CoverArt Browser
v2.0
Browse your cover-art albums in Rhythmbox
|
00001 # -*- Mode: python; coding: utf-8; tab-width: 4; indent-tabs-mode: nil; -*- 00002 # 00003 # Copyright (C) 2012 - fossfreedom 00004 # Copyright (C) 2012 - Agustin Carrasco 00005 # 00006 # This program is free software; you can redistribute it and/or modify 00007 # it under the terms of the GNU General Public License as published by 00008 # the Free Software Foundation; either version 2, or (at your option) 00009 # any later version. 00010 # 00011 # This program is distributed in the hope that it will be useful, 00012 # but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 # GNU General Public License for more details. 00015 # 00016 # You should have received a copy of the GNU General Public License 00017 # along with this program; if not, write to the Free Software 00018 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 00019 00020 from gi.repository import GObject 00021 from gi.repository import GLib 00022 00023 from coverart_widgets import AbstractView 00024 00025 00026 class PlaySourceShowingPolicy(GObject.Object): 00027 ''' 00028 Policy that mostly takes care of how and when things should be showed on 00029 the view that makes use of the `AlbumsModel`. 00030 ''' 00031 00032 def __init__(self, list_view): 00033 super(PlaySourceShowingPolicy, self).__init__() 00034 00035 self.counter = 0 00036 self._has_initialised = False 00037 00038 def initialise(self, album_manager): 00039 if self._has_initialised: 00040 return 00041 00042 self._has_initialised = True 00043 00044 00045 class PlaySourceView(AbstractView): 00046 __gtype_name__ = "PlaySourceView" 00047 00048 name = 'playsourceview' 00049 use_plugin_window = False 00050 00051 def __init__(self): 00052 super(PlaySourceView, self).__init__() 00053 self.view = self 00054 self._has_initialised = False 00055 self.show_policy = PlaySourceShowingPolicy(self) 00056 00057 def initialise(self, source): 00058 if self._has_initialised: 00059 return 00060 00061 self._has_initialised = True 00062 00063 self.view_name = "playsource_view" 00064 super(PlaySourceView, self).initialise(source) 00065 #self.album_manager = source.album_manager 00066 self.shell = source.shell 00067 00068 def switch_to_view(self, source, album): 00069 self.initialise(source) 00070 00071 GLib.idle_add(self.shell.props.display_page_tree.select, 00072 source.playlist_source) 00073 00074 def get_selected_objects(self): 00075 ''' 00076 finds what has been selected 00077 00078 returns an array of `Album` 00079 ''' 00080 return []