Ubuntu – Developing Unity compliant apps in Python – where to start


I'm an experienced programmer who is interested in developing apps for Linux, specifically GTK, and more specifically apps that are Unity compliant. Aside from the obvious step of learning Python, what's the best way to learn things like:

  • How to develop a GUI interface (probably using Glade)? Are there any good Glade2 tutorials?
  • Where are the Unity specific API calls? (such as putting a notification icon on the top panel, and using "badges" on the launch icons (a la Unity Mail's message count).

Also, are there any good Python IDEs that are similar to Xcode or Visual Studio, where you can design your interface, and then double click on buttons and widgets to tie code to them?

Thanks for any help.

Best Answer

Good question.

First of all, the appindicators are not Unity specific in any way. Actually, they run just as well on Xfce or KDE. It's very, very, simple to use. You'll create an indicator object, set the name of icons to use when it needs attention, etc, and simply attach menus to it. The indicators are then sent over dbus and properly displayed in a manner suitable for the current desktop environment. In Unity, Gnome Shell, Xfce and LXDE, it'll be displayed as GTK menus, and in KDE it'll be displayed as Qt menus, etc. Very neat. You can find more information about it here: http://unity.ubuntu.com/projects/appindicators/

In the right pane of Glade, you have a Signals page under Properties. Here you can simply type the name of the method to use as handler for that signal. In your code, you'll just create a gtk.Builder object, load the XML that Glade produces and use the gtk.Builder.connect_signals method to connect all your signals to their methods. This means you can use Glade interfaces in almost any programming language. Since that is so easy, and since languages are different by nature, it makes little sense to add coding to Glade itself. For coding Python (and other languages), I will recommend having a look at Geany ( http://apt.ubuntu.com/p/geany). It is a very good editor/IDE.

Other things in Unity are so new, there is little documentation, except as code examples. Some of the APIs are just now becoming stable, such as for Scopes and Lenses, which weren't even called that a little while ago. As a beginner, I'd wait a little bit before looking into those things.

The entries on the launcher, are actually just referred to as LauncherEntry in code, and it can use a progress bar, a counter and QuickLists. I haven't actually coded that myself, but this page has an example and it seems very easy, like the rest of the Unity APIs: http://bazaar.launchpad.net/~unity-team/libunity/trunk/view/head:/examples/launcher.py

Related Question