diff --git a/terminatorlib/config.py b/terminatorlib/config.py index 1d648e3a..8f656362 100755 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -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 = "" diff --git a/terminatorlib/configfile.py b/terminatorlib/configfile.py index 076c4c2c..59910216 100644 --- a/terminatorlib/configfile.py +++ b/terminatorlib/configfile.py @@ -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