Running PySide applications on Qt Simulator August 26, 2010Posted by lizardo in General.
Tags: maemo, pyside, python, qt
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):
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:
And your application should run under the simulator (the simulator opens automatically if not already running).
- Apply required PySide patches upstream (they are currently under review).
- Attempt to build PySide Mobility as well.