Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/pr/394'
Browse files Browse the repository at this point in the history
* origin/pr/394:
  Refresh disk usage stats every 60s if focused
  • Loading branch information
marmarek committed Nov 15, 2024
2 parents d33d306 + 2a4c2b6 commit 2072a74
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 @@ -891,6 +891,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 @@ -901,6 +903,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 2072a74

Please sign in to comment.