Re: autoconnecting signals with libglade & PyGTK?
- From: Havoc Pennington <hp redhat com>
- To: Jason Tackaberry <tack linux com>
- Cc: gnome-devel-list gnome org
- Subject: Re: autoconnecting signals with libglade & PyGTK?
- Date: 09 Jan 2000 14:18:40 -0500
Jason Tackaberry <tack@linux.com> writes:
> I have been learning Python over the past few weeks, so I am by no means an
> expert. My hope is to write a series of articles for linux.com, one of
> which I would like to demonstrate RAD in Gnome using PyGTK.
>
Nice idea! (BTW there was a short article about this somehwere, it's
in news.gnome.org archives)
> With libglade (in C) there is a function to autoconnect signals. There
> doesn't seem to be any explicit function to do this with PyGTK, but, near as
> I can tell, this functionality is supposed to happen automatically.
>
You might yank Eider out of CVS (cvs co eider) and look at the code
(it's a big pain to actually compile though).
Here's an example from MainWindow.py:
def __init__(self):
xml =
libglade.GladeXML(EiderUtils.get_eider_glade_file("eider.g
lade"), "project-window")
xml.signal_autoconnect (
{ "on_open_project_activate" : self.open_project_cb,
"on_exit_activate" : self.exit_cb,
"on_about_activate" : self.about_cb,
"on_new_project_activate" : self.new_cb,
"on_compile_activate" : self.compile_cb,
"on_api_reference_activate" : self.apiref_cb,
"on_configure_activate" : self.configure_cb,
"on_autogen_activate" : self.autogen_cb,
"on_full_build_activate" : self.full_build_cb,
"on_project_properties_activate" : self.project_properties_cb })
i.e. you pass in a dictionary mapping the Glade callback name to a
function to call.
Havoc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]