-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Add menu shortcut texts for non-darwin OS #5248
Conversation
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.
Nice idea. Thanks for this. I've left some of my own ideas on the code but I think it would be wise to have @toaster have a look as well.
widget/menu_item.go
Outdated
@@ -37,6 +41,25 @@ var keySymbols = map[fyne.KeyName]rune{ | |||
fyne.KeyUp: '↑', | |||
} | |||
|
|||
// key default text |
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.
This comment does not add any value over the variable name. Either remove it or write something more helpful.
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.
Thank you for taking the time to review my PR.
I will rework the comments.
Yes a runtime check might seem simpler (not sure how using runtime checks is easier to unit test TBH). P.S. do check that the font must be different before coding that in - I think that if you choose symbol it would fall back to the normal font if the item is not in fact a symbol. |
I entirely agree that A matches what we already have the best. It is good to be consistent with that and also not compiling in unnecessary code can be a win (sometimes also for readability). To be fair, I did actually suggest B initially because that better described what I meant with "moving out the four if-statements" and because it was a smaller change from the existing code in the PR. However, I do agree that A is more consistent with what we already have and likely is the better path forward. |
tyvm both for the clarification and your patience. I will rework the solution to exclusively use build flags.
With runtime checks you can make the current OS a parameter of the |
Thanks, A helpful answer. It is indeed true that with the build flags the unit tests cannot cover all systems on one run, but CI provides the checks for those systems - so overall we get the optimised path but get the test runs too. |
6b914d5
to
4b4edb4
Compare
Here is my new attempt ready for review. |
Thanks. I had a very quick look through the code on my phone and it looked great. Will follow up with a proper review later in the week when I have more time :) |
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.
Thanks. Sorry for the late review; I've been quite busy recently. This looks great. Just one minor comment about modifying the window size of one of the test images :)
widget/testdata/menu/desktop/layout_shortcuts_other_theme_changed.png
Outdated
Show resolved
Hide resolved
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.
Perfect. Thanks for working on this 👍
Thank you again for your review and patience with my PR. This is my first feature submission for Fyne and I am still learning how everything works. The tests are now passing on my branch. Seams to be those flaky tests again acting up. |
No worries. Glad we all got to the same page in the end. Congratulations on your first PR then :)
Yeah, sorry about that. Seems like the coverage upload is a bit flakey. Strange. Either way, kicking the tests made it all pass now so I'll merge 👍 |
Description:
The current implementation renders menu shortcuts exclusively in macOS style, which might be confusing for users on Windows and Linux (see also #5108).
This PR adds a new generic style for rending menu shortcut texts on non-Darwin OS, while keeping the existing macOS style for Darwin OS. The generic style is mostly spelling out the names of keys instead of using symbols and should be much easier to understand for Windows and Linux users. The style is based on the VS Code shortcut documentation for Windows and Linux.
Additional changes
Example screenshot
Fixes #5108
Checklist:
Where applicable:
N/A