summaryrefslogtreecommitdiffstats
path: root/python/pykde/doc/static.html
blob: e68f13bd1a2d3613511c7f64031e8300bebd18d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
<HTML>
<HEAD>
<TITLE>Types and Related Topics</TITLE>
</HEAD>
<BODY CLASS="SECT1">
<DIV CLASS="NAVHEADER">
<TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0">
<TR>
<TH COLSPAN="3" ALIGN="center">Python Bindings for KDE (PyKDE-3.16.0)</TH>
</TR>
<TR>
<TD WIDTH="10%" ALIGN="left" VALIGN="bottom">
<A HREF="signal.html" ACCESSKEY="P">Prev</A>
</TD>
<TD WIDTH="80%" ALIGN="center" VALIGN="bottom"></TD>
<TD WIDTH="10%" ALIGN="right" VALIGN="bottom">
<A HREF="classref/index.html" ACCESSKEY="N">Next</A>
</TD>
</TR>
</TABLE>
<HR ALIGN="LEFT" WIDTH="100%">
</DIV>
<H1>Types and Related Topics</H1>
<H2>Static Member Functions</H2>
<P>
Static member functions are implemented as Python class functions.
For example the C++ static member function
<TT CLASS="LITERAL" >QObject::connect()</TT>
is called from Python as
<TT CLASS="LITERAL">QObject.connect()</TT> or
<TT CLASS="LITERAL">self.connect()</TT>
if called from a sub-class of
<TT CLASS="LITERAL">QObject</TT>.
</P>
<h2>None and NULL</h2>
<P>Throughout the bindings, the
<TT CLASS="LITERAL">None</TT>
value can be specified wherever
<TT CLASS="LITERAL">NULL</TT>
is acceptable to the underlying C++ code.</P>
<P >Equally,
<TT CLASS="LITERAL">NULL</TT>
is converted to
<TT CLASS="LITERAL">None</TT>
whenever it is returned by the underlying C++ code
</P>

<h2>Enumerated Types</H2>
<P>
Enumerated types are implemented as a set of simple variables corresponding to
the separate enumerated values.
</P>
<P>
When using an enumerated value the name of the class (or a sub-class) in which
the enumerated type was defined in must be included.  For example:
</P>
<TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" >
<TR>
<TD>
<PRE CLASS="PROGRAMLISTING">
Qt.SolidPattern
QWidget.TabFocus
QFrame.TabFocus
</PRE>
</TD>
</TR>
</TABLE>

<H2>Namespaces</H2>
<P>
The C++ code in KDE makes extensive use of namespaces (especially in the kio, kjs,
khtml, kfile, and kparts modules). In PyKDE, namespaces are treated as a "superclass".
For example, "from kparts import KParts" will import the KParts namespace and all
its members. To reference a class in the namespace, use &lt;namespace name&gt;..&lt;classname&gt;,
for example, KParts.ReadOnlyPart. It isn't necessary to import the &lt;classname&gt; (ReadOnlyPart
in the example).
</P>
<h2>Return and Argument Types</h2>
<p>
Some return types or argument types may be different than those in the C++ KDE libs. This is
done for convenience (eg returning/taking Python lists or dicts),  because arguments are
scalar (non-object) types passed by reference (eg int*, bool&), or because there is no
way to express the C++ type in Python (eg template types)
</p>
<p>
Please check the <a href="docs.html">Class Reference Docs</a> which list all classes
and methods in Python format.
</p>
<h2>Version Information</h2><h4><i>New in PyKDE-3.11</i></h4>
<p>
PyKDE provides methods for determining both the KDE version being run and the PyKDE
version being run. The version methods are:
</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<th align = "left" width = "20%"><u>return type</u></th>
<th align = "left" width = "20%"><u>KDE</u></th>
<th align = "center" width = "10%"><u>Example</u></th>
<th></th>
<th align = "left" width = "20%"><u>PyKDE</u></th>
<th align = "center" width = "20%"><u>Example</u></th>
</tr>
<tr>
<td>int</td>
<td>KDE.versionMajor ()</td>
<td align = "center">3</td>
<td></td>
<td>PyKDE.versionMajor ()</td>
<td align = "center">3</td>
</tr>
<tr>
<td>int</td>
<td>KDE.versionMinor ()</td>
<td align = "center">1</td>
<td></td>
<td>PyKDE.versionMinor ()</td>
<td align = "center">8</td>
</tr>
<tr>
<td>int</td>
<td>KDE.versionRelease ()</td>
<td align = "center">4</td>
<td></td>
<td>PyKDE.versionRelease ()</td>
<td align = "center">0</td>
</tr>
<tr>
<td>string</td>
<td>KDE.versionString ()</td>
<td align = "center">"3.1.4"</td>
<td></td>
<td>PyKDE.versionString ()</td>
<td align = "center">"3.11.0"</td>
</tr>
</table>

<h2>Abstract Classes and Pure Virtual Methods</h2>
<P>
C++ allows the use of abstract classes. Abstract classes cannot be used in programs
(instantiated) directly; their only purpose is to serve as a base class from which
programmers can derive other classes that can be used.
</P>
<P>
An abstract class in C++ is defined as a class that has one or more 'pure virtual'
methods. These can be identified in the C++ header files or C++ docs as methods set
equal to 0, for example:
</P>
<TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%">
<TR>
<TD>
<PRE CLASS="PROGRAMLISTING">
virtual int somePureVirtualMethod (int a) = 0;
</PRE>
</TD>
</TR>
</TABLE>
<P>
To derive a useful class from the abstract class, the programmer has to write methods
to overload each of the pure virtual methods. Following a suggestion on the mailing
list, the docs attempt to flag all abstract classes and identify the pure virtual
methods which must be overloaded in the derived class. Derived classes can be created
in Python by writing Python methods to overload the pure virtual methods - no C++ code
is required.
</P>

<DIV CLASS="NAVFOOTER">
<HR ALIGN="LEFT" WIDTH="100%">
<TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" >
<TR>
<TD WIDTH="33%" ALIGN="left" VALIGN="top"><A HREF="signal.html" ACCESSKEY="P">Prev</A></TD>
<TD WIDTH="34%" ALIGN="center" VALIGN="top"><A HREF="index.html" ACCESSKEY="H">Home</A></TD>
<TD WIDTH="33%" ALIGN="right" VALIGN="top"><A HREF="classref/index.html" ACCESSKEY="N">Next</A></TD>
</TR>
<TR>
<TD WIDTH="33%" ALIGN="left" VALIGN="top">Signals and Slots</TD>
<TD WIDTH="34%" ALIGN="center" VALIGN="top">&nbsp;</TD>
<TD WIDTH="33%" ALIGN="right" VALIGN="top">Class Reference</TD>
</TR>
</TABLE>
</DIV>

</BODY>
</HTML>