+ simplify porting of Image module to Python3

This commit is contained in:
wmayer
2016-01-21 12:27:12 +01:00
parent 14c6859968
commit 8e9e6b441f
3 changed files with 69 additions and 48 deletions

View File

@@ -31,20 +31,20 @@ void loadImageResource()
Gui::Translator::instance()->refresh();
}
/* registration table */
extern struct PyMethodDef ImageGui_Import_methods[];
namespace ImageGui {
extern PyObject* initModule();
}
/* Python entry */
extern "C" {
void ImageGuiExport initImageGui()
PyMODINIT_FUNC initImageGui()
{
if (!Gui::Application::Instance) {
PyErr_SetString(PyExc_ImportError, "Cannot load Gui module in console application.");
return;
}
(void) Py_InitModule("ImageGui", ImageGui_Import_methods); /* mod name, table ptr */
(void) ImageGui::initModule();
Base::Console().Log("Loading GUI of Image module... done\n");
// instantiating the commands
@@ -56,5 +56,3 @@ void ImageGuiExport initImageGui()
// add resources and reloads the translators
loadImageResource();
}
} // extern "C" {