Re: [jokosher-devel] IMPORTANT: Stuff to do for 0.2
- From: John Green <john thegreens co uk>
- To: jokosher-devel-list gnome org
- Subject: Re: [jokosher-devel] IMPORTANT: Stuff to do for 0.2
- Date: Tue, 5 Sep 2006 01:38:09 +0100
On Tuesday 29 August 2006 12:21, Laszlo Pandy wrote:
> Jono Bacon a écrit :
>
> And finally, please write more extensions! Here is the Hello World
> Jokosher extension:
> #!/usr/bin/python
> from Jokosher.Extensions import API
> import gtk
>
> #callback for menu entry
> def HelloWorld():
> #launch gtk dialog
> dlg = gtk.MessageDialog(message_format="Hello World")
> dlg.run()
> dlg.destroy()
>
> #called by Jokosher when it wants up to startup
> def startup(API):
> API.add_menu_item("Hello World GTK", HelloWorld)
>
There's a couple of mistakes here, actually, it should be Jokosher.Extension
and the function HelloWorld needs an argument (it gets passed the
gtk.MenuItem). So what I had to get this to work was:
#!/usr/bin/python
from Jokosher.Extension import API
import gtk
#callback for menu entry
def HelloWorld(arg):
#launch gtk dialog
dlg = gtk.MessageDialog(message_format="Hello World")
dlg.run()
dlg.destroy()
#called by Jokosher when it wants up to startup
def startup(API):
API.add_menu_item("Hello World GTK", HelloWorld)
I also have a problem with the Jokosher script setting up the PYTHONPATH
properly. I usually run the script from within the Jokosher directory by
calling
./Jokosher
However, the nested dirname's don't give the parent in this case since
dirname , is still just . and not .. (this is probably not easy to read but I
know what I mean). However if I call it from anywhere else or use
../Jokosher/Jokosher
then it's fine. Can anyone with better bash knowledge sort this?
--
John Green
john thegreens co uk
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]