[#3003] [Label] Fix duplicate context menu entries

This commit is contained in:
Calum Lind 2017-03-22 00:07:34 +00:00
parent f32c8aff90
commit 648dc93655
2 changed files with 9 additions and 8 deletions

View File

@ -179,8 +179,10 @@ class PluginManagerBase(object):
return True
def on_started_error(result, instance):
log.warn('Failed to start plugin: %s\n%s', plugin_name, result.getTraceback())
component.deregister(instance.plugin)
log.error('Failed to start plugin: %s\n%s', plugin_name,
result.getTraceback(elideFrameworkCode=1, detail='brief'))
self.plugins[plugin_name.replace('-', ' ')] = instance
self.disable_plugin(plugin_name)
return False
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)
except Exception as ex:
log.error('Error when disabling plugin: %s', self.plugin._component_name)
log.exception(ex)
log.debug(ex)
d = defer.succeed(False)
def on_disabled(result):
ret = True
if isinstance(result, Failure):
log.error('Error when disabling plugin: %s', name)
log.exception(result.getTraceback())
log.debug('Error when disabling plugin %s: %s', name, result.getTraceback())
ret = False
try:
component.deregister(self.plugins[name].plugin)
del self.plugins[name]
self.config['enabled_plugins'].remove(name)
except Exception as ex:
log.error('Unable to disable plugin: %s', name)
log.exception(ex)
log.warning('Problems occured disabling plugin: %s', name)
log.debug(ex)
ret = False
else:
log.info('Plugin %s disabled...', name)

View File

@ -31,7 +31,7 @@ class LabelConfig(object):
def load(self):
log.debug('Adding Label Preferences page')
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.register_hook('on_show_prefs', self.load_settings)