From 8decf8257752c3c4ff4d54d96a2442022dcd0cd4 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Wed, 19 Nov 2008 13:46:37 +0000 Subject: [PATCH] Make handle size and tab position updatable on the fly --- terminatorlib/prefs_profile.py | 20 ++++++++++++++--- terminatorlib/terminator.py | 41 ++++++++++++++++++---------------- 2 files changed, 39 insertions(+), 22 deletions(-) diff --git a/terminatorlib/prefs_profile.py b/terminatorlib/prefs_profile.py index 861ebddf..865eb045 100644 --- a/terminatorlib/prefs_profile.py +++ b/terminatorlib/prefs_profile.py @@ -49,6 +49,7 @@ class ProfileEditor: focus = ['click', 'sloppy', 'mouse'] background_type = ['solid', 'image', 'transparent'] tab_position = ['top', 'bottom', 'left', 'right'] + tab_position_gtk = {'top' : gtk.POS_TOP, 'bottom' : gtk.POS_BOTTOM, 'left' : gtk.POS_LEFT, 'right' : gtk.POS_RIGHT} def __init__ (self, term): self.term = term @@ -294,10 +295,23 @@ class ProfileEditor: elif changer == "borderless": self.term.window.set_decorated (not values[changer]) elif changer == "handle_size": - # FIXME: How maek work? - pass + self.term.set_handle_size(values[changer]) + gtk.rc_reset_styles(gtk.settings_get_default()) elif changer == "tab_position": - # FIXME: maek work + notebook = self.term.window.get_child() + new_pos = self.tab_position_gtk[values[changer]] + angle = 0 + if isinstance (notebook, gtk.Notebook): + notebook.set_tab_pos(new_pos) + if new_pos == gtk.POS_LEFT: + angle = 90 + elif new_pos == gtk.POS_RIGHT: + angle = 270 + num_pages = notebook.get_n_pages() + for i in xrange(0,num_pages): + tab = notebook.get_tab_label(notebook.get_nth_page(i)) + label = tab.get_children()[0] + label.set_angle(angle) pass # FIXME: which others? cycle_term_tab, close_button_on_tab, copy_on_selection, extreme_tabs, try_posix_regexp diff --git a/terminatorlib/terminator.py b/terminatorlib/terminator.py index 54729f22..b43674b8 100755 --- a/terminatorlib/terminator.py +++ b/terminatorlib/terminator.py @@ -184,24 +184,7 @@ class Terminator: print "full_screen = F11" self.keybindings.configure(self.conf.keybindings) - if self.conf.handle_size in xrange (0,6): - gtk.rc_parse_string(""" - style "terminator-paned-style" { - GtkPaned::handle_size = %s - } - - class "GtkPaned" style "terminator-paned-style" - """ % self.conf.handle_size) - - gtk.rc_parse_string(""" - style "terminator-tab-close-button-style" { - GtkWidget::focus-padding = 0 - GtkWidget::focus-line-width = 0 - xthickness = 0 - ythickness = 0 - } - widget "*.terminator-tab-close-button" style "terminator-tab-close-button-style" - """) + self.set_handle_size (self.conf.handle_size) self.window = gtk.Window () self.window.set_title (APP_NAME.capitalize()) @@ -248,7 +231,27 @@ class Terminator: self.window.show () term.spawn_child () self.save_yourself () - + + def set_handle_size (self, size): + if size in xrange (0,6): + gtk.rc_parse_string(""" + style "terminator-paned-style" { + GtkPaned::handle_size = %s + } + + class "GtkPaned" style "terminator-paned-style" + """ % self.conf.handle_size) + + gtk.rc_parse_string(""" + style "terminator-tab-close-button-style" { + GtkWidget::focus-padding = 0 + GtkWidget::focus-line-width = 0 + xthickness = 0 + ythickness = 0 + } + widget "*.terminator-tab-close-button" style "terminator-tab-close-button-style" + """) + def enable_rgba (self, rgba = False): screen = self.window.get_screen() if rgba: