diff frontends/src/primitivus/primitivus @ 776:f89173f44850

frontends: fixed sendMessage calls, sendMessage is now async so callback and errback need to be specified + redraw in PrimivitusApp.notify
author Goffi <goffi@goffi.org>
date Fri, 03 Jan 2014 21:25:07 +0100
parents eac23b1aad90
children 5642939d254e
line wrap: on
line diff
--- a/frontends/src/primitivus/primitivus	Sun Dec 29 17:48:14 2013 +0100
+++ b/frontends/src/primitivus/primitivus	Fri Jan 03 21:25:07 2014 +0100
@@ -103,13 +103,12 @@
             contact = self.app.contact_list.getContact() ###Based on the fact that there is currently only one contact selectableat once
             if contact:
                 chat = self.app.chat_wins[contact]
-                try:
-                    self.app.sendMessage(contact,
+                self.app.sendMessage(contact,
                                      editBar.get_edit_text(),
                                      mess_type = "groupchat" if chat.type == 'group' else "chat",
-                                     profile_key=self.app.profile)
-                except: # FIXME: bad global catch + sendMessage is now async
-                    self.app.notify(_("Error while sending message"))
+                                     errback=lambda failure: self.app.notify(_("Error while sending message (%s)") % unicode(failure)),
+                                     profile_key=self.app.profile
+                                    )
                 editBar.set_edit_text('')
         elif self.mode == 'COMMAND':
             self.commandHandler()
@@ -346,6 +345,7 @@
     def notify(self, message):
         """"Notify message to user via notification bar"""
         self.notBar.addMessage(message)
+        self.redraw()
 
     def addWindow(self, widget):
         """Display a window if possible,