From 1f15881a3c077f6bbf33e64c6f1a9f486c9f0b63 Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Mon, 16 Nov 2009 15:21:57 +0100 Subject: [PATCH] Fix download list style on Maemo 5 (Maemo bug 4687) This makes the primary and secondary text in the download list take the style from the sytem theme. --- src/gpodder/gtkui/download.py | 9 ++++---- src/gpodder/gtkui/frmntl/model.py | 47 +++++++++++++++++++++++++++++++++++++++ src/gpodder/gui.py | 7 +++++- 3 files changed, 58 insertions(+), 5 deletions(-) create mode 100644 src/gpodder/gtkui/frmntl/model.py diff --git a/src/gpodder/gtkui/download.py b/src/gpodder/gtkui/download.py index 62a8f2b9..c9f355b4 100644 --- a/src/gpodder/gtkui/download.py +++ b/src/gpodder/gtkui/download.py @@ -54,6 +54,9 @@ class DownloadStatusModel(gtk.ListStore): self._status_ids[download.DownloadTask.CANCELLED] = gtk.STOCK_CANCEL self._status_ids[download.DownloadTask.PAUSED] = gtk.STOCK_MEDIA_PAUSE + def _format_message(self, episode, message, podcast): + return '%s\n%s - %s' % (episode, message, podcast) + def request_update(self, iter, task=None): if task is None: # Ongoing update request from UI - get task from model @@ -79,10 +82,8 @@ class DownloadStatusModel(gtk.ListStore): util.format_filesize(task.total_size)) self.set(iter, - self.C_NAME, '%s\n%s - %s' % (\ - task.markup_name, \ - status_message, \ - task.markup_podcast_name), + self.C_NAME, self._format_message(task.markup_name, \ + status_message, task.markup_podcast_name), self.C_PROGRESS, 100.*task.progress, self.C_PROGRESS_TEXT, '%.0f%%' % (task.progress*100.,), self.C_ICON_NAME, self._status_ids[task.status]) diff --git a/src/gpodder/gtkui/frmntl/model.py b/src/gpodder/gtkui/frmntl/model.py new file mode 100644 index 00000000..385b2dd2 --- /dev/null +++ b/src/gpodder/gtkui/frmntl/model.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +# +# gPodder - A media aggregator and podcast client +# Copyright (c) 2005-2009 Thomas Perl and the gPodder Team +# +# gPodder is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# gPodder is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + + +# +# gpodder.gtkui.frmntl.model -- Model customizations for Maemo 5 (2009-11-16) +# + +import gpodder + +_ = gpodder.gettext + +from gpodder.gtkui import download +from gpodder.gtkui.frmntl import style + +class DownloadStatusModel(download.DownloadStatusModel): + def __init__(self): + download.DownloadStatusModel.__init__(self) + head_font = style.get_font_desc('SystemFont') + head_color = style.get_color('ButtonTextColor') + head = (head_font.to_string(), head_color.to_string()) + head = '%%s' % head + sub_font = style.get_font_desc('SmallSystemFont') + sub_color = style.get_color('SecondaryTextColor') + sub = (sub_font.to_string(), sub_color.to_string()) + sub = '%%s - %%s' % sub + self._markup_template = '\n'.join((head, sub)) + + def _format_message(self, episode, message, podcast): + return self._markup_template % (episode, message, podcast) + diff --git a/src/gpodder/gui.py b/src/gpodder/gui.py index cb072921..96925e15 100644 --- a/src/gpodder/gui.py +++ b/src/gpodder/gui.py @@ -78,7 +78,6 @@ from gpodder.dbsqlite import Database from gpodder.gtkui.model import PodcastListModel from gpodder.gtkui.model import EpisodeListModel from gpodder.gtkui.config import UIConfig -from gpodder.gtkui.download import DownloadStatusModel from gpodder.gtkui.services import CoverDownloader from gpodder.gtkui.widgets import SimpleMessageArea from gpodder.gtkui.desktopfile import UserAppsReader @@ -90,6 +89,8 @@ from gpodder.gtkui.interface.common import TreeViewHelper from gpodder.gtkui.interface.addpodcast import gPodderAddPodcast if gpodder.ui.desktop: + from gpodder.gtkui.download import DownloadStatusModel + from gpodder.gtkui.desktop.sync import gPodderSyncUI from gpodder.gtkui.desktop.channel import gPodderChannel @@ -106,6 +107,8 @@ if gpodder.ui.desktop: log('Warning: This probably means your PyGTK installation is too old!') have_trayicon = False elif gpodder.ui.diablo: + from gpodder.gtkui.download import DownloadStatusModel + from gpodder.gtkui.maemo.channel import gPodderChannel from gpodder.gtkui.maemo.preferences import gPodderPreferences from gpodder.gtkui.maemo.shownotes import gPodderShownotes @@ -113,6 +116,8 @@ elif gpodder.ui.diablo: from gpodder.gtkui.maemo.podcastdirectory import gPodderPodcastDirectory have_trayicon = False elif gpodder.ui.fremantle: + from gpodder.gtkui.frmntl.model import DownloadStatusModel + from gpodder.gtkui.maemo.channel import gPodderChannel from gpodder.gtkui.frmntl.preferences import gPodderPreferences from gpodder.gtkui.frmntl.shownotes import gPodderShownotes -- 2.11.4.GIT