graph_python.cpp
00001 /**************************************************************************** 00002 * graph_python.h - Functions for graph python api 00003 * 00004 * Copyright (c) 2004 Petri Damstén <damu@iki.fi> 00005 * 00006 * This file is part of SuperKaramba. 00007 * 00008 * SuperKaramba is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation; either version 2 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * SuperKaramba is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with SuperKaramba; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00021 ****************************************************************************/ 00022 00023 #ifdef _XOPEN_SOURCE 00024 #undef _XOPEN_SOURCE 00025 #endif 00026 00027 #include <Python.h> 00028 #include <tqobject.h> 00029 #include "karamba.h" 00030 #include "meter.h" 00031 #include "meter_python.h" 00032 #include "graph_python.h" 00033 00034 PyObject* py_createGraph(PyObject *, PyObject *args) 00035 { 00036 long widget, x, y, w, h, points; 00037 00038 if (!PyArg_ParseTuple(args, (char*)"llllll", &widget, &x, &y, &w, &h, &points)) 00039 return NULL; 00040 if (!checkKaramba(widget)) 00041 return NULL; 00042 00043 Graph *tmp = 00044 new Graph((karamba*)widget, (int)x, (int)y, (int)w, (int)h, (int)points); 00045 ((karamba*)widget)->meterList->append(tmp); 00046 return (Py_BuildValue((char*)"l", (long)tmp)); 00047 } 00048 00049 PyObject* py_deleteGraph(PyObject *, PyObject *args) 00050 { 00051 long widget, meter; 00052 if (!PyArg_ParseTuple(args, (char*)"ll", &widget, &meter)) 00053 return NULL; 00054 if (!checkKarambaAndMeter(widget, meter, "Graph")) 00055 return NULL; 00056 00057 ((karamba*)widget)->deleteMeterFromSensors((Meter*)meter); 00058 return Py_BuildValue((char*)"l", 00059 ((karamba*)widget)->meterList->removeRef((Meter*)meter)); 00060 } 00061 00062 PyObject* py_getThemeGraph(PyObject *self, PyObject *args) 00063 { 00064 return py_getThemeMeter(self, args, "Graph"); 00065 } 00066 00067 PyObject* py_getGraphSize(PyObject *self, PyObject *args) 00068 { 00069 return py_getSize(self, args, "Graph"); 00070 } 00071 00072 PyObject* py_resizeGraph(PyObject *self, PyObject *args) 00073 { 00074 return py_resize(self, args, "Graph"); 00075 } 00076 00077 PyObject* py_getGraphPos(PyObject *self, PyObject *args) 00078 { 00079 return py_getPos(self, args, "Graph"); 00080 } 00081 00082 PyObject* py_moveGraph(PyObject *self, PyObject *args) 00083 { 00084 return py_move(self, args, "Graph"); 00085 } 00086 00087 PyObject* py_hideGraph(PyObject *self, PyObject *args) 00088 { 00089 return py_hide(self, args, "Graph"); 00090 } 00091 00092 PyObject* py_showGraph(PyObject *self, PyObject *args) 00093 { 00094 return py_show(self, args, "Graph"); 00095 } 00096 00097 PyObject* py_getGraphMinMax(PyObject *self, PyObject *args) 00098 { 00099 return py_getMinMax(self, args, "Graph"); 00100 } 00101 00102 PyObject* py_setGraphMinMax(PyObject *self, PyObject *args) 00103 { 00104 return py_setMinMax(self, args, "Graph"); 00105 } 00106 00107 PyObject* py_getGraphValue(PyObject *self, PyObject *args) 00108 { 00109 return py_getValue(self, args, "Graph"); 00110 } 00111 00112 PyObject* py_setGraphValue(PyObject *self, PyObject *args) 00113 { 00114 return py_setValue(self, args, "Graph"); 00115 } 00116 00117 PyObject* py_getGraphSensor(PyObject *self, PyObject *args) 00118 { 00119 return py_getSensor(self, args, "Graph"); 00120 } 00121 00122 PyObject* py_setGraphSensor(PyObject *self, PyObject *args) 00123 { 00124 return py_setSensor(self, args, "Graph"); 00125 } 00126 00127 PyObject* py_getGraphColor(PyObject *self, PyObject *args) 00128 { 00129 return py_getColor(self, args, "Graph"); 00130 } 00131 00132 PyObject* py_setGraphColor(PyObject *self, PyObject *args) 00133 { 00134 return py_setColor(self, args, "Graph"); 00135 } 00136 00137