From 305f6b28818616fbca01e558a7ceb62550835d10 Mon Sep 17 00:00:00 2001 From: Matt Rose Date: Thu, 8 Feb 2024 16:02:41 -0500 Subject: [PATCH 1/2] GUI designed --- terminatorlib/preferences.glade | 64 ++++++++++++++++++++++++++++----- 1 file changed, 55 insertions(+), 9 deletions(-) diff --git a/terminatorlib/preferences.glade b/terminatorlib/preferences.glade index 83a90847..53e6e32f 100644 --- a/terminatorlib/preferences.glade +++ b/terminatorlib/preferences.glade @@ -1,7 +1,24 @@ - + + + + + + + + + Never + + + Multiple Terminals + + + Always + + + @@ -473,7 +490,7 @@ 36 True - + True False @@ -524,7 +541,7 @@ 0 - 1 + 2 2 @@ -541,7 +558,7 @@ 0 - 2 + 3 2 @@ -558,7 +575,7 @@ 0 - 3 + 4 2 @@ -575,7 +592,7 @@ 0 - 4 + 5 2 @@ -592,7 +609,7 @@ 0 - 5 + 6 2 @@ -609,7 +626,7 @@ 0 - 6 + 7 2 @@ -626,10 +643,39 @@ 0 - 7 + 8 2 + + + True + False + AskBeforeCloseListStore + 1 + + + + 0 + + + + + 1 + 1 + + + + + True + False + Ask Before Closing: + + + 0 + 1 + + True From aa03c235b6ae9b6a74701371c679da5c76900b42 Mon Sep 17 00:00:00 2001 From: Matt Rose Date: Thu, 8 Feb 2024 16:24:22 -0500 Subject: [PATCH 2/2] wired up preferences GUI --- terminatorlib/preferences.glade | 1 + terminatorlib/prefseditor.py | 27 ++++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/terminatorlib/preferences.glade b/terminatorlib/preferences.glade index 53e6e32f..fbfb4c76 100644 --- a/terminatorlib/preferences.glade +++ b/terminatorlib/preferences.glade @@ -653,6 +653,7 @@ False AskBeforeCloseListStore 1 + diff --git a/terminatorlib/prefseditor.py b/terminatorlib/prefseditor.py index 72c14110..8aac701d 100755 --- a/terminatorlib/prefseditor.py +++ b/terminatorlib/prefseditor.py @@ -308,6 +308,18 @@ def set_values(self): active = 0 widget = guiget('winstatecombo') widget.set_active(active) + # Ask Before Closing + option = self.config['ask_before_closing'] + if option == 'never': + active = 0 + elif option == 'multiple_terminals': + active = 1 + elif option == 'always': + active = 2 + else: + active = 1 + widget = guiget('askbeforeclose') + widget.set_active(active) # Window borders widget = guiget('winbordercheck') widget.set_active(not self.config['borderless']) @@ -1497,7 +1509,20 @@ def on_winstatecombo_changed(self, widget): value = 'normal' self.config['window_state'] = value self.config.save() - + def on_askbeforeclose_changed(self, widget): + """Ask Before Close changed""" + selected = widget.get_active() + if selected == 0: + value = 'Never' + elif selected == 1: + value = 'Multiple Terminals' + elif selected == 2: + value = 'Always' + else: + value = 'Multiple Terminals' + configval = value.lower().replace(" ","_") + self.config['ask_before_closing'] = configval + self.config.save() # helper function, not a signal def addprofile(self, name, toclone): """Add a profile"""