Registered Member
|
I'm developping a python Runner for KRunner and it works fine, except that multiple matches for identical items are shown.
The runner searches into a database some results based on a list of "tags" provided by the user. For example if the user digits "searching, array" the runner will look into the database and find the results that have those tags. The problem is that when the user writes "searching" a certain number of matches is show and when it adds ", array" some other matches are added, even though they are already present in KRunner's result list. I've tried to set a unique id for the QueryMatches but it does not work. I tried to use RunnerContext.match(id_str) to see whether there is already a matching item but it always return an invalid QueryMatch. Also calling RunnerContext.matches() will always return an empty list, no matter what. How can I avoid this behaviour? I thought the runner checked the ids of the matches and automatically avoided inserting duplicate matches, but it clearly does not do this. |
Administrator
|
Is your code available somewhere? I might take a look.
"Violence is the last refuge of the incompetent."
Plasma FAQ maintainer - Plasma programming with Python |
Registered Member
|
You may find the source code on bitbucket:
https://bitbucket.org/bakuriu/pseudocoderunner/src The relevant file is contents/code/pseudocode/runner.py. You may create a database of examples running contents/data/examples.py adding contents/code to the PYTHONPATH. If you try to run the plug-in and digit for example "linear" you'll see two identical matches showing up(one is generated looking up the linear tag and one looking up the title). |
Registered Member
|
I've managed to avoid insterting duplicated item. Badsically before adding the matches to the runner I manually scan them and remove duplicates.
I'm still interested if there is a way of avoiding this "by hand". |
Administrator
|
You might want to try asking on plasma-devel@kde.org about that..
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
Registered users: Bing [Bot], Evergrowing, Google [Bot], rockscient