-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #590 from astrofrog/plugin-loading-registry
Improve loading of plugins
- Loading branch information
Showing
12 changed files
with
200 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,25 @@ | ||
from . import export_d3po | ||
from . import export_plotly | ||
from . import ginga_viewer | ||
import sys | ||
|
||
|
||
def load_all_plugins(): | ||
def register_plugins(): | ||
from ..config import qt_client, exporters | ||
qt_client.lazy_add('glue.plugins.ginga_viewer') | ||
exporters.lazy_add('glue.plugins.export_d3po') | ||
exporters.lazy_add('glue.plugins.export_plotly') | ||
exporters.lazy_add('glue.plugins.tools.pv_slicer') | ||
exporters.lazy_add('glue.plugins.tools.spectrum_tool') | ||
|
||
|
||
def load_plugin(plugin): | ||
""" | ||
Load built-in plugins | ||
Load plugin referred to by name 'plugin' | ||
""" | ||
|
||
from .ginga_viewer import load_ginga_viewer_plugin | ||
load_ginga_viewer_plugin() | ||
# When Python 2.6 is no longer supported, we can use: | ||
# import importlib | ||
# module = importlib.import_module(plugin) | ||
__import__(plugin) | ||
module = sys.modules[plugin] | ||
if hasattr(module, 'setup'): | ||
module.setup() | ||
else: | ||
raise AttributeError("Plugin {0} should define 'setup' function".format(plugin)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.