[Sugar-devel] opening a url with WebActivity
Rafael Ortiz
rafael at activitycentral.com
Fri Aug 12 13:08:00 EDT 2011
On Fri, Aug 12, 2011 at 9:40 AM, Erik Blankinship <erikb at mediamods.com>wrote:
> I am trying to figure out how to open a URL in the browse activity from my
> own python sugar activity. What is the best way to do this?
>
> I was hacking around on an xo running 860, sugar 84)
>
> [1]
>
> import webbrowser
> webbrowser.open( "http;//google.com" )
>
> This launches firefox in its own floating window (which was an interesting
> thing to see in sugar, sort of like an easter egg).
> Is it easy for a pythonista to change this to opening WebActivity?
>
> [2]
> After some chat on IRC, I was able to hobble this together:
>
> bus = dbus.SessionBus()
> proxy = bus.get_object('org.laptop.Shell', '/org/laptop/Shell')
> path = dbus.Interface(proxy, 'org.laptop.Shell').GetBundlePath(
> 'org.laptop.WebActivity')
> activity = ActivityBundle(path)
> de_args = activityfactory.get_command(activity, None, None, "
> http://google.com")
> os.execvpe( de_args[0], de_args, activityfactory.get_environment(activity)
> )
>
> This opens a new instance of browse to the requested URL.
> But it skips the pulsating launch sequence, and seems to lock up the
> activity which launched it.
>
> If WebActivity is already running, is there a way to open a URL in that
> instance?
> If WebActivity is not already running, can it be launched normally (showing
> the pulsating icon)?
> How do I prevent locking up the activity which opened the URL?
>
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>
> FWIW you can take a look at the activity
http://activities.sugarlabs.org/en-US/sugar/addon/4455
It does open url's all over the interface.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20110812/f7ab9449/attachment.html>
More information about the Sugar-devel
mailing list