Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/creactistore/_templates/+package+/activity.py_tmpl
diff options
context:
space:
mode:
Diffstat (limited to 'creactistore/_templates/+package+/activity.py_tmpl')
-rw-r--r--creactistore/_templates/+package+/activity.py_tmpl19
1 files changed, 10 insertions, 9 deletions
diff --git a/creactistore/_templates/+package+/activity.py_tmpl b/creactistore/_templates/+package+/activity.py_tmpl
index ce40cfc..dd5d0ed 100644
--- a/creactistore/_templates/+package+/activity.py_tmpl
+++ b/creactistore/_templates/+package+/activity.py_tmpl
@@ -7,10 +7,10 @@ from gettext import gettext as _
from sugar.activity import activity
# add lib path to current python path
-sys.path.append(os.path.join(activity.get_bundle_path(), 'lib'))
-
-# peak import
-from peak.util.imports import importString
+BUNDLE = activity.get_bundle_path()
+sys.path.append(os.path.join(BUNDLE, 'parts', 'pip', 'lib', 'python2.7', 'site-packages'))
+sys.path.append(os.path.join(BUNDLE, 'clone', 'semanticxo', 'src'))
+sys.path.append(os.path.join(BUNDLE, 'clone', 'olpcfr'))
# semanticxo import
from semanticxo.datastore import TripleStore
@@ -53,11 +53,12 @@ class {{package.capitalize()}}Activity(activity.Activity):
def change_screen(self, name):
# init screen if not already initialized
if name not in self.__screens:
- _cls = importString('{{package}}.ui.screens.%s.%s' % (
- name,
- ''.join([n.capitalize()
- for n in name.split('_')])))
- self.__screens[name] = _cls(self)
+ mod_name = '{{package}}.ui.screens.%s' % name
+ cls_name = ''.join([n.capitalize() for n in name.split('_')])
+ # import and init
+ mod = __import__(mod_name, globals(), locals(), [""])
+ cls = getattr(mod, cls_name)
+ self.__screens[name] = cls(self)
# get and show the screen
_scr = self.__screens[name]
_scr._show()