Get rid of config sections

This commit is contained in:
Florian Bruhin 2017-06-14 19:34:36 +02:00
parent 7e7fbf106b
commit 52f15c84a6
3 changed files with 4 additions and 21 deletions

View File

@ -63,12 +63,6 @@ def get(*args, **kwargs):
return objreg.get('config').get(*args, **kwargs)
def section(sect):
"""Get a config section from the global config."""
config = objreg.get('config')
return newconfig.SectionStub(config, sect)
def _init_main_config(parent=None):
"""Initialize the main config.

View File

@ -33,18 +33,6 @@ instance = None
_change_filters = []
class SectionStub:
# FIXME get rid of this once we get rid of sections
def __init__(self, conf, name):
self._conf = conf
self._name = name
def __getitem__(self, item):
return self._conf.get(self._name, item)
class change_filter: # pylint: disable=invalid-name
"""Decorator to filter calls based on a config section/option matching.

View File

@ -363,11 +363,12 @@ class KeyConfigParser(QObject):
line))
commands = [c.split(maxsplit=1)[0].strip() for c in commands]
for cmd in commands:
aliases = config.section('aliases')
# FIXME:conf
# aliases = config.section('aliases')
if cmd in cmdutils.cmd_dict:
cmdname = cmd
elif cmd in aliases:
cmdname = aliases[cmd].split(maxsplit=1)[0].strip()
# elif cmd in aliases:
# cmdname = aliases[cmd].split(maxsplit=1)[0].strip()
else:
raise KeyConfigError("Invalid command '{}'!".format(cmd))
cmd_obj = cmdutils.cmd_dict[cmdname]