- [bug 681] removed force plugin load from plugin and separated the code in a diff issue
Plugin Submission + Generic Plugin Utility Functions & KeyBinding Feature: Mouseless / Mousefree / Keyboard URL opening or yanking
This commit is contained in:
parent
64a6e391ac
commit
d39968ebba
|
@ -69,14 +69,12 @@ class PluginRegistry(borg.Borg):
|
||||||
if not self.available_plugins:
|
if not self.available_plugins:
|
||||||
self.available_plugins = {}
|
self.available_plugins = {}
|
||||||
|
|
||||||
def load_plugins(self, force=False):
|
def load_plugins(self):
|
||||||
"""Load all plugins present in the plugins/ directory in our module"""
|
"""Load all plugins present in the plugins/ directory in our module"""
|
||||||
if self.done and (not force):
|
if self.done:
|
||||||
dbg('Already loaded')
|
dbg('Already loaded')
|
||||||
return
|
return
|
||||||
|
|
||||||
dbg('loading plugins, force:(%s)' % force)
|
|
||||||
|
|
||||||
config = Config()
|
config = Config()
|
||||||
|
|
||||||
for plugindir in self.path:
|
for plugindir in self.path:
|
||||||
|
@ -95,8 +93,8 @@ class PluginRegistry(borg.Borg):
|
||||||
try:
|
try:
|
||||||
module = __import__(plugin[:-3], None, None, [''])
|
module = __import__(plugin[:-3], None, None, [''])
|
||||||
for item in getattr(module, 'AVAILABLE'):
|
for item in getattr(module, 'AVAILABLE'):
|
||||||
func = getattr(module, item)
|
|
||||||
if item not in list(self.available_plugins.keys()):
|
if item not in list(self.available_plugins.keys()):
|
||||||
|
func = getattr(module, item)
|
||||||
self.available_plugins[item] = func
|
self.available_plugins[item] = func
|
||||||
|
|
||||||
if item not in config['enabled_plugins']:
|
if item not in config['enabled_plugins']:
|
||||||
|
@ -104,14 +102,6 @@ class PluginRegistry(borg.Borg):
|
||||||
continue
|
continue
|
||||||
if item not in self.instances:
|
if item not in self.instances:
|
||||||
self.instances[item] = func()
|
self.instances[item] = func()
|
||||||
elif force:
|
|
||||||
#instead of multiple copies of loaded
|
|
||||||
#plugin objects, unload where plugins
|
|
||||||
#can clean up and then re-init so there
|
|
||||||
#is one plugin object
|
|
||||||
self.instances[item].unload()
|
|
||||||
self.instances.pop(item, None)
|
|
||||||
self.instances[item] = func()
|
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
err('PluginRegistry::load_plugins: Importing plugin %s \
|
err('PluginRegistry::load_plugins: Importing plugin %s \
|
||||||
failed: %s' % (plugin, ex))
|
failed: %s' % (plugin, ex))
|
||||||
|
|
|
@ -156,13 +156,6 @@ class Terminal(Gtk.VBox):
|
||||||
dbg('composite_support: %s' % self.composite_support)
|
dbg('composite_support: %s' % self.composite_support)
|
||||||
|
|
||||||
self.vte.show()
|
self.vte.show()
|
||||||
|
|
||||||
#force to load for new window/terminal use case loading plugin
|
|
||||||
#and connecting signals, note the line update_url_matches also
|
|
||||||
#calls load_plugins, but it won't reload since already loaded
|
|
||||||
|
|
||||||
self.load_plugins(force = True)
|
|
||||||
|
|
||||||
self.update_url_matches()
|
self.update_url_matches()
|
||||||
|
|
||||||
self.terminalbox = self.create_terminalbox()
|
self.terminalbox = self.create_terminalbox()
|
||||||
|
@ -292,10 +285,6 @@ class Terminal(Gtk.VBox):
|
||||||
|
|
||||||
return(terminalbox)
|
return(terminalbox)
|
||||||
|
|
||||||
def load_plugins(self, force = False):
|
|
||||||
registry = plugin.PluginRegistry()
|
|
||||||
registry.load_plugins(force)
|
|
||||||
|
|
||||||
def _add_regex(self, name, re):
|
def _add_regex(self, name, re):
|
||||||
match = -1
|
match = -1
|
||||||
if regex.FLAGS_PCRE2:
|
if regex.FLAGS_PCRE2:
|
||||||
|
|
Loading…
Reference in New Issue