From 96b04cc4b86fe305111afdb47ac13c83060f6dac Mon Sep 17 00:00:00 2001 From: Agnieszka Kostrzewa Date: Fri, 23 Mar 2012 09:13:40 +0100 Subject: [PATCH] Alignment fix to #506 --- qubesmanager/main.py | 19 +++++++++++++++---- resources.qrc | 1 + 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/qubesmanager/main.py b/qubesmanager/main.py index e66d804..8cd02a5 100755 --- a/qubesmanager/main.py +++ b/qubesmanager/main.py @@ -124,18 +124,29 @@ class VmNameItem (QTableWidgetItem): self.qid = vm.qid -class VmStatusIcon(VmIconWidget): +class VmStatusIcon(QLabel): def __init__(self, vm, parent=None): - super (VmStatusIcon, self).__init__(":/on.png", True, 0.5, parent) - self.setVisible(vm.last_power_state) + super (VmStatusIcon, self).__init__(parent) self.vm = vm + self.set_on_icon() self.previous_power_state = vm.last_power_state def update(self): if self.previous_power_state != self.vm.last_power_state: - self.setVisible(self.vm.last_power_state) + self.set_on_icon() self.previous_power_state = self.vm.last_power_state + def set_on_icon(self): + if self.vm.last_power_state: + icon = QIcon (":/on.png") + else: + icon = QIcon (":/off.png") + icon_sz = QSize (VmManagerWindow.row_height * 0.5, VmManagerWindow.row_height *0.5) + icon_pixmap = icon.pixmap(icon_sz) + self.setPixmap (icon_pixmap) + self.setFixedSize (icon_sz) + + class VmInfoWidget (QWidget): diff --git a/resources.qrc b/resources.qrc index e8d15ce..662aaa4 100644 --- a/resources.qrc +++ b/resources.qrc @@ -1,5 +1,6 @@ + icons/on-icon/off.png icons/on-icon/on.png icons/mount.png icons/pencil.png