Fix 'vm-outdated' icon updating
This commit is contained in:
parent
e890a61a49
commit
f29983c396
@ -449,6 +449,8 @@ class VmUpdateInfoWidget(QWidget):
|
|||||||
outdated = vm.is_outdated()
|
outdated = vm.is_outdated()
|
||||||
if outdated and not self.previous_outdated:
|
if outdated and not self.previous_outdated:
|
||||||
self.update_status_widget("outdated")
|
self.update_status_widget("outdated")
|
||||||
|
elif not outdated and self.previous_outdated:
|
||||||
|
self.update_status_widget(None)
|
||||||
|
|
||||||
self.previous_outdated = outdated
|
self.previous_outdated = outdated
|
||||||
|
|
||||||
@ -466,31 +468,40 @@ class VmUpdateInfoWidget(QWidget):
|
|||||||
|
|
||||||
if update_recommended and not self.previous_update_recommended:
|
if update_recommended and not self.previous_update_recommended:
|
||||||
self.update_status_widget("update")
|
self.update_status_widget("update")
|
||||||
|
|
||||||
self.previous_update_recommended = update_recommended
|
self.previous_update_recommended = update_recommended
|
||||||
|
|
||||||
|
|
||||||
def update_status_widget(self, state):
|
def update_status_widget(self, state):
|
||||||
self.value = state
|
self.value = state
|
||||||
self.tableItem.set_value(state)
|
self.tableItem.set_value(state)
|
||||||
if state == "ok":
|
if state == "ok":
|
||||||
label_text = ""
|
label_text = ""
|
||||||
icon_path = ":/flag-green.png"
|
icon_path = ":/flag-green.png"
|
||||||
tooltip_text = "VM up to date"
|
tooltip_text = "VM up to date."
|
||||||
elif state == "update":
|
elif state == "update":
|
||||||
label_text = "<font color=\"#CCCC00\">Check updates</font>"
|
label_text = "<font color=\"#CCCC00\">Check updates</font>"
|
||||||
icon_path = ":/update-recommended.png"
|
icon_path = ":/update-recommended.png"
|
||||||
tooltip_text = "Update recommended"
|
tooltip_text = "Update recommended."
|
||||||
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 = "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:
|
if self.show_text:
|
||||||
self.label.setText(label_text)
|
self.label.setText(label_text)
|
||||||
else:
|
else:
|
||||||
self.layout().removeWidget(self.icon)
|
self.layout().removeWidget(self.icon)
|
||||||
self.icon.deleteLater()
|
self.icon.deleteLater()
|
||||||
|
if icon_path != None:
|
||||||
self.icon = VmIconWidget(icon_path, True, 0.7)
|
self.icon = VmIconWidget(icon_path, True, 0.7)
|
||||||
self.icon.setToolTip(tooltip_text)
|
self.icon.setToolTip(tooltip_text)
|
||||||
|
else:
|
||||||
|
self.icon = QLabel(label_text)
|
||||||
self.layout().addWidget(self.icon, alignment=Qt.AlignCenter)
|
self.layout().addWidget(self.icon, alignment=Qt.AlignCenter)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user