Mercurial > libervia-web
diff src/browser/sat_browser/chat.py @ 598:ed6d8f7c6026 frontends_multi_profiles
browser side (blog, chat): fixed dropKey callbacks to adapt them to new widget creation system. Drag'n'Drop should be fixed.
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 06 Feb 2015 19:25:17 +0100 |
parents | a5019e62c3e9 |
children | 1c0d5a87c554 |
line wrap: on
line diff
--- a/src/browser/sat_browser/chat.py Fri Feb 06 19:23:08 2015 +0100 +++ b/src/browser/sat_browser/chat.py Fri Feb 06 19:25:17 2015 +0100 @@ -77,7 +77,8 @@ @param host: SatWebFrontend instance @param target: entity (jid.JID) with who we have a conversation (contact's jid for one 2 one chat, or MUC room) - @param type: one2one for simple conversation, group for MUC""" + @param type: one2one for simple conversation, group for MUC + """ QuickChat.__init__(self, host, target, type_, profiles=profiles) self.vpanel = VerticalPanel() self.vpanel.setSize('100%', '100%') @@ -127,20 +128,16 @@ assert len(self.profiles) == 1 and not self.PROFILES_MULTIPLE and not self.PROFILES_ALLOW_NONE return list(self.profiles)[0] - @classmethod - def registerClass(cls): - base_widget.LiberviaWidget.addDropKey("CONTACT", cls.createPanel) - - @classmethod - def createPanel(cls, host, item, type_=C.CHAT_ONE2ONE): - assert(item) - _contact = item if isinstance(item, jid.JID) else jid.JID(item) - host.contact_panel.setContactMessageWaiting(_contact.bare, False) - _new_panel = Chat(host, _contact, type_) # XXX: pyjamas doesn't seems to support creating with cls directly - _new_panel.historyPrint() - host.setSelected(_new_panel) - _new_panel.refresh() - return _new_panel + # @classmethod + # def createPanel(cls, host, item, type_=C.CHAT_ONE2ONE): + # assert(item) + # _contact = item if isinstance(item, jid.JID) else jid.JID(item) + # host.contact_panel.setContactMessageWaiting(_contact.bare, False) + # _new_panel = Chat(host, _contact, type_) # XXX: pyjamas doesn't seems to support creating with cls directly + # _new_panel.historyPrint() + # host.setSelected(_new_panel) + # _new_panel.refresh() + # return _new_panel def refresh(self): """Refresh the display of this widget. If the unibox is disabled, @@ -361,4 +358,6 @@ #TODO pass + quick_widgets.register(QuickChat, Chat) +base_widget.LiberviaWidget.addDropKey("CONTACT", lambda host, item: host.widgets.getOrCreateWidget(Chat, jid.JID(item), profile=C.PROF_KEY_NONE, on_new_widget=None, on_existing_widget=C.WIDGET_RECREATE))