Automatic signal connection
- From: "Stephen Kennedy" <stevek gnome org>
- To: meld-list gnome org
- Subject: Automatic signal connection
- Date: Sun, 11 Jan 2009 20:15:06 +0000
I'd like to change the way signal connection in meld is done.
The "usual" (signal_autoconnect) method of signal connection in pygtk
has some shortcomings:
1. violation of the don't-repeat-yourself principle as you need to add
the signal in glade and also
to your python code.
2. signal_autoconnect also doesn't help you discover typos in handler names.
3. You can't connect signals which don't have named widgets. e.g.
there is no way to connect a
scrolledwindows adjustments except manually. It's a wart to have both
manual and automatic
connections.
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?
Stephen.
There's an old post which has more details.
http://www.mail-archive.com/pygtk daa com au/msg08468.html
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]