Mercurial > libervia-desktop-kivy
changeset 50:c45d6e9ec731
contact list: fixed contact list display
fixed height, and left align everything.
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 10 Sep 2016 18:01:32 +0200 |
parents | fd9cbf6ae663 |
children | 3f8599d9a766 |
files | src/cagou/plugins/plugin_wid_contact_list.kv src/cagou/plugins/plugin_wid_contact_list.py |
diffstat | 2 files changed, 19 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/cagou/plugins/plugin_wid_contact_list.kv Sat Sep 10 16:01:33 2016 +0200 +++ b/src/cagou/plugins/plugin_wid_contact_list.kv Sat Sep 10 18:01:32 2016 +0200 @@ -14,14 +14,20 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +<ContactListView>: + row_height: dp(50) + <ContactItem>: - spacing: 20 - Widget: + padding: dp(10), dp(3) + size_hint: 1, None + height: dp(50) Avatar: source: root.data.get('avatar', app.default_avatar) - size_hint: (None, None) + size_hint: None, 1 + width: dp(60) Label: + padding: dp(5), 0 text: root.jid + text_size: self.size bold: True - size_hint: (None, None) - Widget: + valign: "middle"
--- a/src/cagou/plugins/plugin_wid_contact_list.py Sat Sep 10 16:01:33 2016 +0200 +++ b/src/cagou/plugins/plugin_wid_contact_list.py Sat Sep 10 18:01:32 2016 +0200 @@ -50,7 +50,7 @@ jid = properties.StringProperty('') def __init__(self, **kwargs): - BoxLayout.__init__(self, **kwargs) + super(ContactItem, self).__init__(**kwargs) def on_touch_down(self, touch): if self.collide_point(*touch.pos): @@ -67,6 +67,9 @@ G.host.switchWidget(self, factory(plg_infos, jid.JID(self.jid), profiles=iter(G.host.profiles))) +class ContactListView(ListView): + pass + class ContactList(QuickContactList, cagou_widget.CagouWidget): @@ -79,7 +82,7 @@ selection_mode='multiple', allow_empty_selection=True, ) - self.add_widget(ListView(adapter=self.adapter)) + self.add_widget(ContactListView(adapter=self.adapter)) self.postInit() self.update() @@ -87,9 +90,9 @@ return {"jid": bare_jid, "data": self._items_cache[bare_jid]} def update(self, entities=None, type_=None, profile=None): - log.info("update: %s %s %s" % (entities, type_, profile)) + log.debug("update: %s %s %s" % (entities, type_, profile)) # FIXME: for now we update on each event # if entities is None and type_ is None: - self._items_cache = self.items - self.adapter.data = self.items_sorted + self._items_cache = self.items_sorted + self.adapter.data = self.items_sorted.keys()