+ issue: #0002350, handle Python's SystemExit exceptions and do not exit application when running from macro dialog or Python editor

This commit is contained in:
wmayer
2015-12-27 23:00:59 +01:00
parent ad5d7f7880
commit b45f321f9c
3 changed files with 54 additions and 36 deletions

View File

@@ -51,6 +51,7 @@
#include <Base/Interpreter.h>
#include <Base/Parameter.h>
#include <Base/Exception.h>
using namespace Gui;
namespace Gui {
@@ -559,7 +560,15 @@ void PythonEditorView::executeScript()
// always save the macro when it is modified
if (EditorView::onHasMsg("Save"))
EditorView::onMsg("Save", 0);
Application::Instance->macroManager()->run(Gui::MacroManager::File,fileName().toUtf8());
try {
Application::Instance->macroManager()->run(Gui::MacroManager::File,fileName().toUtf8());
}
catch (const Base::SystemExitException&) {
// handle SystemExit exceptions
Base::PyGILStateLocker locker;
Base::PyException e;
e.ReportException();
}
}
void PythonEditorView::startDebug()