maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   SailfishOS (https://talk.maemo.org/forumdisplay.php?f=52)
-   -   Python & Qt5 on Sailfish (https://talk.maemo.org/showthread.php?t=91049)

rcolistete 2013-08-15 20:45

Python & Qt5 on Sailfish
 
***********************************************

See Sailfish/Python Development wiki page and post#83 for recent news about Python 3, PyOtherSide and PyQt5 for Sailfish.

***********************************************

Here in this topic we can discuss programming with Python & Qt5 on Sailfish OS. Since Sailfish SDK alpha 2 it needs Qt5 and Wayland (no X11 at the moment), Python (with GUI) has to find some solution to run on Sailfish (XWayland, PySide / PyQt for Qt 5 or PyOtherSide).

Bringing some comments from other topic :
==========================================
The current situation for mobile developers from Maemo/MeeGo/Nemo Mobile to Sailfish pathway is IMHO :

1) softwares in C/C++/Qt 4.7-4.8 (Qt Quick 1) : about 80-90% of MeeGo Harmattan and Nemo Mobile softwares, just some % of Maemo 5 softwares. Anyway due to migration from GUI written in (Harmattan, etc) Qt Quick components to Sailfish Silica (Qt Quick components for GUI in Sailfish OS), there is a need of small-medium source code revision & rewrite. There are 2 options for Qt5/Wayland migration :

1.a) XWayland (X11 running as a Wayland client) be available by Jolla and/or community, so all Qt 4/X11 softwares will remain compatible. Jolla said "just to clarify, while we don't support xwayland atm, we're not ruling out the possibility in future...". It seems XWayland source code isn't long, just some hundreds of lines of code. So, as Jolla itself is open to include XWayland (with the community help, i.e., in Nemo Mobile Wayland effort) and XWayland is a lot smaller than Wayland, I think it is possible to have XWayland ready on Sailfish OS until the end of 2013 (but not included in the Sailfish SDK beta which is soon to be released);

1.b) migrate to Qt 5/Qt Quick 2, which seems to be easy, with minor source code revision & rewrite, then recompile. This work may be worth to also release Qt 5 versions for Ubuntu Touch, Android and iOS (changing from the Qt components from Silica to Qt Components for Ubuntu or Qt Quick Controls);

2) softwares in Python/PySide/Qt 4.7-4.8 (Qt Quick 1) : only about 10-20% of MeeGo Harmattan and Nemo Mobile softwares, just some small % of Maemo 5 softwares. But Python is important, allowing party-time developers to code on device (N900, N9, etc), anytime, anywhere, and contribute to the software diversity. The same migration from Harmattan (etc) Qt Quick components to Sailfish Silica is needed, with small-medium source code revision & rewrite. There are more options for Qt5/Wayland migration, none ready at the moment :

2.a) the same (1.a) option, i.e., release XWayland for Sailfish OS, so PySide and Qt 4.8 could be used in Sailfish as in Sailfish SDK alpha;

2.b) port PySide to Qt5/Qt Quick 2, which has no timeline and is a huge task needing contribution. This effort would benefit Sailfish, Ubuntu Touch, Android and iOS developing in Python/Qt5/Qt Quick 2. So it is expected that Jolla will not contribute (alone) for this huge work;

2.c) use a future PyQt 5 version, because the current one excludes Qt Quick 2. There is also the issue of GPL license and release PyQt 5 for Mer/Nemo/Sailfish;

2.d) use PyOtherSide from thp, which will have a version for Qt5/Qt Quick 2 released soon. It is not a Qt 5 full binding for Python, but it seems a way to code (the GUI) in Qt Quick 2 and call Python from it (so Qt5 is not available from Python, only Python is available from Qt5/Qt Quick 2). As advantages, PyOtherSide is smaller, faster to load and is/will be multiplataform (Symbian, Android, MeeGo, Sailfish, Ubuntu Touch, etc).

So, non-Python developers have a migration path currently available to Qt5/Wayland on Sailfish. Only Python developers are in a wait-to-see/code situation, the easier one seems to be PyOtherSide (2.d).

About the change from Sailfish SDK alpha (with Qt 4.8 & X11) to Sailfish SDK beta (Qt 5 & Wayland) : yes, it is a bad surprise for developers who have already ported/created softwares using Sailfish SDK alpha. But currently there are a very small number (10-20) of softwares written for Sailfish, see the app list in Sailfish - Mer Wiki. So this 'collateral effect' is small.

I trust the Linux/Maemo/MeeGo/Mer/Nemo/Sailfish community efforts so that more than one good solution will be available for developing Sailfish softwares.

I hope XWayland will be released on Sailfish, so X11 legacy will be available : ssh -X, chrooting Debian/etc, many Linux desktop softwares not Wayland compatible, etc.
==========================================

Other comments :
==========================================
More news about PyQt 5 and Qt 5/Qt Quick 2 support :
- PyQt 5.0.1 (next release) will have Qt Quick 2 support, and PyQt 5.1 will have Qt 5.1 support, see
PyQt and Qt 5.1 discussion.

So, in theory, PyQt 5.1 will give Python access to develop softwares (with GUI) for Sailfish, Ubuntu Touch, Android, iOS, etc. Obviously somebody needs to compile PyQt for them.

PyQt 5.0 was released in June 16th, I haven't found any estimate date for PyQt 5.0.1 and 5.1. But PyQt 5.0.1 is the current development snapshot, see the change logs which says "Completed the initial implementation of the QtQuick module" in July 20th.

We Python developers (for Sailfish, etc) should pay attention to PyOtherSide and PyQt 5.x developments.
==========================================

rcolistete 2013-08-15 20:47

Re: Python & Qt5 on Sailfish
 
Python (modules) on Mer/Nemo topic is also useful, citing Python modules available for Mer / Nemo, those which don't use X11 and Qt4 are usually compatible with Sailfish.

rcolistete 2013-08-15 20:55

Re: Python & Qt5 on Sailfish
 
PyOtherSide for Qt5 and Python 3.3, from thp, was updated on August 8th 2013, has better documentation and 4 examples :
http://thp.io/2011/pyotherside/
https://github.com/thp/pyotherside
http://thp.io/2011/pyotherside/doc/classQPython.html
Read here the motivations of thp about PyOtherSide on Qt5.
To use Python 2.x instead of Python 3.3 with PyOtherSide, see thp hint.

So Python developing on Sailfish is again possible, using Qt 5/Qt Quick 2 for GUI and Python for computing, glued by PyOtherSide.

rcolistete 2013-08-15 21:00

Re: Python & Qt5 on Sailfish
 
An application of PyOtherSide to Sailfish is Khertan's ownNotes.
It has source code (in Python 2.7, QML and C/C++) for MeeGo Harmattan and Sailfish :
https://github.com/khertan/ownNotes
Khertan has made a PyOtherSide fork, using Python 2.7 :
https://github.com/khertan/pyotherside

mikecomputing 2013-08-15 21:08

Re: Python & Qt5 on Sailfish
 
"2.d) use PyOtherSide from thp, which will have a version for Qt5/Qt Quick 2 released soon. It is not a Qt 5 full binding for Python, but it seems a way to code (the GUI) in Qt Quick 2 and call Python from it (so Qt5 is not available from Python, only Python is available from Qt5/Qt Quick 2). As advantages, PyOtherSide is smaller, faster to load and is/will be multiplataform (Symbian, Android, MeeGo, Sailfish, Ubuntu Touch, etc). "

For me this is the path to go in case of python+QML on embedded. I dont see any reason to have full access to QtWidgets bindings in python. If people want full QtWidgets, well time to learn C++ because QtWidget is only for "hiend applications" anyway and not something that runs on embedded.

And the rest of the goodies in Qt C++ can be replaced with other good librarys in python anyway.

And about Qt4 vs 5 my guess is keeping backward compability in this area is bad idea better let harmattanui die in favour of qt controls (less fragmentation). Qt5 is now moving incredible fast forward (soon 5.2 is out). So I think alot apps on linux desktop will also move to Qt5 2014.

Yes there will be alot of porting issues but not as big as between 3 => 4 it seems...

MartinK 2013-08-15 23:41

Re: Python & Qt5 on Sailfish
 
I've checked out the updated PyOtherSide and can confirm that it looks very very well & all the examples work just fine (using Python 3.3 and Qt 5.1.2 on a PC). So I'll say PyOtherSide is most probably the future for Python & Qt5.

Basically the only thing missing in PyOtherSide for my use cases at the moment is image loading from Python data objects. So I've written a detailed feature request and posted it at the Github issue tracker. :)
Looks like THP likes it, so it will hopefully soon be added to PyOtherSide.

Regarding my current development plans for Python & Qt5, I'm going to start working a PyOtherSide based Qt5 GUIs for modRana and Mieru, using the QtQuick Controls components. Like this the resulting GUIs should run just fine on Sailfish, Android, Ubuntu-Touch, Tizen, desktop Linux and once it gets Qt5 also on BB10.

Fremantle, Harmattan and other platforms (there are still people using up-to-date modRana on the Neo FreeRunner, seriously! :) ) will be covered by the existing GTK and Qt4 GUIs (I'm not dropping those). Of course the Qt5 GUI will also run there, provided at least Qt5.1 (QtQuick Controls were added in Qt5.1) is available.

rcolistete 2013-08-16 00:22

Re: Python & Qt5 on Sailfish
 
Quote:

Originally Posted by MartinK (Post 1367552)
Regarding my current development plans for Python & Qt5, I'm going to start working a PyOtherSide based Qt5 GUIs for modRana and Mieru, using the QtQuick Controls components. Like this the resulting GUIs should run just fine on Sailfish, Android, Ubuntu-Touch, Tizen, desktop Linux and once it gets Qt5 also on BB10.

Do you think QQC components will work on Sailfish OS instead of using Silica components ?

MartinK 2013-08-16 09:06

Re: Python & Qt5 on Sailfish
 
Quote:

Originally Posted by rcolistete (Post 1367560)
Do you think QQC components will work on Sailfish OS instead of using Silica components ?

They are a built-in part of Qt since 5.1, so they should be available. I hope they won't start stripping built-in Qt functionality any time soon. :)

Also, there is the AbstractUI project, that should make it possible to write a single GUI that will use the native components of the given platform.

gianko 2013-08-16 11:44

Re: Python & Qt5 on Sailfish
 
maybe you read already, but is an interesting post about

http://thpmaemo.blogspot.it/2013/07/...n-on-qt-5.html

"Lightweight can be achieved by not binding all the Qt classes, but only the ones you really need for creating QML applications. And responsive can be achieved by making sure that the interface between QML and Python is asynchronous, so the UI never blocks even if Python is working hard in the background to fulfill the requests of the user interface."

rcolistete 2013-09-27 05:34

Re: Python & Qt5 on Sailfish
 
PyQt 5.0.1 was released in 21 August 2013 with support for QML and Qt Quick2 :
http://www.riverbankcomputing.co.uk/news/pyqt-501
Quote:

* Added the QtQuick module including the ability to create Python Quick items from QML.
* Added the QtQml module including the ability to create Python objects from QML.
The current PyQt5 download is for v5.0.1 :
http://www.riverbankcomputing.co.uk/...pyqt/download5
The "Development Snapshots" PyQt5 v5.1 is also available, compatible with Qt 5.1.

So, PyQt 5.1 will give Python access to develop softwares (with GUI) for Sailfish, Ubuntu Touch, Android, iOS, etc. Obviously somebody needs to compile & package PyQt for them.


All times are GMT. The time now is 12:25.

vBulletin® Version 3.8.8