From e37a5645b43bc9f7534c7678b899461f38dee9bb Mon Sep 17 00:00:00 2001 From: Anna Date: Wed, 2 Jun 2010 17:50:43 -0400 Subject: [PATCH] More framework to make adding to lists work correctly. --- twitterwidgets.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/twitterwidgets.py b/twitterwidgets.py index d5bd9a0..14c6f3c 100644 --- a/twitterwidgets.py +++ b/twitterwidgets.py @@ -623,6 +623,10 @@ class UserBox(gtk.VBox): self.list_box = gtk.combo_box_entry_new_text() self.list_label = gtk.Label('') + self.list_box.append_text('add to list') + self.list_box.set_active(0) + self.list_box.connect('changed', self.on_add_to_list) + self.name_label.set_alignment(0.0, 0.0) self.follow_label.set_alignment(0.0, 0.0) self.verified_label.set_alignment(0.0, 0.0) @@ -641,6 +645,7 @@ class UserBox(gtk.VBox): button_row = gtk.HBox() button_row.pack_start(self.follow_button, expand=False) button_row.pack_start(self.at_button, expand=False) + button_row.pack_start(self.list_box, expand=False) self.pack_start(info_row, expand=False) self.pack_start(button_row, expand=False) @@ -687,6 +692,7 @@ class UserBox(gtk.VBox): self.avatar.show() self.at_button.show() self.follow_button.show() + self.list_box.show() if self.list_label.get_text() != '': self.list_label.show() @@ -738,6 +744,7 @@ class UserBox(gtk.VBox): self.name_label.hide() self.avatar.hide() self.list_label.hide() + self.list_box.hide() def set_lists(self, lists): @@ -751,9 +758,27 @@ class UserBox(gtk.VBox): self.list_label.set_text(list_label_text) + + def list_added(self, new_list): + pass + # fixme: this should add the list to the text field, and remove it + # from the combo box + + + def on_add_to_list(self, widget): + if widget.get_active_text() == 'add to list': + return + + self.emit('add-to-list', widget.get_active_text()) + + widget.set_active(0) + # end class UserBox # signals for UserBox +gobject.signal_new("add-to-list", UserBox, + gobject.SIGNAL_RUN_LAST, + gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT,)) gobject.signal_new("follow-clicked", UserBox, gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT,))