py3: ported Robot to python3
This commit is contained in:
parent
8b5fb47e76
commit
21ffbeafb9
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -53,13 +53,13 @@ In Case of WAIT s wait time
|
|||
<Documentation>
|
||||
<UserDocu>descripe which tool frame to use for that point</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Tool" Type="Int"/>
|
||||
<Parameter Name="Tool" Type="Long"/>
|
||||
</Attribute>
|
||||
<Attribute Name="Base" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>descripe which Base frame to use for that point</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Base" Type="Int"/>
|
||||
<Parameter Name="Base" Type="Long"/>
|
||||
</Attribute>
|
||||
</PythonExport>
|
||||
</GenerateModel>
|
||||
|
|
|
@ -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<long>(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<long>(arg);
|
||||
if (value >= 0)
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user