diff --git a/src/Mod/Robot/App/AppRobot.cpp b/src/Mod/Robot/App/AppRobot.cpp index 999646875..da7f36af2 100644 --- a/src/Mod/Robot/App/AppRobot.cpp +++ b/src/Mod/Robot/App/AppRobot.cpp @@ -85,11 +85,17 @@ private: return Py::Float(0.0); } }; + +PyObject* initModule() +{ + return (new Module)->module().ptr(); +} + } // namespace Robot /* Python entry */ -PyMODINIT_FUNC initRobot() +PyMOD_INIT_FUNC(Robot) { // load dependent module try { @@ -97,7 +103,7 @@ PyMODINIT_FUNC initRobot() } catch(const Base::Exception& e) { PyErr_SetString(PyExc_ImportError, e.what()); - return; + PyMOD_Return(0); } PyObject* robotModule = (new Robot::Module())->module().ptr(); @@ -122,4 +128,6 @@ PyMODINIT_FUNC initRobot() Robot::PropertyTrajectory ::init(); Robot::TrajectoryCompound ::init(); Robot::TrajectoryDressUpObject ::init(); + + PyMOD_Return(robotModule); } diff --git a/src/Mod/Robot/App/WaypointPy.xml b/src/Mod/Robot/App/WaypointPy.xml index 13bc38c40..df9ab2b92 100644 --- a/src/Mod/Robot/App/WaypointPy.xml +++ b/src/Mod/Robot/App/WaypointPy.xml @@ -53,13 +53,13 @@ In Case of WAIT s wait time descripe which tool frame to use for that point - + descripe which Base frame to use for that point - + diff --git a/src/Mod/Robot/App/WaypointPyImp.cpp b/src/Mod/Robot/App/WaypointPyImp.cpp index 321b83276..aca749576 100644 --- a/src/Mod/Robot/App/WaypointPyImp.cpp +++ b/src/Mod/Robot/App/WaypointPyImp.cpp @@ -218,12 +218,12 @@ void WaypointPy::setCont(Py::Boolean arg) getWaypointPtr()->Cont = (bool)arg; } -Py::Int WaypointPy::getTool(void) const +Py::Long WaypointPy::getTool(void) const { - return Py::Int((int)getWaypointPtr()->Tool); + return Py::Long((long)getWaypointPtr()->Tool); } -void WaypointPy::setTool(Py::Int arg) +void WaypointPy::setTool(Py::Long arg) { long value = static_cast(arg); if (value >= 0) @@ -232,12 +232,12 @@ void WaypointPy::setTool(Py::Int arg) throw Py::ValueError("negative tool not allowed!"); } -Py::Int WaypointPy::getBase(void) const +Py::Long WaypointPy::getBase(void) const { - return Py::Int((int)getWaypointPtr()->Base); + return Py::Long((long)getWaypointPtr()->Base); } -void WaypointPy::setBase(Py::Int arg) +void WaypointPy::setBase(Py::Long arg) { long value = static_cast(arg); if (value >= 0) diff --git a/src/Mod/Robot/Gui/AppRobotGui.cpp b/src/Mod/Robot/Gui/AppRobotGui.cpp index 9e5e9066c..cc5b55207 100644 --- a/src/Mod/Robot/Gui/AppRobotGui.cpp +++ b/src/Mod/Robot/Gui/AppRobotGui.cpp @@ -66,15 +66,21 @@ public: private: }; + +PyObject* initModule() +{ + return (new Module)->module().ptr(); +} + } // namespace RobotGui /* Python entry */ -PyMODINIT_FUNC initRobotGui() +PyMOD_INIT_FUNC(RobotGui) { if (!Gui::Application::Instance) { PyErr_SetString(PyExc_ImportError, "Cannot load Gui module in console application."); - return; + PyMOD_Return(0); } try { Base::Interpreter().runString("import PartGui"); @@ -94,9 +100,9 @@ PyMODINIT_FUNC initRobotGui() } catch(const Base::Exception& e) { PyErr_SetString(PyExc_ImportError, e.what()); - return; + PyMOD_Return(0); } - (void)new RobotGui::Module(); + PyObject* mod = RobotGui::initModule(); Base::Console().Log("Loading GUI of Robot module... done\n"); // instantiating the commands @@ -115,4 +121,6 @@ PyMODINIT_FUNC initRobotGui() // add resources and reloads the translators loadRobotResource(); + + PyMOD_Return(mod); }