Querying the dict dataengine

alan moore me at alandmoore.com
Tue Aug 18 05:10:23 CEST 2009


Aaron J. Seigo wrote:
> 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 :)

Thanks, I'll look at it; though I wouldn't recommend anyone hold their 
breath waiting for me to produce working c++ code.

> 
>> 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 ;)
> 
The delay wasn't really the problem, but rather the initial bogus 
output.  I guess I'm thinking of this like a database query -- ask a 
question, wait a bit, get an answer.  I can see how connectSource() 
makes sense in a situation where you have a constant stream of data you 
want to tap into and pipe out to a widget, but is there not a mechanism 
for simply doing a one-off query?  I thought that's what the query() 
method was for, but that wasn't working out either.

Am I thinking about this all wrong?


More information about the Plasma-devel mailing list