merge played and status column into status column with played bullet
git-svn-id: svn://svn.berlios.de/gpodder/branches/gpodder-thp-200708@380 b0d088ad-0a06-0410-aad2-9ed5178a7e87
This commit is contained in:
parent
b016d0ea92
commit
cc84369262
|
@ -3702,77 +3702,6 @@ Filesystem-based MP3 player</property>
|
|||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label86">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><b>Table Style</b></property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">7</property>
|
||||
<property name="bottom_attach">8</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="showplayed">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Display unplayed status in episode list</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">8</property>
|
||||
<property name="bottom_attach">9</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImage" id="image2422">
|
||||
<property name="visible">True</property>
|
||||
<property name="icon_size">6</property>
|
||||
<property name="icon_name">stock_search</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">8</property>
|
||||
<property name="bottom_attach">9</property>
|
||||
<property name="x_padding">6</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options">fill</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label81">
|
||||
<property name="visible">True</property>
|
||||
|
@ -3899,21 +3828,6 @@ Filesystem-based MP3 player</property>
|
|||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHSeparator" id="hseparator10">
|
||||
<property name="visible">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">9</property>
|
||||
<property name="bottom_attach">10</property>
|
||||
<property name="y_padding">6</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHSeparator" id="hseparator3">
|
||||
<property name="visible">True</property>
|
||||
|
|
|
@ -156,17 +156,11 @@ class Gpodder(SimpleGladeApp):
|
|||
self.treeAvailable.set_rules_hint( True)
|
||||
|
||||
iconcell = gtk.CellRendererPixbuf()
|
||||
iconcolumn = gtk.TreeViewColumn( _("Status"), iconcell)
|
||||
iconcolumn.add_attribute( iconcell, "icon-name", 4)
|
||||
|
||||
playedcell = gtk.CellRendererPixbuf()
|
||||
playedcolumn = gtk.TreeViewColumn( _("New"), playedcell)
|
||||
playedcolumn.add_attribute( playedcell, "icon-name", 8)
|
||||
self.played_column = playedcolumn
|
||||
iconcolumn = gtk.TreeViewColumn( _("Status"), iconcell, pixbuf = 4)
|
||||
|
||||
namecell = gtk.CellRendererText()
|
||||
#namecell.set_property('ellipsize', pango.ELLIPSIZE_END)
|
||||
namecolumn = gtk.TreeViewColumn( _("Episode"), namecell, text=1)
|
||||
namecolumn = gtk.TreeViewColumn( _("Episode"), namecell, text = 1)
|
||||
namecolumn.set_sizing( gtk.TREE_VIEW_COLUMN_AUTOSIZE)
|
||||
|
||||
sizecell = gtk.CellRendererText()
|
||||
|
@ -179,7 +173,7 @@ class Gpodder(SimpleGladeApp):
|
|||
desccell.set_property('ellipsize', pango.ELLIPSIZE_END)
|
||||
desccolumn = gtk.TreeViewColumn( _("Description"), desccell, text=6)
|
||||
|
||||
for itemcolumn in ( iconcolumn, playedcolumn, namecolumn, sizecolumn, releasecolumn, desccolumn ):
|
||||
for itemcolumn in ( iconcolumn, namecolumn, sizecolumn, releasecolumn, desccolumn ):
|
||||
itemcolumn.set_resizable( True)
|
||||
itemcolumn.set_reorderable( True)
|
||||
self.treeAvailable.append_column( itemcolumn)
|
||||
|
@ -356,7 +350,6 @@ class Gpodder(SimpleGladeApp):
|
|||
|
||||
def updateTreeView( self):
|
||||
gl = gPodderLib()
|
||||
self.played_column.set_visible( gl.show_played)
|
||||
|
||||
rect = self.treeAvailable.get_visible_rect()
|
||||
if self.channels:
|
||||
|
@ -1263,7 +1256,6 @@ class Gpodderproperties(SimpleGladeApp):
|
|||
self.spinLimitDownloads.set_value(gl.limit_rate_value)
|
||||
self.cbMaxDownloads.set_active(gl.max_downloads_enabled)
|
||||
self.spinMaxDownloads.set_value(gl.max_downloads)
|
||||
self.showplayed.set_active(gl.show_played)
|
||||
self.only_sync_not_played.set_active(gl.only_sync_not_played)
|
||||
if tagging_supported():
|
||||
self.updatetags.set_active(gl.update_tags)
|
||||
|
@ -1484,7 +1476,6 @@ class Gpodderproperties(SimpleGladeApp):
|
|||
gl.limit_rate_value = self.spinLimitDownloads.get_value()
|
||||
gl.max_downloads_enabled = self.cbMaxDownloads.get_active()
|
||||
gl.max_downloads = int(self.spinMaxDownloads.get_value())
|
||||
gl.show_played = self.showplayed.get_active()
|
||||
gl.update_tags = self.updatetags.get_active()
|
||||
gl.only_sync_not_played = self.only_sync_not_played.get_active()
|
||||
device_type = self.comboboxDeviceType.get_active()
|
||||
|
|
|
@ -132,7 +132,6 @@ class gPodderLibClass( object):
|
|||
self.use_gnome_bittorrent = True
|
||||
self.limit_rate = False
|
||||
self.limit_rate_value = 4.0
|
||||
self.show_played = False
|
||||
self.update_tags = False
|
||||
self.desktop_link = _("gPodder downloads")
|
||||
self.device_type = None
|
||||
|
@ -202,7 +201,6 @@ class gPodderLibClass( object):
|
|||
self.write_to_parser( parser, 'download_after_update', self.download_after_update)
|
||||
self.write_to_parser( parser, 'limit_rate', self.limit_rate)
|
||||
self.write_to_parser( parser, 'limit_rate_value', self.limit_rate_value)
|
||||
self.write_to_parser( parser, 'show_played', self.show_played)
|
||||
self.write_to_parser( parser, 'update_tags', self.update_tags)
|
||||
self.write_to_parser( parser, 'opml_url', self.opml_url)
|
||||
self.write_to_parser( parser, 'download_dir', self.downloaddir)
|
||||
|
@ -334,7 +332,6 @@ class gPodderLibClass( object):
|
|||
self.download_after_update = self.get_boolean_from_parser(parser, 'download_after_update', default=False)
|
||||
self.limit_rate = self.get_boolean_from_parser(parser, 'limit_rate', default=False)
|
||||
self.limit_rate_value = self.get_float_from_parser(parser, 'limit_rate_value', default=4.0)
|
||||
self.show_played = self.get_boolean_from_parser(parser, 'show_played', default=False)
|
||||
self.update_tags = self.get_boolean_from_parser(parser, 'update_tags', default=False)
|
||||
self.downloaddir = self.get_from_parser( parser, 'download_dir', expanduser('~/gpodder-downloads'))
|
||||
self.torrentdir = self.get_from_parser( parser, 'bittorrent_dir', expanduser('~/gpodder-downloads/torrents'))
|
||||
|
|
|
@ -102,6 +102,7 @@ class podcastChannel(ListType):
|
|||
MAP_FROM = 'abcdefghijklmnopqrstuvwxyz0123456789'
|
||||
MAP_TO = 'qazwsxedcrfvtgbyhnujmikolp9514738062'
|
||||
SETTINGS = ('sync_to_devices', 'is_music_channel', 'device_playlist_name','override_title','username','password')
|
||||
icon_cache = {}
|
||||
|
||||
storage = shelve.open( libgpodder.gPodderLib().feed_cache_file)
|
||||
fc = cache.Cache( storage)
|
||||
|
@ -133,6 +134,8 @@ class podcastChannel(ListType):
|
|||
episode = podcastItem.from_feedparser_entry( entry, channel)
|
||||
if episode:
|
||||
channel.append( episode)
|
||||
|
||||
channel.sort( reverse = True)
|
||||
|
||||
cls.storage.sync()
|
||||
return channel
|
||||
|
@ -374,43 +377,39 @@ class podcastChannel(ListType):
|
|||
|
||||
def iter_set_downloading_columns( self, model, iter, new_episodes = []):
|
||||
url = model.get_value( iter, 0)
|
||||
local_filename = model.get_value( iter, 9)
|
||||
local_filename = model.get_value( iter, 8)
|
||||
played = not libgpodder.gPodderLib().history_is_played( url)
|
||||
|
||||
played_icon = None
|
||||
if os.path.exists( local_filename):
|
||||
if not libgpodder.gPodderLib().history_is_played( url):
|
||||
played_icon = gtk.STOCK_YES
|
||||
|
||||
file_type = util.file_type_by_extension( util.file_extension_from_url( url))
|
||||
if file_type == 'audio':
|
||||
status_icon = 'audio-x-generic'
|
||||
status_icon = util.get_tree_icon( 'audio-x-generic', played, self.icon_cache)
|
||||
elif file_type == 'video':
|
||||
status_icon = 'video-x-generic'
|
||||
status_icon = util.get_tree_icon( 'video-x-generic', played, self.icon_cache)
|
||||
elif file_type == 'torrent':
|
||||
status_icon = 'applications-internet'
|
||||
status_icon = util.get_tree_icon( 'applications-internet', played, self.icon_cache)
|
||||
else:
|
||||
status_icon = 'unknown'
|
||||
status_icon = util.get_tree_icon( 'unknown', played, self.icon_cache)
|
||||
elif services.download_status_manager.is_download_in_progress( url):
|
||||
status_icon = gtk.STOCK_GO_DOWN
|
||||
status_icon = util.get_tree_icon( gtk.STOCK_GO_DOWN, icon_cache = self.icon_cache)
|
||||
elif libgpodder.gPodderLib().history_is_downloaded( url):
|
||||
status_icon = gtk.STOCK_DELETE
|
||||
status_icon = util.get_tree_icon( gtk.STOCK_DELETE, icon_cache = self.icon_cache)
|
||||
elif url in [ e.url for e in new_episodes ]:
|
||||
status_icon = gtk.STOCK_NEW
|
||||
status_icon = util.get_tree_icon( gtk.STOCK_NEW, icon_cache = self.icon_cache)
|
||||
else:
|
||||
status_icon = None
|
||||
|
||||
model.set( iter, 4, status_icon)
|
||||
model.set( iter, 8, played_icon)
|
||||
|
||||
def items_liststore( self):
|
||||
"""
|
||||
Return a gtk.ListStore containing episodes for this channel
|
||||
"""
|
||||
new_model = gtk.ListStore( gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_BOOLEAN, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING)
|
||||
new_model = gtk.ListStore( gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_BOOLEAN, gtk.gdk.Pixbuf, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING)
|
||||
new_episodes = self.get_new_episodes()
|
||||
|
||||
for item in self.get_all_episodes():
|
||||
new_iter = new_model.append( ( item.url, item.title, util.format_filesize( item.length), True, None, item.cute_pubdate(), item.one_line_description(), item.description, None, item.local_filename() ))
|
||||
new_iter = new_model.append( ( item.url, item.title, util.format_filesize( item.length), True, None, item.cute_pubdate(), item.one_line_description(), item.description, item.local_filename() ))
|
||||
self.iter_set_downloading_columns( new_model, new_iter, new_episodes)
|
||||
|
||||
return new_model
|
||||
|
|
|
@ -35,6 +35,8 @@ are not tied to any specific part of gPodder.
|
|||
|
||||
from gpodder.liblogger import log
|
||||
|
||||
import gtk
|
||||
|
||||
import os
|
||||
import os.path
|
||||
|
||||
|
@ -253,3 +255,37 @@ def file_type_by_extension( extension):
|
|||
|
||||
return None
|
||||
|
||||
|
||||
def get_tree_icon( icon_name, add_bullet = False, icon_cache = None):
|
||||
"""
|
||||
Loads an icon from the current icon theme at the specified
|
||||
size, suitable for display in a gtk.TreeView.
|
||||
|
||||
Optionally adds a green bullet (the GTK Stock "Yes" icon)
|
||||
to the Pixbuf returned.
|
||||
|
||||
If an icon_cache parameter is supplied, it has to be a
|
||||
dictionary and will be used to store generated icons.
|
||||
|
||||
On subsequent calls, icons will be loaded from cache if
|
||||
the cache is supplied again and the icon is found in
|
||||
the cache.
|
||||
"""
|
||||
|
||||
if icon_cache != None and (icon_name,add_bullet) in icon_cache:
|
||||
return icon_cache[(icon_name,add_bullet)]
|
||||
|
||||
icon_theme = gtk.icon_theme_get_default()
|
||||
icon = icon_theme.load_icon( icon_name, 16, 0)
|
||||
|
||||
if add_bullet:
|
||||
emblem = icon_theme.load_icon( gtk.STOCK_YES, 10, 0)
|
||||
size = emblem.get_width()
|
||||
pos = icon.get_width() - size
|
||||
emblem.composite( icon, pos, pos, size, size, pos, pos, 1, 1, gtk.gdk.INTERP_BILINEAR, 255)
|
||||
|
||||
if icon_cache != None:
|
||||
icon_cache[(icon_name,add_bullet)] = icon
|
||||
|
||||
return icon
|
||||
|
||||
|
|
Loading…
Reference in New Issue