MNT: establish a deterministic designer widget order#1325
Open
ZLLentz wants to merge 2 commits intoslaclab:masterfrom
Open
MNT: establish a deterministic designer widget order#1325ZLLentz wants to merge 2 commits intoslaclab:masterfrom
ZLLentz wants to merge 2 commits intoslaclab:masterfrom
Conversation
Collaborator
|
I definitely think this is a good idea. I'd never really noticed the ordering before either. I think the order you've gone with makes sense, and would be happy to go with this as is with this implementation which works fine with my testing. And good point about the conda-forge build, we could just go ahead and update that now, it should have been using this already anyway: https://github.com/slaclab/pydm/blob/master/conda-recipe/build.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In this PR, I'm looking for:
Problem Statement
The PyDM widget order in designer is currently chaotic. I didn't notice this until I started adding some custom widget categories and got very confused about the ordering, then investigated how the ordering is established, and then finally decided that the only way to handle it was to either patch PyDM or make my own designer plugin loader. If others think this is useful I'd prefer to do it in PyDM itself.
Background
Here's a quick primer about how the ordering of the widgets is determined:
addCustomWidget(I haven't tested pyside6). Note that currently in pydm this also ends up being essentially the import/plugin creation order.So this leads to funny things like
PyDMNTTablebeing the first input widget andPyDMTabWidgetbeing the first container widget, simply because their names are early inglobals()due to the imports and attribute name re-use, while other widgets are ordered somewhat deliberately. Small permutations to the ordering in these files can chaotically interfere with the overall designer ordering.It also leads to nonsense ordering for entrypoint widget groups:
This ends up depending on the order in which the widgets are loaded from the entrypoint, which to my eye seems to always be sorted by widget name. So the first group is the group associated with a widget that starts with A, and so-on.
This PR
This PR simply creates an opinionated ordering of the designer widgets:
The details can be changed as much as we like.
I tried to change as little as possible unrelated to this PR- if you'd like me to change more, let me know.
Notes about conda
The conda-forge build uses the internal widgets submodule to set up the designer plugins and would need to be changed to use the proper top-level file.
https://github.com/conda-forge/pydm-feedstock/blob/main/recipe/build.sh#L15