Mercurial > libervia-desktop-kivy
diff src/cagou/plugins/plugin_wid_contact_list.py @ 110:34dfe0e32064
contact list: text entered in header input do filtering in shown contacts
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 15 Jan 2017 21:21:32 +0100 |
parents | 9a6121722669 |
children |
line wrap: on
line diff
--- a/src/cagou/plugins/plugin_wid_contact_list.py Sun Jan 15 21:21:29 2017 +0100 +++ b/src/cagou/plugins/plugin_wid_contact_list.py Sun Jan 15 21:21:32 2017 +0100 @@ -26,6 +26,7 @@ from kivy.uix.boxlayout import BoxLayout from kivy.uix.listview import ListView from kivy.adapters.listadapter import ListAdapter +from kivy.metrics import dp from kivy import properties from cagou.core import cagou_widget from cagou.core import image @@ -86,6 +87,18 @@ self.postInit() self.update() + def onHeaderInputComplete(self, wid, text): + # FIXME: this is implementation dependent, need to be done properly + items = self.children[0].children[0].children[0].children + + for item in items: + if text not in item.ids.jid_label.text: + item.height = 0 + item.opacity = 0 + else: + item.height = dp(50) + item.opacity = 1 + def contactDataConverter(self, idx, bare_jid): return {"jid": bare_jid, "data": self._items_cache[bare_jid]}