Mercurial > libervia-desktop-kivy
comparison cagou/plugins/plugin_wid_chat.py @ 404:f7476818f9fb
core (common): JidSelector + behaviors various improvments:
- renamed *Behaviour => *Behavior to be consistent with Kivy + moved to new
"core.behaviors" modules
- use a dedicated property in ContactItem for notification counter (which is now named
"badge")
- in JidSelector, well-known strings now create use a dedicated layout, add separator
(except if new `add_separators` property is set to False), and are added to attribute of
the same name
- a new `item_class` property is now used to indicate the class to instanciate for items
(by default it's a ContactItem)
- FilterBahavior.do_filter now expect the parent layout instead of directly the children,
this is to allow a FilterBahavior to manage several children layout at once (used with
JidSelector)
- core.utils has been removed, as the behavior there has been moved to core.behaviors
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 12 Feb 2020 20:02:58 +0100 |
parents | ae6f7fd1cb0e |
children | 03554ad70846 |
comparison
equal
deleted
inserted
replaced
403:b0af45a92055 | 404:f7476818f9fb |
---|---|
36 from sat.tools.common import data_format | 36 from sat.tools.common import data_format |
37 from sat_frontends.quick_frontend import quick_widgets | 37 from sat_frontends.quick_frontend import quick_widgets |
38 from sat_frontends.quick_frontend import quick_chat | 38 from sat_frontends.quick_frontend import quick_chat |
39 from sat_frontends.tools import jid | 39 from sat_frontends.tools import jid |
40 from cagou import G | 40 from cagou import G |
41 from cagou.core.constants import Const as C | 41 from ..core.constants import Const as C |
42 from cagou.core import cagou_widget | 42 from ..core import cagou_widget |
43 from cagou.core import xmlui | 43 from ..core import xmlui |
44 from cagou.core.image import Image | 44 from ..core.image import Image |
45 from cagou.core.common import SymbolButton, JidButton | 45 from ..core.common import SymbolButton, JidButton |
46 from cagou.core.utils import FilterBehavior | 46 from ..core.behaviors import FilterBehavior |
47 from cagou.core import menu | 47 from ..core import menu |
48 from cagou.core.common import ContactButton | 48 from ..core.common import ContactButton |
49 | 49 |
50 log = logging.getLogger(__name__) | 50 log = logging.getLogger(__name__) |
51 | 51 |
52 PLUGIN_INFO = { | 52 PLUGIN_INFO = { |
53 "name": _("chat"), | 53 "name": _("chat"), |
947 return | 947 return |
948 G.host.doAction("chat", jid_, [self.profile]) | 948 G.host.doAction("chat", jid_, [self.profile]) |
949 | 949 |
950 def onHeaderInputComplete(self, wid, text, **kwargs): | 950 def onHeaderInputComplete(self, wid, text, **kwargs): |
951 """we filter items when text is entered in input box""" | 951 """we filter items when text is entered in input box""" |
952 self.do_filter( | 952 for layout in self.jid_selector.items_layouts: |
953 self.jid_selector.children[0].children, | 953 self.do_filter( |
954 text, | 954 layout, |
955 # we append nick to jid to filter on both | 955 text, |
956 lambda c: c.jid + c.data.get('nick', ''), | 956 # we append nick to jid to filter on both |
957 width_cb=lambda c: c.base_width, | 957 lambda c: c.jid + c.data.get('nick', ''), |
958 height_cb=lambda c: c.minimum_height, | 958 width_cb=lambda c: c.base_width, |
959 continue_tests=[lambda c: not isinstance(c, ContactButton)]) | 959 height_cb=lambda c: c.minimum_height, |
960 continue_tests=[lambda c: not isinstance(c, ContactButton)]) | |
960 | 961 |
961 | 962 |
962 PLUGIN_INFO["factory"] = Chat.factory | 963 PLUGIN_INFO["factory"] = Chat.factory |
963 quick_widgets.register(quick_chat.QuickChat, Chat) | 964 quick_widgets.register(quick_chat.QuickChat, Chat) |