Mercurial > libervia-backend
comparison libervia/tui/contact_list.py @ 4270:0d7bb4df2343
Reformatted code base using black.
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 19 Jun 2024 18:44:57 +0200 |
parents | b47f21f2b8fa |
children |
comparison
equal
deleted
inserted
replaced
4269:64a85ce8be70 | 4270:0d7bb4df2343 |
---|---|
223 | 223 |
224 notifs = list( | 224 notifs = list( |
225 self.host.get_notifs(entity, exact_jid=special, profile=self.profile) | 225 self.host.get_notifs(entity, exact_jid=special, profile=self.profile) |
226 ) | 226 ) |
227 mentions = list( | 227 mentions = list( |
228 self.host.get_notifs(entity.bare, C.NOTIFY_MENTION, profile=self.profile) | 228 self.host.get_notifs(entity.bare, C.NOTIFY_MENTION, profile=self.profile) |
229 ) | 229 ) |
230 if notifs or mentions: | 230 if notifs or mentions: |
231 attr = 'cl_mention' if mentions else 'cl_notifs' | 231 attr = "cl_mention" if mentions else "cl_notifs" |
232 header = [(attr, "({})".format(len(notifs) + len(mentions))), " "] | 232 header = [(attr, "({})".format(len(notifs) + len(mentions))), " "] |
233 else: | 233 else: |
234 header = "" | 234 header = "" |
235 | 235 |
236 markup.append((entity_attr, entity_txt)) | 236 markup.append((entity_attr, entity_txt)) |
267 continue | 267 continue |
268 markup_extra = [] | 268 markup_extra = [] |
269 if self.contact_list.show_resources: | 269 if self.contact_list.show_resources: |
270 for resource in self.contact_list.getCache(entity, C.CONTACT_RESOURCES): | 270 for resource in self.contact_list.getCache(entity, C.CONTACT_RESOURCES): |
271 resource_disp = ( | 271 resource_disp = ( |
272 "resource_main" | 272 ( |
273 if resource | 273 "resource_main" |
274 == self.contact_list.getCache(entity, C.CONTACT_MAIN_RESOURCE) | 274 if resource |
275 else "resource", | 275 == self.contact_list.getCache(entity, C.CONTACT_MAIN_RESOURCE) |
276 else "resource" | |
277 ), | |
276 "\n " + resource, | 278 "\n " + resource, |
277 ) | 279 ) |
278 markup_extra.append(resource_disp) | 280 markup_extra.append(resource_disp) |
279 if self.contact_list.show_status: | 281 if self.contact_list.show_status: |
280 status = self.contact_list.getCache( | 282 status = self.contact_list.getCache( |
312 entity, ("resource",), markup_prepend=" ", special=True | 314 entity, ("resource",), markup_prepend=" ", special=True |
313 ) | 315 ) |
314 else: | 316 else: |
315 # the special widgets | 317 # the special widgets |
316 if entity.resource: | 318 if entity.resource: |
317 widget = self._build_entity_widget(entity, ("resource",), special=True) | 319 widget = self._build_entity_widget( |
320 entity, ("resource",), special=True | |
321 ) | |
318 else: | 322 else: |
319 widget = self._build_entity_widget( | 323 widget = self._build_entity_widget( |
320 entity, | 324 entity, |
321 ("cache_nick", "cache_name", "node"), | 325 ("cache_nick", "cache_name", "node"), |
322 with_show_attr=False, | 326 with_show_attr=False, |
331 self._build_specials(content) | 335 self._build_specials(content) |
332 if self.contact_list._specials: | 336 if self.contact_list._specials: |
333 content.append(urwid.Divider("=")) | 337 content.append(urwid.Divider("=")) |
334 | 338 |
335 groups = list(self.contact_list._groups) | 339 groups = list(self.contact_list._groups) |
336 groups.sort(key=lambda x: x.lower() if x else '') | 340 groups.sort(key=lambda x: x.lower() if x else "") |
337 for group in groups: | 341 for group in groups: |
338 data = self.contact_list.get_group_data(group) | 342 data = self.contact_list.get_group_data(group) |
339 folded = data.get(C.GROUP_DATA_FOLDED, False) | 343 folded = data.get(C.GROUP_DATA_FOLDED, False) |
340 jids = list(data["jids"]) | 344 jids = list(data["jids"]) |
341 if group is not None and ( | 345 if group is not None and ( |