From 7e00a1a058e12d0dc213e704626803f7e34645e6 Mon Sep 17 00:00:00 2001 From: Martin Baeuml Date: Wed, 7 Sep 2011 13:11:02 +0200 Subject: [PATCH] use default configuration as config template for the createconfig command --- sloth/conf/template/config_template.py | 90 -------------------------- sloth/core/commands.py | 4 +- 2 files changed, 2 insertions(+), 92 deletions(-) delete mode 100644 sloth/conf/template/config_template.py diff --git a/sloth/conf/template/config_template.py b/sloth/conf/template/config_template.py deleted file mode 100644 index 38764c3..0000000 --- a/sloth/conf/template/config_template.py +++ /dev/null @@ -1,90 +0,0 @@ -# Sloth configuration. -# -# The configuration file is a simple python module with module-level -# variables. This module contains the default values for sloth's -# configuration variables. -# -# In all cases in the configuration where a python callable (such as a -# function, class constructor, etc.) is expected, it is equally possible -# to specify a module path (as string) pointing to such a python callable. -# It will then be automatically imported. - -# LABLES -# -# List/tuple of dictionaries that defines the label classes -# that are handled by sloth. For each label, there should -# be one dictionary that contains the following keys: -# -# - 'item' : Visualization item for this label. This can be -# any python callable or a module path string -# implementing the visualization item interface. -# -# - 'inserter' : (optional) Item inserter for this label. -# If the user selects to insert a new label of this class -# the inserter is responsible to actually -# capture the users mouse actions and insert -# a new label into the annotation model. -# -# - 'hotkey' : (optional) A keyboard shortcut starting -# the insertion of a new label of this class. -# -# - 'attributes' : (optional) A dictionary that defines the -# keys and possible values of this label -# class. -LABELS = ( - { - 'attributes': { - 'class': 'rect', - }, - 'inserter': 'sloth.items.RectItemInserter', - 'item': 'sloth.items.RectItem', - 'hotkey': 'r', - }, - { - 'attributes': { - 'class': 'point', - }, - 'inserter': 'sloth.items.PointItemInserter', - 'item': 'sloth.items.PointItem', - 'hotkey': 'p', - }, -) - -# HOTKEYS -# -# Defines the keyboard shortcuts. Each hotkey is defined by a tuple -# with at least 2 entries, where the first entry is the hotkey (sequence), -# and the second entry is the function that is called. The function -# should expect a single parameter, the labeltool object. The optional -# third entry -- if present -- is expected to be a string describing the -# action. -HOTKEYS = ( - ('PgDown', lambda lt: lt.gotoNext(), 'Next image/frame'), - ('PgUp', lambda lt: lt.gotoPrevious(), 'Previous image/frame'), - ('Tab', lambda lt: lt.selectNextAnnotation(), 'Select next annotation'), - ('Shift+Tab', lambda lt: lt.selectPreviousAnnotation(), 'Select previous annotation'), - ('ESC', lambda lt: lt.exitInsertMode(), 'Exit insert mode'), -) - -# CONTAINERS -# -# A list/tuple of two-tuples defining the mapping between filename pattern and -# annotation container classes. The filename pattern can contain wildcards -# such as * and ?. The corresponding container is expected to either a python -# class implementing the sloth container interface, or a module path pointing -# to such a class. -CONTAINERS = ( - ('*.json', 'sloth.annotations.container.JsonContainer'), - ('*.yaml', 'sloth.annotations.container.YamlContainer'), - ('*.pickle', 'sloth.annotations.container.PickleContainer'), - ('*.sloth-init', 'sloth.annotations.container.FileNameListContainer'), -) - -# PLUGINS -# -# A list/tuple of classes implementing the sloth plugin interface. The -# classes can either be given directly or their module path be specified -# as string. -PLUGINS = ( -) - diff --git a/sloth/core/commands.py b/sloth/core/commands.py index 284ae64..b8d997c 100644 --- a/sloth/core/commands.py +++ b/sloth/core/commands.py @@ -38,8 +38,8 @@ class CreateConfigCommand(BaseCommand): if len(args) != 1: raise CommandError("Expect exactly 1 argument.") - template_dir = os.path.join(sloth.__path__[0], 'conf', 'template') - config_template = os.path.join(template_dir, 'config_template.py') + template_dir = os.path.join(sloth.__path__[0], 'conf') + config_template = os.path.join(template_dir, 'default_config.py') target = args[0] if os.path.exists(target) and not options['force']: