From 6fee2cda220af26d3ed56571b854f34fed3e402c Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Wed, 22 Jan 2020 12:46:45 +0100 Subject: [PATCH] Start: Added settings button and allow to turn tips off --- src/Mod/Start/Gui/DlgStartPreferences.ui | 34 ++- src/Mod/Start/Gui/DlgStartPreferencesImp.cpp | 2 + src/Mod/Start/StartPage/CMakeLists.txt | 2 + src/Mod/Start/StartPage/OpenSettings.py | 24 ++ src/Mod/Start/StartPage/StartPage.css | 10 +- src/Mod/Start/StartPage/StartPage.html | 7 +- src/Mod/Start/StartPage/StartPage.py | 6 + src/Mod/Start/StartPage/images/settings.png | Bin 0 -> 1637 bytes src/Mod/Start/StartPage/images/settings.svg | 231 +++++++++++++++++++ 9 files changed, 309 insertions(+), 7 deletions(-) create mode 100644 src/Mod/Start/StartPage/OpenSettings.py create mode 100644 src/Mod/Start/StartPage/images/settings.png create mode 100644 src/Mod/Start/StartPage/images/settings.svg diff --git a/src/Mod/Start/Gui/DlgStartPreferences.ui b/src/Mod/Start/Gui/DlgStartPreferences.ui index cdddf625e6..dfe30aa62a 100644 --- a/src/Mod/Start/Gui/DlgStartPreferences.ui +++ b/src/Mod/Start/Gui/DlgStartPreferences.ui @@ -7,7 +7,7 @@ 0 0 482 - 769 + 795 @@ -146,6 +146,32 @@ + + + + Show tips + + + + + + + Qt::RightToLeft + + + + + + true + + + ShowTips + + + Mod/Start + + + @@ -545,12 +571,12 @@ - - Qt::RightToLeft - If this is selected, the 'New File' icon shows a gradient icon instead of the normal icon + + Qt::RightToLeft + diff --git a/src/Mod/Start/Gui/DlgStartPreferencesImp.cpp b/src/Mod/Start/Gui/DlgStartPreferencesImp.cpp index 8e151c32b9..4bb516bf2d 100644 --- a/src/Mod/Start/Gui/DlgStartPreferencesImp.cpp +++ b/src/Mod/Start/Gui/DlgStartPreferencesImp.cpp @@ -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(); } diff --git a/src/Mod/Start/StartPage/CMakeLists.txt b/src/Mod/Start/StartPage/CMakeLists.txt index 147e4781ce..ef969cf37d 100644 --- a/src/Mod/Start/StartPage/CMakeLists.txt +++ b/src/Mod/Start/StartPage/CMakeLists.txt @@ -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 diff --git a/src/Mod/Start/StartPage/OpenSettings.py b/src/Mod/Start/StartPage/OpenSettings.py new file mode 100644 index 0000000000..3714ffd327 --- /dev/null +++ b/src/Mod/Start/StartPage/OpenSettings.py @@ -0,0 +1,24 @@ +#*************************************************************************** +#* * +#* Copyright (c) 2020 Yorik van Havre * +#* * +#* 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") diff --git a/src/Mod/Start/StartPage/StartPage.css b/src/Mod/Start/StartPage/StartPage.css index 9f4d9037c5..d2b8868407 100644 --- a/src/Mod/Start/StartPage/StartPage.css +++ b/src/Mod/Start/StartPage/StartPage.css @@ -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; } diff --git a/src/Mod/Start/StartPage/StartPage.html b/src/Mod/Start/StartPage/StartPage.html index ca3b28fd29..346eedff7e 100644 --- a/src/Mod/Start/StartPage/StartPage.html +++ b/src/Mod/Start/StartPage/StartPage.html @@ -9,7 +9,12 @@
-
VERSIONSTRING
+
+ VERSIONSTRING + + + +
  • T_DOCUMENTS
  • diff --git a/src/Mod/Start/StartPage/StartPage.py b/src/Mod/Start/StartPage/StartPage.py index 76e94c3a5c..59832d82f4 100644 --- a/src/Mod/Start/StartPage/StartPage.py +++ b/src/Mod/Start/StartPage/StartPage.py @@ -303,6 +303,11 @@ def handle(): ALTCSS = encode(f.read()) HTML = HTML.replace("","") + # 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) diff --git a/src/Mod/Start/StartPage/images/settings.png b/src/Mod/Start/StartPage/images/settings.png new file mode 100644 index 0000000000000000000000000000000000000000..838f8eb8a03356ce538daba4f34584b5d8aeb799 GIT binary patch literal 1637 zcmV-r2AcVaP)#9WK~zYIja6N26WJL(Gjlz5{4*Zgi3!+aJ94xniVz0WAT=@p zIZ&md0(Q3)sRD|K`mnq2t8LZxl~#S|%SO;5WcpAkQ1MWe7NHf{08x+%LJh)@gn;ew zk75hQGZV+ojAw42vIH$e7$%;}<;pwZ zay!{12*MX5BO@c{&!4xit*y~~KCh^%`e-Lyb|;&7oOD2if6QIwT%IP7N_=JzK~oL~XKZntB0cGk|a z>|7uaDEWN8KM+E0jE;`>mCNN*4u_+ms_K*VnBScu91efta=HFCHa5m*G8toXauNXk z$+GOeg9i_WPo6yKFbo46$DvlM(R4a()a!Nb*s){g@bEBC2*J|Q62`~JmvgzCe@lX% zo}Rytj*gxl9312Tz_KhXEG*DKAix9y0hp!(?oA?FXQ!kq3b#*rLf!W;CUYHb{m?eq19^P z{rmSY3axe<>7+)Z|d})?SB}xck zJ3BjJSr!_N1_VLC{QSI?$z=W^%kuS&3CITnLVhpJ{?Kg+W0zHm6~FBA&3?Oen-oz9bjAbgxmCb?Ft zg^rF6T)TFywY0SKr+hyDv8t-yYMM4#uh+*pj&sh>&;MX(Xo%EmHSF252bD_2RjE|I z^!xqi1VNAlK~R`zG`gEo`U^tH=b|Wfo;`b(_xt^fVHl{@YPfOZ#@xGi@A?7IO%`Wj zu~_EPrAvKow;QHuA`l3`vMf}qRlIod!knI-UM7}hEgU|4m<$aK*+o%AtJT8t@-jqG zL@t*zbzQ%;O>h99?RI-2pU?j~kw}om#YGef1qgxwNs^FECb`FtAG-;|FzoT;$L)j= zRI61qn@w1j1wjzDSa};Tlv0LL3Y*P_-Me=~6h&04RZLG$uTe@Z!Z3{T@Zm!~kw|ds z&QKHutyT+?Byl{?p9S#S?XHLr@-s=2xRsR^L?RJXDiwP3=1sj`uU9FhUlT&ooXh2! z%;j>m=g*%9CMPHTilP_?4jdrWY88?s;nk~GE|z7zs;YjoF?b{rxe^Qpf0Rn4h%Czp zg+jP~{kl=F*MBa{@-G!dd0em8S3Zy*4u}0Vn{DRe#fu-U7tZZ=Bb`pSs?}=FFpOIa z!%#xVxnM9Dxp3ivqgJb7UBQ(rS4=`kXEvLyZ)a1es@fDq@kl5X>hJFEW)>G0!Sg(h z9z9B8u~=tUS68y9rzbf)JlvH^rO49K5*8K~&}cLei^b4vHru6ANl+B!-`ghGwQE<9 z5c20UXU>pfv53{xRS-f@E|=kQxeyA4m|!r-8is*vHVd!U3rUi`bKapthqxzCo*ZyG zowqejd%q=t-|zowaB%R4y}iAhrfKNw>x0ALKsX!*0K9qg25;ZKh1csve}6xU#Uk?g zyfrW|z;tzWp`)V%rfD+yd_JtI>IATg8APK|OiWCy&CSi_D5d|sfB*jJL?S^41_t=2PoJ6qZf$!-q9`_AzkWTk zy1I(nw{N$L#o{>6^FMAjo6ob^?CDf0MKn!AFc`$0J9ik%vif9M{;SXD`%9@*YR}Hj z?$dSsHyaz?mPZr{g+Apt?wn;=Ulj_4g$=gMkByCmgTWxm~KP00000NkvXXu0mjf`CuGc literal 0 HcmV?d00001 diff --git a/src/Mod/Start/StartPage/images/settings.svg b/src/Mod/Start/StartPage/images/settings.svg new file mode 100644 index 0000000000..691cfd8303 --- /dev/null +++ b/src/Mod/Start/StartPage/images/settings.svg @@ -0,0 +1,231 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + +