PythonWorkbenchPy.cpp

Go to the documentation of this file.
00001 
00002 // This file is generated by src/Tools/generateTemaplates/templateClassPyExport.py out of the .XML file
00003 // Every change you make here get lost at the next full rebuild!
00004 // This File is normaly build as an include in PythonWorkbenchPyImp.cpp! Its not intended to be in a project!
00005 
00006 #include <boost/filesystem/path.hpp>
00007 #include <boost/filesystem/operations.hpp>
00008 #include <boost/filesystem/exception.hpp>
00009 #include <Base/PyObjectBase.h>
00010 #include <Base/Console.h>
00011 #include <Base/Exception.h>
00012 #include <CXX/Objects.hxx>
00013 
00014 #define new DEBUG_CLIENTBLOCK
00015 
00016 using Base::streq;
00017 using namespace Gui;
00018 
00020 PyTypeObject PythonWorkbenchPy::Type = {
00021     PyObject_HEAD_INIT(&PyType_Type)
00022     0,                                                /*ob_size*/
00023     "Gui.PythonWorkbench",     /*tp_name*/
00024     sizeof(PythonWorkbenchPy),                       /*tp_basicsize*/
00025     0,                                                /*tp_itemsize*/
00026     /* methods */
00027     PyDestructor,                                     /*tp_dealloc*/
00028     0,                                                /*tp_print*/
00029     __getattr,                                        /*tp_getattr*/
00030     __setattr,                                        /*tp_setattr*/
00031     0,                                                /*tp_compare*/
00032     __repr,                                           /*tp_repr*/
00033     0,                                                /*tp_as_number*/
00034     0,                                                /*tp_as_sequence*/
00035     0,                                                /*tp_as_mapping*/
00036     0,                                                /*tp_hash*/
00037     0,                                                /*tp_call */
00038     0,                                                /*tp_str  */
00039     0,                                                /*tp_getattro*/
00040     0,                                                /*tp_setattro*/
00041     /* --- Functions to access object as input/output buffer ---------*/
00042     0,                                                /* tp_as_buffer */
00043     /* --- Flags to define presence of optional/expanded features */
00044     Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_CLASS,        /*tp_flags */
00045     "This class handles document objects in group",           /*tp_doc */
00046     0,                                                /*tp_traverse */
00047     0,                                                /*tp_clear */
00048     0,                                                /*tp_richcompare */
00049     0,                                                /*tp_weaklistoffset */
00050     0,                                                /*tp_iter */
00051     0,                                                /*tp_iternext */
00052     Gui::PythonWorkbenchPy::Methods,                     /*tp_methods */
00053     0,                                                /*tp_members */
00054     Gui::PythonWorkbenchPy::GetterSetter,                     /*tp_getset */
00055     &Gui::WorkbenchPy::Type,                        /*tp_base */
00056     0,                                                /*tp_dict */
00057     0,                                                /*tp_descr_get */
00058     0,                                                /*tp_descr_set */
00059     0,                                                /*tp_dictoffset */
00060     __PyInit,                                         /*tp_init */
00061     0,                                                /*tp_alloc */
00062     Gui::PythonWorkbenchPy::PyMake,/*tp_new */
00063     0,                                                /*tp_free   Low-level free-memory routine */
00064     0,                                                /*tp_is_gc  For PyObject_IS_GC */
00065     0,                                                /*tp_bases */
00066     0,                                                /*tp_mro    method resolution order */
00067     0,                                                /*tp_cache */
00068     0,                                                /*tp_subclasses */
00069     0,                                                /*tp_weaklist */
00070     0                                                 /*tp_del */
00071 };
00072 
00074 PyMethodDef PythonWorkbenchPy::Methods[] = {
00075     {"appendMenu",
00076         (PyCFunction) staticCallback_appendMenu,
00077         METH_VARARGS,
00078         "Append a new menu"
00079     },
00080     {"removeMenu",
00081         (PyCFunction) staticCallback_removeMenu,
00082         METH_VARARGS,
00083         "Remove a menu"
00084     },
00085     {"listMenus",
00086         (PyCFunction) staticCallback_listMenus,
00087         METH_VARARGS,
00088         "Show a list of all menus"
00089     },
00090     {"appendContextMenu",
00091         (PyCFunction) staticCallback_appendContextMenu,
00092         METH_VARARGS,
00093         "Append a new context menu item"
00094     },
00095     {"removeContextMenu",
00096         (PyCFunction) staticCallback_removeContextMenu,
00097         METH_VARARGS,
00098         "Remove a context menu item"
00099     },
00100     {"appendToolbar",
00101         (PyCFunction) staticCallback_appendToolbar,
00102         METH_VARARGS,
00103         "Append a new toolbar"
00104     },
00105     {"removeToolbar",
00106         (PyCFunction) staticCallback_removeToolbar,
00107         METH_VARARGS,
00108         "Remove a toolbar"
00109     },
00110     {"listToolbars",
00111         (PyCFunction) staticCallback_listToolbars,
00112         METH_VARARGS,
00113         "Show a list of all toolbars"
00114     },
00115     {"appendCommandbar",
00116         (PyCFunction) staticCallback_appendCommandbar,
00117         METH_VARARGS,
00118         "Append a new command bar"
00119     },
00120     {"removeCommandbar",
00121         (PyCFunction) staticCallback_removeCommandbar,
00122         METH_VARARGS,
00123         "Remove a command bar"
00124     },
00125     {"listCommandbars",
00126         (PyCFunction) staticCallback_listCommandbars,
00127         METH_VARARGS,
00128         "Show a list of all command bars"
00129     },
00130     {"AppendMenu",
00131         (PyCFunction) staticCallback_AppendMenu,
00132         METH_VARARGS,
00133         "deprecated -- use appendMenu"
00134     },
00135     {"RemoveMenu",
00136         (PyCFunction) staticCallback_RemoveMenu,
00137         METH_VARARGS,
00138         "deprecated -- use removeMenu"
00139     },
00140     {"ListMenus",
00141         (PyCFunction) staticCallback_ListMenus,
00142         METH_VARARGS,
00143         "deprecated -- use listMenus"
00144     },
00145     {"AppendContextMenu",
00146         (PyCFunction) staticCallback_AppendContextMenu,
00147         METH_VARARGS,
00148         "deprecated -- use appendContextMenu"
00149     },
00150     {"RemoveContextMenu",
00151         (PyCFunction) staticCallback_RemoveContextMenu,
00152         METH_VARARGS,
00153         "deprecated -- use removeContextMenu"
00154     },
00155     {"AppendToolbar",
00156         (PyCFunction) staticCallback_AppendToolbar,
00157         METH_VARARGS,
00158         "deprecated -- use appendToolbar"
00159     },
00160     {"RemoveToolbar",
00161         (PyCFunction) staticCallback_RemoveToolbar,
00162         METH_VARARGS,
00163         "deprecated -- use removeToolbar"
00164     },
00165     {"ListToolbars",
00166         (PyCFunction) staticCallback_ListToolbars,
00167         METH_VARARGS,
00168         "deprecated -- use listToolbars"
00169     },
00170     {"AppendCommandbar",
00171         (PyCFunction) staticCallback_AppendCommandbar,
00172         METH_VARARGS,
00173         "deprecated -- use appendCommandBar"
00174     },
00175     {"RemoveCommandbar",
00176         (PyCFunction) staticCallback_RemoveCommandbar,
00177         METH_VARARGS,
00178         "deprecated -- use removeCommandBar"
00179     },
00180     {"ListCommandbars",
00181         (PyCFunction) staticCallback_ListCommandbars,
00182         METH_VARARGS,
00183         "deprecated -- use listCommandBars"
00184     },
00185     {NULL, NULL, 0, NULL}               /* Sentinel */
00186 };
00187 
00188 
00189 
00191 PyGetSetDef PythonWorkbenchPy::GetterSetter[] = {
00192     {NULL, NULL, NULL, NULL, NULL}              /* Sentinel */
00193 };
00194 
00195 // appendMenu() callback and implementer
00196 // PyObject*  PythonWorkbenchPy::appendMenu(PyObject *args){};
00197 // has to be implemented in PythonWorkbenchPyImp.cpp
00198 PyObject * PythonWorkbenchPy::staticCallback_appendMenu (PyObject *self, PyObject *args)
00199 {
00200     // test if twin object not allready deleted
00201     if (!((PyObjectBase*) self)->isValid()){
00202         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00203         return NULL;
00204     }
00205 
00206     // test if object is set Const
00207     if (((PyObjectBase*) self)->isConst()){
00208         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00209         return NULL;
00210     }
00211 
00212     try { // catches all exceptions coming up from c++ and generate a python exception
00213         PyObject* ret = ((PythonWorkbenchPy*)self)->appendMenu(args);
00214         if (ret != 0)
00215             ((PythonWorkbenchPy*)self)->startNotify();
00216         return ret;
00217     }
00218     catch(const Base::Exception& e) // catch the FreeCAD exceptions
00219     {
00220         std::string str;
00221         str += "FreeCAD exception thrown (";
00222         str += e.what();
00223         str += ")";
00224         e.ReportException();
00225         PyErr_SetString(PyExc_Exception,str.c_str());
00226         return NULL;
00227     }
00228     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
00229     {
00230         std::string str;
00231         str += "File system exception thrown (";
00232         //str += e.who();
00233         //str += ", ";
00234         str += e.what();
00235         str += ")\n";
00236         Base::Console().Error(str.c_str());
00237         PyErr_SetString(PyExc_Exception,str.c_str());
00238         return NULL;
00239     }
00240     catch(const Py::Exception&)
00241     {
00242         // The exception text is already set
00243         return NULL;
00244     }
00245     catch(const char* e) // catch simple string exceptions
00246     {
00247         Base::Console().Error(e);
00248         PyErr_SetString(PyExc_Exception,e);
00249         return NULL;
00250     }
00251     // in debug not all exceptions will be catched to get the attention of the developer!
00252 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
00253     catch(const std::exception& e) // catch other c++ exceptions
00254     {
00255         std::string str;
00256         str += "FC++ exception thrown (";
00257         str += e.what();
00258         str += ")";
00259         Base::Console().Error(str.c_str());
00260         PyErr_SetString(PyExc_Exception,str.c_str());
00261         return NULL;
00262     }
00263     catch(...)  // catch the rest!
00264     {
00265         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00266         return NULL;
00267     }
00268 #endif
00269 }
00270 
00271 // removeMenu() callback and implementer
00272 // PyObject*  PythonWorkbenchPy::removeMenu(PyObject *args){};
00273 // has to be implemented in PythonWorkbenchPyImp.cpp
00274 PyObject * PythonWorkbenchPy::staticCallback_removeMenu (PyObject *self, PyObject *args)
00275 {
00276     // test if twin object not allready deleted
00277     if (!((PyObjectBase*) self)->isValid()){
00278         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00279         return NULL;
00280     }
00281 
00282     // test if object is set Const
00283     if (((PyObjectBase*) self)->isConst()){
00284         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00285         return NULL;
00286     }
00287 
00288     try { // catches all exceptions coming up from c++ and generate a python exception
00289         PyObject* ret = ((PythonWorkbenchPy*)self)->removeMenu(args);
00290         if (ret != 0)
00291             ((PythonWorkbenchPy*)self)->startNotify();
00292         return ret;
00293     }
00294     catch(const Base::Exception& e) // catch the FreeCAD exceptions
00295     {
00296         std::string str;
00297         str += "FreeCAD exception thrown (";
00298         str += e.what();
00299         str += ")";
00300         e.ReportException();
00301         PyErr_SetString(PyExc_Exception,str.c_str());
00302         return NULL;
00303     }
00304     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
00305     {
00306         std::string str;
00307         str += "File system exception thrown (";
00308         //str += e.who();
00309         //str += ", ";
00310         str += e.what();
00311         str += ")\n";
00312         Base::Console().Error(str.c_str());
00313         PyErr_SetString(PyExc_Exception,str.c_str());
00314         return NULL;
00315     }
00316     catch(const Py::Exception&)
00317     {
00318         // The exception text is already set
00319         return NULL;
00320     }
00321     catch(const char* e) // catch simple string exceptions
00322     {
00323         Base::Console().Error(e);
00324         PyErr_SetString(PyExc_Exception,e);
00325         return NULL;
00326     }
00327     // in debug not all exceptions will be catched to get the attention of the developer!
00328 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
00329     catch(const std::exception& e) // catch other c++ exceptions
00330     {
00331         std::string str;
00332         str += "FC++ exception thrown (";
00333         str += e.what();
00334         str += ")";
00335         Base::Console().Error(str.c_str());
00336         PyErr_SetString(PyExc_Exception,str.c_str());
00337         return NULL;
00338     }
00339     catch(...)  // catch the rest!
00340     {
00341         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00342         return NULL;
00343     }
00344 #endif
00345 }
00346 
00347 // listMenus() callback and implementer
00348 // PyObject*  PythonWorkbenchPy::listMenus(PyObject *args){};
00349 // has to be implemented in PythonWorkbenchPyImp.cpp
00350 PyObject * PythonWorkbenchPy::staticCallback_listMenus (PyObject *self, PyObject *args)
00351 {
00352     // test if twin object not allready deleted
00353     if (!((PyObjectBase*) self)->isValid()){
00354         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00355         return NULL;
00356     }
00357 
00358     // test if object is set Const
00359     if (((PyObjectBase*) self)->isConst()){
00360         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00361         return NULL;
00362     }
00363 
00364     try { // catches all exceptions coming up from c++ and generate a python exception
00365         PyObject* ret = ((PythonWorkbenchPy*)self)->listMenus(args);
00366         if (ret != 0)
00367             ((PythonWorkbenchPy*)self)->startNotify();
00368         return ret;
00369     }
00370     catch(const Base::Exception& e) // catch the FreeCAD exceptions
00371     {
00372         std::string str;
00373         str += "FreeCAD exception thrown (";
00374         str += e.what();
00375         str += ")";
00376         e.ReportException();
00377         PyErr_SetString(PyExc_Exception,str.c_str());
00378         return NULL;
00379     }
00380     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
00381     {
00382         std::string str;
00383         str += "File system exception thrown (";
00384         //str += e.who();
00385         //str += ", ";
00386         str += e.what();
00387         str += ")\n";
00388         Base::Console().Error(str.c_str());
00389         PyErr_SetString(PyExc_Exception,str.c_str());
00390         return NULL;
00391     }
00392     catch(const Py::Exception&)
00393     {
00394         // The exception text is already set
00395         return NULL;
00396     }
00397     catch(const char* e) // catch simple string exceptions
00398     {
00399         Base::Console().Error(e);
00400         PyErr_SetString(PyExc_Exception,e);
00401         return NULL;
00402     }
00403     // in debug not all exceptions will be catched to get the attention of the developer!
00404 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
00405     catch(const std::exception& e) // catch other c++ exceptions
00406     {
00407         std::string str;
00408         str += "FC++ exception thrown (";
00409         str += e.what();
00410         str += ")";
00411         Base::Console().Error(str.c_str());
00412         PyErr_SetString(PyExc_Exception,str.c_str());
00413         return NULL;
00414     }
00415     catch(...)  // catch the rest!
00416     {
00417         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00418         return NULL;
00419     }
00420 #endif
00421 }
00422 
00423 // appendContextMenu() callback and implementer
00424 // PyObject*  PythonWorkbenchPy::appendContextMenu(PyObject *args){};
00425 // has to be implemented in PythonWorkbenchPyImp.cpp
00426 PyObject * PythonWorkbenchPy::staticCallback_appendContextMenu (PyObject *self, PyObject *args)
00427 {
00428     // test if twin object not allready deleted
00429     if (!((PyObjectBase*) self)->isValid()){
00430         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00431         return NULL;
00432     }
00433 
00434     // test if object is set Const
00435     if (((PyObjectBase*) self)->isConst()){
00436         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00437         return NULL;
00438     }
00439 
00440     try { // catches all exceptions coming up from c++ and generate a python exception
00441         PyObject* ret = ((PythonWorkbenchPy*)self)->appendContextMenu(args);
00442         if (ret != 0)
00443             ((PythonWorkbenchPy*)self)->startNotify();
00444         return ret;
00445     }
00446     catch(const Base::Exception& e) // catch the FreeCAD exceptions
00447     {
00448         std::string str;
00449         str += "FreeCAD exception thrown (";
00450         str += e.what();
00451         str += ")";
00452         e.ReportException();
00453         PyErr_SetString(PyExc_Exception,str.c_str());
00454         return NULL;
00455     }
00456     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
00457     {
00458         std::string str;
00459         str += "File system exception thrown (";
00460         //str += e.who();
00461         //str += ", ";
00462         str += e.what();
00463         str += ")\n";
00464         Base::Console().Error(str.c_str());
00465         PyErr_SetString(PyExc_Exception,str.c_str());
00466         return NULL;
00467     }
00468     catch(const Py::Exception&)
00469     {
00470         // The exception text is already set
00471         return NULL;
00472     }
00473     catch(const char* e) // catch simple string exceptions
00474     {
00475         Base::Console().Error(e);
00476         PyErr_SetString(PyExc_Exception,e);
00477         return NULL;
00478     }
00479     // in debug not all exceptions will be catched to get the attention of the developer!
00480 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
00481     catch(const std::exception& e) // catch other c++ exceptions
00482     {
00483         std::string str;
00484         str += "FC++ exception thrown (";
00485         str += e.what();
00486         str += ")";
00487         Base::Console().Error(str.c_str());
00488         PyErr_SetString(PyExc_Exception,str.c_str());
00489         return NULL;
00490     }
00491     catch(...)  // catch the rest!
00492     {
00493         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00494         return NULL;
00495     }
00496 #endif
00497 }
00498 
00499 // removeContextMenu() callback and implementer
00500 // PyObject*  PythonWorkbenchPy::removeContextMenu(PyObject *args){};
00501 // has to be implemented in PythonWorkbenchPyImp.cpp
00502 PyObject * PythonWorkbenchPy::staticCallback_removeContextMenu (PyObject *self, PyObject *args)
00503 {
00504     // test if twin object not allready deleted
00505     if (!((PyObjectBase*) self)->isValid()){
00506         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00507         return NULL;
00508     }
00509 
00510     // test if object is set Const
00511     if (((PyObjectBase*) self)->isConst()){
00512         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00513         return NULL;
00514     }
00515 
00516     try { // catches all exceptions coming up from c++ and generate a python exception
00517         PyObject* ret = ((PythonWorkbenchPy*)self)->removeContextMenu(args);
00518         if (ret != 0)
00519             ((PythonWorkbenchPy*)self)->startNotify();
00520         return ret;
00521     }
00522     catch(const Base::Exception& e) // catch the FreeCAD exceptions
00523     {
00524         std::string str;
00525         str += "FreeCAD exception thrown (";
00526         str += e.what();
00527         str += ")";
00528         e.ReportException();
00529         PyErr_SetString(PyExc_Exception,str.c_str());
00530         return NULL;
00531     }
00532     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
00533     {
00534         std::string str;
00535         str += "File system exception thrown (";
00536         //str += e.who();
00537         //str += ", ";
00538         str += e.what();
00539         str += ")\n";
00540         Base::Console().Error(str.c_str());
00541         PyErr_SetString(PyExc_Exception,str.c_str());
00542         return NULL;
00543     }
00544     catch(const Py::Exception&)
00545     {
00546         // The exception text is already set
00547         return NULL;
00548     }
00549     catch(const char* e) // catch simple string exceptions
00550     {
00551         Base::Console().Error(e);
00552         PyErr_SetString(PyExc_Exception,e);
00553         return NULL;
00554     }
00555     // in debug not all exceptions will be catched to get the attention of the developer!
00556 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
00557     catch(const std::exception& e) // catch other c++ exceptions
00558     {
00559         std::string str;
00560         str += "FC++ exception thrown (";
00561         str += e.what();
00562         str += ")";
00563         Base::Console().Error(str.c_str());
00564         PyErr_SetString(PyExc_Exception,str.c_str());
00565         return NULL;
00566     }
00567     catch(...)  // catch the rest!
00568     {
00569         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00570         return NULL;
00571     }
00572 #endif
00573 }
00574 
00575 // appendToolbar() callback and implementer
00576 // PyObject*  PythonWorkbenchPy::appendToolbar(PyObject *args){};
00577 // has to be implemented in PythonWorkbenchPyImp.cpp
00578 PyObject * PythonWorkbenchPy::staticCallback_appendToolbar (PyObject *self, PyObject *args)
00579 {
00580     // test if twin object not allready deleted
00581     if (!((PyObjectBase*) self)->isValid()){
00582         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00583         return NULL;
00584     }
00585 
00586     // test if object is set Const
00587     if (((PyObjectBase*) self)->isConst()){
00588         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00589         return NULL;
00590     }
00591 
00592     try { // catches all exceptions coming up from c++ and generate a python exception
00593         PyObject* ret = ((PythonWorkbenchPy*)self)->appendToolbar(args);
00594         if (ret != 0)
00595             ((PythonWorkbenchPy*)self)->startNotify();
00596         return ret;
00597     }
00598     catch(const Base::Exception& e) // catch the FreeCAD exceptions
00599     {
00600         std::string str;
00601         str += "FreeCAD exception thrown (";
00602         str += e.what();
00603         str += ")";
00604         e.ReportException();
00605         PyErr_SetString(PyExc_Exception,str.c_str());
00606         return NULL;
00607     }
00608     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
00609     {
00610         std::string str;
00611         str += "File system exception thrown (";
00612         //str += e.who();
00613         //str += ", ";
00614         str += e.what();
00615         str += ")\n";
00616         Base::Console().Error(str.c_str());
00617         PyErr_SetString(PyExc_Exception,str.c_str());
00618         return NULL;
00619     }
00620     catch(const Py::Exception&)
00621     {
00622         // The exception text is already set
00623         return NULL;
00624     }
00625     catch(const char* e) // catch simple string exceptions
00626     {
00627         Base::Console().Error(e);
00628         PyErr_SetString(PyExc_Exception,e);
00629         return NULL;
00630     }
00631     // in debug not all exceptions will be catched to get the attention of the developer!
00632 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
00633     catch(const std::exception& e) // catch other c++ exceptions
00634     {
00635         std::string str;
00636         str += "FC++ exception thrown (";
00637         str += e.what();
00638         str += ")";
00639         Base::Console().Error(str.c_str());
00640         PyErr_SetString(PyExc_Exception,str.c_str());
00641         return NULL;
00642     }
00643     catch(...)  // catch the rest!
00644     {
00645         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00646         return NULL;
00647     }
00648 #endif
00649 }
00650 
00651 // removeToolbar() callback and implementer
00652 // PyObject*  PythonWorkbenchPy::removeToolbar(PyObject *args){};
00653 // has to be implemented in PythonWorkbenchPyImp.cpp
00654 PyObject * PythonWorkbenchPy::staticCallback_removeToolbar (PyObject *self, PyObject *args)
00655 {
00656     // test if twin object not allready deleted
00657     if (!((PyObjectBase*) self)->isValid()){
00658         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00659         return NULL;
00660     }
00661 
00662     // test if object is set Const
00663     if (((PyObjectBase*) self)->isConst()){
00664         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00665         return NULL;
00666     }
00667 
00668     try { // catches all exceptions coming up from c++ and generate a python exception
00669         PyObject* ret = ((PythonWorkbenchPy*)self)->removeToolbar(args);
00670         if (ret != 0)
00671             ((PythonWorkbenchPy*)self)->startNotify();
00672         return ret;
00673     }
00674     catch(const Base::Exception& e) // catch the FreeCAD exceptions
00675     {
00676         std::string str;
00677         str += "FreeCAD exception thrown (";
00678         str += e.what();
00679         str += ")";
00680         e.ReportException();
00681         PyErr_SetString(PyExc_Exception,str.c_str());
00682         return NULL;
00683     }
00684     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
00685     {
00686         std::string str;
00687         str += "File system exception thrown (";
00688         //str += e.who();
00689         //str += ", ";
00690         str += e.what();
00691         str += ")\n";
00692         Base::Console().Error(str.c_str());
00693         PyErr_SetString(PyExc_Exception,str.c_str());
00694         return NULL;
00695     }
00696     catch(const Py::Exception&)
00697     {
00698         // The exception text is already set
00699         return NULL;
00700     }
00701     catch(const char* e) // catch simple string exceptions
00702     {
00703         Base::Console().Error(e);
00704         PyErr_SetString(PyExc_Exception,e);
00705         return NULL;
00706     }
00707     // in debug not all exceptions will be catched to get the attention of the developer!
00708 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
00709     catch(const std::exception& e) // catch other c++ exceptions
00710     {
00711         std::string str;
00712         str += "FC++ exception thrown (";
00713         str += e.what();
00714         str += ")";
00715         Base::Console().Error(str.c_str());
00716         PyErr_SetString(PyExc_Exception,str.c_str());
00717         return NULL;
00718     }
00719     catch(...)  // catch the rest!
00720     {
00721         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00722         return NULL;
00723     }
00724 #endif
00725 }
00726 
00727 // listToolbars() callback and implementer
00728 // PyObject*  PythonWorkbenchPy::listToolbars(PyObject *args){};
00729 // has to be implemented in PythonWorkbenchPyImp.cpp
00730 PyObject * PythonWorkbenchPy::staticCallback_listToolbars (PyObject *self, PyObject *args)
00731 {
00732     // test if twin object not allready deleted
00733     if (!((PyObjectBase*) self)->isValid()){
00734         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00735         return NULL;
00736     }
00737 
00738     // test if object is set Const
00739     if (((PyObjectBase*) self)->isConst()){
00740         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00741         return NULL;
00742     }
00743 
00744     try { // catches all exceptions coming up from c++ and generate a python exception
00745         PyObject* ret = ((PythonWorkbenchPy*)self)->listToolbars(args);
00746         if (ret != 0)
00747             ((PythonWorkbenchPy*)self)->startNotify();
00748         return ret;
00749     }
00750     catch(const Base::Exception& e) // catch the FreeCAD exceptions
00751     {
00752         std::string str;
00753         str += "FreeCAD exception thrown (";
00754         str += e.what();
00755         str += ")";
00756         e.ReportException();
00757         PyErr_SetString(PyExc_Exception,str.c_str());
00758         return NULL;
00759     }
00760     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
00761     {
00762         std::string str;
00763         str += "File system exception thrown (";
00764         //str += e.who();
00765         //str += ", ";
00766         str += e.what();
00767         str += ")\n";
00768         Base::Console().Error(str.c_str());
00769         PyErr_SetString(PyExc_Exception,str.c_str());
00770         return NULL;
00771     }
00772     catch(const Py::Exception&)
00773     {
00774         // The exception text is already set
00775         return NULL;
00776     }
00777     catch(const char* e) // catch simple string exceptions
00778     {
00779         Base::Console().Error(e);
00780         PyErr_SetString(PyExc_Exception,e);
00781         return NULL;
00782     }
00783     // in debug not all exceptions will be catched to get the attention of the developer!
00784 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
00785     catch(const std::exception& e) // catch other c++ exceptions
00786     {
00787         std::string str;
00788         str += "FC++ exception thrown (";
00789         str += e.what();
00790         str += ")";
00791         Base::Console().Error(str.c_str());
00792         PyErr_SetString(PyExc_Exception,str.c_str());
00793         return NULL;
00794     }
00795     catch(...)  // catch the rest!
00796     {
00797         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00798         return NULL;
00799     }
00800 #endif
00801 }
00802 
00803 // appendCommandbar() callback and implementer
00804 // PyObject*  PythonWorkbenchPy::appendCommandbar(PyObject *args){};
00805 // has to be implemented in PythonWorkbenchPyImp.cpp
00806 PyObject * PythonWorkbenchPy::staticCallback_appendCommandbar (PyObject *self, PyObject *args)
00807 {
00808     // test if twin object not allready deleted
00809     if (!((PyObjectBase*) self)->isValid()){
00810         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00811         return NULL;
00812     }
00813 
00814     // test if object is set Const
00815     if (((PyObjectBase*) self)->isConst()){
00816         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00817         return NULL;
00818     }
00819 
00820     try { // catches all exceptions coming up from c++ and generate a python exception
00821         PyObject* ret = ((PythonWorkbenchPy*)self)->appendCommandbar(args);
00822         if (ret != 0)
00823             ((PythonWorkbenchPy*)self)->startNotify();
00824         return ret;
00825     }
00826     catch(const Base::Exception& e) // catch the FreeCAD exceptions
00827     {
00828         std::string str;
00829         str += "FreeCAD exception thrown (";
00830         str += e.what();
00831         str += ")";
00832         e.ReportException();
00833         PyErr_SetString(PyExc_Exception,str.c_str());
00834         return NULL;
00835     }
00836     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
00837     {
00838         std::string str;
00839         str += "File system exception thrown (";
00840         //str += e.who();
00841         //str += ", ";
00842         str += e.what();
00843         str += ")\n";
00844         Base::Console().Error(str.c_str());
00845         PyErr_SetString(PyExc_Exception,str.c_str());
00846         return NULL;
00847     }
00848     catch(const Py::Exception&)
00849     {
00850         // The exception text is already set
00851         return NULL;
00852     }
00853     catch(const char* e) // catch simple string exceptions
00854     {
00855         Base::Console().Error(e);
00856         PyErr_SetString(PyExc_Exception,e);
00857         return NULL;
00858     }
00859     // in debug not all exceptions will be catched to get the attention of the developer!
00860 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
00861     catch(const std::exception& e) // catch other c++ exceptions
00862     {
00863         std::string str;
00864         str += "FC++ exception thrown (";
00865         str += e.what();
00866         str += ")";
00867         Base::Console().Error(str.c_str());
00868         PyErr_SetString(PyExc_Exception,str.c_str());
00869         return NULL;
00870     }
00871     catch(...)  // catch the rest!
00872     {
00873         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00874         return NULL;
00875     }
00876 #endif
00877 }
00878 
00879 // removeCommandbar() callback and implementer
00880 // PyObject*  PythonWorkbenchPy::removeCommandbar(PyObject *args){};
00881 // has to be implemented in PythonWorkbenchPyImp.cpp
00882 PyObject * PythonWorkbenchPy::staticCallback_removeCommandbar (PyObject *self, PyObject *args)
00883 {
00884     // test if twin object not allready deleted
00885     if (!((PyObjectBase*) self)->isValid()){
00886         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00887         return NULL;
00888     }
00889 
00890     // test if object is set Const
00891     if (((PyObjectBase*) self)->isConst()){
00892         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00893         return NULL;
00894     }
00895 
00896     try { // catches all exceptions coming up from c++ and generate a python exception
00897         PyObject* ret = ((PythonWorkbenchPy*)self)->removeCommandbar(args);
00898         if (ret != 0)
00899             ((PythonWorkbenchPy*)self)->startNotify();
00900         return ret;
00901     }
00902     catch(const Base::Exception& e) // catch the FreeCAD exceptions
00903     {
00904         std::string str;
00905         str += "FreeCAD exception thrown (";
00906         str += e.what();
00907         str += ")";
00908         e.ReportException();
00909         PyErr_SetString(PyExc_Exception,str.c_str());
00910         return NULL;
00911     }
00912     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
00913     {
00914         std::string str;
00915         str += "File system exception thrown (";
00916         //str += e.who();
00917         //str += ", ";
00918         str += e.what();
00919         str += ")\n";
00920         Base::Console().Error(str.c_str());
00921         PyErr_SetString(PyExc_Exception,str.c_str());
00922         return NULL;
00923     }
00924     catch(const Py::Exception&)
00925     {
00926         // The exception text is already set
00927         return NULL;
00928     }
00929     catch(const char* e) // catch simple string exceptions
00930     {
00931         Base::Console().Error(e);
00932         PyErr_SetString(PyExc_Exception,e);
00933         return NULL;
00934     }
00935     // in debug not all exceptions will be catched to get the attention of the developer!
00936 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
00937     catch(const std::exception& e) // catch other c++ exceptions
00938     {
00939         std::string str;
00940         str += "FC++ exception thrown (";
00941         str += e.what();
00942         str += ")";
00943         Base::Console().Error(str.c_str());
00944         PyErr_SetString(PyExc_Exception,str.c_str());
00945         return NULL;
00946     }
00947     catch(...)  // catch the rest!
00948     {
00949         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00950         return NULL;
00951     }
00952 #endif
00953 }
00954 
00955 // listCommandbars() callback and implementer
00956 // PyObject*  PythonWorkbenchPy::listCommandbars(PyObject *args){};
00957 // has to be implemented in PythonWorkbenchPyImp.cpp
00958 PyObject * PythonWorkbenchPy::staticCallback_listCommandbars (PyObject *self, PyObject *args)
00959 {
00960     // test if twin object not allready deleted
00961     if (!((PyObjectBase*) self)->isValid()){
00962         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00963         return NULL;
00964     }
00965 
00966     // test if object is set Const
00967     if (((PyObjectBase*) self)->isConst()){
00968         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
00969         return NULL;
00970     }
00971 
00972     try { // catches all exceptions coming up from c++ and generate a python exception
00973         PyObject* ret = ((PythonWorkbenchPy*)self)->listCommandbars(args);
00974         if (ret != 0)
00975             ((PythonWorkbenchPy*)self)->startNotify();
00976         return ret;
00977     }
00978     catch(const Base::Exception& e) // catch the FreeCAD exceptions
00979     {
00980         std::string str;
00981         str += "FreeCAD exception thrown (";
00982         str += e.what();
00983         str += ")";
00984         e.ReportException();
00985         PyErr_SetString(PyExc_Exception,str.c_str());
00986         return NULL;
00987     }
00988     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
00989     {
00990         std::string str;
00991         str += "File system exception thrown (";
00992         //str += e.who();
00993         //str += ", ";
00994         str += e.what();
00995         str += ")\n";
00996         Base::Console().Error(str.c_str());
00997         PyErr_SetString(PyExc_Exception,str.c_str());
00998         return NULL;
00999     }
01000     catch(const Py::Exception&)
01001     {
01002         // The exception text is already set
01003         return NULL;
01004     }
01005     catch(const char* e) // catch simple string exceptions
01006     {
01007         Base::Console().Error(e);
01008         PyErr_SetString(PyExc_Exception,e);
01009         return NULL;
01010     }
01011     // in debug not all exceptions will be catched to get the attention of the developer!
01012 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
01013     catch(const std::exception& e) // catch other c++ exceptions
01014     {
01015         std::string str;
01016         str += "FC++ exception thrown (";
01017         str += e.what();
01018         str += ")";
01019         Base::Console().Error(str.c_str());
01020         PyErr_SetString(PyExc_Exception,str.c_str());
01021         return NULL;
01022     }
01023     catch(...)  // catch the rest!
01024     {
01025         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
01026         return NULL;
01027     }
01028 #endif
01029 }
01030 
01031 // AppendMenu() callback and implementer
01032 // PyObject*  PythonWorkbenchPy::AppendMenu(PyObject *args){};
01033 // has to be implemented in PythonWorkbenchPyImp.cpp
01034 PyObject * PythonWorkbenchPy::staticCallback_AppendMenu (PyObject *self, PyObject *args)
01035 {
01036     // test if twin object not allready deleted
01037     if (!((PyObjectBase*) self)->isValid()){
01038         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
01039         return NULL;
01040     }
01041 
01042     // test if object is set Const
01043     if (((PyObjectBase*) self)->isConst()){
01044         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
01045         return NULL;
01046     }
01047 
01048     try { // catches all exceptions coming up from c++ and generate a python exception
01049         PyObject* ret = ((PythonWorkbenchPy*)self)->AppendMenu(args);
01050         if (ret != 0)
01051             ((PythonWorkbenchPy*)self)->startNotify();
01052         return ret;
01053     }
01054     catch(const Base::Exception& e) // catch the FreeCAD exceptions
01055     {
01056         std::string str;
01057         str += "FreeCAD exception thrown (";
01058         str += e.what();
01059         str += ")";
01060         e.ReportException();
01061         PyErr_SetString(PyExc_Exception,str.c_str());
01062         return NULL;
01063     }
01064     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
01065     {
01066         std::string str;
01067         str += "File system exception thrown (";
01068         //str += e.who();
01069         //str += ", ";
01070         str += e.what();
01071         str += ")\n";
01072         Base::Console().Error(str.c_str());
01073         PyErr_SetString(PyExc_Exception,str.c_str());
01074         return NULL;
01075     }
01076     catch(const Py::Exception&)
01077     {
01078         // The exception text is already set
01079         return NULL;
01080     }
01081     catch(const char* e) // catch simple string exceptions
01082     {
01083         Base::Console().Error(e);
01084         PyErr_SetString(PyExc_Exception,e);
01085         return NULL;
01086     }
01087     // in debug not all exceptions will be catched to get the attention of the developer!
01088 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
01089     catch(const std::exception& e) // catch other c++ exceptions
01090     {
01091         std::string str;
01092         str += "FC++ exception thrown (";
01093         str += e.what();
01094         str += ")";
01095         Base::Console().Error(str.c_str());
01096         PyErr_SetString(PyExc_Exception,str.c_str());
01097         return NULL;
01098     }
01099     catch(...)  // catch the rest!
01100     {
01101         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
01102         return NULL;
01103     }
01104 #endif
01105 }
01106 
01107 // RemoveMenu() callback and implementer
01108 // PyObject*  PythonWorkbenchPy::RemoveMenu(PyObject *args){};
01109 // has to be implemented in PythonWorkbenchPyImp.cpp
01110 PyObject * PythonWorkbenchPy::staticCallback_RemoveMenu (PyObject *self, PyObject *args)
01111 {
01112     // test if twin object not allready deleted
01113     if (!((PyObjectBase*) self)->isValid()){
01114         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
01115         return NULL;
01116     }
01117 
01118     // test if object is set Const
01119     if (((PyObjectBase*) self)->isConst()){
01120         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
01121         return NULL;
01122     }
01123 
01124     try { // catches all exceptions coming up from c++ and generate a python exception
01125         PyObject* ret = ((PythonWorkbenchPy*)self)->RemoveMenu(args);
01126         if (ret != 0)
01127             ((PythonWorkbenchPy*)self)->startNotify();
01128         return ret;
01129     }
01130     catch(const Base::Exception& e) // catch the FreeCAD exceptions
01131     {
01132         std::string str;
01133         str += "FreeCAD exception thrown (";
01134         str += e.what();
01135         str += ")";
01136         e.ReportException();
01137         PyErr_SetString(PyExc_Exception,str.c_str());
01138         return NULL;
01139     }
01140     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
01141     {
01142         std::string str;
01143         str += "File system exception thrown (";
01144         //str += e.who();
01145         //str += ", ";
01146         str += e.what();
01147         str += ")\n";
01148         Base::Console().Error(str.c_str());
01149         PyErr_SetString(PyExc_Exception,str.c_str());
01150         return NULL;
01151     }
01152     catch(const Py::Exception&)
01153     {
01154         // The exception text is already set
01155         return NULL;
01156     }
01157     catch(const char* e) // catch simple string exceptions
01158     {
01159         Base::Console().Error(e);
01160         PyErr_SetString(PyExc_Exception,e);
01161         return NULL;
01162     }
01163     // in debug not all exceptions will be catched to get the attention of the developer!
01164 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
01165     catch(const std::exception& e) // catch other c++ exceptions
01166     {
01167         std::string str;
01168         str += "FC++ exception thrown (";
01169         str += e.what();
01170         str += ")";
01171         Base::Console().Error(str.c_str());
01172         PyErr_SetString(PyExc_Exception,str.c_str());
01173         return NULL;
01174     }
01175     catch(...)  // catch the rest!
01176     {
01177         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
01178         return NULL;
01179     }
01180 #endif
01181 }
01182 
01183 // ListMenus() callback and implementer
01184 // PyObject*  PythonWorkbenchPy::ListMenus(PyObject *args){};
01185 // has to be implemented in PythonWorkbenchPyImp.cpp
01186 PyObject * PythonWorkbenchPy::staticCallback_ListMenus (PyObject *self, PyObject *args)
01187 {
01188     // test if twin object not allready deleted
01189     if (!((PyObjectBase*) self)->isValid()){
01190         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
01191         return NULL;
01192     }
01193 
01194     // test if object is set Const
01195     if (((PyObjectBase*) self)->isConst()){
01196         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
01197         return NULL;
01198     }
01199 
01200     try { // catches all exceptions coming up from c++ and generate a python exception
01201         PyObject* ret = ((PythonWorkbenchPy*)self)->ListMenus(args);
01202         if (ret != 0)
01203             ((PythonWorkbenchPy*)self)->startNotify();
01204         return ret;
01205     }
01206     catch(const Base::Exception& e) // catch the FreeCAD exceptions
01207     {
01208         std::string str;
01209         str += "FreeCAD exception thrown (";
01210         str += e.what();
01211         str += ")";
01212         e.ReportException();
01213         PyErr_SetString(PyExc_Exception,str.c_str());
01214         return NULL;
01215     }
01216     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
01217     {
01218         std::string str;
01219         str += "File system exception thrown (";
01220         //str += e.who();
01221         //str += ", ";
01222         str += e.what();
01223         str += ")\n";
01224         Base::Console().Error(str.c_str());
01225         PyErr_SetString(PyExc_Exception,str.c_str());
01226         return NULL;
01227     }
01228     catch(const Py::Exception&)
01229     {
01230         // The exception text is already set
01231         return NULL;
01232     }
01233     catch(const char* e) // catch simple string exceptions
01234     {
01235         Base::Console().Error(e);
01236         PyErr_SetString(PyExc_Exception,e);
01237         return NULL;
01238     }
01239     // in debug not all exceptions will be catched to get the attention of the developer!
01240 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
01241     catch(const std::exception& e) // catch other c++ exceptions
01242     {
01243         std::string str;
01244         str += "FC++ exception thrown (";
01245         str += e.what();
01246         str += ")";
01247         Base::Console().Error(str.c_str());
01248         PyErr_SetString(PyExc_Exception,str.c_str());
01249         return NULL;
01250     }
01251     catch(...)  // catch the rest!
01252     {
01253         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
01254         return NULL;
01255     }
01256 #endif
01257 }
01258 
01259 // AppendContextMenu() callback and implementer
01260 // PyObject*  PythonWorkbenchPy::AppendContextMenu(PyObject *args){};
01261 // has to be implemented in PythonWorkbenchPyImp.cpp
01262 PyObject * PythonWorkbenchPy::staticCallback_AppendContextMenu (PyObject *self, PyObject *args)
01263 {
01264     // test if twin object not allready deleted
01265     if (!((PyObjectBase*) self)->isValid()){
01266         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
01267         return NULL;
01268     }
01269 
01270     // test if object is set Const
01271     if (((PyObjectBase*) self)->isConst()){
01272         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
01273         return NULL;
01274     }
01275 
01276     try { // catches all exceptions coming up from c++ and generate a python exception
01277         PyObject* ret = ((PythonWorkbenchPy*)self)->AppendContextMenu(args);
01278         if (ret != 0)
01279             ((PythonWorkbenchPy*)self)->startNotify();
01280         return ret;
01281     }
01282     catch(const Base::Exception& e) // catch the FreeCAD exceptions
01283     {
01284         std::string str;
01285         str += "FreeCAD exception thrown (";
01286         str += e.what();
01287         str += ")";
01288         e.ReportException();
01289         PyErr_SetString(PyExc_Exception,str.c_str());
01290         return NULL;
01291     }
01292     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
01293     {
01294         std::string str;
01295         str += "File system exception thrown (";
01296         //str += e.who();
01297         //str += ", ";
01298         str += e.what();
01299         str += ")\n";
01300         Base::Console().Error(str.c_str());
01301         PyErr_SetString(PyExc_Exception,str.c_str());
01302         return NULL;
01303     }
01304     catch(const Py::Exception&)
01305     {
01306         // The exception text is already set
01307         return NULL;
01308     }
01309     catch(const char* e) // catch simple string exceptions
01310     {
01311         Base::Console().Error(e);
01312         PyErr_SetString(PyExc_Exception,e);
01313         return NULL;
01314     }
01315     // in debug not all exceptions will be catched to get the attention of the developer!
01316 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
01317     catch(const std::exception& e) // catch other c++ exceptions
01318     {
01319         std::string str;
01320         str += "FC++ exception thrown (";
01321         str += e.what();
01322         str += ")";
01323         Base::Console().Error(str.c_str());
01324         PyErr_SetString(PyExc_Exception,str.c_str());
01325         return NULL;
01326     }
01327     catch(...)  // catch the rest!
01328     {
01329         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
01330         return NULL;
01331     }
01332 #endif
01333 }
01334 
01335 // RemoveContextMenu() callback and implementer
01336 // PyObject*  PythonWorkbenchPy::RemoveContextMenu(PyObject *args){};
01337 // has to be implemented in PythonWorkbenchPyImp.cpp
01338 PyObject * PythonWorkbenchPy::staticCallback_RemoveContextMenu (PyObject *self, PyObject *args)
01339 {
01340     // test if twin object not allready deleted
01341     if (!((PyObjectBase*) self)->isValid()){
01342         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
01343         return NULL;
01344     }
01345 
01346     // test if object is set Const
01347     if (((PyObjectBase*) self)->isConst()){
01348         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
01349         return NULL;
01350     }
01351 
01352     try { // catches all exceptions coming up from c++ and generate a python exception
01353         PyObject* ret = ((PythonWorkbenchPy*)self)->RemoveContextMenu(args);
01354         if (ret != 0)
01355             ((PythonWorkbenchPy*)self)->startNotify();
01356         return ret;
01357     }
01358     catch(const Base::Exception& e) // catch the FreeCAD exceptions
01359     {
01360         std::string str;
01361         str += "FreeCAD exception thrown (";
01362         str += e.what();
01363         str += ")";
01364         e.ReportException();
01365         PyErr_SetString(PyExc_Exception,str.c_str());
01366         return NULL;
01367     }
01368     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
01369     {
01370         std::string str;
01371         str += "File system exception thrown (";
01372         //str += e.who();
01373         //str += ", ";
01374         str += e.what();
01375         str += ")\n";
01376         Base::Console().Error(str.c_str());
01377         PyErr_SetString(PyExc_Exception,str.c_str());
01378         return NULL;
01379     }
01380     catch(const Py::Exception&)
01381     {
01382         // The exception text is already set
01383         return NULL;
01384     }
01385     catch(const char* e) // catch simple string exceptions
01386     {
01387         Base::Console().Error(e);
01388         PyErr_SetString(PyExc_Exception,e);
01389         return NULL;
01390     }
01391     // in debug not all exceptions will be catched to get the attention of the developer!
01392 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
01393     catch(const std::exception& e) // catch other c++ exceptions
01394     {
01395         std::string str;
01396         str += "FC++ exception thrown (";
01397         str += e.what();
01398         str += ")";
01399         Base::Console().Error(str.c_str());
01400         PyErr_SetString(PyExc_Exception,str.c_str());
01401         return NULL;
01402     }
01403     catch(...)  // catch the rest!
01404     {
01405         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
01406         return NULL;
01407     }
01408 #endif
01409 }
01410 
01411 // AppendToolbar() callback and implementer
01412 // PyObject*  PythonWorkbenchPy::AppendToolbar(PyObject *args){};
01413 // has to be implemented in PythonWorkbenchPyImp.cpp
01414 PyObject * PythonWorkbenchPy::staticCallback_AppendToolbar (PyObject *self, PyObject *args)
01415 {
01416     // test if twin object not allready deleted
01417     if (!((PyObjectBase*) self)->isValid()){
01418         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
01419         return NULL;
01420     }
01421 
01422     // test if object is set Const
01423     if (((PyObjectBase*) self)->isConst()){
01424         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
01425         return NULL;
01426     }
01427 
01428     try { // catches all exceptions coming up from c++ and generate a python exception
01429         PyObject* ret = ((PythonWorkbenchPy*)self)->AppendToolbar(args);
01430         if (ret != 0)
01431             ((PythonWorkbenchPy*)self)->startNotify();
01432         return ret;
01433     }
01434     catch(const Base::Exception& e) // catch the FreeCAD exceptions
01435     {
01436         std::string str;
01437         str += "FreeCAD exception thrown (";
01438         str += e.what();
01439         str += ")";
01440         e.ReportException();
01441         PyErr_SetString(PyExc_Exception,str.c_str());
01442         return NULL;
01443     }
01444     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
01445     {
01446         std::string str;
01447         str += "File system exception thrown (";
01448         //str += e.who();
01449         //str += ", ";
01450         str += e.what();
01451         str += ")\n";
01452         Base::Console().Error(str.c_str());
01453         PyErr_SetString(PyExc_Exception,str.c_str());
01454         return NULL;
01455     }
01456     catch(const Py::Exception&)
01457     {
01458         // The exception text is already set
01459         return NULL;
01460     }
01461     catch(const char* e) // catch simple string exceptions
01462     {
01463         Base::Console().Error(e);
01464         PyErr_SetString(PyExc_Exception,e);
01465         return NULL;
01466     }
01467     // in debug not all exceptions will be catched to get the attention of the developer!
01468 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
01469     catch(const std::exception& e) // catch other c++ exceptions
01470     {
01471         std::string str;
01472         str += "FC++ exception thrown (";
01473         str += e.what();
01474         str += ")";
01475         Base::Console().Error(str.c_str());
01476         PyErr_SetString(PyExc_Exception,str.c_str());
01477         return NULL;
01478     }
01479     catch(...)  // catch the rest!
01480     {
01481         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
01482         return NULL;
01483     }
01484 #endif
01485 }
01486 
01487 // RemoveToolbar() callback and implementer
01488 // PyObject*  PythonWorkbenchPy::RemoveToolbar(PyObject *args){};
01489 // has to be implemented in PythonWorkbenchPyImp.cpp
01490 PyObject * PythonWorkbenchPy::staticCallback_RemoveToolbar (PyObject *self, PyObject *args)
01491 {
01492     // test if twin object not allready deleted
01493     if (!((PyObjectBase*) self)->isValid()){
01494         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
01495         return NULL;
01496     }
01497 
01498     // test if object is set Const
01499     if (((PyObjectBase*) self)->isConst()){
01500         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
01501         return NULL;
01502     }
01503 
01504     try { // catches all exceptions coming up from c++ and generate a python exception
01505         PyObject* ret = ((PythonWorkbenchPy*)self)->RemoveToolbar(args);
01506         if (ret != 0)
01507             ((PythonWorkbenchPy*)self)->startNotify();
01508         return ret;
01509     }
01510     catch(const Base::Exception& e) // catch the FreeCAD exceptions
01511     {
01512         std::string str;
01513         str += "FreeCAD exception thrown (";
01514         str += e.what();
01515         str += ")";
01516         e.ReportException();
01517         PyErr_SetString(PyExc_Exception,str.c_str());
01518         return NULL;
01519     }
01520     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
01521     {
01522         std::string str;
01523         str += "File system exception thrown (";
01524         //str += e.who();
01525         //str += ", ";
01526         str += e.what();
01527         str += ")\n";
01528         Base::Console().Error(str.c_str());
01529         PyErr_SetString(PyExc_Exception,str.c_str());
01530         return NULL;
01531     }
01532     catch(const Py::Exception&)
01533     {
01534         // The exception text is already set
01535         return NULL;
01536     }
01537     catch(const char* e) // catch simple string exceptions
01538     {
01539         Base::Console().Error(e);
01540         PyErr_SetString(PyExc_Exception,e);
01541         return NULL;
01542     }
01543     // in debug not all exceptions will be catched to get the attention of the developer!
01544 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
01545     catch(const std::exception& e) // catch other c++ exceptions
01546     {
01547         std::string str;
01548         str += "FC++ exception thrown (";
01549         str += e.what();
01550         str += ")";
01551         Base::Console().Error(str.c_str());
01552         PyErr_SetString(PyExc_Exception,str.c_str());
01553         return NULL;
01554     }
01555     catch(...)  // catch the rest!
01556     {
01557         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
01558         return NULL;
01559     }
01560 #endif
01561 }
01562 
01563 // ListToolbars() callback and implementer
01564 // PyObject*  PythonWorkbenchPy::ListToolbars(PyObject *args){};
01565 // has to be implemented in PythonWorkbenchPyImp.cpp
01566 PyObject * PythonWorkbenchPy::staticCallback_ListToolbars (PyObject *self, PyObject *args)
01567 {
01568     // test if twin object not allready deleted
01569     if (!((PyObjectBase*) self)->isValid()){
01570         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
01571         return NULL;
01572     }
01573 
01574     // test if object is set Const
01575     if (((PyObjectBase*) self)->isConst()){
01576         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
01577         return NULL;
01578     }
01579 
01580     try { // catches all exceptions coming up from c++ and generate a python exception
01581         PyObject* ret = ((PythonWorkbenchPy*)self)->ListToolbars(args);
01582         if (ret != 0)
01583             ((PythonWorkbenchPy*)self)->startNotify();
01584         return ret;
01585     }
01586     catch(const Base::Exception& e) // catch the FreeCAD exceptions
01587     {
01588         std::string str;
01589         str += "FreeCAD exception thrown (";
01590         str += e.what();
01591         str += ")";
01592         e.ReportException();
01593         PyErr_SetString(PyExc_Exception,str.c_str());
01594         return NULL;
01595     }
01596     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
01597     {
01598         std::string str;
01599         str += "File system exception thrown (";
01600         //str += e.who();
01601         //str += ", ";
01602         str += e.what();
01603         str += ")\n";
01604         Base::Console().Error(str.c_str());
01605         PyErr_SetString(PyExc_Exception,str.c_str());
01606         return NULL;
01607     }
01608     catch(const Py::Exception&)
01609     {
01610         // The exception text is already set
01611         return NULL;
01612     }
01613     catch(const char* e) // catch simple string exceptions
01614     {
01615         Base::Console().Error(e);
01616         PyErr_SetString(PyExc_Exception,e);
01617         return NULL;
01618     }
01619     // in debug not all exceptions will be catched to get the attention of the developer!
01620 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
01621     catch(const std::exception& e) // catch other c++ exceptions
01622     {
01623         std::string str;
01624         str += "FC++ exception thrown (";
01625         str += e.what();
01626         str += ")";
01627         Base::Console().Error(str.c_str());
01628         PyErr_SetString(PyExc_Exception,str.c_str());
01629         return NULL;
01630     }
01631     catch(...)  // catch the rest!
01632     {
01633         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
01634         return NULL;
01635     }
01636 #endif
01637 }
01638 
01639 // AppendCommandbar() callback and implementer
01640 // PyObject*  PythonWorkbenchPy::AppendCommandbar(PyObject *args){};
01641 // has to be implemented in PythonWorkbenchPyImp.cpp
01642 PyObject * PythonWorkbenchPy::staticCallback_AppendCommandbar (PyObject *self, PyObject *args)
01643 {
01644     // test if twin object not allready deleted
01645     if (!((PyObjectBase*) self)->isValid()){
01646         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
01647         return NULL;
01648     }
01649 
01650     // test if object is set Const
01651     if (((PyObjectBase*) self)->isConst()){
01652         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
01653         return NULL;
01654     }
01655 
01656     try { // catches all exceptions coming up from c++ and generate a python exception
01657         PyObject* ret = ((PythonWorkbenchPy*)self)->AppendCommandbar(args);
01658         if (ret != 0)
01659             ((PythonWorkbenchPy*)self)->startNotify();
01660         return ret;
01661     }
01662     catch(const Base::Exception& e) // catch the FreeCAD exceptions
01663     {
01664         std::string str;
01665         str += "FreeCAD exception thrown (";
01666         str += e.what();
01667         str += ")";
01668         e.ReportException();
01669         PyErr_SetString(PyExc_Exception,str.c_str());
01670         return NULL;
01671     }
01672     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
01673     {
01674         std::string str;
01675         str += "File system exception thrown (";
01676         //str += e.who();
01677         //str += ", ";
01678         str += e.what();
01679         str += ")\n";
01680         Base::Console().Error(str.c_str());
01681         PyErr_SetString(PyExc_Exception,str.c_str());
01682         return NULL;
01683     }
01684     catch(const Py::Exception&)
01685     {
01686         // The exception text is already set
01687         return NULL;
01688     }
01689     catch(const char* e) // catch simple string exceptions
01690     {
01691         Base::Console().Error(e);
01692         PyErr_SetString(PyExc_Exception,e);
01693         return NULL;
01694     }
01695     // in debug not all exceptions will be catched to get the attention of the developer!
01696 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
01697     catch(const std::exception& e) // catch other c++ exceptions
01698     {
01699         std::string str;
01700         str += "FC++ exception thrown (";
01701         str += e.what();
01702         str += ")";
01703         Base::Console().Error(str.c_str());
01704         PyErr_SetString(PyExc_Exception,str.c_str());
01705         return NULL;
01706     }
01707     catch(...)  // catch the rest!
01708     {
01709         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
01710         return NULL;
01711     }
01712 #endif
01713 }
01714 
01715 // RemoveCommandbar() callback and implementer
01716 // PyObject*  PythonWorkbenchPy::RemoveCommandbar(PyObject *args){};
01717 // has to be implemented in PythonWorkbenchPyImp.cpp
01718 PyObject * PythonWorkbenchPy::staticCallback_RemoveCommandbar (PyObject *self, PyObject *args)
01719 {
01720     // test if twin object not allready deleted
01721     if (!((PyObjectBase*) self)->isValid()){
01722         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
01723         return NULL;
01724     }
01725 
01726     // test if object is set Const
01727     if (((PyObjectBase*) self)->isConst()){
01728         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
01729         return NULL;
01730     }
01731 
01732     try { // catches all exceptions coming up from c++ and generate a python exception
01733         PyObject* ret = ((PythonWorkbenchPy*)self)->RemoveCommandbar(args);
01734         if (ret != 0)
01735             ((PythonWorkbenchPy*)self)->startNotify();
01736         return ret;
01737     }
01738     catch(const Base::Exception& e) // catch the FreeCAD exceptions
01739     {
01740         std::string str;
01741         str += "FreeCAD exception thrown (";
01742         str += e.what();
01743         str += ")";
01744         e.ReportException();
01745         PyErr_SetString(PyExc_Exception,str.c_str());
01746         return NULL;
01747     }
01748     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
01749     {
01750         std::string str;
01751         str += "File system exception thrown (";
01752         //str += e.who();
01753         //str += ", ";
01754         str += e.what();
01755         str += ")\n";
01756         Base::Console().Error(str.c_str());
01757         PyErr_SetString(PyExc_Exception,str.c_str());
01758         return NULL;
01759     }
01760     catch(const Py::Exception&)
01761     {
01762         // The exception text is already set
01763         return NULL;
01764     }
01765     catch(const char* e) // catch simple string exceptions
01766     {
01767         Base::Console().Error(e);
01768         PyErr_SetString(PyExc_Exception,e);
01769         return NULL;
01770     }
01771     // in debug not all exceptions will be catched to get the attention of the developer!
01772 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
01773     catch(const std::exception& e) // catch other c++ exceptions
01774     {
01775         std::string str;
01776         str += "FC++ exception thrown (";
01777         str += e.what();
01778         str += ")";
01779         Base::Console().Error(str.c_str());
01780         PyErr_SetString(PyExc_Exception,str.c_str());
01781         return NULL;
01782     }
01783     catch(...)  // catch the rest!
01784     {
01785         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
01786         return NULL;
01787     }
01788 #endif
01789 }
01790 
01791 // ListCommandbars() callback and implementer
01792 // PyObject*  PythonWorkbenchPy::ListCommandbars(PyObject *args){};
01793 // has to be implemented in PythonWorkbenchPyImp.cpp
01794 PyObject * PythonWorkbenchPy::staticCallback_ListCommandbars (PyObject *self, PyObject *args)
01795 {
01796     // test if twin object not allready deleted
01797     if (!((PyObjectBase*) self)->isValid()){
01798         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
01799         return NULL;
01800     }
01801 
01802     // test if object is set Const
01803     if (((PyObjectBase*) self)->isConst()){
01804         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a non const method");
01805         return NULL;
01806     }
01807 
01808     try { // catches all exceptions coming up from c++ and generate a python exception
01809         PyObject* ret = ((PythonWorkbenchPy*)self)->ListCommandbars(args);
01810         if (ret != 0)
01811             ((PythonWorkbenchPy*)self)->startNotify();
01812         return ret;
01813     }
01814     catch(const Base::Exception& e) // catch the FreeCAD exceptions
01815     {
01816         std::string str;
01817         str += "FreeCAD exception thrown (";
01818         str += e.what();
01819         str += ")";
01820         e.ReportException();
01821         PyErr_SetString(PyExc_Exception,str.c_str());
01822         return NULL;
01823     }
01824     catch(const boost::filesystem::filesystem_error& e) // catch boost filesystem exception
01825     {
01826         std::string str;
01827         str += "File system exception thrown (";
01828         //str += e.who();
01829         //str += ", ";
01830         str += e.what();
01831         str += ")\n";
01832         Base::Console().Error(str.c_str());
01833         PyErr_SetString(PyExc_Exception,str.c_str());
01834         return NULL;
01835     }
01836     catch(const Py::Exception&)
01837     {
01838         // The exception text is already set
01839         return NULL;
01840     }
01841     catch(const char* e) // catch simple string exceptions
01842     {
01843         Base::Console().Error(e);
01844         PyErr_SetString(PyExc_Exception,e);
01845         return NULL;
01846     }
01847     // in debug not all exceptions will be catched to get the attention of the developer!
01848 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
01849     catch(const std::exception& e) // catch other c++ exceptions
01850     {
01851         std::string str;
01852         str += "FC++ exception thrown (";
01853         str += e.what();
01854         str += ")";
01855         Base::Console().Error(str.c_str());
01856         PyErr_SetString(PyExc_Exception,str.c_str());
01857         return NULL;
01858     }
01859     catch(...)  // catch the rest!
01860     {
01861         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
01862         return NULL;
01863     }
01864 #endif
01865 }
01866 
01867 
01868 
01869 //--------------------------------------------------------------------------
01870 // Parents structure
01871 //--------------------------------------------------------------------------
01872 PyParentObject PythonWorkbenchPy::Parents[] = { PARENTSGuiPythonWorkbenchPy };
01873 
01874 //--------------------------------------------------------------------------
01875 // Constructor
01876 //--------------------------------------------------------------------------
01877 PythonWorkbenchPy::PythonWorkbenchPy(PythonWorkbench *pcObject, PyTypeObject *T)
01878     : WorkbenchPy(reinterpret_cast<WorkbenchPy::PointerType>(pcObject), T)
01879 {
01880 }
01881 
01882 PyObject *PythonWorkbenchPy::PyMake(struct _typeobject *, PyObject *, PyObject *)  // Python wrapper
01883 {
01884     // never create such objects with the constructor
01885     PyErr_SetString(PyExc_RuntimeError, "You cannot create directly an instance of 'PythonWorkbenchPy'.");
01886  
01887     return 0;
01888 }
01889 
01890 int PythonWorkbenchPy::PyInit(PyObject* /*args*/, PyObject* /*kwd*/)
01891 {
01892     return 0;
01893 }
01894 
01895 //--------------------------------------------------------------------------
01896 // destructor
01897 //--------------------------------------------------------------------------
01898 PythonWorkbenchPy::~PythonWorkbenchPy()                                // Everything handled in parent
01899 {
01900 }
01901 
01902 //--------------------------------------------------------------------------
01903 // PythonWorkbenchPy representation
01904 //--------------------------------------------------------------------------
01905 PyObject *PythonWorkbenchPy::_repr(void)
01906 {
01907     return Py_BuildValue("s", representation().c_str());
01908 }
01909 
01910 //--------------------------------------------------------------------------
01911 // PythonWorkbenchPy Attributes
01912 //--------------------------------------------------------------------------
01913 PyObject *PythonWorkbenchPy::_getattr(char *attr)                               // __getattr__ function: note only need to handle new state
01914 {
01915     try {
01916         // getter method for special Attributes (e.g. dynamic ones)
01917         PyObject *r = getCustomAttributes(attr);
01918         if(r) return r;
01919     }
01920 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
01921     catch(const Base::Exception& e) // catch the FreeCAD exceptions
01922     {
01923         std::string str;
01924         str += "FreeCAD exception thrown (";
01925         str += e.what();
01926         str += ")";
01927         e.ReportException();
01928         PyErr_SetString(PyExc_Exception,str.c_str());
01929         return NULL;
01930     }
01931     catch(const std::exception& e) // catch other c++ exceptions
01932     {
01933         std::string str;
01934         str += "FC++ exception thrown (";
01935         str += e.what();
01936         str += ")";
01937         Base::Console().Error(str.c_str());
01938         PyErr_SetString(PyExc_Exception,str.c_str());
01939         return NULL;
01940     }
01941     catch(const Py::Exception&)
01942     {
01943         // The exception text is already set
01944         return NULL;
01945     }
01946     catch(...)  // catch the rest!
01947     {
01948         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
01949         return NULL;
01950     }
01951 #else  // DONT_CATCH_CXX_EXCEPTIONS  
01952     catch(const Base::Exception& e) // catch the FreeCAD exceptions
01953     {
01954         std::string str;
01955         str += "FreeCAD exception thrown (";
01956         str += e.what();
01957         str += ")";
01958         e.ReportException();
01959         PyErr_SetString(PyExc_Exception,str.c_str());
01960         return NULL;
01961     }
01962     catch(const Py::Exception&)
01963     {
01964         // The exception text is already set
01965         return NULL;
01966     }
01967 #endif  // DONT_CATCH_CXX_EXCEPTIONS
01968 
01969     PyObject *rvalue = Py_FindMethod(Methods, this, attr);
01970     if (rvalue == NULL)
01971     {
01972         PyErr_Clear();
01973         return WorkbenchPy::_getattr(attr);
01974     }
01975     else
01976     {
01977         return rvalue;
01978     }
01979 }
01980 
01981 int PythonWorkbenchPy::_setattr(char *attr, PyObject *value)    // __setattr__ function: note only need to handle new state
01982 {
01983     try {
01984         // setter for  special Attributes (e.g. dynamic ones)
01985         int r = setCustomAttributes(attr, value);
01986         if(r==1) return 0;
01987     }
01988 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
01989     catch(const Base::Exception& e) // catch the FreeCAD exceptions
01990     {
01991         std::string str;
01992         str += "FreeCAD exception thrown (";
01993         str += e.what();
01994         str += ")";
01995         e.ReportException();
01996         PyErr_SetString(PyExc_Exception,str.c_str());
01997         return -1;
01998     }
01999     catch(const std::exception& e) // catch other c++ exceptions
02000     {
02001         std::string str;
02002         str += "FC++ exception thrown (";
02003         str += e.what();
02004         str += ")";
02005         Base::Console().Error(str.c_str());
02006         PyErr_SetString(PyExc_Exception,str.c_str());
02007         return -1;
02008     }
02009     catch(const Py::Exception&)
02010     {
02011         // The exception text is already set
02012         return -1;
02013     }
02014     catch(...)  // catch the rest!
02015     {
02016         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
02017         return -1;
02018     }
02019 #else  // DONT_CATCH_CXX_EXCEPTIONS  
02020     catch(const Base::Exception& e) // catch the FreeCAD exceptions
02021     {
02022         std::string str;
02023         str += "FreeCAD exception thrown (";
02024         str += e.what();
02025         str += ")";
02026         e.ReportException();
02027         PyErr_SetString(PyExc_Exception,str.c_str());
02028         return -1;
02029     }
02030     catch(const Py::Exception&)
02031     {
02032         // The exception text is already set
02033         return -1;
02034     }
02035 #endif  // DONT_CATCH_CXX_EXCEPTIONS
02036 
02037     return WorkbenchPy::_setattr(attr, value);
02038 }
02039 
02040 PythonWorkbench *PythonWorkbenchPy::getPythonWorkbenchPtr(void) const
02041 {
02042     return static_cast<PythonWorkbench *>(_pcTwinPointer);
02043 }
02044 
02045 #if 0
02046 /* From here on come the methods you have to implement, but NOT in this module. Implement in PythonWorkbenchPyImp.cpp! This prototypes 
02047  * are just for convenience when you add a new method.
02048  */
02049 
02050 
02051 // returns a string which represents the object e.g. when printed in python
02052 std::string PythonWorkbenchPy::representation(void) const
02053 {
02054     return std::string("<PythonWorkbench object>");
02055 }
02056 
02057 PyObject* PythonWorkbenchPy::appendMenu(PyObject *args)
02058 {
02059     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
02060     return 0;
02061 }
02062 
02063 PyObject* PythonWorkbenchPy::removeMenu(PyObject *args)
02064 {
02065     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
02066     return 0;
02067 }
02068 
02069 PyObject* PythonWorkbenchPy::listMenus(PyObject *args)
02070 {
02071     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
02072     return 0;
02073 }
02074 
02075 PyObject* PythonWorkbenchPy::appendContextMenu(PyObject *args)
02076 {
02077     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
02078     return 0;
02079 }
02080 
02081 PyObject* PythonWorkbenchPy::removeContextMenu(PyObject *args)
02082 {
02083     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
02084     return 0;
02085 }
02086 
02087 PyObject* PythonWorkbenchPy::appendToolbar(PyObject *args)
02088 {
02089     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
02090     return 0;
02091 }
02092 
02093 PyObject* PythonWorkbenchPy::removeToolbar(PyObject *args)
02094 {
02095     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
02096     return 0;
02097 }
02098 
02099 PyObject* PythonWorkbenchPy::listToolbars(PyObject *args)
02100 {
02101     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
02102     return 0;
02103 }
02104 
02105 PyObject* PythonWorkbenchPy::appendCommandbar(PyObject *args)
02106 {
02107     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
02108     return 0;
02109 }
02110 
02111 PyObject* PythonWorkbenchPy::removeCommandbar(PyObject *args)
02112 {
02113     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
02114     return 0;
02115 }
02116 
02117 PyObject* PythonWorkbenchPy::listCommandbars(PyObject *args)
02118 {
02119     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
02120     return 0;
02121 }
02122 
02123 PyObject* PythonWorkbenchPy::AppendMenu(PyObject *args)
02124 {
02125     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
02126     return 0;
02127 }
02128 
02129 PyObject* PythonWorkbenchPy::RemoveMenu(PyObject *args)
02130 {
02131     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
02132     return 0;
02133 }
02134 
02135 PyObject* PythonWorkbenchPy::ListMenus(PyObject *args)
02136 {
02137     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
02138     return 0;
02139 }
02140 
02141 PyObject* PythonWorkbenchPy::AppendContextMenu(PyObject *args)
02142 {
02143     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
02144     return 0;
02145 }
02146 
02147 PyObject* PythonWorkbenchPy::RemoveContextMenu(PyObject *args)
02148 {
02149     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
02150     return 0;
02151 }
02152 
02153 PyObject* PythonWorkbenchPy::AppendToolbar(PyObject *args)
02154 {
02155     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
02156     return 0;
02157 }
02158 
02159 PyObject* PythonWorkbenchPy::RemoveToolbar(PyObject *args)
02160 {
02161     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
02162     return 0;
02163 }
02164 
02165 PyObject* PythonWorkbenchPy::ListToolbars(PyObject *args)
02166 {
02167     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
02168     return 0;
02169 }
02170 
02171 PyObject* PythonWorkbenchPy::AppendCommandbar(PyObject *args)
02172 {
02173     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
02174     return 0;
02175 }
02176 
02177 PyObject* PythonWorkbenchPy::RemoveCommandbar(PyObject *args)
02178 {
02179     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
02180     return 0;
02181 }
02182 
02183 PyObject* PythonWorkbenchPy::ListCommandbars(PyObject *args)
02184 {
02185     PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
02186     return 0;
02187 }
02188 
02189 
02190 
02191 PyObject *PythonWorkbenchPy::getCustomAttributes(const char* attr) const
02192 {
02193     return 0;
02194 }
02195 
02196 int PythonWorkbenchPy::setCustomAttributes(const char* attr, PyObject *obj)
02197 {
02198     return 0; 
02199 }
02200 #endif
02201 
02202 
02203 

Generated on Wed Nov 23 19:00:32 2011 for FreeCAD by  doxygen 1.6.1