From fbc447ad4b62fb97d95a12eaa1f85b41c42112d3 Mon Sep 17 00:00:00 2001 From: wmayer Date: Wed, 11 Oct 2023 13:42:02 +0200 Subject: [PATCH] Gui: fixes a problem that if executing a macro that requires user-interaction this is blocked --- src/Gui/DlgMacroExecuteImp.cpp | 5 +++-- src/Gui/EditorView.cpp | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Gui/DlgMacroExecuteImp.cpp b/src/Gui/DlgMacroExecuteImp.cpp index a0a2a433df..11781d4ef8 100644 --- a/src/Gui/DlgMacroExecuteImp.cpp +++ b/src/Gui/DlgMacroExecuteImp.cpp @@ -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(); } } diff --git a/src/Gui/EditorView.cpp b/src/Gui/EditorView.cpp index cf031d0f61..409d137aab 100644 --- a/src/Gui/EditorView.cpp +++ b/src/Gui/EditorView.cpp @@ -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(); } }