comparison frontends/src/quick_frontend/quick_app.py @ 1658:683b76c1145d

quick_frontend, primitivus: display the number of alerts for each contact and not only a symbol (*)
author souliane <souliane@mailoo.org>
date Tue, 24 Nov 2015 13:31:28 +0100
parents ad2ad28b8923
children d17772b0fe22
comparison
equal deleted inserted replaced
1657:62cd8fc1aef7 1658:683b76c1145d
294 raise NotImplementedError 294 raise NotImplementedError
295 295
296 @property 296 @property
297 def alerts_count(self): 297 def alerts_count(self):
298 """Count the over whole alerts for all contact lists""" 298 """Count the over whole alerts for all contact lists"""
299 return sum([len(clist._alerts) for clist in self.contact_lists.values()]) 299 return sum([sum(clist._alerts.values()) for clist in self.contact_lists.values()])
300 300
301 def registerSignal(self, function_name, handler=None, iface="core", with_profile=True): 301 def registerSignal(self, function_name, handler=None, iface="core", with_profile=True):
302 """Register a handler for a signal 302 """Register a handler for a signal
303 303
304 @param function_name (str): name of the signal to handle 304 @param function_name (str): name of the signal to handle
508 508
509 # we display the message in the widget 509 # we display the message in the widget
510 chat_widget.newMessage(from_jid, target, msg, type_, extra, profile) 510 chat_widget.newMessage(from_jid, target, msg, type_, extra, profile)
511 511
512 # ContactList alert 512 # ContactList alert
513 visible = False 513 if not from_me:
514 for widget in self.visible_widgets: 514 visible = False
515 if isinstance(widget, quick_chat.QuickChat) and widget.manageMessage(from_jid, type_): 515 for widget in self.visible_widgets:
516 visible = True 516 if isinstance(widget, quick_chat.QuickChat) and widget.manageMessage(from_jid, type_):
517 break 517 visible = True
518 if not visible: 518 break
519 contact_list.setAlert(from_jid.bare if type_ == C.MESS_TYPE_GROUPCHAT else from_jid) 519 if not visible:
520 contact_list.addAlert(from_jid.bare if type_ == C.MESS_TYPE_GROUPCHAT else from_jid)
520 521
521 def sendMessage(self, to_jid, message, subject='', mess_type="auto", extra={}, callback=None, errback=None, profile_key=C.PROF_KEY_NONE): 522 def sendMessage(self, to_jid, message, subject='', mess_type="auto", extra={}, callback=None, errback=None, profile_key=C.PROF_KEY_NONE):
522 if callback is None: 523 if callback is None:
523 callback = lambda dummy=None: None # FIXME: optional argument is here because pyjamas doesn't support callback without arg with json proxy 524 callback = lambda dummy=None: None # FIXME: optional argument is here because pyjamas doesn't support callback without arg with json proxy
524 if errback is None: 525 if errback is None: