Ejemplo n.º 1
0
    def update_song(self, song):
        self.song = song
        
        # Update simpler.
        self.cover_image.set_from_pixbuf(CoverManager.get_pixbuf_from_song(song, 92, 92, False, False))
        self.title_label.set_text(utils.xmlescape(song.get_str("title")))
        self.artist_label.set_text(utils.xmlescape(song.get_str("artist")))
        self.album_label.set_text(utils.xmlescape(song.get_str("album")))
        
        # Update detail.
        if self.song.get_type() not in ["cue", "local", "cdda"]:
            utils.ThreadRun(self.get_song_attr, self.file_type_label.set_text, (song, True)).start()
            utils.ThreadRun(self.get_song_attr, self.file_format_label.set_text, (song, False)).start()
        else:    
            self.file_type_label.set_text(self.get_song_attr(song, True))
            self.file_format_label.set_text(self.get_song_attr(song, False))        

        self.file_size_label.set_text(song.get_str("#size"))
        self.song_duration_label.set_text(song.get_str("#duration"))        
        self.song_bitrate_label.set_text(song.get_str("#bitrate"))
        self.song_rate_label.set_text(song.get_str("#rate"))        
        self.song_added_label.set_text(song.get_str("#added"))
        self.song_lasted_label.set_text(song.get_str("#lastplayed"))
        self.song_playcount_label.set_text(song.get_str("#playcount"))
        self.song_date_label.set_text(song.get_str("#date"))        
        
        # Update location.
        self.location_entry.set_text(song.get_path())
Ejemplo n.º 2
0
    def update_song(self, song):
        self.song = song

        # Update simpler.
        self.cover_image.set_from_pixbuf(
            CoverManager.get_pixbuf_from_song(song, 92, 92, False, False))
        self.title_label.set_text(utils.xmlescape(song.get_str("title")))
        self.artist_label.set_text(utils.xmlescape(song.get_str("artist")))
        self.album_label.set_text(utils.xmlescape(song.get_str("album")))

        # Update detail.
        if self.song.get_type() not in ["cue", "local", "cdda"]:
            utils.ThreadRun(self.get_song_attr, self.file_type_label.set_text,
                            (song, True)).start()
            utils.ThreadRun(self.get_song_attr,
                            self.file_format_label.set_text,
                            (song, False)).start()
        else:
            self.file_type_label.set_text(self.get_song_attr(song, True))
            self.file_format_label.set_text(self.get_song_attr(song, False))

        self.file_size_label.set_text(song.get_str("#size"))
        self.song_duration_label.set_text(song.get_str("#duration"))
        self.song_bitrate_label.set_text(song.get_str("#bitrate"))
        self.song_rate_label.set_text(song.get_str("#rate"))
        self.song_added_label.set_text(song.get_str("#added"))
        self.song_lasted_label.set_text(song.get_str("#lastplayed"))
        self.song_playcount_label.set_text(song.get_str("#playcount"))
        self.song_date_label.set_text(song.get_str("#date"))

        # Update location.
        self.location_entry.set_text(song.get_path())
Ejemplo n.º 3
0
 def update_song(self, song):
     self.song = song
     song_cover_pixbuf = CoverManager.get_pixbuf_from_song(song,
                                                           300,
                                                           180,
                                                           False,
                                                           optimum=False)
     self.cover_image.set_from_pixbuf(song_cover_pixbuf)
    def render_info(self, cr, rect):
        if self.is_hover:
            draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHover")
        
        if self.icon_pixbuf is None:
            self.icon_pixbuf = CoverManager.get_pixbuf_from_song(self.song, 37, 38, try_web=False)
            
            
        icon_width = self.icon_pixbuf.get_width()
        icon_height = self.icon_pixbuf.get_height()
        icon_x = rect.x + self.info_padding_x
        icon_y = rect.y + (rect.height - icon_height) / 2
        
        # Draw shadow.
        drop_shadow_padding = 3
        drop_shadow_radious = 3
        draw_shadow(
            cr,
            icon_x,
            icon_y,
            icon_width + drop_shadow_padding,
            icon_height + drop_shadow_padding,
            drop_shadow_radious,
            app_theme.get_shadow_color("window_shadow")
            )

        outside_shadow_padding = 2
        outside_shadow_radious = 3
        draw_shadow(
            cr,
            icon_x - outside_shadow_padding,
            icon_y - outside_shadow_padding,
            icon_width + outside_shadow_padding * 2,
            icon_height + outside_shadow_padding * 2,
            outside_shadow_radious,
            app_theme.get_shadow_color("window_shadow")
            )
        
        # Draw wallpaper.
        
        draw_pixbuf(cr, self.icon_pixbuf, icon_x, icon_y)
        rect.x = icon_x + self.icon_pixbuf.get_width() + self.info_padding_x
        rect.width -= self.info_padding_x * 2 - self.icon_pixbuf.get_width()
        _width, _height = get_content_size("%s" % self.song.get_str("title"))
        draw_text(cr, "<b>%s</b>" % self.song.get_str("title"), rect.x, icon_y, rect.width, _height,
                  text_size=10)                   
        
        rect.y = icon_y + icon_width - _height
        _width, _height = get_content_size(self.status_text)
        draw_text(cr, self.status_text, rect.x, rect.y, rect.width, _height)
Ejemplo n.º 5
0
    def render_info(self, cr, rect):
        if self.is_hover:
            draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height,
                             "globalItemHover")

        if self.icon_pixbuf is None:
            self.icon_pixbuf = CoverManager.get_pixbuf_from_song(self.song,
                                                                 37,
                                                                 38,
                                                                 try_web=False)

        icon_width = self.icon_pixbuf.get_width()
        icon_height = self.icon_pixbuf.get_height()
        icon_x = rect.x + self.info_padding_x
        icon_y = rect.y + (rect.height - icon_height) / 2

        # Draw shadow.
        drop_shadow_padding = 3
        drop_shadow_radious = 3
        draw_shadow(cr, icon_x, icon_y, icon_width + drop_shadow_padding,
                    icon_height + drop_shadow_padding, drop_shadow_radious,
                    app_theme.get_shadow_color("window_shadow"))

        outside_shadow_padding = 2
        outside_shadow_radious = 3
        draw_shadow(cr, icon_x - outside_shadow_padding,
                    icon_y - outside_shadow_padding,
                    icon_width + outside_shadow_padding * 2,
                    icon_height + outside_shadow_padding * 2,
                    outside_shadow_radious,
                    app_theme.get_shadow_color("window_shadow"))

        # Draw wallpaper.

        draw_pixbuf(cr, self.icon_pixbuf, icon_x, icon_y)
        rect.x = icon_x + self.icon_pixbuf.get_width() + self.info_padding_x
        rect.width -= self.info_padding_x * 2 - self.icon_pixbuf.get_width()
        _width, _height = get_content_size("%s" % self.song.get_str("title"))
        draw_text(cr,
                  "<b>%s</b>" % self.song.get_str("title"),
                  rect.x,
                  icon_y,
                  rect.width,
                  _height,
                  text_size=10)

        rect.y = icon_y + icon_width - _height
        _width, _height = get_content_size(self.status_text)
        draw_text(cr, self.status_text, rect.x, rect.y, rect.width, _height)
Ejemplo n.º 6
0
 def update_song(self, song):
     self.song = song
     
     # Update simpler.
     self.cover_image.set_from_pixbuf(CoverManager.get_pixbuf_from_song(song, 92, 92, False, False))
     self.title_label.set_text(song.get_str("title"))
     self.artist_label.set_text(song.get_str("artist"))
     self.album_label.set_text(song.get_str("album"))
     
     # Update detail.
     self.file_type_label.set_text(self.get_song_attr(song, True))
     self.file_format_label.set_text(self.get_song_attr(song, False))        
     self.file_size_label.set_text(song.get_str("#size"))
     self.song_duration_label.set_text(song.get_str("#duration"))        
     self.song_bitrate_label.set_text(song.get_str("#bitrate"))
     self.song_rate_label.set_text(song.get_str("#rate"))        
     self.song_added_label.set_text(song.get_str("#added"))
     self.song_lasted_label.set_text(song.get_str("#lastplayed"))
     self.song_playcount_label.set_text(song.get_str("#playcount"))
     self.song_date_label.set_text(song.get_str("#date"))        
     
     # Update location.
     self.location_entry.set_text(song.get_path())
Ejemplo n.º 7
0
 def update_song(self, song):    
     self.song = song
     song_cover_pixbuf = CoverManager.get_pixbuf_from_song(song, 300, 180, False, optimum=False)
     self.cover_image.set_from_pixbuf(song_cover_pixbuf)
Ejemplo n.º 8
0
 def get_song_cover(self):
     return CoverManager.get_pixbuf_from_song(self.song, 
                                             BROWSER_COVER_SIZE["x"], 
                                             BROWSER_COVER_SIZE["y"],
                                             try_web=False,
                                             optimum=True)