Mercurial > libervia-desktop-kivy
diff src/cagou/plugins/plugin_wid_contact_list.py @ 22:74117b733bac
plugin chat: first draft:
- only one 2 one display is handled for now
- own messages are displayed in blue, other ones in gray
- by default we display our own jid (for now)
- to change target, contact in contact widget can be clicked, or a jid can be entered in header input
- disco is called on jid entered in header, if it's a conference a MUCJoin will be called (not implemented yet), else a new chat widget with the jid replace the current one
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 08 Aug 2016 01:07:43 +0200 |
parents | 5c9feaa060a5 |
children | d09bd16dbbe2 |
line wrap: on
line diff
--- a/src/cagou/plugins/plugin_wid_contact_list.py Mon Aug 08 01:02:32 2016 +0200 +++ b/src/cagou/plugins/plugin_wid_contact_list.py Mon Aug 08 01:07:43 2016 +0200 @@ -22,6 +22,7 @@ log = logging.getLogger(__name__) from sat.core.i18n import _ from sat_frontends.quick_frontend.quick_contact_list import QuickContactList +from sat_frontends.tools import jid from kivy.uix.boxlayout import BoxLayout from kivy.uix.listview import ListView from kivy.adapters.listadapter import ListAdapter @@ -49,6 +50,21 @@ def __init__(self, **kwargs): BoxLayout.__init__(self, **kwargs) + def on_touch_down(self, touch): + if self.collide_point(*touch.pos): + # XXX: for now clicking on an item launch the corresponding Chat widget + # behaviour should change in the future + try: + # FIXME: Q&D way to get chat plugin, should be replaced by a clean method + # in host + plg_infos = [p for p in G.host.getPluggedWidgets() if 'chat' in p['import_name']][0] + except IndexError: + log.warning(u"No plugin widget found to display chat") + else: + factory = plg_infos['factory'] + G.host.switchWidget(self, factory(plg_infos, jid.JID(self.jid), profiles=iter(G.host.profiles))) + + class ContactList(QuickContactList, cagou_widget.CagouWidget):