Add flags to control the start of the application #200
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #199.
It is currently impossible to get a
visiomode.core.Visiomode
object without incurring the cost of starting the whole application (i.e., starting the webpanel and getting stuck in the main application loop).This PR puts such actions behind their own flags, meaning it is possible to initialise a minimal version of the application.
Another aspect the PR addresses is the import of plugins. They (
visiomode.devices
,visiomode.protocols
,visiomode.stimuli
) are imported automatically when importingvisiomode
(or any submodules). And because of avisiomode.plugins.load_modules_dir()
at the end of said plugins, they are loaded at import time. The refactor proposed here moves their initialisation into the main app initialisation and puts it behind a flag.This could be a problem if they are required to be initialised under other circumstances but I have not been able to produce an error when playing around with the application. Do let me know if there's a use case that would require them to be loaded outside of the main application startup.