On Thu, Oct 6, 2011 at 12:49 PM, <span dir="ltr"><<a href="mailto:godiard@sugarlabs.org">godiard@sugarlabs.org</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
From: Gonzalo Odiard <<a href="mailto:godiard@gmail.com">godiard@gmail.com</a>><br>
<br>
The local examples are saved but are not loaded again when the activity starts.<br>
<br>
Signed-off-by: Gonzalo Odiard <<a href="mailto:gonzalo@laptop.org">gonzalo@laptop.org</a>><br>
---<br>
pippy_app.py | 11 +++++++++--<br>
1 files changed, 9 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/pippy_app.py b/pippy_app.py<br>
index 3a0317d..909512f 100644<br>
--- a/pippy_app.py<br>
+++ b/pippy_app.py<br>
@@ -222,12 +222,19 @@ class PippyActivity(ViewSourceActivity, groupthink.sugar_tools.GroupActivity):<br>
self.model.set_value(_iter, 0, entry)<br>
self.model.set_value(_iter, 1, entry["name"])<br>
# Adding local examples<br>
- #d = os.path.join(os.environ['SUGAR_ACTIVITY_ROOT'],'data')<br>
+ root = os.path.join(os.environ['SUGAR_ACTIVITY_ROOT'],'data')<br>
direntry_examples = { "name": _("My examples"),<br>
- "path": os.path.join(root, d) + "/" }<br>
+ "path": root + "/" }<br>
self.example_iter = self.model.insert_before(None, None)<br>
self.model.set_value(self.example_iter, 0, direntry_examples)<br>
self.model.set_value(self.example_iter, 1, direntry_examples["name"])<br>
+ for _file in sorted(os.listdir(root)):<br>
+ file_name = os.path.join(root, _file)<br>
+ if os.path.isfile(file_name):<br>
+ entry = {"name": _file, "path": file_name}<br>
+ _iter = self.model.insert_before(self.example_iter, None)<br>
+ self.model.set_value(_iter, 0, entry)<br>
+ self.model.set_value(_iter, 1, entry["name"])<br>
<br>
treeview.expand_all()<br>
<font color="#888888"><br>
--<br>
1.7.4.4<br>
<br>
_______________________________________________<br>
Sugar-devel mailing list<br>
<a href="mailto:Sugar-devel@lists.sugarlabs.org">Sugar-devel@lists.sugarlabs.org</a><br>
<a href="http://lists.sugarlabs.org/listinfo/sugar-devel" target="_blank">http://lists.sugarlabs.org/listinfo/sugar-devel</a><br>
</font></blockquote></div><div><br></div>Thanks! Pushed as<div><br></div><div><meta http-equiv="content-type" content="text/html; charset=utf-8"><meta http-equiv="content-type" content="text/html; charset=utf-8"><a href="http://git.sugarlabs.org/pippy/mainline/commit/d928b8d4695d82678e6a8c90d5836eea1a8548c6">http://git.sugarlabs.org/pippy/mainline/commit/d928b8d4695d82678e6a8c90d5836eea1a8548c6</a></div>
<div><br></div><div><br></div><div>Cheers.</div>