diff sat_frontends/primitivus/contact_list.py @ 2617:81b70eeb710f

quick_frontend(contact list): refactored update: update is now called with appropriate constant value (C.UPDATE_ADD, C.UPDATE_DELETE, C.UPDATE_MODIFY and so on) when a widget change visibility according to current options. Before it was linked to cache only (C.UPDATE_ADD was only called when contact was first added to cache). This make widget handling in frontends more easy. Renamed entityToShow to entityVisible, which seems to correspond better. Started reducing lines lenght to 90 chars as a test. May become the new coding style soon.
author Goffi <goffi@goffi.org>
date Sun, 24 Jun 2018 21:59:29 +0200
parents 26edcf3a30eb
children 56f94936df1e
line wrap: on
line diff
--- a/sat_frontends/primitivus/contact_list.py	Thu Jun 21 01:21:44 2018 +0200
+++ b/sat_frontends/primitivus/contact_list.py	Sun Jun 24 21:59:29 2018 +0200
@@ -231,7 +231,7 @@
         widgets = []  # list of built widgets
 
         for entity in entities:
-            if entity in self.contact_list._specials or not self.contact_list.entityToShow(entity):
+            if entity in self.contact_list._specials or not self.contact_list.entityVisible(entity):
                 continue
             markup_extra = []
             if self.contact_list.show_resources:
@@ -287,7 +287,7 @@
             data = self.contact_list.getGroupData(group)
             folded = data.get(C.GROUP_DATA_FOLDED, False)
             jids = list(data['jids'])
-            if group is not None and (self.contact_list.anyEntityToShow(jids) or self.contact_list.show_empty_groups):
+            if group is not None and (self.contact_list.anyEntityVisible(jids) or self.contact_list.show_empty_groups):
                 header = '[-]' if not folded else '[+]'
                 widget = sat_widgets.ClickableText(group, header=header + ' ')
                 content.append(widget)