[SailfishDevel] QtMobility and Python bindings

Martin Kolman martin.kolman at gmail.com
Thu Jul 18 21:55:26 UTC 2013

18.7.2013 08:12, FIlip Kłębczyk:
> Martin, I don't believe it will be left that way till phone launch. 
> Somehow I have a feeling that someone, maybe even from Jolla ;) will 
> help create PySide Qt5 bindings.
> Regards,
> Filip
Indeed, the news from THP look good. I've heard about PyOtherSide 
earlier, but it looked like a very limited proof of concept. Now it 
looks quite a bit more real. :)

Also the points he makes[1] are very good - most Python & QML 
applications use very little of the Qt machinery, but the the bindings 
normally bind it all, leading to long startup time & big size of the 
bindings (making things worse on platforms where all additional stuff 
needs to be bundled, such as on Android or BB10). I actually have a 
"policy" of sort when working on my applications, to place as much 
functionality as possible to the GUI & platform independent Python core. 
The GUI/s should be just a thin layer visualizing the data models from 
the core to the user. PyOtherSide as described so far seems to be a 
perfect fit in this regard. :)

In short what such a GUI layer needs:
* sending data (numbers, strings, etc.) from Python to QML and from QML 
to Python
* some sort of signals to notify the GUI about events in Python 
(download finished) and Python about events in QML ("search" button clicked)
* loading images from Python to QML - from files & file-like objects 
residing in memory
* shared data models - this is kinda optional, as it could be hacked 
together from data passing and signals, but having it built in would be 
kinda nice

I guess that's basically it - once this work in some form, we are good 
to go. :)

One issue could be vector drawing, which is IIRC currently handled by 
sublassing the declarative item and drawing to it with QPainter. No sure 
how this would work with the PyOtherSide asynchronous mode of operation. 
But there should be some canvas like drawing mechanism in QtQuick 2.0 
and worst case, one can still just draw PNGs to file like objects with 
pycairo and pass it to QML. :)

BTW, PyOtherSide reminds me a bit about the Tart project[3][4] started 
by Peter Hansen to provide bindings for Cascades on BB10, not sure if it 
the project is still active though.

Best wishes

[1] https://twitter.com/thp4/status/357849906750316544
[3] http://hg.microcode.ca/blackberry-py/src
[4] http://peterhansen.ca/blog/blackberry-tart-preview.html

More information about the Devel mailing list