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
|
<?xml version="1.0" standalone="no"?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<chapter id="thunarx-python-overview"
xmlns:xi="http://www.w3.org/2001/XInclude">
<title>Overview</title>
<para>Writing a thunarx-python extension is a fairly straight-forward process.
One simply imports the Thunarx module and creates a class which is derived from a number
of the Thunarx module's classes. When an extension derives a class, it becomes a "provider",
telling Thunarx to ask it for information. There are several types of providers
available for extensions to use: there is MenuProvider, PropertyPageProvider, RenamerProvider,
and PreferencePageProvider, all of which will be explained
in more detail below. Your class can be derived from multiple providers.</para>
<para>Here are the basic steps:</para>
<para>1. A script is written and installed to the standard python extensions install path</para>
<para>2. Thunar is (re)started and loads the thunarx-python C extension, which in turn loads all python extensions</para>
<para>3. Any python script in the standard python extensions install path that imports the Thunarx module and derives
the main class from a Thunarx module class will be loaded</para>
<note>
<title>Where to install python extensions</title>
<para>As of thunarx-python 0.3.0, python extensions are installed in $XDG_DATA_DIR/thunarx-python/extensions where $XDG_DATA_DIR
could be /usr/share for a global install or ~/.local/share for a local install.</para>
</note>
<note>
<para>As of thunarx-python 0.5.0, python extensions are loaded in the following order:
1. $XDG_DATA_HOME/thunarx-python/extensions
2. thunar_prefix/share/thunarx-python/extensions
3. $XDG_DATA_DIRS/thunarx-python/extensions
4. THUNARX_EXTENSION_DIR/python (i.e. /usr/lib64/thunarx-3/python)</para>
</note>
<note>
<title>thunarx-3</title>
<para>As of thunar v1.7.0, thunarx requires Gtk+3 and no longer accepts gtk.Actions. Instead, it expects Thunarx.MenuItems.</para>
</note>
<note>
<title>python3</title>
<para>As of thunarx-python v0.5.0, thunarx-python can be built to embed python3 instead of python2. It uses the $PYTHON environment variable to determine which library to use.</para>
</note>
<xi:include href="thunarx-python-overview-example.xml"/>
</chapter>
|