From 7522bb2b9d13263def7bb1f08b2e23341d1d0e8c Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Sat, 3 Jul 2010 20:42:33 +0100 Subject: [PATCH] Deprecate the hide_tabbar config option and instead add a 'hidden' value to tab_position and update the code/UI/docs accordingly. --- doc/terminator_config.5 | 2 ++ terminatorlib/container.py | 2 ++ terminatorlib/notebook.py | 9 ++++++--- terminatorlib/preferences.glade | 3 +++ terminatorlib/prefseditor.py | 4 ++++ terminatorlib/window.py | 5 ++++- 6 files changed, 21 insertions(+), 4 deletions(-) diff --git a/doc/terminator_config.5 b/doc/terminator_config.5 index 91ea6797..07feaf1f 100644 --- a/doc/terminator_config.5 +++ b/doc/terminator_config.5 @@ -54,6 +54,7 @@ Default value: \fBFalse\fR .TP .B tab_position Defines where tabs are placed. Can be any of: top, left, right, bottom. +If this is set to "hidden", the tab bar will not be shown. Note that hiding the tab bar is very confusing and not recommended. Default value: \fBtop\fR .TP .B close_button_on_tab \fR(boolean) @@ -62,6 +63,7 @@ Default value: \fBTrue\fR .TP .B hide_tabbar \fR(boolean) If set to True, the tab bar will be hidden. This means there will be no visual indication of either how many tabs there are, or which one you are on. Be warned that this can be very confusing and hard to use. +.B NOTE: THIS OPTION IS DEPRECATED, USE tab_position INSTEAD Default value: \fBFalse\fR .TP .B scroll_tabbar \fR(boolean) diff --git a/terminatorlib/container.py b/terminatorlib/container.py index b75a31a2..2ddf5f2c 100755 --- a/terminatorlib/container.py +++ b/terminatorlib/container.py @@ -199,6 +199,8 @@ the %s will also close all terminals within it.') % (reqtype, reqtype)) terminals = {} for child in self.get_offspring(): + if not child: + continue if maker.isinstance(child, 'Terminal'): terminals[child] = child.get_allocation() elif maker.isinstance(child, 'Container'): diff --git a/terminatorlib/notebook.py b/terminatorlib/notebook.py index 146573da..9e72da36 100755 --- a/terminatorlib/notebook.py +++ b/terminatorlib/notebook.py @@ -48,9 +48,12 @@ class Notebook(Container, gtk.Notebook): self.set_property('homogeneous', True) self.set_scrollable(self.config['scroll_tabbar']) - pos = getattr(gtk, 'POS_%s' % self.config['tab_position'].upper()) - self.set_tab_pos(pos) - self.set_show_tabs(not self.config['hide_tabbar']) + if self.config['tab_position'] == 'hidden' or self.config['hide_tabbar']: + self.set_show_tabs(False) + else: + self.set_show_tabs(True) + pos = getattr(gtk, 'POS_%s' % self.config['tab_position'].upper()) + self.set_tab_pos(pos) for tab in xrange(0, self.get_n_pages()): label = self.get_tab_label(self.get_nth_page(tab)) diff --git a/terminatorlib/preferences.glade b/terminatorlib/preferences.glade index 249b106a..3fb20be6 100644 --- a/terminatorlib/preferences.glade +++ b/terminatorlib/preferences.glade @@ -57,6 +57,9 @@ Right + + Hidden + diff --git a/terminatorlib/prefseditor.py b/terminatorlib/prefseditor.py index 6f3f1fb6..f7f67949 100755 --- a/terminatorlib/prefseditor.py +++ b/terminatorlib/prefseditor.py @@ -210,6 +210,8 @@ class PrefsEditor: active = 2 elif option == 'right': active = 3 + elif option == 'hidden': + active = 4 else: active = 0 widget.set_active(active) @@ -852,6 +854,8 @@ class PrefsEditor: value = 'left' elif selected == 3: value = 'right' + elif selected == 4: + value = 'hidden' else: value = 'top' self.config['tab_position'] = value diff --git a/terminatorlib/window.py b/terminatorlib/window.py index 88712ce0..3654644e 100755 --- a/terminatorlib/window.py +++ b/terminatorlib/window.py @@ -431,9 +431,12 @@ class Window(Container, gtk.Window): def get_visible_terminals(self): """Walk down the widget tree to find all of the visible terminals. Mostly using Container::get_visible_terminals()""" + terminals = {} maker = Factory() child = self.get_child() - terminals = {} + + if not child: + return([]) # If our child is a Notebook, reset to work from its visible child if maker.isinstance(child, 'Notebook'):