[sugar] Launching activities from other activities

Sayamindu Dasgupta sayamindu
Mon Oct 13 14:43:20 EDT 2008


On Mon, Oct 13, 2008 at 11:27 PM, Morgan Collett
<morgan.collett at gmail.com> wrote:
> On Mon, Oct 13, 2008 at 17:15, Sayamindu Dasgupta <sayamindu at gmail.com> wrote:
>> Hello,
>> What would be the best way to launch any activity from another
>> activity ? An example where this is required would be #8774 where
>> teachers from Uruguay are complaining that they are not being able to
>> directly open hyperlinks  embedded in PDFs from Read.
>> Ideally when the user clicks on the link, Browse should start and show
>> the relevant page.
>> I wrote a small utility called sugar-open yesterday, similar to
>> gnome-open and xdg-open, where you pass any uri to the tool, and it
>> will try to open it with the first relevant Activity it can find. I'm
>> planning to make Read invoke sugar-open and launch Browse if required.
>> Is there any better way to do this ?
>> Thanks,
>> Sayamindu
>
> Uruguay is currently using a pre-Rainbow build, so this should work.
>
> The alternative, under Rainbow, is to do what Chat does: create a
> journal entry with a mime-type of text/uri-list, and call
> show_object_in_journal to switch to the journal view of that object so
> it can be launched with a click:
> http://dev.laptop.org/git?p=chat-activity;a=blob;f=pippy_app.py#l512
>
> Hopefully Rainbow will grow a mechanism for activities to request it
> to launch other activities given certain restrictions.
>
> Regards
> Morgan
>

I did some experiments, and there's a way to launch stuff even under
rainbow (it's an ugly hack though).

You can install sugar-open from http://dev.laptop.org/ticket/8817 and use

os.system('sugar-open www.laptop.org')

from Read, for instance to launch Browse. (One needs to be careful
with the uri).

Cheers,
Sayamindu


-- 
Sayamindu Dasgupta
[http://sayamindu.randomink.org/ramblings]



More information about the Sugar-devel mailing list