comparison frontends/wix/contact_list.py @ 138:2f8c86488b05

wix: scrolling is not reseted anymore when clicking on a group on contact list
author Goffi <goffi@goffi.org>
date Fri, 16 Jul 2010 22:22:52 +0800
parents 8d611eb9ae48
children 9ee4a1d0d7fb
comparison
equal deleted inserted replaced
137:227394eb080c 138:2f8c86488b05
145 145
146 def onSelected(self, event): 146 def onSelected(self, event):
147 """Called when a contact is selected.""" 147 """Called when a contact is selected."""
148 data = self.getSelection() 148 data = self.getSelection()
149 if data == None: #we have a group 149 if data == None: #we have a group
150 first_visible = self.GetVisibleBegin()
150 group = self.GetClientData(self.GetSelection()) 151 group = self.GetClientData(self.GetSelection())
151 erased = self.__eraseGroup(group) 152 erased = self.__eraseGroup(group)
152 if not erased: #the group was already erased, we can add again the contacts 153 if not erased: #the group was already erased, we can add again the contacts
153 contacts = self.CM.getContFromGroup(group) 154 contacts = self.CM.getContFromGroup(group)
154 contacts.sort() 155 contacts.sort()
155 id_insert = self.GetSelection()+1 156 id_insert = self.GetSelection()+1
156 for contact in contacts: 157 for contact in contacts:
157 self.Insert(self.__presentItem(contact), id_insert, contact) 158 self.Insert(self.__presentItem(contact), id_insert, contact)
158 self.SetSelection(wx.NOT_FOUND) 159 self.SetSelection(wx.NOT_FOUND)
160 self.ScrollToLine(first_visible)
159 event.Skip(False) 161 event.Skip(False)
160 else: 162 else:
161 event.Skip() 163 event.Skip()
162 164
163 def onActivated(self, event): 165 def onActivated(self, event):