itom  3.0.0
pythonItom.h
1 /* ********************************************************************
2  itom software
3  URL: http://www.uni-stuttgart.de/ito
4  Copyright (C) 2016, Institut fuer Technische Optik (ITO),
5  Universitaet Stuttgart, Germany
6 
7  This file is part of itom.
8 
9  itom is free software; you can redistribute it and/or modify it
10  under the terms of the GNU Library General Public Licence as published by
11  the Free Software Foundation; either version 2 of the Licence, or (at
12  your option) any later version.
13 
14  itom is distributed in the hope that it will be useful, but
15  WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
17  General Public Licence for more details.
18 
19  You should have received a copy of the GNU Library General Public License
20  along with itom. If not, see <http://www.gnu.org/licenses/>.
21 *********************************************************************** */
22 
23 #ifndef PYTHONITOM_H
24 #define PYTHONITOM_H
25 
26 /* includes */
27 #ifndef Q_MOC_RUN
28  #define PY_ARRAY_UNIQUE_SYMBOL itom_ARRAY_API //see numpy help ::array api :: Miscellaneous :: Importing the api (this line must bebefore include global.h)
29  #define NO_IMPORT_ARRAY
30 
31  //python
32  // see http://vtk.org/gitweb?p=VTK.git;a=commitdiff;h=7f3f750596a105d48ea84ebfe1b1c4ca03e0bab3
33  #if (defined _DEBUG) && (defined WIN32)
34  #undef _DEBUG
35  #include "Python.h"
36  #define _DEBUG
37  #else
38  #include "Python.h"
39  #endif
40 #endif
41 
42 #include "../global.h"
43 
44 #include <qhash.h>
45 #include <qstring.h>
46 
47 namespace ito
48 {
49 
50 class FuncWeakRef; //forward declaration
51 
53 {
54 
55 public:
56  static PyMethodDef PythonMethodItom[];
57  static PyModuleDef PythonModuleItom;
58  static PyObject* PyInitItom(void);
59 
61  static PyObject* PyOpenEmptyScriptEditor(PyObject *pSelf, PyObject *pArgs);
62  static PyObject* PyNewScript(PyObject *pSelf, PyObject *pArgs);
63  static PyObject* PyOpenScript(PyObject *pSelf, PyObject *pArgs);
64  static PyObject* PyClearCommandLine(PyObject *pSelf);
65  static PyObject* PyShowHelpViewer(PyObject *pSelf, PyObject *pArgs);
66 
67  static PyObject* PyPlotImage(PyObject *pSelf, PyObject *pArgs, PyObject *pKwds);
68  static PyObject* PyLiveImage(PyObject *pSelf, PyObject *pArgs, PyObject *pKwds);
69 
70  static PyObject* PyFilter(PyObject *pSelf, PyObject *pArgs, PyObject *kwds);
71  static PyObject* PyFilterHelp(PyObject* pSelf, PyObject* pArgs, PyObject *pKwds);
72  static PyObject* PyWidgetHelp(PyObject* pSelf, PyObject* pArgs, PyObject *pKwds);
73  static PyObject* PyPluginHelp(PyObject* pSelf, PyObject* pArgs, PyObject *pKwds);
74  static PyObject* PyPlotHelp(PyObject* pSelf, PyObject* pArgs, PyObject *pKwds);
75  static PyObject* PyITOMVersion(PyObject* pSelf, PyObject* pArgs);
76 
77  static PyObject* PyLoadIDC(PyObject* pSelf, PyObject* pArgs, PyObject *pKwds);
78  static PyObject* PySaveIDC(PyObject* pSelf, PyObject* pArgs, PyObject *pKwds);
79 
80  static PyObject* PyPluginLoaded(PyObject* pSelf, PyObject* pArgs);
81  static PyObject* PyFilterLoaded(PyObject* pSelf, PyObject* pArgs);
82  static PyObject* PyPlotLoaded(PyObject* pSelf, PyObject* pArgs);
83 
84  static PyObject* PySaveDataObject(PyObject* pSelf, PyObject* pArgs, PyObject *pKwds);
85  static PyObject* PyLoadDataObject(PyObject* pSelf, PyObject* pArgs, PyObject *pKwds);
86 
87  static PyObject* PyAddButton(PyObject* pSelf, PyObject* pArgs, PyObject *kwds);
88  static PyObject* PyRemoveButton(PyObject* pSelf, PyObject* pArgs);
89 
90  static PyObject* PyAddMenu(PyObject* pSelf, PyObject* args, PyObject *kwds);
91  static PyObject* PyRemoveMenu(PyObject* pSelf, PyObject* args, PyObject *kwds);
92 
93  static PyObject* PyCheckSignals(PyObject* pSelf);
94  static PyObject* PyProcessEvents(PyObject* pSelf);
95 
96  static PyObject* PySaveMatlabMat(PyObject* pSelf, PyObject* pArgs);
97  static PyObject* PyLoadMatlabMat(PyObject* pSelf, PyObject* pArgs);
98  static PyObject* PyMatlabMatDataObjectConverter(PyObject *element);
100  static PyObject* PyGetDebugger(PyObject* pSelf);
101  static PyObject* PyGCStartTracking(PyObject *pSelf);
102  static PyObject* PyGCEndTracking(PyObject *pSelf);
103 
104  static PyObject* PyAutoReloader(PyObject* pSelf, PyObject *args, PyObject *kwds);
105 
106  static PyObject* PyGetScreenInfo(PyObject* pSelf);
107 
108  static PyObject* getDefaultScaleableUnits(PyObject* pSelf);
109  static PyObject* scaleValueAndUnit(PyObject* pSelf, PyObject* pArgs, PyObject *pKwds);
110 
111  static PyObject* getAppPath(PyObject* pSelf);
112  static PyObject* getQtToolPath(PyObject* pSelf, PyObject* pArgs);
113  static PyObject* getCurrentPath(PyObject* pSelf);
114  static PyObject* setCurrentPath(PyObject* pSelf, PyObject* pArgs);
115 
116  static PyObject* PyGetPalette(PyObject* pSelf, PyObject* pArgs);
117  static PyObject* PySetPalette(PyObject* pSelf, PyObject* pArgs);
118  static PyObject* PyGetPaletteList(PyObject* pSelf, PyObject* pArgs);
119 
120  static PyObject* compressData(PyObject* pSelf, PyObject* pArgs);
121  static PyObject* uncompressData(PyObject* pSelf, PyObject* pArgs);
122 
123  static PyObject* setApplicationCursor(PyObject* pSelf, PyObject* pArgs);
124 
125  static PyObject* userCheckIsAdmin(PyObject* pSelf);
126  static PyObject* userCheckIsDeveloper(PyObject* pSelf);
127  static PyObject* userCheckIsUser(PyObject* pSelf);
128  static PyObject* userGetUserInfo(PyObject* pSelf);
129 
130 protected:
131  static QHash<size_t, QString> m_gcTrackerList;
132 
133  static ito::FuncWeakRef* hashButtonOrMenuCode(PyObject *code, PyObject *argtuple, ito::RetVal &retval, QString &codeString);
134  static ito::RetVal unhashButtonOrMenuCode(const size_t &funcID);
135  static ito::RetVal unhashButtonOrMenuCode(const ito::FuncWeakRef *funcWeakRef);
136 };
137 
138 } //end namespace ito
139 #endif
Definition: pythonItom.h:52
static PyObject * PyMatlabMatDataObjectConverter(PyObject *element)
returns new reference to element and extracts tags, if possible
Definition: pythonItom.cpp:3147
Class for managing status values (like errors or warning)
Definition: retVal.h:54
static QHash< size_t, QString > m_gcTrackerList
list with objects currently tracked by python garbage collector.
Definition: pythonItom.h:131
static PyObject * PyInitItom(void)
methods of module itom
Definition: pythonItom.cpp:4560
static PyObject * PyNewScript(PyObject *pSelf, PyObject *pArgs)
Definition: pythonItom.cpp:104
Definition: apiFunctionsGraph.cpp:39
static PyObject * PyOpenScript(PyObject *pSelf, PyObject *pArgs)
Definition: pythonItom.cpp:145
static PyObject * PyOpenEmptyScriptEditor(PyObject *pSelf, PyObject *pArgs)
Definition: pythonItom.cpp:72
Definition: pythonEngine.h:106
static PyObject * PyITOMVersion(PyObject *pSelf, PyObject *pArgs)
Definition: pythonItom.cpp:1978