From 476f1d0754ce2bc32defed5bbcd0d1a03baaac4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marta=20Marczykowska-G=C3=B3recka?= Date: Thu, 20 Aug 2020 00:16:01 +0200 Subject: [PATCH] Fixed display of default template in Create New VM From default (name) to name (default). fixes QubesOS/qubes-issues#6001 --- qubesmanager/create_new_vm.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/qubesmanager/create_new_vm.py b/qubesmanager/create_new_vm.py index b1be32a..4bf8c02 100644 --- a/qubesmanager/create_new_vm.py +++ b/qubesmanager/create_new_vm.py @@ -100,12 +100,18 @@ class NewVmDlg(QtWidgets.QDialog, Ui_NewVMDlg): widget=self.label, qubes_app=self.app) - utils.initialize_widget_with_default( + utils.initialize_widget_with_vms( widget=self.template_vm, - choices=[(vm.name, vm) for vm in self.app.domains - if not utils.is_internal(vm) and vm.klass == 'TemplateVM'], - mark_existing_as_default=True, - default_value=getattr(self.app, 'default_template', None)) + qubes_app=self.app, + filter_function=(lambda vm: not utils.is_internal(vm) and + vm.klass == 'TemplateVM')) + + 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( widget=self.netvm,