comparison src/browser/libervia_main.py @ 648:6d3142b782c3 frontends_multi_profiles

browser_side: classes reorganisation: - moved widgets in dedicated modules (base, contact, editor, libervia) and a widget module for single classes - same thing for panels (base, main, contact) - libervia_widget mix main panels and widget and drag n drop for technical reasons (see comments) - renamed WebPanel to WebWidget
author Goffi <goffi@goffi.org>
date Thu, 26 Feb 2015 18:10:54 +0100
parents 9972a24592b0
children 2df91d0308ac
comparison
equal deleted inserted replaced
647:e0021d571eef 648:6d3142b782c3
40 from pyjamas import Window, DOM 40 from pyjamas import Window, DOM
41 41
42 from sat_browser import json 42 from sat_browser import json
43 from sat_browser import register 43 from sat_browser import register
44 from sat_browser.contact_list import ContactList 44 from sat_browser.contact_list import ContactList
45 from sat_browser import base_widget 45 from sat_browser import widget
46 from sat_browser import panels 46 from sat_browser import main_panel
47 from sat_browser import blog 47 from sat_browser import blog
48 from sat_browser import dialog 48 from sat_browser import dialog
49 from sat_browser import xmlui 49 from sat_browser import xmlui
50 from sat_browser import html_tools 50 from sat_browser import html_tools
51 from sat_browser import notification 51 from sat_browser import notification
52 from sat_browser import libervia_widget
52 53
53 from sat_browser.constants import Const as C 54 from sat_browser.constants import Const as C
54 import os.path 55 import os.path
55 56
56 57
67 MAX_MBLOG_CACHE = 500 # Max microblog entries kept in memories 68 MAX_MBLOG_CACHE = 500 # Max microblog entries kept in memories
68 69
69 # Set to true to not create a new LiberviaWidget when a similar one 70 # Set to true to not create a new LiberviaWidget when a similar one
70 # already exist (i.e. a chat panel with the same target). Instead 71 # already exist (i.e. a chat panel with the same target). Instead
71 # the existing widget will be eventually removed from its parent 72 # the existing widget will be eventually removed from its parent
72 # and added to new base_widget.WidgetsPanel, or replaced to the expected 73 # and added to new libervia_widget.WidgetsPanel, or replaced to the expected
73 # position if the previous and the new parent are the same. 74 # position if the previous and the new parent are the same.
74 REUSE_EXISTING_LIBERVIA_WIDGETS = True 75 REUSE_EXISTING_LIBERVIA_WIDGETS = True
75 76
76 77
77 class SatWebFrontend(InputHistory, QuickApp): 78 class SatWebFrontend(InputHistory, QuickApp):
79 log.info("============ onModuleLoad ==============") 80 log.info("============ onModuleLoad ==============")
80 self.bridge_signals = json.BridgeSignals(self) 81 self.bridge_signals = json.BridgeSignals(self)
81 QuickApp.__init__(self, json.BridgeCall) 82 QuickApp.__init__(self, json.BridgeCall)
82 self.uni_box = None # FIXME: to be removed 83 self.uni_box = None # FIXME: to be removed
83 self.status_panel = HTML('<br />') 84 self.status_panel = HTML('<br />')
84 self.panel = panels.MainPanel(self) 85 self.panel = main_panel.MainPanel(self)
85 self.tab_panel = self.panel.tab_panel 86 self.tab_panel = self.panel.tab_panel
86 self.tab_panel.addTabListener(self) 87 self.tab_panel.addTabListener(self)
87 self._register_box = None 88 self._register_box = None
88 RootPanel().add(self.panel) 89 RootPanel().add(self.panel)
89 90
154 # def addSelectedListener(self, callback): 155 # def addSelectedListener(self, callback):
155 # self._selected_listeners.add(callback) 156 # self._selected_listeners.add(callback)
156 157
157 def getSelected(self): 158 def getSelected(self):
158 wid = self.tab_panel.getCurrentPanel() 159 wid = self.tab_panel.getCurrentPanel()
159 if not isinstance(wid, base_widget.WidgetsPanel): 160 if not isinstance(wid, libervia_widget.WidgetsPanel):
160 log.error("Tab widget is not a base_widget.WidgetsPanel, can't get selected widget") 161 log.error("Tab widget is not a WidgetsPanel, can't get selected widget")
161 return None 162 return None
162 return wid.selected 163 return wid.selected
163 164
164 def setSelected(self, widget): 165 def setSelected(self, widget):
165 """Define the selected widget""" 166 """Define the selected widget"""
166 widgets_panel = self.tab_panel.getCurrentPanel() 167 widgets_panel = self.tab_panel.getCurrentPanel()
167 if not isinstance(widgets_panel, base_widget.WidgetsPanel): 168 if not isinstance(widgets_panel, libervia_widget.WidgetsPanel):
168 return 169 return
169 170
170 selected = widgets_panel.selected 171 selected = widgets_panel.selected
171 172
172 if selected == widget: 173 if selected == widget:
192 193
193 def onBeforeTabSelected(self, sender, tab_index): 194 def onBeforeTabSelected(self, sender, tab_index):
194 return True 195 return True
195 196
196 def onTabSelected(self, sender, tab_index): 197 def onTabSelected(self, sender, tab_index):
197 selected = self.getSelected() 198 pass
199 # selected = self.getSelected()
198 # FIXME: 200 # FIXME:
199 # for callback in self._selected_listeners: 201 # for callback in self._selected_listeners:
200 # callback(selected) 202 # callback(selected)
201 203
202 def onEventPreview(self, event): 204 def onEventPreview(self, event):
304 self._register_box.hide() 306 self._register_box.hide()
305 del self._register_box # don't work if self._register_box is None 307 del self._register_box # don't work if self._register_box is None
306 308
307 # display the real presence status panel 309 # display the real presence status panel
308 self.panel.header.remove(self.status_panel) 310 self.panel.header.remove(self.status_panel)
309 self.status_panel = panels.PresenceStatusPanel(self) 311 self.status_panel = main_panel.PresenceStatusPanel(self)
310 self.panel.header.add(self.status_panel) 312 self.panel.header.add(self.status_panel)
311 313
312 self.bridge_signals.call('getSignals', self.bridge_signals.signalHandler) 314 self.bridge_signals.call('getSignals', self.bridge_signals.signalHandler)
313 315
314 #it's time to fill the page 316 #it's time to fill the page
327 329
328 self.bridge.getNewAccountDomain(callback=domain_cb, errback=domain_eb) 330 self.bridge.getNewAccountDomain(callback=domain_cb, errback=domain_eb)
329 self.plug_profiles([C.PROF_KEY_NONE]) # XXX: None was used intitially, but pyjamas bug when using variable arguments and None is the only arg. 331 self.plug_profiles([C.PROF_KEY_NONE]) # XXX: None was used intitially, but pyjamas bug when using variable arguments and None is the only arg.
330 microblog_widget = self.displayWidget(blog.MicroblogPanel, ()) 332 microblog_widget = self.displayWidget(blog.MicroblogPanel, ())
331 self.setSelected(microblog_widget) 333 self.setSelected(microblog_widget)
332 # self.discuss_panel.addWidget(panels.MicroblogPanel(self, [])) 334 # self.discuss_panel.addWidget(panel.MicroblogPanel(self, []))
333 335
334 # # get cached params and refresh the display 336 # # get cached params and refresh the display
335 # def param_cb(cat, name, count): 337 # def param_cb(cat, name, count):
336 # count[0] += 1 338 # count[0] += 1
337 # refresh = count[0] == len(C.CACHED_PARAMS) 339 # refresh = count[0] == len(C.CACHED_PARAMS)
342 # self.bridge.call('asyncGetParamA', param_cb(cat, name, count), name, cat) 344 # self.bridge.call('asyncGetParamA', param_cb(cat, name, count), name, cat)
343 345
344 def profilePlugged(self, dummy): 346 def profilePlugged(self, dummy):
345 QuickApp.profilePlugged(self, dummy) 347 QuickApp.profilePlugged(self, dummy)
346 # we fill the panels already here 348 # we fill the panels already here
347 for widget in self.widgets.getWidgets(blog.MicroblogPanel): 349 for wid in self.widgets.getWidgets(blog.MicroblogPanel):
348 if widget.accept_all(): 350 if wid.accept_all():
349 self.bridge.getMassiveLastMblogs('ALL', [], 10, profile=C.PROF_KEY_NONE, callback=widget.massiveInsert) 351 self.bridge.getMassiveLastMblogs('ALL', [], 10, profile=C.PROF_KEY_NONE, callback=wid.massiveInsert)
350 else: 352 else:
351 self.bridge.getMassiveLastMblogs('GROUP', widget.accepted_groups, 10, profile=C.PROF_KEY_NONE, callback=widget.massiveInsert) 353 self.bridge.getMassiveLastMblogs('GROUP', wid.accepted_groups, 10, profile=C.PROF_KEY_NONE, callback=wid.massiveInsert)
352 354
353 #we ask for our own microblogs: 355 #we ask for our own microblogs:
354 self.bridge.getMassiveLastMblogs('JID', [unicode(self.whoami.bare)], 10, profile=C.PROF_KEY_NONE, callback=self._ownBlogsFills) 356 self.bridge.getMassiveLastMblogs('JID', [unicode(self.whoami.bare)], 10, profile=C.PROF_KEY_NONE, callback=self._ownBlogsFills)
355 357
356 # initialize plugins which waited for the connection to be done 358 # initialize plugins which waited for the connection to be done
361 def addContactList(self, dummy): 363 def addContactList(self, dummy):
362 contact_list = ContactList(self) 364 contact_list = ContactList(self)
363 self.panel.addContactList(contact_list) 365 self.panel.addContactList(contact_list)
364 return contact_list 366 return contact_list
365 367
366 def newWidget(self, widget): 368 def newWidget(self, wid):
367 log.debug("newWidget: {}".format(widget)) 369 log.debug("newWidget: {}".format(wid))
368 self.addWidget(widget) 370 self.addWidget(wid)
369 371
370 def newMessageHandler(self, from_jid_s, msg, type_, to_jid_s, extra, profile): 372 def newMessageHandler(self, from_jid_s, msg, type_, to_jid_s, extra, profile):
371 if type_ == C.MESS_TYPE_HEADLINE: 373 if type_ == C.MESS_TYPE_HEADLINE:
372 from_jid = jid.JID(from_jid_s) 374 from_jid = jid.JID(from_jid_s)
373 if from_jid.domain == self._defaultDomain: 375 if from_jid.domain == self._defaultDomain:
416 ui.show() 418 ui.show()
417 elif "public_blog" in data: 419 elif "public_blog" in data:
418 # TODO: use the bare instead of node when all blogs can be retrieved 420 # TODO: use the bare instead of node when all blogs can be retrieved
419 node = jid.JID(data['public_blog']).node 421 node = jid.JID(data['public_blog']).node
420 # FIXME: "/blog/{}" won't work with unicode nodes 422 # FIXME: "/blog/{}" won't work with unicode nodes
421 self.displayWidget(panels.WebPanel, "/blog/{}".format(node), show_url=False, new_tab="{}'s blog".format(unicode(node))) 423 self.displayWidget(widget.WebWidget, "/blog/{}".format(node), show_url=False, new_tab="{}'s blog".format(unicode(node)))
422 else: 424 else:
423 dialog.InfoDialog("Error", 425 dialog.InfoDialog("Error",
424 "Unmanaged action result", Width="400px").center() 426 "Unmanaged action result", Width="400px").center()
425 427
426 def _actionEb(self, err_data): 428 def _actionEb(self, err_data):
462 mblog_entry = blog.MicroblogItem(mblog) 464 mblog_entry = blog.MicroblogItem(mblog)
463 self.mblog_cache.append((_groups, mblog_entry)) 465 self.mblog_cache.append((_groups, mblog_entry))
464 466
465 if len(self.mblog_cache) > MAX_MBLOG_CACHE: 467 if len(self.mblog_cache) > MAX_MBLOG_CACHE:
466 del self.mblog_cache[0:len(self.mblog_cache - MAX_MBLOG_CACHE)] 468 del self.mblog_cache[0:len(self.mblog_cache - MAX_MBLOG_CACHE)]
467 for widget in self.widgets.getWidgets(blog.MicroblogPanel): 469 for wid in self.widgets.getWidgets(blog.MicroblogPanel):
468 self.FillMicroblogPanel(widget) 470 self.FillMicroblogPanel(wid)
469 471
470 # FIXME 472 # FIXME
471 self.initialised = True # initialisation phase is finished here 473 self.initialised = True # initialisation phase is finished here
472 for event_data in self.init_cache: # so we have to send all the cached events 474 for event_data in self.init_cache: # so we have to send all the cached events
473 self._personalEventCb(*event_data) 475 self._personalEventCb(*event_data)
483 # self.bridge.call('getRoomsJoined', self._getRoomsJoinedCb) 485 # self.bridge.call('getRoomsJoined', self._getRoomsJoinedCb)
484 # #and if there is any subscription request waiting for us 486 # #and if there is any subscription request waiting for us
485 # self.bridge.call('getWaitingSub', self._getWaitingSubCb) 487 # self.bridge.call('getWaitingSub', self._getWaitingSubCb)
486 # #we fill the panels already here 488 # #we fill the panels already here
487 # for lib_wid in self.libervia_widgets: 489 # for lib_wid in self.libervia_widgets:
488 # if isinstance(lib_wid, panels.MicroblogPanel): 490 # if isinstance(lib_wid, panel.MicroblogPanel):
489 # if lib_wid.accept_all(): 491 # if lib_wid.accept_all():
490 # self.bridge.call('getMassiveLastMblogs', lib_wid.massiveInsert, 'ALL', [], 10) 492 # self.bridge.call('getMassiveLastMblogs', lib_wid.massiveInsert, 'ALL', [], 10)
491 # else: 493 # else:
492 # self.bridge.call('getMassiveLastMblogs', lib_wid.massiveInsert, 'GROUP', lib_wid.accepted_groups, 10) 494 # self.bridge.call('getMassiveLastMblogs', lib_wid.massiveInsert, 'GROUP', lib_wid.accepted_groups, 10)
493 495
514 _groups = set(data['groups'].split() if data['groups'] else []) 516 _groups = set(data['groups'].split() if data['groups'] else [])
515 else: 517 else:
516 _groups = None 518 _groups = None
517 mblog_entry = blog.MicroblogItem(data) 519 mblog_entry = blog.MicroblogItem(data)
518 520
519 for widget in self.widgets.getWidgets(blog.MicroblogPanel): 521 for wid in self.widgets.getWidgets(blog.MicroblogPanel):
520 widget.addEntryIfAccepted(sender, _groups, mblog_entry) 522 wid.addEntryIfAccepted(sender, _groups, mblog_entry)
521 523
522 if sender == self.whoami.bare: 524 if sender == self.whoami.bare:
523 found = False 525 found = False
524 for index in xrange(0, len(self.mblog_cache)): 526 for index in xrange(0, len(self.mblog_cache)):
525 entry = self.mblog_cache[index] 527 entry = self.mblog_cache[index]
532 if not found: 534 if not found:
533 self.mblog_cache.append((_groups, mblog_entry)) 535 self.mblog_cache.append((_groups, mblog_entry))
534 if len(self.mblog_cache) > MAX_MBLOG_CACHE: 536 if len(self.mblog_cache) > MAX_MBLOG_CACHE:
535 del self.mblog_cache[0:len(self.mblog_cache - MAX_MBLOG_CACHE)] 537 del self.mblog_cache[0:len(self.mblog_cache - MAX_MBLOG_CACHE)]
536 elif event_type == 'MICROBLOG_DELETE': 538 elif event_type == 'MICROBLOG_DELETE':
537 for widget in self.widgets.getWidgets(blog.MicroblogPanel): 539 for wid in self.widgets.getWidgets(blog.MicroblogPanel):
538 widget.removeEntry(data['type'], data['id']) 540 wid.removeEntry(data['type'], data['id'])
539 log.debug("%s %s %s" % (self.whoami.bare, sender, data['type'])) 541 log.debug("%s %s %s" % (self.whoami.bare, sender, data['type']))
540 542
541 if sender == self.whoami.bare and data['type'] == 'main_item': 543 if sender == self.whoami.bare and data['type'] == 'main_item':
542 for index in xrange(0, len(self.mblog_cache)): 544 for index in xrange(0, len(self.mblog_cache)):
543 entry = self.mblog_cache[index] 545 entry = self.mblog_cache[index]
620 try: 622 try:
621 wid = self.widgets.getOrCreateWidget(class_, target, *args, **kwargs) 623 wid = self.widgets.getOrCreateWidget(class_, target, *args, **kwargs)
622 except quick_widgets.WidgetAlreadyExistsError: 624 except quick_widgets.WidgetAlreadyExistsError:
623 kwargs['on_existing_widget'] = C.WIDGET_KEEP 625 kwargs['on_existing_widget'] = C.WIDGET_KEEP
624 wid = self.widgets.getOrCreateWidget(class_, target, *args, **kwargs) 626 wid = self.widgets.getOrCreateWidget(class_, target, *args, **kwargs)
625 widgets_panel = wid.getParent(base_widget.WidgetsPanel, expect=False) 627 widgets_panel = wid.getParent(libervia_widget.WidgetsPanel, expect=False)
626 if widgets_panel is None: 628 if widgets_panel is None:
627 # The widget exists but is hidden 629 # The widget exists but is hidden
628 self.addWidget(wid) 630 self.addWidget(wid)
629 elif widgets_panel != self.tab_panel.getCurrentPanel(): 631 elif widgets_panel != self.tab_panel.getCurrentPanel():
630 # the widget is on an other tab, so we add a new one here 632 # the widget is on an other tab, so we add a new one here
673 675
674 # def getRoomWidget(self, target): 676 # def getRoomWidget(self, target):
675 # """Get the MUC widget for the given target. 677 # """Get the MUC widget for the given target.
676 678
677 # @param target (jid.JID): BARE jid of the MUC 679 # @param target (jid.JID): BARE jid of the MUC
678 # @return: panels.ChatPanel instance or None 680 # @return: panel.ChatPanel instance or None
679 # """ 681 # """
680 # entity = {'item': target, 'type_': 'group'} 682 # entity = {'item': target, 'type_': 'group'}
681 # if target.full() in self.room_list or target in self.room_list: # as JID is a string-based class, we don't know what will please Pyjamas... 683 # if target.full() in self.room_list or target in self.room_list: # as JID is a string-based class, we don't know what will please Pyjamas...
682 # return self.getLiberviaWidget(panels.ChatPanel, entity, ignoreOtherTabs=False) 684 # return self.getLiberviaWidget(panel.ChatPanel, entity, ignoreOtherTabs=False)
683 # return None 685 # return None
684 686
685 # def getOrCreateRoomWidget(self, target): 687 # def getOrCreateRoomWidget(self, target):
686 # """Get the MUC widget for the given target, create it if necessary. 688 # """Get the MUC widget for the given target, create it if necessary.
687 689
688 # @param target (jid.JID): BARE jid of the MUC 690 # @param target (jid.JID): BARE jid of the MUC
689 # @return: panels.ChatPanel instance 691 # @return: panel.ChatPanel instance
690 # """ 692 # """
691 # lib_wid = self.getRoomWidget(target) 693 # lib_wid = self.getRoomWidget(target)
692 # if lib_wid: 694 # if lib_wid:
693 # return lib_wid 695 # return lib_wid
694 696
705 # else: 707 # else:
706 # tab_name = target.node 708 # tab_name = target.node
707 709
708 # self.room_list.append(target) 710 # self.room_list.append(target)
709 # entity = {'item': target, 'type_': 'group'} 711 # entity = {'item': target, 'type_': 'group'}
710 # return self.getOrCreateLiberviaWidget(panels.ChatPanel, entity, new_tab=tab_name) 712 # return self.getOrCreateLiberviaWidget(panel.ChatPanel, entity, new_tab=tab_name)
711 713
712 # def _newMessageCb(self, from_jid_s, msg, msg_type, to_jid_s, extra): 714 # def _newMessageCb(self, from_jid_s, msg, msg_type, to_jid_s, extra):
713 # from_jid = jid.JID(from_jid_s) 715 # from_jid = jid.JID(from_jid_s)
714 # to_jid = jid.JID(to_jid_s) 716 # to_jid = jid.JID(to_jid_s)
715 # for plugin in self.plugins.values(): 717 # for plugin in self.plugins.values():
718 # return # plugin returned False to interrupt the process 720 # return # plugin returned False to interrupt the process
719 # self.newMessageCb(from_jid, msg, msg_type, to_jid, extra) 721 # self.newMessageCb(from_jid, msg, msg_type, to_jid, extra)
720 722
721 # def newMessageCb(self, from_jid, msg, msg_type, to_jid, extra): 723 # def newMessageCb(self, from_jid, msg, msg_type, to_jid, extra):
722 # other = to_jid if from_jid.bare == self.whoami.bare else from_jid 724 # other = to_jid if from_jid.bare == self.whoami.bare else from_jid
723 # lib_wid = self.getLiberviaWidget(panels.ChatPanel, {'item': other}, ignoreOtherTabs=False) 725 # lib_wid = self.getLiberviaWidget(panel.ChatPanel, {'item': other}, ignoreOtherTabs=False)
724 # self.displayNotification(from_jid, msg) 726 # self.displayNotification(from_jid, msg)
725 # if msg_type == 'headline' and from_jid.full() == self._defaultDomain: 727 # if msg_type == 'headline' and from_jid.full() == self._defaultDomain:
726 # try: 728 # try:
727 # assert extra['subject'] # subject is defined and not empty 729 # assert extra['subject'] # subject is defined and not empty
728 # title = extra['subject'] 730 # title = extra['subject']
746 # self.contact_panel.setContactMessageWaiting(other.bare, True) 748 # self.contact_panel.setContactMessageWaiting(other.bare, True)
747 749
748 # def _presenceUpdateCb(self, entity, show, priority, statuses): 750 # def _presenceUpdateCb(self, entity, show, priority, statuses):
749 # entity_jid = jid.JID(entity) 751 # entity_jid = jid.JID(entity)
750 # if self.whoami and self.whoami == entity_jid: # XXX: QnD way to get our presence/status 752 # if self.whoami and self.whoami == entity_jid: # XXX: QnD way to get our presence/status
751 # assert(isinstance(self.status_panel, panels.PresenceStatusPanel)) 753 # assert(isinstance(self.status_panel, main_panel.PresenceStatusPanel))
752 # self.status_panel.setPresence(show) # pylint: disable=E1103 754 # self.status_panel.setPresence(show) # pylint: disable=E1103
753 # if statuses: 755 # if statuses:
754 # self.status_panel.setStatus(statuses.values()[0]) # pylint: disable=E1103 756 # self.status_panel.setStatus(statuses.values()[0]) # pylint: disable=E1103
755 # else: 757 # else:
756 # bare_jid = entity_jid.bareJID() 758 # bare_jid = entity_jid.bareJID()
879 # @param from_jid_s: JID of the contact who sent his state, or '@ALL@' 881 # @param from_jid_s: JID of the contact who sent his state, or '@ALL@'
880 # @param state: new state (string) 882 # @param state: new state (string)
881 # """ 883 # """
882 # if from_jid_s == '@ALL@': 884 # if from_jid_s == '@ALL@':
883 # for lib_wid in self.libervia_widgets: 885 # for lib_wid in self.libervia_widgets:
884 # if isinstance(lib_wid, panels.ChatPanel): 886 # if isinstance(lib_wid, panel.ChatPanel):
885 # lib_wid.setState(state, nick=C.ALL_OCCUPANTS) 887 # lib_wid.setState(state, nick=C.ALL_OCCUPANTS)
886 # return 888 # return
887 # from_jid = jid.JID(from_jid_s) 889 # from_jid = jid.JID(from_jid_s)
888 # lib_wid = self.getLiberviaWidget(panels.ChatPanel, {'item': from_jid}, ignoreOtherTabs=False) 890 # lib_wid = self.getLiberviaWidget(panel.ChatPanel, {'item': from_jid}, ignoreOtherTabs=False)
889 # lib_wid.setState(state, nick=from_jid.resource) 891 # lib_wid.setState(state, nick=from_jid.resource)
890 892
891 def _askConfirmation(self, confirmation_id, confirmation_type, data): 893 def _askConfirmation(self, confirmation_id, confirmation_type, data):
892 answer_data = {} 894 answer_data = {}
893 895
943 # if type_ in ("PUBLIC", "GROUP"): 945 # if type_ in ("PUBLIC", "GROUP"):
944 # self.bridge.call("sendMblog", None, type_, entities if type_ == "GROUP" else None, text, extra) 946 # self.bridge.call("sendMblog", None, type_, entities if type_ == "GROUP" else None, text, extra)
945 # elif type_ == "COMMENT": 947 # elif type_ == "COMMENT":
946 # self.bridge.call("sendMblogComment", None, entities, text, extra) 948 # self.bridge.call("sendMblogComment", None, entities, text, extra)
947 # elif type_ == "STATUS": 949 # elif type_ == "STATUS":
948 # assert(isinstance(self.status_panel, panels.PresenceStatusPanel)) 950 # assert(isinstance(self.status_panel, main_panel.PresenceStatusPanel))
949 # self.bridge.call('setStatus', None, self.status_panel.presence, text) # pylint: disable=E1103 951 # self.bridge.call('setStatus', None, self.status_panel.presence, text) # pylint: disable=E1103
950 # elif type_ in ("groupchat", "chat"): 952 # elif type_ in ("groupchat", "chat"):
951 # addresses.append((addr, entities)) 953 # addresses.append((addr, entities))
952 # else: 954 # else:
953 # log.error("Unknown target type") 955 # log.error("Unknown target type")
968 If type_ is None, a popup being currently displayed will be hidden. 970 If type_ is None, a popup being currently displayed will be hidden.
969 @type_: a type determining the CSS style to be applied (see WarningPopup.showWarning) 971 @type_: a type determining the CSS style to be applied (see WarningPopup.showWarning)
970 @msg: message to be displayed 972 @msg: message to be displayed
971 """ 973 """
972 if not hasattr(self, "warning_popup"): 974 if not hasattr(self, "warning_popup"):
973 self.warning_popup = panels.WarningPopup() 975 self.warning_popup = main_panel.WarningPopup()
974 self.warning_popup.showWarning(type_, msg) 976 self.warning_popup.showWarning(type_, msg)
975 977
976 def showDialog(self, message, title="", type_="info", answer_cb=None, answer_data=None): 978 def showDialog(self, message, title="", type_="info", answer_cb=None, answer_data=None):
977 if type_ == 'info': 979 if type_ == 'info':
978 popup = dialog.InfoDialog(unicode(title), unicode(message), callback=answer_cb) 980 popup = dialog.InfoDialog(unicode(title), unicode(message), callback=answer_cb)