I used 169 as a base and separated it into the dockbarx module and the launcher/factory. This has not failed yet, and I have tested it many times. Other applets, for example the deskbar applet, use a similar format: a launcher of less than 200 lines, and multiple imported modules.
I moved dockbarx.py to /usr/lib/python2.6/dist-packages. After that, it can be imported with import dockbarx.
I call the following factory class dockbarx_factory.py:
#!/usr/bin/python
# Copyright 2008, 2009, 2010 Aleksey Shaferov and Matias Sars
#
# DockBar is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# DockBar is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with dockbar. If not, see <http://www.gnu.org/licenses/>.
I used 169 as a base and separated it into the dockbarx module and the launcher/factory. This has not failed yet, and I have tested it many times. Other applets, for example the deskbar applet, use a similar format: a launcher of less than 200 lines, and multiple imported modules.
I moved dockbarx.py to /usr/lib/ python2. 6/dist- packages. After that, it can be imported with import dockbarx. factory. py:
I call the following factory class dockbarx_
#!/usr/bin/python
# Copyright 2008, 2009, 2010 Aleksey Shaferov and Matias Sars www.gnu. org/licenses/>.
#
# DockBar is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# DockBar is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with dockbar. If not, see <http://
import pygtk '2.0')
pygtk.require(
import gtk
import gobject
import gnomeapplet
import sys
import dockbarx
def dockbar_ factory( applet, iid): DockBar( applet) set_background_ widget( applet) show_all( )
dockbar = dockbarx.
applet.
applet.
return True
if len(sys.argv) == 2 and sys.argv[1] == "run-in-window": DockBarWindow( ) main() .bonobo_ factory( "OAFIID: GNOME_DockBarXA pplet_Factory" ,
gnomeapplet. Applet. __gtype_ _,
dockbarwin = dockbarx.
dockbarwin.
else:
gnomeapplet
"dockbar applet", "0", dockbar_factory)
Now, this factory class needs to be referenced in the bonobo server description:
--- GNOME_DockBarXA pplet.server 2010-04-29 00:00:04.496690000 +0300 pplet.server. modular 2010-04-29 01:35:30.285671672 +0300 GNOME_DockBarXA pplet_Factory" type="exe" location= "/usr/bin/ dockbarx. py"> GNOME_DockBarXA pplet_Factory" type="exe" location= "/usr/bin/ dockbarx_ factory. py">
+++ GNOME_DockBarXA
@@ -1,5 +1,5 @@
<oaf_info>
-<oaf_server iid="OAFIID:
+<oaf_server iid="OAFIID:
<oaf_attribute name="repo_ids" type="stringv"> IDL:Bonobo/ GenericFactory: 1.0"/>
<item value="
And that's it.