Querying the dict dataengine

Aaron J. Seigo aseigo at kde.org
Tue Aug 18 00:38:39 CEST 2009


On Saturday 15 August 2009, alan moore wrote:
> Hello; I am working on my first plasmoid (in Python), so apologies in
> advance if I'm a blockhead.
>
> I'm trying to remake the old kicker dictionary applet.  I have code that
> works by calling the "dict" CLI command, but naturally I want to switch
> that to working with a data engine.  I'm a bit hazy on how to
> communicate with the dict dataEngine and get what I want from it;
> specifically:
>
>   - How do I tell it what server/dictionary to use?  I saw there is a
> setServer() function in the code, but it's private.

i don't believe there is a way to do this currently. it could be done in a few 
ways:

* the source name could be the server, though that's not backwards compatible

* there could be a serviceForSource that returns a service that lets one 
define what the server(s) to use for that word should be.

the latter is probably the way to go. it requires a bit of work to the dict 
dataengine in kdebase, but wouldn't be too difficult. other engines implement 
serviceForSource as well, so examples abound :)

> I also tried using connectSource(), then assigning mydef in dataUpdated.
>   I noticed in that case that I first got an empty dictionary, then a
> few moments later the actual data I was looking for.

that's correct; the process is asynchronous so it will update later. there is 
no way around that unless we make the entire internet synchronous ;)

-- 
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43

KDE core developer sponsored by Qt Software
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20090817/defb4406/attachment.sig 


More information about the Plasma-devel mailing list