From 64f48e95e853147262a7e83079ef10808b34c4ac Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Thu, 5 Jun 2008 16:17:09 +0000 Subject: [PATCH] Thu, 05 Jun 2008 18:16:05 +0200 Improve/fix podcast list tooltips as suggested by the Usability Test * src/gpodder/gui.py: Restructure and redesign the podcast list according to the suggestions in the Usability Test * src/gpodder/libpodcasts.py: Add helping code for the new tooltips git-svn-id: svn://svn.berlios.de/gpodder/trunk@731 b0d088ad-0a06-0410-aad2-9ed5178a7e87 --- ChangeLog | 7 +++++++ src/gpodder/gui.py | 42 ++++++++++++++++++++++++++++++++++++++---- src/gpodder/libpodcasts.py | 6 ++++++ 3 files changed, 51 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index f019911f..43369aa2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Thu, 05 Jun 2008 18:16:05 +0200 +Improve/fix podcast list tooltips as suggested by the Usability Test + + * src/gpodder/gui.py: Restructure and redesign the podcast list + according to the suggestions in the Usability Test + * src/gpodder/libpodcasts.py: Add helping code for the new tooltips + Thu, 05 Jun 2008 18:12:20 +0200 New (optional) dependency: PIL (for Rockbox Cover Art) diff --git a/src/gpodder/gui.py b/src/gpodder/gui.py index 25c3f71e..d34c0013 100644 --- a/src/gpodder/gui.py +++ b/src/gpodder/gui.py @@ -554,13 +554,47 @@ class gPodder(GladeWidget): self.last_tooltip_channel = None return False self.last_tooltip_channel = channel - tooltip.set_icon(channel.get_cover_pixbuf()) - diskspace_str = _('Used disk space: %s') % util.format_filesize(channel.save_dir_size) + channel.request_save_dir_size() + diskspace_str = gl.format_filesize(channel.save_dir_size, 0) error_str = model.get_value(iter, 6) if error_str: error_str = _('Feedparser error: %s') % saxutils.escape(error_str.strip()) - error_str = '%s\n' % error_str - tooltip.set_markup( '%s\n%s\n%s%s\n\n%s' % (saxutils.escape(channel.title), saxutils.escape(channel.url), error_str, saxutils.escape(channel.description), diskspace_str)) + error_str = '%s' % error_str + table = gtk.Table(rows=3, columns=3) + table.set_row_spacings(5) + table.set_col_spacings(5) + table.set_border_width(5) + + heading = gtk.Label() + heading.set_alignment(0, 1) + heading.set_markup('%s\n%s' % (saxutils.escape(channel.title), saxutils.escape(channel.url))) + table.attach(heading, 0, 1, 0, 1) + size_info = gtk.Label() + size_info.set_alignment(1, 1) + size_info.set_justify(gtk.JUSTIFY_RIGHT) + size_info.set_markup('%s\n%s' % (diskspace_str, _('disk usage'))) + table.attach(size_info, 2, 3, 0, 1) + + table.attach(gtk.HSeparator(), 0, 3, 1, 2) + + if len(channel.description) < 500: + description = channel.description + else: + pos = channel.description.find('\n\n') + if pos == -1 or pos > 500: + description = channel.description[:498]+'[...]' + else: + description = channel.description[:pos] + + description = gtk.Label(description) + if error_str: + description.set_markup(error_str) + description.set_alignment(0, 0) + description.set_line_wrap(True) + table.attach(description, 0, 3, 2, 3) + + table.show_all() + tooltip.set_custom(table) return True diff --git a/src/gpodder/libpodcasts.py b/src/gpodder/libpodcasts.py index 57385a75..8aaa20b3 100644 --- a/src/gpodder/libpodcasts.py +++ b/src/gpodder/libpodcasts.py @@ -227,9 +227,15 @@ class podcastChannel(list): self.password = '' self.save_dir_size = 0 + self.__save_dir_size_set = False self.__tree_model = None + def request_save_dir_size(self): + if not self.__save_dir_size_set: + self.update_save_dir_size() + self.__save_dir_size_set = True + def update_save_dir_size(self): self.save_dir_size = util.calculate_size(self.save_dir) -- 2.11.4.GIT