[Goodies-dev] [request] python plugin tutorial

Martin Forsgren mk0foma at student.chalmers.se
Sun Feb 3 22:24:09 CET 2008


Den 2008-01-31 18:40:43 skrev Alexandre Leray  
<newsletters at alexandreleray.com>:

> Hi,
>
> thanks for your response. I got this error :
> "Traceback (most recent call last):
>   File "test.py", line 9, in ?
>     plugin = xfce4.panel.Plugin()
> RuntimeError: could not create xfce4.panel.ExternalPanelPlugin object"

Do you run the program as an aplet? What I now it isn't possible
for a program to manipulate the panel from "outside".

Create a "program.desktop" file with content approx as below under
/usr/share/xfce4/panel-plugins ( path may wary but the file isn't
alone where it should be ).

[Xfce Panel]
Encoding=UTF-8
Name=Network Manager
Comment=Easy network manager also displaying network information
Icon=nm-device-wireless
Type=Panel
X-XFCE-Unique=true
X-XFCE-Exec=/home/user/program.py

both your program and the desktop file must be executable me think.

Hope it works...
/Martin

>
> In the documentation the right object is called
> external.ExternalPanelPlugin.
>
> Any idea ?
>
> Bye
>
> Martin Forsgren wrote:
>> Hi,
>> there isn't much documentation, atleast what I've found, but
>> its not so hard. Check http://code.google.com/p/pynetworkmanager/ and  
>> look
>> at the panel-plugin code.
>>
>> Maby this below is enough for you... (it's copy/paste code and can  
>> contain
>> errors)
>>
>> ------
>>
>> # External libraries
>> import gtk							# use gtk-library
>> import xfce4.panel				# to create xfce4 panel plugin
>>
>> # Button with status icon and menu plopping up on clicking it
>> button = gtk.Button( "Hello World" )
>> button.show()
>>
>> # create an xfce panel plugin
>> plugin = xfce4.panel.Plugin()
>>
>> plugin.add( button )
>>
>> # Add right mouse button action
>> plugin.add_action_widget( button )
>>
>> # Show plugin
>> plugin.show()
>>
>> # Close plugin on destroy
>> plugin.connect("destroy", pynm.stop )
>>
>> # Ready. Start plugin
>> gtk.main_loop()
>>
>> ---------
>>
>> Den 2008-01-25 18:44:59 skrev Alexandre Leray
>> <newsletters at alexandreleray.com>:
>>
>>
>>> Hi everybody,
>>>
>>> It's quite hard to find documentation on pyxfce and python plugins.  
>>> Does
>>> anybody could make me a brief tutorial (like "hello world" in a panel)
>>> or give me links for?
>>>
>>> Thanks!
>>> _______________________________________________
>>> Goodies-dev mailing list
>>> Goodies-dev at xfce.org
>>> http://foo-projects.org/mailman/listinfo/goodies-dev
>>>
>>
>>
>> _______________________________________________
>> Goodies-dev mailing list
>> Goodies-dev at xfce.org
>> http://foo-projects.org/mailman/listinfo/goodies-dev
>>
>
> _______________________________________________
> Goodies-dev mailing list
> Goodies-dev at xfce.org
> http://foo-projects.org/mailman/listinfo/goodies-dev





More information about the Goodies-dev mailing list