py3: ported Start to python3
This commit is contained in:
parent
742d2c1627
commit
55545fbcad
|
@ -27,6 +27,7 @@
|
|||
#endif
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <Base/PyObjectBase.h>
|
||||
#include <Base/Interpreter.h>
|
||||
#include <CXX/Extensions.hxx>
|
||||
#include <CXX/Objects.hxx>
|
||||
|
@ -46,11 +47,18 @@ public:
|
|||
|
||||
private:
|
||||
};
|
||||
|
||||
PyObject* initModule()
|
||||
{
|
||||
return (new Module)->module().ptr();
|
||||
}
|
||||
|
||||
} // namespace Start
|
||||
|
||||
/* Python entry */
|
||||
PyMODINIT_FUNC initStart()
|
||||
PyMOD_INIT_FUNC(Start)
|
||||
{
|
||||
new Start::Module();
|
||||
PyObject* mod = Start::initModule();
|
||||
Base::Console().Log("Loading Start module... done\n");
|
||||
PyMOD_Return(mod);
|
||||
}
|
||||
|
|
|
@ -62,15 +62,21 @@ public:
|
|||
|
||||
private:
|
||||
};
|
||||
|
||||
PyObject* initModule()
|
||||
{
|
||||
return (new Module)->module().ptr();
|
||||
}
|
||||
|
||||
} // namespace StartGui
|
||||
|
||||
|
||||
/* Python entry */
|
||||
PyMODINIT_FUNC initStartGui()
|
||||
PyMOD_INIT_FUNC(StartGui)
|
||||
{
|
||||
if (!Gui::Application::Instance) {
|
||||
PyErr_SetString(PyExc_ImportError, "Cannot load Gui module in console application.");
|
||||
return;
|
||||
PyMOD_Return(0);
|
||||
}
|
||||
|
||||
// load dependent module
|
||||
|
@ -79,7 +85,7 @@ PyMODINIT_FUNC initStartGui()
|
|||
}
|
||||
catch(const Base::Exception& e) {
|
||||
PyErr_SetString(PyExc_ImportError, e.what());
|
||||
return;
|
||||
PyMOD_Return(0);
|
||||
}
|
||||
catch (Py::Exception& e) {
|
||||
Py::Object o = Py::type(e);
|
||||
|
@ -95,7 +101,7 @@ PyMODINIT_FUNC initStartGui()
|
|||
PyErr_Print();
|
||||
}
|
||||
|
||||
new StartGui::Module();
|
||||
PyObject* mod = StartGui::initModule();
|
||||
Base::Console().Log("Loading GUI of Start module... done\n");
|
||||
|
||||
// instantiating the commands
|
||||
|
@ -104,4 +110,5 @@ PyMODINIT_FUNC initStartGui()
|
|||
|
||||
// add resources and reloads the translators
|
||||
loadStartResource();
|
||||
PyMOD_Return(mod);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user