Planet maemo: category "feed:72b1fb57bb8964a8251594e25932bb34"

Anderson Lizardo

Running PySide applications on Qt Simulator

2010-08-26 14:20 UTC  by  Anderson Lizardo
0
0

Some may have noticed that the Nokia Qt SDK contains a simulator for Qt applications on Nokia devices. It consists of the simulator application, plus Qt libraries built for its platform (Q_WS_SIMULATOR), which basically “wraps” the target application on the simulator window (and allows to simulate various events of the target device).

It has been asked on the Maemo.org Talk whether it would be possible to run PySide applications on the simulator. Technically, it would be as simple as building PySide against the simulator libraries… and indeed it was! Well, at least after a couple of patches, I managed to make it work, as can be seen on the screenshot below (for the curious the application running on it is the “hyperui” demo from pyside-examples repository):

Qt Simulator running PySide

For anyone willing to try, you just need to download the latest PySide code, apply the patches not yet upstream (to the pyside.git tree), and build everything as per official instructions, with these notes:

  • When building PySide, add the directory which contains the Qt tools for the Simulator platform (usually “<SDK_installation_dir>/Simulator/Qt/gcc/bin”) to your PATH (taking care to add it before other directories which contain Qt tools).
  • When building PySide, add -DQ_WS_SIMULATOR=yes to the cmake command. This is necessary because currently CMake does not detect the Simulator platform, thus requiring us to force it.
  • When running applications, remember to set LD_LIBRARY_PATH to point to the Simulator libraries, otherwise the application might try to be run with your system Qt libraries, which will probably fail.

To make testing easier, I built PySide binaries (from git snapshots) for the Simulator libraries shipped in Nokia Qt SDK 1.0. You can download them here. They were built on Ubuntu 10.04 (32-bit), but will probably work on other (32-bit) distributions. Also note it was build for Python 2.6. To use these binaries, unpack the tarball and modify the “qt_sdk_dir” in run_with_simulator.sh to point to your Nokia Qt SDK installation directory. Next, run:

./run_with_simulator.sh /path/to/app.py

And your application should run under the simulator (the simulator opens automatically if not already running).

TODO
  • Apply required PySide patches upstream (they are currently under review).
  • Attempt to build PySide Mobility as well.
Categories: General
Anderson Lizardo

Are you a Python developer, feeling envious of your C++-coding buddies cranking out N900 Qt applications with all those nice Qt Mobility APIs? No reason for envy any longer: The PyMaemo/PySide team is proud to present PySide Mobility: Python bindings for the Qt Mobility APIs! Combining the power of Python and the Nokia-sponsored PySide Qt bindings with the capabilities of Qt Mobility, you’ll be spewing out impressive apps for N900 like never before!

Original announcement

Categories: General
Anderson Lizardo

Qt 4.6.2 for Maemo 5 was released this week. Due to some changes prior to the final Qt release, PySide users might have seen this error when trying to use QtQui:

Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: /usr/lib/pymodules/python2.5/PySide/QtGui.so: undefined symbol: _ZNK24QAbstractKineticScroller10metaObjectEv

To fix this, we rebuilt the PySide 0.2.3 packages against the Qt 4.6.2 release, and now it should be working again. So make sure you are using the latest PySide packages on Maemo 5 (0.2.3-1maemo3) and enjoy!

Categories: General
Anderson Lizardo

The PyMaemo team has prepared a short tutorial with an actual example on how to access APIs for which there are no Python bindings yet. libosso-abook was used as an example, but in practice, you can access any C libraries using the same approach. This technique can be used while we do not finish implementing the full Maemo API.

Enjoy.

Categories: General