Indicating transient power states (ticket #520)
This commit is contained in:
parent
4184e49853
commit
a6f9619d60
BIN
icons/transient.png
Normal file
BIN
icons/transient.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
@ -141,10 +141,13 @@ class VmStatusIcon(QLabel):
|
|||||||
self.previous_power_state = self.vm.last_power_state
|
self.previous_power_state = self.vm.last_power_state
|
||||||
|
|
||||||
def set_on_icon(self):
|
def set_on_icon(self):
|
||||||
if self.vm.last_power_state:
|
if self.vm.last_power_state == "Running":
|
||||||
icon = QIcon (":/on.png")
|
icon = QIcon (":/on.png")
|
||||||
|
elif self.vm.last_power_state in ["Starting", "Halting", "Dying"]:
|
||||||
|
icon = QIcon (":/transient.png")
|
||||||
else:
|
else:
|
||||||
icon = QIcon (":/off.png")
|
icon = QIcon (":/off.png")
|
||||||
|
|
||||||
icon_sz = QSize (VmManagerWindow.row_height * 0.5, VmManagerWindow.row_height *0.5)
|
icon_sz = QSize (VmManagerWindow.row_height * 0.5, VmManagerWindow.row_height *0.5)
|
||||||
icon_pixmap = icon.pixmap(icon_sz)
|
icon_pixmap = icon.pixmap(icon_sz)
|
||||||
self.setPixmap (icon_pixmap)
|
self.setPixmap (icon_pixmap)
|
||||||
@ -479,20 +482,20 @@ class VmRowInTable(object):
|
|||||||
table.setItem(row_no, VmManagerWindow.columns_indices['NetVM'], self.netvm_widget)
|
table.setItem(row_no, VmManagerWindow.columns_indices['NetVM'], self.netvm_widget)
|
||||||
|
|
||||||
self.cpu_usage_widget = VmUsageBarWidget(0, 100, "%v %",
|
self.cpu_usage_widget = VmUsageBarWidget(0, 100, "%v %",
|
||||||
lambda vm, val: val if vm.last_power_state else 0, vm, 0, self.cpu_graph_hue)
|
lambda vm, val: val if vm.last_running else 0, vm, 0, self.cpu_graph_hue)
|
||||||
table.setCellWidget(row_no, VmManagerWindow.columns_indices['CPU'], self.cpu_usage_widget)
|
table.setCellWidget(row_no, VmManagerWindow.columns_indices['CPU'], self.cpu_usage_widget)
|
||||||
table.setItem(row_no, VmManagerWindow.columns_indices['CPU'], self.cpu_usage_widget.tableItem)
|
table.setItem(row_no, VmManagerWindow.columns_indices['CPU'], self.cpu_usage_widget.tableItem)
|
||||||
|
|
||||||
self.load_widget = ChartWidget(vm, lambda vm, val: val if vm.last_power_state else 0, self.cpu_graph_hue, 0 )
|
self.load_widget = ChartWidget(vm, lambda vm, val: val if vm.last_running else 0, self.cpu_graph_hue, 0 )
|
||||||
table.setCellWidget(row_no, VmManagerWindow.columns_indices['CPU Graph'], self.load_widget)
|
table.setCellWidget(row_no, VmManagerWindow.columns_indices['CPU Graph'], self.load_widget)
|
||||||
table.setItem(row_no, VmManagerWindow.columns_indices['CPU Graph'], self.load_widget.tableItem)
|
table.setItem(row_no, VmManagerWindow.columns_indices['CPU Graph'], self.load_widget.tableItem)
|
||||||
|
|
||||||
self.mem_usage_widget = VmUsageBarWidget(0, qubes_host.memory_total/1024, "%v MB",
|
self.mem_usage_widget = VmUsageBarWidget(0, qubes_host.memory_total/1024, "%v MB",
|
||||||
lambda vm, val: vm.get_mem()/1024 if vm.last_power_state else 0, vm, 0, self.mem_graph_hue)
|
lambda vm, val: vm.get_mem()/1024 if vm.last_running else 0, vm, 0, self.mem_graph_hue)
|
||||||
table.setCellWidget(row_no, VmManagerWindow.columns_indices['MEM'], self.mem_usage_widget)
|
table.setCellWidget(row_no, VmManagerWindow.columns_indices['MEM'], self.mem_usage_widget)
|
||||||
table.setItem(row_no, VmManagerWindow.columns_indices['MEM'], self.mem_usage_widget.tableItem)
|
table.setItem(row_no, VmManagerWindow.columns_indices['MEM'], self.mem_usage_widget.tableItem)
|
||||||
|
|
||||||
self.mem_widget = ChartWidget(vm, lambda vm, val: vm.get_mem()*100/qubes_host.memory_total if vm.last_power_state else 0, self.mem_graph_hue, 0)
|
self.mem_widget = ChartWidget(vm, lambda vm, val: vm.get_mem()*100/qubes_host.memory_total if vm.last_running else 0, self.mem_graph_hue, 0)
|
||||||
table.setCellWidget(row_no, VmManagerWindow.columns_indices['MEM Graph'], self.mem_widget)
|
table.setCellWidget(row_no, VmManagerWindow.columns_indices['MEM Graph'], self.mem_widget)
|
||||||
table.setItem(row_no, VmManagerWindow.columns_indices['MEM Graph'], self.mem_widget.tableItem)
|
table.setItem(row_no, VmManagerWindow.columns_indices['MEM Graph'], self.mem_widget.tableItem)
|
||||||
|
|
||||||
@ -714,7 +717,8 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
|
|
||||||
vms_list = [vm for vm in self.qvm_collection.values()]
|
vms_list = [vm for vm in self.qvm_collection.values()]
|
||||||
for vm in vms_list:
|
for vm in vms_list:
|
||||||
vm.last_power_state = vm.is_running()
|
vm.last_power_state = vm.get_power_state()
|
||||||
|
vm.last_running = vm.last_power_state in ["Running", "Starting"]
|
||||||
|
|
||||||
no_vms = len (vms_list)
|
no_vms = len (vms_list)
|
||||||
vms_to_display = []
|
vms_to_display = []
|
||||||
@ -750,7 +754,7 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
|
|
||||||
row_no = 0
|
row_no = 0
|
||||||
for vm in vms_list:
|
for vm in vms_list:
|
||||||
if (not self.show_inactive_vms) and (not vm.last_power_state):
|
if (not self.show_inactive_vms) and (not vm.last_running):
|
||||||
continue
|
continue
|
||||||
if vm.internal:
|
if vm.internal:
|
||||||
continue
|
continue
|
||||||
@ -774,9 +778,10 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
if manager_window.isVisible():
|
if manager_window.isVisible():
|
||||||
some_vms_have_changed_power_state = False
|
some_vms_have_changed_power_state = False
|
||||||
for vm in self.vms_list:
|
for vm in self.vms_list:
|
||||||
state = vm.is_running();
|
state = vm.get_power_state()
|
||||||
if vm.last_power_state != state:
|
if vm.last_power_state != state:
|
||||||
vm.last_power_state = state
|
vm.last_power_state = state
|
||||||
|
vm.last_running = (state in ["Running", "Starting"])
|
||||||
some_vms_have_changed_power_state = True
|
some_vms_have_changed_power_state = True
|
||||||
|
|
||||||
reload_table = self.reload_table
|
reload_table = self.reload_table
|
||||||
@ -887,10 +892,10 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
if vm != None:
|
if vm != None:
|
||||||
# Update available actions:
|
# Update available actions:
|
||||||
self.action_settings.setEnabled(True)
|
self.action_settings.setEnabled(True)
|
||||||
self.action_removevm.setEnabled(not vm.installed_by_rpm and not vm.last_power_state)
|
self.action_removevm.setEnabled(not vm.installed_by_rpm and not (vm.last_running))
|
||||||
self.action_resumevm.setEnabled(not vm.last_power_state)
|
self.action_resumevm.setEnabled(not vm.last_running)
|
||||||
self.action_pausevm.setEnabled(vm.last_power_state and vm.qid != 0)
|
self.action_pausevm.setEnabled(vm.last_running and vm.qid != 0)
|
||||||
self.action_shutdownvm.setEnabled(vm.last_power_state and vm.qid != 0)
|
self.action_shutdownvm.setEnabled(vm.last_running and vm.qid != 0)
|
||||||
self.action_appmenus.setEnabled(not vm.is_netvm())
|
self.action_appmenus.setEnabled(not vm.is_netvm())
|
||||||
self.action_editfwrules.setEnabled(vm.is_networked() and not (vm.is_netvm() and not vm.is_proxyvm()))
|
self.action_editfwrules.setEnabled(vm.is_networked() and not (vm.is_netvm() and not vm.is_proxyvm()))
|
||||||
self.action_updatevm.setEnabled(vm.is_updateable() or vm.qid == 0)
|
self.action_updatevm.setEnabled(vm.is_updateable() or vm.qid == 0)
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
<file alias="add.png">icons/add.png</file>
|
<file alias="add.png">icons/add.png</file>
|
||||||
<file alias="flag-blue.png">icons/flag-blue.png</file>
|
<file alias="flag-blue.png">icons/flag-blue.png</file>
|
||||||
<file alias="on.png">icons/running.png</file>
|
<file alias="on.png">icons/running.png</file>
|
||||||
|
<file alias="transient.png">icons/transient.png</file>
|
||||||
<file alias="flag-green.png">icons/flag-green.png</file>
|
<file alias="flag-green.png">icons/flag-green.png</file>
|
||||||
<file alias="flag-red.png">icons/flag-red.png</file>
|
<file alias="flag-red.png">icons/flag-red.png</file>
|
||||||
<file alias="flag-yellow.png">icons/flag-yellow.png</file>
|
<file alias="flag-yellow.png">icons/flag-yellow.png</file>
|
||||||
|
Loading…
Reference in New Issue
Block a user