Sunday, July 26, 2009

Writing Sugar activities with PyQt

At David Boddie's suggestion, have dedicated part of this weekend to explore how well PyQt can be used to write Sugar activities. The results have been very satisfying, I would say thanks to python's flexibility and to the Sugar activity architecture, an excellent work of Marco Pesenti Gritti.

So I got something that looks and behaves similarly to activities compliant to the Sugar Human Interface Guidelines, with the following exceptions:

* No combobox for selecting the sharing mode.

* Some theme quirks were fixed with a custom stylesheet, I think these should be treated as bugs in either QGtkStyle or the Sugar Gtk theme. Or if QGtkStyle is not up to this job, we would need to implement a new QStyle. Couldn't workaround all of the issues in the stylesheet.

* No palettes at all. Hope implementing them in Qt will be much less work than it has been in Gtk+.

* The XCursor theme is not picked up, need to investigate further.

* Some Gtk stuff is still used, I think PyQt activities shouldn't use Gtk+ at all for better memory usage and startup performance.

Good news is that I have reimplemented good part of the activity API in PyQt quite quickly, but we may want to design a better API learning from the mistakes of the past.

Now, let's let the Sugar platform get flooded of KDE Edu activities :)

Update:

Code: http://git.sugarlabs.org/projects/hellow-world-qt/repos/mainline

Screenshot:

2 comments:

  1. Could we please get a screenshot?

    I assume that gobject stuff (barring gtk) should not be a problem to use with PyQt activities, since Qt uses the glib event loop.

    ReplyDelete
  2. I don't remember making any direct suggestions - I was probably just rambling - but the result looks good, anyway!

    Did the PyQt activity take much longer to start up than other existing activities?

    ReplyDelete