Alignment fix to #506

This commit is contained in:
Agnieszka Kostrzewa 2012-03-23 09:13:40 +01:00
parent 64770213c4
commit 96b04cc4b8
2 changed files with 16 additions and 4 deletions

View File

@ -124,18 +124,29 @@ class VmNameItem (QTableWidgetItem):
self.qid = vm.qid self.qid = vm.qid
class VmStatusIcon(VmIconWidget): class VmStatusIcon(QLabel):
def __init__(self, vm, parent=None): def __init__(self, vm, parent=None):
super (VmStatusIcon, self).__init__(":/on.png", True, 0.5, parent) super (VmStatusIcon, self).__init__(parent)
self.setVisible(vm.last_power_state)
self.vm = vm self.vm = vm
self.set_on_icon()
self.previous_power_state = vm.last_power_state self.previous_power_state = vm.last_power_state
def update(self): def update(self):
if self.previous_power_state != self.vm.last_power_state: 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 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): class VmInfoWidget (QWidget):

View File

@ -1,5 +1,6 @@
<RCC> <RCC>
<qresource> <qresource>
<file alias="off.png">icons/on-icon/off.png</file>
<file alias="on.png">icons/on-icon/on.png</file> <file alias="on.png">icons/on-icon/on.png</file>
<file alias="mount.png">icons/mount.png</file> <file alias="mount.png">icons/mount.png</file>
<file alias="pencil.png">icons/pencil.png</file> <file alias="pencil.png">icons/pencil.png</file>