diff --git a/src/Gui/DlgSettingsMacro.ui b/src/Gui/DlgSettingsMacro.ui index 75d84a396..e22998a27 100644 --- a/src/Gui/DlgSettingsMacro.ui +++ b/src/Gui/DlgSettingsMacro.ui @@ -1,45 +1,62 @@ - - - - + + Gui::Dialog::DlgSettingsMacro - - + + 0 0 - 384 - 388 + 391 + 407 - + Macro - - - 9 - - - 6 - - - - + + + + + General macro settings + + + + + + Run macros in local environment + + + true + + + LocalEnvironment + + + Macro + + + + + + + + + Macro recording settings - - + + 9 - + 6 - + - + Qt::Vertical - + 20 40 @@ -47,56 +64,56 @@ - - - + + + Logging Commands - - - 11 - - + + 6 + + 11 + - - + + Show script commands in python console - - true - - + + true + + ScriptToPyConsole - + Macro - - + + Log all commands issued by menus to file: - + ScriptToFile - + Macro - - + + FullScript.FCScript - + ScriptFile - + Macro @@ -104,46 +121,46 @@ - - - + + + Gui commands - - + + 11 - + 6 - - - + + + Recording GUI commands - + true - + RecordGui - + Macro - - - + + + Record as comment - + true - + GuiAsComment - + Macro @@ -151,27 +168,27 @@ - - - + + + Macro path - - + + 11 - + 6 - - - + + + Gui::FileChooser::Directory - + MacroPath - + Macro @@ -184,21 +201,22 @@ - + - Gui::PrefCheckBox - QCheckBox -
Gui/PrefWidgets.h
- 0 - + Gui::FileChooser + QWidget +
Gui/FileDialog.h
Gui::PrefFileChooser Gui::FileChooser
Gui/PrefWidgets.h
- 0 - +
+ + Gui::PrefCheckBox + QCheckBox +
Gui/PrefWidgets.h
@@ -209,11 +227,11 @@ PrefCheckBox_GuiAsComment setEnabled(bool) - + 20 20 - + 20 20 diff --git a/src/Gui/DlgSettingsMacroImp.cpp b/src/Gui/DlgSettingsMacroImp.cpp index bccacfd7f..ce79fba28 100644 --- a/src/Gui/DlgSettingsMacroImp.cpp +++ b/src/Gui/DlgSettingsMacroImp.cpp @@ -54,6 +54,7 @@ DlgSettingsMacroImp::~DlgSettingsMacroImp() void DlgSettingsMacroImp::saveSettings() { + PrefCheckBox_LocalEnv->onSave(); MacroPath->onSave(); PrefCheckBox_RecordGui->onSave(); PrefCheckBox_GuiAsComment->onSave(); @@ -64,6 +65,7 @@ void DlgSettingsMacroImp::saveSettings() void DlgSettingsMacroImp::loadSettings() { + PrefCheckBox_LocalEnv->onRestore(); MacroPath->onRestore(); PrefCheckBox_RecordGui->onRestore(); PrefCheckBox_GuiAsComment->onRestore(); diff --git a/src/Gui/Macro.cpp b/src/Gui/Macro.cpp index f0d6658d9..89f9fab1a 100644 --- a/src/Gui/Macro.cpp +++ b/src/Gui/Macro.cpp @@ -71,6 +71,7 @@ void MacroManager::OnChange(Base::Subject &rCaller, const char * sR this->recordGui = this->params->GetBool("RecordGui", true); this->guiAsComment = this->params->GetBool("GuiAsComment", true); this->scriptToPyConsole = this->params->GetBool("ScriptToPyConsole", true); + this->localEnv = this->params->GetBool("LocalEnvironment", true); } void MacroManager::open(MacroType eType,const char *sName) @@ -228,7 +229,7 @@ void MacroManager::run(MacroType eType,const char *sName) PythonRedirector std_out("stdout",pyout); PythonRedirector std_err("stderr",pyerr); //The given path name is expected to be Utf-8 - Base::Interpreter().runFile(sName, true); + Base::Interpreter().runFile(sName, this->localEnv); } catch (const Base::SystemExitException&) { Base::PyGILStateLocker lock; diff --git a/src/Gui/Macro.h b/src/Gui/Macro.h index cba009d2b..bbd4266b1 100644 --- a/src/Gui/Macro.h +++ b/src/Gui/Macro.h @@ -98,6 +98,7 @@ protected: bool recordGui; bool guiAsComment; bool scriptToPyConsole; + bool localEnv; PythonConsole* pyConsole; // link to the python console PythonDebugger* pyDebugger; Base::Reference params; // link to the Macro parameter group