[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-bindings
Subject: [Kde-bindings] Python DataEngine problem
From: Luca Beltrame <einar () heavensinferno ! net>
Date: 2008-12-28 15:12:47
Message-ID: 200812281612.54095.einar () heavensinferno ! net
[Download RAW message or body]
[Attachment #2 (multipart/signed)]
[Attachment #4 (multipart/mixed)]
Hello,
I've been starting to play with Plasma and Python (KDE 4.2 beta 2), and I've
been trying to create a simple DataEngine. I wonder if these should be
installed as packages, with plasmapkg, or with something else, because I can't
seem to get them to work in the engine explorer.
I always get these errors:
Traceback (most recent call last): \
File "/usr/share/kde4/apps/plasma_scriptengine_python/pydataengine.py", line
43, in init
self.module = __import__(self.plugin_name+'.main') \
ImportError: No module named main \
Traceback (most recent call last): \
File "/usr/share/kde4/apps/plasma_scriptengine_python/pydataengine.py", line
58, in sources
return self.pydataengine.sources() \
AttributeError: pydataengine \
Traceback (most recent call last): \
File "/usr/share/kde4/apps/plasma_scriptengine_python/pydataengine.py", line
64, in sourceRequestEvent
return self.pydataengine.sourceRequestEvent(name) \
AttributeError: pydataengine
My main.py and metadata.desktop files are attached, but it must be noted that
this happens also with the sample DataEngine code present in SVN
(plasma_dataengine_pytime; exactly the same error).
Is there anything I'm doing wrong, or is there a bug?
I apologize in advance if the quality of the code is rather crude, I was just
trying an experiment.
Thanks!
P.S.: Please CC me in replies, I'm not subscribed.
["main.py" (text/x-python)]
#!/usr/bin/env python
from PyQt4.QtCore import *
from PyKDE4.kdecore import *
from PyKDE4 import plasmascript
from Bio import Entrez # querying functions
class PyEUtilsEngine(plasmascript.DataEngine):
def __init__(self, parent, args=None):
plasmascript.DataEngine.__init__(self, parent)
def init():
Entrez.email = "testa_testa@graffiti.net"
self.setMinimumPollingInterval(3000) # To comply with NCBI regulations
def sources(self):
sources = ["NCBI"]
return sources
def sourceRequestEvent(self, name):
return updateSourceEvent(name)
def updateSourceEvent(self, gene):
handle = Entrez.esearch(name, db="gene")
data = Entrez.read(handle)
idlist = data["IdList"]
self.setData("Genes",QVariant(idlist))
return True
def CreateDataEngine(parent):
return PyEutilsEngine(parent)
["metadata.desktop" (application/x-desktop)]
["signature.asc" (application/pgp-signature)]
_______________________________________________
Kde-bindings mailing list
Kde-bindings@kde.org
https://mail.kde.org/mailman/listinfo/kde-bindings
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic