From 8b45976c8d444080408223706e3000238bcc14db Mon Sep 17 00:00:00 2001 From: looooo Date: Wed, 1 Mar 2017 17:15:19 +0100 Subject: [PATCH] py3: Part: Gui: gathering commits from python3-branch --- src/Mod/Part/AttachmentEditor/Commands.py | 2 +- src/Mod/Part/AttachmentEditor/TaskAttachmentEditor.py | 4 ++-- src/Mod/Part/Gui/AppPartGui.cpp | 6 ++++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Mod/Part/AttachmentEditor/Commands.py b/src/Mod/Part/AttachmentEditor/Commands.py index c88012f855..088d8b55c8 100644 --- a/src/Mod/Part/AttachmentEditor/Commands.py +++ b/src/Mod/Part/AttachmentEditor/Commands.py @@ -83,7 +83,7 @@ class CommandEditAttachment: from PySide import QtGui mb = QtGui.QMessageBox() mb.setIcon(mb.Icon.Warning) - mb.setText(err.message) + mb.setText(str(err)) mb.setWindowTitle("Error") mb.exec_() diff --git a/src/Mod/Part/AttachmentEditor/TaskAttachmentEditor.py b/src/Mod/Part/AttachmentEditor/TaskAttachmentEditor.py index bef4e51d78..e17eddf4d3 100644 --- a/src/Mod/Part/AttachmentEditor/TaskAttachmentEditor.py +++ b/src/Mod/Part/AttachmentEditor/TaskAttachmentEditor.py @@ -40,7 +40,7 @@ except ImportError as err: def getAllDependent(feature): return [] App.Console.PrintWarning("AttachmentEditor: Failed to import some code from Show module. Functionality will be limited.\n") - App.Console.PrintWarning(err.message) + App.Console.PrintWarning(str(err)) if App.GuiUp: import FreeCADGui as Gui @@ -583,7 +583,7 @@ class AttachmentEditorTaskPanel(FrozenClass): # when entering and extiting dialog without changing anything self.obj.Placement = new_plm except Exception as err: - self.form.message.setText(_translate('AttachmentEditor',"Error: {err}",None).format(err= err.message)) + self.form.message.setText(_translate('AttachmentEditor',"Error: {err}",None).format(err= str(err))) if new_plm is not None: self.form.groupBox_superplacement.setTitle(_translate('AttachmentEditor',"Extra placement:",None)) diff --git a/src/Mod/Part/Gui/AppPartGui.cpp b/src/Mod/Part/Gui/AppPartGui.cpp index 9888457bb0..42329b95d6 100644 --- a/src/Mod/Part/Gui/AppPartGui.cpp +++ b/src/Mod/Part/Gui/AppPartGui.cpp @@ -122,8 +122,14 @@ PyMOD_INIT_FUNC(PartGui) Base::Console().Log("Loading GUI of Part module... done\n"); +#if PY_MAJOR_VERSION >= 3 + static struct PyModuleDef pAttachEngineTextsModuleDef = {PyModuleDef_HEAD_INIT,"AttachEngineResources", "AttachEngineResources", -1, 0}; + PyObject* pAttachEngineTextsModule = PyModule_Create(&pAttachEngineTextsModuleDef); +#else PyObject* pAttachEngineTextsModule = Py_InitModule3("AttachEngineResources", AttacherGui::AttacherGuiPy::Methods, "AttachEngine Gui resources"); +#endif + Py_INCREF(pAttachEngineTextsModule); PyModule_AddObject(partGuiModule, "AttachEngineResources", pAttachEngineTextsModule);