Friday, January 18, 2008

Portable UI

For many years, I've been looking for a way to write portable applications with a nice, responsive user interface. Many have tried and many have failed:

  • Python with tcl/tk - A nice experience from the developer side. The Python wrapper around the tk widget set shows how you can get compact, yet easy understandable code and write UI's in short time. If it just weren't that ugly ...
  • Java with Swing - Swing borrows a lot from X11, the grandfather of all graphical desktops. I have yet to see anyone managing to impress the world with their grandfather ...
  • Java with SWT - Now, here comes a contender. Java is pretty widely available (not quite as many platforms as Python, but still), it is pretty fast, okay, the download is a bit on the big side ... but no DLL hell, easy to setup (especially if you don't provide an installer and just push a ZIP out). SWT is nice, fast ... and bare bones. MFC? Well, they have JFace and in a few years, there might even be a text editing component that can do word wrap and still show line numbers. Oh, and SWT is available on even fewer platforms than Java. Palm, anyone?
  • HTML - Web based apps are all the hype. If you want to use your app on the run, it gets tricky. I don't know about the US, but here in Europe, going online with you mobile will ruin you. Literally. Also, I've had my struggles with HTML and CSS and I can do without. Either and both.

I've tried a few more but in the end, things never felt right. Until recently. I'm a big fan of treeline. Treeline uses Python and PyQt which wraps Qt (say: "cute"). Qt is a mature framework, currently at version 4.3.3, with 4.4 is around the corner. It doesn't have all the nifty stuff I can imagine (like an RTF editor; QTextEdit can only do a (big) fraction of that) but it gets closer to what I want than anything else.

In the past two weeks, I wrote a little clone of yWriter4. The little baby has currently about 8000 loc and about half of the functionality I want to give it (especially the text editing is still leaving a lot to be desired). Except for two bugs (signal names and GC issues), it's been a real pleasure to use. I managed to implement almost every feature within a few minutes or few hours (the storyboard took 6 hours, the scene chart view took two), also thanks to the good defaults of the framework. Here is an impression of v0.2:

So when you're considering to write a small to medium sized application which needs to run on Windows, Linux and MacOS, give PyQt a try.

No comments: