How can I use Plover as a library from an independent script? #1292
Answered
by
user202729
user202729
asked this question in
Q&A and Support
-
(title.) |
Beta Was this translation helpful? Give feedback.
Answered by
user202729
Apr 24, 2021
Replies: 1 comment 4 replies
-
Some modules can be used directly ( Some others (system-dependent) require using the registry to register some modules. # make sure that Plover can be imported in the current Python environment
import plover
from plover.registry import registry
from plover import system
from plover.steno import Stroke
registry.update()
system.setup("English Stenotype")
print(Stroke({"S-", "T-"})) Note: import pkg_resources
registry.register_plugin_from_entrypoint("system",
pkg_resources.EntryPoint.parse(
'English Stenotype = plover.system.english_stenotype',
dist=pkg_resources.EggInfoDistribution()
)
) which only loads that plugin, which is significantly faster. (TODO figure out what |
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
user202729
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Some modules can be used directly (
KeyboardCapture
for example).Some others (system-dependent) require using the registry to register some modules.
Note:
registry.update()
loads all the currently-installed plugins, which might take a long time depends on which plugins are installed (even with the base Plover installation, it still takes 0.6s). An alternative is to do