diff --git a/terminatorlib/preferences.glade b/terminatorlib/preferences.glade
index 9a17abf1..ab7b02ee 100644
--- a/terminatorlib/preferences.glade
+++ b/terminatorlib/preferences.glade
@@ -360,11 +360,6 @@
0.1
0.2
-
-
- False
- True
- 3
-
-
-
-
- True
- False
-
-
- True
- False
- Background Image:
-
-
- False
- True
- 5
- 0
-
-
-
-
- True
- False
- Choose file
-
-
-
- False
- True
- end
- 1
-
-
-
False
True
@@ -3017,62 +3028,22 @@
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
+ 6
@@ -4185,4 +4156,9 @@ Much of the behavior of Terminator is based on GNOME Terminal, and we are adding
+
+ 1
+ 0.1
+ 0.01
+
diff --git a/terminatorlib/prefseditor.py b/terminatorlib/prefseditor.py
index bbb4218c..136eb440 100755
--- a/terminatorlib/prefseditor.py
+++ b/terminatorlib/prefseditor.py
@@ -633,14 +633,14 @@ class PrefsEditor:
guiget('solid_radiobutton').set_active(True)
elif self.config['background_type'] == 'transparent':
guiget('transparent_radiobutton').set_active(True)
+ elif self.config['background_type'] == 'image':
+ guiget('image_radiobutton').set_active(True)
self.update_background_tab()
# 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
@@ -945,10 +945,6 @@ class PrefsEditor:
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.
@@ -1507,13 +1503,21 @@ class PrefsEditor:
backtype = None
imagewidget = guiget('image_radiobutton')
transwidget = guiget('transparent_radiobutton')
- if transwidget.get_active() == True:
+
+ if imagewidget.get_active() == True:
+ backtype = 'image'
+ elif transwidget.get_active() == True:
backtype = 'transparent'
else:
backtype = 'solid'
self.config['background_type'] = backtype
self.config.save()
+ if backtype == 'image':
+ guiget('background_image_file').set_sensitive(True)
+ else:
+ guiget('background_image_file').set_sensitive(False)
+
if backtype in ('transparent', 'image'):
guiget('darken_background_scale').set_sensitive(True)
else:
diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py
index 44b5b097..d1b53d49 100644
--- a/terminatorlib/terminal.py
+++ b/terminatorlib/terminal.py
@@ -36,6 +36,7 @@ class Overpaint(Vte.Terminal):
def __init__(self):
Vte.Terminal.__init__(self)
self.config = Config()
+ ### inactive_color_offset is the opposite of alpha level
self.dim_p = float(self.config['inactive_color_offset'])
self.dim_l = round(1.0 - self.dim_p,3)
def dim(self,b):
@@ -158,15 +159,16 @@ class Terminal(Gtk.VBox):
self.queue_draw()
self.background_image = None
if self.config['background_image'] != '':
- self.vte.set_clear_background(False)
- self.vte.connect("draw",self.background_draw)
-
try:
self.background_image = GdkPixbuf.Pixbuf.new_from_file(self.config['background_image'])
- except Exception:
- pass
+ self.vte.set_clear_background(False)
+ self.vte.connect("draw",self.background_draw)
+ except Exception as e:
+ self.background_image = None
+ self.vte.set_clear_background(True)
+ err('error loading background image: %s' % e)
- self.background_alpha = self.config['background_alpha']
+ self.background_alpha = self.config['background_darkness']
self.vte.set_allow_hyperlink(True)
self.vte._draw_data = None
if not hasattr(self.vte, "set_opacity") or \
@@ -746,7 +748,7 @@ class Terminal(Gtk.VBox):
self.bgcolor = Gdk.RGBA()
self.bgcolor.parse(self.config['background_color'])
- if self.config['background_type'] == 'transparent':
+ if self.config['background_type'] == 'transparent' or self.config['background_type'] == 'image':
self.bgcolor.alpha = self.config['background_darkness']
else:
self.bgcolor.alpha = 1
@@ -1114,10 +1116,10 @@ class Terminal(Gtk.VBox):
widget._draw_data = None
def background_draw(self, widget, cr):
- if not self.background_image:
+ if not self.config['background_type'] == 'image' or not self.background_image:
return(False)
- over = self.bgcolor
- over.alpha = self.background_alpha
+ #if not self.background_image:
+ # return(False)
rect = self.vte.get_allocation()
xratio = float(rect.width) / float(self.background_image.get_width())
yratio = float(rect.height) / float(self.background_image.get_height())
@@ -1125,7 +1127,7 @@ class Terminal(Gtk.VBox):
cr.scale(xratio,yratio)
Gdk.cairo_set_source_pixbuf(cr, self.background_image, 0, 0)
cr.paint()
- Gdk.cairo_set_source_rgba(cr,over)
+ Gdk.cairo_set_source_rgba(cr,self.bgcolor)
cr.paint()
cr.restore()
diff --git a/terminatorlib/terminator.py b/terminatorlib/terminator.py
index d8d76b4d..9657da5c 100644
--- a/terminatorlib/terminator.py
+++ b/terminatorlib/terminator.py
@@ -439,7 +439,9 @@ class Terminator(Borg):
else:
bgcolor = Gdk.RGBA()
bgcolor = profiles[profile]['background_color']
- if profiles[profile]['background_type'] == 'transparent':
+ if profiles[profile]['background_type'] == 'image':
+ backgound_image = profiles[profile]['background_image']
+ if profiles[profile]['background_type'] == 'transparent' or profiles[profile]['background_type'] == 'image':
bgalpha = profiles[profile]['background_darkness']
else:
bgalpha = "1"
@@ -631,4 +633,4 @@ class Terminator(Borg):
return(layout)
-# vim: set expandtab ts=4 sw=4:
\ No newline at end of file
+# vim: set expandtab ts=4 sw=4: