From ef6288f1ffcbb0d36086ca0bf74576f974a67e62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marta=20Marczykowska-G=C3=B3recka?= Date: Wed, 6 Feb 2019 14:35:29 +0100 Subject: [PATCH] Added "set as dvm template" to VM settings Added an 'Advanced' settings checkbox that allows the user to set a given VM as template fo dispvms. It sets both the template_for_dispvms property and the appmenus-dispvm feature - instead of delving into particulars of how and which should be set, the user can just turn off the whole setting if they want to make some changes in the vm and then turn it on again. fixes QubesOS/qubes-issues#4004 --- qubesmanager/settings.py | 17 +++++++++++++++++ ui/settingsdlg.ui | 18 ++++++++++++++---- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/qubesmanager/settings.py b/qubesmanager/settings.py index 07baf7a..f707162 100755 --- a/qubesmanager/settings.py +++ b/qubesmanager/settings.py @@ -704,6 +704,11 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog): self.seamless_on_button.clicked.connect(self.enable_seamless) self.seamless_off_button.clicked.connect(self.disable_seamless) + if hasattr(self.vm, "template_for_dispvms"): + self.dvm_template_checkbox.setChecked(self.vm.template_for_dispvms) + else: + self.dvm_template_checkbox.setVisible(False) + def enable_seamless(self): self.vm.run_service_for_stdio("qubes.SetGuiMode", input=b'SEAMLESS') @@ -759,6 +764,18 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog): except Exception as ex: # pylint: disable=broad-except msg.append(str(ex)) + if getattr(self.vm, "template_for_dispvms", False) != \ + self.dvm_template_checkbox.isChecked(): + try: + self.vm.template_for_dispvms = \ + self.dvm_template_checkbox.isChecked() + if self.dvm_template_checkbox.isChecked(): + self.vm.features["appmenus-dispvm"] = True + else: + del self.vm.features["appmenus-dispvm"] + except Exception as ex: # pylint: disable=broad-except + msg.append(str(ex)) + return msg def include_in_balancing_changed(self, state): diff --git a/ui/settingsdlg.ui b/ui/settingsdlg.ui index 833d31e..d7d5d3d 100644 --- a/ui/settingsdlg.ui +++ b/ui/settingsdlg.ui @@ -779,7 +779,7 @@ border-width: 1px; 15 - + Default DispVM: @@ -789,17 +789,17 @@ border-width: 1px; - + - + Boot qube from CDROM - + @@ -825,6 +825,16 @@ The qube must be running to disable seamless mode; this setting is not persisten + + + + + + + Allow starting DisposableVMs from this qube + + +