From dc38fd72cdce66f5c4cce91402fb61d087f75fd8 Mon Sep 17 00:00:00 2001 From: Agnieszka Kostrzewa Date: Thu, 1 Mar 2012 22:50:32 +0100 Subject: [PATCH] Allow to change f/w rules and appmenus of a running VM (ticket #452) --- qubesmanager/settings.py | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/qubesmanager/settings.py b/qubesmanager/settings.py index 3f4d1f7..9081508 100644 --- a/qubesmanager/settings.py +++ b/qubesmanager/settings.py @@ -139,15 +139,16 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog): self.done(0) def __save_changes__(self, thread_monitor): - ret = self.__apply_basic_tab__() - if len(ret) > 0 : - thread_monitor.set_error_msg('\n'.join(ret)) - thread_monitor.set_finished() - return + self.fw_model.apply_rules() self.AppListManager.save_appmenu_select_changes() + + ret = self.__apply_basic_tab__() + if len(ret) > 0 : + thread_monitor.set_error_msg('\n'.join(ret)) thread_monitor.set_finished() + def current_tab_changed(self, idx): if idx == self.tabs_indices["firewall"]: if self.vm.netvm_vm is not None and not self.vm.netvm_vm.is_proxyvm(): @@ -211,15 +212,13 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog): def __apply_basic_tab__(self): msg = [] - if self.vm.is_running(): - msg.append("Can't change settings of a running VM.") - msg.append("telemele") - return msg - # vmname changed vmname = str(self.vmname.text()) if self.vm.name != vmname: - if self.qvm_collection.get_vm_by_name(vmname) is not None: + if self.vm.is_running(): + msg.append("Can't change name of a running VM.") + + elif self.qvm_collection.get_vm_by_name(vmname) is not None: msg.append("A VM named {0} already exists in the system!".format(vmname)) else: oldname = self.vm.name @@ -236,11 +235,15 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog): #vm label changed if self.vmlabel.currentIndex() != self.label_idx: - label = self.label_list[self.vmlabel.currentIndex()] - self.qvm_collection.lock_db_for_writing() - self.vm.label = label - self.qvm_collection.save() - self.qvm_collection.unlock_db() + if self.vm.is_running(): + msg.append("Can't change label of a running VM.") + + else: + label = self.label_list[self.vmlabel.currentIndex()] + self.qvm_collection.lock_db_for_writing() + self.vm.label = label + self.qvm_collection.save() + self.qvm_collection.unlock_db() return msg