this space intentionally left blank

February 5, 2009

Filed under: tech»mobile

make -widget

When people talk about scripting on S60 (and you know what a hot topic that is), they usually mean Python. But there are actually two scripting engines on the platform: in addition to PyS60, there's also a Webkit-based widget engine for building apps in Javascript with some hooks into device functionality. Widgets have to be compiled into a .zip-based format, though, which means that (for me, at least) the whole appeal of a scripting language--the ability to cobble together quick solutions on the fly--is basically lost.

That said, I do like Javascript, particularly as a "scratch pad" kind of language. And the .wgz files used to install these apps can be created on a phone, using the Zip Manager program and a decent file manager. It's just a pain, during each "recompile," to delete the old .wgz, create a new .zip, add the project files, close it, change the extension, and run it again. Exactly the kind of thing, actually, that Python could easily automate.

In that spirit, is a kind of compiler script for generating Web Runtime widgets on S60. It takes care of archiving (hopefully with the right structure), renaming, and even runs the installer file for you. This should take a lot of the pain out of creating widgets on the phone itself. It's not flashy, but it's fast and can be run repeatedly with minimum hassle--I thought about adding a GUI, but I thought for the intended audience streamlined execution was probably a lot more important.

To set it up, you'll need to create a directory containing the widget project as detailed in the WRT development guide, including an info.plist XML manifest for the application. Next, edit the wgzPackager script to point it toward this directory: the relevant variables are dirString and wgzString, with the former being the directory above your project, and the latter being the project name itself. So, for example, I keep my projects in 'e:\\documents\\wrtdev\\' (the backslashes are doubled because they have to be escaped), with a subfolder of 'AppName' for each application.

I hope somebody finds this useful, but to be honest, I'm ambivalent about widget programming on mobile. It still strikes me as too limited, too slow, and too resource-hungry to be enjoyable. On the other hand, I recently started looking through Symbian C++, and that's a nightmare: oddities like two-phase constructors and the weird garbage collection stack mean that it's hardly in a good position to foster developer interest in the platform. And since, as far as I can tell, S60 is the smartphone platform with the greatest amount of flexibility and software freedom, having good developer support is important. I'm hoping that Nokia's upcoming port of Qt for S60 development will change things, by eliminating a lot of the weirdness and giving it a strong foundation for moving forward. In the meantime, if Python's not your thing, I guess widgets are the way to go.

Future - Present - Past