• 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/richtextlabel.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 * richtextlabel_python.cpp - Functions for richtext 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/richtextlabel.h"
30 
31 #include <Python.h>
32 
33 #include <qobject.h>
34 
35 #include "meters/richtextlabel.h"
36 
37 #include "python/meter.h"
38 
39 #include "../karamba.h"
40 
41 PyObject* py_createRichText(PyObject *, PyObject *args)
42 {
43  long widget, underline = 0;
44  PyObject *text;
45  if (!PyArg_ParseTuple(args, (char*)"lO|l:createRichText",
46  &widget, &text, &underline))
47  return NULL;
48  if (!checkKaramba(widget))
49  return NULL;
50  RichTextLabel *tmp = new RichTextLabel((Karamba*)widget);
51  tmp->setText(PyString2QString(text), underline);
52  tmp->setTextProps(((Karamba*)widget)->getDefaultTextProps());
53  ((Karamba*)widget)->addToGroup(tmp);
54  return (Py_BuildValue((char*)"l", (long)tmp));
55 }
56 
57 PyObject* py_deleteRichText(PyObject *, PyObject *args)
58 {
59  long widget, meter;
60  if (!PyArg_ParseTuple(args, (char*)"ll:deleteRichText", &widget, &meter))
61  return NULL;
62  if (!checkKarambaAndMeter(widget, meter, "RichTextLabel"))
63  return NULL;
64 
65  ((Karamba*)widget)->deleteMeterFromSensors((Meter*)meter);
66  //((Karamba*)widget)->clickList->removeAll((Meter*)meter);
67  return Py_BuildValue((char*)"l",
68  ((Karamba*)widget)->removeMeter((Meter*)meter));
69 }
70 
71 PyObject* py_getThemeRichText(PyObject *self, PyObject *args)
72 {
73  return py_getThemeMeter(self, args, "RichTextLabel");
74 }
75 
76 PyObject* py_getRichTextSize(PyObject *self, PyObject *args)
77 {
78  return py_getSize(self, args, "RichTextLabel");
79 }
80 
81 PyObject* py_resizeRichText(PyObject *self, PyObject *args)
82 {
83  return py_resize(self, args, "RichTextLabel");
84 }
85 
86 PyObject* py_getRichTextPos(PyObject *self, PyObject *args)
87 {
88  return py_getPos(self, args, "RichTextLabel");
89 }
90 
91 PyObject* py_moveRichText(PyObject *self, PyObject *args)
92 {
93  return py_move(self, args, "RichTextLabel");
94 }
95 
96 PyObject* py_hideRichText(PyObject *self, PyObject *args)
97 {
98  return py_hide(self, args, "RichTextLabel");
99 }
100 
101 PyObject* py_showRichText(PyObject *self, PyObject *args)
102 {
103  return py_show(self, args, "RichTextLabel");
104 }
105 
106 PyObject* py_getRichTextValue(PyObject *self, PyObject *args)
107 {
108  return py_getStringValue(self, args, "RichTextLabel");
109 }
110 
111 PyObject* py_setRichTextValue(PyObject *self, PyObject *args)
112 {
113  return py_setStringValue(self, args, "RichTextLabel");
114 }
115 
116 PyObject* py_getRichTextSensor(PyObject *self, PyObject *args)
117 {
118  return py_getSensor(self, args, "RichTextLabel");
119 }
120 
121 PyObject* py_setRichTextSensor(PyObject *self, PyObject *args)
122 {
123  return py_setSensor(self, args, "RichTextLabel");
124 }
125 
126 PyObject* py_setRichTextFontSize(PyObject *, PyObject *args)
127 {
128  long widget, textSensor;
129  long size;
130  if (!PyArg_ParseTuple(args, (char*)"lll:changeRichTextSize",
131  &widget, &textSensor, &size))
132  return NULL;
133  if (!checkKarambaAndMeter(widget, textSensor, "RichTextLabel"))
134  return NULL;
135  ((RichTextLabel*)textSensor)->setFontSize(size);
136  return Py_BuildValue((char*)"l", 1);
137 }
138 
139 PyObject* py_getRichTextFontSize(PyObject *, PyObject *args)
140 {
141  long widget, textSensor;
142  if (!PyArg_ParseTuple(args, (char*)"ll:getRichTextSize", &widget, &textSensor))
143  return NULL;
144  if (!checkKarambaAndMeter(widget, textSensor, "RichTextLabel"))
145  return NULL;
146  return Py_BuildValue((char*)"l", ((RichTextLabel*)textSensor)->getFontSize());
147 }
148 
149 PyObject* py_setRichTextFont(PyObject *, PyObject *args)
150 {
151  long widget, textSensor;
152  char* text;
153  if (!PyArg_ParseTuple(args, (char*)"lls:changeRichTextFont",
154  &widget, &textSensor, &text))
155  return NULL;
156  if (!checkKarambaAndMeter(widget, textSensor, "RichTextLabel"))
157  return NULL;
158  ((RichTextLabel*)textSensor)->setFont(text);
159  return Py_BuildValue((char*)"l", 1);
160 }
161 
162 PyObject* py_getRichTextFont(PyObject *, PyObject *args)
163 {
164  long widget, textSensor;
165  if (!PyArg_ParseTuple(args, (char*)"ll:getRichTextFont", &widget, &textSensor))
166  return NULL;
167  if (!checkKarambaAndMeter(widget, textSensor, "RichTextLabel"))
168  return NULL;
169  return Py_BuildValue((char*)"s", ((RichTextLabel*)textSensor)->getFont().toAscii().constData());
170 }
171 
172 // Set the width of a Rich Text Label
173 PyObject* py_set_rich_text_width(PyObject*, PyObject* args)
174 {
175  long widget, text, size;
176  if (!PyArg_ParseTuple(args, (char*)"lll:setRichTextWidth", &widget, &text, &size))
177  return NULL;
178  if (!checkKarambaAndMeter(widget, text, "RichTextLabel"))
179  return NULL;
180 
181  RichTextLabel* richText = (RichTextLabel*) text;
182 
183  richText -> setWidth(size);
184  return Py_BuildValue((char*)"l", 1);
185 }
186 
py_getThemeMeter
PyObject * py_getThemeMeter(PyObject *, PyObject *args, QString type)
Definition: python/meter.cpp:161
py_hideRichText
PyObject * py_hideRichText(PyObject *self, PyObject *args)
RichText/hideRichText.
Definition: python/richtextlabel.cpp:96
py_move
PyObject * py_move(PyObject *, PyObject *args, QString type)
Definition: python/meter.cpp:212
PyObject
struct _object PyObject
Definition: python/karamba.h:35
PyString2QString
QString PyString2QString(PyObject *text)
Definition: python/meter.cpp:92
meter.h
RichTextLabel::setTextProps
void setTextProps(TextField *t)
Definition: meters/richtextlabel.cpp:130
py_hide
PyObject * py_hide(PyObject *, PyObject *args, QString type)
Definition: python/meter.cpp:225
py_showRichText
PyObject * py_showRichText(PyObject *self, PyObject *args)
RichText/showRichText.
Definition: python/richtextlabel.cpp:101
py_getThemeRichText
PyObject * py_getThemeRichText(PyObject *self, PyObject *args)
RichText/getThemeRichText.
Definition: python/richtextlabel.cpp:71
py_setRichTextSensor
PyObject * py_setRichTextSensor(PyObject *self, PyObject *args)
RichText/setRichTextSensor.
Definition: python/richtextlabel.cpp:121
py_createRichText
PyObject * py_createRichText(PyObject *, PyObject *args)
RichText/createRichText.
Definition: python/richtextlabel.cpp:41
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_setRichTextFontSize
PyObject * py_setRichTextFontSize(PyObject *, PyObject *args)
RichText/changeRichTextSize.
Definition: python/richtextlabel.cpp:126
Karamba
Definition: karamba.h:52
richtextlabel.h
py_getRichTextSize
PyObject * py_getRichTextSize(PyObject *self, PyObject *args)
RichText/getRichTextSize.
Definition: python/richtextlabel.cpp:76
py_resize
PyObject * py_resize(PyObject *, PyObject *args, QString type)
Definition: python/meter.cpp:189
py_getRichTextFontSize
PyObject * py_getRichTextFontSize(PyObject *, PyObject *args)
RichText/getRichTextFontSize.
Definition: python/richtextlabel.cpp:139
py_getRichTextFont
PyObject * py_getRichTextFont(PyObject *, PyObject *args)
RichText/getRichTextFont.
Definition: python/richtextlabel.cpp:162
py_setRichTextValue
PyObject * py_setRichTextValue(PyObject *self, PyObject *args)
RichText/changeRichText.
Definition: python/richtextlabel.cpp:111
RichTextLabel
Definition: meters/richtextlabel.h:24
checkKaramba
bool checkKaramba(long widget)
Definition: python/meter.cpp:26
py_getRichTextPos
PyObject * py_getRichTextPos(PyObject *self, PyObject *args)
RichText/getRichTextPos.
Definition: python/richtextlabel.cpp:86
py_getRichTextSensor
PyObject * py_getRichTextSensor(PyObject *self, PyObject *args)
RichText/getRichTextSensor.
Definition: python/richtextlabel.cpp:116
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_set_rich_text_width
PyObject * py_set_rich_text_width(PyObject *, PyObject *args)
RichText/setRichTextWidth.
Definition: python/richtextlabel.cpp:173
py_getRichTextValue
PyObject * py_getRichTextValue(PyObject *self, PyObject *args)
RichText/getRichTextValue.
Definition: python/richtextlabel.cpp:106
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
richtextlabel.h
py_moveRichText
PyObject * py_moveRichText(PyObject *self, PyObject *args)
RichText/moveRichText.
Definition: python/richtextlabel.cpp:91
py_resizeRichText
PyObject * py_resizeRichText(PyObject *self, PyObject *args)
RichText/resizeRichText.
Definition: python/richtextlabel.cpp:81
py_getStringValue
PyObject * py_getStringValue(PyObject *, PyObject *args, QString type)
Definition: python/meter.cpp:268
py_setRichTextFont
PyObject * py_setRichTextFont(PyObject *, PyObject *args)
RichText/changeRichTextFont.
Definition: python/richtextlabel.cpp:149
RichTextLabel::setText
void setText(const QString &text, bool linkUnderline=false)
Definition: meters/richtextlabel.cpp:54
py_deleteRichText
PyObject * py_deleteRichText(PyObject *, PyObject *args)
RichText/deleteRichText.
Definition: python/richtextlabel.cpp:57
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