- print "Created player window, playlist: %s" % (self.playlist)
-
- def on_hide(self, wnd):
- print "Hiding player window"
-
- def on_destroy(self, wnd):
- print "Destroying player window"
- if self.player:
- self.player.stop()
- global _the_playerwindow
- _the_playerwindow = None
-
- def add_stock_button(self, btns, stock, cb):
- btn = hildon.GtkButton(gtk.HILDON_SIZE_FINGER_HEIGHT)
- btn.set_relief(gtk.RELIEF_NONE)
- btn.set_image(gtk.image_new_from_stock(stock, gtk.ICON_SIZE_SMALL_TOOLBAR))
- btn.connect('clicked', cb)
- btns.add(btn)
-
- def set_labels(self, track, artist, album, playlist_pos, playlist_size):
- self.playlist_pos.set_markup('<span size="small">%s/%s songs</span>'%(playlist_pos, playlist_size))
- self.track.set_markup('<span size="x-large">%s</span>'%(track))
- self.artist.set_markup('<span size="large">%s</span>'%(artist))
- self.album.set_markup('<span foreground="#aaaaaa">%s</span>'%(album))
-
- def update_state(self):
- item = self.playlist.current()
- if item:
- if not item.name:
- item.load()
- print "current:", item
- self.set_labels(item.name, item.artist_name, item.album_name,
- self.playlist.current_index(), self.playlist.size())
- coverfile = jamaendo.get_album_cover(int(item.album_id), size=200)
- print "coverfile:", coverfile
- self.cover.set_from_file(coverfile)
-
- def play_tracks(self, tracks):
- self.playlist = Playlist(playlist)
- self.player.play(self.playlist)
- self.update_state()
-
- def on_play(self, button):
- self.player.play(self.playlist)
- self.update_state()
- def on_pause(self, button):
- self.player.pause()
- def on_prev(self, button):
- self.player.prev()
- self.update_state()
- def on_next(self, button):
- self.player.next()
- self.update_state()
- def on_stop(self, button):
- self.player.stop()
-
-def open_playerwindow(tracks):
- global _the_playerwindow
- if _the_playerwindow:
- hildon.WindowStack.push_1(_the_playerwindow)
- _the_playerwindow.play_tracks(tracks)
- else:
- _the_playerwindow = PlayerWindow(tracks)
- _the_playerwindow.show_all()
- return _the_playerwindow
-
-class SearchWindow(hildon.StackableWindow):