Skip to content

Commit

Permalink
Merge pull request #7729 from drew2a/fix/7350
Browse files Browse the repository at this point in the history
Refactor `settingspage.py` and `tabbuttonpanel.py`
  • Loading branch information
drew2a committed Nov 28, 2023
2 parents e8b8354 + 3163fd9 commit b2dbbd1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/tribler/gui/widgets/settingspage.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ def initialize_settings_page(self, version_history):

self.update_stacked_widget_height()

def showEvent(self, *args):
super().showEvent(*args)
self.window().settings_tab.process_button_click(self.window().settings_general_button)

def on_channel_autocommit_checkbox_changed(self, _):
self.window().gui_settings.setValue("autocommit_enabled", self.window().channel_autocommit_checkbox.isChecked())

Expand Down
10 changes: 7 additions & 3 deletions src/tribler/gui/widgets/tabbuttonpanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@ def initialize(self):
connect(button.clicked_tab_button, self.on_tab_button_click)

def on_tab_button_click(self, clicked_button):
gui_sentry_reporter.add_breadcrumb(message=f'{clicked_button.objectName()}.Click', category='UI', level='info')
self.process_button_click(clicked_button)

self.deselect_all_buttons(except_select=clicked_button)
self.clicked_tab_button.emit(clicked_button.objectName())
def process_button_click(self, button):
""" This method is called when a button is clicked."""
gui_sentry_reporter.add_breadcrumb(message=f'{button.objectName()}.Click', category='UI', level='info')

self.deselect_all_buttons(except_select=button)
self.clicked_tab_button.emit(button.objectName())

def deselect_all_buttons(self, except_select=None):
for button in self.buttons:
Expand Down

0 comments on commit b2dbbd1

Please sign in to comment.