Merge branch 'master' of ssh://git.qubes-os.org/var/lib/qubes/git/joanna/qubes-manager

This commit is contained in:
Marek Marczykowski 2012-04-24 18:57:56 +02:00
commit ede2034e77
7 changed files with 46 additions and 27 deletions

BIN
icons/transient.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@ -300,7 +300,7 @@
<normaloff>:/removevm.png</normaloff>:/removevm.png</iconset>
</property>
<property name="text">
<string>remove AppVM</string>
<string>Remove AppVM</string>
</property>
<property name="toolTip">
<string>Remove an existing AppVM (must be stopped first)</string>
@ -509,7 +509,7 @@
<normaloff>:/settings.png</normaloff>:/settings.png</iconset>
</property>
<property name="text">
<string>Settings</string>
<string>VM settings</string>
</property>
<property name="toolTip">
<string>VM Settings</string>

View File

@ -141,10 +141,13 @@ class VmStatusIcon(QLabel):
self.previous_power_state = self.vm.last_power_state
def set_on_icon(self):
if self.vm.last_power_state:
if self.vm.last_power_state == "Running":
icon = QIcon (":/on.png")
elif self.vm.last_power_state in ["Starting", "Halting", "Dying"]:
icon = QIcon (":/transient.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)
@ -479,20 +482,20 @@ class VmRowInTable(object):
table.setItem(row_no, VmManagerWindow.columns_indices['NetVM'], self.netvm_widget)
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.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.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",
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.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.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()]
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)
vms_to_display = []
@ -750,7 +754,7 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
row_no = 0
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
if vm.internal:
continue
@ -774,9 +778,10 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
if manager_window.isVisible():
some_vms_have_changed_power_state = False
for vm in self.vms_list:
state = vm.is_running();
state = vm.get_power_state()
if vm.last_power_state != state:
vm.last_power_state = state
vm.last_running = (state in ["Running", "Starting"])
some_vms_have_changed_power_state = True
reload_table = self.reload_table
@ -887,10 +892,10 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
if vm != None:
# Update available actions:
self.action_settings.setEnabled(True)
self.action_removevm.setEnabled(not vm.installed_by_rpm and not vm.last_power_state)
self.action_resumevm.setEnabled(not vm.last_power_state)
self.action_pausevm.setEnabled(vm.last_power_state and vm.qid != 0)
self.action_shutdownvm.setEnabled(vm.last_power_state and vm.qid != 0)
self.action_removevm.setEnabled(not vm.installed_by_rpm and not (vm.last_running))
self.action_resumevm.setEnabled(not vm.last_running)
self.action_pausevm.setEnabled(vm.last_running 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_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)

View File

@ -360,7 +360,25 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
self.include_in_balancing.setChecked(self.vm.services['meminfo-writer']==True)
#paths
self.dir_path.setText(self.vm.dir_path)
self.config_path.setText(self.vm.conf_file)
if self.vm.template is not None:
self.root_img_path.setText(self.vm.template.root_img)
else:
self.root_img_path.setText("n/a")
self.volatile_img_path.setText(self.vm.volatile_img)
self.private_img_path.setText(self.vm.private_img)
#kernel
#in case VM is not Linux
if not hasattr(self.vm, "kernel"):
self.kernel_groupbox.setVisible(False)
return;
if self.vm.template is not None:
text = self.vm.kernel
self.kernel.insertItem(0, text)
@ -390,16 +408,7 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
self.kernel_opts.setText(self.vm.kernelopts)
#paths
self.dir_path.setText(self.vm.dir_path)
self.config_path.setText(self.vm.conf_file)
if self.vm.template is not None:
self.root_img_path.setText(self.vm.template.root_img)
else:
self.root_img_path.setText("n/a")
self.volatile_img_path.setText(self.vm.volatile_img)
self.private_img_path.setText(self.vm.private_img)
def __apply_advanced_tab__(self):
#mem/cpu
@ -417,6 +426,10 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
#include_in_memory_balancing applied in services tab
#in case VM is not Linux
if not hasattr(self.vm, "kernel"):
return;
#kernel changed
if self.kernel.currentIndex() != self.kernel_idx:

View File

@ -16,6 +16,7 @@
<file alias="add.png">icons/add.png</file>
<file alias="flag-blue.png">icons/flag-blue.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-red.png">icons/flag-red.png</file>
<file alias="flag-yellow.png">icons/flag-yellow.png</file>

View File

@ -29,7 +29,7 @@
<locale language="English" country="UnitedStates"/>
</property>
<property name="currentIndex">
<number>3</number>
<number>1</number>
</property>
<widget class="QWidget" name="basic_tab">
<property name="locale">
@ -435,7 +435,7 @@
</widget>
</item>
<item row="0" column="1">
<widget class="QGroupBox" name="groupBox_10">
<widget class="QGroupBox" name="kernel_groupbox">
<property name="enabled">
<bool>true</bool>
</property>

View File

@ -1 +1 @@
1.2.10
1.2.11