comparison src/cagou/core/cagou_main.py @ 43:12fdc7d1feb1

core: newWidget implementation, it only display a not when a MUC room has been joined
author Goffi <goffi@goffi.org>
date Sun, 28 Aug 2016 16:50:56 +0200
parents 7cac2d1a6f20
children 7819e9efa250
comparison
equal deleted inserted replaced
42:286865bc013a 43:12fdc7d1feb1
25 from sat.core import log as logging 25 from sat.core import log as logging
26 log = logging.getLogger(__name__) 26 log = logging.getLogger(__name__)
27 from sat.core import exceptions 27 from sat.core import exceptions
28 from sat_frontends.quick_frontend.quick_app import QuickApp 28 from sat_frontends.quick_frontend.quick_app import QuickApp
29 from sat_frontends.quick_frontend import quick_widgets 29 from sat_frontends.quick_frontend import quick_widgets
30 from sat_frontends.quick_frontend import quick_chat
30 from sat_frontends.bridge.DBus import DBusBridgeFrontend 31 from sat_frontends.bridge.DBus import DBusBridgeFrontend
31 import kivy 32 import kivy
32 kivy.require('1.9.1') 33 kivy.require('1.9.1')
33 import kivy.support 34 import kivy.support
34 kivy.support.install_gobject_iteration() 35 kivy.support.install_gobject_iteration()
329 continue 330 continue
330 return plugin_info 331 return plugin_info
331 332
332 ## widgets handling 333 ## widgets handling
333 334
335
336 def newWidget(self, widget):
337 log.debug(u"new widget created: {}".format(widget))
338 if isinstance(widget, quick_chat.QuickChat) and widget.type == C.CHAT_GROUP:
339 self.addNote(u"", _(u"room {} has been joined").format(widget.target))
340
334 def getParentHandler(self, widget): 341 def getParentHandler(self, widget):
335 """Return handler holding this widget 342 """Return handler holding this widget
336 343
337 @return (WidgetsHandler): handler 344 @return (WidgetsHandler): handler
338 """ 345 """
404 self.app.root.changeWidget(WidgetsHandler()) 411 self.app.root.changeWidget(WidgetsHandler())
405 412
406 def setPresenceStatus(self, show='', status=None, profile=C.PROF_KEY_NONE): 413 def setPresenceStatus(self, show='', status=None, profile=C.PROF_KEY_NONE):
407 log.info(u"Profile presence status set to {show}/{status}".format(show=show, status=status)) 414 log.info(u"Profile presence status set to {show}/{status}".format(show=show, status=status))
408 415
409 def addNote(self, title, message, level): 416 def addNote(self, title, message, level=C.XMLUI_DATA_LVL_INFO):
410 """add a note (message which disappear) to root widget's header""" 417 """add a note (message which disappear) to root widget's header"""
411 self.app.root.addNote(title, message, level) 418 self.app.root.addNote(title, message, level)
412 419
413 def addNotifUI(self, ui): 420 def addNotifUI(self, ui):
414 """add a notification with a XMLUI attached 421 """add a notification with a XMLUI attached