This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Will Plasma5 support Python applets?

Tags: None
(comma "," separated)
Midori Yakumo
Registered Member
Posts
2
Karma
0
Currently it has only QML API as techbase writes, should we wait for KDE5 where PyQt5 may be re-supported? :o
User avatar
einar
Administrator
Posts
3402
Karma
7
OS
Short answer: never.
Long answer: All the extra language support has been ripped out, by design, as the only supported way to build Plasma applets will be through QtQuick (not easily supportable on dynamic languages - PyQt5 itself does some hacks just to allow that). Also, many implementations had longstanding bugs (I know, because I looked at the code and fixed some of them) and uncaught exceptions in Python code (programmer mistake) would cause the underlying bound C++ object (from Plasma) to get deleted, causing hard to debug crashes.


"Violence is the last refuge of the incompetent."
Image
Plasma FAQ maintainer - Plasma programming with Python
User avatar
ivan
KDE Developer
Posts
918
Karma
14
OS
I would not be as categoric as Einar, but the essence of his answer is correct.

There has been some experimental work to bring other languages in QML, like CoffeeScript. I'm not sure whether it will ever get merged into Qt master, even if it gets finished. If not, It can be done through a simple preprocessor.

Until either Plasma starts supporting something else, or Qt does, you'll be forced to use JS inside QML. For other parts, you can use anything that compiles to javascript (and C++ for the underlying things).

For a list of languages that can compile to JS, you can refer to (contains a couple of Python or Python-like languages, no idea how mature the projects are):
https://github.com/jashkenas/coffeescri ... pile-to-js


Image
Midori Yakumo
Registered Member
Posts
2
Karma
0
So C++ is the only way to extend QML in plasmoid/plasma-widget there?
User avatar
david_edmundson
KDE Developer
Posts
359
Karma
1
OS
We still have dataengines/servicejobs like in Plasma 4 which can be in Python and then exposed to QML.

For anything more advanced, C++.
User avatar
einar
Administrator
Posts
3402
Karma
7
OS
Note that this implies the existence of Python bindings for plasma-framework, and these at the moment don't exist.


"Violence is the last refuge of the incompetent."
Image
Plasma FAQ maintainer - Plasma programming with Python
User avatar
david_edmundson
KDE Developer
Posts
359
Karma
1
OS
plasma-framework/src/scriptengines/python ?

I've not tested them, but they do exist.


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot], rblackwell