Start: Added settings button and allow to turn tips off

This commit is contained in:
Yorik van Havre
2020-01-22 12:46:45 +01:00
parent 4ea3007776
commit 6fee2cda22
9 changed files with 309 additions and 7 deletions

View File

@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>482</width>
<height>769</height>
<height>795</height>
</rect>
</property>
<property name="windowTitle">
@@ -146,6 +146,32 @@
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_19">
<property name="text">
<string>Show tips</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="Gui::PrefCheckBox" name="checkBox_7">
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string/>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>ShowTips</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Start</cstring>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@@ -545,12 +571,12 @@
</item>
<item row="12" column="1">
<widget class="Gui::PrefCheckBox" name="checkBox_6">
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="toolTip">
<string>If this is selected, the 'New File' icon shows a gradient icon instead of the normal icon</string>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string/>
</property>

View File

@@ -110,6 +110,7 @@ void DlgStartPreferencesImp::saveSettings()
ui->checkBox_4->onSave();
ui->checkBox_5->onSave();
ui->checkBox_6->onSave();
ui->checkBox_7->onSave();
ui->lineEdit->onSave();
ui->spinBox->onSave();
}
@@ -140,6 +141,7 @@ void DlgStartPreferencesImp::loadSettings()
ui->checkBox_4->onRestore();
ui->checkBox_5->onRestore();
ui->checkBox_6->onRestore();
ui->checkBox_7->onRestore();
ui->lineEdit->onRestore();
ui->spinBox->onRestore();
}

View File

@@ -14,6 +14,7 @@ SET(StartPage_PythonResources
StartPage.js
StartPage.html
EnableDownload.py
OpenSettings.py
)
SET(StartPage_ImageResources
@@ -24,6 +25,7 @@ SET(StartPage_ImageResources
images/freecad.png
images/installed.png
images/new_file_thumbnail.svg
images/settings.png
)
SET(StartPage_Resources

View File

@@ -0,0 +1,24 @@
#***************************************************************************
#* *
#* Copyright (c) 2020 Yorik van Havre <yorik@uncreated.net> *
#* *
#* This program is free software; you can redistribute it and/or modify *
#* it under the terms of the GNU Lesser General Public License (LGPL) *
#* as published by the Free Software Foundation; either version 2 of *
#* the License, or (at your option) any later version. *
#* for detail see the LICENCE text file. *
#* *
#* This program is distributed in the hope that it will be useful, *
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
#* GNU Library General Public License for more details. *
#* *
#* You should have received a copy of the GNU Library General Public *
#* License along with this program; if not, write to the Free Software *
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
#* USA *
#* *
#***************************************************************************
import FreeCADGui
FreeCADGui.showPreferences("Start")

View File

@@ -27,7 +27,13 @@ hr {
.version {
font-size: 0.8em;
float: right;
padding-right: 40px;
padding-right: 10px;
}
.settingsicon {
width: 16px;
height: 16px;
margin-left: 20px;
vertical-align:middle;
}
.container {
margin: 2%
@@ -152,7 +158,7 @@ h3 a {
}
.footnote {
text-align: center;
display: block;
display: block; /* footnote tips display */
clear: both;
padding-top: 10px;
}

View File

@@ -9,7 +9,12 @@
<body onload="load()">
<div class="container">
<div class="title">
<div class="version">VERSIONSTRING</div>
<div class="version">
VERSIONSTRING
<a href="OpenSettings.py">
<img class="settingsicon" src="IMAGE_SRC_SETTINGS">
</a>
</div>
</div>
<ul id="tabs" class="tabs">
<li><a id="htab1" class="active" onClick="toggle('tab1')" href="#">T_DOCUMENTS</a></li>

View File

@@ -303,6 +303,11 @@ def handle():
ALTCSS = encode(f.read())
HTML = HTML.replace("<!--QSS-->","<style type=\"text/css\">"+ALTCSS+"</style>")
# turn tips off if needed
if not FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Start").GetBool("ShowTips",True):
HTML = HTML.replace("display: block; /* footnote tips display */","display: none; /* footnote tips display */")
# get FreeCAD version
v = FreeCAD.Version()
@@ -394,6 +399,7 @@ def handle():
HTML = HTML.replace("IMAGE_SRC_POWERHUB",'file:///'+os.path.join(resources_dir, 'images/poweruserhub.png'))
HTML = HTML.replace("IMAGE_SRC_DEVHUB",'file:///'+os.path.join(resources_dir, 'images/developerhub.png'))
HTML = HTML.replace("IMAGE_SRC_MANUAL",'file:///'+os.path.join(resources_dir, 'images/manual.png'))
HTML = HTML.replace("IMAGE_SRC_SETTINGS",'file:///'+os.path.join(resources_dir, 'images/settings.png'))
imagepath= 'file:///'+os.path.join(resources_dir, 'images/installed.png')
imagepath = imagepath.replace('\\','/') # replace Windows backslash with slash to make the path javascript compatible
HTML = HTML.replace("IMAGE_SRC_INSTALLED",imagepath)

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 9.2 KiB