Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/sugar/activity/activity.py14
-rw-r--r--src/sugar/tutorius/Makefile.am4
-rw-r--r--src/sugar/tutorius/bundler.py36
3 files changed, 32 insertions, 22 deletions
diff --git a/src/sugar/activity/activity.py b/src/sugar/activity/activity.py
index 3e2d3d4..a5188fd 100644
--- a/src/sugar/activity/activity.py
+++ b/src/sugar/activity/activity.py
@@ -77,7 +77,6 @@ from sugar.datastore import datastore
from sugar.session import XSMPClient
from sugar import wm
from sugar.tutorius.services import ObjectStore
-from sugar.tutorius.tutoserialize import TutoSerializer
_ = lambda msg: gettext.dgettext('sugar-toolkit', msg)
@@ -129,14 +128,15 @@ class ActivityToolbar(gtk.Toolbar):
self.tutorials.combo.connect('changed', self.__tutorial_changed_cb)
# Get tutorial list by file
logging.debug("************************************ before creating serialize")
- serialize = TutoSerializer()
- logging.debug("************************************ before calling load_tuto_list()")
-
- #tutorials = self._activity.get_tutorials()
- if getattr(self._activity,"_tutorials",None) is None:
- tutorials = serialize.load_tuto_list()
+## serialize = TutoSerializer()
+## logging.debug("************************************ before calling load_tuto_list()")
+##
+## #tutorials = self._activity.get_tutorials()
+## if getattr(self._activity,"_tutorials",None) is None:
+## tutorials = serialize.load_tuto_list()
self._current_tutorial = None
+ tutorials = None
if tutorials:
for key, tutorial in tutorials.items():
# self.tutorials.combo.append_item(key, _(tutorial.name))
diff --git a/src/sugar/tutorius/Makefile.am b/src/sugar/tutorius/Makefile.am
index 05cec50..8805314 100644
--- a/src/sugar/tutorius/Makefile.am
+++ b/src/sugar/tutorius/Makefile.am
@@ -9,5 +9,5 @@ sugar_PYTHON = \
services.py \
overlayer.py \
editor.py \
- linear_creator.py \
- tutoserialize.py
+ linear_creator.py\
+ bundler.py
diff --git a/src/sugar/tutorius/bundler.py b/src/sugar/tutorius/bundler.py
index 74b9eac..d089c35 100644
--- a/src/sugar/tutorius/bundler.py
+++ b/src/sugar/tutorius/bundler.py
@@ -32,10 +32,20 @@ from sugar.tutorius.actions import DialogMessage, OnceWrapper, BubbleMessage
from sugar.tutorius.filters import GtkWidgetEventFilter, TimerEvent
from ConfigParser import SafeConfigParser
-def __get_store_root():
- return os.path.join(os.getenv("SUGAR_PREFIX"),"share","tutorius","data")
-def __get_bundle_root():
- return os.path.join(os.getenv("SUGAR_BUNDLE_PATH"),"data","tutorius","data")
+def _get_store_root():
+ path = os.path.join(os.getenv("SUGAR_PREFIX"),"share","tutorius","data")
+ if os.path.exists(path):
+ return path
+ else:
+ os.makedirs(path)
+ return path
+def _get_bundle_root():
+ path = os.path.join(os.getenv("SUGAR_BUNDLE_PATH"),"data","tutorius","data")
+ if os.path.exists(path):
+ return path
+ else:
+ os.makedirs(path)
+ return path
INI_ACTIVITY_SECTION = "RELATED_ACTIVITIES"
INI_METADATA_SECTION = "GENERAL_METADATA"
@@ -53,8 +63,8 @@ class TutorialStore:
given activity.
"""
- store_root = __get_store_root()
- bundle_root = __get_bundle_root()
+ store_root = _get_store_root()
+ bundle_root = _get_bundle_root()
logging.debug("*********** Path of store_root : " + store_root)
@@ -133,7 +143,7 @@ class XMLSerializer(Serializer):
fsm_xml.appendChild(fsm_element)
fsm_element.setAttributeNS("http://tutorius.org", "fsm:Name", fsm.name)
fsm_element.setAttributeNS("http://tutorius.org", "fsm:StartStateName", fsm.start_state_name)
- fsm_element = doc.
+ #fsm_element = doc.
tutorial_element.appendChild(fsm_element)
@@ -193,12 +203,12 @@ class TutorialBundler:
#Look for the file in the path if a uid is supplied
if generated_guid:
#General store
- store_path = os.path.join(__get_store_root(), generated_guid, INI_FILENAME)
+ store_path = os.path.join(_get_store_root(), generated_guid, INI_FILENAME)
if os.path.isfile(store_path):
self.Path = os.path.dirname(store_path)
else:
#Bundle store
- bundle_path = os.path.join(__get_bundle_root(), generated_guid, INI_FILENAME)
+ bundle_path = os.path.join(_get_bundle_root(), generated_guid, INI_FILENAME)
if os.path.isfile(bundle_path):
self.Path = os.path.dirname(bundle_path)
else:
@@ -206,7 +216,7 @@ class TutorialBundler:
else:
#Create the folder, any failure will go through to the caller for now
- store_path = os.path.join(__get_store_root(), generated_guid)
+ store_path = os.path.join(_get_store_root(), generated_guid)
os.mkdir(store_path)
self.Path = store_path
@@ -262,8 +272,8 @@ class TutorialBundler:
more than one path, the store_root is given priority.
"""
- store_root = __get_store_root()
- bundle_root = __get_bundle_root()
+ store_root = _get_store_root()
+ bundle_root = _get_bundle_root()
config = SafeConfigParser()
path = None
@@ -327,7 +337,7 @@ class TutorialBundler:
save_fsm(fsm, xml_filename, store_root)
- def add_resources(self, typename, file):
+ def add_ressource(self, file):
"""
Add ressource in tutorial directory
return True if success or if file is already in tutorial directory