2024-09-08 23:53:42 -04:00

41 lines
1.4 KiB
Diff

79a80,104
>
> def _create_plugin_tab(self, plugin):
> from gramps.gui.pluginmanager import GuiPluginManager
> pmgr = GuiPluginManager.get_instance()
> mod = pmgr.load_plugin(plugin)
> if not mod is None:
>
> done = False
> tab_views = plugin.tabviews
> if tab_views is None:
> done = True
> else:
> for tab_view in tab_views:
> if tab_view == 'EditSecondary' or tab_view == type(self).__name__:
> done = True
> break
>
> if done:
>
> tab_class = getattr(mod, plugin.tabclass)
> tab = tab_class(self.dbstate, self.uistate, self.track)
>
> return tab
>
> return None
81a107,115
> # load custom tabs from EDITORTAB plugins
> from gramps.gui.pluginmanager import PluginRegister
> plugs = PluginRegister.get_instance().editortab_plugins()
> for plug in plugs:
> print("found plugin " + plug.name)
> tab = self._create_plugin_tab(plug)
> if tab is not None:
> tab.obj = self.obj
> if hasattr(tab, 'load'):
> tab.load()
>
> self._add_tab(notebook, tab)
>