frontends: fixed sendMessage calls, sendMessage is now async so callback and errback need to be specified + redraw in PrimivitusApp.notify

This commit is contained in:
Goffi 2014-01-03 21:25:07 +01:00
commit fc003ecf77

View file

@ -103,13 +103,12 @@ class EditBar(sat_widgets.ModalEdit):
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 @@ class PrimitivusApp(QuickApp, InputHistory):
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,