faridz-ki / Keypirinha-Dictionary

A Keypirinha package that gets word definitions via the unofficial Google Dictionary API
2 stars 0 forks source link

Quality of life improvements #4

Open MaddyGuthridge opened 3 years ago

MaddyGuthridge commented 3 years ago

It'd be great if there were a few quality of life tweaks to improve the plugin.

Adding a waiting message while it waits for API results. I thought it wasn't working since it was taking a few seconds to grab the results.

Also, predicting words that the user will type and pre-emptively grabbing their results as they type to avoid the waiting all together. This could take some complicated stuff though like including a local list of words along with the ability to sort them by commonality (so that more common words are suggested first, obviously, direct matches should be prioritised).

Also, it'd be great to include the definition on the bottom line to allow longer definitions to be readable for those of us with a larger primary result text display (see image). image

If you were to move the definition to the bottom row, you could put the name of the word and the definition number on the top row, which would be awesome if you added the predictive words thing.

I'm pretty familiar with Python (not so much KeyPirinha's API though), so I could possibly try to help out when I have time in a few weeks.

MaddyGuthridge commented 3 years ago

A possible library to use for this could be autocomplete.

faridz-ki commented 3 years ago

With regards to autocomplete: my initial plan for this package was to just use a dictionary library instead of making API requests, but I couldn't find a way to import the package. I eventually figured this was due to the way Keypirinha has packaged its Python interpreter.

There is a way to do this though, which is to include the library you're importing the actual source code and import it that way, but it gets extremely messy once that library has dependencies outside of the Python standard library.

I'll shop around for an autocomplete library which fits the bill in terms of usability and dependency, but it'll be difficult.

The other two suggestions are really good ideas that I hadn't thought of myself, and I'll be looking to work on them - you can feel more than free to work on one or the other as well, just let me know which, then feel free to fork and PR :)

MaddyGuthridge commented 3 years ago

Does Keypirinha have a thing that you can run when the plugin is installed, kinda like how pip runs a setup.py thing? You could use that to invoke pip (provided Keypirinha also has that) and install any required dependencies. If it doesn't have that it could honestly be very cool if they added it and I might do a feature request for it once I get more familiar with its API and stuff.

faridz-ki commented 3 years ago

I've just read through the docs again, but it doesn't look like that's currently a possibility. If you'd rather be sure yourself, the Overview and Embedded Python Interpreter sections pretty clearly outline the lifecycle of both a package and the interpreter, and the embedded Python source code is here - I didn't see anything in there which would allow that though.

For what it's worth, I think it's a great suggestion to have some way of importing external modules within their embedded interpreter via pip, and I assume the best way to make that suggestion is via their issue tracker or their support chat room. I can't see any issue about this in particular though, but I admit I haven't looked particularly hard.

If you want to look at direct imports, the MovieDB package shows that it's possible to do, and might be worth looking into as a solution.

ziova commented 2 years ago

any updates?