On Fri, 2005-10-14 at 01:25 -0400, Chris Spencer wrote:
> I've been using Glade to design some Gnome applications. However, I've
> been having an extremely difficult time trying to load the glade file
> with pyGTK. The few examples I've found only cover extremely simple GTK
> programs. When I try to load my Gnome application in a similar way I get
> the error:
>
> GnomeUI-ERROR **: You must call gnome_program_init() before creating a
> GnomeApp
>
> This function doesn't appear to be listed in the docs, and Google only
> returns posts of people asking about this function...and finding little.
Basically something like this. I run this on RedHat 9 and it had
different handing of the app-data property than the newer versions so
you might not need the both of those chunks.
===
import gtk
import gtk.glade
import gnome
try:
props = { gnome.PARAM_APP_DATADIR : '/usr/share'}
prog = gnome.program_init('dcsrvmon', '1.0', properties=props)
except:
prog = gnome.program_init('dcsrvmon', '1.0')
prog.set_property('app-datadir', '/usr/share')
self.tree = gtk.glade.XML('./dcsrvmon.glade','logWindow')
dict = {'on_logWindowCloseBtn_clicked': self.logWindowClose,
'on_logWindowHelpBtn_clicked': self.logWindowHelp,
'on_logWindow_delete_event': self.logWindowClose,
}
self.tree.signal_autoconnect(dict)
===
>
> Does anyone know of pyGTK Gnome application examples, or better yet, a
> Python code generator for glade files? I've found glc and gladepyc, but
> they both appear to be dead projects.
I wouldn't really recommend that anyway. Why bother with code
generation when you load everything with just a couple of calls anyway.
You might want to look at Kiwi for a model of setting up Glade based
classes. I do something similar in my code. A class attribute names
the glade file and a base class loads file and autoconnects with all the
methods in the class.
>
> Chris
>
> _______________________________________________
> pygtk mailing list [email protected]
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
--
Steve McClure Racemi
email: [EMAIL PROTECTED] 75 5th St NE
voice: 404-892-5850 Suite 333
fax: 404-892-7215 Atlanta, GA 30308
http://www.racemi.com
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/