itom  4.1.0
pythonItom.h
1 /* ********************************************************************
2  itom software
3  URL: http://www.uni-stuttgart.de/ito
4  Copyright (C) 2020, 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/pythonWrapper.h"
36  #define _DEBUG
37  #else
38  #include "python/pythonWrapper.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* PyPlot1d(PyObject *pSelf, PyObject *pArgs, PyObject *pKwds);
71  static PyObject* PyPlot2d(PyObject *pSelf, PyObject *pArgs, PyObject *pKwds);
72  static PyObject* PyPlot25d(PyObject *pSelf, PyObject *pArgs, PyObject *pKwds);
73 
74  static PyObject* PyFilter(PyObject *pSelf, PyObject *pArgs, PyObject *pKwds);
75  static PyObject* PyFilterHelp(PyObject* pSelf, PyObject* pArgs, PyObject *pKwds);
76  static PyObject* PyWidgetHelp(PyObject* pSelf, PyObject* pArgs, PyObject *pKwds);
77  static PyObject* PyPluginHelp(PyObject* pSelf, PyObject* pArgs, PyObject *pKwds);
78  static PyObject* PyAboutInfo(PyObject* pSelf, PyObject* pArgs, PyObject *pKwds);
79  static PyObject* PyPlotHelp(PyObject* pSelf, PyObject* pArgs, PyObject *pKwds);
80  static PyObject* PyItomVersion(PyObject* pSelf, PyObject* pArgs, PyObject* pKwds);
81 
82  static PyObject* PyLoadIDC(PyObject* pSelf, PyObject* pArgs, PyObject *pKwds);
83  static PyObject* PySaveIDC(PyObject* pSelf, PyObject* pArgs, PyObject *pKwds);
84 
85  static PyObject* PyPluginLoaded(PyObject* pSelf, PyObject* pArgs);
86  static PyObject* PyFilterLoaded(PyObject* pSelf, PyObject* pArgs);
87  static PyObject* PyPlotLoaded(PyObject* pSelf, PyObject* pArgs);
88 
89  static PyObject* PySaveDataObject(PyObject* pSelf, PyObject* pArgs, PyObject *pKwds);
90  static PyObject* PyLoadDataObject(PyObject* pSelf, PyObject* pArgs, PyObject *pKwds);
91 
92  static PyObject* PyRegisterResource(PyObject* pSelf, PyObject* pArgs, PyObject *pKwds);
93  static PyObject* PyUnregisterResource(PyObject* pSelf, PyObject* pArgs, PyObject *pKwds);
94 
95  static PyObject* PyAddButton(PyObject* pSelf, PyObject* pArgs, PyObject *kwds);
96  static PyObject* PyRemoveButton(PyObject* pSelf, PyObject* pArgs);
97 
98  static PyObject* PyAddMenu(PyObject* pSelf, PyObject* args, PyObject *kwds);
99  static PyObject* PyRemoveMenu(PyObject* pSelf, PyObject* args, PyObject *kwds);
100 
101  static PyObject* PySetCentralWidgetsSizes(PyObject* pSelf, PyObject* pArgs, PyObject* pKwds);
102 
103  static PyObject* PyDumpMenusAndButtons(PyObject* pSelf);
104 
105  static PyObject* PyCheckSignals(PyObject* pSelf);
106  static PyObject* PyProcessEvents(PyObject* pSelf);
107 
108  static PyObject* PySaveMatlabMat(PyObject* pSelf, PyObject* pArgs);
109  static PyObject* PyLoadMatlabMat(PyObject* pSelf, PyObject* pArgs);
110  static PyObject* PyMatlabMatDataObjectConverter(PyObject *element);
112  static PyObject* PyGetDebugger(PyObject* pSelf);
113  static PyObject* PyGCStartTracking(PyObject *pSelf);
114  static PyObject* PyGCEndTracking(PyObject *pSelf);
115 
116  static PyObject* PyAutoReloader(PyObject* pSelf, PyObject *args, PyObject *kwds);
117 
118  static PyObject* PyGetScreenInfo(PyObject* pSelf);
119 
120  static PyObject* getDefaultScaleableUnits(PyObject* pSelf);
121  static PyObject* scaleValueAndUnit(PyObject* pSelf, PyObject* pArgs, PyObject *pKwds);
122 
123  static PyObject* getAppPath(PyObject* pSelf);
124  static PyObject* getQtToolPath(PyObject* pSelf, PyObject* pArgs);
125  static PyObject* getCurrentPath(PyObject* pSelf);
126  static PyObject* setCurrentPath(PyObject* pSelf, PyObject* pArgs);
127 
128  static PyObject* PyGetPalette(PyObject* pSelf, PyObject* pArgs);
129  static PyObject* PySetPalette(PyObject* pSelf, PyObject* pArgs, PyObject *pKwds);
130  static PyObject* PyGetPaletteList(PyObject* pSelf, PyObject* pArgs);
131 
132  static PyObject* compressData(PyObject* pSelf, PyObject* pArgs);
133  static PyObject* uncompressData(PyObject* pSelf, PyObject* pArgs);
134 
135  static PyObject* setApplicationCursor(PyObject* pSelf, PyObject* pArgs);
136 
137  static PyObject* userCheckIsAdmin(PyObject* pSelf);
138  static PyObject* userCheckIsDeveloper(PyObject* pSelf);
139  static PyObject* userCheckIsUser(PyObject* pSelf);
140  static PyObject* userGetUserInfo(PyObject* pSelf);
141 
142  static PyObject* PyClearAll(PyObject* pSelf);
143 
144 protected:
145  static QHash<size_t, QString> m_gcTrackerList;
146 
147  static ito::FuncWeakRef* hashButtonOrMenuCode(PyObject *code, PyObject *argtuple, ito::RetVal &retval, QString &codeString);
148  static ito::RetVal unhashButtonOrMenuCode(const size_t &funcID);
149  static ito::RetVal unhashButtonOrMenuCode(const ito::FuncWeakRef *funcWeakRef);
150 };
151 
152 } //end namespace ito
153 #endif
Definition: pythonItom.h:52
static PyObject * PyMatlabMatDataObjectConverter(PyObject *element)
returns new reference to element and extracts tags, if possible
Definition: pythonItom.cpp:4178
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:145
static PyObject * PyInitItom(void)
methods of module itom
Definition: pythonItom.cpp:6243
static PyObject * PyNewScript(PyObject *pSelf, PyObject *pArgs)
Definition: pythonItom.cpp:126
Definition: apiFunctionsGraph.cpp:39
static PyObject * PyOpenScript(PyObject *pSelf, PyObject *pArgs)
Definition: pythonItom.cpp:181
static PyObject * PyOpenEmptyScriptEditor(PyObject *pSelf, PyObject *pArgs)
Definition: pythonItom.cpp:85
Definition: pythonEngine.h:92