Skip to content
This repository has been archived by the owner on Nov 9, 2024. It is now read-only.

Commit

Permalink
Added quickload method to make the initial loading of plugins require…
Browse files Browse the repository at this point in the history
… fewer lines of code
  • Loading branch information
nint8835 committed May 13, 2017
1 parent a3b627c commit 4574b33
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
11 changes: 10 additions & 1 deletion jigsaw/PluginLoader.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,4 +275,13 @@ def unload_plugin(self, name: str) -> None:
manifest = self.get_manifest(name)
self._manifests.remove(manifest)

self._logger.debug("{} unloaded.".format(name))
self._logger.debug("{} unloaded.".format(name))

def quickload(self, *args):
"""
Loads all manifests, loads all plugins, and then enables all plugins
:param args: The args to pass to the plugin
"""
self.load_manifests()
self.load_plugins(args)
self.enable_all_plugins()
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name="Jigsaw",
version="3.0.0",
version="3.1.0",
packages=["jigsaw", ],
license="MIT",
description="A plugin framework for Python3.6+",
Expand Down
5 changes: 5 additions & 0 deletions tests/test_jigsaw.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,8 @@ def test_reload_all_manifests():
j.load_manifests()
j.reload_all_manifests()
assert j.get_manifest("Basic Test") is not None

def test_quickload():
j = jigsaw.PluginLoader((os.path.abspath(os.path.join(os.path.abspath(__file__), "..", "plugins")),))
j.quickload()
assert j.get_plugin_loaded("Basic Test")

0 comments on commit 4574b33

Please sign in to comment.