Skip to content

Commit 7b1217d

Browse files
authored
Re-enable plugins
1 parent 397746e commit 7b1217d

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

activity_browser/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
from .application import application
88
from .signals import signals
99
from .settings import ab_settings, project_settings
10-
from .controllers import *
1110
from .info import __version__ as version
1211
from .layouts.main import MainWindow
1312
from .plugin import Plugin
13+
from .controllers import *
1414

1515

1616
def load_settings() -> None:

activity_browser/controllers/plugin.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,21 @@ def load_plugin(self, name):
4141
importlib.reload(plugin_lib)
4242
return plugin_lib.Plugin()
4343
except Exception as e:
44-
log.error("Error: Import of plugin {} failed".format(name), error=e)
44+
log.error(f"Import of plugin '{name}' failed: {e}")
4545

4646
def add_plugin(self, name, select: bool = True):
4747
"""add or reload tabs of the given plugin"""
4848
if select:
4949
plugin = self.plugins[name]
5050
# Apply plugin load() function
51-
plugin.load()
51+
try:
52+
plugin.load()
53+
except Exception as e:
54+
log.warning(f"Failed to load plugin '{name}' due to an error in the plugin, ignoring plugin. "
55+
"If this keeps happening contact the plugin developers and let them know of this error:"
56+
f"\n{e}")
57+
return
58+
5259
# Add plugins tabs
5360
for tab in plugin.tabs:
5461
application.main_window.add_tab_to_panel(
@@ -78,7 +85,7 @@ def reload_plugins(self):
7885
try:
7986
self.add_plugin(name)
8087
except:
81-
log.error(f"Error: plugin {name} not installed")
88+
log.warning(f"Tried to load plugin '{name}' but it is not installed, ignoring plugin")
8289

8390
def close(self):
8491
"""close all plugins"""

0 commit comments

Comments
 (0)