[kupfer] preferences: Display Plugin Load error in Info sidebar
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [kupfer] preferences: Display Plugin Load error in Info sidebar
- Date: Fri, 9 Oct 2009 00:01:47 +0000 (UTC)
commit ef5fa981c1e442e433af5cb20db0bc93bfee6961
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Thu Oct 8 22:10:24 2009 +0200
preferences: Display Plugin Load error in Info sidebar
kupfer/plugins.py | 11 +++++++++++
kupfer/preferences.py | 9 +++++++++
2 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/kupfer/plugins.py b/kupfer/plugins.py
index 0bf3a7e..6277c8d 100644
--- a/kupfer/plugins.py
+++ b/kupfer/plugins.py
@@ -221,3 +221,14 @@ def initialize_plugin(plugin_name):
return
settings_dict.initialize(plugin_name)
+def get_plugin_error(plugin_name):
+ """
+ Return None if plugin is loaded without error, else
+ return a string describing the error.
+ """
+ try:
+ plugin = import_plugin(plugin_name)
+ if getattr(plugin, "is_fake_plugin", None):
+ return plugin.error_message
+ except ImportError, e:
+ return "'%s' is not a plugin" % plugin_name
diff --git a/kupfer/preferences.py b/kupfer/preferences.py
index 90ccb3f..be0f11d 100644
--- a/kupfer/preferences.py
+++ b/kupfer/preferences.py
@@ -292,6 +292,15 @@ class PreferencesWindowController (pretty.OutputMixin):
infobox.pack_start(label, False)
about.pack_start(infobox, False)
+ # Check for plugin load error
+ error = plugins.get_plugin_error(plugin_id)
+ if error:
+ label = gtk.Label()
+ label.set_alignment(0, 0)
+ label.set_markup(u"<b>%s</b>\n%s" %
+ (_("Plugin could not be read due to an error:"), error))
+ about.pack_start(label, False)
+
wid = self._make_plugin_info_widget(plugin_id)
about.pack_start(wid, False)
psettings_wid = self._make_plugin_settings_widget(plugin_id)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]