Start: Allow to not show start page on file open

This commit is contained in:
Yorik van Havre
2018-08-09 17:04:50 -03:00
committed by Yorik van Havre
parent 36cd5a55cf
commit 1007c822d6
5 changed files with 46 additions and 6 deletions

View File

@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>476</width>
<height>533</height>
<height>559</height>
</rect>
</property>
<property name="windowTitle">
@@ -433,6 +433,32 @@
</property>
</widget>
</item>
<item row="14" column="0">
<widget class="QLabel" name="label_13">
<property name="text">
<string>Apply on start with opening</string>
</property>
</widget>
</item>
<item row="14" 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>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string/>
</property>
<property name="prefEntry" stdset="0">
<cstring>DoNotShowOnOpen</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Start</cstring>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View File

@@ -93,6 +93,7 @@ void DlgStartPreferencesImp::saveSettings()
radioButton_2->onSave();
checkBox_1->onSave();
checkBox_2->onSave();
checkBox_3->onSave();
}
void DlgStartPreferencesImp::loadSettings()
@@ -116,6 +117,7 @@ void DlgStartPreferencesImp::loadSettings()
radioButton_2->onRestore();
checkBox_1->onRestore();
checkBox_2->onRestore();
checkBox_3->onRestore();
}
/**

View File

@@ -73,7 +73,7 @@ void StartGui::Workbench::activated()
QByteArray utf8Title = title.toUtf8();
QByteArray cmd;
QTextStream str(&cmd);
str << "import WebGui" << endl;
str << "import WebGui,sys,Start" << endl;
str << "from StartPage import StartPage" << endl;
str << endl;
str << "class WebPage(object):" << endl;
@@ -101,6 +101,7 @@ void StartGui::Workbench::activated()
str << " self.pargrp.Detach(self.webPage)" << endl;
str << endl;
str << "webView=WebView()" << endl;
str << "StartPage.checkPostOpenStartPage()" << endl;
Base::Interpreter().runString(cmd);
// Gui::Command::runCommand(Gui::Command::Gui, cmd);

View File

@@ -31,7 +31,7 @@ FreeCADGui.addLanguagePath(":/translations")
FreeCADGui.updateLocale()
iconprovider = QtGui.QFileIconProvider()
iconbank = {} # to store already created icons
iconbank = {} # to store already created icons so we don't overpollute the temp dir
def gethexcolor(color):
@@ -55,7 +55,7 @@ def isplainfile(filename):
if basename.startswith("."):
return False
if basename[-1].isdigit():
if basename[-7:-1].lower() == "fcstd":
if basename[-7:-1].lower() == "fcstd": # freecad backup file
return False
if basename.endswith("~"):
return False
@@ -373,7 +373,7 @@ def handle():
TEXTCOLOR = gethexcolor(p.GetUnsigned("PageTextColor",255))
BGTCOLOR = gethexcolor(p.GetUnsigned("BackgroundTextColor",4294703103))
SHADOW = "#888888"
if QtGui.QColor(BASECOLOR).valueF() < 0.5: # dark page
if QtGui.QColor(BASECOLOR).valueF() < 0.5: # dark page - we need to make darker shadows
SHADOW = "#000000"
HTML = HTML.replace("BASECOLOR",BASECOLOR)
@@ -436,3 +436,14 @@ def postStart():
subw.close()
def checkPostOpenStartPage():
"on Start WB startup, check if we are loading a file and therefore need to close the StartPage"
import Start
if FreeCAD.ParamGet('User parameter:BaseApp/Preferences/Mod/Start').GetBool('DoNotShowOnOpen',False) and (not hasattr(Start,'CanOpenStartPage')):
if len(sys.argv) > 1:
postStart()
Start.CanOpenStartPage = True

File diff suppressed because one or more lines are too long