From c07fe542d7efd33ef6943b019222d842739d2211 Mon Sep 17 00:00:00 2001 From: Markus Lampert Date: Sat, 17 Jun 2017 13:46:11 -0700 Subject: [PATCH] Forward modifyStandardButtons into python task dialogs. --- src/Gui/TaskView/TaskDialogPython.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Gui/TaskView/TaskDialogPython.cpp b/src/Gui/TaskView/TaskDialogPython.cpp index 72a3fdeeba..bbafe006c4 100644 --- a/src/Gui/TaskView/TaskDialogPython.cpp +++ b/src/Gui/TaskView/TaskDialogPython.cpp @@ -428,8 +428,24 @@ QDialogButtonBox::StandardButtons TaskDialogPython::getStandardButtons(void) con return TaskDialog::getStandardButtons(); } -void TaskDialogPython::modifyStandardButtons(QDialogButtonBox*) +void TaskDialogPython::modifyStandardButtons(QDialogButtonBox *buttonBox) { + Base::PyGILStateLocker lock; + try { + if (dlg.hasAttr(std::string("modifyStandardButtons"))) { + Gui::PythonWrapper wrap; + wrap.loadGuiModule(); + wrap.loadWidgetsModule(); + Py::Callable method(dlg.getAttr(std::string("modifyStandardButtons"))); + Py::Tuple args(1); + args.setItem(0, wrap.fromQWidget(buttonBox, "QDialogButtonBox")); + method.apply(args); + } + } + catch (Py::Exception&) { + Base::PyException e; // extract the Python error text + e.ReportException(); + } } bool TaskDialogPython::isAllowedAlterDocument(void) const