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

Sam Parkinson sam.parkinson3 at gmail.com
Sat Apr 19 22:39:53 EDT 2014


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
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20140420/b675d8af/attachment-0001.html>


More information about the Sugar-devel mailing list