Random notes from mg

a blog by Marius Gedminas

Marius is a Python hacker. He works for Programmers of Vilnius, a small Python/Zope 3 startup. He has a personal home page at http://gedmin.as. His email is marius@gedmin.as. He does not like spam, but is not afraid of it.

Wed, 12 Oct 2011

N9 Hackathon in Vienna

Last weekend I attended the N9 Hackathon in Vienna. Nokia kindly sponsored all food and accommodation costs and, at the very end, surprised me with an entirely unexpected gift of a N9 phone.

Vienna: great transportation system, delicious food (either that, or I was always extremely hungry when I ate), huge portions, restaurants open until midnight. Shame I didn't have time to see the city itself.

The N9 is a gorgeous phone; much more so in real life than in pictures.

After some hassle upgrading the Qt SDK (the provided upgrade tool managed to somehow remove the Qt Creator IDE while purporting to upgrade it; I had to reinstall the entire SDK) and flashing my N950 with Beta 2 firmware (Qt SDK 1.1.3 produces apps incompatible with the old Beta 1 firmware of the N950) I started prototyping a time tracking application in QML, while learning QML and the N9 design guidelines at the same time.

Converting the pretty pictures into QML was harder than I expected, but at the end of the second day I had something that looked like a native N9 application.

screenshot of the prototype

Most useful reference pages were:

Finally, workflow. QML is parsed at run time (application startup time, unless you delay the loading), which means no recompilation ought to be required to make changes, which means short development feedback cycles ought to be possible. So I was not happy about having to wait several seconds after hitting Run in Qt Creator, while it built a .deb, copied it to the device over wifi or USB networking, installed and ran it there. Deploying to the Qt Simulator is quicker, but not as much as I think it ought to be. Plus, the Qt Simulator apparently cannot simulate the landscape mode of the N9, and it lies about the default font size of QML Text elements (if you do not specify a pixelSize, text elements will look all right in the simulator, but ridiculously tiny on the N9).

In the end I cobbled up a shell script that rsyncs my updated QML files to the device and runs a short Python script (over ssh) to launch them. You need rsync and PySide installed on the device for this, obviously, as well as having SSH set up for passwordless logins. As a bonus, I can now do QML development during lunch, directly on the device, with vim, enjoying proper syntax highlighting. :)

Oh, and my code is up on Github.

posted at 14:25 | tags: , | permanent link to this entry | 4 comments
Nice scripts, thanks for sharing them. I was too lazy to do it myself, but been meaning to do that for a long time.
posted by urho konttori at Thu Oct 13 23:13:43 2011
Incidentally there are a few tricky things about the scripts, learned through trial and error:

* the signal thing in the Python script to let me quit the app with Ctrl-C

* the -t flag passed to ssh so that Ctrl-C kills the app instead of leaving it in the background

* the 'source ~/.profile' thing so that DISPLAY and other environment variables are set up right and the app can work when started over ssh

The hostname 'mg-n950' was hardcoded to in my /etc/hosts for USB connectivity during the hackathon; at home I set up my router to hand out fixed DHCP addresses with that name for that particular MAC address.
posted by Marius Gedminas at Fri Oct 14 13:51:04 2011
Oh, actually I shouldn't claim trial-and-error credit for the Python signal thing; that was entirely thanks to StackOverflow: http://stackoverflow.com/questions/4938723/what-is-the-correct-way-to-make-my-pyqt-application-quit-when-killed-from-the-con
posted by Marius Gedminas at Fri Oct 14 13:53:19 2011
This is nice :D

would love to see some1 hacking the FM receiver/transmitter ")

adding antenna maybe lol
posted by et3rnal at Tue Oct 18 06:40:43 2011

Name (required)

E-mail (will not be shown)


Comment (some HTML allowed)