comparison sat_frontends/primitivus/contact_list.py @ 2993:d58dccd9e4b4

primitivus (contact list): fixed notifications counter for mentions: notifications counter was not properly counting mentions and was not changing colour as expected, this patch fixes this and changed colour to the more readable light red when not focused. fixes 319
author Goffi <goffi@goffi.org>
date Mon, 08 Jul 2019 19:11:29 +0200
parents 003b8b4b56a7
children ab2696e34d29
comparison
equal deleted inserted replaced
2992:4d5b9d4c7448 2993:d58dccd9e4b4
222 entity_attr = "default" 222 entity_attr = "default"
223 223
224 notifs = list( 224 notifs = list(
225 self.host.getNotifs(entity, exact_jid=special, profile=self.profile) 225 self.host.getNotifs(entity, exact_jid=special, profile=self.profile)
226 ) 226 )
227 if notifs: 227 mentions = list(
228 header = [("cl_notifs", u"({})".format(len(notifs))), u" "]
229 if list(
230 self.host.getNotifs(entity.bare, C.NOTIFY_MENTION, profile=self.profile) 228 self.host.getNotifs(entity.bare, C.NOTIFY_MENTION, profile=self.profile)
231 ): 229 )
232 header = ("cl_mention", header) 230 if notifs or mentions:
231 attr = 'cl_mention' if mentions else 'cl_notifs'
232 header = [(attr, u"({})".format(len(notifs) + len(mentions))), u" "]
233 else: 233 else:
234 header = u"" 234 header = u""
235 235
236 markup.append((entity_attr, entity_txt)) 236 markup.append((entity_attr, entity_txt))
237 if markup_prepend: 237 if markup_prepend: