4 from playerwindow import open_playerwindow
6 class ShowArtist(hildon.StackableWindow):
7 def __init__(self, artist):
8 hildon.StackableWindow.__init__(self)
9 self.set_title("Artist")
12 self.panarea = hildon.PannableArea()
13 vbox = gtk.VBox(False, 0)
16 name.set_markup('<big>%s</big>'%(artist.name))
17 vbox.pack_start(name, False)
19 self.album_store = gtk.ListStore(str, int)
20 self.album_view = gtk.TreeView(self.album_store)
21 col = gtk.TreeViewColumn('Name')
22 self.album_view.append_column(col)
23 cell = gtk.CellRendererText()
24 col.pack_start(cell, True)
25 col.add_attribute(cell, 'text', 0)
26 self.album_view.set_search_column(0)
27 col.set_sort_column_id(0)
28 self.album_view.connect('row-activated', self.row_activated)
31 self.panarea.add(self.album_view)
32 vbox.pack_start(self.panarea, True, True, 0)
35 for album in jamaendo.get_albums(artist.ID):
36 self.album_store.append([album.name, album.ID])
38 def row_activated(self, treeview, path, view_column):
39 treeiter = self.album_store.get_iter(path)
40 title, _id = self.album_store.get(treeiter, 0, 1)
41 album = jamaendo.get_album(_id)
42 if isinstance(album, list):
46 def open_item(self, item):
47 if isinstance(item, jamaendo.Album):
48 from showalbum import ShowAlbum
51 elif isinstance(item, jamaendo.Artist):
52 wnd = ShowArtist(item)
54 elif isinstance(item, jamaendo.Track):
55 wnd = open_playerwindow()
56 wnd.play_tracks([item])