views:

280

answers:

3

I am a linux (mostly ubuntu) user with a reasonable understanding of how the system works (although I am certainly not a linux guru!). In the past I have developed small cross-platform desktop applications in python/GTK and I delivered them to clients as self-contained filetrees, so that the only dependencies were Python itself and GTK.

Now I would like to develop a small applet for ubuntu, that I would like to release under GPL 2 or 3.

In particular these are the new steps I know I must learn in order to achieve my goal (it is very possible there are a few more that I am unaware of, though!):

  • Integrating with gnome: I want my application to be available as an applet in the taskbar.
  • Using D-bus: In particular I want my applet to use the new osd-notification framework for ubuntu, but communication with other applets is also a possible feature for a second iteration.
  • Packaging: I would like to setup a public PPA as soon as the application will reach alpha stage, but I also would like to use dependencies from existing packages in the official repos, rather than include the libraries again in my own package.

Of course official documentation will be my first source of knowledge, but - basing my judgment on the very useful answers that I received on another topic here on SO - I decided to turn to the SO community to collect additional advice like for example:

  1. Are there additional steps to those I outlined before, that I have to learn in order to be able to implement my project?
  2. Based on your own experience, would you advise me to learn those steps in advance (as the knowledge of those will influence my way of coding the core functionality) or would you consider integration with gnome / d-bus and packaging as "higher encapsulating levels" that can be added on top of core functionality afterwards (note: D-bus will be used at first just for pushing data. Input data will be retrieved with a webservice)?
  3. Would you advise me to separate my application in two packages (back-end and front-end) or to keep it together in a single package?,
  4. Do you know of any useful resource that you would advise me to look at, for learning any of the things that I have to?
  5. Are you aware of any common "beginner's mistakes" that I should be aware of?

These questions are not meant to be exhaustive, though: if you feel that I am missing something from the general picture, you are more than welcomed to point me in the right direction!

Thank you in advance for your time!

PS: Should I have failed in explaining my final goal, take a look at project hamster: what I want to achieve is similar in terms of user interface (meaning: the applet should display the status and clicking on it should open the application itself, from which you could both configure the applet and perform various operations).

+2  A: 

Well, you list python, so you'll want to have pynotify in your arsenal. It wraps DBus, and gives you a direct api for manipulating the osd-notification system.

>>> import pynotify
>>> pynotify.init("Lil' Applet")
True
>>> note = pynotify.Notification(
...            pynotify.get_app_name(), 
...            "Lil' Applet wants you to know something's up.", 
...            "/usr/share/icons/Human/48x48/status/dialog-information.png")
>>> note.show()
True

This displays a notification that looks like this:

[    ] **Lil' Applet**
[ICON]
[    ] Lil' Applet wants you to know something's up.
jcdyer
there is bit of difference between a notification pop-up and a fully fledged application that appears in panel
tm_lv
I'm well aware of that. I'm only proposing this as part of your solution. Hence "you'll want to have pynotify in your arsenal." I figured other people could chime in with other pieces of the puzzle.
jcdyer
Thanks for this (+1). I imagined it would have been something dramatically more complex... but hey... this seems to work out of the box!. That was definitively useful. :)
mac
+2  A: 

As you already know, your first and best friend will be the code written by others - copy, paste, dissect, understand. Luckily there are a few projects that do what you intend to achieve. I can recommend conduit's code as a prime reference how to do things in a clean fashion. I think they also have stuff on dbus. Others to keep an eye on, would be deskbar-applet, hamster (heh), and any other app you remember having feature X. Sometimes it might require some C code deciphering though (like the applet button bit - i suggest you better take it from hamster as i was having some major time getting the thing straight)

Then the "devhelp" app will be of great assistance - it allows you to read and search in man pages fast and easy. Make sure that you also have the -doc packages for all the modules you intend to use. For user interface i strongly suggest using glade, as that will allow you to change interface later much easier. Where you can't use glade - add and alignment box and add the widget in the box in the code. There certainly will be quirks and things that you will learn the hard way. Should not be too hard though!

The packaging, especially the autotools will be bit of a struggle, but you will get it right. For how to do debians (and from there to PPA), you can dig in the hamster's repository history. There was once a "debian" folder.

I would suggest to start small - see if you can get a window. Then put a button on it. You don't have to do it "right" the first time. For first time it will be ok, if something works at all.

As for the separation - i would not bother about it until you get there. Splitting up into two parts and have a core, should not be too hard later. But that all depends on your priorities.

Last thing - getting friends who know the field helps too. And one way to get new friends, is by taking part in other projects, heh.

tm_lv
Thanks for the various recommendations (+1). Glade and devhelp are well under the belt since my first project, actually but it is very helpful to have some pointer to some good code to look at.
mac
+1  A: 

There are some very good recommendations here already, but let me suggest that you develop your applet not so much "for Ubuntu" as "for Gnome". It doesn't take much extra effort to also make RPM packages for distributions such as Fedora, and Arch Linux packages, to name two examples. There is one major disadvantage though -- to stay compatible with Debian stable you have to stick to ancient versions of GTK and GLib, or at least make any functionality depending on newer versions optional. It's painful, but apparently Debian stable users appreciate it.

I'd also suggest setting up a source code management system somewhere as early as possible. You may not be worried about your disk crashing, but sometimes it saves you a lot of trouble just to be able to revert everything you did since the last commit.

Here's the link to the documentation on the official Gnome Panel Applet library. I don't know if it has Python bindings or not.

ptomato
Very helpful, thank you! (+1). I believe the bindings for python of the library you sent to me are in the `python-gnomeapplet` package. Versioning System is always up and running (I use mainly bazaar). I have an additional question, if you don't mind: can you give me some pointer on how packaging for other distros from within another distros (in case this is possible at all)? Thanks!
mac
It's theoretically possible, but I wouldn't trust "cross-packaged" packages. The best thing to do in my opinion is install the distribution you want to package for on a virtual machine (if you have a reasonably fast system) or on a dual-boot partition (if you don't). KVM worked right out of the box for me.
ptomato