From f4f76110f0b4c5ab3d8138b3e5067a56477565dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marta=20Marczykowska-G=C3=B3recka?= Date: Wed, 8 Jan 2020 21:20:27 +0100 Subject: [PATCH] Fixed Apply behavior for VM Settings VM Setting will now update (current) markers correctly after Apply. fixes QubesOS/qubes-issues#5531 --- qubesmanager/settings.py | 9 +++++++++ qubesmanager/utils.py | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/qubesmanager/settings.py b/qubesmanager/settings.py index 73bf647..6ddba13 100644 --- a/qubesmanager/settings.py +++ b/qubesmanager/settings.py @@ -272,6 +272,15 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtWidgets.QDialog): def apply(self): self.save_changes() + # these signals must be disconnected to avoid unintended behavior + # on refreshing the drop-downs + self.netVM.currentIndexChanged.disconnect() + self.kernel.currentIndexChanged.disconnect() + self.default_dispvm.currentIndexChanged.disconnect() + + self.__init_basic_tab__() + self.__init_advanced_tab__() + def save_and_apply(self): self.save_changes() self.done(0) diff --git a/qubesmanager/utils.py b/qubesmanager/utils.py index 11b7cf1..52c4bd6 100644 --- a/qubesmanager/utils.py +++ b/qubesmanager/utils.py @@ -45,6 +45,11 @@ def prepare_choice(widget, holder, propname, choice, default, allow_none=False, transform=None): # for newly created vms, set propname to None + # clear the widget, so that prepare_choice functions can be used + # to refresh widget values + while widget.count() > 0: + widget.removeItem(0) + debug( 'prepare_choice(widget={widget!r}, ' 'holder={holder!r}, '