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 783f505516
commit 58ab713eb5
9 changed files with 309 additions and 7 deletions

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