-
Notifications
You must be signed in to change notification settings - Fork 279
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
Add "Save as..." feature for dictionary conversion #1149
Add "Save as..." feature for dictionary conversion #1149
Conversation
11e1045
to
c098a8a
Compare
Thanks for this feature, I've been thinking about it for a long time!
|
A weird corner case is that the user saves a copy to overwrite some other dictionary in the list. |
It would be good to do a quick config refresh which should trigger any dictionary changes from the file system. I don't think stopping someone from exporting onto a dictionary that they have open makes sense (even if that use case is weird as heck.) |
Another weird edge case is that between the right-click and the save, some plugin might change the dictionary list so the dictionary at that row may point to a different one or missing (index out of bound). What should be done in that case? (report an error? Save the old one?) Similarly, what if some plugin adds a dictionary entry into that dictionary after the right click but before the save? By the way, the internal functions are really poorly-documented. What is the |
Maybe we should grab reference to the dictionary on context menu selection
rather than just using the index.
Wholeheartedly agree that the code documentation needs love and care. It's
very unfriendly to new (and old) devs.
…On Fri., Oct. 16, 2020, 11:35 p.m. user202729, ***@***.***> wrote:
Another weird edge case is that between the right-click and the save, some
plugin might change the dictionary list so the dictionary at that row may
point to a different one or missing (index out of bound). What should be
done in that case? (report an error? Save the old one?) Similarly, what if
some plugin adds a dictionary entry into that dictionary after the right
click but before the save?
By the way, the internal functions are really poorly-documented. What is
the loaded_dictionaries parameter of _update_dictionaries used for, and
how is that related to reloading the dictionaries (as used in
_create_new_dictionary)?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1149 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABMSASWZ23O2RHNFGRS36E3SLEGJFANCNFSM4STN4GKQ>
.
|
Can you add a news fragment please? |
|
Given #922, perhaps it actually makes sense to allow export multiple dictionaries, with higher priority dictionaries preferred. |
There's that new thing which is almost the same thing as the one in this pull request; however you can roll it back if you don't want it. Remark: currently "save a copy as" creates a new undo event; even though there's no dictionary change. Should test with bottom-up dictionary order too (however currently there's no automated GUI test)
|
OK, so I took a look at this, and immediately there are some warning bells, with the way some Qt objects are dynamically created, combined with First thing I did when testing, is I tried to save "main.json", on "main.json" (yes, vicious), and Plover crashed, not with a traceback, but flat out segfaulted. But my biggest issue with this PR is the interface: it's inconsistent. Suddenly, we have this context popup, with only one entry, and it's not even for the most common operation. Add to that the dynamically changing text (save vs merge), which IMHO is bad for discoverability. Some of the other issues are easy to correct:
If you use
That part is taken care by See #1244 for an alternative. |
Summary of changes
Right-click at a dictionary and choose "Save as..." can make a copy of the dictionary.
As far as I know, there's no existing easy way to do it natively with Plover. (#589, https://groups.google.com/forum/#!topic/ploversteno/PRapWs8I2-o, https://github.com/balshetzer/plover_dict_converter, http://plover.stenoknight.com/2012/12/dictionary-converter.html -- although all of those are at least 4 years old)
Issues:
except:
is also copied from the function below. I'm not sure which function can raise the exception.are really inconsistent. At least use
None
.Pull Request Checklist