|
|
|
@ -1,12 +1,12 @@
|
|
|
|
|
<?xml version="1.0" ?>
|
|
|
|
|
<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.2-Based Variant V1.1//EN" "dtd/kdex.dtd" [
|
|
|
|
|
<!ENTITY appname "<application>PyKDE Extensions</application>">
|
|
|
|
|
<!ENTITY appname "<application>PyTDE Extensions</application>">
|
|
|
|
|
<!ENTITY kappname "&appname;"><!-- Do *not* replace kappname-->
|
|
|
|
|
<!ENTITY package "kde-module"><!-- tdebase, tdeadmin, etc -->
|
|
|
|
|
<!ENTITY % addindex "IGNORE">
|
|
|
|
|
<!ENTITY % English "INCLUDE"><!-- change language only here -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Do not define any other entities; instead, use the entities
|
|
|
|
|
from kde-genent.entities and $LANG/user.entities. -->
|
|
|
|
|
]>
|
|
|
|
@ -61,14 +61,14 @@ creation and installation of TDE applications.
|
|
|
|
|
</abstract>
|
|
|
|
|
|
|
|
|
|
<!-- This is a set of Keywords for indexing by search engines.
|
|
|
|
|
Please at least include KDE, the KDE package it is in, the name
|
|
|
|
|
Please at least include TDE, the TDE package it is in, the name
|
|
|
|
|
of your application, and a few relevant keywords. -->
|
|
|
|
|
|
|
|
|
|
<keywordset>
|
|
|
|
|
<keyword>KDE</keyword>
|
|
|
|
|
<keyword>PyKDE Extensions</keyword>
|
|
|
|
|
<keyword>TDE</keyword>
|
|
|
|
|
<keyword>PyTDE Extensions</keyword>
|
|
|
|
|
<keyword>python</keyword>
|
|
|
|
|
<keyword>PyKDE</keyword>
|
|
|
|
|
<keyword>PyTDE</keyword>
|
|
|
|
|
</keywordset>
|
|
|
|
|
|
|
|
|
|
</bookinfo>
|
|
|
|
@ -88,11 +88,11 @@ creation and installation of TDE applications.
|
|
|
|
|
<title>Installation & Distutils support</title>
|
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
C++ projects on KDE traditionally use
|
|
|
|
|
C++ projects on TDE traditionally use
|
|
|
|
|
<ulink url="http://www.gnu.org/software/autoconf/">autoconf</ulink>,
|
|
|
|
|
<ulink url="http://www.gnu.org/software/automake/">automake</ulink>
|
|
|
|
|
and <ulink url="http://www.gnu.org/software/libtool/">libtool</ulink>
|
|
|
|
|
to handle the building and installation. These tools
|
|
|
|
|
to handle the building and installation. These tools
|
|
|
|
|
and difficult to use, even for experianced developers.
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
@ -100,12 +100,12 @@ and difficult to use, even for experianced developers.
|
|
|
|
|
Fortunately Python has a its own system for building and installing
|
|
|
|
|
modules and software. <ulink url="http://docs.python.org/lib/module-distutils.html">Distutils</ulink>
|
|
|
|
|
is a standard Python package and comes with every Python installation.
|
|
|
|
|
&appname; builds on Distutils with extensions tailored for handling KDE
|
|
|
|
|
&appname; builds on Distutils with extensions tailored for handling TDE
|
|
|
|
|
programs.
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
A typical KDE program comes not only with the program itself but also
|
|
|
|
|
A typical TDE program comes not only with the program itself but also
|
|
|
|
|
extra files such as a manual written in <ulink url="http://i18n.kde.org/doc/markup/">Docbook
|
|
|
|
|
format</ulink>, <ulink url="http://i18n.kde.org/translation-howto/">translation files</ulink>,
|
|
|
|
|
icons, images and other auxiliary data files. &appname; provides support for
|
|
|
|
@ -113,22 +113,22 @@ handling all these other files types.
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
<sect1 id="distutils-using">
|
|
|
|
|
<title>Using Distutils with KDE programs</title>
|
|
|
|
|
<title>Using Distutils with TDE programs</title>
|
|
|
|
|
<para>
|
|
|
|
|
It is advised that you first read the standard
|
|
|
|
|
<ulink url="http://docs.python.org/lib/module-distutils.html">Distutils documentation</ulink>
|
|
|
|
|
to learn about how it works. &appname; adds some KDE specific extensions which are documented
|
|
|
|
|
to learn about how it works. &appname; adds some TDE specific extensions which are documented
|
|
|
|
|
below.
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
Distutils is based around writing a <filename>setup.py</filename> file which
|
|
|
|
|
then uses the distutils package
|
|
|
|
|
To use the KDE extensions, the first thing you need to do in your <filename>setup.py
|
|
|
|
|
To use the TDE extensions, the first thing you need to do in your <filename>setup.py
|
|
|
|
|
</filename> file is include the <symbol>tdedistutils</symbol> package.
|
|
|
|
|
<programlisting>
|
|
|
|
|
#!/usr/bin/env python
|
|
|
|
|
# Setup.py file for MyKDEApplication
|
|
|
|
|
# Setup.py file for MyTDEApplication
|
|
|
|
|
|
|
|
|
|
import tdedistutils
|
|
|
|
|
</programlisting>
|
|
|
|
@ -149,7 +149,7 @@ tdedistutils.setup(name="pytdeextensions",
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
<symbol>min_kde_version</symbol> and <symbol>min_qt_version</symbol> specify
|
|
|
|
|
the minimum versions of the Qt library and KDE needed to install and run
|
|
|
|
|
the minimum versions of the Qt library and TDE needed to install and run
|
|
|
|
|
the software. These requirements are checked during install.
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
@ -163,7 +163,7 @@ arguments.
|
|
|
|
|
<sect1 id="distutils-files">
|
|
|
|
|
<title>Application data files</title>
|
|
|
|
|
<para>
|
|
|
|
|
Each KDE application as a data directory of it's own for storing any extra
|
|
|
|
|
Each TDE application as a data directory of it's own for storing any extra
|
|
|
|
|
data files it may need to run.
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
@ -191,7 +191,7 @@ find the correct file to <symbol>import</symbol>.
|
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
Even with all of the python files in the Application data directory, it is
|
|
|
|
|
still desirable to have your application's "executables" available in KDE's
|
|
|
|
|
still desirable to have your application's "executables" available in TDE's
|
|
|
|
|
<filename>bin</filename> directory. &appname; provides an easy way for creating
|
|
|
|
|
symbolic links from the "bin" directory to scripts in the application
|
|
|
|
|
directory.
|
|
|
|
@ -208,7 +208,7 @@ in the application data directory.
|
|
|
|
|
<sect1 id="distutils-uninstall">
|
|
|
|
|
<title>Uninstall command</title>
|
|
|
|
|
<para>
|
|
|
|
|
Standard Distutils does not feature an uninstall command. &appname; does
|
|
|
|
|
Standard Distutils does not feature an uninstall command. &appname; does
|
|
|
|
|
and it can be easily invoked with:
|
|
|
|
|
<screen>
|
|
|
|
|
python setup.py uninstall
|
|
|
|
@ -229,7 +229,7 @@ Docbook is an XML based file format for writing manuals and books.
|
|
|
|
|
More information about using Docbook to write manuals and documentation using
|
|
|
|
|
Docbook is <ulink url="http://i18n.kde.org/doc/markup/">here</ulink>.
|
|
|
|
|
Manuals are written in the Docbook format, but need to be converted
|
|
|
|
|
into HTML when installed and made available for the KDE Help Center.
|
|
|
|
|
into HTML when installed and made available for the TDE Help Center.
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
@ -270,22 +270,22 @@ to be converted into Python classes before they can be used in a Python
|
|
|
|
|
application. This can be manually done using the <command>pyuic</command>
|
|
|
|
|
command from the shell. But it is a lot more convenient to let &appname;
|
|
|
|
|
to this automatically for you. All you need to do is import the
|
|
|
|
|
<symbol>qtdesigner</symbol> or <symbol>kdedesigner</symbol> module, depending
|
|
|
|
|
on whether your application is pure Qt or uses KDE, and then you can import
|
|
|
|
|
<symbol>qtdesigner</symbol> or <symbol>tdedesigner</symbol> module, depending
|
|
|
|
|
on whether your application is pure Qt or uses TDE, and then you can import
|
|
|
|
|
your user interface files as though they were normal Python files.
|
|
|
|
|
|
|
|
|
|
<programlisting>
|
|
|
|
|
#!/usr/bin/env python
|
|
|
|
|
from tdeui import *
|
|
|
|
|
|
|
|
|
|
import kdedesigner # This module lets us import .ui file directly.
|
|
|
|
|
import tdedesigner # This module lets us import .ui file directly.
|
|
|
|
|
from MyWindow import * # Loads MyWindow.ui
|
|
|
|
|
|
|
|
|
|
# Subclass the Qt-designer form.
|
|
|
|
|
class MyWindowCode(MyWindow):
|
|
|
|
|
# Implement extra functionality and methods.
|
|
|
|
|
</programlisting>
|
|
|
|
|
The <symbol>kdedesigner</symbol>/<symbol>qtdesigner</symbol> module converts
|
|
|
|
|
The <symbol>tdedesigner</symbol>/<symbol>qtdesigner</symbol> module converts
|
|
|
|
|
<literal role="extension">.ui</literal> on demand to
|
|
|
|
|
<literal role="extension">.py</literal> files.
|
|
|
|
|
</para>
|
|
|
|
@ -298,8 +298,8 @@ The <symbol>kdedesigner</symbol>/<symbol>qtdesigner</symbol> module converts
|
|
|
|
|
<para>
|
|
|
|
|
i18n (an abbreviation of internationalization) is the process of translating
|
|
|
|
|
the user interface and documentation of a piece of software into another
|
|
|
|
|
language. <ulink url="i18n.kde.org">i18n.kde.org</ulink> is the central
|
|
|
|
|
information point for the effort to translate KDE software into other
|
|
|
|
|
language. <ulink url="i18n.kde.org">i18n.kde.org</ulink> is the central
|
|
|
|
|
information point for the effort to translate TDE software into other
|
|
|
|
|
languages.
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
@ -339,7 +339,7 @@ in your <filename>setup.py</filename>, you can specify the directory
|
|
|
|
|
that should contain the <literal role="extension">.pot</literal> and
|
|
|
|
|
<literal role="extension">.po</literal> files. The argument for
|
|
|
|
|
<symbol>i18n</symbol> is a tuple. The first item is the relative path
|
|
|
|
|
to the directory where the translation files should be stored. The
|
|
|
|
|
to the directory where the translation files should be stored. The
|
|
|
|
|
second item is a list of directories that should be scanned for Python source
|
|
|
|
|
files containing translatable strings.
|
|
|
|
|
<programlisting>
|
|
|
|
@ -370,32 +370,32 @@ needed by the application at runtime.
|
|
|
|
|
<chapter id="kcontrol-modules">
|
|
|
|
|
<title>TDE Control Center Modules</title>
|
|
|
|
|
<para>
|
|
|
|
|
&appname; can also help create modules for the TDE Control Center.
|
|
|
|
|
&appname; can also help create modules for the TDE Control Center.
|
|
|
|
|
C++ glue code is needed when writing in module in Python. Fortunately
|
|
|
|
|
&appname; can generate this glue for you automatically.
|
|
|
|
|
</para>
|
|
|
|
|
<para>
|
|
|
|
|
The best way to start learning about creating modules is to read the
|
|
|
|
|
The best way to start learning about creating modules is to read the
|
|
|
|
|
<ulink url="http://developer.kde.org/documentation/other/kcm_howto.html">TDEConfig
|
|
|
|
|
Module HOWTO</ulink>. It is written for C++, but the concepts are the same for
|
|
|
|
|
Python.
|
|
|
|
|
</para>
|
|
|
|
|
<para>
|
|
|
|
|
In your <filename>setup.py</filename> file you can specify the list of kcontrol
|
|
|
|
|
modules that need to be installed.
|
|
|
|
|
modules that need to be installed.
|
|
|
|
|
<programlisting>
|
|
|
|
|
kcontrol_modules = [ ('src/kcontrol_module.desktop','kcontrol_module.py')] )
|
|
|
|
|
</programlisting>
|
|
|
|
|
This is just a list of tuples. The first item is name of the
|
|
|
|
|
<literal role="extension">.desktop</literal> file that you've made for your
|
|
|
|
|
module. The second item is the name of the Python program to run when the
|
|
|
|
|
user views the module in kcontrol. This program is expected to be in
|
|
|
|
|
user views the module in kcontrol. This program is expected to be in
|
|
|
|
|
the application's data files directory.
|
|
|
|
|
</para>
|
|
|
|
|
<para>
|
|
|
|
|
The <ulink url="http://developer.kde.org/documentation/standards/kde/kcontrol_style/index.html">
|
|
|
|
|
KControl Module Guidelines</ulink> provides useful information about how to
|
|
|
|
|
design a KControl module that fits into the rest of KDE.
|
|
|
|
|
design a KControl module that fits into the rest of TDE.
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
<tip>
|
|
|
|
@ -434,14 +434,14 @@ has some documentation about TDEIO-slaves aimed at C++ programmers.
|
|
|
|
|
</para>
|
|
|
|
|
<para>
|
|
|
|
|
In your <filename>setup.py</filename> file you can specify the list of tdeioslaves
|
|
|
|
|
that need to be installed.
|
|
|
|
|
that need to be installed.
|
|
|
|
|
<programlisting>
|
|
|
|
|
tdeioslaves = [ ('src/tdeioslave.protocol','tdeioslave.py')] )
|
|
|
|
|
</programlisting>
|
|
|
|
|
This is just a list of tuples. The first item is name of the
|
|
|
|
|
<literal role="extension">.protocol</literal> file that you've made for your
|
|
|
|
|
tdeio-slave. The second item is the name of the Python program to run when the
|
|
|
|
|
user views the module in kcontrol. This program is expected to be in
|
|
|
|
|
user views the module in kcontrol. This program is expected to be in
|
|
|
|
|
the application's data files directory.
|
|
|
|
|
</para>
|
|
|
|
|
</chapter>
|
|
|
|
@ -453,7 +453,7 @@ the application's data files directory.
|
|
|
|
|
<para>
|
|
|
|
|
The <filename>app_templates</filename> directory contains a number of
|
|
|
|
|
application templates. An <quote>application template</quote> is just a collection of files
|
|
|
|
|
in a directory structure that should be copied and used as starting point
|
|
|
|
|
in a directory structure that should be copied and used as starting point
|
|
|
|
|
when developing a new application. An application template typically contains
|
|
|
|
|
default documentation files, icons, source file and <filename>setup.py
|
|
|
|
|
</filename> file which can later be modified.
|
|
|
|
@ -551,16 +551,16 @@ described below.
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
<sect1 id="app-template-simple">
|
|
|
|
|
<title>Simple KDE utility template</title>
|
|
|
|
|
<title>Simple TDE utility template</title>
|
|
|
|
|
<para>
|
|
|
|
|
The <filename>kdeutility</filename> application template is a simple utility
|
|
|
|
|
that uses an interface designed in Qt-Designer. It doesn't have a menubar
|
|
|
|
|
that uses an interface designed in Qt-Designer. It doesn't have a menubar
|
|
|
|
|
or toolbar.
|
|
|
|
|
</para>
|
|
|
|
|
</sect1>
|
|
|
|
|
|
|
|
|
|
<sect1 id="app-template-application">
|
|
|
|
|
<title>KDE application template</title>
|
|
|
|
|
<title>TDE application template</title>
|
|
|
|
|
<para>
|
|
|
|
|
The <filename>kdeapp</filename> application template is an application with
|
|
|
|
|
menubar, toolbar and separated document and view classes. The menubar and toolbars
|
|
|
|
@ -581,7 +581,7 @@ application outside of KControl to ease development and debugging.
|
|
|
|
|
<title>TDEIO-slave Application Template</title>
|
|
|
|
|
<para>
|
|
|
|
|
The <filename>tdeioslave</filename> application template is a simple
|
|
|
|
|
TDEIO-slave that implements a simple RAM disk. Once installed it can be
|
|
|
|
|
TDEIO-slave that implements a simple RAM disk. Once installed it can be
|
|
|
|
|
accessed using tdeioslave:/ in konqueror. It is initially empty. Files and
|
|
|
|
|
directories can be made and deposited. <filename>tdeioslave.py</filename>
|
|
|
|
|
contains more information and comments.
|
|
|
|
@ -629,7 +629,7 @@ Programming &appname; plugins is a joy to behold. Just read through the next
|
|
|
|
|
<refpurpose>remove a list of children from a parent widget's managed
|
|
|
|
|
list.
|
|
|
|
|
<indexterm id="ix-1007-unmanagechildren-1"><primary>widgets</primary><secondary>removing</secondary></indexterm>
|
|
|
|
|
<indexterm id="ix-1007-unmanagechildren-2"><primary>XtUnmanageChildren</primary></indexterm>
|
|
|
|
|
<indexterm id="ix-1007-unmanagechildren-2"><primary>XtUnmanageChildren</primary></indexterm>
|
|
|
|
|
</refpurpose>
|
|
|
|
|
|
|
|
|
|
</refnamediv>
|
|
|
|
@ -779,7 +779,7 @@ installed.</para>
|
|
|
|
|
|
|
|
|
|
<!-- Include credits for the programmers, documentation writers, and
|
|
|
|
|
contributors here. The license for your software should then be included below
|
|
|
|
|
the credits with a reference to the appropriate license file included in the KDE
|
|
|
|
|
the credits with a reference to the appropriate license file included in the TDE
|
|
|
|
|
distribution. -->
|
|
|
|
|
|
|
|
|
|
<title>Credits and License</title>
|
|
|
|
@ -869,6 +869,6 @@ sgml-indent-step:0
|
|
|
|
|
sgml-indent-data:nil
|
|
|
|
|
End:
|
|
|
|
|
|
|
|
|
|
vim:tabstop=2:shiftwidth=2:expandtab
|
|
|
|
|
vim:tabstop=2:shiftwidth=2:expandtab
|
|
|
|
|
-->
|
|
|
|
|
|
|
|
|
|