Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@beyondcompute
Copy link
Contributor

@beyondcompute beyondcompute commented Mar 16, 2025

Why

I was getting confused while working with add-on configs, files, etc. often clicking the buttons without having any add-ons selected, and getting the please_select_a_single_addon_first pop-up. Perhaps this could improve the usability of the dialog, if buttons were only clickable when clicking them would lead to a useful action.

How

  1. Added itemSelectionChanged handler because it is also triggered on empty selection, etc.
  2. Left currentRowChanged handler to preserve the hook’s behavior. But moved the button-disabling logic to the new handler.
  3. Upon selection state change, disabling the 3 buttons, enabling “View Files” for empty selection, and enabling all 3 buttons when only 1 add-on is selected (still checking if the add-on has Page and Config).

Note that now it would theoretically be possible to remove the onlyOneSelected function. 📝

I hope, my code is not too sloppy (and I am sorry for doing multiple things, like adding the Cmd+W shortcut, in the same PR). Big thanks to the Anki team for all their effort! 🙌

Before:

Note that when multiple add-ons are selected, the state of Page and Config buttons depends on which add-on is the first among the selected ones.

Screen.Recording.2025-03-16.at.22.53.46.mov

After:

Screen.Recording.2025-03-17.at.00.08.05.mov

@beyondcompute beyondcompute force-pushed the addons-dialog-disable-config-etc-buttons-on-multiple-selection branch 2 times, most recently from ebdf533 to 76c93e8 Compare March 18, 2025 00:00
@beyondcompute beyondcompute force-pushed the addons-dialog-disable-config-etc-buttons-on-multiple-selection branch from 76c93e8 to 581ef7d Compare March 18, 2025 00:00
@abdnh
Copy link
Collaborator

abdnh commented Mar 19, 2025

Looking good. Thank you!

@abdnh abdnh merged commit ffcc761 into ankitects:main Mar 19, 2025
1 check passed
@beyondcompute beyondcompute deleted the addons-dialog-disable-config-etc-buttons-on-multiple-selection branch March 19, 2025 12:11
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.

2 participants