-
Notifications
You must be signed in to change notification settings - Fork 238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
webui: add glossary preview buttons #610
Conversation
- browse buttons for input and output files - browse.html page: can be used standalone, takes path to dictionary, shows first `DEFAULT_MAX_BROWSE_ENTRIES` defined in server_ws_http.py - add favicon.ico - ui_controller.py: resolve home `~` placeholder in paths - server_ws_http.py: override `super.translate_path()` to allow resource resolution from additional web roots, ie .js .css when browsing .mdx files - add **Browse** link in webui menu
Interesting. But "Browse" sounds like "browse files", something like a File Chooser or File Manager. Should be renamed to something else, like "Glossary Preview".
We use iterators / generators, so if you only read a small number of entries (then break out of loop), it should not take long. |
yes, I noticed, clicking the 🔎 from index.html only takes the 42 top entries so it's generally pretty quick to render something; it's only the search that can take forever, thought it would be fun to be able to search, as a way of verifying the converted result or the input file. I suppose that it would probably be mixing scopes between a conversion tool and a dictionary, but as a debugging extension it might be useful — for example, as a way to quickly preview a dictionary without installing it into a dedicated app before deciding if you need to convert it or not. |
Right. BTW I created this plugin just for purpose of viewing a dictionary in web browser (kinda like |
In fact, I've used the html_dir plugin before, but not as a way of browsing dictionaries but for extracting resources; for big dictionaries with hundreds of thousands of entries and additional resources like audio and images it generates way too many files, and I'd rather have them packed in some kind of container like sqlite or something optimized for searching like slob. With the current preview in the webui I do actually find it quite practical to be able to peek and inspect some dictionaries without needing to convert and install them. |
So the Search function might need to read the entire glossary (if matching entries are fewer than then limit). |
yes, totally agree that it is not nice, and I appreciate that you raised this concern since imo it does need to be addressed properly, but don't have a 💯 clear idea of what would be an appropriate UI/UX here — (1) removing the search entirely will reduce the usability, (2) adding a persistent warning always displayed on the page will be ugly, reduce usability and be too annoying; how about (3) adding a modal dialog that will appear once and then if accepted by clicking the
wdyt? |
btw, another side offtopic regarding web dictionary viewers, in the same category as 'goldendict-web', discovered the other day: https://github.com/liuyug/flask-mdict — made by the author of |
Sounds good. I had starred flask-mdict, but don't remember it! Probably saw it a long time ago. Can you make it so that searched entries will be loaded one at a time and not make the user wait for all? I have also made wrappers around sqlite with a class that acts like a list, used for global sqlite mode and stardict writer. |
hmmm, right, good idea, indeed, this would be much better than blocking the UI until all results are collected; will have to chew it a bit and find a clean for a way to do it with websockets Only see SqList and wrappers being used in the stardict writer; can SqList be used with any format? is it supposed to be used as an alternative to |
No, it's specific to the use case.
No, actually I can add a |
aha, I see that ..sure, let's switch to a discussion page, although never used them before. |
switched to websockets to make entries load progressively on the client; the difference is not very huge — for dictionaries over 1GB the delay until the first entry is found is of course still noticeable, especially when a lot of resources need to be parsed (audio, images); to actually see the progressive loading in action had to set in any case; progressive loading now works and in the future if the backend responds quicker before the first record the client will reflect that |
Thanks. |
max
GET param in the url controls the max number of entries as in e.g.http://127.0.0.1:1984/browse?path=/path/to/oald.mdx&max=42&format=OctopusMdict
&word=something
parameter in the URL)max=123
parameter thenDEFAULT_MAX_BROWSE_ENTRIES
is used defined inserver_ws_http.py
~
placeholder in input/output pathsserver_ws_http.py
: override standard librarysuper.translate_path()
to allow resource resolution from additional web roots, ie .js .css when browsing .mdx files@ilius the entire idea came up after discovering view_glossary.py in the repo and thought it could be more useful and friendlier to use if hooked to the webui; searching in big files is of course slow and can take forever since it's just looping over entries; more of a poc, and not really meant to work as a dictionary since that will require some kind of indexing and better search approach