Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/pippy_app.py
diff options
context:
space:
mode:
authorGonzalo Odiard <godiard@gmail.com>2011-10-06 17:49:36 (GMT)
committer Rafael Ortiz <rafael@activitycentral.com>2011-10-06 17:55:30 (GMT)
commitd928b8d4695d82678e6a8c90d5836eea1a8548c6 (patch)
treedcec05276d261457442e70a932cf71bf3ff780ad /pippy_app.py
parent202fa19b3b629f41ab110ba0803a81a79d8af62d (diff)
Fix the load of already saved examples
The local examples are saved but are not loaded again when the activity starts. Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org> Signed-off-by: Rafael Ortiz <rafael@activitycentral.com>
Diffstat (limited to 'pippy_app.py')
-rw-r--r--pippy_app.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/pippy_app.py b/pippy_app.py
index 5ee8ff8..47618d1 100644
--- a/pippy_app.py
+++ b/pippy_app.py
@@ -226,12 +226,19 @@ class PippyActivity(ViewSourceActivity, groupthink.sugar_tools.GroupActivity):
self.model.set_value(_iter, 0, entry)
self.model.set_value(_iter, 1, entry["name"])
# Adding local examples
- #d = os.path.join(os.environ['SUGAR_ACTIVITY_ROOT'],'data')
+ root = os.path.join(os.environ['SUGAR_ACTIVITY_ROOT'],'data')
direntry_examples = { "name": _("My examples"),
- "path": os.path.join(root, d) + "/" }
+ "path": root + "/" }
self.example_iter = self.model.insert_before(None, None)
self.model.set_value(self.example_iter, 0, direntry_examples)
self.model.set_value(self.example_iter, 1, direntry_examples["name"])
+ for _file in sorted(os.listdir(root)):
+ file_name = os.path.join(root, _file)
+ if os.path.isfile(file_name):
+ entry = {"name": _file, "path": file_name}
+ _iter = self.model.insert_before(self.example_iter, None)
+ self.model.set_value(_iter, 0, entry)
+ self.model.set_value(_iter, 1, entry["name"])
treeview.expand_all()