Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable token balance refresh only if widget is available #7201

Merged
merged 1 commit into from
Nov 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions src/tribler/gui/tribler_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -772,18 +772,22 @@ def received_settings(self, settings):
# We do this after receiving the settings so we have the default download location.
self.process_uri_request()

# Set token balance refresh timer and load the token balance
self.token_refresh_timer = QTimer()
connect(self.token_refresh_timer.timeout, self.load_token_balance)
self.token_refresh_timer.start(60000)

self.load_token_balance()
if self.token_balance_widget.isVisible():
self.enable_token_balance_refresh()

def on_settings_button_click(self):
self.deselect_all_menu_buttons()
self.stackedWidget.setCurrentIndex(PAGE_SETTINGS)
self.settings_page.load_settings()

def enable_token_balance_refresh(self):
# Set token balance refresh timer and load the token balance
self.token_refresh_timer = QTimer()
connect(self.token_refresh_timer.timeout, self.load_token_balance)
self.token_refresh_timer.start(2000)

self.load_token_balance()

def on_token_balance_click(self, _):
self.raise_window()
self.deselect_all_menu_buttons()
Expand Down