Make f11_modifier work again.
This commit is contained in:
parent
1f0bb51e76
commit
ca66d55bea
|
@ -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,
|
||||||
|
@ -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):
|
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):
|
||||||
|
|
|
@ -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("""
|
||||||
|
|
Loading…
Reference in New Issue