Remove record from the Group in reversed order
This limit the number of cursor changes on large list as the changes are that the cursor is still on the top. issue6741 review39661002
This commit is contained in:
1 parent
64aad613a0
commit
de174eedef
1 file changed
+4
-2
@@ -124,10 +124,12 @@ class Group(SignalEvent, list):
|
||||
del self.__id2record[record.id]
|
||||
|
||||
def clear(self):
|
||||
for record in self[:]:
|
||||
# Use reversed order to minimize the cursor reposition as the cursor
|
||||
# has more chances to be on top of the list.
|
||||
for record in reversed(self[:]):
|
||||
self.signal('group-list-changed', ('record-removed', record))
|
||||
record.destroy()
|
||||
self.pop(0)
|
||||
self.pop()
|
||||
self.__id2record = {}
|
||||
self.record_removed, self.record_deleted = [], []
|
||||
|
||||
|
||||
Reference in new issue
Block a user