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
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
defaults = {
Defaults = {
'gt_dir' : '/apps/gnome-terminal',
'profile_dir' : '/apps/gnome-terminal/profiles',
'titlebars' : True,
@ -181,6 +132,56 @@ class TerminatorConfValuestore:
}
}
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):
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):

View File

@ -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'] = '<Ctrl><Shift>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 = <Ctrl><Shift>F11"
self.keybindings.configure(self.conf.keybindings)
if self.conf.handle_size in xrange (0,6):
gtk.rc_parse_string("""