← Back to team overview

unity-dev team mailing list archive

Re: python lens question

 

On 05/04/2012 03:48 AM, Sean Dague wrote:
I'm working on a python lens for Unity in 12.04 for pidgin. The idea
being that online buddies are searchable and by activating them a window
will pop up to message them. I've got the search part of the scope
pretty well under control, nice list of users with their buddy icons
displayed, thanks to reading some of the one hundred scopes project.
Most of this is communicating to pidgin over dbus, with a little
cheating and looking through the xml file for icon file names.

The part that I don't know how to do is catch the click/activate signal
when the item is selected. Unlike most of the lenses, which are serving
up a file or url, there isn't a url for openning a message to a buddy.
However, if I can capture that event in any way, I can open the message
window via a dbus call to pidgin.

This is definitely possible. You need to connect to the "activate-uri" signal on your Unity.Scope object (http://developer.ubuntu.com/api/ubuntu-12.04/python/Unity-5.0.html#Unity.Scope).

Then do what you must with the passed in URI and return Unity.ActivationResponse.new (Unity.HandledType.HIDE_DASH, uri).

You can check unity-lens-bliss, which does something similar except it uses SHOW_DASH, to create a browsing experience in the dash, where you can browse into app categories. See http://bazaar.launchpad.net/~unity-team/unity-lens-bliss/trunk/view/head:/bliss/apps.py#L91

Good luck!

Cheers,
Mikkel


Follow ups

References