[Sugar-devel] [PATCH Pippy] Fix the load of already saved examples

Rafael Ortiz rafael at activitycentral.com
Thu Oct 6 14:01:35 EDT 2011


On Thu, Oct 6, 2011 at 12:49 PM, <godiard at sugarlabs.org> wrote:

> From: Gonzalo Odiard <godiard at gmail.com>
>
> The local examples are saved but are not loaded again when the activity
> starts.
>
> Signed-off-by: Gonzalo Odiard <gonzalo at laptop.org>
> ---
>  pippy_app.py |   11 +++++++++--
>  1 files changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/pippy_app.py b/pippy_app.py
> index 3a0317d..909512f 100644
> --- a/pippy_app.py
> +++ b/pippy_app.py
> @@ -222,12 +222,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()
>
> --
> 1.7.4.4
>
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>

Thanks! Pushed as

http://git.sugarlabs.org/pippy/mainline/commit/d928b8d4695d82678e6a8c90d5836eea1a8548c6


Cheers.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20111006/3934a4ad/attachment.html>


More information about the Sugar-devel mailing list