Gui: fixes a problem that if executing a macro that requires user-interaction this is blocked

This commit is contained in:
wmayer
2023-10-11 13:42:02 +02:00
committed by wwmayer
parent 5b1ccf895a
commit fbc447ad4b
2 changed files with 6 additions and 3 deletions

View File

@@ -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();
}
}

View File

@@ -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();
}
}