From a17b38844c8397bcb23585785d654ca15ebe4b52 Mon Sep 17 00:00:00 2001 From: ztjohnst Date: Sun, 19 Jan 2020 04:14:58 -0500 Subject: [PATCH 1/3] Can only open one settings dialog now. --- main.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 5398dea..c8a3891 100755 --- a/main.py +++ b/main.py @@ -353,6 +353,7 @@ def __init__(self, *args): self.inst = Xqemu() self.settings = SettingsManager() self.settings.load() + self.settings_window = SettingsWindow(self.settings) self.runButton.setText('Start') self.pauseButton.setText('Pause') self.pauseButton.setEnabled(False) @@ -429,8 +430,10 @@ def onRestartButtonClicked(self): self.inst.restart() def onSettingsClicked(self): - s = SettingsWindow(self.settings) - s.exec_() + if not self.settings_window.isVisible(): + self.settings_window.exec_() + else: + self.settings_window.setFocus() self.settings.save() def onExitClicked(self): From c415cf4e7d635e4e971f43170d14df565c85ee09 Mon Sep 17 00:00:00 2001 From: ztjohnst Date: Sun, 19 Jan 2020 04:59:15 -0500 Subject: [PATCH 2/3] Added closeEvent so we can do proper clean up like closing the settings dialog. --- main.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main.py b/main.py index c8a3891..cc90e00 100755 --- a/main.py +++ b/main.py @@ -438,6 +438,12 @@ def onSettingsClicked(self): def onExitClicked(self): self.inst.stop() + self.settings_window.close() + sys.exit(0) + + def closeEvent(self,event): + self.inst.stop() + self.settings_window.close() sys.exit(0) def main(): From 9159c6a59b8da3cca2f5c34b848e0b0a6582d9bf Mon Sep 17 00:00:00 2001 From: ztjohnst Date: Sun, 19 Jan 2020 09:29:40 -0500 Subject: [PATCH 3/3] Settings window is now raised to the front if its already open and Settings is clicked again --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index c8a3891..ca2dd58 100755 --- a/main.py +++ b/main.py @@ -433,7 +433,7 @@ def onSettingsClicked(self): if not self.settings_window.isVisible(): self.settings_window.exec_() else: - self.settings_window.setFocus() + self.settings_window.raise_() self.settings.save() def onExitClicked(self):