Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/sugar/tutorius/bundler.py
diff options
context:
space:
mode:
authorcharles <iso.swiffer@gmail.com>2009-04-16 19:48:58 (GMT)
committer charles <iso.swiffer@gmail.com>2009-04-16 19:48:58 (GMT)
commit1d61b35afdab7806ceb608c1c6fad10e696efe98 (patch)
treea78da8b604e871c262c40d9d42519ed8ab0a0cf3 /src/sugar/tutorius/bundler.py
parentf02b9202add548f259f4d05b7edb2d39a9206b2a (diff)
changes to compile and run
Diffstat (limited to 'src/sugar/tutorius/bundler.py')
-rw-r--r--src/sugar/tutorius/bundler.py36
1 files changed, 23 insertions, 13 deletions
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