[kupfer] preferences: Parse and display the standard ImportError message nicer
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [kupfer] preferences: Parse and display the standard ImportError message nicer
- Date: Sun, 11 Oct 2009 21:49:25 +0000 (UTC)
commit 282f13d24447ce1ac75c8a10bdc7f58a8564a585
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Sun Oct 11 23:28:35 2009 +0200
preferences: Parse and display the standard ImportError message nicer
Make the error when importing plugins "No module named %s"
localizable.
kupfer/preferences.py | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/kupfer/preferences.py b/kupfer/preferences.py
index be0f11d..283f232 100644
--- a/kupfer/preferences.py
+++ b/kupfer/preferences.py
@@ -1,11 +1,13 @@
+import os
+import re
+
import gtk
import gio
import gobject
import pango
-
from xdg import BaseDirectory as base
from xdg import DesktopEntry as desktop
-import os
+
from kupfer import config, plugins, pretty, settings, utils, icons
from kupfer import keybindings
@@ -295,6 +297,13 @@ class PreferencesWindowController (pretty.OutputMixin):
# Check for plugin load error
error = plugins.get_plugin_error(plugin_id)
if error:
+ # TRANS: Error message when Plugin needs a Python module to load
+ import_error_localized = _("Python module '%s' is needed") % u"\\1"
+ import_error_pat = u"No module named ([^\s]+)"
+ if re.match(import_error_pat, error):
+ error = re.sub("No module named ([^\s]+)",
+ import_error_localized,
+ error, count=1)
label = gtk.Label()
label.set_alignment(0, 0)
label.set_markup(u"<b>%s</b>\n%s" %
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]