Skip to content
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

Optional method to export dictionary to JSON using Plover's "save as" feature? #9

Open
user202729 opened this issue Sep 29, 2023 · 0 comments

Comments

@user202729
Copy link
Member

It may be useful to allow exporting a Python dictionary to a JSON file.

I think a possible implementation is something like:

		def _default_items():
			return ()
			raise ValueError("Dictionary does not support exporting!")
		items = mod.get('items', _default_items)
		if not isinstance(items, typing.Callable):
			raise ValueError('invalid `items\' function: %s\n' % items)
		self._items = items

then the Python file, if it wants, can define a items function that returns an iterable of (stroke, value): (str, str) objects.

Motivation: my library https://github.com/user202729/plover-python-dictionary-lib/ supports exporting to JSON, but it would be better to allow doing that inside Plover's GUI itself, so user who are not familiar with the CLI would find it easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant