[sugar] running the journal inside the shell process

Marco Pesenti Gritti mpgritti at gmail.com
Tue May 27 06:08:53 EDT 2008


Does the Journal need to be an activity at all?

Marco

On Tue, May 27, 2008 at 11:28 AM, Tomeu Vizoso <tomeu at tomeuvizoso.net> wrote:
> Hi,
>
> talking with Morgan about journal object transfer (see link below), he
> commented that if the journal was part of the shell, the invitations
> stuff would be easier to implement.
>
> http://wiki.laptop.org/go/Specifications/Object_Transfers
>
> The hack below almost works fine, there just seem to be a problem with
> the shell calling TakeScreenshot to itself...
>
> Any idea how this could be done in a more appropriate way?
>
> Thanks,
>
> Tomeu
>
> diff --git a/src/view/Shell.py b/src/view/Shell.py
> index f45923d..6befd91 100644
> --- a/src/view/Shell.py
> +++ b/src/view/Shell.py
> @@ -92,8 +92,19 @@ class Shell(gobject.GObject):
>         # Checking for the bundle existence will also ensure
>         # that the shell service is started up.
>         registry = activity.get_registry()
> -        if registry.get_activity('org.laptop.JournalActivity'):
> -            self.start_activity('org.laptop.JournalActivity')
> +        activity_info = registry.get_activity('org.laptop.JournalActivity')
> +        if activity_info is not None:
> +            import sys, os
> +            from sugar.activity.activityhandle import ActivityHandle
> +            from sugar.activity import activityfactory
> +            sys.path.insert(0, activity_info.path)
> +
> +            from journalactivity import JournalActivity
> +
> +            os.environ['SUGAR_BUNDLE_ID'] = 'org.laptop.JournalActivity'
> +            handle = ActivityHandle(activityfactory.create_activity_id())
> +            journal_activity = JournalActivity(handle)
> +            journal_activity.show_all()
>
>     def _activity_started_cb(self, home_model, home_activity):
>         activity_host = ActivityHost(home_activity)
> _______________________________________________
> Sugar mailing list
> Sugar at lists.laptop.org
> http://lists.laptop.org/listinfo/sugar
>


More information about the Sugar mailing list