• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeutils API Reference
  • KDE Home
  • Contact Us
 

superkaramba

  • sources
  • kde-4.12
  • kdeutils
  • superkaramba
  • src
  • python
python/bar.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 * bar_python.cpp - Functions for bar python api
3 *
4 * Copyright (c) 2004 Petri Damstén <damu@iki.fi>
5 *
6 * This file is part of SuperKaramba.
7 *
8 * SuperKaramba is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * SuperKaramba is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with SuperKaramba; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 ****************************************************************************/
22 
23 #if defined(_XOPEN_SOURCE) && !defined(__SUNPRO_CC)
24 #undef _XOPEN_SOURCE
25 #endif
26 
27 #include "python/bar.h"
28 
29 #include <Python.h>
30 #include <qobject.h>
31 #include "../karamba.h"
32 #include "meters/meter.h"
33 #include "python/meter.h"
34 #include "meters/bar.h"
35 
36 PyObject* py_createBar(PyObject *, PyObject *args)
37 {
38  long widget, x, y, w, h;
39  char *text;
40  if (!PyArg_ParseTuple(args, (char*)"lllll|s", &widget, &x, &y, &w, &h, &text))
41  return NULL;
42  if (!checkKaramba(widget))
43  return NULL;
44 
45  Bar *tmp = new Bar((Karamba*)widget, x, y, w, h);
46  if (text && text[0] != '\0')
47  tmp->setImage(text);
48  ((Karamba*)widget)->addToGroup(tmp);
49  return (Py_BuildValue((char*)"l", (long)tmp));
50 }
51 
52 PyObject* py_deleteBar(PyObject *, PyObject *args)
53 {
54  long widget, meter;
55  if (!PyArg_ParseTuple(args, (char*)"ll", &widget, &meter))
56  return NULL;
57  if (!checkKarambaAndMeter(widget, meter, "Bar"))
58  return NULL;
59 
60  ((Karamba*)widget)->deleteMeterFromSensors((Meter*)meter);
61  return Py_BuildValue((char*)"l",
62  ((Karamba*)widget)->removeMeter((Meter*)meter));
63 }
64 
65 PyObject* py_getThemeBar(PyObject *self, PyObject *args)
66 {
67  return py_getThemeMeter(self, args, "Bar");
68 }
69 
70 PyObject* py_getBarSize(PyObject *self, PyObject *args)
71 {
72  return py_getSize(self, args, "Bar");
73 }
74 
75 PyObject* py_resizeBar(PyObject *self, PyObject *args)
76 {
77  return py_resize(self, args, "Bar");
78 }
79 
80 PyObject* py_getBarPos(PyObject *self, PyObject *args)
81 {
82  return py_getPos(self, args, "Bar");
83 }
84 
85 PyObject* py_moveBar(PyObject *self, PyObject *args)
86 {
87  return py_move(self, args, "Bar");
88 }
89 
90 PyObject* py_hideBar(PyObject *self, PyObject *args)
91 {
92  return py_hide(self, args, "Bar");
93 }
94 
95 PyObject* py_showBar(PyObject *self, PyObject *args)
96 {
97  return py_show(self, args, "Bar");
98 }
99 
100 PyObject* py_getBarMinMax(PyObject *self, PyObject *args)
101 {
102  return py_getMinMax(self, args, "Bar");
103 }
104 
105 PyObject* py_setBarMinMax(PyObject *self, PyObject *args)
106 {
107  return py_setMinMax(self, args, "Bar");
108 }
109 
110 PyObject* py_getBarValue(PyObject *self, PyObject *args)
111 {
112  return py_getValue(self, args, "Bar");
113 }
114 
115 PyObject* py_setBarValue(PyObject *self, PyObject *args)
116 {
117  return py_setValue(self, args, "Bar");
118 }
119 
120 PyObject* py_getBarSensor(PyObject *self, PyObject *args)
121 {
122  return py_getSensor(self, args, "Bar");
123 }
124 
125 PyObject* py_setBarSensor(PyObject *self, PyObject *args)
126 {
127  return py_setSensor(self, args, "Bar");
128 }
129 
130 PyObject* py_getBarImage(PyObject *, PyObject *args)
131 {
132  long widget, meter;
133  if (!PyArg_ParseTuple(args, (char*)"ll", &widget, &meter))
134  return NULL;
135  if (!checkKarambaAndMeter(widget, meter, "Bar"))
136  return NULL;
137  return Py_BuildValue((char*)"s", ((Bar*)meter)->getImage().toAscii().constData());
138 }
139 
140 PyObject* py_setBarImage(PyObject *, PyObject *args)
141 {
142  long widget, meter;
143  char* s;
144  if (!PyArg_ParseTuple(args, (char*)"lls", &widget, &meter, &s))
145  return NULL;
146  if (!checkKarambaAndMeter(widget, meter, "Bar"))
147  return NULL;
148  return Py_BuildValue((char*)"l", ((Bar*)meter)->setImage(s));
149 }
150 
151 PyObject* py_getBarVertical(PyObject *, PyObject *args)
152 {
153  long widget, meter;
154  if (!PyArg_ParseTuple(args, (char*)"ll", &widget, &meter))
155  return NULL;
156  if (!checkKarambaAndMeter(widget, meter, "Bar"))
157  return NULL;
158  return Py_BuildValue((char*)"l", ((Bar*)meter)->getVertical());
159 }
160 
161 PyObject* py_setBarVertical(PyObject *, PyObject *args)
162 {
163  long widget, meter, l;
164  if (!PyArg_ParseTuple(args, (char*)"lll", &widget, &meter, &l))
165  return NULL;
166  if (!checkKarambaAndMeter(widget, meter, "Bar"))
167  return NULL;
168  ((Bar*)meter)->setVertical(l);
169  return Py_BuildValue((char*)"l", 1);
170 }
py_getThemeMeter
PyObject * py_getThemeMeter(PyObject *, PyObject *args, QString type)
Definition: python/meter.cpp:161
py_getMinMax
PyObject * py_getMinMax(PyObject *, PyObject *args, QString type)
Definition: python/meter.cpp:293
py_move
PyObject * py_move(PyObject *, PyObject *args, QString type)
Definition: python/meter.cpp:212
PyObject
struct _object PyObject
Definition: python/karamba.h:35
meter.h
meter.h
py_hide
PyObject * py_hide(PyObject *, PyObject *args, QString type)
Definition: python/meter.cpp:225
py_hideBar
PyObject * py_hideBar(PyObject *self, PyObject *args)
Bar/hideBar.
Definition: python/bar.cpp:90
py_getBarSize
PyObject * py_getBarSize(PyObject *self, PyObject *args)
Bar/getBarSize.
Definition: python/bar.cpp:70
bar.h
py_getSensor
PyObject * py_getSensor(PyObject *, PyObject *args, QString type)
Definition: python/meter.cpp:316
py_getBarMinMax
PyObject * py_getBarMinMax(PyObject *self, PyObject *args)
Bar/getBarMinMax.
Definition: python/bar.cpp:100
py_getSize
PyObject * py_getSize(PyObject *, PyObject *args, QString type)
Definition: python/meter.cpp:177
py_setBarValue
PyObject * py_setBarValue(PyObject *self, PyObject *args)
Bar/setBarValue.
Definition: python/bar.cpp:115
py_getValue
PyObject * py_getValue(PyObject *, PyObject *args, QString type)
Definition: python/meter.cpp:247
Karamba
Definition: karamba.h:52
Bar
Definition: meters/bar.h:18
py_resize
PyObject * py_resize(PyObject *, PyObject *args, QString type)
Definition: python/meter.cpp:189
Bar::setImage
bool setImage(const QString &imagePath)
Definition: meters/bar.cpp:38
py_deleteBar
PyObject * py_deleteBar(PyObject *, PyObject *args)
Bar/deleteBar.
Definition: python/bar.cpp:52
py_getBarImage
PyObject * py_getBarImage(PyObject *, PyObject *args)
Bar/getBarImage.
Definition: python/bar.cpp:130
py_setValue
PyObject * py_setValue(PyObject *, PyObject *args, QString type)
Definition: python/meter.cpp:257
bar.h
py_getBarValue
PyObject * py_getBarValue(PyObject *self, PyObject *args)
Bar/getBarValue.
Definition: python/bar.cpp:110
py_getBarSensor
PyObject * py_getBarSensor(PyObject *self, PyObject *args)
Bar/getBarSensor.
Definition: python/bar.cpp:120
checkKaramba
bool checkKaramba(long widget)
Definition: python/meter.cpp:26
py_getBarVertical
PyObject * py_getBarVertical(PyObject *, PyObject *args)
Bar/getBarVertical.
Definition: python/bar.cpp:151
py_setMinMax
PyObject * py_setMinMax(PyObject *, PyObject *args, QString type)
Definition: python/meter.cpp:304
py_setBarMinMax
PyObject * py_setBarMinMax(PyObject *self, PyObject *args)
Bar/setBarMinMax.
Definition: python/bar.cpp:105
checkKarambaAndMeter
bool checkKarambaAndMeter(long widget, long meter, const char *type)
Definition: python/meter.cpp:74
py_setBarVertical
PyObject * py_setBarVertical(PyObject *, PyObject *args)
Bar/setBarVertical.
Definition: python/bar.cpp:161
py_show
PyObject * py_show(PyObject *, PyObject *args, QString type)
Definition: python/meter.cpp:236
py_getPos
PyObject * py_getPos(PyObject *, PyObject *args, QString type)
Definition: python/meter.cpp:201
py_showBar
PyObject * py_showBar(PyObject *self, PyObject *args)
Bar/showBar.
Definition: python/bar.cpp:95
py_setSensor
PyObject * py_setSensor(PyObject *, PyObject *args, QString type)
Definition: python/meter.cpp:328
Meter
Definition: meters/meter.h:23
py_createBar
PyObject * py_createBar(PyObject *, PyObject *args)
Bar/createBar.
Definition: python/bar.cpp:36
py_resizeBar
PyObject * py_resizeBar(PyObject *self, PyObject *args)
Bar/resizeBar.
Definition: python/bar.cpp:75
py_getBarPos
PyObject * py_getBarPos(PyObject *self, PyObject *args)
Bar/getBarPos.
Definition: python/bar.cpp:80
py_moveBar
PyObject * py_moveBar(PyObject *self, PyObject *args)
Bar/moveBar.
Definition: python/bar.cpp:85
py_getThemeBar
PyObject * py_getThemeBar(PyObject *self, PyObject *args)
Bar/getThemeBar.
Definition: python/bar.cpp:65
py_setBarSensor
PyObject * py_setBarSensor(PyObject *self, PyObject *args)
Bar/setBarSensor.
Definition: python/bar.cpp:125
py_setBarImage
PyObject * py_setBarImage(PyObject *, PyObject *args)
Bar/setBarImage.
Definition: python/bar.cpp:140
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:07:19 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

superkaramba

Skip menu "superkaramba"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeutils API Reference

Skip menu "kdeutils API Reference"
  • ark
  • filelight
  • kcalc
  • kcharselect
  • kdf
  • kfloppy
  • kgpg
  • kremotecontrol
  • ktimer
  • kwallet
  • superkaramba
  • sweeper

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal