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

Setting plasmoid font in python

Tags: None
(comma "," separated)
deadrabbit
Registered Member
Posts
2
Karma
0
OS

Setting plasmoid font in python

Tue Mar 23, 2010 3:04 am
I'm pretty much a noob at Python, and a total noob at all things related to KDE development. I'm struggling to build a basic plasmoid, due to the little documentation available.

Anyway, my current problem: how do I sent the font and font size for a plasmoid in Python? And a broader question - is there python API documentation available somewhere?

One more thing - how do I view the error output in Plasmate? I'm finding that when something doesn't work, I have to install the broken plasmoid, run plasma-desktop from the console, and then add the widget, all just to debug. Quite cumbersome.

Thanks!
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: Setting plasmoid font in python

Tue Mar 23, 2010 5:49 am
Hmm... according to the QGraphicsWidget documentation, passing a QFont to the setFont() function should be sufficient, but it isn't listed in the member list of Plasma::Applet, so this might not be possible. It is more than likely a flaw of the documentation however.

You may find the below links helpful.

General KDE Documentation (C++)
Qt documentation (C++)
PyQt4 reference guide
PyQt4 class reference


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
deadrabbit
Registered Member
Posts
2
Karma
0
OS

Re: Setting plasmoid font in python

Tue Mar 23, 2010 7:36 pm
Thanks for the suggestion, I'll try that.

In response to my last question, launching plasmate from a terminal provides debugging info . . . I can't believe I didn't think of that earlier.
User avatar
einar
Administrator
Posts
3402
Karma
7
OS

Re: Setting plasmoid font in python

Tue Mar 23, 2010 9:44 pm
You can also use plasmoidviewer and give it the path of the plasmoid, and it'll be loaded for you in a window. You can also simulate different use cases (desktop, panel) like that.

Regarding the Python API, it should be bundled with kdebindings, but not all distributions ship that. Bear in mind that it's directly translated from the C++ sources, so sometimes it's better to look at the C++ API directly - most of the time (with some exceptions such as KConfigXT) it can be directly translated to Python.


"Violence is the last refuge of the incompetent."
Image
Plasma FAQ maintainer - Plasma programming with Python


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Sogou [Bot]