-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Jack Cherng <[email protected]>
- Loading branch information
Showing
3 changed files
with
20 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,12 @@ | ||
def plugin_reload() -> None: | ||
def reload_plugin() -> None: | ||
import sys | ||
|
||
# Remove all previously loaded plugin modules. | ||
prefix = f"{__package__}." | ||
for module_name in tuple(filter(lambda m: m.startswith(prefix) and m != __name__, sys.modules)): | ||
del sys.modules[module_name] | ||
|
||
|
||
plugin_reload() | ||
reload_plugin() | ||
|
||
from .plugin import set_up | ||
from .plugin import tear_down | ||
from .plugin.commands import * # noqa: F401, F403 | ||
|
||
|
||
def plugin_loaded() -> None: | ||
set_up() | ||
|
||
|
||
def plugin_unloaded() -> None: | ||
tear_down() | ||
from .plugin import * # noqa: F401, F403 |
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,6 +1,20 @@ | ||
def set_up() -> None: | ||
# import all listeners and commands | ||
from .commands.fanhuaji_convert import FanhuajiConvertCommand | ||
from .commands.fanhuaji_convert_panel import FanhuajiConvertPanelCommand | ||
|
||
__all__ = ( | ||
# ST: core | ||
"plugin_loaded", | ||
"plugin_unloaded", | ||
# ST: commands | ||
"FanhuajiConvertCommand", | ||
"FanhuajiConvertPanelCommand", | ||
) | ||
|
||
|
||
def plugin_loaded() -> None: | ||
pass | ||
|
||
|
||
def tear_down() -> None: | ||
def plugin_unloaded() -> None: | ||
pass |
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,7 +0,0 @@ | ||
from .fanhuaji_convert import FanhuajiConvertCommand | ||
from .fanhuaji_convert_panel import FanhuajiConvertPanelCommand | ||
|
||
__all__ = ( | ||
"FanhuajiConvertCommand", | ||
"FanhuajiConvertPanelCommand", | ||
) | ||