AppImageGui.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *                                                                         *
00003  *   This program is free software; you can redistribute it and/or modify  *
00004  *   it under the terms of the GNU Library General Public License as       *
00005  *   published by the Free Software Foundation; either version 2 of the    *
00006  *   License, or (at your option) any later version.                       *
00007  *   for detail see the LICENCE text file.                                 *
00008  *   Jürgen Riegel 2002                                                    *
00009  *                                                                         *
00010  ***************************************************************************/
00011 
00012 
00013 #include "PreCompiled.h"
00014 #ifndef _PreComp_
00015 # include <Python.h>
00016 #endif
00017 
00018 #include <Base/Console.h>
00019 #include <Gui/Application.h>
00020 #include <Gui/Language/Translator.h>
00021 #include "Workbench.h"
00022 #include "ViewProviderImagePlane.h"
00023 #include "qrc_Image.cpp"
00024 
00025 // use a different name to CreateCommand()
00026 void CreateImageCommands(void);
00027 
00028 void loadImageResource()
00029 {
00030     // add resources and reloads the translators
00031     Q_INIT_RESOURCE(Image);
00032     Gui::Translator::instance()->refresh();
00033 }
00034 
00035 /* registration table  */
00036 extern struct PyMethodDef ImageGui_Import_methods[];
00037 
00038 
00039 /* Python entry */
00040 extern "C" {
00041 void ImageGuiExport initImageGui()
00042 {
00043     if (!Gui::Application::Instance) {
00044         PyErr_SetString(PyExc_ImportError, "Cannot load Gui module in console application.");
00045         return;
00046     }
00047 
00048     (void) Py_InitModule("ImageGui", ImageGui_Import_methods);   /* mod name, table ptr */
00049     Base::Console().Log("Loading GUI of Image module... done\n");
00050 
00051     // instantiating the commands
00052     CreateImageCommands();
00053 
00054     ImageGui::ViewProviderImagePlane::init();
00055     ImageGui::Workbench::init();
00056 
00057     // add resources and reloads the translators
00058     loadImageResource();
00059 }
00060 
00061 } // extern "C" {

Generated on Wed Nov 23 18:59:55 2011 for FreeCAD by  doxygen 1.6.1