00001 /*************************************************************************** 00002 * (c) Jürgen Riegel (juergen.riegel@web.de) 2002 * 00003 * * 00004 * This file is part of the FreeCAD CAx development system. * 00005 * * 00006 * This program is free software; you can redistribute it and/or modify * 00007 * it under the terms of the GNU Library General Public License (LGPL) * 00008 * as published by the Free Software Foundation; either version 2 of * 00009 * the License, or (at your option) any later version. * 00010 * for detail see the LICENCE text file. * 00011 * * 00012 * FreeCAD is distributed in the hope that it will be useful, * 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00015 * GNU Library General Public License for more details. * 00016 * * 00017 * You should have received a copy of the GNU Library General Public * 00018 * License along with FreeCAD; if not, write to the Free Software * 00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * 00020 * USA * 00021 * * 00022 * Juergen Riegel 2002 * 00023 ***************************************************************************/ 00024 00025 00026 #include "PreCompiled.h" 00027 #ifndef _PreComp_ 00028 #endif 00029 00030 #include <App/Application.h> 00031 #include <Base/Console.h> 00032 #include <Base/Interpreter.h> 00033 00034 #include <Gui/Application.h> 00035 00036 #include "Workbench.h" 00037 00038 // use a different name to CreateCommand() 00039 void CreateImportCommands(void); 00040 00041 00042 /* registration table */ 00043 extern struct PyMethodDef ImportGui_Import_methods[]; 00044 00045 extern "C" { 00046 void ImportGuiExport initImportGui() 00047 { 00048 if (!Gui::Application::Instance) { 00049 PyErr_SetString(PyExc_ImportError, "Cannot load Gui module in console application."); 00050 return; 00051 } 00052 (void) Py_InitModule("ImportGui", ImportGui_Import_methods); /* mod name, table ptr */ 00053 Base::Console().Log("Loading GUI of Import module... done\n"); 00054 00055 try { 00056 Base::Interpreter().loadModule("PartGui"); 00057 } 00058 catch(const Base::Exception& e) { 00059 PyErr_SetString(PyExc_ImportError, e.what()); 00060 return; 00061 } 00062 00063 CreateImportCommands(); 00064 ImportGui::Workbench::init(); 00065 } 00066 00067 } // extern "C" {