Commit 06b0bcf85cba85d14bb4f76160e406f6917b55a1
1 parent
0ac26eef
Exists in
master
ENH: Added plugin folder option to be in the main directory
Showing
2 changed files
with
5 additions
and
1 deletions
Show diff stats
invesalius/inv_paths.py
@@ -38,6 +38,8 @@ OLD_USER_LOG_DIR = OLD_USER_INV_DIR.joinpath("logs") | @@ -38,6 +38,8 @@ OLD_USER_LOG_DIR = OLD_USER_INV_DIR.joinpath("logs") | ||
38 | 38 | ||
39 | INV_TOP_DIR = pathlib.Path(__file__).parent.parent.resolve() | 39 | INV_TOP_DIR = pathlib.Path(__file__).parent.parent.resolve() |
40 | 40 | ||
41 | +PLUGIN_DIRECTORY = INV_TOP_DIR.joinpath("plugins") | ||
42 | + | ||
41 | ICON_DIR = INV_TOP_DIR.joinpath("icons") | 43 | ICON_DIR = INV_TOP_DIR.joinpath("icons") |
42 | SAMPLE_DIR = INV_TOP_DIR.joinpath("samples") | 44 | SAMPLE_DIR = INV_TOP_DIR.joinpath("samples") |
43 | DOC_DIR = INV_TOP_DIR.joinpath("docs") | 45 | DOC_DIR = INV_TOP_DIR.joinpath("docs") |
invesalius/plugins.py
@@ -25,6 +25,7 @@ from pubsub import pub as Publisher | @@ -25,6 +25,7 @@ from pubsub import pub as Publisher | ||
25 | 25 | ||
26 | import invesalius.constants as consts | 26 | import invesalius.constants as consts |
27 | from invesalius import inv_paths | 27 | from invesalius import inv_paths |
28 | +from itertools import chain | ||
28 | 29 | ||
29 | 30 | ||
30 | def import_source(module_name, module_file_path): | 31 | def import_source(module_name, module_file_path): |
@@ -44,7 +45,8 @@ class PluginManager: | @@ -44,7 +45,8 @@ class PluginManager: | ||
44 | 45 | ||
45 | def find_plugins(self): | 46 | def find_plugins(self): |
46 | self.plugins = {} | 47 | self.plugins = {} |
47 | - for p in sorted(inv_paths.USER_PLUGINS_DIRECTORY.glob("*")): | 48 | + for p in sorted(chain(inv_paths.USER_PLUGINS_DIRECTORY.glob("*"),\ |
49 | + inv_paths.PLUGIN_DIRECTORY.glob("*"))): | ||
48 | if p.is_dir(): | 50 | if p.is_dir(): |
49 | try: | 51 | try: |
50 | with p.joinpath("plugin.json").open() as f: | 52 | with p.joinpath("plugin.json").open() as f: |