comparison src/browser/sat_browser/contact_panel.py @ 753:76a9c074327b

browser_side (contact_panel): fixes contact box update
author souliane <souliane@mailoo.org>
date Tue, 24 Nov 2015 11:00:26 +0100
parents 102bab805ec1
children fc941d0d97f8
comparison
equal deleted inserted replaced
752:9b57d117e8c5 753:76a9c074327b
95 if current_jids == jids: 95 if current_jids == jids:
96 # the display doesn't change 96 # the display doesn't change
97 return 97 return
98 for contact_jid in set(current_jids).difference(jids): 98 for contact_jid in set(current_jids).difference(jids):
99 self.removeContactBox(contact_jid) 99 self.removeContactBox(contact_jid)
100 current_index = 0 100 count = 0
101 insert_count = 0
102 for contact_jid in jids: 101 for contact_jid in jids:
103 try:
104 if current_jids[current_index] == contact_jid:
105 current_index += 1
106 continue
107 except IndexError:
108 pass
109 assert isinstance(contact_jid, jid.JID) 102 assert isinstance(contact_jid, jid.JID)
110 self.updateContactBox(contact_jid, current_index + insert_count) 103 self.updateContactBox(contact_jid, count)
111 insert_count += 1 104 count += 1
112 105
113 def getContactBox(self, contact_jid): 106 def getContactBox(self, contact_jid):
114 """Get the contact box for the given contact. 107 """Get the contact box for the given contact.
115 108
116 @param contact_jid (jid.JID): contact JID 109 @param contact_jid (jid.JID): contact JID