diff --git a/src/backend/models/model.py b/src/backend/models/model.py index 3ba20d63..2cd36d1c 100644 --- a/src/backend/models/model.py +++ b/src/backend/models/model.py @@ -1,7 +1,6 @@ # SPDX-License-Identifier: LGPL-3.0-or-later import itertools -import time from bisect import bisect from contextlib import contextmanager from threading import RLock @@ -194,22 +193,13 @@ class Model(MutableMapping): yield None finally: indice = self._active_batch_remove_indice - groups = [list(group) for item, group in itertools.groupby(indice)] - last = None - - if groups: - last = groups[-1].pop() - if not groups[-1]: - del groups[-1] + groups = [ + list(group) for item, group in itertools.groupby(indice) + ] for grp in groups: - ModelItemDeleted(self.sync_id, index=grp[0], count=len(grp)) - - # Seems QML ListView has an horrible bug where removing a large - # amount of items at once will result in a corrupted empty display, - # this dumb workaround is the only way I've found - if last: - time.sleep(0.2) - ModelItemDeleted(self.sync_id, index=last, count=1) + ModelItemDeleted( + self.sync_id, index=grp[0], count=len(grp), + ) self._active_batch_remove_indice = None