From 6da7f5ca9b7daf5dcc7abe8baf278d59ae82c1be Mon Sep 17 00:00:00 2001 From: drew2a Date: Thu, 18 Apr 2024 15:45:50 +0200 Subject: [PATCH] Remove the torrent grouping based on names --- .../gui/widgets/tablecontentdelegate.py | 5 ----- src/tribler/gui/widgets/tablecontentmodel.py | 21 +++++-------------- 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/src/tribler/gui/widgets/tablecontentdelegate.py b/src/tribler/gui/widgets/tablecontentdelegate.py index 54455638fdd..891cd7854c1 100644 --- a/src/tribler/gui/widgets/tablecontentdelegate.py +++ b/src/tribler/gui/widgets/tablecontentdelegate.py @@ -379,11 +379,6 @@ def draw_title_and_tags(self, painter: QPainter, option: QStyleOptionViewItem, i debug = False # change to True to see the search rank of items and to highlight remote items item_name = data_item["name"] - group = data_item.get("group") - if group: - has_remote_items = any(group_item.get('remote') for group_item in group.values()) - item_name += f" (+ {len(group)} similar{' *' if debug and has_remote_items else ''})" - if debug: rank = data_item.get("rank") if rank is not None: diff --git a/src/tribler/gui/widgets/tablecontentmodel.py b/src/tribler/gui/widgets/tablecontentmodel.py index bc2cee5ce3b..ee618f95d0d 100644 --- a/src/tribler/gui/widgets/tablecontentmodel.py +++ b/src/tribler/gui/widgets/tablecontentmodel.py @@ -116,7 +116,6 @@ def __init__(self, parent=None): self.saved_scroll_state = None self.qt_object_destroyed = False - self.group_by_name = False self.sort_by_rank = False self.text_filter = '' @@ -204,7 +203,6 @@ def extract_unique_new_items(self, items: List, on_top: bool, remote: bool) -> T # Only add unique items to the table model and reverse mapping from unique ids to rows is built. insert_index = 0 if on_top else len(self.data_items) unique_new_items = [] - name_mapping = {item['name']: item for item in self.data_items} if self.group_by_name else {} now = time.time() for item in items: if remote: @@ -218,21 +216,12 @@ def extract_unique_new_items(self, items: List, on_top: bool, remote: bool) -> T item_uid = get_item_uid(item) if item_uid not in self.item_uid_map: - prev_item = name_mapping.get(item['name']) - if self.group_by_name and prev_item is not None and not on_top and prev_item['type'] == REGULAR_TORRENT: - group = prev_item.setdefault('group', {}) - if item_uid not in group: - group[item_uid] = item - else: - self.item_uid_map[item_uid] = insert_index - if 'infohash' in item: - self.item_uid_map[item['infohash']] = insert_index - unique_new_items.append(item) - - if self.group_by_name and item['type'] == REGULAR_TORRENT and prev_item is None: - name_mapping[item['name']] = item + self.item_uid_map[item_uid] = insert_index + if 'infohash' in item: + self.item_uid_map[item['infohash']] = insert_index + unique_new_items.append(item) - insert_index += 1 + insert_index += 1 return unique_new_items, insert_index def add_items(self, new_items, on_top=False, remote=False):