-
Notifications
You must be signed in to change notification settings - Fork 26
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
REF: button bar rework - template switch menu + Jira reporting button #572
Conversation
I think the fewer-buttons look is pretty nice fwiw |
A sort-of minimal implementation of my suggestion. We should of course set the stylesheet outside this callback but the idea remains: def add_template(filename: pathlib.Path) -> None:
def switch_template(*, filename: pathlib.Path = filename):
self.force_template = filename
action = base_menu.addAction(str(filename))
action.triggered.connect(switch_template)
if self.current_template == filename:
base_menu.setDefaultAction(action)
base_menu.setStyleSheet("QMenu::item:default { color: #ff0000; }")
actions.append(action) |
Kudos to @tangkong for the suggestion + implementation
Great suggestion @tangkong - pushed a commit with this: (Styling may need some work) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's nice! It helps make the template organization/hierarchy a little more obvious.
Leads me to wonder if people would ever want the base templates. I'm sure there's a world where we do, but for now people probably don't care huh.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, there probably is little reason to display those - though maybe better to display more options than less just in case? The menu should look less cluttered for a non-development checkout version, but not much better admittedly.
Another thought is that this menu could also have nested submenus. I'm fond of seeing all the choices in a big list personally. That said, base/"advanced" ones still could be in an "Other screens" menu, maybe...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick note: the most up-to-date version of this looks even better with the shared prefixes cleaned up
I'm curious how this will end up looking for dev_conda
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this looks good, we could quibble about the exact format of template menu but I think it's a clear improvement in its current state
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing to suggest about the code- just two unnecessary observations to distract you.
I'll run with the branch and take a look at it now
self.embedded_screen: "Embedded", | ||
self.detailed_screen: "Detailed", | ||
self.engineering_screen: "Engineering", | ||
}[self] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's wild to me that this works, the code reads pretty confusingly if you forget that this is an IntEnum
(as I did, on initial review).
I don't think many other classes would be able to look themselves up in a dictionary of their own attributes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've used this pattern before with enums and kinda liked it - but if you think it's confusing it's worth redoing honestly as "clever code" is not good code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't necessarily think it's worth changes- the only reason I was confused is because:
- The diff cut off at a point where I didn't see "IntEnum"
- I briefly forgot that IntEnum can be used as an int
for template in DEFAULT_TEMPLATES_FLATTEN: | ||
add_template(template) | ||
|
||
prefix = os.path.commonprefix( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this widely useful utility function hiding in the os.path module? Python weird
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't agree more...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe unrelated to this PR and more as a consequence of #563: there's some edge cases now where you can accidentally pick a template that doesn't itself contain a button title bar, and there's no way to go back. Not sure how to handle this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good one... maybe the suite needs to be smarter and insert a title bar if it doesn't exist in the newly-created display?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, either a smart title bar or some alternate way to switch templates- right clicking?
Or, prevent us from swapping to the "dead end" templates I guess (somehow)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm 👍 on all the changes introduced here
Description
Motivation and Context
How Has This Been Tested?
Where Has This Been Documented?
PR text
Screenshots (if appropriate):
The new toolbar:
!
being "create jira report":->
...
shows all templates from all categories: