Example #1
0
    def display(self):
        if is_now_playing():
            self.set_color(clutter.Color(0, 0, 0, 250))
            self.set_opacity(250)

            # Remove existing text.
            for actor in self.now_playing_box.get_children():
                self.now_playing_box.remove(actor)

            song = now_playing()
            text = clutter.Text(settings.FOOTER_FONT, 'Now playing:')
            text.set_color(clutter.Color(200, 200, 200))
            self.now_playing_box.add(text)
            text = clutter.Text(settings.FOOTER_SONG_FONT, song)
            text.set_color(clutter.Color(240, 240, 40))
            self.now_playing_box.add(text)
            try:
                text = clutter.Text(settings.FOOTER_ARTIST_FONT,
                                    "by %s" % song.artist)
                text.set_color(clutter.Color(240, 240, 40))
                self.now_playing_box.add(text)
            except Exception:
                pass

            if has_next_song():
                song = next_song()

                # Remove existing text.
                for actor in self.next_song_box.get_children():
                    self.next_song_box.remove(actor)

                text = clutter.Text(settings.FOOTER_FONT, 'Next song:')
                text.set_color(clutter.Color(200, 200, 200))
                self.next_song_box.add(text)
                text = clutter.Text(settings.FOOTER_SONG_FONT, song)
                text.set_color(clutter.Color(240, 240, 40))
                self.next_song_box.add(text)
                try:
                    text = clutter.Text(settings.FOOTER_ARTIST_FONT,
                                        "by %s" % song.artist)
                    text.set_color(clutter.Color(240, 240, 40))
                    self.next_song_box.add(text)
                except Exception:
                    pass

            self.animation = self.animate(clutter.EASE_IN_CUBIC,
                                          settings.FOOTER_FADE_RATE, 'opacity',
                                          0)
Example #2
0
 def update(self):
     if is_now_playing() and self.now_playing != now_playing():
         self.display()
         self.now_playing = now_playing()