Commit 06b0bcf85cba85d14bb4f76160e406f6917b55a1

Authored by Paulo Henrique Junqueira Amorim
1 parent 0ac26eef
Exists in master

ENH: Added plugin folder option to be in the main directory

invesalius/inv_paths.py
... ... @@ -38,6 +38,8 @@ OLD_USER_LOG_DIR = OLD_USER_INV_DIR.joinpath("logs")
38 38  
39 39 INV_TOP_DIR = pathlib.Path(__file__).parent.parent.resolve()
40 40  
  41 +PLUGIN_DIRECTORY = INV_TOP_DIR.joinpath("plugins")
  42 +
41 43 ICON_DIR = INV_TOP_DIR.joinpath("icons")
42 44 SAMPLE_DIR = INV_TOP_DIR.joinpath("samples")
43 45 DOC_DIR = INV_TOP_DIR.joinpath("docs")
... ...
invesalius/plugins.py
... ... @@ -25,6 +25,7 @@ from pubsub import pub as Publisher
25 25  
26 26 import invesalius.constants as consts
27 27 from invesalius import inv_paths
  28 +from itertools import chain
28 29  
29 30  
30 31 def import_source(module_name, module_file_path):
... ... @@ -44,7 +45,8 @@ class PluginManager:
44 45  
45 46 def find_plugins(self):
46 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 50 if p.is_dir():
49 51 try:
50 52 with p.joinpath("plugin.json").open() as f:
... ...