Re: Automatic signal connection



2009/1/11 Stephen Kennedy <stevek gnome org>:
> I'd like to change the way signal connection in meld is done.
<snip>
> I've added code to connect handlers based on method names which avoids
> all the above issues.
> http://svn.gnome.org/viewvc/meld/trunk/gnomeglade.py?r1=1084&r2=1126
> Unnamed widgets need to be given names before calling. e.g.
> self.vadjustment = self.scrolledwindow.get_vadjustment()
> gnomeglade.connect_signal_handlers(self)
>
> Comments?

I like the elegance of the approach, but there are a couple of points
I think might make it a little tougher to do this. Firstly, we have a
single callback for multiple widgets in several cases (e.g.,
on_textview_expose_event, which handles textview0, textview1 and
textview2). We would have to call map_widgets_into_lists() beforehand,
and also add code to deal specifically with these list objects.

The second problem is gtk.UIManager. As far as I read it, the current
code autoconnects signals from a glade file, but warns on any
[on_|after_]*__* that it can't connect up. However, all of the signals
from menu/toolbar callbacks are going to have callbacks matching this
pattern. I think GtkBuilder has support for constructing UIManager
objects, so maybe that would be a long-term fix; for now maybe just
some special casing would be required.

--
Kai


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]