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, font, text): super(Square, self).__init__( clutter.BinLayout(clutter.BIN_ALIGNMENT_CENTER, clutter.BIN_ALIGNMENT_CENTER)) super(Square, self).set_color(config.square_background_color) self.text = Text(font, text) self.add(self.text)
def __init__(self): """ """ super(AllPlayerScoresOverlay, self).__init__( clutter.BinLayout(clutter.BIN_ALIGNMENT_CENTER, clutter.BIN_ALIGNMENT_CENTER)) self.set_color(config.square_background_color) self.text = Text('', '')
def __init__(self): """ """ super(DailyDoubleOverlay, self).__init__( clutter.BinLayout(clutter.BIN_ALIGNMENT_CENTER, clutter.BIN_ALIGNMENT_CENTER)) self.set_color(config.square_background_color) self.text = Text(config.daily_double_font, 'Daily\nDouble') self.add(self.text)
def __init__(self): """ """ super(ClueOverlay, self).__init__( clutter.BinLayout(clutter.BIN_ALIGNMENT_CENTER, clutter.BIN_ALIGNMENT_CENTER)) self.set_color(config.square_background_color) self.clue_item = Text('', '') self.clue_item.set_size(self.get_width(), self.get_height())
def __init__(self, width=DEFAULT_SYMBOL_SIZE): super(PlaySymbol, self).__init__(width=width, color='blue') self.box = clutter.Box( clutter.BinLayout(clutter.BIN_ALIGNMENT_CENTER, clutter.BIN_ALIGNMENT_CENTER)) self.play = clutter.Text('Router Ultra Bold 25', 'PLAY') self.play.set_color(clutter.Color(255, 255, 255, 102)) self.box.add(self.play) self.add(self.box)
def __init__(self): """ """ super(FinalRoundOverlay, self).__init__( clutter.BinLayout(clutter.BIN_ALIGNMENT_CENTER, clutter.BIN_ALIGNMENT_CENTER)) self.set_color(config.square_background_color) self.text = Text(config.final_round_font, 'Final\nRound') self.text.set_size(self.get_width(), self.get_height()) self.add(self.text) self.music = cluttergst.VideoTexture() self.music.set_filename(config.sound_final_music)
def __init__(self): super(TransientMessage, self).__init__( clutter.BinLayout(clutter.BIN_ALIGNMENT_CENTER, clutter.BIN_ALIGNMENT_CENTER)) self.set_size(settings.SCREEN_WIDTH, settings.SCREEN_HEIGHT) self.set_color(clutter.Color(0, 0, 0, 0)) self.text = clutter.Text(settings.TRANSIENT_MESSAGE_FONT, '') self.text.set_property('scale-gravity', clutter.GRAVITY_CENTER) self.text.set_line_alignment(ALIGN_CENTER) self.text.set_line_wrap(True) self.text.set_color(clutter.Color(230, 230, 230)) self.add(self.text) self.animation = None
def __init__(self): """ """ super(PlayerScoreOverlay, self).__init__( clutter.BinLayout(clutter.BIN_ALIGNMENT_CENTER, clutter.BIN_ALIGNMENT_CENTER)) box = clutter.Box(clutter.BoxLayout()) layout = box.get_layout_manager() layout.set_vertical(True) self.set_color(config.square_background_color) self.name = Text(config.player_overlay_font, '') box.add(self.name) self.score = Text(config.player_overlay_font, '') box.add(self.score) self.add(box)
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)
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): """ """ self.stage = clutter.stage_get_default() if settings.FULLSCREEN: logging.info('Setting GUI to fullscreen.') self.stage.hide_cursor() self.stage.set_fullscreen(True) self.stage.set_size(settings.SCREEN_WIDTH, settings.SCREEN_HEIGHT) else: logging.info('Setting GUI to windowed mode.') self.stage.show_cursor() self.stage.set_fullscreen(False) self.stage.set_user_resizable(True) self.stage.set_size(settings.SCREEN_WIDTH * 0.5, settings.SCREEN_HEIGHT * 0.5) self.stage.set_color(clutter.Color(0x00, 0x00, 0x00, 0xff)) self.stage.set_title("AS220 Jukebox") self.stage.connect('destroy', clutter.main_quit) self.stage.connect('allocation-changed', self.on_allocation_changed) self.stage.connect('key-press-event', self.on_press) self.stage.connect('key-release-event', self.on_release) self.layout = clutter.BinLayout(clutter.BIN_ALIGNMENT_CENTER, clutter.BIN_ALIGNMENT_CENTER) self.container = clutter.Box(self.layout) self.stage.add(self.container) # Setup screen container self.screen_container = ScreenContainer() self.container.add(self.screen_container) front = FrontScreen() self.screen_container.add_screen(front) self.screen_container.active_screen = front self.transient_message = transient_message self.footer = footer self.layout.add(self.footer, clutter.BIN_ALIGNMENT_CENTER, clutter.BIN_ALIGNMENT_END) self.container.add(transient_message)
def __init__(self): """ """ super(CategoryOverlay, self).__init__(clutter.BoxLayout()) layout = self.get_layout_manager() layout.set_vertical(False) self.set_color(config.background_color) self.boxes = [] for category_name in game.get_category_names(): box = clutter.Box( clutter.BinLayout(clutter.BIN_ALIGNMENT_CENTER, clutter.BIN_ALIGNMENT_CENTER)) rect = clutter.Rectangle() rect.set_color(config.square_background_color) box.add(rect) text = Text(config.category_overlay_font, category_name) box.add(text) self.add(box)
def __init__(self, title): super(Header, self).__init__( clutter.BinLayout( clutter.BIN_ALIGNMENT_CENTER, clutter.BIN_ALIGNMENT_START, )) layout = self.get_layout_manager() #layout.set_vertical(False) # Setup default header elements. self.logo = LogoSmall() self.title = clutter.Text(settings.HEADER_TITLE_FONT, title) self.title.set_color(FONT_COLOR) self.credits = Credits() layout.add(self.logo, clutter.BIN_ALIGNMENT_START, clutter.BIN_ALIGNMENT_START) layout.add(self.title, clutter.BIN_ALIGNMENT_CENTER, clutter.BIN_ALIGNMENT_START) layout.add(self.credits, clutter.BIN_ALIGNMENT_END, clutter.BIN_ALIGNMENT_START)
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(GenreListScreen, self).__init__( clutter.BinLayout(clutter.BIN_ALIGNMENT_CENTER, clutter.BIN_ALIGNMENT_CENTER)) self.set_name('genre list')
def __init__(self, width=DEFAULT_SYMBOL_SIZE, color='solid'): super(Symbol, self).__init__(clutter.BinLayout(True, True)) self.set_width(width) self.circle = clutter.CairoTexture(width, width) cr = self.circle.cairo_create() cr.set_operator(cairo.OPERATOR_CLEAR) cr.paint() cr.set_operator(cairo.OPERATOR_OVER) cr.arc(width / 2, width / 2, width / 2, 0.0, 2 * math.pi) if color == 'solid': pattern = cairo.SolidPattern(0.20, 0.20, 0.20, 0.9) cr.set_source(pattern) cr.fill_preserve() del pattern elif color == 'bubble': pattern = cairo.RadialGradient(width / 2, width / 2, 0, width / 2, width / 2, width / 2) pattern.add_color_stop_rgba(0, 0.88, 0.95, 0.99, 0.1) pattern.add_color_stop_rgba(0.6, 0.88, 0.95, 0.99, 0.1) pattern.add_color_stop_rgba(0.8, 0.67, 0.83, 0.91, 0.2) pattern.add_color_stop_rgba(0.9, 0.5, 0.67, 0.88, 0.7) pattern.add_color_stop_rgba(1.0, 0.3, 0.43, 0.69, 0.8) cr.set_source(pattern) cr.fill_preserve() del pattern pattern = cairo.LinearGradient(0, 0, width, width) pattern.add_color_stop_rgba(0.0, 1.0, 1.0, 1.0, 0.0) pattern.add_color_stop_rgba(0.15, 1.0, 1.0, 1.0, 0.95) pattern.add_color_stop_rgba(0.3, 1.0, 1.0, 1.0, 0.0) pattern.add_color_stop_rgba(0.7, 1.0, 1.0, 1.0, 0.95) pattern.add_color_stop_rgba(1.0, 1.0, 1.0, 1.0, 0.0) cr.set_source(pattern) cr.fill() del pattern elif color == 'blue': pattern = cairo.RadialGradient(width / 2, width / 2, 0, width / 2, width / 2, width / 2) pattern.add_color_stop_rgba(0, 0.22, 0.22, 0.99, 0.1) pattern.add_color_stop_rgba(0.6, 0.22, 0.22, 0.88, 0.1) pattern.add_color_stop_rgba(0.8, 0.22, 0.22, 0.67, 0.2) pattern.add_color_stop_rgba(0.9, 0.22, 0.22, 0.55, 0.7) pattern.add_color_stop_rgba(1.0, 0.22, 0.22, 0.44, 0.8) cr.set_source(pattern) cr.fill_preserve() del pattern pattern = cairo.RadialGradient(width / 2, width / 2, 0, width / 2, width / 2, width / 2) pattern.add_color_stop_rgba(0.9, 0.22, 0.22, 0.99, 0.1) pattern.add_color_stop_rgba(0.8, 0.22, 0.22, 0.88, 0.1) pattern.add_color_stop_rgba(0.75, 0.22, 0.22, 0.67, 0.2) pattern.add_color_stop_rgba(0.7, 0.22, 0.22, 0.55, 0.7) pattern.add_color_stop_rgba(0.1, 0.22, 0.22, 0.44, 0.8) cr.set_source(pattern) cr.fill_preserve() del pattern pattern = cairo.LinearGradient(0, 0, width, width) pattern.add_color_stop_rgba(0.0, 0.0, 0.0, 1.0, 0.0) pattern.add_color_stop_rgba(0.15, 0.0, 0.0, 1.0, 0.95) pattern.add_color_stop_rgba(0.3, 0.0, 0.0, 1.0, 0.0) pattern.add_color_stop_rgba(0.7, 0.0, 0.0, 1.0, 0.95) pattern.add_color_stop_rgba(1.0, 0.0, 0.0, 1.0, 0.0) cr.set_source(pattern) cr.fill() del pattern elif color == 'green': pattern = cairo.RadialGradient(width / 2, width / 2, 0, width / 2, width / 2, width / 2) pattern.add_color_stop_rgba(0, 0.22, 0.99, 0.22, 0.1) pattern.add_color_stop_rgba(0.6, 0.22, 0.88, 0.22, 0.1) pattern.add_color_stop_rgba(0.8, 0.22, 0.67, 0.22, 0.2) pattern.add_color_stop_rgba(0.9, 0.22, 0.55, 0.22, 0.7) pattern.add_color_stop_rgba(1.0, 0.22, 0.44, 0.22, 0.8) cr.set_source(pattern) cr.fill_preserve() del pattern pattern = cairo.RadialGradient(width / 2, width / 2, 0, width / 2, width / 2, width / 2) pattern.add_color_stop_rgba(0.9, 0.22, 0.99, 0.22, 0.1) pattern.add_color_stop_rgba(0.8, 0.22, 0.88, 0.22, 0.1) pattern.add_color_stop_rgba(0.75, 0.22, 0.67, 0.22, 0.2) pattern.add_color_stop_rgba(0.7, 0.22, 0.55, 0.22, 0.7) pattern.add_color_stop_rgba(0.1, 0.22, 0.44, 0.22, 0.8) cr.set_source(pattern) cr.fill_preserve() del pattern pattern = cairo.LinearGradient(0, 0, width, width) pattern.add_color_stop_rgba(0.0, 0.0, 1.0, 0.0, 0.0) pattern.add_color_stop_rgba(0.15, 0.0, 1.0, 0.0, 0.95) pattern.add_color_stop_rgba(0.3, 0.0, 1.0, 0.0, 0.0) pattern.add_color_stop_rgba(0.7, 0.0, 1.0, 0.0, 0.95) pattern.add_color_stop_rgba(1.0, 0.0, 1.0, 0.0, 0.0) cr.set_source(pattern) cr.fill() del pattern elif color == 'red': pattern = cairo.RadialGradient(width / 2, width / 2, 0, width / 2, width / 2, width / 2) pattern.add_color_stop_rgba(0, 0.99, 0.22, 0.22, 0.1) pattern.add_color_stop_rgba(0.6, 0.88, 0.22, 0.22, 0.1) pattern.add_color_stop_rgba(0.8, 0.67, 0.22, 0.22, 0.2) pattern.add_color_stop_rgba(0.9, 0.55, 0.22, 0.22, 0.7) pattern.add_color_stop_rgba(1.0, 0.44, 0.22, 0.22, 0.8) cr.set_source(pattern) cr.fill_preserve() del pattern pattern = cairo.RadialGradient(width / 2, width / 2, 0, width / 2, width / 2, width / 2) pattern.add_color_stop_rgba(0.9, 0.99, 0.22, 0.22, 0.1) pattern.add_color_stop_rgba(0.8, 0.88, 0.22, 0.22, 0.1) pattern.add_color_stop_rgba(0.75, 0.67, 0.22, 0.22, 0.2) pattern.add_color_stop_rgba(0.7, 0.55, 0.22, 0.22, 0.7) pattern.add_color_stop_rgba(0.1, 0.44, 0.22, 0.22, 0.8) cr.set_source(pattern) cr.fill_preserve() del pattern pattern = cairo.LinearGradient(0, 0, width, width) pattern.add_color_stop_rgba(0.0, 1.0, 0.0, 0.0, 0.0) pattern.add_color_stop_rgba(0.15, 1.0, 0.0, 0.0, 0.95) pattern.add_color_stop_rgba(0.3, 1.0, 0.0, 0.0, 0.0) pattern.add_color_stop_rgba(0.7, 1.0, 0.0, 0.0, 0.95) pattern.add_color_stop_rgba(1.0, 1.0, 0.0, 0.0, 0.0) cr.set_source(pattern) cr.fill() del pattern del cr self.add(self.circle) # glowing timeline self.timeline = clutter.Timeline(duration=settings.ARROW_BLINK_RATE) self.timeline.set_loop(True) self.alpha = clutter.Alpha(self.timeline, clutter.LINEAR) self.blink = clutter.BehaviourOpacity(alpha=self.alpha, opacity_start=BLINK_OFF_OPACITY, opacity_end=255) self.timeline.connect('completed', self.on_blink_completed) # By default we enable blinking for arrow. self.blink_on()