From 381419c2675cb9294a49ae2d02cbc500c0ef13dd Mon Sep 17 00:00:00 2001 From: wmayer Date: Sat, 23 Jan 2016 19:04:27 +0100 Subject: [PATCH] py3: ported PartDesign to python3 --- src/Mod/PartDesign/App/AppPartDesign.cpp | 9 ++++++--- src/Mod/PartDesign/Gui/AppPartDesignGui.cpp | 10 ++++++---- src/Mod/PartDesign/InitGui.py | 4 ++-- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/Mod/PartDesign/App/AppPartDesign.cpp b/src/Mod/PartDesign/App/AppPartDesign.cpp index f701cb500..5722da092 100644 --- a/src/Mod/PartDesign/App/AppPartDesign.cpp +++ b/src/Mod/PartDesign/App/AppPartDesign.cpp @@ -27,6 +27,7 @@ #endif #include +#include #include #include "FeaturePad.h" @@ -63,7 +64,7 @@ extern PyObject* initModule(); } /* Python entry */ -PyMODINIT_FUNC init_PartDesign() +PyMOD_INIT_FUNC(_PartDesign) { // load dependent module try { @@ -72,10 +73,10 @@ PyMODINIT_FUNC init_PartDesign() } catch(const Base::Exception& e) { PyErr_SetString(PyExc_ImportError, e.what()); - return; + PyMOD_Return(0); } - (void)PartDesign::initModule(); + PyObject* mod = PartDesign::initModule(); Base::Console().Log("Loading PartDesign module... done\n"); @@ -141,4 +142,6 @@ PyMODINIT_FUNC init_PartDesign() PartDesign::Wedge ::init(); PartDesign::AdditiveWedge ::init(); PartDesign::SubtractiveWedge ::init(); + + PyMOD_Return(mod); } diff --git a/src/Mod/PartDesign/Gui/AppPartDesignGui.cpp b/src/Mod/PartDesign/Gui/AppPartDesignGui.cpp index fbce447ff..6f1d51c00 100644 --- a/src/Mod/PartDesign/Gui/AppPartDesignGui.cpp +++ b/src/Mod/PartDesign/Gui/AppPartDesignGui.cpp @@ -97,11 +97,11 @@ PyObject* initModule() /* Python entry */ -PyMODINIT_FUNC initPartDesignGui() +PyMOD_INIT_FUNC(PartDesignGui) { if (!Gui::Application::Instance) { PyErr_SetString(PyExc_ImportError, "Cannot load Gui module in console application."); - return; + PyMOD_Return(0); } try { @@ -110,10 +110,10 @@ PyMODINIT_FUNC initPartDesignGui() } catch(const Base::Exception& e) { PyErr_SetString(PyExc_ImportError, e.what()); - return; + PyMOD_Return(0); } - (void)PartDesignGui::initModule(); + PyObject* mod = PartDesignGui::initModule(); Base::Console().Log("Loading GUI of PartDesign module... done\n"); // instantiating the commands @@ -154,4 +154,6 @@ PyMODINIT_FUNC initPartDesignGui() // add resources and reloads the translators loadPartDesignResource(); + + PyMOD_Return(mod); } diff --git a/src/Mod/PartDesign/InitGui.py b/src/Mod/PartDesign/InitGui.py index 1d07369e1..f47991b6d 100644 --- a/src/Mod/PartDesign/InitGui.py +++ b/src/Mod/PartDesign/InitGui.py @@ -35,7 +35,7 @@ class PartDesignWorkbench ( Workbench ): self.__class__.Icon = FreeCAD.getResourceDir() + "Mod/PartDesign/Resources/icons/PartDesignWorkbench.svg" self.__class__.MenuText = "Part Design" self.__class__.ToolTip = "Part Design workbench" - + def Initialize(self): # load the module try: @@ -59,6 +59,6 @@ class PartDesignWorkbench ( Workbench ): # pass def GetClassName(self): - return "PartDesignGui::Workbench" + return "PartDesignGui::Workbench" Gui.addWorkbench(PartDesignWorkbench())