Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@localhost.localdomain>2007-06-13 12:39:33 (GMT)
committer Marco Pesenti Gritti <marco@localhost.localdomain>2007-06-13 12:39:33 (GMT)
commit396fcb392c4ae7a8f3a180f0301372579ee8753e (patch)
tree48727066e24d289d077bdcd77033caaddb75370c
parent705eb8119a267355f56ccfbd4928ce868752f945 (diff)
parent8e9c0b640ba551ca9a712302d96712313113792f (diff)
Merge branch 'master' of git+ssh://dev.laptop.org/git/sugar
-rwxr-xr-xbin/sugar-activity5
-rw-r--r--sugar/activity/__init__.py4
-rw-r--r--sugar/activity/registry.py5
-rw-r--r--sugar/graphics/combobox.py21
-rw-r--r--sugar/objects/objecttype.py5
5 files changed, 24 insertions, 16 deletions
diff --git a/bin/sugar-activity b/bin/sugar-activity
index 9a97090..3e9c1c5 100755
--- a/bin/sugar-activity
+++ b/bin/sugar-activity
@@ -20,7 +20,7 @@ import sys
import os
from ConfigParser import ConfigParser
-from sugar.activity import ActivityRegistry
+from sugar import activity
from sugar import env
# Setup the environment so that we run inside the Sugar shell
@@ -51,8 +51,7 @@ def print_help(self):
activity_info = None
if len(sys.argv) > 1:
- registry = ActivityRegistry()
- activities = registry.find_activity(sys.argv[1])
+ activities = activity.get_registry().find_activity(sys.argv[1])
if len(activities) > 0:
activity_info = activities[0]
diff --git a/sugar/activity/__init__.py b/sugar/activity/__init__.py
index 89bd1c3..261b388 100644
--- a/sugar/activity/__init__.py
+++ b/sugar/activity/__init__.py
@@ -36,4 +36,6 @@ class. This class allows for querying the ID of the root
window, requesting sharing across the network, and basic
"what type of application are you" queries.
"""
-
+from sugar.activity.registry import ActivityRegistry
+from sugar.activity.registry import get_registry
+from sugar.activity.registry import ActivityInfo
diff --git a/sugar/activity/registry.py b/sugar/activity/registry.py
index 7e307b8..79d6403 100644
--- a/sugar/activity/registry.py
+++ b/sugar/activity/registry.py
@@ -58,7 +58,10 @@ class ActivityRegistry(object):
info_list = self._registry.GetActivitiesForType(mime_type)
return self._convert_info_list(info_list)
-_registry = ActivityRegistry()
+_registry = None
def get_registry():
+ global _registry
+ if not _registry:
+ _registry = ActivityRegistry()
return _registry
diff --git a/sugar/graphics/combobox.py b/sugar/graphics/combobox.py
index 284b1a1..48419d0 100644
--- a/sugar/graphics/combobox.py
+++ b/sugar/graphics/combobox.py
@@ -1,18 +1,19 @@
# Copyright (C) 2007, One Laptop Per Child
#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
#
-# This program is distributed in the hope that it will be useful,
+# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
import sys
import logging
diff --git a/sugar/objects/objecttype.py b/sugar/objects/objecttype.py
index b515bd1..20e6e11 100644
--- a/sugar/objects/objecttype.py
+++ b/sugar/objects/objecttype.py
@@ -49,7 +49,10 @@ class ObjectTypeRegistry(object):
type_dict = self._registry.GetTypeForMIME(mime_type)
return _object_type_from_dict(type_dict)
-_registry = ObjectTypeRegistry()
+_registry = None
def get_registry():
+ global _registry
+ if not _registry:
+ _registry = ObjectTypeRegistry()
return _registry