Ejemplo n.º 1
0
    def _generate_album_values(self, album):
        tooltip = album.name
        pixbuf = album.cover.pixbuf.scale_simple(48, 48,
                                                 GdkPixbuf.InterpType.BILINEAR)
        show = True

        rating = album.rating
        if int(rating) > 0:
            rating = u'\u2605' * int(rating)
        else:
            rating = ''

        year = ' (' + str(album.real_year) + ')'

        track_count = album.track_count
        if track_count == 1:
            detail = rb3compat.unicodedecode(_(' with 1 track'), 'UTF-8')
        else:
            detail = rb3compat.unicodedecode(
                _(' with %d tracks') % track_count, 'UTF-8')

        duration = album.duration / 60

        if duration == 1:
            detail += rb3compat.unicodedecode(_(' and a duration of 1 minute'),
                                              'UTF-8')
        else:
            detail += rb3compat.unicodedecode(
                _(' and a duration of %d minutes') % duration, 'UTF-8')

        tooltip = rb3compat.unicodestr(tooltip, 'utf-8')
        tooltip = rb3compat.unicodeencode(tooltip, 'utf-8')
        import cgi

        formatted = '<b><i>' + \
                    cgi.escape(rb3compat.unicodedecode(tooltip, 'utf-8')) + \
                    '</i></b>' + \
                    year + \
                    ' ' + rating + \
                    '\n<small>' + \
                    GLib.markup_escape_text(detail) + \
                    '</small>'

        return tooltip, pixbuf, album, show, '', formatted, ''
    def _generate_album_values(self, album):
        tooltip = album.name
        pixbuf = album.cover.pixbuf.scale_simple(48, 48, GdkPixbuf.InterpType.BILINEAR)
        show = True

        rating = album.rating
        if int(rating) > 0:
            rating = u'\u2605' * int(rating)
        else:
            rating = ''

        year = ' (' + str(album.real_year) + ')'

        track_count = album.track_count
        if track_count == 1:
            detail = rb3compat.unicodedecode(_(' with 1 track'), 'UTF-8')
        else:
            detail = rb3compat.unicodedecode(_(' with %d tracks') %
                                             track_count, 'UTF-8')

        duration = album.duration / 60

        if duration == 1:
            detail += rb3compat.unicodedecode(_(' and a duration of 1 minute'), 'UTF-8')
        else:
            detail += rb3compat.unicodedecode(_(' and a duration of %d minutes') %
                                              duration, 'UTF-8')

        tooltip = rb3compat.unicodestr(tooltip, 'utf-8')
        tooltip = rb3compat.unicodeencode(tooltip, 'utf-8')
        import cgi

        formatted = '<b><i>' + \
                    cgi.escape(rb3compat.unicodedecode(tooltip, 'utf-8')) + \
                    '</i></b>' + \
                    year + \
                    ' ' + rating + \
                    '\n<small>' + \
                    GLib.markup_escape_text(detail) + \
                    '</small>'

        return tooltip, pixbuf, album, show, '', formatted, ''
    def _generate_status(self, albums=None):
        self.status = ''

        if albums:
            track_count = 0
            duration = 0

            for album in albums:
                # Calculate duration and number of tracks from that album
                track_count += album.track_count
                duration += album.duration / 60

            # now lets build up a status label containing some
            # 'interesting stuff' about the album
            if len(albums) == 1:
                #. TRANSLATORS - for example "abba's greatest hits by ABBA"
                self.status = rb3compat.unicodedecode(_('%s by %s') % 
                        (album.name, album.artist), 'UTF-8')
            else:
                #. TRANSLATORS - the number of albums that have been selected/highlighted
                self.status = rb3compat.unicodedecode(_('%d selected albums') % 
                        (len(albums)), 'UTF-8')

            if track_count == 1:
                self.status += rb3compat.unicodedecode(_(' with 1 track'), 'UTF-8')
            else:
                self.status += rb3compat.unicodedecode(_(' with %d tracks') % 
                        track_count, 'UTF-8')

            if duration == 1:
                self.status += rb3compat.unicodedecode(_(' and a duration of 1 minute'), 'UTF-8')
            else:
                self.status += rb3compat.unicodedecode(_(' and a duration of %d minutes') % 
                        duration, 'UTF-8')
    def update_request_status_bar(self, coverobject):
        '''
        Callback called by the album loader starts performing a new cover
        request. It prompts the source to change the content of the request
        statusbar.
        '''
        print("CoverArtBrowser DEBUG - update_request_status_bar")

        if coverobject:
            # for example "Requesting the picture cover for the music artist Michael Jackson"
            tranlation_string = _('Requesting cover for %s...')
            self.request_statusbar.set_text(
                rb3compat.unicodedecode(_('Requesting cover for %s...') % (coverobject.name), 'UTF-8'))
        else:
            self.request_status_box.hide()
            self.popup_menu.set_sensitive('cover_search_menu_item', True)
            self.request_cancel_button.set_sensitive(True)
        print("CoverArtBrowser DEBUG - end update_request_status_bar")
    def update_request_status_bar(self, album):
        '''
        Callback called by the album loader starts performing a new cover
        request. It prompts the source to change the content of the request
        statusbar.
        '''
        print("CoverArtBrowser DEBUG - update_request_status_bar")

        if album:
            self.request_statusbar.set_text(
                rb3compat.unicodedecode(_('Requesting cover for %s - %s...') % (album.name,
                album.artist), 'UTF-8'))
        else:
            self.request_status_box.hide()
            #self.popup_menu.set_sensitive('source_menu_search_all_item', True)
            self.popup_menu.set_sensitive('cover_search_menu_item', True)
            self.request_cancel_button.set_sensitive(True)
        print("CoverArtBrowser DEBUG - end update_request_status_bar")
    def update_request_status_bar(self, coverobject):
        '''
        Callback called by the album loader starts performing a new cover
        request. It prompts the source to change the content of the request
        statusbar.
        '''
        print("CoverArtBrowser DEBUG - update_request_status_bar")

        if coverobject:
            # for example "Requesting the picture cover for the music artist Michael Jackson"
            tranlation_string = _('Requesting cover for %s...')
            self.request_statusbar.set_text(
                rb3compat.unicodedecode(
                    _('Requesting cover for %s...') % (coverobject.name),
                    'UTF-8'))
        else:
            self.request_status_box.hide()
            self.popup_menu.set_sensitive('cover_search_menu_item', True)
            self.request_cancel_button.set_sensitive(True)
        print("CoverArtBrowser DEBUG - end update_request_status_bar")
    def _generate_status(self, albums=None):
        self.status = ''

        if albums:
            track_count = 0
            duration = 0

            for album in albums:
                # Calculate duration and number of tracks from that album
                track_count += album.track_count
                duration += album.duration / 60

            # now lets build up a status label containing some
            # 'interesting stuff' about the album
            if len(albums) == 1:
                #. TRANSLATORS - for example "abba's greatest hits by ABBA"
                self.status = rb3compat.unicodedecode(
                    _('%s by %s') % (album.name, album.artist), 'UTF-8')
            else:
                #. TRANSLATORS - the number of albums that have been selected/highlighted
                self.status = rb3compat.unicodedecode(
                    _('%d selected albums') % (len(albums)), 'UTF-8')

            if track_count == 1:
                self.status += rb3compat.unicodedecode(_(' with 1 track'),
                                                       'UTF-8')
            else:
                self.status += rb3compat.unicodedecode(
                    _(' with %d tracks') % track_count, 'UTF-8')

            if duration == 1:
                self.status += rb3compat.unicodedecode(
                    _(' and a duration of 1 minute'), 'UTF-8')
            else:
                self.status += rb3compat.unicodedecode(
                    _(' and a duration of %d minutes') % duration, 'UTF-8')