default. TODO: autodiscovery
"""
+DRIVER_SETTING_SECTION = 'drivers'
+"""Name of the config section which controls driver selection.
+"""
+
class Driver(object):
"""Base class for file format drivers.
"""
def default_settings():
- settings = [Setting(
- 'drivers', help='Enable/disable default drivers.')]
+ settings = [Setting(DRIVER_SETTING_SECTION,
+ help='Enable/disable default drivers.')]
for dnode in DRIVER_GRAPH:
driver = dnode.data
default_include = [di for mod_name,di in DRIVER_MODULES
if mod_name == driver.name][0]
help = driver.__doc__.split('\n', 1)[0]
settings.append(Setting(
- section='drivers',
+ section=DRIVER_SETTING_SECTION,
option=driver.name,
value=str(default_include),
help=help,
"""List of builtin modules. TODO: autodiscovery
"""
+PLUGIN_SETTING_SECTION = 'plugins'
+"""Name of the config section which controls plugin selection.
+"""
+
# Plugins and settings
"""
def default_settings():
- settings = [Setting(
- 'plugins', help='Enable/disable default plugins.')]
+ settings = [Setting(PLUGIN_SETTING_SECTION,
+ help='Enable/disable default plugins.')]
for pnode in PLUGIN_GRAPH:
if pnode.data.name in BUILTIN_MODULES:
continue # builtin inclusion is not optional
if mod_name == plugin.name][0]
help = 'Commands: ' + ', '.join([c.name for c in plugin.commands()])
settings.append(Setting(
- section='plugins',
+ section=PLUGIN_SETTING_SECTION,
option=plugin.name,
value=str(default_include),
help=help,
"""List of user interface modules. TODO: autodiscovery
"""
+USER_INTERFACE_SETTING_SECTION = 'user interfaces'
+"""Name of the config section which controls UI selection.
+"""
+
class QueueMessage (object):
def __str__(self):
return self.__class__.__name__
"""
def __init__(self, name):
self.name = name
- self.setting_section = '%s ui' % self.name
+ self.setting_section = '%s user interface' % self.name
self.config = {}
def default_settings(self):
"""
def default_settings():
- settings = [Setting('UIs', help='Select the user interface (only one).')]
+ settings = [Setting(USER_INTERFACE_SETTING_SECTION,
+ help='Select the user interface (only one).')]
for i,ui in enumerate(USER_INTERFACES.values()):
help = ui.__doc__.split('\n', 1)[0]
- settings.append(Setting('UIs', ui.name, str(i==0), help=help))
+ settings.append(Setting(USER_INTERFACE_SETTING_SECTION,
+ ui.name, str(i==0), help=help))
# i==0 to enable the first by default
for ui in USER_INTERFACES.values():
settings.extend(ui.default_settings())
return settings
def load_ui(config):
- uis = [c for c,v in config.items('UIs') if v == 'True']
+ uis = [c for c,v in config.items(USER_INTERFACE_SETTING_SECTION) if v == 'True']
assert len(uis) == 1, 'Can only select one UI, not %d: %s' % (len(uis),uis)
ui_name = uis[0]
ui = USER_INTERFACES[ui_name]