[Sugar-devel] launching a native python activity window from web activity

Gonzalo Odiard godiard at sugarlabs.org
Mon Apr 21 08:08:09 EDT 2014


Just note this is a hack.
The code in jarabe is not for use in activities, but is the best we can do
right now,
until
http://wiki.sugarlabs.org/go/Features/Start_activity_from_another_activity
is implemented.

Gonzalo


On Sat, Apr 19, 2014 at 7:39 PM, Sam Parkinson <sam.parkinson3 at gmail.com>wrote:

> Ah, the develop activity. It actually has a nice simple hack
>
>
>         from jarabe.model import bundleregistry
>         from sugar3.activity import activityfactory
>
>         registry = bundleregistry.get_registry()
>         bundle = registry.get_bundle(self.bundle.get_bundle_id())
>         activityfactory.create(bundle)
>
>
> But that is launching an activity from a python activity. Maybe you need
> to make some sort of shim for the web activity.
>
>
> On Sun, Apr 20, 2014 at 12:33 PM, Sebastian Silva <
> sebastian at fuentelibre.org> wrote:
>
>> Hi,
>> I haven't seen how it does it, but Develop Activity does launch the
>> active activity/project.
>>
>> I dunno if it's "clean", but it works!
>>
>> Regards,
>> Sebastian
>>
>> El sáb, 19 de abr 2014 a las 4:54 PM, Sam Parkinson <
>> sam.parkinson3 at gmail.com> escribió:
>>
>> Hi,
>>
>> Currently there is no clean way to launch any activity from inside any
>> other one!
>>
>> I think someone was working on an intents system, but I don't know the
>> status of that.
>>
>> Sam
>>
>>
>> On Sun, Apr 20, 2014 at 2:38 AM, Puneet Kaur <puneet.gkaur at gmail.com>wrote:
>>
>>> Hello all,
>>>
>>> I am trying to launch native activity from a webactivity , can you
>>> please let me know how it can be done ?
>>>
>>> I have made a small native python activity (here<https://github.com/puneetgkaur/pygame_camera>)
>>> {some basic gui toolbars yet to be included, just a gtk window with a
>>> webcam output as of now }
>>>
>>> I have put the activity code in
>>> /home/puneet/sugar-build/build/out/install/lib/python2.7/site-packages, so
>>> that it can accessible by other python classes
>>>
>>> Have imported this class in apisocket.py, where I try to launch activity
>>> by calling :
>>>
>>> python_activity_class_name(self._activity)
>>>
>>>
>>> The code can reach the python class from javascript but is not able to
>>> launch the window.
>>>
>>> It gives the error :
>>>
>>> Traceback (most recent call last):
>>>   File "build/bdist.linux-i686/egg/gwebsockets/server.py", line 127, in
>>> _message_write_cb
>>> gi._glib.GError: Error sending data: Broken pipe
>>> 1397922466.607808 ERROR root: No activities are running
>>> 1397922466.609076 WARNING root: icon_size is deprecated. Use pixel_size
>>> instead.
>>> Window manager warning: CurrentTime used to choose focus window; focus
>>> window may not be correct.
>>> Window manager warning: Got a request to focus 0x6000ee (main.py) with a
>>> timestamp of 0.  This shouldn't happen!
>>> Window manager warning: CurrentTime used to choose focus window; focus
>>> window may not be correct.
>>> Window manager warning: Got a request to focus the no_focus_window with
>>> a timestamp of 0.  This shouldn't happen!
>>>
>>> So the strategy behind the methodology is to pass on the control from
>>> the webactivity to the python activity and then back from python activity
>>> to webactivity when the user clicks to capture
>>>
>>> But the issue is that probably we are not allowed to to launch another
>>> activity while in webactivity, is that true ?
>>>
>>> does someone has a few ideas as to how it can be done ?
>>>
>>>
>>>
>>> _______________________________________________
>>> Sugar-devel mailing list
>>> Sugar-devel at lists.sugarlabs.org
>>> http://lists.sugarlabs.org/listinfo/sugar-devel
>>>
>>>
>>
>
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>
>


-- 
Gonzalo Odiard

SugarLabs - Software for children learning
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20140421/1b2a7e6e/attachment.html>


More information about the Sugar-devel mailing list