py3: ported PartDesign to python3

This commit is contained in:
wmayer 2016-01-23 19:04:27 +01:00 committed by looooo
parent da1081bc98
commit 381419c267
3 changed files with 14 additions and 9 deletions

View File

@ -27,6 +27,7 @@
#endif
#include <Base/Console.h>
#include <Base/PyObjectBase.h>
#include <Base/Interpreter.h>
#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);
}

View File

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

View File

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