[Sugar-devel] Regarding opening one Sugar activity from inside another

James Cameron quozl at laptop.org
Tue Jun 4 04:13:36 EDT 2019


I'm only speculating, so you'll need to test and evaluate.

launch_bundle does not take arguments for the activity, so Browse
won't know to open the URL.

Perhaps you should do something like this;

1.  create a Journal object in the datastore,

2.  set the metadata mime_type to text/uri-list,

3.  write a single URL to the object,

4.  call launch_bundle passing the uid of the Journal object,

To evaluate my speculation, please review source code;

https://github.com/sugarlabs/browse-activity/blob/master/activity/activity.info#L7
tells Sugar that the Browse activity is capable of opening any Journal
object with the mime_type of text/uri-list.

https://github.com/sugarlabs/browse-activity/blob/master/webactivity.py#L350
shows how the Browse activity will react when read_file reads a
Journal object of that mime_type.

https://developer.sugarlabs.org/sugar3/sugar3.datastore.datastore.html
describes the Journal datastore API for activities.

https://github.com/sugarlabs/sugar/blob/master/src/jarabe/journal/misc.py#L242
shows how the Journal activity can start a Journal object that isn't
an activity bundle.

https://github.com/sugarlabs/get-books-activity/blob/master/GetIABooksActivity.py#L643
shows how the Get Books activity may start Read or Browse given a
selected downloaded book.  Follow the code path down from this point,
and you'll see it call launch_bundle.

On Mon, Jun 03, 2019 at 06:32:40PM +0530, Swarup N wrote:
> Hello,
> Thank you for your response. I was able to use [1]
> sugar3.activity.activity.launch_bundle to make progress.
> 
> I was trying to call Browse-activity from Terminal-activity, in an attempt to
> implement the URL+click feature in the Terminal-activity-emulator.
> After writing my first patch I realised that my code is not calling any
> instance of 'Browse-activity' anywhere, nor there seems to be any instance of
> it. I was wondering if the community to could guide me in the process of making
> the right import instances and API calls.
> 
> Thanks and Regards,
> Swarup- N
> 
> References:
> 
> [1] https://developer.sugarlabs.org/sugar3/sugar3.activity.activity.html#sugar3.activity.activity.launch_bundle

-- 
James Cameron
http://quozl.netrek.org/


More information about the Sugar-devel mailing list