comparison frontends/src/quick_frontend/quick_app.py @ 1787:d678b723460b

quick_frontend, primitivus: mechanism to signal a new message reception when the window is hidden (even if the message is actually displayed): - for now this is only used by Libervia
author souliane <souliane@mailoo.org>
date Tue, 12 Jan 2016 17:54:38 +0100
parents d17772b0fe22
children 70ce9421c4d3
comparison
equal deleted inserted replaced
1786:104874018ab0 1787:d678b723460b
514 visible = False 514 visible = False
515 for widget in self.visible_widgets: 515 for widget in self.visible_widgets:
516 if isinstance(widget, quick_chat.QuickChat) and widget.manageMessage(from_jid, type_): 516 if isinstance(widget, quick_chat.QuickChat) and widget.manageMessage(from_jid, type_):
517 visible = True 517 visible = True
518 break 518 break
519 if not visible: 519 if visible:
520 if self.isHidden(): # the window is hidden
521 self.updateAlertsCounter(extra_inc=1)
522 else:
520 contact_list.addAlert(from_jid.bare if type_ == C.MESS_TYPE_GROUPCHAT else from_jid) 523 contact_list.addAlert(from_jid.bare if type_ == C.MESS_TYPE_GROUPCHAT else from_jid)
521 524
522 def sendMessage(self, to_jid, message, subject='', mess_type="auto", extra={}, callback=None, errback=None, profile_key=C.PROF_KEY_NONE): 525 def sendMessage(self, to_jid, message, subject='', mess_type="auto", extra={}, callback=None, errback=None, profile_key=C.PROF_KEY_NONE):
523 if callback is None: 526 if callback is None:
524 callback = lambda dummy=None: None # FIXME: optional argument is here because pyjamas doesn't support callback without arg with json proxy 527 callback = lambda dummy=None: None # FIXME: optional argument is here because pyjamas doesn't support callback without arg with json proxy
699 702
700 def progressIdHandler(self, progress_id, profile): 703 def progressIdHandler(self, progress_id, profile):
701 """Callback used when an action result in a progress id""" 704 """Callback used when an action result in a progress id"""
702 log.info(u"Progress ID received: {}".format(progress_id)) 705 log.info(u"Progress ID received: {}".format(progress_id))
703 706
704 def updateAlertsCounter(self): 707 def isHidden(self):
705 """Update the over whole alerts counter 708 """Tells if the frontend window is hidden.
706 709
710 @return bool
711 """
712 raise NotImplementedError
713
714 def updateAlertsCounter(self, extra_inc=0):
715 """Update the over whole alerts counter.
716
717 @param extra_inc (int): extra counter
707 """ 718 """
708 pass 719 pass
709 720
710 def paramUpdateHandler(self, name, value, namespace, profile): 721 def paramUpdateHandler(self, name, value, namespace, profile):
711 log.debug(_(u"param update: [%(namespace)s] %(name)s = %(value)s") % {'namespace': namespace, 'name': name, 'value': value}) 722 log.debug(_(u"param update: [%(namespace)s] %(name)s = %(value)s") % {'namespace': namespace, 'name': name, 'value': value})