+ proper exception handling of FemGui module

This commit is contained in:
wmayer
2015-10-22 11:01:21 +02:00
parent 96fb93f394
commit bdb0b54a3c

View File

@@ -68,7 +68,7 @@ extern struct PyMethodDef FemGui_Import_methods[];
/* Python entry */
extern "C" {
void FemGuiExport initFemGui()
void FemGuiExport initFemGui()
{
if (!Gui::Application::Instance) {
PyErr_SetString(PyExc_ImportError, "Cannot load Gui module in console application.");
@@ -102,19 +102,25 @@ void FemGuiExport initFemGui()
FemGui::ViewProviderResult ::init();
FemGui::ViewProviderResultPython ::init();
Base::Interpreter().loadModule("FemCommands");
try {
Base::Interpreter().loadModule("FemCommands");
Base::Interpreter().loadModule("_CommandMechanicalShowResult");
Base::Interpreter().loadModule("_CommandQuickAnalysis");
Base::Interpreter().loadModule("_CommandPurgeFemResults");
Base::Interpreter().loadModule("_CommandMechanicalJobControl");
Base::Interpreter().loadModule("_CommandFemFromShape");
Base::Interpreter().loadModule("_CommandNewMechanicalAnalysis");
Base::Interpreter().loadModule("_CommandMechanicalShowResult");
Base::Interpreter().loadModule("_CommandQuickAnalysis");
Base::Interpreter().loadModule("_CommandPurgeFemResults");
Base::Interpreter().loadModule("_CommandMechanicalJobControl");
Base::Interpreter().loadModule("_CommandFemFromShape");
Base::Interpreter().loadModule("_CommandNewMechanicalAnalysis");
Base::Interpreter().loadModule("MechanicalAnalysis");
Base::Interpreter().loadModule("MechanicalMaterial");
Base::Interpreter().loadModule("FemBeamSection");
Base::Interpreter().loadModule("FemShellThickness");
Base::Interpreter().loadModule("MechanicalAnalysis");
Base::Interpreter().loadModule("MechanicalMaterial");
Base::Interpreter().loadModule("FemBeamSection");
Base::Interpreter().loadModule("FemShellThickness");
}
catch (const Base::Exception& e) {
PyErr_SetString(PyExc_ImportError, e.what());
return;
}
// register preferences pages
new Gui::PrefPageProducer<FemGui::DlgSettingsFemImp> ("FEM");