Where in the Source Code are the Graphic icons handled?

Tags: #<Tag:0x00007f1c9aa610b8>

The album status, track matching status, etc. I’ve tried following backwards by looking for where the graphic is referenced in the source and I can’t find anything.

I would think it’s in /picard/picard/album.py but while I see references to self.status, I don’t see how that is being applied.

It’s all in itemviews.py, there depending on status the colors and icons get applied.

1 Like

What I can’t figure out is how/where the icons are combined with the titles.

There’s the match / match pending which I would like to see the routine for choosing which one, 90, 80, 70, 60… gets affixed to the track title. I want to see about changing the text colors in the percentage complete column to be green when it’s 100%, red when it’s less than 50%…

…and the silver/gold record with the overlaid asterisk or not. Where does that get affixed to the left of the album title?

I want to see if I can separate the album graphic from the album title, to it’s own column. Why? To understand how graphic content only would be put in a column mostly.

I’d also like to figure out separating the columns from the Left and Right, since anything I’ve added appears in both, so lets leave out the irrelevant ones from the Left.

Hmm… maybe it’s being imported from itemviews.py into both album.py and cluster.py … so make a separate list for cluster…

…and fix the save column positions and widths on quit and that would be golden UI wise.

It’s all handled in itemviews.py, album.py and cluster.py don’t deal with UI at all. The icons are set with calls to setIcon on the various items being displayed. There are classes for each type of item (ClusterItem, AlbumItem, TrackItem etc.). Each item class is handling setting an appropriate icon for itself.

The left column is managed by the class FileTreeView (itemviews.py#L610), the right column by AlbumTreeView (itemviews.py#L640). Both inherit from BaseTreeView, which currently sets the displayed column to what is defined in MainPanel.columns. So same columns for both views, but this could of course be split for the separate views.

1 Like

I’m trying to see where the icon is becoming part of the title on the Album side, as I’d like to separate that to it’s own column in the hopes that the sort routine would give me the ability to sort by icon type. All the gold, not gold, modified…

def column(self, column, linked_tracks=None):
    if column == 'title':
        if self.status is not None:
            title = self.status
        else:
            title = self.metadata['album']
        if self.tracks:
            linked_tracks = 0
            for track in self.tracks:
                if track.is_linked():
                    linked_tracks += 1

            #text = title
            #text = '%s\u200E (%d/%d' % (title, linked_tracks, len(self.tracks))
            text = '%s\u200E' % (title)

Separating out the linked, amount of tracks, amount of images into their own columns was pretty straight forward.

I think I need to look at itemviews a bit more. Maybe take the high-school programming class method from the mid 1980s. Print the thing out and flow chart it.