Skip to content
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

Launcher: Make sure actions in Launcher are sorted #537

Merged
merged 3 commits into from
May 23, 2024

Conversation

fabiaserra
Copy link
Contributor

Changelog Description

Sort action items by identifier so their order doesn't keep changing on every launch.

Testing notes:

  1. Open Launcher
  2. Actions should be sorted

@ynbot ynbot added type: feature Adding something new and exciting to the product size/XS labels May 21, 2024
@BigRoy
Copy link
Collaborator

BigRoy commented May 22, 2024

@iLLiCiTiT isn't it much easier to just turn the sort role data here to e.g.:

            item.setData((action_item.order, action_item.identifier), ACTION_SORT_ROLE)

So that it sorts on the tuple of order, then identifier? Of course you can replace identifier there with e.g. nice display name if you prefer that.

The current fix seems a bit overkill and admittedly hard to grasp as well.

@iLLiCiTiT
Copy link
Member

iLLiCiTiT commented May 22, 2024

isn't it much easier to just turn the sort role data here to e.g.:

My experience with using python objects (tuple of 2 values) in role data of model are not very good, they usually fall apart when Qt wrapper of a DCC (or on different platform) tries to convert it to QVariant resulting in invalid value. It also does not handle TypeError to 100% avoid TypeError we should validate or autofix order and label in backend (can be done).

@fabiaserra
Copy link
Contributor Author

works as expected, thank you @iLLiCiTiT !

@iLLiCiTiT iLLiCiTiT merged commit 47f7073 into ynput:develop May 23, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/XS type: feature Adding something new and exciting to the product
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants