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): 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)
class ArtistDetailScreen(Screen): 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 on_press(self, actor, event): """ """ if self.songs: self.songs.on_press(actor, event) if event.keyval == clutter.keysyms.Left: self.get_parent().remove_screen(self) if event.keyval == clutter.keysyms.Right: if self.songs: self.get_parent().new_screen( SongDetailScreen(self.songs.selected.obj))
class SongListScreen(Screen): 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 on_second(self): """ """ pass def on_press(self, actor, event): """ """ self.songs.on_press(actor, event) if event.keyval == clutter.keysyms.Left: self.get_parent().remove_screen(self) elif event.keyval == clutter.keysyms.Right: self.get_parent().new_screen( SongDetailScreen(self.songs.selected.obj) )
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)
class ArtistListScreen(Screen): 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) def on_press(self, actor, event): """ """ self.artists.on_press(actor, event) if event.keyval == clutter.keysyms.Left: self.get_parent().remove_screen(self) elif event.keyval == clutter.keysyms.Right: self.get_parent().new_screen( ArtistDetailScreen(self.artists.selected.obj) )
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)
def __init__(self): super(FrontScreen, self).__init__( clutter.BinLayout(clutter.BIN_ALIGNMENT_CENTER, clutter.BIN_ALIGNMENT_CENTER) ) layout = self.get_layout_manager() self.credits = Credits() layout.add(self.credits, clutter.BIN_ALIGNMENT_START, clutter.BIN_ALIGNMENT_END) self.right_arrow = RightArrow() layout.add(self.right_arrow, clutter.BIN_ALIGNMENT_END, clutter.BIN_ALIGNMENT_CENTER) self.boxed_contents = clutter.Box(clutter.BoxLayout()) box_layout = self.boxed_contents.get_layout_manager() box_layout.set_use_animations(True) box_layout.set_vertical(True) box_layout.set_spacing(100) self.header = LogoLarge() box_layout.pack(self.header, True, False, False, clutter.BOX_ALIGNMENT_CENTER, clutter.BOX_ALIGNMENT_CENTER) self.labels = ( clutter.Text(settings.FRONT_SCREEN_FONT, 'songs'), clutter.Text(settings.FRONT_SCREEN_FONT, 'artists'), ) self.selected = self.labels[0] for label in self.labels: label.set_color(FONT_COLOR) label.set_opacity(FONT_OPACITY) label.set_property('scale-gravity', clutter.GRAVITY_CENTER) box_layout.pack(label, True, False, False, clutter.BOX_ALIGNMENT_CENTER, clutter.BOX_ALIGNMENT_CENTER) layout.add(self.boxed_contents, clutter.BIN_ALIGNMENT_CENTER, clutter.BIN_ALIGNMENT_START) self.highlight(self.selected)
class ArtistListScreen(Screen): 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) def on_press(self, actor, event): """ """ self.artists.on_press(actor, event) if event.keyval == clutter.keysyms.Left: self.get_parent().remove_screen(self) elif event.keyval == clutter.keysyms.Right: self.get_parent().new_screen( ArtistDetailScreen(self.artists.selected.obj))
class SongListScreen(Screen): 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 on_second(self): """ """ pass def on_press(self, actor, event): """ """ self.songs.on_press(actor, event) if event.keyval == clutter.keysyms.Left: self.get_parent().remove_screen(self) elif event.keyval == clutter.keysyms.Right: self.get_parent().new_screen( SongDetailScreen(self.songs.selected.obj))
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)