From 06b0bcf85cba85d14bb4f76160e406f6917b55a1 Mon Sep 17 00:00:00 2001 From: phamorim Date: Mon, 15 Jun 2020 11:27:49 -0300 Subject: [PATCH] ENH: Added plugin folder option to be in the main directory --- invesalius/inv_paths.py | 2 ++ invesalius/plugins.py | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/invesalius/inv_paths.py b/invesalius/inv_paths.py index 96ea744..c1376bb 100644 --- a/invesalius/inv_paths.py +++ b/invesalius/inv_paths.py @@ -38,6 +38,8 @@ OLD_USER_LOG_DIR = OLD_USER_INV_DIR.joinpath("logs") INV_TOP_DIR = pathlib.Path(__file__).parent.parent.resolve() +PLUGIN_DIRECTORY = INV_TOP_DIR.joinpath("plugins") + ICON_DIR = INV_TOP_DIR.joinpath("icons") SAMPLE_DIR = INV_TOP_DIR.joinpath("samples") DOC_DIR = INV_TOP_DIR.joinpath("docs") diff --git a/invesalius/plugins.py b/invesalius/plugins.py index d04664a..8a36f58 100644 --- a/invesalius/plugins.py +++ b/invesalius/plugins.py @@ -25,6 +25,7 @@ from pubsub import pub as Publisher import invesalius.constants as consts from invesalius import inv_paths +from itertools import chain def import_source(module_name, module_file_path): @@ -44,7 +45,8 @@ class PluginManager: def find_plugins(self): self.plugins = {} - for p in sorted(inv_paths.USER_PLUGINS_DIRECTORY.glob("*")): + for p in sorted(chain(inv_paths.USER_PLUGINS_DIRECTORY.glob("*"),\ + inv_paths.PLUGIN_DIRECTORY.glob("*"))): if p.is_dir(): try: with p.joinpath("plugin.json").open() as f: -- libgit2 0.21.2