diff --git a/src/tribler-gui/tribler_gui/widgets/tablecontentmodel.py b/src/tribler-gui/tribler_gui/widgets/tablecontentmodel.py index f3753d67eb7..fbd80c093b0 100644 --- a/src/tribler-gui/tribler_gui/widgets/tablecontentmodel.py +++ b/src/tribler-gui/tribler_gui/widgets/tablecontentmodel.py @@ -7,6 +7,8 @@ from PyQt5.QtCore import QAbstractTableModel, QModelIndex, QRectF, QSize, Qt, pyqtSignal +from faker import Faker + from tribler_common.simpledefs import CHANNELS_VIEW_UUID, CHANNEL_STATE from tribler_common.utilities import to_fts_query @@ -20,6 +22,19 @@ EXPANDING = 0 +user_names_cache = {} + + +def get_user_name_cached(pk): + name = user_names_cache.get(pk) + if name is not None: + return name + Faker.seed(pk) + name = Faker().name() + user_names_cache[pk] = name + return name + + class Column(Enum): ACTIONS = auto() CATEGORY = auto() @@ -62,7 +77,7 @@ def define_columns(): Column.STATE: d('state', "", width=80, tooltip_filter=lambda data: data, sortable=False), Column.TORRENTS: d('torrents', tr("Torrents"), width=90), Column.SUBSCRIBED: d('subscribed', tr("Subscribed"), width=95), - Column.AUTHOR: d('public_key', "", width=40), + Column.AUTHOR: d('public_key', "", width=40, tooltip_filter=lambda data:get_user_name_cached(data)), } # pylint: enable=line-too-long # fmt:on