From f29983c396a749399bb9c55d99bf8baaebaa8d7e Mon Sep 17 00:00:00 2001 From: Agnieszka Kostrzewa Date: Wed, 25 Apr 2012 17:13:54 +0200 Subject: [PATCH] Fix 'vm-outdated' icon updating --- qubesmanager/main.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/qubesmanager/main.py b/qubesmanager/main.py index c919621..79ff354 100755 --- a/qubesmanager/main.py +++ b/qubesmanager/main.py @@ -449,6 +449,8 @@ class VmUpdateInfoWidget(QWidget): outdated = vm.is_outdated() if outdated and not self.previous_outdated: self.update_status_widget("outdated") + elif not outdated and self.previous_outdated: + self.update_status_widget(None) self.previous_outdated = outdated @@ -466,31 +468,40 @@ class VmUpdateInfoWidget(QWidget): if update_recommended and not self.previous_update_recommended: self.update_status_widget("update") + self.previous_update_recommended = update_recommended + def update_status_widget(self, state): self.value = state self.tableItem.set_value(state) if state == "ok": label_text = "" icon_path = ":/flag-green.png" - tooltip_text = "VM up to date" + tooltip_text = "VM up to date." elif state == "update": label_text = "Check updates" icon_path = ":/update-recommended.png" - tooltip_text = "Update recommended" + tooltip_text = "Update recommended." elif state == "outdated": label_text = "VM outdated" icon_path = ":/outdated.png" - tooltip_text = "VM outdated" + tooltip_text = "The VM must be restarted for its filesystem to reflect the template's recent changes." + elif state == None: + label_text = "" + icon_path = None + tooltip_text = None if self.show_text: self.label.setText(label_text) else: self.layout().removeWidget(self.icon) self.icon.deleteLater() - self.icon = VmIconWidget(icon_path, True, 0.7) - self.icon.setToolTip(tooltip_text) + if icon_path != None: + self.icon = VmIconWidget(icon_path, True, 0.7) + self.icon.setToolTip(tooltip_text) + else: + self.icon = QLabel(label_text) self.layout().addWidget(self.icon, alignment=Qt.AlignCenter)