Fixed display of default template in Create New VM

From default (name) to name (default).

fixes QubesOS/qubes-issues#6001
This commit is contained in:
Marta Marczykowska-Górecka 2020-08-20 00:16:01 +02:00
parent 3e512bb7c3
commit 476f1d0754
No known key found for this signature in database
GPG Key ID: 9A752C30B26FD04B

View File

@ -100,12 +100,18 @@ class NewVmDlg(QtWidgets.QDialog, Ui_NewVMDlg):
widget=self.label, widget=self.label,
qubes_app=self.app) qubes_app=self.app)
utils.initialize_widget_with_default( utils.initialize_widget_with_vms(
widget=self.template_vm, widget=self.template_vm,
choices=[(vm.name, vm) for vm in self.app.domains qubes_app=self.app,
if not utils.is_internal(vm) and vm.klass == 'TemplateVM'], filter_function=(lambda vm: not utils.is_internal(vm) and
mark_existing_as_default=True, vm.klass == 'TemplateVM'))
default_value=getattr(self.app, 'default_template', None))
default_template = self.app.default_template
for i in range(self.template_vm.count()):
if self.template_vm.itemData(i) == default_template:
self.template_vm.setCurrentIndex(i)
self.template_vm.setItemText(
i, str(default_template) + " (default)")
utils.initialize_widget_with_default( utils.initialize_widget_with_default(
widget=self.netvm, widget=self.netvm,