Skip to content

Commit

Permalink
Refresh disk usage stats every 60s if focused
Browse files Browse the repository at this point in the history
  • Loading branch information
alimirjamali committed Nov 14, 2024
1 parent 4aee918 commit 2a4c2b6
Showing 1 changed file with 11 additions and 0 deletions.
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

0 comments on commit 2a4c2b6

Please sign in to comment.