def __init__(self): super(SongListScreen, self).__init__( clutter.BinLayout(clutter.BIN_ALIGNMENT_CENTER, clutter.BIN_ALIGNMENT_CENTER)) self.set_name('song list') layout = self.get_layout_manager() self.header = Header('All Songs') self.header.set_width(self.get_width()) layout.add(self.header, clutter.BIN_ALIGNMENT_CENTER, clutter.BIN_ALIGNMENT_START) self.left_arrow = LeftArrow() self.right_arrow = RightArrow() songs = Song.objects.filter(approved=True).order_by('title') self.songs = ScrollingText(map(BlinkingText, songs), items_on_screen=settings.SONG_LIST_ITEMS) self.songs.set_width(self.get_width() - (self.left_arrow.get_width() + self.right_arrow.get_width())) self.songs.set_height(self.get_height() - self.header.get_height()) layout.add(self.songs, clutter.BIN_ALIGNMENT_CENTER, clutter.BIN_ALIGNMENT_END) layout.add(self.left_arrow, clutter.BIN_ALIGNMENT_START, clutter.BIN_ALIGNMENT_CENTER) layout.add(self.right_arrow, clutter.BIN_ALIGNMENT_END, clutter.BIN_ALIGNMENT_CENTER)
def __init__(self, song): super(SongDetailScreen, self).__init__( clutter.BinLayout(clutter.BIN_ALIGNMENT_CENTER, clutter.BIN_ALIGNMENT_CENTER)) # Immediately store song information self.song = song self.set_name('song detail %s' % self.song.title) layout = self.get_layout_manager() self.header = Header('Song Details') self.header.set_width(self.get_width()) layout.add(self.header, clutter.BIN_ALIGNMENT_CENTER, clutter.BIN_ALIGNMENT_START) self.left_arrow = LeftArrow() self.play = PlaySymbol() self.box = clutter.Box(clutter.BoxLayout()) box_layout = self.box.get_layout_manager() box_layout.set_vertical(True) box_layout.set_spacing(20) text = clutter.Text(settings.SONG_TITLE_FONT, self.song.title) text.set_line_alignment(ALIGN_CENTER) text.set_line_wrap(True) text.set_color(clutter.Color(230, 230, 230, 0xff)) self.box.add(text) text = clutter.Text(settings.SONG_ARTIST_FONT, "by %s" % self.song.artist.name) text.set_line_alignment(ALIGN_CENTER) text.set_line_wrap(True) text.set_color(clutter.Color(210, 210, 210, 0xff)) self.box.add(text) self.box.set_width(self.get_width() - (self.left_arrow.get_width() + self.play.get_width())) layout.add( self.box, clutter.BIN_ALIGNMENT_CENTER, clutter.BIN_ALIGNMENT_CENTER, ) layout.add(self.left_arrow, clutter.BIN_ALIGNMENT_START, clutter.BIN_ALIGNMENT_CENTER) layout.add(self.play, clutter.BIN_ALIGNMENT_END, clutter.BIN_ALIGNMENT_CENTER)
def __init__(self, artist): super(ArtistDetailScreen, self).__init__( clutter.BinLayout(clutter.BIN_ALIGNMENT_CENTER, clutter.BIN_ALIGNMENT_CENTER)) self.set_name('artist detail %s' % artist.name) layout = self.get_layout_manager() photo = artist.random_photo() self.background = BackgroundImages(artist) #self.background = clutter.Texture(settings.MEDIA_ROOT + "/" + photo.photo.name) self.background.set_opacity(30) layout.add(self.background, clutter.BIN_ALIGNMENT_END, clutter.BIN_ALIGNMENT_END) self.background.lower_bottom() self.header = Header('Artist Details') self.header.set_width(self.get_width()) layout.add(self.header, clutter.BIN_ALIGNMENT_CENTER, clutter.BIN_ALIGNMENT_START) self.left_arrow = LeftArrow() songs = artist.song_set.filter(approved=True).order_by('title') self.songs = None if len(songs) > 0: self.right_arrow = RightArrow() self.songs = ScrollingText( map(BlinkingText, songs), items_on_screen=settings.SONG_LIST_ITEMS) self.songs.set_width(self.get_width() - (self.left_arrow.get_width() + self.right_arrow.get_width())) self.songs.set_height(self.get_height() - self.header.get_height()) layout.add(self.songs, clutter.BIN_ALIGNMENT_CENTER, clutter.BIN_ALIGNMENT_END) layout.add(self.right_arrow, clutter.BIN_ALIGNMENT_END, clutter.BIN_ALIGNMENT_CENTER) else: text = clutter.Text('Router Bold 70', 'No songs available.') text.set_color(clutter.Color(200, 200, 200, 0xff)) layout.add(text, clutter.BIN_ALIGNMENT_CENTER, clutter.BIN_ALIGNMENT_CENTER) layout.add(self.left_arrow, clutter.BIN_ALIGNMENT_START, clutter.BIN_ALIGNMENT_CENTER)
def __init__(self): super(ArtistListScreen, self).__init__( clutter.BinLayout(clutter.BIN_ALIGNMENT_CENTER, clutter.BIN_ALIGNMENT_CENTER)) self.set_name('artist list') layout = self.get_layout_manager() self.header = Header('All Artists') self.header.set_width(self.get_width()) layout.add(self.header, clutter.BIN_ALIGNMENT_CENTER, clutter.BIN_ALIGNMENT_START) self.left_arrow = LeftArrow() self.right_arrow = RightArrow() # Filter to all artists that have songs. artists = Artist.objects.filter( song__isnull=False).distinct().order_by('name') artists = artists.filter( song__approved=True).distinct().order_by('name') self.artists = ScrollingText( map(BlinkingText, artists), items_on_screen=settings.ARTIST_LIST_ITEMS) self.artists.set_width(self.get_width() - (self.left_arrow.get_width() + self.right_arrow.get_width())) self.artists.set_height(self.get_height() - self.header.get_height()) layout.add(self.artists, clutter.BIN_ALIGNMENT_CENTER, clutter.BIN_ALIGNMENT_END) layout.add(self.left_arrow, clutter.BIN_ALIGNMENT_START, clutter.BIN_ALIGNMENT_CENTER) layout.add(self.right_arrow, clutter.BIN_ALIGNMENT_END, clutter.BIN_ALIGNMENT_CENTER)