From 19ae99386dea12429dc7a6d122b991e70d3ca5e9 Mon Sep 17 00:00:00 2001 From: Julio Biason Date: Mon, 10 May 2010 14:37:51 -0300 Subject: [PATCH] the ok button now emits a signal so the interface can work properly --- mitterlib/ui/helpers/gtk_updatebox.py | 12 +++++++++++- mitterlib/ui/ui_pygtk.py | 2 ++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/mitterlib/ui/helpers/gtk_updatebox.py b/mitterlib/ui/helpers/gtk_updatebox.py index c8564eb..6ecb5f2 100644 --- a/mitterlib/ui/helpers/gtk_updatebox.py +++ b/mitterlib/ui/helpers/gtk_updatebox.py @@ -44,6 +44,10 @@ class UpdateBox(gtk.VBox): __gsignals__ = { 'text-focus': ( + gobject.SIGNAL_RUN_LAST, + gobject.TYPE_NONE, + ()), + 'status-updated': ( gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ())} @@ -67,13 +71,14 @@ class UpdateBox(gtk.VBox): add_button = gtk.Button(stock=gtk.STOCK_OK) add_button.set_relief(gtk.RELIEF_NONE); + add_button.connect('clicked', self.do_update) status_bar = gtk.HBox(False, 0) status_bar.pack_start(self._update_status, expand=True, fill=False, padding=0) status_bar.pack_start(self._update_info, expand=True, fill=False, padding=0) - status_bar.pack_start(add_button, expand=false, fill=False, padding=0) + status_bar.pack_start(add_button, expand=False, fill=False, padding=0) status_bar.pack_start(close_button, expand=False, fill=False, padding=0) @@ -155,3 +160,8 @@ class UpdateBox(gtk.VBox): self.avatar.set_from_pixbuf(pixbuf) # pixbuf can only be set, not get. pixbuf = property(None, _set_pixbuf) + + def do_update(self, widget=None): + text = self._text.get_buffer() + self.emit('status-updated') + return diff --git a/mitterlib/ui/ui_pygtk.py b/mitterlib/ui/ui_pygtk.py index 9c92614..20d1fa7 100644 --- a/mitterlib/ui/ui_pygtk.py +++ b/mitterlib/ui/ui_pygtk.py @@ -89,6 +89,7 @@ class Interface(object): self._update_field = UpdateBox( self._images['avatar'], self._options[self.NAMESPACE]['spell_check']) + self._update_field.connect('status-updated', self._update_status) self._statusbar = SmartStatusbar() # the messages grid @@ -498,6 +499,7 @@ class Interface(object): def _update_status(self, widget): """Update your status.""" if not self._update_field.get_property('visible'): + # update box is not visible; show it. self._update_field.show() return