Skip to content

Commit

Permalink
Display external plugins in the dependencies dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
goanpeca committed Jul 14, 2020
1 parent b475ef1 commit 8a47f4d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions spyder/app/mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -1338,6 +1338,14 @@ def create_edit_action(text, tr_text, icon):
configuration=CONF,
)
self.register_plugin(plugin_instance, external=True)

# These attributes come from spyder.app.solver
module = plugin_class._spyder_module_name
package_name = plugin_class._spyder_package_name
version = plugin_class._spyder_version
description = plugin_instance.get_description()
dependencies.add(module, package_name, description,
version, None, kind=dependencies.PLUGIN)
except Exception as error:
print("%s: %s" % (plugin_class, str(error)), file=STDERR)
traceback.print_exc(file=STDERR)
Expand Down
6 changes: 6 additions & 0 deletions spyder/app/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ def find_external_plugins():
class_name = entry_point.attrs[0]
mod = importlib.import_module(entry_point.module_name)
plugin_class = getattr(mod, class_name, None)

# To display in dependencies dialog
plugin_class._spyder_module_name = entry_point.module_name
plugin_class._spyder_package_name = entry_point.dist.project_name
plugin_class._spyder_version = entry_point.dist.version

external_plugins[name] = plugin_class
if name != plugin_class.NAME:
raise SpyderAPIError(
Expand Down

0 comments on commit 8a47f4d

Please sign in to comment.