Gui: fixes a problem that if executing a macro that requires user-interaction this is blocked
This commit is contained in:
@@ -45,7 +45,6 @@
|
||||
#include "Macro.h"
|
||||
#include "MainWindow.h"
|
||||
#include "PythonEditor.h"
|
||||
#include "WaitCursor.h"
|
||||
|
||||
|
||||
using namespace Gui;
|
||||
@@ -387,7 +386,7 @@ void DlgMacroExecuteImp::accept()
|
||||
|
||||
QFileInfo fi(dir, item->text(0));
|
||||
try {
|
||||
WaitCursor wc;
|
||||
getMainWindow()->setCursor(Qt::WaitCursor);
|
||||
PythonTracingLocker tracelock(watcher->getTrace());
|
||||
|
||||
getMainWindow()->appendRecentMacro(fi.filePath());
|
||||
@@ -395,12 +394,14 @@ void DlgMacroExecuteImp::accept()
|
||||
// after macro run recalculate the document
|
||||
if (Application::Instance->activeDocument())
|
||||
Application::Instance->activeDocument()->getDocument()->recompute();
|
||||
getMainWindow()->unsetCursor();
|
||||
}
|
||||
catch (const Base::SystemExitException&) {
|
||||
// handle SystemExit exceptions
|
||||
Base::PyGILStateLocker locker;
|
||||
Base::PyException e;
|
||||
e.ReportException();
|
||||
getMainWindow()->unsetCursor();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -650,15 +650,17 @@ void PythonEditorView::executeScript()
|
||||
if (EditorView::onHasMsg("Save"))
|
||||
EditorView::onMsg("Save", nullptr);
|
||||
try {
|
||||
WaitCursor wc;
|
||||
getMainWindow()->setCursor(Qt::WaitCursor);
|
||||
PythonTracingLocker tracelock(watcher->getTrace());
|
||||
Application::Instance->macroManager()->run(Gui::MacroManager::File,fileName().toUtf8());
|
||||
getMainWindow()->unsetCursor();
|
||||
}
|
||||
catch (const Base::SystemExitException&) {
|
||||
// handle SystemExit exceptions
|
||||
Base::PyGILStateLocker locker;
|
||||
Base::PyException e;
|
||||
e.ReportException();
|
||||
getMainWindow()->unsetCursor();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user