[kupfer: 33/41] icons: Catch and print errors for malformed icon-list data
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [kupfer: 33/41] icons: Catch and print errors for malformed icon-list data
- Date: Tue, 26 Apr 2011 17:15:34 +0000 (UTC)
commit ceb03c0bfa7e1e5cc260df7d060ab44edaee57ef
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Tue Apr 26 18:45:48 2011 +0200
icons: Catch and print errors for malformed icon-list data
kupfer/icons.py | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/kupfer/icons.py b/kupfer/icons.py
index af41403..dbd4408 100644
--- a/kupfer/icons.py
+++ b/kupfer/icons.py
@@ -55,6 +55,8 @@ def parse_load_icon_list(icon_list_data, get_data_func, plugin_name=None):
continue
fields = map(str.strip, line.split('\t'))
if len(fields) < 2:
+ pretty.print_error(__name__, "Malformed icon-list line %r from %r" %
+ (line, plugin_name))
continue
icon_name, basename = fields[:2]
override = ('!override' in fields)
@@ -75,7 +77,13 @@ def load_icon_from_func(plugin_name, icon_name, get_data_func, override=False):
if not override and _default_theme.has_icon(icon_name):
pretty.print_debug(__name__, "Skipping themed icon", icon_name)
return
- icon_data = get_data_func()
+ try:
+ icon_data = get_data_func()
+ except:
+ pretty.print_error(__name__, "Error loading icon %r for %r" %
+ (icon_name, plugin_name))
+ pretty.print_exc(__name__)
+ return
for size in (SMALL_SZ, LARGE_SZ):
pixbuf = get_pixbuf_from_data(icon_data, size, size)
gtk.icon_theme_add_builtin_icon(icon_name, size, pixbuf)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]