Introducing LibreOffice integration with Unity’s Application Menubar

Canonical has kindly sponsored some of my time at Codethink to bring one of the major missing pieces of the Unity user experience in Ubuntu. As you may know the Unity features a global menubar for applications. Integration with standard Gtk+ applications and Firefox/Thunderbird is already in place.

 

 

LibreOffice is the default office suite for Ubuntu 11.04 and its menus were not shown on the Application Menubar… until now:

I just rolled the first release. It has plenty of bugs and memory leaks, and kenvandine just told me it crashes on 64bits, but it's a start and the basic info publishing and command dispatching is there.

I expect to get it into shape in the upcoming weeks. I'm focusing on avoiding memory leaks and covering some corner cases with window handling at this point. Then I'll take care of shortcuts and getting some missing information of each item.

Hacking with UNO has been… interesting… the one good thing is that pretty much everything is either documented or there's some code around to look at. I had some deja vu moments when I worked on StarOffice/OpenOffice.org and Firefox extensions for APOC. Thanks god for Google Codesearch.

I also hope this code becomes useful for environments other than Unity such as GNOME Shell. If you have any questions about it just ask!

Python JPath

A while ago I spent some time hacking on a little python library to query JSON or YAML objects paths using a language inspired in XPathPython JPath. I thought it could be useful to share it with people out there.

This allows for simple access to elements included in repetitive structures such as twitter feeds. I have very basic support for the language implemented (as I only need a few features).

Here's a little example of how it works:

a = {'a': [{'b': {'x': {'x': {'x': True}}}},{'b': True, 'a': False},{'b': "foo"}]}

BaseQuery ('/a/*/*').execute (a)    

This snippet executes the /a/*/* query (all childs of all childs of the value stored in the 'a' key of the root object) and returns a list of all matches:

[{'x': {'x': {'x': True}}}, False, True, 'foo']

I do not intend to do a 1-1 match of all the XPath language, only pick the features that makes sense in the JSON/YAML context. The project is hosted in github, merge requests are welcome!