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

Refresh disk usage stats every 60s if focused #394

Merged
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
11 changes: 11 additions & 0 deletions qubesmanager/qube_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -876,6 +876,8 @@ def __init__(self, qt_app, qubes_app, dispatcher, _parent=None):
dispatcher.add_handler('domain-feature-delete:updates-available',
self.on_domain_updates_available)

self.installEventFilter(self)

# It needs to store threads until they finish
self.threads_list = []
self.progress = None
Expand All @@ -886,6 +888,15 @@ def __init__(self, qt_app, qubes_app, dispatcher, _parent=None):
self.size_on_disk_timer.setInterval(1000 * 60 * 5) # every 5 mins
self.size_on_disk_timer.start()

def eventFilter(self, _object, event):
''' refresh disk usage every 60s if focused & every 5m in background '''
if event.type() == QEvent.Type.WindowActivate:
self.update_running_size()
self.size_on_disk_timer.setInterval(1000 * 60)
elif event.type() == QEvent.Type.WindowDeactivate:
self.size_on_disk_timer.setInterval(1000 * 60 * 5)
return False

def scroll_to_top(self):
self.table.selectRow(0)
self.table.scrollToTop()
Expand Down