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( self.include_in_backups_widget = table_widgets.VMPropertyItem(
vm, "include_in_backups", 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[ table.setItem(row_no, VmManagerWindow.columns_indices[
'Include in backups'], self.include_in_backups_widget) 'Include in backups'], self.include_in_backups_widget)
@ -135,6 +135,11 @@ class VmRowInTable:
table.setItem(row_no, VmManagerWindow.columns_indices[ table.setItem(row_no, VmManagerWindow.columns_indices[
'Last backup'], self.last_backup_widget) '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 self.table = table
def update(self, update_size_on_disk=False, event=None): def update(self, update_size_on_disk=False, event=None):
@ -335,6 +340,7 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow):
"IP": 8, "IP": 8,
"Include in backups": 9, "Include in backups": 9,
"Last backup": 10, "Last backup": 10,
"DVM Template": 11
} }
def __init__(self, qt_app, qubes_app, dispatcher, parent=None): 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["NetVM"]: self.action_netvm,
self.columns_indices["Size"]: self.action_size_on_disk, self.columns_indices["Size"]: self.action_size_on_disk,
self.columns_indices["Internal"]: self.action_internal, self.columns_indices["Internal"]: self.action_internal,
self.columns_indices["IP"]: self self.columns_indices["IP"]: self.action_ip,
.action_ip, self.columns_indices["Include in backups"]: self self.columns_indices["Include in backups"]: self.action_backups,
.action_backups, self.columns_indices["Last backup"]: self self.columns_indices["Last backup"]: self.action_last_backup,
.action_last_backup self.columns_indices["DVM Template"]: self.action_dvm_template
} }
self.visible_columns_count = len(self.columns_indices) 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): def on_action_size_on_disk_toggled(self, checked):
self.showhide_column(self.columns_indices['Size'], 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 # noinspection PyArgumentList
@QtCore.pyqtSlot(name='on_action_about_qubes_triggered') @QtCore.pyqtSlot(name='on_action_about_qubes_triggered')
def action_about_qubes_triggered(self): # pylint: disable=no-self-use def action_about_qubes_triggered(self): # pylint: disable=no-self-use

View File

@ -286,7 +286,7 @@ class VMPropertyItem(QtGui.QTableWidgetItem):
self.setText("n/a") self.setText("n/a")
elif self.check_default and \ elif self.check_default and \
self.vm.property_is_default(self.property_name): self.vm.property_is_default(self.property_name):
self.setText('default (' + str(val) + ')') self.setText('default (' + str(val) + ')')
elif val is True: elif val is True:
self.setText("Yes") self.setText("Yes")
else: else:

View File

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