Skip to content

PICARD-442: Add match quality column and allow sorting #2696

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

knguyen1
Copy link
Contributor

@knguyen1 knguyen1 commented Aug 2, 2025

Summary

  • This is a…
    • Bug fix
    • Feature addition
    • Refactoring
    • Minor / simple change (like a typo)
    • Other
  • Describe this change in 1-2 sentences: Adds a new "Match Quality" column to the album view that displays match statistics using visual icons and text, showing matched/total tracks, missing tracks, duplicates, and extra files.

Problem

Users need a quick visual way to assess the quality of their file-to-track matches in albums. Currently, users must manually inspect each track to understand match status, which is time-consuming and error-prone.

Solution

  • Added MatchQualityColumn class that displays match statistics at the album level
  • Implemented custom delegate (MatchQualityColumnDelegate) for rendering icons and text
  • Column shows format: "matched/total; missing; duplicates; extra; unmatched"
  • Uses existing match icons from FileItem for visual consistency
  • Added re-sort trigger in Album._finalize_loading() to ensure accurate sorting after album loads
  • Column integrates with existing item views system and respects sorting/filtering
image

Action

Additional actions required:

@knguyen1
Copy link
Contributor Author

knguyen1 commented Aug 2, 2025

FYI.. changes unrelated to the feature is due to ruff format.

@zas zas requested review from phw, zas and rdswift August 2, 2025 07:09
@@ -91,6 +91,7 @@
from picard.ui.collectionmenu import CollectionMenu
from picard.ui.enums import MainAction
from picard.ui.filter import Filter
from picard.ui.itemviews.match_quality_column import MatchQualityColumn, MatchQualityColumnDelegate
Copy link
Collaborator

@rdswift rdswift Aug 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the new style for import formatting because of ruff? Wasn't our standard to format multiple imports as a tuple with each import (tuple item) on a separate line?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. This is from the pre-commit hook ruff format, the rule is governed by:

pyproject.toml:157-157

line-length = 120

This particularly line is 100 chars long, so ruff/black will prefer to keep it on one line.

Copy link
Collaborator

@rdswift rdswift Aug 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but there was an isort rule force_grid_wrap = 2 (along with other formatting rules) in the pyproject.toml file that differ from the current ruff configuration. Thus the reason for my question, because the include style is now different.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ruff prefers black style (can't change it). That's another thing noticed that was missing from the previous isort configuration.

Anyway that's a pyproject.toml/formatting change, unrelated to this PR.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ruff prefers black style (can't change it).

I see that, and it appears that the ruff development team have no intention of supporting isort formatting. That's unfortunate because the way that we used to format the imports made a lot more sense (in my opinion) when reviewing git diffs.

Anyway that's a pyproject.toml/formatting change, unrelated to this PR.

Agreed. It's just that this PR happens to be where I noticed the changes.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should review changes (in a separate PR) after running ruff format. I just did a test on current master branch: 273 files changed, 5013 insertions(+), 4555 deletions(-)

We need to ensure format is correct and no issue is created by running ruff format.
Also we need to update documentation about coding style if we go this way.

I would apply those changes first, and get rid of stylistic changes in PRs. I mean if we agree to use black style, I'm not totally happy with it style-wise, but ruff format is very convenient and fast.

@phw @rdswift @knguyen1 What do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I generally agree with @zas. I'm also not really happy with the black style. The changing of import style based on line length is rather annoying and can lead to unnecessary and hard to read changed lines in diffs rather randomly. We had quite lengthy discussions about this when we introduced isort managing the imports, and the current system of having multiple imports on separate lines worked really well.

But if we really can't change it I would prefer the convenience of ruff format over my personal taste.

We should do a complete formatting run in a separate PR and check the result. Maybe there is more changes that we need to discuss and probably tweak one way or another.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@phw has summarized my thoughts exactly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should review changes (in a separate PR) after running ruff format. I just did a test on current master branch: 273 files changed, 5013 insertions(+), 4555 deletions(-)

We need to ensure format is correct and no issue is created by running ruff format.

Yes. I noted this in this PR comment: #2690 (comment)

I also suggest the same: We need a massive ruff format refactor so that (a) we can add ruff format --check to the CI pipelines and (b) so that we can avoid seeing so much non-PR related formatting noise in future PR's.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran ruff format on current master branch, and created a PR for us to review changes: #2697

Copy link
Collaborator

@rdswift rdswift left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks fine to me.

For clarification, I assume this new column is intended to augment (not replace) the current Album / Release status icon. In that case, it might be better positioned in a column adjacent to the current Album / Release status icon.

My other concern is with the width of this column -- always a minimum of 200 pixels (if I read the code correctly). Since the details are available for display as a tooltip on this new Match Quality icon, perhaps we can just display the icon and not the summary numbers (which can be viewed from the tooltip). This would save some of the limited available display space.

Finally, since this changes the standard display for the user, I believe that the documentation should be updated (at least the Album / Release Icons section, and possibly the images on the Main Screen page). I'll add a sub-task ticket for this so it doesn't get forgotten.

@knguyen1
Copy link
Contributor Author

knguyen1 commented Aug 3, 2025

For clarification, I assume this new column is intended to augment (not replace) the current Album / Release status icon. In that case, it might be better positioned in a column adjacent to the current Album / Release status icon.

Need to make some decisions here re: match/total; missing; duplicates; extra; unmatched details in the col. My preference is only the icon.

  • Display the full details (match/total; missing; duplicates; extra; unmatched) in the column?
image
  • Only matched/total?
image
  • Only the icon?
image

Also matched/total is available in the Title column already anyway. So have to make a decision there too...

And if we decide on only the icon, I suggest we rename the column -> Match.

@rdswift
Copy link
Collaborator

rdswift commented Aug 3, 2025

My preference is only the icon.

I think that would be my preference as well, since all the details are available via the tooltip.

And if we decide on only the icon, I suggest we rename the column -> Match.

That would help reduce the space required. Would it be possible to leave out the column name completely (and only have the sort direction indicator if required)? I'm thinking that it being next to the status icon might make it clear that it is the quality of the match. Then again, it might not be clear to other users.

@zas
Copy link
Collaborator

zas commented Aug 4, 2025

My preference is only the icon.

Mine too, as all infos are available elsewhere (tooltip and/or title).

@phw
Copy link
Member

phw commented Aug 4, 2025

My preference is only the icon.

And if we decide on only the icon, I suggest we rename the column -> Match.

+1 for both of those from me, too

@knguyen1
Copy link
Contributor Author

knguyen1 commented Aug 5, 2025

My preference is only the icon.

And if we decide on only the icon, I suggest we rename the column -> Match.

+1 for both of those from me, too

This commit: 3f7260f

  • Pull column to left, next to Title/Length/Artist
  • Rename column -> Match
  • Column always shows
  • Remove text from column
  • Column sort order seems to be different on linux vs. Windows (will confirm)
image

@knguyen1
Copy link
Contributor Author

knguyen1 commented Aug 5, 2025

Column sort order seems to be different on linux vs. Windows (will confirm)

Just tested on Linux and confirmed. The sorting order icon seems reversed on linux. Commit: 3039a01

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants