Make f11_modifier work again.

This commit is contained in:
Thomas Hurst 2008-08-15 13:40:10 +01:00
parent 1f0bb51e76
commit ca66d55bea
2 changed files with 93 additions and 90 deletions

View File

@ -49,56 +49,7 @@ def err (log = ""):
from configfile import ConfigFile, ConfigSyntaxError from configfile import ConfigFile, ConfigSyntaxError
class TerminatorConfig: Defaults = {
"""This class is used as the base point of the config system"""
callback = None
sources = []
def __init__ (self, sources):
self._keys = None
for source in sources:
if isinstance(source, TerminatorConfValuestore):
self.sources.append (source)
# We always add a default valuestore last so no valid config item ever goes unset
source = TerminatorConfValuestoreDefault ()
self.sources.append (source)
def _merge_keybindings(self):
if self._keys:
return self._keys
self._keys = {}
for source in reversed(self.sources):
try:
val = source.keybindings
self._keys.update(val)
except:
pass
return self._keys
keybindings = property(_merge_keybindings)
def __getattr__ (self, keyname):
for source in self.sources:
dbg ("TConfig: Looking for: '%s' in '%s'"%(keyname, source.type))
try:
val = getattr (source, keyname)
dbg (" TConfig: got: '%s' from a '%s'"%(val, source.type))
return (val)
except:
pass
dbg (" TConfig: Out of sources")
raise (AttributeError)
class TerminatorConfValuestore:
type = "Base"
values = {}
reconfigure_callback = None
# Our settings
defaults = {
'gt_dir' : '/apps/gnome-terminal', 'gt_dir' : '/apps/gnome-terminal',
'profile_dir' : '/apps/gnome-terminal/profiles', 'profile_dir' : '/apps/gnome-terminal/profiles',
'titlebars' : True, 'titlebars' : True,
@ -150,37 +101,87 @@ class TerminatorConfValuestore:
'enable_real_transparency' : False, 'enable_real_transparency' : False,
'try_posix_regexp' : platform.system() != 'Linux', 'try_posix_regexp' : platform.system() != 'Linux',
'keybindings' : { 'keybindings' : {
'zoom_in': '<Ctrl>plus', 'zoom_in' : '<Ctrl>plus',
'zoom_out': '<Ctrl>minus', 'zoom_out' : '<Ctrl>minus',
'zoom_normal': '<Ctrl>0', 'zoom_normal' : '<Ctrl>0',
'new_root_tab': '<Ctrl><Shift><Alt>T', 'new_root_tab' : '<Ctrl><Shift><Alt>T',
'new_tab': '<Ctrl><Shift>T', 'new_tab' : '<Ctrl><Shift>T',
'go_next': '<Ctrl><Shift>N', 'go_next' : '<Ctrl><Shift>N',
'go_prev': '<Ctrl><Shift>P', 'go_prev' : '<Ctrl><Shift>P',
'split_horiz': '<Ctrl><Shift>O', 'split_horiz' : '<Ctrl><Shift>O',
'split_vert': '<Ctrl><Shift>E', 'split_vert' : '<Ctrl><Shift>E',
'close_term': '<Ctrl><Shift>W', 'close_term' : '<Ctrl><Shift>W',
'copy': '<Ctrl><Shift>C', 'copy' : '<Ctrl><Shift>C',
'paste': '<Ctrl><Shift>V', 'paste' : '<Ctrl><Shift>V',
'toggle_scrollbar': '<Ctrl><Shift>S', 'toggle_scrollbar' : '<Ctrl><Shift>S',
'search': '<Ctrl><Shift>F', 'search' : '<Ctrl><Shift>F',
'close_window': '<Ctrl><Shift>Q', 'close_window' : '<Ctrl><Shift>Q',
'resize_up': '<Ctrl><Shift>Up', 'resize_up' : '<Ctrl><Shift>Up',
'resize_down': '<Ctrl><Shift>Down', 'resize_down' : '<Ctrl><Shift>Down',
'resize_left': '<Ctrl><Shift>Left', 'resize_left' : '<Ctrl><Shift>Left',
'resize_right': '<Ctrl><Shift>Right', 'resize_right' : '<Ctrl><Shift>Right',
'move_tab_right': '<Ctrl><Shift>Page_Down', 'move_tab_right' : '<Ctrl><Shift>Page_Down',
'move_tab_left': '<Ctrl><Shift>Page_Up', 'move_tab_left' : '<Ctrl><Shift>Page_Up',
'toggle_zoom': '<Ctrl><Shift>X', 'toggle_zoom' : '<Ctrl><Shift>X',
'scaled_zoom': '<Ctrl><Shift>Z', 'scaled_zoom' : '<Ctrl><Shift>Z',
'next_tab': '<Ctrl>Page_Down', 'next_tab' : '<Ctrl>Page_Down',
'prev_tab': '<Ctrl>Page_Up', 'prev_tab' : '<Ctrl>Page_Up',
'go_prev': '<Ctrl><Shift>Tab', 'go_prev' : '<Ctrl><Shift>Tab',
'go_next': '<Ctrl>Tab', 'go_next' : '<Ctrl>Tab',
'full_screen': 'F11', 'full_screen' : 'F11',
}
} }
}
class TerminatorConfig:
"""This class is used as the base point of the config system"""
callback = None
sources = []
def __init__ (self, sources):
self._keys = None
for source in sources:
if isinstance(source, TerminatorConfValuestore):
self.sources.append (source)
# We always add a default valuestore last so no valid config item ever goes unset
source = TerminatorConfValuestoreDefault ()
self.sources.append (source)
def _merge_keybindings(self):
if self._keys:
return self._keys
self._keys = {}
for source in reversed(self.sources):
try:
val = source.keybindings
self._keys.update(val)
except:
pass
return self._keys
keybindings = property(_merge_keybindings)
def __getattr__ (self, keyname):
for source in self.sources:
dbg ("TConfig: Looking for: '%s' in '%s'"%(keyname, source.type))
try:
val = getattr (source, keyname)
dbg (" TConfig: got: '%s' from a '%s'"%(val, source.type))
return (val)
except:
pass
dbg (" TConfig: Out of sources")
raise (AttributeError)
class TerminatorConfValuestore:
type = "Base"
values = {}
reconfigure_callback = None
# Our settings
def __getattr__ (self, keyname): def __getattr__ (self, keyname):
if self.values.has_key (keyname): if self.values.has_key (keyname):
dbg ("Returning '%s'"%keyname) dbg ("Returning '%s'"%keyname)
@ -192,7 +193,7 @@ class TerminatorConfValuestore:
class TerminatorConfValuestoreDefault (TerminatorConfValuestore): class TerminatorConfValuestoreDefault (TerminatorConfValuestore):
def __init__ (self): def __init__ (self):
self.type = "Default" self.type = "Default"
self.values = self.defaults self.values = Defaults
class TerminatorConfValuestoreRC (TerminatorConfValuestore): class TerminatorConfValuestoreRC (TerminatorConfValuestore):
rcfilename = "" rcfilename = ""
@ -220,11 +221,11 @@ class TerminatorConfValuestoreRC (TerminatorConfValuestore):
try: try:
value = ini.settings[key] value = ini.settings[key]
# Check if this is actually a key we care about # 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 # We should really mention this to the user
continue continue
deftype = self.defaults[key].__class__.__name__ deftype = Defaults[key].__class__.__name__
if deftype == 'bool': if deftype == 'bool':
if value.lower () in ('true', 'yes', 'on'): if value.lower () in ('true', 'yes', 'on'):
self.values[key] = True self.values[key] = True
@ -248,7 +249,8 @@ class TerminatorConfValuestoreRC (TerminatorConfValuestore):
dbg (" VS_RCFile: Set value '%s' to '%s'" % (key, self.values[key])) dbg (" VS_RCFile: Set value '%s' to '%s'" % (key, self.values[key]))
except Exception, e: 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 pass
class TerminatorConfValuestoreGConf (TerminatorConfValuestore): class TerminatorConfValuestoreGConf (TerminatorConfValuestore):

View File

@ -118,12 +118,13 @@ class Terminator:
self.icon_theme = gtk.IconTheme () self.icon_theme = gtk.IconTheme ()
self.keybindings = TerminatorKeybindings() self.keybindings = TerminatorKeybindings()
self.keybindings.configure(self.conf.keybindings)
if self.conf.f11_modifier: if self.conf.f11_modifier:
print "Warning: f11_modifier is no longer supported" config.Defaults['keybindings']['full_screen'] = '<Ctrl><Shift>F11'
print "Add the following to the end of your terminator config:" 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 "[keybindings]"
print "full_screen = <Ctrl><Shift>F11" print "full_screen = <Ctrl><Shift>F11"
self.keybindings.configure(self.conf.keybindings)
if self.conf.handle_size in xrange (0,6): if self.conf.handle_size in xrange (0,6):
gtk.rc_parse_string(""" gtk.rc_parse_string("""