[#3003] [Label] Fix duplicate context menu entries
This commit is contained in:
parent
f32c8aff90
commit
648dc93655
|
@ -179,8 +179,10 @@ class PluginManagerBase(object):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def on_started_error(result, instance):
|
def on_started_error(result, instance):
|
||||||
log.warn('Failed to start plugin: %s\n%s', plugin_name, result.getTraceback())
|
log.error('Failed to start plugin: %s\n%s', plugin_name,
|
||||||
component.deregister(instance.plugin)
|
result.getTraceback(elideFrameworkCode=1, detail='brief'))
|
||||||
|
self.plugins[plugin_name.replace('-', ' ')] = instance
|
||||||
|
self.disable_plugin(plugin_name)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return_d.addCallbacks(on_started, on_started_error, callbackArgs=[instance], errbackArgs=[instance])
|
return_d.addCallbacks(on_started, on_started_error, callbackArgs=[instance], errbackArgs=[instance])
|
||||||
|
@ -207,22 +209,21 @@ class PluginManagerBase(object):
|
||||||
d = defer.maybeDeferred(self.plugins[name].disable)
|
d = defer.maybeDeferred(self.plugins[name].disable)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
log.error('Error when disabling plugin: %s', self.plugin._component_name)
|
log.error('Error when disabling plugin: %s', self.plugin._component_name)
|
||||||
log.exception(ex)
|
log.debug(ex)
|
||||||
d = defer.succeed(False)
|
d = defer.succeed(False)
|
||||||
|
|
||||||
def on_disabled(result):
|
def on_disabled(result):
|
||||||
ret = True
|
ret = True
|
||||||
if isinstance(result, Failure):
|
if isinstance(result, Failure):
|
||||||
log.error('Error when disabling plugin: %s', name)
|
log.debug('Error when disabling plugin %s: %s', name, result.getTraceback())
|
||||||
log.exception(result.getTraceback())
|
|
||||||
ret = False
|
ret = False
|
||||||
try:
|
try:
|
||||||
component.deregister(self.plugins[name].plugin)
|
component.deregister(self.plugins[name].plugin)
|
||||||
del self.plugins[name]
|
del self.plugins[name]
|
||||||
self.config['enabled_plugins'].remove(name)
|
self.config['enabled_plugins'].remove(name)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
log.error('Unable to disable plugin: %s', name)
|
log.warning('Problems occured disabling plugin: %s', name)
|
||||||
log.exception(ex)
|
log.debug(ex)
|
||||||
ret = False
|
ret = False
|
||||||
else:
|
else:
|
||||||
log.info('Plugin %s disabled...', name)
|
log.info('Plugin %s disabled...', name)
|
||||||
|
|
|
@ -31,7 +31,7 @@ class LabelConfig(object):
|
||||||
def load(self):
|
def load(self):
|
||||||
log.debug('Adding Label Preferences page')
|
log.debug('Adding Label Preferences page')
|
||||||
builder = Builder()
|
builder = Builder()
|
||||||
builder.add_from_file(self.get_resource('label_pref.glade'))
|
builder.add_from_file(self.get_resource('label_pref.ui'))
|
||||||
|
|
||||||
self.plugin.add_preferences_page(_('Label'), builder.get_object('label_prefs_box'))
|
self.plugin.add_preferences_page(_('Label'), builder.get_object('label_prefs_box'))
|
||||||
self.plugin.register_hook('on_show_prefs', self.load_settings)
|
self.plugin.register_hook('on_show_prefs', self.load_settings)
|
||||||
|
|
Loading…
Reference in New Issue