-
Notifications
You must be signed in to change notification settings - Fork 13
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
feat: add action keybinding info over tooltip #218
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #218 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 31 31
Lines 1871 1875 +4
=========================================
+ Hits 1871 1875 +4 ☔ View full report in Codecov by Sentry. |
@@ -54,6 +56,11 @@ def _on_triggered(self, checked: bool) -> None: | |||
# to raise any exceptions. | |||
self._app.commands.execute_command(self._command_id).result() | |||
|
|||
def setToolTip(self, tooltip: str) -> None: |
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.
with this pattern, is there any way for someone to opt out of this behavior? For example, if they wish to set their own tooltip (sans suffix). What do you think about simply calling self.setToolTip
with the text and the shortcut suffix in __init__
(and then later calls to setToolTip()
would override it). ... or some other method that makes it opt-out-able
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.
Oh I see, maybe I overdid a little bit here trying to implement a way to always show the keybinding 😅 Will simplify things then 👍
Also, regardless of the simplification. could it make sense to add over the Action
definition a field like the one for CommandRule
definition for the icon visibility?
app-model/src/app_model/types/_command_rule.py
Lines 61 to 65 in 4afa6f6
icon_visible_in_menu: bool = Field( | |
True, | |
description="Whether to show the icon in menus (for backends that support it). " | |
"If `False`, only the title will be shown. By default, `True`.", | |
) |
So something like keybinding_visible_in_tooltip
and make its default value False
?
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 i'd prefer not to have that sort of "view-specific" setting in the model itself.
…ge of single key as key combination with Qt6
@tlambert03 I think your comments have been addressed if you wouldn't mind taking another look at this PR? |
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!
Closes #216
Related to napari/napari#7133