Show an icon for VMs whose TemplateVM is running.

https://groups.google.com/d/topic/qubes-users/woHD9RaHvF8/discussion
This commit is contained in:
Matt McCutchen 2015-02-08 20:21:43 -05:00 committed by Marek Marczykowski-Górecki
parent 0d9bb27229
commit aefe0dde43
3 changed files with 23 additions and 9 deletions

BIN
icons/to-be-outdated.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -459,7 +459,7 @@ class VmUpdateInfoWidget(QWidget):
self.set_value(value) self.set_value(value)
def set_value(self, value): def set_value(self, value):
if value == "outdated": if value in ("outdated", "to-be-outdated"):
self.value = 30 self.value = 30
elif value == "update": elif value == "update":
self.value = 20 self.value = 20
@ -484,7 +484,7 @@ class VmUpdateInfoWidget(QWidget):
layout.addWidget(self.icon, alignment=Qt.AlignCenter) layout.addWidget(self.icon, alignment=Qt.AlignCenter)
self.setLayout(layout) self.setLayout(layout)
self.previous_outdated = False self.previous_outdated_state = None
self.previous_update_recommended = None self.previous_update_recommended = None
self.value = None self.value = None
self.tableItem = VmUpdateInfoWidget.VmUpdateInfoItem(self.value, vm) self.tableItem = VmUpdateInfoWidget.VmUpdateInfoItem(self.value, vm)
@ -493,13 +493,22 @@ class VmUpdateInfoWidget(QWidget):
if vm.type == "HVM": if vm.type == "HVM":
return return
outdated = vm.is_outdated() if vm.is_outdated():
if outdated and not self.previous_outdated: outdated_state = "outdated"
self.update_status_widget("outdated") # During TemplateVM shutdown, there's an interval of a few seconds
elif not outdated and self.previous_outdated: # during which vm.template.is_running() returns false but
self.update_status_widget(None) # vm.is_outdated() does not yet return true, so the icon disappears.
# This looks goofy, but we've decided not to fix it at this time
# (2015-02-09).
elif vm.template and vm.template.is_running():
outdated_state = "to-be-outdated"
else:
outdated_state = None
self.previous_outdated = outdated if outdated_state != self.previous_outdated_state:
self.update_status_widget(outdated_state)
self.previous_outdated_state = outdated_state
if not vm.is_updateable(): if not vm.is_updateable():
return return
@ -551,7 +560,11 @@ class VmUpdateInfoWidget(QWidget):
elif state == "outdated": elif state == "outdated":
label_text = "<font color=\"red\">VM outdated</font>" label_text = "<font color=\"red\">VM outdated</font>"
icon_path = ":/outdated.png" icon_path = ":/outdated.png"
tooltip_text = "The VM must be restarted for its filesystem to reflect the template's recent changes." tooltip_text = "The VM must be restarted for its filesystem to reflect the template's recent committed changes."
elif state == "to-be-outdated":
label_text = "<font color=\"#800000\">TemplateVM running</font>"
icon_path = ":/to-be-outdated.png"
tooltip_text = "The TemplateVM must be stopped before changes from its current session can be picked up by this VM."
elif state == None: elif state == None:
label_text = "" label_text = ""
icon_path = None icon_path = None

View File

@ -8,6 +8,7 @@
<file alias="global-settings.png">icons/global-settings.png</file> <file alias="global-settings.png">icons/global-settings.png</file>
<file alias="off.png">icons/on-icon/off.png</file> <file alias="off.png">icons/on-icon/off.png</file>
<file alias="outdated.png">icons/outdated.png</file> <file alias="outdated.png">icons/outdated.png</file>
<file alias="to-be-outdated.png">icons/to-be-outdated.png</file>
<file alias="update-recommended.png">icons/update-recommended.png</file> <file alias="update-recommended.png">icons/update-recommended.png</file>
<file alias="show-all-running.png">icons/show-all-running.png</file> <file alias="show-all-running.png">icons/show-all-running.png</file>
<file alias="mount.png">icons/mount.png</file> <file alias="mount.png">icons/mount.png</file>