ynput / ayon-core

Apache License 2.0
28 stars 34 forks source link

Launcher: Make sure actions in Launcher are sorted #537

Closed fabiaserra closed 4 months ago

fabiaserra commented 4 months ago

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
BigRoy commented 4 months ago

@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 commented 4 months ago

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 commented 4 months ago

works as expected, thank you @iLLiCiTiT !