[pygtk] Gnome Applet using Python
Milinda Pathirage
milinda.pathirage at gmail.com
Tue Nov 27 23:13:34 WST 2007
Hi all,
I am new to pygtk. I create sample applet by looking at Computer temperature
applet from http://computertemp.berlios.de/. But when I try to add the
applet to panel it gave following error.
The panel encountered a problem while loading "OAFIID:GNOME_SampleApplet".
Here is my applet code.
#!/usr/bin/env python
import pygtk
import gtk
import gobject
import gnome
import gnomeapplet
class SampleApplet(gnomeapplet.Applet):
def __init__(self, applet, iid):
self.__gobject_init__()
self.applet =3D applet
label =3D gtk.Label("Hello World")
self.applet.add(label)
gobject.type_register(SampleApplet)
DEBUG =3D False
def sample_applet_factory(applet, iid):
SampleApplet(applet, iid)
return True
def main(debug):
global DEBUG
DEBUG =3D debug
# Create the applet
gnomeapplet.bonobo_factory("OAFIID:GNOME_SampleApplet_Factory",
SampleApplet.__gtype__,
"Python applet example",
"0.1",
sample_applet_factory)
and here is the server file:
<oaf_info>
<oaf_server iid=3D"OAFIID:GNOME_SampleApplet_Factory"
type=3D"exe" location=3D"/usr/bin/pysample.py">
<oaf_attribute name=3D"repo_ids" type=3D"stringv">
<item value=3D"IDL:Bonobo/GenericFactory:1.0"/>
<item value=3D"IDL:Bonobo/Unknown:1.0"/>
</oaf_attribute>
<oaf_attribute name=3D"name" type=3D"string" value=3D"Python
applet example"/>
<oaf_attribute name=3D"description" type=3D"string"
value=3D"Python applet example"/>
</oaf_server>
<oaf_server iid=3D"OAFIID:GNOME_SampleApplet"
type=3D"factory"
location=3D"OAFIID:GNOME_SampleApplet_Factory">
<oaf_attribute name=3D"repo_ids" type=3D"stringv">
<item value=3D"IDL:GNOME/Vertigo/PanelAppletShell:1=
.0
"/>
<item value=3D"IDL:Bonobo/Control:1.0"/>
<item value=3D"IDL:Bonobo/Unknown:1.0"/>
</oaf_attribute>
<oaf_attribute name=3D"name" type=3D"string" value=3D"Python
applet example"/>
<oaf_attribute name=3D"description" type=3D"string"
value=3D"Python applet example"/>
<oaf_attribute name=3D"panel:category" type=3D"string"
value=3D"Utility"/>
<oaf_attribute name=3D"panel:icon" type=3D"string" value=3D"
arts.svg"/>
</oaf_server>
</oaf_info>
Do anyone have any idea about this problem. I am using Ubuntu 7.10 ("Gutsy
Gibbon").
Thank in advance
Milinda
-- =
http://think2ed.blogspot.com "thinksquared"
http://wsaxc.blogspot.com "Web Services With Axis2/C"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20071127/3e08d2e0/at=
tachment-0001.htm
More information about the pygtk
mailing list