itom 2.0.0
D:/git-itom/sources/itom/Qitom/python/pythonItom.h
00001 /* ********************************************************************
00002     itom software
00003     URL: http://www.uni-stuttgart.de/ito
00004     Copyright (C) 2013, Institut fuer Technische Optik (ITO),
00005     Universitaet Stuttgart, Germany
00006 
00007     This file is part of itom.
00008   
00009     itom is free software; you can redistribute it and/or modify it
00010     under the terms of the GNU Library General Public Licence as published by
00011     the Free Software Foundation; either version 2 of the Licence, or (at
00012     your option) any later version.
00013 
00014     itom is distributed in the hope that it will be useful, but
00015     WITHOUT ANY WARRANTY; without even the implied warranty of
00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library
00017     General Public Licence for more details.
00018 
00019     You should have received a copy of the GNU Library General Public License
00020     along with itom. If not, see <http://www.gnu.org/licenses/>.
00021 *********************************************************************** */
00022 
00023 #ifndef PYTHONITOM_H
00024 #define PYTHONITOM_H
00025 
00026 /* includes */
00027 #ifndef Q_MOC_RUN
00028     #define PY_ARRAY_UNIQUE_SYMBOL itom_ARRAY_API //see numpy help ::array api :: Miscellaneous :: Importing the api (this line must bebefore include global.h)
00029     #define NO_IMPORT_ARRAY
00030 
00031     //python
00032     // see http://vtk.org/gitweb?p=VTK.git;a=commitdiff;h=7f3f750596a105d48ea84ebfe1b1c4ca03e0bab3
00033     #if (defined _DEBUG) && (defined WIN32)
00034         #undef _DEBUG
00035         #include "Python.h"
00036         #define _DEBUG
00037     #else
00038         #include "Python.h"
00039     #endif
00040 #endif
00041 
00042 #include "../global.h"
00043 
00044 #include <qhash.h>
00045 #include <qstring.h>
00046 
00047 namespace ito 
00048 {
00049 
00050 class FuncWeakRef; //forward declaration
00051 
00052 class PythonItom
00053 {
00054 
00055 public:
00056     static PyMethodDef PythonMethodItom[];
00057     static PyModuleDef PythonModuleItom;
00058     static PyObject* PyInitItom(void);
00059 
00061     static PyObject* PyOpenEmptyScriptEditor(PyObject *pSelf, PyObject *pArgs);
00062     static PyObject* PyNewScript(PyObject *pSelf, PyObject *pArgs);
00063     static PyObject* PyOpenScript(PyObject *pSelf, PyObject *pArgs);
00064     static PyObject* PyClearCommandLine(PyObject *pSelf);
00065 
00066     static PyObject* PyPlotImage(PyObject *pSelf, PyObject *pArgs, PyObject *pKwds);
00067     static PyObject* PyLiveImage(PyObject *pSelf, PyObject *pArgs, PyObject *pKwds);
00068 
00069     static PyObject* PyFilter(PyObject *pSelf, PyObject *pArgs, PyObject *kwds);
00070     static PyObject* PyFilterHelp(PyObject* pSelf, PyObject* pArgs, PyObject *pKwds);
00071     static PyObject* PyWidgetHelp(PyObject* pSelf, PyObject* pArgs, PyObject *pKwds);
00072     static PyObject* PyPluginHelp(PyObject* pSelf, PyObject* pArgs, PyObject *pKwds);
00073     static PyObject* PyPlotHelp(PyObject* pSelf, PyObject* pArgs, PyObject *pKwds);
00074     static PyObject* PyITOMVersion(PyObject* pSelf, PyObject* pArgs);
00075 
00076     static PyObject* PyLoadIDC(PyObject* pSelf, PyObject* pArgs, PyObject *pKwds);
00077     static PyObject* PySaveIDC(PyObject* pSelf, PyObject* pArgs, PyObject *pKwds);
00078 
00079     static PyObject* PyPluginLoaded(PyObject* pSelf, PyObject* pArgs);
00080     static PyObject* PyFilterLoaded(PyObject* pSelf, PyObject* pArgs);
00081     static PyObject* PyPlotLoaded(PyObject* pSelf, PyObject* pArgs);
00082 
00083     static PyObject* PySaveDataObject(PyObject* pSelf, PyObject* pArgs, PyObject *pKwds);
00084     static PyObject* PyLoadDataObject(PyObject* pSelf, PyObject* pArgs, PyObject *pKwds);
00085 
00086     static PyObject* PyAddButton(PyObject* pSelf, PyObject* pArgs, PyObject *kwds);
00087     static PyObject* PyRemoveButton(PyObject* pSelf, PyObject* pArgs);
00088 
00089     static PyObject* PyAddMenu(PyObject* pSelf, PyObject* args, PyObject *kwds);
00090     static PyObject* PyRemoveMenu(PyObject* pSelf, PyObject* args, PyObject *kwds);
00091 
00092     static PyObject* PyCheckSignals(PyObject* pSelf);
00093     static PyObject* PyProcessEvents(PyObject* pSelf);
00094 
00095     static PyObject* PySaveMatlabMat(PyObject* pSelf, PyObject* pArgs);
00096     static PyObject* PyLoadMatlabMat(PyObject* pSelf, PyObject* pArgs);
00097     static PyObject* PyMatlabMatDataObjectConverter(PyObject *element);  
00099     static PyObject* PyGetDebugger(PyObject* pSelf);
00100     static PyObject* PyGCStartTracking(PyObject *pSelf);
00101     static PyObject* PyGCEndTracking(PyObject *pSelf);
00102     //static PyObject* PyGetGlobalDict(PyObject *pSelf);
00103 
00104     static PyObject* PyAutoReloader(PyObject* pSelf, PyObject *args, PyObject *kwds);
00105 
00106     static PyObject* PyGetScreenInfo(PyObject* pSelf);
00107 
00108     static PyObject* getDefaultScaleableUnits(PyObject* pSelf);
00109     static PyObject* scaleValueAndUnit(PyObject* pSelf, PyObject* pArgs, PyObject *pKwds);
00110 
00111     static PyObject* getAppPath(PyObject* pSelf);
00112     static PyObject* getCurrentPath(PyObject* pSelf);
00113     static PyObject* setCurrentPath(PyObject* pSelf, PyObject* pArgs);
00114 
00115     static PyObject* PyGetPalette(PyObject* pSelf, PyObject* pArgs);
00116     static PyObject* PySetPalette(PyObject* pSelf, PyObject* pArgs);
00117     static PyObject* PyGetPaletteList(PyObject* pSelf, PyObject* pArgs);
00118 
00119     static PyObject* compressData(PyObject* pSelf, PyObject* pArgs);
00120     static PyObject* uncompressData(PyObject* pSelf, PyObject* pArgs);
00121 
00122     static PyObject* setApplicationCursor(PyObject* pSelf, PyObject* pArgs);
00123 
00124     static PyObject* userCheckIsAdmin(PyObject* pSelf);
00125     static PyObject* userCheckIsDeveloper(PyObject* pSelf);
00126     static PyObject* userCheckIsUser(PyObject* pSelf);
00127     static PyObject* userGetUserInfo(PyObject* pSelf);
00128 
00129 protected:
00130     static QHash<size_t, QString> m_gcTrackerList; 
00131 
00132     static ito::FuncWeakRef* hashButtonOrMenuCode(PyObject *code, PyObject *argtuple, ito::RetVal &retval, QString &codeString);
00133     static ito::RetVal unhashButtonOrMenuCode(const size_t &funcID);
00134     static ito::RetVal unhashButtonOrMenuCode(const ito::FuncWeakRef *funcWeakRef);
00135 };
00136 
00137 } //end namespace ito
00138 #endif
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends