Actually set a colour value. Only set config options if the entire line parses correctly.
This commit is contained in:
parent
e7467bfeba
commit
c2524cec47
@ -238,6 +238,7 @@ Some lines have been ignored.""") % escape(repr(self.rcfilename))
|
||||
if key.endswith('_color'):
|
||||
try:
|
||||
gtk.gdk.color_parse(value)
|
||||
self.values[key] = value
|
||||
except ValueError:
|
||||
err(_("Setting %s value %s not a valid colour; ignoring") % (key,repr(value)))
|
||||
continue
|
||||
@ -268,6 +269,7 @@ Some lines have been ignored.""") % escape(repr(self.rcfilename))
|
||||
except Exception, e:
|
||||
dbg (" VS_RCFile: %s Exception handling: %s" % (type(e), key))
|
||||
pass
|
||||
dbg("Config parsed as: %s" % repr(self.values))
|
||||
|
||||
class TerminatorConfValuestoreGConf (TerminatorConfValuestore):
|
||||
profile = ""
|
||||
|
@ -142,6 +142,8 @@ class ConfigFile:
|
||||
|
||||
if self._line[self._pos:] != '':
|
||||
raise ConfigSyntaxError(_("Unexpected token"), self)
|
||||
|
||||
self._line_ok()
|
||||
except ConfigSyntaxError, e:
|
||||
if self.errors_are_fatal:
|
||||
raise e
|
||||
@ -161,8 +163,18 @@ class ConfigFile:
|
||||
|
||||
def _value(self, value):
|
||||
dbg("Value %s" % repr(value))
|
||||
if self._currsection is not None:
|
||||
self.settings.setdefault(self._currsection, {})[self._currsetting] = value
|
||||
else:
|
||||
self.settings[self._currsetting] = value
|
||||
self._currvalue = value
|
||||
|
||||
def _line_ok(self):
|
||||
if self._currvalue is None: return
|
||||
try:
|
||||
if self._currsection is not None:
|
||||
try:
|
||||
self.settings.setdefault(self._currsection, {})[self._currsetting] = self._currvalue
|
||||
except TypeError, e:
|
||||
raise ConfigSyntaxError(_("Section %s is being used as a setting name" % repr(self._currsection)), self)
|
||||
else:
|
||||
self.settings[self._currsetting] = self._currvalue
|
||||
finally:
|
||||
self._currvalue = None
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user