diff options
Diffstat (limited to 'shell/ActivityRegistry.py')
-rw-r--r-- | shell/ActivityRegistry.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/shell/ActivityRegistry.py b/shell/ActivityRegistry.py index 957d436..6d296bb 100644 --- a/shell/ActivityRegistry.py +++ b/shell/ActivityRegistry.py @@ -29,6 +29,14 @@ class ActivityModule: def get_directory(self): """Get the path to activity directory.""" return self._directory + + def get_default_type(self): + """Get the the type of the default activity service.""" + return self._default_type + + def set_default_type(self, default_type): + """Set the the type of the default activity service.""" + self._default_type = default_type class ActivityRegistry: """Service that tracks the available activities""" @@ -65,12 +73,20 @@ class ActivityRegistry: logging.error('%s miss the required name option' % (path)) return False + if cp.has_option('Activity', 'default_type'): + default_type = cp.get('Activity', 'default_type') + else: + default_type = None + if cp.has_option('Activity', 'exec'): activity_exec = cp.get('Activity', 'exec') elif cp.has_option('Activity', 'python_module'): python_module = cp.get('Activity', 'python_module') + python_module = cp.get('Activity', 'python_module') activity_exec = '%s %s %s' % (env.get_activity_runner(), activity_id, python_module) + if default_type: + activity_exec += ' ' + default_type env.add_to_python_path(directory) else: logging.error('%s must specifiy exec or python_module' % (path)) @@ -79,6 +95,8 @@ class ActivityRegistry: module = ActivityModule(name, activity_id, activity_exec, directory) self._activities.append(module) + module.set_default_type(default_type) + return True def list_activities(self): |