Mercurial > libervia-backend
comparison frontends/src/primitivus/contact_list.py @ 1658:683b76c1145d
quick_frontend, primitivus: display the number of alerts for each contact and not only a symbol (*)
author | souliane <souliane@mailoo.org> |
---|---|
date | Tue, 24 Nov 2015 13:31:28 +0100 |
parents | 8a7145138330 |
children | d17772b0fe22 |
comparison
equal
deleted
inserted
replaced
1657:62cd8fc1aef7 | 1658:683b76c1145d |
---|---|
134 If True, all jids in self._alerts with the same bare jid has contact_wid.data will be removed | 134 If True, all jids in self._alerts with the same bare jid has contact_wid.data will be removed |
135 @param contact_wid: widget of the contact, must have the entity set in data attribute | 135 @param contact_wid: widget of the contact, must have the entity set in data attribute |
136 @param selected: boolean returned by the widget, telling if it is selected | 136 @param selected: boolean returned by the widget, telling if it is selected |
137 """ | 137 """ |
138 entity = contact_wid.data | 138 entity = contact_wid.data |
139 self.removeAlert(entity, use_bare_jid) | 139 self.removeAlerts(entity, use_bare_jid) |
140 self.host.modeHint(C.MODE_INSERTION) | 140 self.host.modeHint(C.MODE_INSERTION) |
141 self._emit('click', entity) | 141 self._emit('click', entity) |
142 | 142 |
143 def onNickUpdate(self, entity, new_nick, profile): | 143 def onNickUpdate(self, entity, new_nick, profile): |
144 self.update() | 144 self.update() |
161 @param markup_append (list): markup to append to the generated one before building the widget | 161 @param markup_append (list): markup to append to the generated one before building the widget |
162 @return (list): markup data are expected by Urwid text widgets | 162 @return (list): markup data are expected by Urwid text widgets |
163 """ | 163 """ |
164 markup = [] | 164 markup = [] |
165 if use_bare_jid: | 165 if use_bare_jid: |
166 alerts = {entity.bare for entity in self._alerts} | |
167 selected = {entity.bare for entity in self._selected} | 166 selected = {entity.bare for entity in self._selected} |
168 else: | 167 else: |
169 alerts = self._alerts | |
170 selected = self._selected | 168 selected = self._selected |
171 if keys is None: | 169 if keys is None: |
172 entity_txt = entity | 170 entity_txt = entity |
173 else: | 171 else: |
174 cache = self.getCache(entity) | 172 cache = self.getCache(entity) |
189 show_icon, entity_attr = C.PRESENCE.get(show, ('', 'default')) | 187 show_icon, entity_attr = C.PRESENCE.get(show, ('', 'default')) |
190 markup.insert(0, u"{} ".format(show_icon)) | 188 markup.insert(0, u"{} ".format(show_icon)) |
191 else: | 189 else: |
192 entity_attr = 'default' | 190 entity_attr = 'default' |
193 | 191 |
194 if with_alert and entity in alerts: | 192 alerts_count = self.getAlerts(entity, use_bare_jid=use_bare_jid) |
193 if with_alert and alerts_count: | |
195 entity_attr = 'alert' | 194 entity_attr = 'alert' |
196 header = C.ALERT_HEADER | 195 header = C.ALERT_HEADER % alerts_count |
197 else: | 196 else: |
198 header = '' | 197 header = '' |
199 | 198 |
200 markup.append((entity_attr, entity_txt)) | 199 markup.append((entity_attr, entity_txt)) |
201 if markup_prepend: | 200 if markup_prepend: |