Added DVM Template column to Qube Manager

It is labelled "Template for DispVMs" and behaves like every
other column.

fixes QubesOS/qubes-issues#4912
This commit is contained in:
Marta Marczykowska-Górecka 2019-03-29 18:50:01 +01:00
parent 2ce6e8b1cc
commit cf1dd0d355
No known key found for this signature in database
GPG Key ID: 9A752C30B26FD04B
3 changed files with 36 additions and 7 deletions

View File

@ -126,7 +126,7 @@ class VmRowInTable:
self.include_in_backups_widget = table_widgets.VMPropertyItem(
vm, "include_in_backups",
empty_function=(lambda x: True if x is None or not x else False))
empty_function=(lambda x: not bool(x)))
table.setItem(row_no, VmManagerWindow.columns_indices[
'Include in backups'], self.include_in_backups_widget)
@ -135,6 +135,11 @@ class VmRowInTable:
table.setItem(row_no, VmManagerWindow.columns_indices[
'Last backup'], self.last_backup_widget)
self.dvm_template_widget = table_widgets.VMPropertyItem(
vm, "template_for_dispvms", empty_function=(lambda x: not x))
table.setItem(row_no, VmManagerWindow.columns_indices['DVM Template'],
self.dvm_template_widget)
self.table = table
def update(self, update_size_on_disk=False, event=None):
@ -335,6 +340,7 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow):
"IP": 8,
"Include in backups": 9,
"Last backup": 10,
"DVM Template": 11
}
def __init__(self, qt_app, qubes_app, dispatcher, parent=None):
@ -375,10 +381,10 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow):
self.columns_indices["NetVM"]: self.action_netvm,
self.columns_indices["Size"]: self.action_size_on_disk,
self.columns_indices["Internal"]: self.action_internal,
self.columns_indices["IP"]: self
.action_ip, self.columns_indices["Include in backups"]: self
.action_backups, self.columns_indices["Last backup"]: self
.action_last_backup
self.columns_indices["IP"]: self.action_ip,
self.columns_indices["Include in backups"]: self.action_backups,
self.columns_indices["Last backup"]: self.action_last_backup,
self.columns_indices["DVM Template"]: self.action_dvm_template
}
self.visible_columns_count = len(self.columns_indices)
@ -1181,6 +1187,9 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow):
def on_action_size_on_disk_toggled(self, checked):
self.showhide_column(self.columns_indices['Size'], checked)
def on_action_dvm_template_toggled(self, checked):
self.showhide_column(self.columns_indices['DVM Template'], checked)
# noinspection PyArgumentList
@QtCore.pyqtSlot(name='on_action_about_qubes_triggered')
def action_about_qubes_triggered(self): # pylint: disable=no-self-use

View File

@ -136,7 +136,7 @@
<number>10</number>
</property>
<property name="columnCount">
<number>11</number>
<number>12</number>
</property>
<attribute name="horizontalHeaderCascadingSectionResizes">
<bool>false</bool>
@ -234,6 +234,11 @@
<string>Last backup</string>
</property>
</column>
<column>
<property name="text">
<string>Template for DispVMs</string>
</property>
</column>
</widget>
</item>
</layout>
@ -277,6 +282,7 @@
<addaction name="action_backups"/>
<addaction name="action_last_backup"/>
<addaction name="separator"/>
<addaction name="action_dvm_template"/>
<addaction name="action_toolbar"/>
<addaction name="action_menubar"/>
<addaction name="separator"/>
@ -830,6 +836,20 @@
<string>Launch a tool that allows multiple templates to be changed at once</string>
</property>
</action>
<action name="action_dvm_template">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="text">
<string>Template for DispVMs</string>
</property>
<property name="toolTip">
<string>Template for DispVMs</string>
</property>
</action>
</widget>
<resources>
<include location="../resources.qrc"/>