From d4f5e4362fed2911d9fce377d9306723f8a33c7d Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Mon, 25 Feb 2008 09:50:06 +0000 Subject: [PATCH 1/2] Remove a FIXME. Stop failing on unfound config values, this is madness. Move options parsing callback into the __main__ handling. Formatting tweaks --- terminator | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/terminator b/terminator index 7a60e351..5298d718 100755 --- a/terminator +++ b/terminator @@ -64,7 +64,6 @@ def openurl (url): class TerminatorTerm: # Our settings - # FIXME: Add commandline and/or gconf options to change these defaults = { 'gt_dir' : '/apps/gnome-terminal', '_profile_dir' : '%s/profiles', @@ -236,8 +235,8 @@ class TerminatorTerm: if ret == None: print >> sys.stderr, _('Unknown value requested. Unable to find in gconf profile or default settings: ') + property - sys.exit (1) - return ret + + return (ret) def reconfigure_vte (self): # Set our emulation @@ -669,11 +668,13 @@ class Terminator: parent.add (pane) - position = (vertical) and parent.allocation.height or parent.allocation.width + position = (vertical) and parent.allocation.height \ + or parent.allocation.width if isinstance (parent, gtk.Paned): # We are inside a split term - position = (vertical) and widget.get_box().allocation.height or widget.get_box().allocation.width + position = (vertical) and widget.get_box().allocation.height \ + or widget.get_box().allocation.width if (widget.get_box () == parent.get_child1 ()): widget.get_box ().reparent (pane) @@ -814,20 +815,18 @@ class Terminator: elif isinstance (parent, gtk.HPaned) and not vertical: return parent return self.get_first_parent_paned(parent, vertical) - - -def execute_cb (option, opt, value, parser): - assert value is None - value = [] - while parser.rargs: - arg = parser.rargs[0] - value.append (arg) - del (parser.rargs[0]) - setattr(parser.values, option.dest, value) - if __name__ == '__main__': + def execute_cb (option, opt, value, parser): + assert value is None + value = [] + while parser.rargs: + arg = parser.rargs[0] + value.append (arg) + del (parser.rargs[0]) + setattr(parser.values, option.dest, value) + usage = "usage: %prog [options]" parser = OptionParser (usage) parser.add_option ("-d", "--debug", action="store_true", dest="debug", help="Enable debugging information") From 752e929eec9f5d888214e476f82c68dcf8d36f71 Mon Sep 17 00:00:00 2001 From: Thomas Meire Date: Mon, 25 Feb 2008 12:02:02 +0100 Subject: [PATCH 2/2] Fix how background-settings are applied. (Code based on code from gnome-terminal) --- terminator | 45 ++++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/terminator b/terminator index 5298d718..2e32fab8 100755 --- a/terminator +++ b/terminator @@ -292,25 +292,6 @@ class TerminatorTerm: else: fg_color = gtk.gdk.color_parse (self.reconf ('foreground_color')) bg_color = gtk.gdk.color_parse (self.reconf ('background_color')) - - # Set our background image, transparency and type - background_type = self.reconf ('background_type') - - if background_type == "solid": - self._vte.set_background_image_file ('') - self._vte.set_background_transparent (False) - if background_type == "image": - self._vte.set_background_image_file (self.reconf ('background_image')) - self._vte.set_scroll_background (self.reconf ('scroll_background')) - self._vte.set_background_transparent (False) - if background_type == "transparent": - darkness = self.reconf ('background_darkness') - if self._vte.is_composited(): - self._vte.set_background_transparent (False) - self._vte.set_opacity(int(darkness * 65535)) - else: - self._vte.set_background_transparent (True) - self._vte.set_background_saturation (1 - darkness) colors = palette.split (':') palette = [] @@ -319,6 +300,32 @@ class TerminatorTerm: palette.append (gtk.gdk.color_parse (color)) self._vte.set_colors (fg_color, bg_color, palette) + # Set our background image, transparency and type + # Many thanks to the authors of gnome-terminal, on which this code is based. + background_type = self.reconf ('background_type') + + # set background image settings + if background_type == "image": + self._vte.set_background_image_file (self.reconf ('background_image')) + self._vte.set_scroll_background (self.reconf('scroll_background')) + else: + self._vte.set_background_image_file('') + self._vte.set_scroll_background(False) + + # set transparency for the background (image) + if background_type in ("image", "transparent"): + self._vte.set_background_tint_color (bg_color) + self._vte.set_background_saturation(1 - (self.reconf ('background_darkness'))) + self._vte.set_opacity(int(self.reconf('background_darkness') * 65535)) + else: + self._vte.set_background_saturation(1) + self._vte.set_opacity(65535) + + if not self._vte.is_composited(): + self._vte.set_background_transparent (background_type == "transparent") + else: + self._vte.set_background_transparent (False) + # Set our cursor blinkiness self._vte.set_cursor_blinks = (self.reconf ('cursor_blink'))