From 538b358df029ed9ea952eebd6722379874e89e67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Thu, 6 Mar 2014 01:46:45 +0100 Subject: [PATCH] Add "HVM Template" VM type to create VM dialog (#758) --- newappvmdlg.ui | 36 ++++++++++++++++++++++------------- qubesmanager/create_new_vm.py | 24 ++++++++++++++++++++--- 2 files changed, 44 insertions(+), 16 deletions(-) diff --git a/newappvmdlg.ui b/newappvmdlg.ui index 5a928cc..c2f071a 100644 --- a/newappvmdlg.ui +++ b/newappvmdlg.ui @@ -6,8 +6,8 @@ 0 0 - 500 - 200 + 496 + 215 @@ -98,18 +98,28 @@ + + + + false + + + HVM template + + + + + + + Allow networking + + + true + + + - - - - Allow networking - - - true - - - @@ -127,7 +137,7 @@ 0 0 482 - 30 + 51 diff --git a/qubesmanager/create_new_vm.py b/qubesmanager/create_new_vm.py index 6c2332b..fd315d5 100644 --- a/qubesmanager/create_new_vm.py +++ b/qubesmanager/create_new_vm.py @@ -59,6 +59,7 @@ class NewVmDlg (QDialog, Ui_NewVMDlg): pass else: self.hvm_radio.setEnabled(True) + self.hvmtpl_radio.setEnabled(True) self.qvm_collection.lock_db_for_reading() self.qvm_collection.load() @@ -86,6 +87,8 @@ class NewVmDlg (QDialog, Ui_NewVMDlg): return False if self.hvm_radio.isChecked(): return QubesHVm.is_template_compatible(vm) + elif self.hvmtpl_radio.isChecked(): + return False else: return QubesVm.is_template_compatible(vm) self.template_vm_list = filter(filter_template, self.qvm_collection.values()) @@ -108,19 +111,28 @@ class NewVmDlg (QDialog, Ui_NewVMDlg): if checked: self.template_name.setEnabled(True) self.allow_networking.setEnabled(False) + def on_proxyvm_radio_toggled(self, checked): if checked: self.template_name.setEnabled(True) self.allow_networking.setEnabled(True) + def on_hvm_radio_toggled(self, checked): - if checked: + if self.hvm_radio.isChecked() or self.hvmtpl_radio.isChecked(): self.standalone.setChecked(True) self.allow_networking.setEnabled(True) + self.standalone.setEnabled(self.hvm_radio.isChecked()) else: self.standalone.setChecked(False) + self.standalone.setEnabled(True) self.fill_template_list() + + def on_hvmtpl_radio_toggled(self, checked): + return self.on_hvm_radio_toggled(checked) + def on_standalone_toggled(self, checked): - if checked and self.hvm_radio.isChecked(): + if checked and (self.hvm_radio.isChecked() or + self.hvmtpl_radio.isChecked()): self.template_name.setEnabled(False) else: self.template_name.setEnabled(True) @@ -157,8 +169,14 @@ class NewVmDlg (QDialog, Ui_NewVMDlg): vmtype = "NetVM" elif self.proxyvm_radio.isChecked(): vmtype = "ProxyVM" - else: #hvm_radio.isChecked() + elif self.hvm_radio.isChecked(): vmtype = "HVM" + elif self.hvmtpl_radio.isChecked(): + vmtype = "TemplateHVM" + else: + QErrorMessage.showMessage(None, "Error creating AppVM!", "Unknown " + "VM type, this is error in Qubes Manager") + self.done(0) vmclass = "Qubes" + vmtype.replace("VM", "Vm")