Added <last> as an option to the workbench selection.

This commit is contained in:
Markus Lampert
2019-10-18 22:05:55 -07:00
committed by Yorik van Havre
parent 44be21d1ac
commit d5820329c5
5 changed files with 57 additions and 7 deletions

View File

@@ -54,6 +54,16 @@ DlgStartPreferencesImp::DlgStartPreferencesImp( QWidget* parent )
menuText[text] = *it;
}
{ // add special workbench to selection
QPixmap px = Gui::Application::Instance->workbenchIcon(QString::fromLatin1("NoneWorkbench"));
QString key = QString::fromLatin1("<last>");
QString value = QString::fromLatin1("$LastModule");
if (px.isNull())
AutoloadModuleCombo->addItem(key, QVariant(value));
else
AutoloadModuleCombo->addItem(px, key, QVariant(value));
}
for (QMap<QString, QString>::Iterator it = menuText.begin(); it != menuText.end(); ++it) {
QPixmap px = Gui::Application::Instance->workbenchIcon(it.value());
if (px.isNull())

View File

@@ -567,6 +567,8 @@ def postStart():
# switch workbench
wb = param.GetString("AutoloadModule","")
if "$LastModule" == wb:
wb = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/General").GetString("LastModule","")
if wb:
# don't switch workbenches if we are not in Start anymore
if FreeCADGui.activeWorkbench() and (FreeCADGui.activeWorkbench().name() == "StartWorkbench"):