Skip to main content

Posts

Showing posts from January, 2010

KRunner and Skype with a Plasma Python runner

After the odyssey of developing a KDE Plasma runner in Python I have finally develop a simple one that interacts with Skype. You can read the full story (part 1 , 2 , 3 and 4 ) or just the (useful part)  modifications to my KDE  and the final example . You can download this version from here or download the latest (and beta) version from the bazaar repository... To uninstall it just... I hope to get a fully stable version very soon and then, I will publish a downloadable file in project page and a deb package in my PPA .

KRunner in Python (and IV)

To make this very simple example working, I've had to modify the pyrunner.py file that I checked out in the last post . I don't know if this changes will be necessary in newer KDE versions (mine is 4.3.4), but by now this patch can be used. And here is a final working example: from PyKDE4 import plasmascript from PyKDE4.plasma import Plasma class EchoRunner(plasmascript.Runner): def match(self, search): if not search.isValid(): return term = search.query() if term.length I think it is self explainable, but you can leave any question in the comments. You can also download the full example structure ready to install from here .

KRunner in Python (III)

It works!! Thank to a comment in the bug I submitted , I've been taking a look and I've found that in trunk version, this problem has been fixed. In concrete, the support for runners and wallpapers has been added to the ones for applets and data engines. To add it to your kde installation, just use cmake to install it automatically (after you fix the missing dependencies) or do it by hand: svn co svn://anonsvn.kde.org/home/kde/trunk/KDE/kdebase/workspace/plasma/generic/scriptengines/python python-scriptengine cd python-scriptengine sudo cp plasma-scriptengine-runner-python.desktop /usr/share/kde4/services/ sudo cp pyrunner.py /usr/share/kde4/apps/plasma_scriptengine_python/ sudo cp plasmascript.py /usr/lib/pymodules/python2.6/PyKDE4/plasmascript.py sudo cp plasmascript.py /usr/share/pyshared/PyKDE4/plasmascript.py # And if you want to add the support for wallpapers sudo cp plasma-scriptengine-wallpaper-python.desktop /usr/share/kde4/services/ sudo cp pywallpaper.py /u...

KRunner in Python (II)

Digging into the way that kde handles services, I've found that this code emulates its behaviour : from PyQt4 import QtGui from PyKDE4.kdecore import KServiceTypeTrader QtGui.QApplication([]) constraint = "[X-Plasma-API] == '%s' and '%s' in [X-Plasma-ComponentTypes]" KServiceTypeTrader.self().query("Plasma/ScriptEngine", constraint % ("python", "Runner")) # -> [] KServiceTypeTrader.self().query("Plasma/ScriptEngine", constraint % ("python", "Applet")) # -> [<PyKDE4.kdecore.KService object at 0xb75bee6c>] KServiceTypeTrader.self().query("Plasma/ScriptEngine", constraint % ("python", "DataEngine")) # -> [<pykde4.kdecore.kservice 0xb75befac="" at="" object="">] Conclusion: There is no Python script engine for runners but there is for applets and data engines. :( To be continued (again)...