PyMaemo/GUI toolkit selection guide

(PySide)
(PyQt)
Line 39: Line 39:
=== PyQt ===
=== PyQt ===
-
[http://www.riverbankcomputing.co.uk/software/pyqt/intro PyQt] is a Python binding for the Qt framework, developed by Riverbank Computing Ltd. It is a very established and stable set of bindings and widely used in the desktop world. On Maemo 5, it is maintained as a community effort. PyQt on Maemo 5 currently provides support for Qt 4.5 (which is shipped with the release firmware), without the Maemo-specific classes. Qt 4.6 support is already present in source, and the corresponding binary packages will be released in sync with the official PyQt release. It is licensed under GPL, allowing only GPL software development. (It is also possible to purchase commercial licenses for proprietary software development, but on Maemo this would be hardly practical.) While new PyQt-compatible bindings can be created using [http://directory.fsf.org/project/Python-SIP/ SIP], no freely available automatic binding generation tools exist, making independent generation of bindings for large libraries impractical.
+
[http://www.riverbankcomputing.co.uk/software/pyqt/intro PyQt] is a Python binding for the Qt framework, developed by Riverbank Computing Ltd. It is a very established and stable set of bindings and widely used in the desktop world. On Maemo 5, it is maintained as a community effort. PyQt on Maemo 5 currently provides support for Qt 4.5 (which is shipped with the release firmware), without the Maemo-specific classes. Qt 4.6 support is already present in source, and the corresponding binary packages will be released in sync with the official PyQt release. It is licensed under GPL for Open Source projects, but a commercial license can be obtained from Riverbank for proprietary development. While new PyQt-compatible bindings can be created using [http://directory.fsf.org/project/Python-SIP/ SIP], no freely available automatic binding generation tools exist, making independent generation of bindings for large libraries impractical.
PyQt cannot be intermixed with the future Maemo 6 platform API bindings created using PySide.
PyQt cannot be intermixed with the future Maemo 6 platform API bindings created using PySide.

Revision as of 16:14, 8 January 2010

Contents

Introduction

This page describes the alternative toolkits with which graphical user interfaces can be created in PyMaemo. Their respective differences and future prospects are discussed to help any new PyMaemo developers make an informed technology selection.

In particular, the differences of GTK+ and Qt toolkits are described, as well as the roles of the PySide and PyQt Qt binding projects.

GTK+-based toolkits

GTK+ is a widget toolkit for creating graphical user interfaces. While written in the C programming language, it is object oriented. Object orientation is achieved by using the Glib object system (GObject). In the open source community, Gtk+ is most notably used in the GNOME project.

Hildon is an application framework developed by Nokia for the Maemo operating system. It primarily consists of a set of GTK+ extensions providing mobile device oriented functionality and a finger-friendly interface. It has been the primary graphical toolkit in Maemo devices until Maemo 5.

Python Hildon

Python Hildon is the Python language wrapper around the Hildon framework, allowing Python developers to use Hildon in Python programs. It depends on PyGtk for creating graphical user interfaces.

Python Hildon has been available for many years and has been updated to support the features of the Maemo 5 platform. The bindings are stable and widely used in the Maemo developer community.

If you plan to start developing software for Nokia N900 (Maemo 5) only, Python Hildon is probably the most straightforward selection. However, as the level of GTK+ and Hildon support in Maemo 6 is still unknown (it will probably be community-supported only), it might provide for a more difficult upgrade path in the future Maemo platform versions.

Qt-based toolkits

Qt, developed by Nokia's Qt Development Frameworks division, is an application development framework consisting of a comprehensive set of GUI widgets as well as non-GUI functionality such as network support, thread management, XML parsing, and so on. Qt is written in C++. KDE is the most significant project in the open source community using Qt.

The future Maemo platforms will be based on the Qt framework. The native GUI widget set will be DirectUI which is not part of Qt but will be derived from QGraphicsView. In a similar manner, the platform APIs (Maemo API) will be heavily based on Qt principles, providing Qt-like class hierarchies for different functionalities.

Any native Qt application written for Maemo 5 adopts the platform's native look and feel. Furthermore, these applications will be at least source-level compatible with Maemo 6 and will adopt its look and feel accordingly. Hence, Qt is the best selection as a toolkit if you want to future-proof your application.

PySide

PySide is a Python binding for the Qt framework, developed by Nokia at OpenBossa by the same team as PyMaemo itself. It was initially published in August 2009 and, on the Maemo 5 platform, provides full-featured bindings for Qt 4.6 (including the Maemo-specific QMaemo5 classes). PySide is licensed under LGPL, allowing both open source and proprietary software development. The generator tools for creating new bindings are also available, allowing developers to rapidly create new bindings if required.

The PyMaemo team will provide the bindings for Maemo 6 platform APIs (DirectUI, Maemo API) using PySide.

Currently, the disk and memory footprint of PySide is still somewhat larger than PyQt (although the run-time performance is at least on par). This issue will be solved in March 2010 when the new binding architecture, Shiboken, will replace the current Boost.Python based implementation. Also, since PySide is a relatively young project, it is still more buggy than PyQt.

If your project requires Maemo-specific Qt extensions or Qt 4.6 features and you don't mind the temporary memory impact of PySide and want your application to work as is in the future Maemo platforms, PySide is the best choice for you.

PyQt

PyQt is a Python binding for the Qt framework, developed by Riverbank Computing Ltd. It is a very established and stable set of bindings and widely used in the desktop world. On Maemo 5, it is maintained as a community effort. PyQt on Maemo 5 currently provides support for Qt 4.5 (which is shipped with the release firmware), without the Maemo-specific classes. Qt 4.6 support is already present in source, and the corresponding binary packages will be released in sync with the official PyQt release. It is licensed under GPL for Open Source projects, but a commercial license can be obtained from Riverbank for proprietary development. While new PyQt-compatible bindings can be created using SIP, no freely available automatic binding generation tools exist, making independent generation of bindings for large libraries impractical.

PyQt cannot be intermixed with the future Maemo 6 platform API bindings created using PySide.

PyQt is currently the most mature set of Qt bindings for PyMaemo. If no Qt 4.6 features or Maemo-specific Qt extensions are required, it provides a stable, small, and bugfree set of Python Qt bindings. Moreover, the source-level compatibility of PySide with PyQt is rather high, making porting PyQt programs to PySide (and vice versa) an easy task, thus providing an upgrade path for PyQt developers in the future.

If you want to immediately release a Python Qt 4.5 application with as stable bindings as possible, don't require the Maemo-specific pieces, and are prepared to possibly port your code to PySide in the future, then PyQt is the right choice for you.