• 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/textlabel.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 * textlabel_python.cpp - Functions for textlabel python api
3 *
4 * Copyright (C) 2003 Hans Karlsson <karlsson.h@home.se>
5 * Copyright (C) 2003-2004 Adam Geitgey <adam@rootnode.org>
6 * Copyright (c) 2004 Petri Damstén <damu@iki.fi>
7 *
8 * This file is part of SuperKaramba.
9 *
10 * SuperKaramba is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * SuperKaramba is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with SuperKaramba; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 ****************************************************************************/
24 
25 #if defined(_XOPEN_SOURCE) && !defined(__SUNPRO_CC)
26 #undef _XOPEN_SOURCE
27 #endif
28 
29 #include "python/textlabel.h"
30 
31 #include <Python.h>
32 #include <qobject.h>
33 #include "../karamba.h"
34 #include "meters/textlabel.h"
35 #include "python/meter.h"
36 
37 PyObject* py_createText(PyObject *, PyObject *args)
38 {
39  long widget, x, y, w, h;
40  PyObject *text;
41  if (!PyArg_ParseTuple(args, (char*)"lllllO:createText", &widget, &x, &y, &w, &h, &text))
42  return NULL;
43  if (!checkKaramba(widget))
44  return NULL;
45  TextLabel *tmp =
46  new TextLabel((Karamba*)widget, (int)x, (int)y, (int)w, (int)h);
47  tmp->setValue(PyString2QString(text));
48  tmp->setTextProps(((Karamba*)widget)->getDefaultTextProps());
49  ((Karamba*)widget)->addToGroup(tmp);
50  return (Py_BuildValue((char*)"l", (long)tmp));
51 }
52 
53 PyObject* py_deleteText(PyObject *, PyObject *args)
54 {
55  long widget, meter;
56  if (!PyArg_ParseTuple(args, (char*)"ll:deleteText", &widget, &meter))
57  return NULL;
58  if (!checkKarambaAndMeter(widget, meter, "TextLabel"))
59  return NULL;
60 
61  ((Karamba*)widget)->deleteMeterFromSensors((Meter*)meter);
62  return Py_BuildValue((char*)"l",
63  ((Karamba*)widget)->removeMeter((Meter*)meter));
64 }
65 
66 PyObject* py_getThemeText(PyObject *self, PyObject *args)
67 {
68  return py_getThemeMeter(self, args, "TextLabel");
69 }
70 
71 PyObject* py_getTextSize(PyObject *self, PyObject *args)
72 {
73  return py_getSize(self, args, "TextLabel");
74 }
75 
76 PyObject* py_resizeText(PyObject *self, PyObject *args)
77 {
78  return py_resize(self, args, "TextLabel");
79 }
80 
81 PyObject* py_getTextPos(PyObject *self, PyObject *args)
82 {
83  return py_getPos(self, args, "TextLabel");
84 }
85 
86 PyObject* py_moveText(PyObject *self, PyObject *args)
87 {
88  return py_move(self, args, "TextLabel");
89 }
90 
91 PyObject* py_hideText(PyObject *self, PyObject *args)
92 {
93  return py_hide(self, args, "TextLabel");
94 }
95 
96 PyObject* py_showText(PyObject *self, PyObject *args)
97 {
98  return py_show(self, args, "TextLabel");
99 }
100 
101 PyObject* py_getTextValue(PyObject *self, PyObject *args)
102 {
103  return py_getStringValue(self, args, "TextLabel");
104 }
105 
106 PyObject* py_setTextValue(PyObject *self, PyObject *args)
107 {
108  return py_setStringValue(self, args, "TextLabel");
109 }
110 
111 PyObject* py_getTextSensor(PyObject *self, PyObject *args)
112 {
113  return py_getSensor(self, args, "TextLabel");
114 }
115 
116 PyObject* py_setTextSensor(PyObject *self, PyObject *args)
117 {
118  return py_setSensor(self, args, "TextLabel");
119 }
120 
121 PyObject* py_getTextColor(PyObject *self, PyObject *args)
122 {
123  return py_getColor(self, args, "TextLabel");
124 }
125 
126 PyObject* py_setTextColor(PyObject *self, PyObject *args)
127 {
128  return py_setColor(self, args, "TextLabel");
129 }
130 
131 PyObject* py_setTextShadow(PyObject *, PyObject *args)
132 {
133  long widget, textSensor;
134  long shadow;
135  if (!PyArg_ParseTuple(args, (char*)"lll:changeTextShadow",
136  &widget, &textSensor, &shadow))
137  return NULL;
138  if (!checkKarambaAndMeter(widget, textSensor, "TextLabel"))
139  return NULL;
140  ((TextLabel*)textSensor)->setShadow(shadow);
141  return Py_BuildValue((char*)"l", 1);
142 }
143 
144 PyObject* py_getTextShadow(PyObject *, PyObject *args)
145 {
146  long widget, textSensor;
147  if (!PyArg_ParseTuple(args, (char*)"ll:getTextShadow", &widget, &textSensor))
148  return NULL;
149  if (!checkKarambaAndMeter(widget, textSensor, "TextLabel"))
150  return NULL;
151  return Py_BuildValue((char*)"l", ((TextLabel*)textSensor)->getShadow());
152 }
153 
154 PyObject* py_setTextFontSize(PyObject *, PyObject *args)
155 {
156  long widget, textSensor;
157  long size;
158  if (!PyArg_ParseTuple(args, (char*)"lll:changeTextSize",
159  &widget, &textSensor, &size))
160  return NULL;
161  if (!checkKarambaAndMeter(widget, textSensor, "TextLabel"))
162  return NULL;
163  ((TextLabel*)textSensor)->setFontSize(size);
164  return Py_BuildValue((char*)"l", 1);
165 }
166 
167 PyObject* py_getTextFontSize(PyObject *, PyObject *args)
168 {
169  long widget, textSensor;
170  if (!PyArg_ParseTuple(args, (char*)"ll:getTextSize", &widget, &textSensor))
171  return NULL;
172  if (!checkKarambaAndMeter(widget, textSensor, "TextLabel"))
173  return NULL;
174  return Py_BuildValue((char*)"l", ((TextLabel*)textSensor)->getFontSize());
175 }
176 
177 PyObject* py_setTextFont(PyObject *, PyObject *args)
178 {
179  long widget, textSensor;
180  char* text;
181  if (!PyArg_ParseTuple(args, (char*)"lls:changeTextFont",
182  &widget, &textSensor, &text))
183  return NULL;
184  if (!checkKarambaAndMeter(widget, textSensor, "TextLabel"))
185  return NULL;
186  ((TextLabel*)textSensor)->setFont(text);
187  return Py_BuildValue((char*)"l", 1);
188 }
189 
190 PyObject* py_getTextFont(PyObject *, PyObject *args)
191 {
192  long widget, textSensor;
193  if (!PyArg_ParseTuple(args, (char*)"ll:getTextFont", &widget, &textSensor))
194  return NULL;
195  if (!checkKarambaAndMeter(widget, textSensor, "TextLabel"))
196  return NULL;
197  return Py_BuildValue((char*)"s", ((TextLabel*)textSensor)->getFont().toAscii().constData());
198 }
199 
200 PyObject* py_setTextAlign(PyObject *, PyObject *args)
201 {
202  long widget, textSensor;
203  char* text;
204  if (!PyArg_ParseTuple(args, (char*)"lls:changeTextFont",
205  &widget, &textSensor, &text))
206  return NULL;
207  if (!checkKarambaAndMeter(widget, textSensor, "TextLabel"))
208  return NULL;
209  ((TextLabel*)textSensor)->setAlignment(text);
210  return Py_BuildValue((char*)"l", 1);
211 }
212 
213 PyObject* py_getTextAlign(PyObject *, PyObject *args)
214 {
215  long widget, textSensor;
216  if (!PyArg_ParseTuple(args, (char*)"ll:getTextFont", &widget, &textSensor))
217  return NULL;
218  if (!checkKarambaAndMeter(widget, textSensor, "TextLabel"))
219  return NULL;
220  return Py_BuildValue((char*)"s", ((TextLabel*)textSensor)->getAlignment().toAscii().constData());
221 }
222 
223 PyObject* py_setTextScroll(PyObject *, PyObject *args)
224 {
225  long widget, textSensor;
226  char* type;
227  int x = 0, y = 0, pause = 0, gap = 0;
228  if (!PyArg_ParseTuple(args, (char*)"lls|llll:setScroll",
229  &widget, &textSensor, &type, &x, &y, &gap, &pause))
230  return NULL;
231  if (!checkKarambaAndMeter(widget, textSensor, "TextLabel"))
232  return NULL;
233  ((TextLabel*)textSensor)->setScroll(type, QPoint(x, y), gap, pause);
234  return Py_BuildValue((char*)"l", 1);
235 }
py_getThemeMeter
PyObject * py_getThemeMeter(PyObject *, PyObject *args, QString type)
Definition: python/meter.cpp:161
py_createText
PyObject * py_createText(PyObject *, PyObject *args)
Text/createText.
Definition: python/textlabel.cpp:37
py_move
PyObject * py_move(PyObject *, PyObject *args, QString type)
Definition: python/meter.cpp:212
py_getTextAlign
PyObject * py_getTextAlign(PyObject *, PyObject *args)
Text/getTextAlign.
Definition: python/textlabel.cpp:213
PyObject
struct _object PyObject
Definition: python/karamba.h:35
TextLabel
Definition: meters/textlabel.h:19
PyString2QString
QString PyString2QString(PyObject *text)
Definition: python/meter.cpp:92
py_getTextShadow
PyObject * py_getTextShadow(PyObject *, PyObject *args)
Text/getTextShadow.
Definition: python/textlabel.cpp:144
meter.h
py_hideText
PyObject * py_hideText(PyObject *self, PyObject *args)
Text/hideText.
Definition: python/textlabel.cpp:91
py_getTextSize
PyObject * py_getTextSize(PyObject *self, PyObject *args)
Text/getTextSize.
Definition: python/textlabel.cpp:71
py_hide
PyObject * py_hide(PyObject *, PyObject *args, QString type)
Definition: python/meter.cpp:225
py_setTextShadow
PyObject * py_setTextShadow(PyObject *, PyObject *args)
Text/changeTextShadow.
Definition: python/textlabel.cpp:131
py_getTextColor
PyObject * py_getTextColor(PyObject *self, PyObject *args)
Text/getTextColor.
Definition: python/textlabel.cpp:121
textlabel.h
py_getTextValue
PyObject * py_getTextValue(PyObject *self, PyObject *args)
Text/getTextValue.
Definition: python/textlabel.cpp:101
py_setTextValue
PyObject * py_setTextValue(PyObject *self, PyObject *args)
Text/changeText.
Definition: python/textlabel.cpp:106
py_setTextAlign
PyObject * py_setTextAlign(PyObject *, PyObject *args)
Text/setTextAlign.
Definition: python/textlabel.cpp:200
py_getSensor
PyObject * py_getSensor(PyObject *, PyObject *args, QString type)
Definition: python/meter.cpp:316
py_getSize
PyObject * py_getSize(PyObject *, PyObject *args, QString type)
Definition: python/meter.cpp:177
py_getTextFont
PyObject * py_getTextFont(PyObject *, PyObject *args)
Text/getTextFont.
Definition: python/textlabel.cpp:190
TextLabel::setValue
void setValue(const QString &text)
Definition: meters/textlabel.cpp:144
Karamba
Definition: karamba.h:52
py_resize
PyObject * py_resize(PyObject *, PyObject *args, QString type)
Definition: python/meter.cpp:189
py_getTextPos
PyObject * py_getTextPos(PyObject *self, PyObject *args)
Text/getTextPos.
Definition: python/textlabel.cpp:81
py_setTextColor
PyObject * py_setTextColor(PyObject *self, PyObject *args)
Text/changeTextColor.
Definition: python/textlabel.cpp:126
py_getColor
PyObject * py_getColor(PyObject *, PyObject *args, QString type)
Definition: python/meter.cpp:353
py_getTextFontSize
PyObject * py_getTextFontSize(PyObject *, PyObject *args)
Text/getTextFontSize.
Definition: python/textlabel.cpp:167
textlabel.h
py_deleteText
PyObject * py_deleteText(PyObject *, PyObject *args)
Text/deleteText.
Definition: python/textlabel.cpp:53
py_resizeText
PyObject * py_resizeText(PyObject *self, PyObject *args)
Text/resizeText.
Definition: python/textlabel.cpp:76
checkKaramba
bool checkKaramba(long widget)
Definition: python/meter.cpp:26
py_showText
PyObject * py_showText(PyObject *self, PyObject *args)
Text/showText.
Definition: python/textlabel.cpp:96
py_moveText
PyObject * py_moveText(PyObject *self, PyObject *args)
Text/moveText.
Definition: python/textlabel.cpp:86
py_getTextSensor
PyObject * py_getTextSensor(PyObject *self, PyObject *args)
Text/getTextSensor.
Definition: python/textlabel.cpp:111
checkKarambaAndMeter
bool checkKarambaAndMeter(long widget, long meter, const char *type)
Definition: python/meter.cpp:74
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_setTextSensor
PyObject * py_setTextSensor(PyObject *self, PyObject *args)
Text/setTextSensor.
Definition: python/textlabel.cpp:116
py_setTextScroll
PyObject * py_setTextScroll(PyObject *, PyObject *args)
Definition: python/textlabel.cpp:223
py_setTextFontSize
PyObject * py_setTextFontSize(PyObject *, PyObject *args)
Text/changeTextSize.
Definition: python/textlabel.cpp:154
py_setSensor
PyObject * py_setSensor(PyObject *, PyObject *args, QString type)
Definition: python/meter.cpp:328
Meter
Definition: meters/meter.h:23
py_setStringValue
PyObject * py_setStringValue(PyObject *, PyObject *args, QString type)
Definition: python/meter.cpp:279
TextLabel::setTextProps
void setTextProps(TextField *)
Definition: meters/textlabel.cpp:84
py_getThemeText
PyObject * py_getThemeText(PyObject *self, PyObject *args)
Text/getThemeText.
Definition: python/textlabel.cpp:66
py_setTextFont
PyObject * py_setTextFont(PyObject *, PyObject *args)
Text/changeTextFont.
Definition: python/textlabel.cpp:177
py_getStringValue
PyObject * py_getStringValue(PyObject *, PyObject *args, QString type)
Definition: python/meter.cpp:268
py_setColor
PyObject * py_setColor(PyObject *, PyObject *args, QString type)
Definition: python/meter.cpp:341
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:07:20 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