# Where in the Source Code are the Graphic icons handled?

**URL:** <https://community.metabrainz.org/t/where-in-the-source-code-are-the-graphic-icons-handled/447842>\
**Category:** MusicBrainz Picard\
**Tags:** source-code\
**Created:** [October 17, 2019, 11:24am UTC](https://community.metabrainz.org/t/where-in-the-source-code-are-the-graphic-icons-handled/447842 "2019-10-17T11:24:33Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![tdiaz](https://community.metabrainz.org/user_avatar/community.metabrainz.org/tdiaz/32/14333_2.png) [@tdiaz](https://community.metabrainz.org/u/tdiaz)\
**Post date:** [October 17, 2019, 11:24am UTC](https://community.metabrainz.org/t/where-in-the-source-code-are-the-graphic-icons-handled/447842/1 "2019-10-17T11:24:33Z")

</div>

![36%20AM](https://community.metabrainz.org/uploads/default/original/3X/e/2/e2c3472b51d8fbd821440aeef29b04d87fecc050.png)

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.

---

<div class="post-metadata">

**Author:** ![outsidecontext](https://community.metabrainz.org/user_avatar/community.metabrainz.org/outsidecontext/32/90_2.png) [@outsidecontext](https://community.metabrainz.org/u/outsidecontext)\
**Post date:** [October 17, 2019, 11:54am UTC](https://community.metabrainz.org/t/where-in-the-source-code-are-the-graphic-icons-handled/447842/2 "2019-10-17T11:54:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tdiaz](https://community.metabrainz.org/user_avatar/community.metabrainz.org/tdiaz/32/14333_2.png) [@tdiaz](https://community.metabrainz.org/u/tdiaz)\
**Post date:** [November 7, 2019, 5:37pm UTC](https://community.metabrainz.org/t/where-in-the-source-code-are-the-graphic-icons-handled/447842/3 "2019-11-07T17:37:24Z")

</div>

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.

 ![32%20AM](https://community.metabrainz.org/uploads/default/original/3X/a/c/ac433eab69fe0d944677c81277891041ed603cbf.png)

---

<div class="post-metadata">

**Author:** ![tdiaz](https://community.metabrainz.org/user_avatar/community.metabrainz.org/tdiaz/32/14333_2.png) [@tdiaz](https://community.metabrainz.org/u/tdiaz)\
**Post date:** [November 8, 2019, 12:13am UTC](https://community.metabrainz.org/t/where-in-the-source-code-are-the-graphic-icons-handled/447842/4 "2019-11-08T00:13:32Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![outsidecontext](https://community.metabrainz.org/user_avatar/community.metabrainz.org/outsidecontext/32/90_2.png) [@outsidecontext](https://community.metabrainz.org/u/outsidecontext)\
**Post date:** [November 11, 2019, 10:41am UTC](https://community.metabrainz.org/t/where-in-the-source-code-are-the-graphic-icons-handled/447842/5 "2019-11-11T10:41:34Z")

</div>

> [@tdiaz](#):
>
> maybe it’s being imported from itemviews.py into both album.py and cluster.py

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.

> [@tdiaz](#):
>
> I’d also like to figure out separating the columns from the Left and Right

The left column is managed by the class `FileTreeView` ([itemviews.py#L610](https://github.com/metabrainz/picard/blob/552051aeb938dfc9bc78419693d2dfeb294e8012/picard/ui/itemviews.py#L610)), the right column by `AlbumTreeView` ([itemviews.py#L640](https://github.com/metabrainz/picard/blob/552051aeb938dfc9bc78419693d2dfeb294e8012/picard/ui/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.

---

<div class="post-metadata">

**Author:** ![tdiaz](https://community.metabrainz.org/user_avatar/community.metabrainz.org/tdiaz/32/14333_2.png) [@tdiaz](https://community.metabrainz.org/u/tdiaz)\
**Post date:** [December 11, 2019, 4:30pm UTC](https://community.metabrainz.org/t/where-in-the-source-code-are-the-graphic-icons-handled/447842/6 "2019-12-11T16:30:03Z")

</div>

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.
