py3: ported ReverseEngineering to python3

This commit is contained in:
wmayer 2016-01-23 18:16:14 +01:00
parent 125fd78fa3
commit 1558e920db
2 changed files with 19 additions and 5 deletions

View File

@ -735,6 +735,12 @@ Mesh.show(m)
}
#endif
};
PyObject* initModule()
{
return (new Module)->module().ptr();
}
} // namespace Reen
@ -748,9 +754,10 @@ PyMODINIT_FUNC initReverseEngineering()
}
catch(const Base::Exception& e) {
PyErr_SetString(PyExc_ImportError, e.what());
return;
PyMOD_Return(0);
}
new Reen::Module();
PyObject* mod = Reen::initModule();
Base::Console().Log("Loading ReverseEngineering module... done\n");
PyMOD_Return(mod);
}

View File

@ -57,18 +57,24 @@ public:
private:
};
PyObject* initModule()
{
return (new Module)->module().ptr();
}
} // namespace ReverseEngineeringGui
/* Python entry */
PyMODINIT_FUNC initReverseEngineeringGui()
PyMOD_INIT_FUNC(ReverseEngineeringGui)
{
if (!Gui::Application::Instance) {
PyErr_SetString(PyExc_ImportError, "Cannot load Gui module in console application.");
return;
PyMOD_Return(0);
}
new ReverseEngineeringGui::Module();
PyObject* mod = ReverseEngineeringGui::initModule();
Base::Console().Log("Loading GUI of ReverseEngineering module... done\n");
// instantiating the commands
@ -77,4 +83,5 @@ PyMODINIT_FUNC initReverseEngineeringGui()
// add resources and reloads the translators
loadReverseEngineeringResource();
PyMOD_Return(mod);
}