From cd5292881e7085fb5047cc3104c7a5c24e3df5a9 Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Thu, 21 Nov 2013 13:39:35 -0500 Subject: [PATCH] Add single_instance field to activity bundle This field can be used by activities that need to be restricted to a single open instance. Usage is: single_instance = yes jarabe/model/shell.py has been modified look for this field in a separate patch to Sugar. Together these two patches constitute the implementation of Sugar feature Launch Limits [1] [1] http://wiki.sugarlabs.org/go/Features/Launch_Limits --- src/sugar3/bundle/activitybundle.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/sugar3/bundle/activitybundle.py b/src/sugar3/bundle/activitybundle.py index ce8d006b..c065fa4b 100644 --- a/src/sugar3/bundle/activitybundle.py +++ b/src/sugar3/bundle/activitybundle.py @@ -108,6 +108,7 @@ class ActivityBundle(Bundle): self._tags = None self._activity_version = '0' self._summary = None + self._single_instance = False info_file = self.get_file('activity/activity.info') if info_file is None: @@ -179,6 +180,10 @@ class ActivityBundle(Bundle): if cp.has_option(section, 'summary'): self._summary = cp.get(section, 'summary') + if cp.has_option(section, 'single_instance'): + if cp.get(section, 'single_instance') == 'yes': + self._single_instance = True + def _get_linfo_file(self): # Using method from gettext.py, first find languages from environ languages = [] @@ -279,6 +284,10 @@ class ActivityBundle(Bundle): """Get the summary that describe the activity""" return self._summary + def get_single_instance(self): + """Get whether there should be a single instance for the activity""" + return self._single_instance + def get_show_launcher(self): """Get whether there should be a visible launcher for the activity""" return self._show_launcher