From ca66d55bea3066e62b6686a82b8b677f94b4f4c8 Mon Sep 17 00:00:00 2001 From: Thomas Hurst Date: Fri, 15 Aug 2008 13:40:10 +0100 Subject: [PATCH] Make f11_modifier work again. --- terminatorlib/config.py | 176 ++++++++++++++++++------------------ terminatorlib/terminator.py | 7 +- 2 files changed, 93 insertions(+), 90 deletions(-) diff --git a/terminatorlib/config.py b/terminatorlib/config.py index f2930419..9d6a2777 100755 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -49,6 +49,90 @@ def err (log = ""): from configfile import ConfigFile, ConfigSyntaxError +Defaults = { + 'gt_dir' : '/apps/gnome-terminal', + 'profile_dir' : '/apps/gnome-terminal/profiles', + 'titlebars' : True, + 'titletips' : False, + 'allow_bold' : True, + 'silent_bell' : True, + 'background_color' : '#000000', + 'background_darkness' : 0.5, + 'background_type' : 'solid', + 'background_image' : '', + 'backspace_binding' : 'ascii-del', + 'delete_binding' : 'delete-sequence', + 'cursor_blink' : True, + 'emulation' : 'xterm', + 'font' : 'Mono 8', + 'foreground_color' : '#AAAAAA', + 'scrollbar_position' : "right", + 'scroll_background' : True, + 'scroll_on_keystroke' : True, + 'scroll_on_output' : True, + 'scrollback_lines' : 500, + 'focus' : 'click', + 'exit_action' : 'close', + 'palette' : '#000000000000:#CDCD00000000:#0000CDCD0000:#CDCDCDCD0000:#30BF30BFA38E:#A53C212FA53C:#0000CDCDCDCD:#FAFAEBEBD7D7:#404040404040:#FFFF00000000:#0000FFFF0000:#FFFFFFFF0000:#00000000FFFF:#FFFF0000FFFF:#0000FFFFFFFF:#FFFFFFFFFFFF', + 'word_chars' : '-A-Za-z0-9,./?%&#:_', + 'mouse_autohide' : True, + 'update_records' : True, + 'login_shell' : False, + 'use_custom_command' : False, + 'custom_command' : '', + 'use_system_font' : True, + 'use_theme_colors' : False, + 'http_proxy' : '', + 'ignore_hosts' : ['localhost','127.0.0.0/8','*.local'], + 'encoding' : 'UTF-8', + 'active_encodings' : ['UTF-8', 'ISO-8859-1'], + 'background_image' : '', + 'extreme_tabs' : False, + 'fullscreen' : False, + 'borderless' : False, + 'maximise' : False, + 'handle_size' : -1, + 'focus_on_close' : 'auto', + 'f11_modifier' : False, + 'force_no_bell' : False, + 'cycle_term_tab' : True, + 'copy_on_selection' : False, + 'close_button_on_tab' : True, + 'enable_real_transparency' : False, + 'try_posix_regexp' : platform.system() != 'Linux', + 'keybindings' : { + 'zoom_in' : 'plus', + 'zoom_out' : 'minus', + 'zoom_normal' : '0', + 'new_root_tab' : 'T', + 'new_tab' : 'T', + 'go_next' : 'N', + 'go_prev' : 'P', + 'split_horiz' : 'O', + 'split_vert' : 'E', + 'close_term' : 'W', + 'copy' : 'C', + 'paste' : 'V', + 'toggle_scrollbar' : 'S', + 'search' : 'F', + 'close_window' : 'Q', + 'resize_up' : 'Up', + 'resize_down' : 'Down', + 'resize_left' : 'Left', + 'resize_right' : 'Right', + 'move_tab_right' : 'Page_Down', + 'move_tab_left' : 'Page_Up', + 'toggle_zoom' : 'X', + 'scaled_zoom' : 'Z', + 'next_tab' : 'Page_Down', + 'prev_tab' : 'Page_Up', + 'go_prev' : 'Tab', + 'go_next' : 'Tab', + 'full_screen' : 'F11', + } +} + + class TerminatorConfig: """This class is used as the base point of the config system""" callback = None @@ -98,89 +182,6 @@ class TerminatorConfValuestore: reconfigure_callback = None # Our settings - defaults = { - 'gt_dir' : '/apps/gnome-terminal', - 'profile_dir' : '/apps/gnome-terminal/profiles', - 'titlebars' : True, - 'titletips' : False, - 'allow_bold' : True, - 'silent_bell' : True, - 'background_color' : '#000000', - 'background_darkness' : 0.5, - 'background_type' : 'solid', - 'background_image' : '', - 'backspace_binding' : 'ascii-del', - 'delete_binding' : 'delete-sequence', - 'cursor_blink' : True, - 'emulation' : 'xterm', - 'font' : 'Mono 8', - 'foreground_color' : '#AAAAAA', - 'scrollbar_position' : "right", - 'scroll_background' : True, - 'scroll_on_keystroke' : True, - 'scroll_on_output' : True, - 'scrollback_lines' : 500, - 'focus' : 'click', - 'exit_action' : 'close', - 'palette' : '#000000000000:#CDCD00000000:#0000CDCD0000:#CDCDCDCD0000:#30BF30BFA38E:#A53C212FA53C:#0000CDCDCDCD:#FAFAEBEBD7D7:#404040404040:#FFFF00000000:#0000FFFF0000:#FFFFFFFF0000:#00000000FFFF:#FFFF0000FFFF:#0000FFFFFFFF:#FFFFFFFFFFFF', - 'word_chars' : '-A-Za-z0-9,./?%&#:_', - 'mouse_autohide' : True, - 'update_records' : True, - 'login_shell' : False, - 'use_custom_command' : False, - 'custom_command' : '', - 'use_system_font' : True, - 'use_theme_colors' : False, - 'http_proxy' : '', - 'ignore_hosts' : ['localhost','127.0.0.0/8','*.local'], - 'encoding' : 'UTF-8', - 'active_encodings' : ['UTF-8', 'ISO-8859-1'], - 'background_image' : '', - 'extreme_tabs' : False, - 'fullscreen' : False, - 'borderless' : False, - 'maximise' : False, - 'handle_size' : -1, - 'focus_on_close' : 'auto', - 'f11_modifier' : False, - 'force_no_bell' : False, - 'cycle_term_tab' : True, - 'copy_on_selection' : False, - 'close_button_on_tab' : True, - 'enable_real_transparency' : False, - 'try_posix_regexp' : platform.system() != 'Linux', - 'keybindings' : { - 'zoom_in': 'plus', - 'zoom_out': 'minus', - 'zoom_normal': '0', - 'new_root_tab': 'T', - 'new_tab': 'T', - 'go_next': 'N', - 'go_prev': 'P', - 'split_horiz': 'O', - 'split_vert': 'E', - 'close_term': 'W', - 'copy': 'C', - 'paste': 'V', - 'toggle_scrollbar': 'S', - 'search': 'F', - 'close_window': 'Q', - 'resize_up': 'Up', - 'resize_down': 'Down', - 'resize_left': 'Left', - 'resize_right': 'Right', - 'move_tab_right': 'Page_Down', - 'move_tab_left': 'Page_Up', - 'toggle_zoom': 'X', - 'scaled_zoom': 'Z', - 'next_tab': 'Page_Down', - 'prev_tab': 'Page_Up', - 'go_prev': 'Tab', - 'go_next': 'Tab', - 'full_screen': 'F11', - } - } - def __getattr__ (self, keyname): if self.values.has_key (keyname): dbg ("Returning '%s'"%keyname) @@ -192,7 +193,7 @@ class TerminatorConfValuestore: class TerminatorConfValuestoreDefault (TerminatorConfValuestore): def __init__ (self): self.type = "Default" - self.values = self.defaults + self.values = Defaults class TerminatorConfValuestoreRC (TerminatorConfValuestore): rcfilename = "" @@ -220,11 +221,11 @@ class TerminatorConfValuestoreRC (TerminatorConfValuestore): try: value = ini.settings[key] # Check if this is actually a key we care about - if not self.defaults.has_key (key): + if not Defaults.has_key (key): # We should really mention this to the user continue - deftype = self.defaults[key].__class__.__name__ + deftype = Defaults[key].__class__.__name__ if deftype == 'bool': if value.lower () in ('true', 'yes', 'on'): self.values[key] = True @@ -248,7 +249,8 @@ class TerminatorConfValuestoreRC (TerminatorConfValuestore): dbg (" VS_RCFile: Set value '%s' to '%s'" % (key, self.values[key])) except Exception, e: - dbg (" VS_RCFile: %s Exception handling: %s" % (type(e), item)) + dbg (" VS_RCFile: %s Exception handling: %s" % (type(e), key)) + raise e pass class TerminatorConfValuestoreGConf (TerminatorConfValuestore): diff --git a/terminatorlib/terminator.py b/terminatorlib/terminator.py index 1cc01cf9..305d4e8a 100755 --- a/terminatorlib/terminator.py +++ b/terminatorlib/terminator.py @@ -118,12 +118,13 @@ class Terminator: self.icon_theme = gtk.IconTheme () self.keybindings = TerminatorKeybindings() - self.keybindings.configure(self.conf.keybindings) if self.conf.f11_modifier: - print "Warning: f11_modifier is no longer supported" - print "Add the following to the end of your terminator config:" + config.Defaults['keybindings']['full_screen'] = 'F11' + print "Warning: Config setting f11_modifier is deprecated and will be removed in version 1.0" + print "Please add the following to the end of your terminator config:" print "[keybindings]" print "full_screen = F11" + self.keybindings.configure(self.conf.keybindings) if self.conf.handle_size in xrange (0,6): gtk.rc_parse_string("""