[three]Bean

Querying Gnome-Shell Search Providers Over DBUS with Python

Oct 31, 2012 | categories: python, dbus, gnome, fedora View Comments

I'm working on a gnome-shell search provider to query the Fedora Packages webapp with the pkgwat python api.

In older versions of the gnome-shell, this used to be super simple -- you would just drop an XML file in /usr/share/gnome-shell/open-search-providers that defined a URL for where to search for stuff.

GNOME changed the way this all worked in gnome-shell 3.6 and you have to have an actual dbus service that returns results now. I haven't figured that part all out yet but I'm on the way.

Part of the first step was figuring out how the existing search providers worked, so I wrote this little python snippet to query the Documents search provider. Maybe you'll find it useful:

import dbus
import pprint

bus = dbus.SessionBus()
proxy = bus.get_object(
    # Query the Documents search provider...
    'org.gnome.Documents.SearchProvider',
    '/org/gnome/Documents/SearchProvider',

    # Or query my own search provider instead...
    #'org.fedoraproject.fedorapackages.search',
    #'/org/fedoraproject/fedorapackages/search',
)

# which interface do we make our calls against?
kw = dict(dbus_interface="org.gnome.Shell.SearchProvider")

# This is what we want to search our docs for
term = "aw"  # = "foobartest"

ids = proxy.GetInitialResultSet(term, **kw)

result = proxy.GetResultMetas(ids, **kw)
result = [dict(item) for item in result]

pprint.pprint(result)

J5's tool d-feet was indispensable in figuring this out. This dbus-python tutorial was super useful too.

For my own search provider, I forked lmacken's fedmsg-notify as a starting point. More on that later.

View Comments

fedmsg Middleware - Notifications in Every App?

Oct 29, 2012 | categories: python, fedmsg, fedora View Comments

I made this screencast demonstrating the concept of fedmsg middleware for notifications. "Inject a WebSocket connection on every page!"

As usual, if you want to get involved, hit me up in IRC on freenode in #fedora-apps -- I'm threebean there.

View Comments

The Moksha Demo Dashboard

Oct 25, 2012 | categories: python, moksha, fedora View Comments

Just writing to show off how easy it is to stand up the moksha demo dashboard these days (it used to be kind of tricky).

http://threebean.org/moksha-screenshot-2012-10-25.png

First, install some system dependencies if you don't already have them:

sudo yum install zeromq zeromq-devel python-virtualenvwrapper

Open two terminals. In the first one run:

mkvirtualenv demo-dashboard
pip install mdemos.server mdemos.menus mdemos.metrics
wget https://raw.github.com/mokshaproject/mdemos.server/master/development.ini
paster serve --reload development.ini

And in the second one run:

workon demo-dashboard
moksha-hub

"Easy." Point your browser at http://localhost:8080/ for action.

p.s. -- In other news, I got fedmsg working with zeromq-3.2 in our staging infrastructure yesterday. It required this patch to python-txzmq That one aside, python-zmq and php-zmq "just worked" in epel-test. If you're writing zeromq code, you probably want to read this porting guide.

View Comments

The first week of fedmsg events in datanommer's DB

Oct 16, 2012 | categories: fedmsg, datanommer, fedora View Comments

Last week we finally got datanommer working in our production environment. Originally ianweller's idea, it is a consumer that sits listening to the fedmsg bus and logs every event to a postgresql database.

It's nice to have in place now. With the data we can make more confident statements about what's happening on the bus... we can record a series of events from our production environment... play those back in staging for testing scenarios... and most importantly, we can make pretty graphs.

I made the following with the output of the datanommer-dump command and these scripts:

https://raw.github.com/ralphbean/datanommer/develop/tools/first-week-of-datanommer/activity.png

You can see the ups and downs of the day/night cycle and you can see activity dip on the weekend, too. Neat!

View Comments

busmon and Stack Overflow licensing.

Oct 05, 2012 | categories: fedmsg, busmon, fedora View Comments

Today, I was working on busmon and trying to minimize some of the spam it was publishing back to the fedmsg bus. This amounted to cutting out some server-side code that used pygments to produce styled html markup and replacing it with client-side code that did approximately the same thing.

@lmacken found this Stack Overflow piece that did just about what I needed. Like any reasonable person, I copied and pasted and was satisfied.

Licensing! Hold the phone! Turns out that content on Stack Overflow is licensed CC-BY-SA-3.0. By my reading, code posted there is therefore incompatible with GPL code.

Wild, right?

Denouement -> I ended up rewriting it my way just to get on with it.

View Comments

« Previous Page -- Next Page »