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. |
| # 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.
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.
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
So something like keybinding_visible_in_tooltip and make its default value False?
There was a problem hiding this comment.
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? |
Closes #216
Related to napari/napari#7133