From 2f48fb33a3229e2a9582c218642c0e342282cfa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sat, 9 Jan 2021 05:53:53 +0100 Subject: [PATCH] create_new_vm: enable/disable "install system" option on template change When choosing StandaloneVM type, the option to install a system should be enabled when empty source template is set. Fix this when choosing VM type first and only then changing template to empty. --- qubesmanager/create_new_vm.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/qubesmanager/create_new_vm.py b/qubesmanager/create_new_vm.py index 5dff684..a95792d 100644 --- a/qubesmanager/create_new_vm.py +++ b/qubesmanager/create_new_vm.py @@ -168,6 +168,8 @@ class NewVmDlg(QtWidgets.QDialog, Ui_NewVMDlg): self.vm_type.currentIndexChanged.connect(self.type_change) + self.template_vm.currentIndexChanged.connect(self.template_change) + self.launch_settings.stateChanged.connect(self.settings_change) self.install_system.stateChanged.connect(self.install_change) @@ -287,6 +289,17 @@ class NewVmDlg(QtWidgets.QDialog, Ui_NewVMDlg): self.template_vm.setCurrentIndex(0) self.template_type = "template" + def template_change(self): + template = self.template_vm.currentData() + klass = self.vm_type.currentData() + + if klass in ['TemplateVM', 'StandaloneVM'] and template is None: + self.install_system.setEnabled(True) + self.install_system.setChecked(True) + else: + self.install_system.setEnabled(False) + self.install_system.setChecked(False) + def install_change(self): if self.install_system.isChecked(): self.launch_settings.setChecked(False)