Merge branch 'master' of git.qubes-os.org:/var/lib/qubes/git/aga/qubes-manager
This commit is contained in:
commit
ca34f4a024
@ -137,17 +137,17 @@ class VmStatusIcon(QLabel):
|
||||
self.previous_power_state = self.vm.last_power_state
|
||||
|
||||
def set_on_icon(self):
|
||||
icon = QIcon(":/on.png")
|
||||
icon_sz = QSize (VmManagerWindow.row_height * 0.5, VmManagerWindow.row_height * 0.5)
|
||||
if self.vm.last_power_state:
|
||||
icon_pixmap = icon.pixmap(icon_sz)
|
||||
icon = QIcon (":/on.png")
|
||||
else:
|
||||
icon_pixmap = icon.pixmap(icon_sz, QIcon.Disabled)
|
||||
|
||||
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 VmInfoItem (QTableWidgetItem):
|
||||
@ -157,13 +157,16 @@ class VmInfoWidget (QWidget):
|
||||
self.vm = vm
|
||||
|
||||
def __lt__(self, other):
|
||||
self_val = 1 if self.vm.is_running() else 0
|
||||
other_val = 1 if other.vm.is_running() else 0
|
||||
|
||||
self_val += self.upd_info_item.value
|
||||
other_val += other.upd_info_item.value
|
||||
|
||||
return (self_val) < (other_val)
|
||||
self_val = self.upd_info_item.value
|
||||
other_val = other.upd_info_item.value
|
||||
if self.tableWidget().sort_state_by_upd:
|
||||
self_val += 1 if self.vm.is_running() else 0
|
||||
other_val += 1 if other.vm.is_running() else 0
|
||||
return (self_val) > (other_val) #sort with Ascending Order
|
||||
else:
|
||||
self_val = self_val/10 + 10*(1 if self.vm.is_running() else 0)
|
||||
other_val = other_val/10 + 10*(1 if other.vm.is_running() else 0)
|
||||
return (self_val) < (other_val) #sort with Descending order
|
||||
|
||||
def __init__(self, vm, parent = None):
|
||||
super (VmInfoWidget, self).__init__(parent)
|
||||
@ -454,7 +457,6 @@ class VmRowInTable(object):
|
||||
table.setItem(row_no, VmManagerWindow.columns_indices['Label'], self.label_widget.tableItem)
|
||||
|
||||
self.name_widget = VmNameItem(vm)
|
||||
#table.setCellWidget(row_no, VmManagerWindow.columns_indices['Name'], self.name_widget)
|
||||
table.setItem(row_no, VmManagerWindow.columns_indices['Name'], self.name_widget)
|
||||
|
||||
self.info_widget = VmInfoWidget(vm)
|
||||
@ -493,7 +495,6 @@ class VmRowInTable(object):
|
||||
self.mem_usage_widget.update_load(self.vm, None)
|
||||
self.load_widget.update_load(self.vm, cpu_load)
|
||||
self.mem_widget.update_load(self.vm, None)
|
||||
#self.upd_widget.update_outdated(self.vm)
|
||||
|
||||
class NewAppVmDlg (QDialog, ui_newappvmdlg.Ui_NewAppVMDlg):
|
||||
def __init__(self, parent = None):
|
||||
@ -572,9 +573,12 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
||||
|
||||
self.table.horizontalHeader().setResizeMode(QHeaderView.Fixed)
|
||||
|
||||
|
||||
self.table.sortItems(self.columns_indices["Label"], Qt.AscendingOrder)
|
||||
self.sort_by_mem = None
|
||||
self.sort_by_cpu = None
|
||||
self.sort_by_state = None
|
||||
self.table.sort_state_by_upd = True
|
||||
|
||||
self.context_menu = QMenu(self)
|
||||
self.context_menu.addAction(self.action_settings)
|
||||
@ -731,6 +735,11 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
||||
self.fill_table()
|
||||
update_devs=True
|
||||
|
||||
if self.sort_by_state != None and self.table.sort_state_by_upd and some_vms_have_changed_power_state:
|
||||
self.table.sort_state_by_upd = not self.table.sort_state_by_upd # sorter indicator changed will switch it...and we want it to remain unswtched.
|
||||
self.table.sortItems(self.columns_indices["State"], self.sort_by_state)
|
||||
|
||||
|
||||
blk_visible = None
|
||||
rows_with_blk = None
|
||||
if update_devs == True:
|
||||
@ -757,8 +766,6 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
||||
blk_visible = False
|
||||
|
||||
vm_row.update(self.counter, blk_visible=blk_visible, cpu_load = cur_cpu_load)
|
||||
if self.sort_by_cpu != None:
|
||||
self.table.sortItems(self.columns_indices["CPU"], self.sort_by_cpu)
|
||||
|
||||
else:
|
||||
for vm_row in self.vms_in_table.values():
|
||||
@ -769,11 +776,13 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
||||
blk_visible = False
|
||||
|
||||
vm_row.update(self.counter, blk_visible=blk_visible)
|
||||
|
||||
if self.sort_by_cpu != None:
|
||||
self.table.sortItems(self.columns_indices["CPU"], self.sort_by_cpu)
|
||||
elif self.sort_by_mem != None:
|
||||
self.table.sortItems(self.columns_indices["MEM"], self.sort_by_mem)
|
||||
|
||||
|
||||
self.table_selection_changed()
|
||||
|
||||
if not out_of_schedule:
|
||||
@ -800,13 +809,28 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
||||
def sortIndicatorChanged(self, column, order):
|
||||
if column == self.columns_indices["CPU"] or column == self.columns_indices["CPU Graph"]:
|
||||
self.sort_by_mem = None
|
||||
self.sort_by_state = None
|
||||
self.sort_by_cpu = order
|
||||
return
|
||||
elif column == self.columns_indices["MEM"] or column == self.columns_indices["MEM Graph"]:
|
||||
self.sort_by_cpu = None
|
||||
self.sort_by_state = None
|
||||
self.sort_by_mem = order
|
||||
return
|
||||
elif column == self.columns_indices["State"]:
|
||||
self.table.sort_state_by_upd = not self.table.sort_state_by_upd
|
||||
self.sort_by_cpu = None
|
||||
self.sort_by_mem = None
|
||||
if self.table.sort_state_by_upd:
|
||||
self.sort_by_state = Qt.DescendingOrder
|
||||
else:
|
||||
self.sort_by_state = Qt.AscendingOrder
|
||||
return
|
||||
else:
|
||||
self.sort_by_cpu = None
|
||||
self.sort_by_mem = None
|
||||
self.sort_by_state = None
|
||||
|
||||
|
||||
def table_selection_changed (self):
|
||||
|
||||
@ -1059,6 +1083,7 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
||||
assert vm.is_running()
|
||||
try:
|
||||
subprocess.check_call (["/usr/sbin/xl", "pause", vm.name])
|
||||
|
||||
except Exception as ex:
|
||||
QMessageBox.warning (None, "Error pausing VM!", "ERROR: {0}".format(ex))
|
||||
return
|
||||
@ -1083,6 +1108,7 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
||||
return
|
||||
|
||||
trayIcon.showMessage ("Qubes Manager", "VM '{0}' is shutting down...".format(vm.name), msecs=3000)
|
||||
|
||||
self.shutdown_monitor[vm.qid] = VmShutdownMonitor (vm)
|
||||
QTimer.singleShot (vm_shutdown_timeout, self.shutdown_monitor[vm.qid].check_if_vm_has_shutdown)
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
<RCC>
|
||||
<qresource>
|
||||
<file alias="off.png">icons/on-icon/off.png</file>
|
||||
<file alias="on.png">icons/on-icon/on.png</file>
|
||||
<file alias="mount.png">icons/mount.png</file>
|
||||
<file alias="pencil.png">icons/pencil.png</file>
|
||||
<file alias="redfirewall.png">icons/redfirewall.png</file>
|
||||
@ -10,7 +12,6 @@
|
||||
<file alias="flag-red.png">icons/flag-red.png</file>
|
||||
<file alias="flag-yellow.png">icons/flag-yellow.png</file>
|
||||
<file alias="remove.png">icons/remove.png</file>
|
||||
<file alias="on.png">icons/on.png</file>
|
||||
<file alias="appsprefs.png">icons/appsprefs.png</file>
|
||||
<file alias="newfirewall.png">icons/newfirewall.png</file>
|
||||
<file alias="qubes.png">icons/qubes.png</file>
|
||||
|
Loading…
Reference in New Issue
Block a user