quickly-talk team mailing list archive
-
quickly-talk team
-
Mailing list archive
-
Message #00001
Enhancements for gtk.Builder
Hi all
There has been an enhancement for gtk.Builder (autosignals by Michael
Terry) merged into trunk recently. While I was working on a parallel
branch enhancing gtk.Builder a conflicting design arose. Michael is
the reviewer for my branch and he suggested throwing this design point
open to discussion.
In BuilderGlue.py.__init__(...)
lines 71 to 96 functions as auto-connect-by-name. It walks the
builders widgets and signals
and looks for methods like widget_signal_event(...) and calls
widget.connect(signal, widget_signal_event) for every match. Michael
likes my variant
find method on_widget_signal and call widget.connect(signal, on_widget_signal).
My branch was, among other things, addressing automating a group of
widgets to common handler suggestion by jo-erlend on #quickly. The use
case given was 4 navigation widgets "<<", "<", ">", ">>" connecting to
a common handler.
my suggested handler was decorated like this
http://www.drdobbs.com/web-development/184406073#l9
and auto-connected-by-decoration
@ui(["first", "previous", "next", "last"], "clicked")
def on_navigate(widget):
widget_name = get_name(widget)
do_navigate(widget_name)
as a alternative to (auto-connect-by-name)
def on_navigate(widget):
widget_name = get_name(widget)
do_navigate(widget_name)
on_first_clicked=on_navigate
on_previous_clicked=on_navigate
on_next_clicked=on_navigate
on_last_clicked=on_navigate
Michael stated that many to one is an edge case but I don't agree.
many to one is in PreferencesDialog now and it is needed for toolbar
and menu handling.
Follow ups