Python and QML

Eric Mesa ericsbinaryworld at gmail.com
Thu May 10 02:54:25 UTC 2012


Alright, here's my python code:

import sys

from PyQt4.QtCore import QObject, QUrl, pyqtSignal
from PyQt4.QtGui import QApplication
from PyQt4.QtDeclarative import QDeclarativeView
from PyKDE4.plasma import Plasma
from PyKDE4 import plasmascript

app = QApplication(sys.argv)

# Create the QML user interface.
view = QDeclarativeView()
view.setSource(QUrl('flickrviews.qml'))
view.setResizeMode(QDeclarativeView.SizeRootObjectToView)


#the meat and potatoes
# Get the root object of the user interface.  It defines a
# signal and any JavaScript functions.  Both
# can be accessed transparently from Python.
rootObject = view.rootObject()

#make it visible
view.setGeometry(100, 100, 400, 240)
view.show()

app.exec_()


this gives me the error: module "org.kde.plasma.core" is not installed
     import org.kde.plasma.core 0.1 as PlasmaCore

this is similar to the error I got when I was trying to develop my plasmoid
in qtcreator.  It means I won't be able to connect to my data engine.  Is
there no way around that?  It seems weird that only plasmoids can use the
power of data engines.

--
Eric Mesa
http://about.me/ericmesa
http://www.ericsbinaryworld.com



On Wed, May 9, 2012 at 11:19 AM, Eric Mesa <ericsbinaryworld at gmail.com>wrote:

> On Wed, May 9, 2012 at 10:55 AM, Luca Beltrame <lbeltrame at kde.org> wrote:
>
>> In data mercoledì 9 maggio 2012 16:44:12, Marco Martin ha scritto:
>>
>> > afaik only pyqt has complete bindings for kdelibs for now
>>
>> Correct, PySide is not supported.
>>
>> > I am no aware about the status of bindings on those parts, that's more
>> > a question for bindings people
>>
>> To be blunt, I haven't seen *any* new work on Python bindings, mainly
>> because
>> kdelibs is frozen.
>>
>>
>> This stuff needs likely to be written, not sure if it needs some C++ glue
>> or
>> not. PyQt has already support for QML, with some limitations.
>> _________________________
>>
>
> OK, so if I'm understanding you guys correctly - as currently written if I
> went this route I would have to make a regular program, not a plasmoid.  I
> think that's fine with me for this particular project - other than using
> data engines, I don't think I'm doing anything plasmoid specific - and I
> think I can still use those in a QML program, right?  I guess we'll see
> what happens when I try to make this work sometime this week.  At any rate,
> perhaps it can be converted to a plasmoid in the future if the bindings are
> written.
> --
> Eric Mesa
> http://about.me/ericmesa
> http://www.ericsbinaryworld.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20120509/f042cc15/attachment.html>


More information about the Plasma-devel mailing list