Skip to content

PICARD-3061: Add long descriptions to tags, display them in tooltips #2636

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 22 commits into
base: master
Choose a base branch
from

Conversation

rdswift
Copy link
Collaborator

@rdswift rdswift commented Apr 16, 2025

Summary

  • This is a…
    • Bug fix
    • Feature addition
    • Refactoring
    • Minor / simple change (like a typo)
    • Other
  • Describe this change in 1-2 sentences: Add tooltip descriptions to PRESERVED_TAGS and EXTRA_VARIABLES

Problem

The tooltips shown for the tags and variables in the script editor only showed information for the TAG_NAMES. There were no tooltip descriptions for PRESERVED_TAGS and EXTRA_VARIABLES.

Solution

Add tooltip descriptions to PRESERVED_TAGS and EXTRA_VARIABLES. Add test for tooltips on tags and variables.

Action

Additional actions required:

  • Update Picard documentation (please include a reference to this PR)
  • Other (please specify below)

Since this change will result in some new and changed string for translation, please review the new and existing tag description strings to ensure that any desired changes are captured prior to merging this PR.

@rdswift rdswift requested review from phw and zas April 16, 2025 20:04
@rdswift rdswift force-pushed the additional_variable_tooltips branch from 6fb64b9 to cd2d916 Compare April 16, 2025 20:14
@rdswift rdswift marked this pull request as draft April 16, 2025 20:17
@rdswift rdswift force-pushed the additional_variable_tooltips branch from cd2d916 to bf70857 Compare April 16, 2025 20:33
@rdswift rdswift marked this pull request as ready for review April 16, 2025 20:38
Copy link
Member

@phw phw left a comment

Choose a reason for hiding this comment

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

Generally I agree with the goal of providing more context for the variables. But I don't think the current approach works, as it is repurposing the tag name feature. Instead there should be a separate longer description. See my more detailed comments on the code.

As a side note I think the strings used for description should ideally be the same as used in the documentation. Maybe not always the full text. But the more similar they are (ideally identical) the easier it is to reuse the translations on Weblate.

@zas zas mentioned this pull request Apr 17, 2025
7 tasks
@rdswift rdswift marked this pull request as draft April 18, 2025 16:36
@rdswift rdswift force-pushed the additional_variable_tooltips branch from 68f2ea9 to 535dd59 Compare April 23, 2025 15:01
@rdswift rdswift requested a review from phw April 23, 2025 15:28
@rdswift rdswift marked this pull request as ready for review April 23, 2025 15:28
@rdswift rdswift force-pushed the additional_variable_tooltips branch from 0262cbe to 20ec4f2 Compare April 23, 2025 16:24
@rdswift
Copy link
Collaborator Author

rdswift commented Apr 23, 2025

Rebased and pushed with significant changes from the original PR. Please review the descriptions and tooltip code, along with identified TODO: entries. We should remove all of the TODO: items before merging.

EDIT: I also tried to put all of the tags in alphabetical order for ease of maintenance and adding new tags. Please request a change if you spot something in the wrong place.

@zas
Copy link
Collaborator

zas commented Apr 23, 2025

@rdswift what do you think about displaying the tooltip on tag's titles in metadata box, as done in rdswift#19 ?

@zas zas changed the title Add tooltip descriptions to PRESERVED_TAGS and EXTRA_VARIABLES Add long descriptions to tags, display them in tooltips Apr 23, 2025
@rdswift
Copy link
Collaborator Author

rdswift commented Apr 23, 2025

what do you think about displaying the tooltip on tag's titles in metadata box, as done in rdswift#19 ?

Great idea. I merged your changes. Thanks.

@rdswift
Copy link
Collaborator Author

rdswift commented Apr 23, 2025

Also, just a "heads up" that it looks like the Ubuntu test-requirements isn't loading the markdown module, so I ended up checking for that and providing alternate test results for some of the tests in test_util_tags.py in order to make the CI process happy. The macOS and Windows versions seemed to load okay and passed without the alternative results.

@zas
Copy link
Collaborator

zas commented Apr 23, 2025

Also, just a "heads up" that it looks like the Ubuntu test-requirements isn't loading the markdown module, so I ended up checking for that and providing alternate test results for some of the tests in test_util_tags.py in order to make the CI process happy. The macOS and Windows versions seemed to load okay and passed without the alternative results.

markdown is optional, so we should improve matrix testing so we test with and without it.

@rdswift
Copy link
Collaborator Author

rdswift commented Apr 24, 2025

markdown is optional, so we should improve matrix testing so we test with and without it.

In that case, the upside is that I've covered both conditions in the testing for this PR. 😉

),
TagVar(
'media',
shortdesc=N_('Media'),
# TODO: Confirm this is a multi-value.
longdesc=N_('A multi-value tag containing the media on which the release was distributed (e.g.: CD).'),
Copy link
Member

Choose a reason for hiding this comment

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

This isn't multi-value. This is set per track, and a track only has a single media type

),
TagVar(
# TODO: Check if this actually exists or if it was provided by the last.fm plugin.
Copy link
Member

Choose a reason for hiding this comment

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

"Mood" is one of the defined and mapped tags

@phw
Copy link
Member

phw commented Apr 24, 2025

markdown is optional, so we should improve matrix testing so we test with and without it.

We already have this, the test-requirements tests are specifically for this. They test with reduced or older dependencies. E.g. the first test it runs does install the oldest versions we claim to support, and does not include any optional dependency. The other tests include specific versions of one of the optional dependencies. Currently this is now mostly used to test for alternative packages we support (discid vs. libdiscid, chardet vs. charset-normalizer).

So the purpose here is exactly to catch cases where tests fail with optional dependencies missing. Worked as intended :)

The "normal" tests run with requirements.txt applied fully.

@zas
Copy link
Collaborator

zas commented Apr 24, 2025

We already have this, the test-requirements tests are specifically for this.

Thanks for clarifying, I thought something wasn't working, but actually that's the reverse, it is working perfectly :)
@rdswift : since markdown is optional, you have to handle both cases in the code (as you discovered), that's not a problem with tests (a contrario).

zas
zas previously approved these changes Apr 27, 2025
Copy link
Collaborator

@zas zas left a comment

Choose a reason for hiding this comment

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

LGTM

@zas
Copy link
Collaborator

zas commented Apr 27, 2025

@rdswift do you have more changes to add to this PR? I think it is now (very) good, so I approved it.
I'd like @phw to review it too before any merge, there are more than expect changes (for the good imho) in this PR so extensive review is needed.

@rdswift
Copy link
Collaborator Author

rdswift commented Apr 27, 2025

@rdswift do you have more changes to add to this PR? I think it is now (very) good, so I approved it.

Nothing more from me on this PR. I may have some more description changes, or link / see also / option items to add, but I will start a new PR for that.

I'd like @phw to review it too before any merge, there are more than expect changes (for the good imho) in this PR so extensive review is needed.

I'd like to have him review it again as well. One thing we still didn't finalize is whether or not to use "No description provided" or just repeat the tag name as the tooltip if there is no longdesc or shortdesc or the tag is not found in TagVars.

@rdswift rdswift changed the title Add long descriptions to tags, display them in tooltips PICARD-3061: Add long descriptions to tags, display them in tooltips Apr 28, 2025
rdswift and others added 21 commits April 28, 2025 11:41
- Add long descriptions to use for tooltips.
- Add tooltips method.
- Add basic html if markup not loaded.
Add backticks around date format.

Co-authored-by: Laurent Monin <lmonin.zas@gmail.com>
- Add a constant to PICARD_URLS for `https://musicbrainz.org/doc/`
- Add a helper to get a title for an option setting in
`picard/profile.py`
- Only include the long description and notes in tag tooltips.
- Add a new method to get a tag's full description including the long
description, notes, related settings and links.  This could be used to
provide tag documentation similar to scripting function documentation.
- Change tag options to `is_*` for consistency. Use properties `not_*`
for use with `ATTRIB2NOTE` as proposed by @zas.
- Update tests.
* Notes/sections: make the code more generic, and easier to extend

- use an IntEnum to identify sections
- use a namedtuple to describe each section: title & function to get content
- replace _add_section() by a more generic _add_sections()

* Move `_gen_sections()` to TagVar, make format translatable

* Add tests for basic TagVar
- Remove `profile_setting_title()` from `picard/profile.py`
- Add `get_option_title()` to `picard/options.py`
- Update `picard/util/tags.py` to use new `get_option_title()` function
- Add new `test/test_options.py` file
- Update `test/test_util_tags.py` file to use new `get_option_title()`
function
@rdswift rdswift force-pushed the additional_variable_tooltips branch from fd94a0a to ecfa871 Compare April 28, 2025 17:42
Copy link
Collaborator

@zas zas left a comment

Choose a reason for hiding this comment

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

LGTM

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

Successfully merging this pull request may close these issues.

3 participants