On Wed, 2011-02-09 at 14:57 +0100, Alessandro Dentella wrote: 
> On Wed, Feb 09, 2011 at 08:32:23AM -0500, Adam Tauno Williams wrote:
> > builder = gtk.Builder()
> > builder.add_from_file(self.gladefile)
> > self.window = builder.get_object("MainWindow")
> > This, according to my understanding creates an instance of the
> > MainWindow widget as defined in the Glade file.
> > Now if I want to connect the events defined in the Glade file to
> > handlers of the 'current' instance I perform -
> > builder.connect_signals(self)
> > But according to the log messages this tries to connect any event
> > handler defined in the glade file to methods of this object.  Is there a
> > way to only connect event handlers for the "MainWindow" widget?  Do I
> > need to define each widget in a separate Glade file?
> In the Builder documentations it says:
>   The connect_signals() method uses Python's introspective features to look at
>   the keys (if object is a mapping) or attributes (if object is an instance)
>   and tries to match them with the signal handler names given in the interface
>   description. The callbacks referenced by each matched key or attribute are
>   connected to their matching signals.
> So that you can pass a dict with only the keys corresponding to the handler
> you need to connect.

Yes, I read that something like twelve times - I just assumed I was
missing something - because, ugh... that diminishes the value of a GUI
builder.  It seems the advice should then be to place each window /
entity in a separate Glade file.  [If two entities in a Glade file have
a handler of the same name... where does it get bound to?  This really
seems non-intuitive].

_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to