comparison src/browser/sat_browser/main_panel.py @ 684:e876f493dccc

browser_side: follow changes made on quick_frontend for chat states and MUC symbols + minor fixes following the refactorisation: - some MUC handlers are no more needed, the presence handler is enough - move the chat states logic to quick_frontend - display MUC games symbols - remove classes contact_list.ContactsPanel, contact_panel.Occupant and contact_panel.OccupantsList - move buildPresenceStyle and setPresenceStyle to html_tools - fixes games menu callback
author souliane <souliane@mailoo.org>
date Wed, 18 Mar 2015 10:17:04 +0100
parents a90cc8fc9605
children 9877607c719a
comparison
equal deleted inserted replaced
683:801eb94aa869 684:e876f493dccc
40 import dialog 40 import dialog
41 import base_widget 41 import base_widget
42 import base_menu 42 import base_menu
43 import libervia_widget 43 import libervia_widget
44 import editor_widget 44 import editor_widget
45 import contact_list 45 import html_tools
46 from constants import Const as C 46 from constants import Const as C
47 47
48 48
49 ### Warning notification (visibility of message, and other warning data) ### 49 ### Warning notification (visibility of message, and other warning data) ###
50 50
169 styles = {'menu_bar': 'presence-button'} 169 styles = {'menu_bar': 'presence-button'}
170 base_widget.WidgetMenuBar.__init__(self, parent, parent.host, styles=styles) 170 base_widget.WidgetMenuBar.__init__(self, parent, parent.host, styles=styles)
171 self.button = self.addCategory(u"◉") 171 self.button = self.addCategory(u"◉")
172 presence_menu = self.button.getSubMenu() 172 presence_menu = self.button.getSubMenu()
173 for presence, presence_i18n in C.PRESENCE.items(): 173 for presence, presence_i18n in C.PRESENCE.items():
174 html = u'<span class="%s">◉</span> %s' % (contact_list.buildPresenceStyle(presence), presence_i18n) 174 html = u'<span class="%s">◉</span> %s' % (html_tools.buildPresenceStyle(presence), presence_i18n)
175 presence_menu.addItem(html, True, base_menu.SimpleCmd(lambda presence=presence: self.changePresenceCb(presence))) 175 presence_menu.addItem(html, True, base_menu.SimpleCmd(lambda presence=presence: self.changePresenceCb(presence)))
176 self.parent_panel = parent 176 self.parent_panel = parent
177 177
178 def changePresenceCb(self, presence=''): 178 def changePresenceCb(self, presence=''):
179 """Callback to notice the backend of a new presence set by the user. 179 """Callback to notice the backend of a new presence set by the user.
217 def status(self): 217 def status(self):
218 return self.status_panel._original_content['text'] 218 return self.status_panel._original_content['text']
219 219
220 def setPresence(self, presence): 220 def setPresence(self, presence):
221 self._presence = presence 221 self._presence = presence
222 contact_list.setPresenceStyle(self.presence_bar.button, self._presence) 222 html_tools.setPresenceStyle(self.presence_bar.button, self._presence)
223 223
224 def setStatus(self, status): 224 def setStatus(self, status):
225 self.status_panel.setContent({'text': status}) 225 self.status_panel.setContent({'text': status})
226 self.status_panel.setDisplayContent() 226 self.status_panel.setDisplayContent()
227 227