Skip to content

Commit

Permalink
py3: ported Import to python3
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer authored and looooo committed Feb 12, 2017
1 parent 05544f3 commit 944d62e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
5 changes: 3 additions & 2 deletions src/Mod/Import/App/AppImport.cpp
Expand Up @@ -36,7 +36,7 @@ namespace Import {
extern PyObject* initModule();
}

PyMODINIT_FUNC initImport()
PyMOD_INIT_FUNC(Import)
{
PyObject* importModule = Import::initModule();

Expand All @@ -45,7 +45,7 @@ PyMODINIT_FUNC initImport()
}
catch(const Base::Exception& e) {
PyErr_SetString(PyExc_ImportError, e.what());
return;
PyMOD_Return(0);
}

// add mesh elements
Expand All @@ -55,4 +55,5 @@ PyMODINIT_FUNC initImport()
//Import::StepShape ::init();

Base::Console().Log("Loading Import module... done\n");
PyMOD_Return(importModule);
}
13 changes: 8 additions & 5 deletions src/Mod/Import/Gui/AppImportGui.cpp
Expand Up @@ -43,23 +43,26 @@ namespace ImportGui {
extern PyObject* initModule();
}

PyMODINIT_FUNC initImportGui()
PyMOD_INIT_FUNC(ImportGui)
{
if (!Gui::Application::Instance) {
PyErr_SetString(PyExc_ImportError, "Cannot load Gui module in console application.");
return;
PyMOD_Return(0);
}
(void)ImportGui::initModule();
Base::Console().Log("Loading GUI of Import module... done\n");

try {
Base::Interpreter().loadModule("PartGui");
}
catch(const Base::Exception& e) {
PyErr_SetString(PyExc_ImportError, e.what());
return;
PyMOD_Return(0);
}

PyObject* mod = ImportGui::initModule();
Base::Console().Log("Loading GUI of Import module... done\n");

CreateImportCommands();
ImportGui::Workbench::init();

PyMOD_Return(mod);
}

0 comments on commit 944d62e

Please sign in to comment.