Start: Refined display + start with forum disabled

This commit is contained in:
Yorik van Havre
2018-08-18 00:06:33 -03:00
committed by Yorik van Havre
parent 241b79ffd5
commit 256cfcad14
6 changed files with 325 additions and 278 deletions

View File

@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>476</width>
<height>559</height>
<height>581</height>
</rect>
</property>
<property name="windowTitle">
@@ -42,39 +42,23 @@
<string>Start page options</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="1" alignment="Qt::AlignRight">
<widget class="Gui::PrefColorButton" name="colorButton_7">
<property name="enabled">
<bool>false</bool>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>60</height>
</size>
</property>
<item row="11" column="1">
<widget class="Gui::PrefFileChooser" name="fileChooser_3">
<property name="toolTip">
<string>the down gradient for the background color (currently unsupported)</string>
</property>
<property name="color">
<color>
<red>127</red>
<green>158</green>
<blue>181</blue>
</color>
<string>an optional custom folder to be displayed at the bottom of the first page</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>BackgroundColor2</cstring>
<cstring>ShowCustomFolder</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Start</cstring>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_8">
<item row="11" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Link color</string>
<string>Show additional folder</string>
</property>
</widget>
</item>
@@ -104,132 +88,6 @@
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Box background color</string>
</property>
</widget>
</item>
<item row="8" column="1" alignment="Qt::AlignRight">
<widget class="Gui::PrefColorButton" name="colorButton_6">
<property name="maximumSize">
<size>
<width>60</width>
<height>60</height>
</size>
</property>
<property name="toolTip">
<string>the color of the links</string>
</property>
<property name="color">
<color>
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</property>
<property name="prefEntry" stdset="0">
<cstring>LinkColor</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Start</cstring>
</property>
</widget>
</item>
<item row="4" column="1" alignment="Qt::AlignRight">
<widget class="Gui::PrefColorButton" name="colorButton_2">
<property name="maximumSize">
<size>
<width>60</width>
<height>60</height>
</size>
</property>
<property name="toolTip">
<string>the color of the version text</string>
</property>
<property name="color">
<color>
<red>255</red>
<green>251</green>
<blue>247</blue>
</color>
</property>
<property name="prefEntry" stdset="0">
<cstring>BackgroundTextColor</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Start</cstring>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Background image</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Background color</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Page text color</string>
</property>
</widget>
</item>
<item row="6" column="1" alignment="Qt::AlignRight">
<widget class="Gui::PrefColorButton" name="colorButton_4">
<property name="maximumSize">
<size>
<width>60</width>
<height>60</height>
</size>
</property>
<property name="toolTip">
<string>the color of the text on he main pages</string>
</property>
<property name="color">
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</property>
<property name="prefEntry" stdset="0">
<cstring>PageTextColor</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Start</cstring>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="Gui::PrefFileChooser" name="fileChooser_2">
<property name="toolTip">
<string>an optional image to display as background</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>BackgroundImage</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Start</cstring>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Page background color</string>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
@@ -237,75 +95,10 @@
</property>
</widget>
</item>
<item row="11" column="1">
<widget class="Gui::PrefFileChooser" name="fileChooser_3">
<property name="toolTip">
<string>an optional custom folder to be displayed at the bottom of the first page</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>ShowCustomFolder</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Start</cstring>
</property>
</widget>
</item>
<item row="11" column="0">
<widget class="QLabel" name="label_10">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Show additional folder</string>
</property>
</widget>
</item>
<item row="7" column="1" alignment="Qt::AlignRight">
<widget class="Gui::PrefColorButton" name="colorButton_5">
<property name="maximumSize">
<size>
<width>60</width>
<height>60</height>
</size>
</property>
<property name="toolTip">
<string>the background color of the boxes inside the pages</string>
</property>
<property name="color">
<color>
<red>221</red>
<green>221</green>
<blue>221</blue>
</color>
</property>
<property name="prefEntry" stdset="0">
<cstring>BoxColor</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Start</cstring>
</property>
</widget>
</item>
<item row="0" column="1" alignment="Qt::AlignRight">
<widget class="Gui::PrefColorButton" name="colorButton_1">
<property name="maximumSize">
<size>
<width>60</width>
<height>60</height>
</size>
</property>
<property name="toolTip">
<string>the background color behind the panels</string>
</property>
<property name="color">
<color>
<red>79</red>
<green>88</green>
<blue>116</blue>
</color>
</property>
<property name="prefEntry" stdset="0">
<cstring>BackgroundColor1</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Start</cstring>
<string>Background color</string>
</property>
</widget>
</item>
@@ -348,6 +141,250 @@
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_12">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Background color gradient down</string>
</property>
</widget>
</item>
<item row="4" column="1" alignment="Qt::AlignRight">
<widget class="Gui::PrefColorButton" name="colorButton_2">
<property name="maximumSize">
<size>
<width>60</width>
<height>60</height>
</size>
</property>
<property name="toolTip">
<string>the color of the version text</string>
</property>
<property name="color">
<color>
<red>255</red>
<green>251</green>
<blue>247</blue>
</color>
</property>
<property name="prefEntry" stdset="0">
<cstring>BackgroundTextColor</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Start</cstring>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Link color</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="Gui::PrefFileChooser" name="fileChooser_2">
<property name="toolTip">
<string>an optional image to display as background</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>BackgroundImage</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Start</cstring>
</property>
</widget>
</item>
<item row="13" column="0">
<widget class="QLabel" name="autoModuleLabel">
<property name="text">
<string>Switch workbench after loafing</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Page background color</string>
</property>
</widget>
</item>
<item row="6" column="1" alignment="Qt::AlignRight">
<widget class="Gui::PrefColorButton" name="colorButton_4">
<property name="maximumSize">
<size>
<width>60</width>
<height>60</height>
</size>
</property>
<property name="toolTip">
<string>the color of the text on he main pages</string>
</property>
<property name="color">
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</property>
<property name="prefEntry" stdset="0">
<cstring>PageTextColor</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Start</cstring>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Background image</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Page text color</string>
</property>
</widget>
</item>
<item row="13" column="1">
<widget class="QComboBox" name="AutoloadModuleCombo"/>
</item>
<item row="8" column="1" alignment="Qt::AlignRight">
<widget class="Gui::PrefColorButton" name="colorButton_6">
<property name="maximumSize">
<size>
<width>60</width>
<height>60</height>
</size>
</property>
<property name="toolTip">
<string>the color of the links</string>
</property>
<property name="color">
<color>
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</property>
<property name="prefEntry" stdset="0">
<cstring>LinkColor</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Start</cstring>
</property>
</widget>
</item>
<item row="7" column="1" alignment="Qt::AlignRight">
<widget class="Gui::PrefColorButton" name="colorButton_5">
<property name="maximumSize">
<size>
<width>60</width>
<height>60</height>
</size>
</property>
<property name="toolTip">
<string>the background color of the boxes inside the pages</string>
</property>
<property name="color">
<color>
<red>221</red>
<green>221</green>
<blue>221</blue>
</color>
</property>
<property name="prefEntry" stdset="0">
<cstring>BoxColor</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Start</cstring>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Box background color</string>
</property>
</widget>
</item>
<item row="0" column="1" alignment="Qt::AlignRight">
<widget class="Gui::PrefColorButton" name="colorButton_1">
<property name="maximumSize">
<size>
<width>60</width>
<height>60</height>
</size>
</property>
<property name="toolTip">
<string>the background color behind the panels</string>
</property>
<property name="color">
<color>
<red>79</red>
<green>88</green>
<blue>116</blue>
</color>
</property>
<property name="prefEntry" stdset="0">
<cstring>BackgroundColor1</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Start</cstring>
</property>
</widget>
</item>
<item row="1" column="1" alignment="Qt::AlignRight">
<widget class="Gui::PrefColorButton" name="colorButton_7">
<property name="enabled">
<bool>false</bool>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>60</height>
</size>
</property>
<property name="toolTip">
<string>the down gradient for the background color (currently unsupported)</string>
</property>
<property name="color">
<color>
<red>127</red>
<green>158</green>
<blue>181</blue>
</color>
</property>
<property name="prefEntry" stdset="0">
<cstring>BackgroundColor2</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Start</cstring>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="label_7">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Open links</string>
</property>
</widget>
</item>
<item row="14" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Close start page after loading</string>
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="Gui::PrefCheckBox" name="checkBox_1">
<property name="toolTip">
@@ -377,44 +414,7 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_12">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Background color gradient down</string>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="label_7">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Open links</string>
</property>
</widget>
</item>
<item row="12" column="0">
<widget class="QLabel" name="autoModuleLabel">
<property name="text">
<string>Switch workbench after loafing</string>
</property>
</widget>
</item>
<item row="12" column="1">
<widget class="QComboBox" name="AutoloadModuleCombo"/>
</item>
<item row="13" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Close start page after loading</string>
</property>
</widget>
</item>
<item row="13" column="1">
<item row="14" column="1">
<widget class="Gui::PrefCheckBox" name="checkBox_2">
<property name="toolTip">
<string>Should the start page be closed after loading?</string>
@@ -433,14 +433,14 @@
</property>
</widget>
</item>
<item row="14" column="0">
<item row="15" column="0">
<widget class="QLabel" name="label_13">
<property name="text">
<string>Apply on start with opening</string>
<string>Close &amp; switch on file open</string>
</property>
</widget>
</item>
<item row="14" column="1">
<item row="15" column="1">
<widget class="Gui::PrefCheckBox" name="checkBox_3">
<property name="toolTip">
<string>If FreeCAD is started by opening a file, apply the two settings above</string>
@@ -459,6 +459,32 @@
</property>
</widget>
</item>
<item row="12" column="0">
<widget class="QLabel" name="label_14">
<property name="text">
<string>Show forum</string>
</property>
</widget>
</item>
<item row="12" column="1">
<widget class="Gui::PrefCheckBox" name="checkBox_4">
<property name="toolTip">
<string>If this is checked, the latest posts from the FreeCAD forum will be displayed on the Activity tab</string>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string/>
</property>
<property name="prefEntry" stdset="0">
<cstring>ShowForum</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Start</cstring>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View File

@@ -94,6 +94,7 @@ void DlgStartPreferencesImp::saveSettings()
checkBox_1->onSave();
checkBox_2->onSave();
checkBox_3->onSave();
checkBox_4->onSave();
}
void DlgStartPreferencesImp::loadSettings()
@@ -118,6 +119,7 @@ void DlgStartPreferencesImp::loadSettings()
checkBox_1->onRestore();
checkBox_2->onRestore();
checkBox_3->onRestore();
checkBox_4->onRestore();
}
/**

View File

@@ -113,6 +113,10 @@ ul.icons {
max-width: 24px;
max-height: 24px;
}
.forumbox img {
max-width: 100% !important;
max-height: 100% !important;
}
.allwidth {
max-width: 98%;
}
@@ -148,3 +152,7 @@ ul.workbenches li, ul.addonslist li {
.forum ul {
padding: 10px;
}
.forumbox {
margin-top: 20px;
display: none; /* forumbox */
}

View File

@@ -95,16 +95,16 @@
</div>
<div class="footnote">
<p><b>TIP</b>: T_OFFLINEHELP</p>
<p><b>T_TIP</b>: T_OFFLINEHELP</p>
</div>
</div>
<div id="tab3" class="panel tab3 hidden">
<div class="docbox allwidth">
<h2>T_RECENTCOMMITS</h2>
<h2>T_RECENTCOMMITS</h2>
<div class="docbox allwidth">
<div class="footnote">T_DESCR_RECENTCOMMITS</div>
@@ -117,13 +117,17 @@
</div>
<div class="docbox allwidth">
<div class="forumbox">
<h2>T_FORUM</h2>
<div class="docbox allwidth">
<div class="footnote">T_DESCR_FORUM</div>
<div id="forum">T_OFFLINEPLACEHOLDER</div>
<div class="footnote">T_DESCR_FORUM</div>
<div id="forum">T_OFFLINEPLACEHOLDER</div>
</div>
</div>

View File

@@ -1,5 +1,5 @@
var allowDownloads = 0;
var showForum = 0;
function toggle(tab) {
@@ -36,13 +36,15 @@ function load() {
tobj.buildScriptTag(); // Build the script tag
tobj.addScriptTag(); // Execute (add) the script tag
ddiv.innerHTML = "Downloading addons list...";
// load forum recent posts
ddiv = document.getElementById("forum");
ddiv.innerHTML = "Connecting...";
var tobj=new JSONscriptRequest('https://api.rss2json.com/v1/api.json?rss_url=https%3A%2F%2Fforum.freecadweb.org%2Ffeed.php&api_key=s9yqcsrevp9irkqworzmvnrjs4jotjac2g4ybs95&callback=printForum');
tobj.buildScriptTag(); // Build the script tag
tobj.addScriptTag(); // Execute (add) the script tag
ddiv.innerHTML = "Downloading addons list...";
if (showForum == 1) {
// load forum recent posts
ddiv = document.getElementById("forum");
ddiv.innerHTML = "Connecting...";
var tobj=new JSONscriptRequest('https://www.freecadweb.org/xml-to-json.php?callback=printForum&url=https://forum.freecadweb.org/feed.php');
tobj.buildScriptTag(); // Build the script tag
tobj.addScriptTag(); // Execute (add) the script tag
ddiv.innerHTML = "Downloading addons list...";
}
}
}
@@ -88,8 +90,8 @@ function printForum(data) {
ddiv.innerHTML = "Received";
var html = ['<ul>'];
for (var i = 0; i < 25; i++) {
if (i < data.items.length){
html.push('<li><a href="', data.items[i].link, '">', data.items[i].title, '</a><br/><p>', data.items[i].content,'</p></li>');
if (i < data.feed.entry.length){
html.push('<li><big><a href="', data.feed.entry[i].link.href, '">', data.feed.entry[i].title.$, '</a></big><br/><p>', data.feed.entry[i].content.$,'</p></li>');
}
}
html.push('</ul>');

View File

@@ -329,7 +329,7 @@ def handle():
UL_WORKBENCHES = '<ul class="workbenches">'
FreeCAD.getResourceDir()
for wb in FreeCADGui.listWorkbenches().keys():
for wb in sorted(FreeCADGui.listWorkbenches().keys()):
if wb.endswith("Workbench"):
wn = wb[:-9]
if wb in iconbank:
@@ -353,7 +353,7 @@ def handle():
iconbank[wb] = img
UL_WORKBENCHES += '<li><h3>'
UL_WORKBENCHES += '<img src="'+iconbank[wb]+'">'
UL_WORKBENCHES += '<a href="https://www.freecadweb.org/wiki/'+wn+'_Workbench">'+wn+'</a>'
UL_WORKBENCHES += '<a href="https://www.freecadweb.org/wiki/'+wn+'_Workbench">'+wn.replace("ReverseEngineering","ReverseEng")+'</a>'
UL_WORKBENCHES += '</h3></li>'
UL_WORKBENCHES += '</ul>'
HTML = HTML.replace("UL_WORKBENCHES",UL_WORKBENCHES)
@@ -390,6 +390,11 @@ def handle():
if FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Start").GetBool("AllowDownload",False):
HTML = HTML.replace("var allowDownloads = 0;","var allowDownloads = 1;")
# enable or disable forum
if FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Start").GetBool("ShowForum",False):
HTML = HTML.replace("var showForum = 0;","var showForum = 1;")
HTML = HTML.replace("display: none; /* forumbox */","display: block; /* forumbox */")
# encode if necessary