diff --git a/src/tribler-common/tribler_common/sentry_reporter/sentry_mixin.py b/src/tribler-common/tribler_common/sentry_reporter/sentry_mixin.py deleted file mode 100644 index 01c15ef7519..00000000000 --- a/src/tribler-common/tribler_common/sentry_reporter/sentry_mixin.py +++ /dev/null @@ -1,20 +0,0 @@ -from typing import Optional - -from tribler_common.sentry_reporter.sentry_reporter import SentryReporter - - -class AddBreadcrumbOnShowMixin: - """This class has been designed for extending QWidget and QDialog instances - and send breadcrumbs on a show event. - """ - - def __init__(self): - self.sentry_reporter: Optional[SentryReporter] = None - - def set_sentry_reporter(self, sentry_reporter: SentryReporter): - self.sentry_reporter = sentry_reporter - - def showEvent(self, *args): - super().showEvent(*args) - - self.sentry_reporter.add_breadcrumb(message=f'{self.__class__.__name__}.Show', category='UI', level='info') diff --git a/src/tribler-gui/tribler_gui/dialogs/dialogcontainer.py b/src/tribler-gui/tribler_gui/dialogs/dialogcontainer.py index fd5abe07df3..6b947d7d1d6 100644 --- a/src/tribler-gui/tribler_gui/dialogs/dialogcontainer.py +++ b/src/tribler-gui/tribler_gui/dialogs/dialogcontainer.py @@ -2,16 +2,13 @@ from PyQt5.QtGui import QPainter from PyQt5.QtWidgets import QStyle, QStyleOption, QWidget -from tribler_common.sentry_reporter.sentry_mixin import AddBreadcrumbOnShowMixin - -from tribler_gui import gui_sentry_reporter +from tribler_gui.sentry_mixin import AddBreadcrumbOnShowMixin from tribler_gui.utilities import connect class DialogContainer(AddBreadcrumbOnShowMixin, QWidget): def __init__(self, parent, left_right_margin=100): QWidget.__init__(self, parent) - self.set_sentry_reporter(gui_sentry_reporter) self.setStyleSheet("background-color: rgba(30, 30, 30, 0.75);") diff --git a/src/tribler-gui/tribler_gui/dialogs/feedbackdialog.py b/src/tribler-gui/tribler_gui/dialogs/feedbackdialog.py index abb7e8f9837..fc98001ef9d 100644 --- a/src/tribler-gui/tribler_gui/dialogs/feedbackdialog.py +++ b/src/tribler-gui/tribler_gui/dialogs/feedbackdialog.py @@ -9,12 +9,12 @@ from PyQt5.QtWidgets import QAction, QApplication, QDialog, QMessageBox, QTreeWidgetItem from tribler_common.reported_error import ReportedError -from tribler_common.sentry_reporter.sentry_mixin import AddBreadcrumbOnShowMixin from tribler_common.sentry_reporter.sentry_reporter import SentryReporter from tribler_common.sentry_reporter.sentry_scrubber import SentryScrubber from tribler_common.sentry_reporter.sentry_tools import CONTEXT_DELIMITER, LONG_TEXT_DELIMITER from tribler_gui.event_request_manager import received_events +from tribler_gui.sentry_mixin import AddBreadcrumbOnShowMixin from tribler_gui.tribler_action_menu import TriblerActionMenu from tribler_gui.tribler_request_manager import performed_requests as tribler_performed_requests from tribler_gui.utilities import connect, get_ui_file_path, tr @@ -33,7 +33,6 @@ def __init__( # pylint: disable=too-many-arguments, too-many-locals retrieve_error_message_from_stacktrace=False, ): QDialog.__init__(self, parent) - self.set_sentry_reporter(sentry_reporter) uic.loadUi(get_ui_file_path('feedback_dialog.ui'), self) diff --git a/src/tribler-gui/tribler_gui/sentry_mixin.py b/src/tribler-gui/tribler_gui/sentry_mixin.py new file mode 100644 index 00000000000..4486e069800 --- /dev/null +++ b/src/tribler-gui/tribler_gui/sentry_mixin.py @@ -0,0 +1,12 @@ +from tribler_gui import gui_sentry_reporter + + +class AddBreadcrumbOnShowMixin: + """This class has been designed for extending QWidget and QDialog instances + and send breadcrumbs on a show event. + """ + + def showEvent(self, *args): + super().showEvent(*args) + + gui_sentry_reporter.add_breadcrumb(message=f'{self.__class__.__name__}.Show', category='UI', level='info') diff --git a/src/tribler-gui/tribler_gui/widgets/channelcontentswidget.py b/src/tribler-gui/tribler_gui/widgets/channelcontentswidget.py index 7aecc0cdfd4..cec979e7d10 100644 --- a/src/tribler-gui/tribler_gui/widgets/channelcontentswidget.py +++ b/src/tribler-gui/tribler_gui/widgets/channelcontentswidget.py @@ -7,13 +7,11 @@ from psutil import LINUX -from tribler_common.sentry_reporter.sentry_mixin import AddBreadcrumbOnShowMixin from tribler_common.simpledefs import CHANNEL_STATE from tribler_core.components.metadata_store.db.orm_bindings.channel_node import DIRTY_STATUSES, NEW from tribler_core.components.metadata_store.db.serialization import CHANNEL_TORRENT, COLLECTION_NODE -from tribler_gui import gui_sentry_reporter from tribler_gui.defs import ( BUTTON_TYPE_CONFIRM, BUTTON_TYPE_NORMAL, @@ -22,6 +20,7 @@ ) from tribler_gui.dialogs.confirmationdialog import ConfirmationDialog from tribler_gui.dialogs.new_channel_dialog import NewChannelDialog +from tribler_gui.sentry_mixin import AddBreadcrumbOnShowMixin from tribler_gui.tribler_action_menu import TriblerActionMenu from tribler_gui.tribler_request_manager import TriblerNetworkRequest from tribler_gui.utilities import connect, disconnect, get_image_path, get_ui_file_path, tr @@ -43,7 +42,6 @@ class ChannelContentsWidget(AddBreadcrumbOnShowMixin, widget_form, widget_class): def __init__(self, parent=None): widget_class.__init__(self, parent=parent) - self.set_sentry_reporter(gui_sentry_reporter) # ACHTUNG! This is a dumb workaround for a bug(?) in PyQT bindings in Python 3.7 # When more than a single instance of a class is created, every next setupUi diff --git a/src/tribler-gui/tribler_gui/widgets/channeldescriptionwidget.py b/src/tribler-gui/tribler_gui/widgets/channeldescriptionwidget.py index 779db80e251..4462ff4881d 100644 --- a/src/tribler-gui/tribler_gui/widgets/channeldescriptionwidget.py +++ b/src/tribler-gui/tribler_gui/widgets/channeldescriptionwidget.py @@ -6,10 +6,8 @@ from PyQt5.QtNetwork import QNetworkRequest from PyQt5.QtWidgets import QFileDialog, QPushButton -from tribler_common.sentry_reporter.sentry_mixin import AddBreadcrumbOnShowMixin - -from tribler_gui import gui_sentry_reporter from tribler_gui.dialogs.confirmationdialog import ConfirmationDialog +from tribler_gui.sentry_mixin import AddBreadcrumbOnShowMixin from tribler_gui.tribler_request_manager import TriblerNetworkRequest from tribler_gui.utilities import connect, get_image_path, get_ui_file_path, tr @@ -64,8 +62,6 @@ class ChannelDescriptionWidget(AddBreadcrumbOnShowMixin, widget_form, widget_cla def __init__(self, parent=None): widget_class.__init__(self, parent=parent) - self.set_sentry_reporter(gui_sentry_reporter) - try: self.setupUi(self) except SystemError: diff --git a/src/tribler-gui/tribler_gui/widgets/createtorrentpage.py b/src/tribler-gui/tribler_gui/widgets/createtorrentpage.py index 7a7e2874bb8..69a30fe809e 100644 --- a/src/tribler-gui/tribler_gui/widgets/createtorrentpage.py +++ b/src/tribler-gui/tribler_gui/widgets/createtorrentpage.py @@ -4,11 +4,9 @@ from PyQt5.QtGui import QIcon from PyQt5.QtWidgets import QAction, QFileDialog, QWidget -from tribler_common.sentry_reporter.sentry_mixin import AddBreadcrumbOnShowMixin - -from tribler_gui import gui_sentry_reporter from tribler_gui.defs import BUTTON_TYPE_NORMAL, PAGE_EDIT_CHANNEL_TORRENTS from tribler_gui.dialogs.confirmationdialog import ConfirmationDialog +from tribler_gui.sentry_mixin import AddBreadcrumbOnShowMixin from tribler_gui.tribler_action_menu import TriblerActionMenu from tribler_gui.tribler_request_manager import TriblerNetworkRequest from tribler_gui.utilities import connect, get_image_path @@ -21,8 +19,6 @@ class CreateTorrentPage(AddBreadcrumbOnShowMixin, QWidget): def __init__(self): QWidget.__init__(self) - self.set_sentry_reporter(gui_sentry_reporter) - self.channel_identifier = None self.dialog = None self.selected_item_index = -1 diff --git a/src/tribler-gui/tribler_gui/widgets/discoveringpage.py b/src/tribler-gui/tribler_gui/widgets/discoveringpage.py index 0b97c74976d..4a968501330 100644 --- a/src/tribler-gui/tribler_gui/widgets/discoveringpage.py +++ b/src/tribler-gui/tribler_gui/widgets/discoveringpage.py @@ -1,8 +1,6 @@ from PyQt5.QtWidgets import QWidget -from tribler_common.sentry_reporter.sentry_mixin import AddBreadcrumbOnShowMixin - -from tribler_gui import gui_sentry_reporter +from tribler_gui.sentry_mixin import AddBreadcrumbOnShowMixin from tribler_gui.utilities import connect from tribler_gui.widgets.loadingpage import LOADING_ANIMATION @@ -15,8 +13,6 @@ class DiscoveringPage(AddBreadcrumbOnShowMixin, QWidget): def __init__(self): QWidget.__init__(self) - self.set_sentry_reporter(gui_sentry_reporter) - self.found_channels = 0 self.is_discovering = False diff --git a/src/tribler-gui/tribler_gui/widgets/downloadspage.py b/src/tribler-gui/tribler_gui/widgets/downloadspage.py index 89a3dd68356..9313d980c51 100644 --- a/src/tribler-gui/tribler_gui/widgets/downloadspage.py +++ b/src/tribler-gui/tribler_gui/widgets/downloadspage.py @@ -6,9 +6,6 @@ from PyQt5.QtNetwork import QNetworkRequest from PyQt5.QtWidgets import QAbstractItemView, QAction, QFileDialog, QWidget -from tribler_common.sentry_reporter.sentry_mixin import AddBreadcrumbOnShowMixin - -from tribler_gui import gui_sentry_reporter from tribler_gui.defs import ( BUTTON_TYPE_CONFIRM, BUTTON_TYPE_NORMAL, @@ -28,6 +25,7 @@ DOWNLOADS_FILTER_INACTIVE, ) from tribler_gui.dialogs.confirmationdialog import ConfirmationDialog +from tribler_gui.sentry_mixin import AddBreadcrumbOnShowMixin from tribler_gui.tribler_action_menu import TriblerActionMenu from tribler_gui.tribler_request_manager import TriblerFileDownloadRequest, TriblerNetworkRequest from tribler_gui.utilities import compose_magnetlink, connect, format_speed, tr @@ -55,8 +53,6 @@ class DownloadsPage(AddBreadcrumbOnShowMixin, QWidget): def __init__(self): QWidget.__init__(self) - self.set_sentry_reporter(gui_sentry_reporter) - self.export_dir = None self.filter = DOWNLOADS_FILTER_ALL self.download_widgets = {} # key: infohash, value: QTreeWidgetItem diff --git a/src/tribler-gui/tribler_gui/widgets/ipv8health.py b/src/tribler-gui/tribler_gui/widgets/ipv8health.py index 0661a57d708..691ff8ebac1 100644 --- a/src/tribler-gui/tribler_gui/widgets/ipv8health.py +++ b/src/tribler-gui/tribler_gui/widgets/ipv8health.py @@ -6,9 +6,7 @@ from PyQt5.QtGui import QPainter from PyQt5.QtWidgets import QWidget -from tribler_common.sentry_reporter.sentry_mixin import AddBreadcrumbOnShowMixin - -from tribler_gui import gui_sentry_reporter +from tribler_gui.sentry_mixin import AddBreadcrumbOnShowMixin from tribler_gui.utilities import connect @@ -29,8 +27,6 @@ class MonitorWidget(AddBreadcrumbOnShowMixin, QWidget): def __init__(self): super().__init__() - self.set_sentry_reporter(gui_sentry_reporter) - self.is_paused = False self.update_lock = threading.Lock() diff --git a/src/tribler-gui/tribler_gui/widgets/loadingpage.py b/src/tribler-gui/tribler_gui/widgets/loadingpage.py index 5444811ee58..09376b91bd8 100644 --- a/src/tribler-gui/tribler_gui/widgets/loadingpage.py +++ b/src/tribler-gui/tribler_gui/widgets/loadingpage.py @@ -1,9 +1,7 @@ from PyQt5.QtSvg import QGraphicsSvgItem, QSvgRenderer from PyQt5.QtWidgets import QGraphicsScene, QWidget -from tribler_common.sentry_reporter.sentry_mixin import AddBreadcrumbOnShowMixin - -from tribler_gui import gui_sentry_reporter +from tribler_gui.sentry_mixin import AddBreadcrumbOnShowMixin from tribler_gui.utilities import connect, get_image_path @@ -29,8 +27,6 @@ class LoadingPage(AddBreadcrumbOnShowMixin, QWidget): def __init__(self): QWidget.__init__(self) - self.set_sentry_reporter(gui_sentry_reporter) - self.loading_label = None self.upgrading = False diff --git a/src/tribler-gui/tribler_gui/widgets/searchresultswidget.py b/src/tribler-gui/tribler_gui/widgets/searchresultswidget.py index 15cd4e0bbe8..007acdf9447 100644 --- a/src/tribler-gui/tribler_gui/widgets/searchresultswidget.py +++ b/src/tribler-gui/tribler_gui/widgets/searchresultswidget.py @@ -5,12 +5,11 @@ from PyQt5 import uic -from tribler_common.sentry_reporter.sentry_mixin import AddBreadcrumbOnShowMixin from tribler_common.utilities import Query, to_fts_query from tribler_core.components.metadata_store.db.serialization import CHANNEL_TORRENT, COLLECTION_NODE, REGULAR_TORRENT -from tribler_gui import gui_sentry_reporter +from tribler_gui.sentry_mixin import AddBreadcrumbOnShowMixin from tribler_gui.tribler_request_manager import TriblerNetworkRequest from tribler_gui.utilities import connect, get_ui_file_path, tr from tribler_gui.widgets.tablecontentmodel import SearchResultsModel @@ -50,8 +49,6 @@ def complete(self): class SearchResultsWidget(AddBreadcrumbOnShowMixin, widget_form, widget_class): def __init__(self, parent=None): widget_class.__init__(self, parent=parent) - self.set_sentry_reporter(gui_sentry_reporter) - self._logger = logging.getLogger(self.__class__.__name__) try: diff --git a/src/tribler-gui/tribler_gui/widgets/settingspage.py b/src/tribler-gui/tribler_gui/widgets/settingspage.py index 585bf98977b..d69999202df 100644 --- a/src/tribler-gui/tribler_gui/widgets/settingspage.py +++ b/src/tribler-gui/tribler_gui/widgets/settingspage.py @@ -4,11 +4,9 @@ from PyQt5.QtWidgets import QCheckBox, QFileDialog, QMessageBox, QSizePolicy, QWidget from tribler_common.osutils import get_root_state_directory -from tribler_common.sentry_reporter.sentry_mixin import AddBreadcrumbOnShowMixin from tribler_common.simpledefs import MAX_LIBTORRENT_RATE_LIMIT from tribler_common.version_manager import remove_state_dirs -from tribler_gui import gui_sentry_reporter from tribler_gui.defs import ( DARWIN, DEFAULT_API_PORT, @@ -21,6 +19,7 @@ PAGE_SETTINGS_SEEDING, ) from tribler_gui.dialogs.confirmationdialog import ConfirmationDialog +from tribler_gui.sentry_mixin import AddBreadcrumbOnShowMixin from tribler_gui.tribler_request_manager import TriblerNetworkRequest from tribler_gui.utilities import ( AVAILABLE_TRANSLATIONS, @@ -43,8 +42,6 @@ class SettingsPage(AddBreadcrumbOnShowMixin, QWidget): def __init__(self): QWidget.__init__(self) - self.set_sentry_reporter(gui_sentry_reporter) - self.settings = None self.version_history = None self.lang_list = sorted([lang_name for lang_name, lang_code in AVAILABLE_TRANSLATIONS.items()]) diff --git a/src/tribler-gui/tribler_gui/widgets/subscriptionswidget.py b/src/tribler-gui/tribler_gui/widgets/subscriptionswidget.py index 0c090d1f34a..b68bb3c67d0 100644 --- a/src/tribler-gui/tribler_gui/widgets/subscriptionswidget.py +++ b/src/tribler-gui/tribler_gui/widgets/subscriptionswidget.py @@ -2,9 +2,7 @@ from PyQt5.QtGui import QFont from PyQt5.QtWidgets import QLabel, QWidget -from tribler_common.sentry_reporter.sentry_mixin import AddBreadcrumbOnShowMixin - -from tribler_gui import gui_sentry_reporter +from tribler_gui.sentry_mixin import AddBreadcrumbOnShowMixin from tribler_gui.utilities import connect, format_votes_rich_text, get_votes_rating_description, tr from tribler_gui.widgets.tablecontentdelegate import DARWIN, WINDOWS @@ -16,8 +14,6 @@ class SubscriptionsWidget(AddBreadcrumbOnShowMixin, QWidget): def __init__(self, parent): QWidget.__init__(self, parent) - self.set_sentry_reporter(gui_sentry_reporter) - self.subscribe_button = None self.initialized = False self.contents_widget = None diff --git a/src/tribler-gui/tribler_gui/widgets/trustgraphpage.py b/src/tribler-gui/tribler_gui/widgets/trustgraphpage.py index 87a62d71bd2..da4bb21b771 100644 --- a/src/tribler-gui/tribler_gui/widgets/trustgraphpage.py +++ b/src/tribler-gui/tribler_gui/widgets/trustgraphpage.py @@ -8,9 +8,6 @@ import pyqtgraph as pg -from tribler_common.sentry_reporter.sentry_mixin import AddBreadcrumbOnShowMixin - -from tribler_gui import gui_sentry_reporter from tribler_gui.defs import ( COLOR_DEFAULT, COLOR_GREEN, @@ -22,6 +19,7 @@ TB, TRUST_GRAPH_PEER_LEGENDS, ) +from tribler_gui.sentry_mixin import AddBreadcrumbOnShowMixin from tribler_gui.tribler_request_manager import TriblerNetworkRequest from tribler_gui.utilities import connect, format_size, html_label, tr @@ -84,8 +82,6 @@ def mouseDragEvent(self, event): class TrustGraphPage(AddBreadcrumbOnShowMixin, QWidget): def __init__(self): QWidget.__init__(self) - self.set_sentry_reporter(gui_sentry_reporter) - self.trust_graph = None self.graph_view = None self.selected_node = dict() diff --git a/src/tribler-gui/tribler_gui/widgets/trustpage.py b/src/tribler-gui/tribler_gui/widgets/trustpage.py index 5d42efd6402..c40e4c56025 100644 --- a/src/tribler-gui/tribler_gui/widgets/trustpage.py +++ b/src/tribler-gui/tribler_gui/widgets/trustpage.py @@ -2,11 +2,9 @@ from PyQt5.QtWidgets import QWidget -from tribler_common.sentry_reporter.sentry_mixin import AddBreadcrumbOnShowMixin - -from tribler_gui import gui_sentry_reporter from tribler_gui.defs import PB, TB from tribler_gui.dialogs.trustexplanationdialog import TrustExplanationDialog +from tribler_gui.sentry_mixin import AddBreadcrumbOnShowMixin from tribler_gui.tribler_request_manager import TriblerNetworkRequest from tribler_gui.utilities import connect from tribler_gui.widgets.graphs.dataplot import TimeSeriesDataPlot @@ -29,8 +27,6 @@ class TrustPage(AddBreadcrumbOnShowMixin, QWidget): def __init__(self): QWidget.__init__(self) - self.set_sentry_reporter(gui_sentry_reporter) - self.trust_plot = None self.history = None self.byte_scale = 1024 * 1024