From 75a43162820a2a7057f272991e90fea3620e704e Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Tue, 23 Nov 2010 16:00:26 +0100 Subject: [PATCH] Maemo 5: Time display + playback fixes --- src/gpodder/gtkui/frmntl/model.py | 10 ++++------ src/gpodder/gtkui/model.py | 7 +++---- src/gpodder/gui.py | 31 ++++++++++++++----------------- 3 files changed, 21 insertions(+), 27 deletions(-) diff --git a/src/gpodder/gtkui/frmntl/model.py b/src/gpodder/gtkui/frmntl/model.py index 6a53293b..0927769b 100644 --- a/src/gpodder/gtkui/frmntl/model.py +++ b/src/gpodder/gtkui/frmntl/model.py @@ -54,13 +54,13 @@ class DownloadStatusModel(download.DownloadStatusModel): class EpisodeListModel(gtk.GenericTreeModel): - N_COLUMNS = 17 + N_COLUMNS = 16 C_URL, C_TITLE, C_FILESIZE_TEXT, C_EPISODE, C_STATUS_ICON, \ C_PUBLISHED_TEXT, C_DESCRIPTION, C_TOOLTIP, \ C_VIEW_SHOW_UNDELETED, C_VIEW_SHOW_DOWNLOADED, \ C_VIEW_SHOW_UNPLAYED, C_FILESIZE, C_PUBLISHED, \ - C_TIME, C_TIME1_VISIBLE, C_TIME2_VISIBLE, \ + C_TIME, C_TIME_VISIBLE, \ C_LOCKED = range(N_COLUMNS) DATA_TYPES = (str, str, str, object, str , str, str, \ @@ -165,10 +165,8 @@ class EpisodeListModel(gtk.GenericTreeModel): return episode.pubDate elif column == self.C_TIME: return episode.get_play_info_string() - elif column == self.C_TIME1_VISIBLE: - return (episode.total_time and not episode.current_position) - elif column == self.C_TIME2_VISIBLE: - return (episode.total_time and episode.current_position) + elif column == self.C_TIME_VISIBLE: + return episode.total_time elif column == self.C_LOCKED: return episode.is_locked and \ episode.state == gpodder.STATE_DOWNLOADED and \ diff --git a/src/gpodder/gtkui/model.py b/src/gpodder/gtkui/model.py index de9577c2..ad93e8a9 100644 --- a/src/gpodder/gtkui/model.py +++ b/src/gpodder/gtkui/model.py @@ -47,8 +47,8 @@ class EpisodeListModel(gtk.ListStore): C_PUBLISHED_TEXT, C_DESCRIPTION, C_TOOLTIP, \ C_VIEW_SHOW_UNDELETED, C_VIEW_SHOW_DOWNLOADED, \ C_VIEW_SHOW_UNPLAYED, C_FILESIZE, C_PUBLISHED, \ - C_TIME, C_TIME1_VISIBLE, C_TIME2_VISIBLE, \ - C_LOCKED = range(17) + C_TIME, C_TIME_VISIBLE, \ + C_LOCKED = range(16) SEARCH_COLUMNS = (C_TITLE, C_DESCRIPTION) @@ -365,8 +365,7 @@ class EpisodeListModel(gtk.ListStore): self.C_DESCRIPTION, description, \ self.C_TOOLTIP, tooltip, \ self.C_TIME, episode.get_play_info_string(), \ - self.C_TIME1_VISIBLE, episode.total_time and not episode.current_position, \ - self.C_TIME2_VISIBLE, episode.total_time and episode.current_position, \ + self.C_TIME_VISIBLE, episode.total_time, \ self.C_LOCKED, episode.is_locked) def _get_icon_from_image(self,image_path, icon_size): diff --git a/src/gpodder/gui.py b/src/gpodder/gui.py index bf8de889..c98f5684 100644 --- a/src/gpodder/gui.py +++ b/src/gpodder/gui.py @@ -32,6 +32,7 @@ import time import tempfile import collections import threading +import urllib from xml.sax import saxutils @@ -594,7 +595,7 @@ class gPodder(BuilderWidget, dbus.service.Object): if uri.startswith(prefix): # File is on the local filesystem in the download folder - filename = uri[len(prefix):] + filename = urllib.unquote(uri[len(prefix):]) file_parts = [x for x in filename.split(os.sep) if x] if len(file_parts) == 2: @@ -1052,27 +1053,15 @@ class gPodder(BuilderWidget, dbus.service.Object): if gpodder.ui.fremantle: from gpodder.gtkui.frmntl import style timecell = gtk.CellRendererText() - timecell.set_property('font-desc', style.get_font_desc('SystemFont')) + timecell.set_property('font-desc', style.get_font_desc('SmallSystemFont')) timecell.set_property('foreground-gdk', style.get_color('SecondaryTextColor')) timecell.set_property('alignment', pango.ALIGN_RIGHT) timecell.set_property('xalign', 1.) timecell.set_property('xpad', 5) + timecell.set_property('yalign', .85) namecolumn.pack_start(timecell, False) namecolumn.add_attribute(timecell, 'text', EpisodeListModel.C_TIME) - namecolumn.add_attribute(timecell, 'visible', EpisodeListModel.C_TIME1_VISIBLE) - - # Add another cell renderer to fix a sizing issue (one renderer - # only renders short text and the other one longer text to avoid - # having titles of episodes unnecessarily cut off) - timecell = gtk.CellRendererText() - timecell.set_property('font-desc', style.get_font_desc('SystemFont')) - timecell.set_property('foreground-gdk', style.get_color('SecondaryTextColor')) - timecell.set_property('alignment', pango.ALIGN_RIGHT) - timecell.set_property('xalign', 1.) - timecell.set_property('xpad', 5) - namecolumn.pack_start(timecell, False) - namecolumn.add_attribute(timecell, 'text', EpisodeListModel.C_TIME) - namecolumn.add_attribute(timecell, 'visible', EpisodeListModel.C_TIME2_VISIBLE) + namecolumn.add_attribute(timecell, 'visible', EpisodeListModel.C_TIME_VISIBLE) lockcell = gtk.CellRendererPixbuf() lockcell.set_property('stock-size', gtk.ICON_SIZE_MENU) @@ -2315,7 +2304,15 @@ class gPodder(BuilderWidget, dbus.service.Object): # file names via D-Bus, so we simply place all file names into a # temporary M3U playlist and open that with the Media Player. m3u_filename = os.path.join(gpodder.home, 'gpodder_open_with.m3u') - util.write_m3u_playlist(m3u_filename, groups['default'], extm3u=False) + + def to_url(x): + if '://' not in x: + return 'file://' + urllib.quote(os.path.abspath(x)) + return x + + util.write_m3u_playlist(m3u_filename, \ + map(to_url, groups['default']), \ + extm3u=False) util.gui_open(m3u_filename) else: for filename in groups['default']: -- 2.11.4.GIT