From 3c77ec10c128363a44f4d20b15a66fea9a720732 Mon Sep 17 00:00:00 2001 From: Thomas Hurst Date: Thu, 28 Aug 2008 17:08:15 +0100 Subject: [PATCH] Add support for tab_position. --- doc/terminator_config.5 | 10 +++++++--- terminatorlib/config.py | 6 ++++++ terminatorlib/terminator.py | 13 ++++++++++--- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/doc/terminator_config.5 b/doc/terminator_config.5 index eb5f5a5f..f8a38470 100644 --- a/doc/terminator_config.5 +++ b/doc/terminator_config.5 @@ -182,14 +182,18 @@ Default value: \fBTrue\fR If set to True, tabs will have a close button on them. Default value: \fBTrue\fR .TP -.B copy_on_selection \fR(boolean) -If set to True, text selections will be automatically copied to the clipboard, in addition to being made the Primary selection. -Default value: \fBFalse\fR +.B tab_position +Defines where tabs are placed. Can be any of: top, left, right, bottom. +Default value: \fBtop\fR .TP .B extreme_tabs \fB(boolean)\fR If set to True, tabs can be created within other tabs. Be warned that this can be very confusing and hard to use. Default value: \fBFalse\fR .TP +.B copy_on_selection \fR(boolean) +If set to True, text selections will be automatically copied to the clipboard, in addition to being made the Primary selection. +Default value: \fBFalse\fR +.TP .B try_posix_regexp \fB(boolean)\fR If set to True, URL matching regexps will try to use POSIX style first, and fall back on GNU style on failure. If you are on Linux but URL matches don't work, try setting this to True. If you are not on Linux, but you get VTE warnings on startup saying "Error compiling regular expression", set this to False to silence them (they are otherwise harmless). Default value: \fBFalse\fR on Linux, \fBTrue\fR otherwise. diff --git a/terminatorlib/config.py b/terminatorlib/config.py index 82cd3a31..48c7304c 100755 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -98,6 +98,7 @@ Defaults = { 'cycle_term_tab' : True, 'copy_on_selection' : False, 'close_button_on_tab' : True, + 'tab_position' : 'top', 'enable_real_transparency' : False, 'try_posix_regexp' : platform.system() != 'Linux', 'keybindings' : { @@ -269,6 +270,11 @@ Errors were encountered while parsing terminator_config(5) file: self.values[key] = value except ValueError: raise ValueError(_("Setting %s value %s not a valid colour; ignoring") % (key,repr(value))) + elif key == 'tab_position': + if value.lower() in ('top', 'left', 'bottom', 'right'): + self.values[key] = value.lower() + else: + raise ValueError(_("%s must be one of: top, left, right, bottom") % key) elif deftype == 'bool': if value.lower () in ('true', 'yes', 'on'): self.values[key] = True diff --git a/terminatorlib/terminator.py b/terminatorlib/terminator.py index a087cb58..8a2b69ec 100755 --- a/terminatorlib/terminator.py +++ b/terminatorlib/terminator.py @@ -34,7 +34,12 @@ class TerminatorNotebookTabLabel(gtk.HBox): gtk.HBox.__init__(self, False) self._notebook = notebook self.terminator = terminator - self._label = gtk.Label(title) + self._label = gtk.Label(title) + tab_pos = notebook.get_tab_pos() + if tab_pos == gtk.POS_LEFT: + self._label.set_angle(90) + elif tab_pos == gtk.POS_RIGHT: + self._label.set_angle(270) icon = gtk.Image() icon.set_from_stock(gtk.STOCK_CLOSE, gtk.ICON_SIZE_MENU) self.pack_start(self._label, True, True) @@ -344,7 +349,7 @@ class Terminator: parent.set_tab_label_packing(pane, True, True, gtk.PACK_START) parent.set_tab_reorderable(pane, True) parent.set_current_page(page) - + position = (vertical) and parent.allocation.height \ or parent.allocation.width @@ -480,10 +485,12 @@ class Terminator: ((self.conf.extreme_tabs and not toplevel) or not isinstance(child, gtk.Notebook))): #no notebook yet. notebook = gtk.Notebook() - #notebook.set_tab_pos(gtk.POS_TOP) notebook.connect('page-reordered',self.on_page_reordered) notebook.set_property('homogeneous', True) notebook.set_tab_reorderable(widget, True) + # Config validates this. + pos = getattr(gtk, "POS_%s" % self.conf.tab_position.upper()) + notebook.set_tab_pos(pos) if isinstance(parent, gtk.Paned): if parent.get_child1() == child: