From 8db142d92b51d816a4d0e288f25be67992a6a0a4 Mon Sep 17 00:00:00 2001 From: Matt Rose Date: Wed, 30 Sep 2020 10:20:02 -0400 Subject: [PATCH] add GUI controls for background image --- terminatorlib/preferences.glade | 116 +++++++++++++++++++++++++++++++- terminatorlib/prefseditor.py | 15 ++++- 2 files changed, 128 insertions(+), 3 deletions(-) diff --git a/terminatorlib/preferences.glade b/terminatorlib/preferences.glade index 968fe9cb..3b1063c7 100644 --- a/terminatorlib/preferences.glade +++ b/terminatorlib/preferences.glade @@ -360,6 +360,11 @@ 0.1 0.2 + + 1 + 0.1 + 0.01 + False 6 @@ -1434,6 +1439,12 @@ 2 + + + + + + True @@ -2860,7 +2871,7 @@ False False - 1 + 5 0 @@ -2928,7 +2939,108 @@ False True - 2 + 3 + + + + + True + False + + + True + False + Background Image: + + + False + True + 5 + 0 + + + + + True + False + Choose file + + + + False + True + end + 1 + + + + + False + True + 4 + + + + + True + False + + + True + False + Shade Background Image: + + + False + True + 5 + 0 + + + + + True + False + Transparent + + + False + True + 1 + + + + + True + True + background_image_shading_adjustment + 1 + + + + True + True + 2 + + + + + True + False + Opaque + + + False + True + end + 3 + + + + + False + True + 5 diff --git a/terminatorlib/prefseditor.py b/terminatorlib/prefseditor.py index a198fc5c..f483924d 100755 --- a/terminatorlib/prefseditor.py +++ b/terminatorlib/prefseditor.py @@ -637,7 +637,11 @@ class PrefsEditor: # Background shading widget = guiget('background_darkness_scale') widget.set_value(float(self.config['background_darkness'])) - + widget = guiget('background_image_file') + widget.set_filename(self.config['background_image']) + widget = guiget('background_image_shading_scale') + widget.set_value(float(self.config['background_alpha'])) + ## Scrolling tab # Scrollbar position widget = guiget('scrollbar_position_combobox') @@ -931,6 +935,15 @@ class PrefsEditor: self.config['scrollbar_position'] = value self.config.save() + def on_background_image_file_set(self,widget): + print(widget.get_filename()) + self.config['background_image'] = widget.get_filename() + self.config.save() + + def on_background_image_shading_scale_value_changed(self,widget): + self.config['background_alpha'] = widget.get_value() + self.config.save() + def on_darken_background_scale_value_changed(self, widget): """Background darkness setting changed""" value = widget.get_value() # This one is rounded according to the UI.