Open OverLordGoldDragon opened 4 years ago
That's a great suggestion @OverLordGoldDragon!
@juanis2112, what do you think?
I was able to change the tooltip property of the tab widget, but I couldn't get it to actually show up on hover. @ccordoba12 is there a better way?
If not, I was able to work around that by triggering it manually using the existing event handler, adding the following in the TabFilter.event_filter
method in dock.py
(Importing QToolTip
from qtpy.QtWidgets
above):
if event_type == QEvent.ToolTip:
tab_index = self.dock_tabbar.tabAt(event.pos())
if tab_index != -1:
QToolTip.showText(
event.globalPos(), self.dock_tabbar.tabToolTip(tab_index))
It doesn't inherit the style of the other tooltips for some reason (@ccordoba12 you know why?), but we can set that by a few different ways; for example in the __init__
method of TabFilter
right below the other setStyleSheet()
call, we can do e.g.
if is_dark_interface():
tooltip_bg_color = qdarkstyle.DarkPalette.COLOR_SELECTION_LIGHT
qapplication().setStyleSheet(f"QToolTip {{ color: #000000; background-color: {tooltip_bg_color}; border: 0px; }}")
(Of course, we'll need to import qdarkstyle,is_dark_interface
from spyder.config.gui
and qapplication
from spyder.utils.qthelpers
.)
That example just shows the current tool tip text, which is the widget title; but I believe we can do it by either doing a lookup right in TabFilter (which might be a little complicated and repetitive) or, probably better, by setting it when setting up each plugin. @ccordoba12 any ideas on the best way to do this, or should I just go with this?
I was able to change the tooltip property of the tab widget, but I couldn't get it to actually show up on hover. @ccordoba12 is there a better way?
I haven't done that before, so I couldn't tell.
It doesn't inherit the style of the other tooltips for some reason (@ccordoba12 you know why?)
No idea, sorry.
@ccordoba12 any ideas on the best way to do this, or should I just go with this?
I think you should go with this approach.
It'd be useful if there was a tooltip showing which keyboard shortcut can be used to change focus to that window; I only somewhat recently learned that Ctrl + Shift + I and Ctrl + Shift + E are IPython and Editor, respectively, which has been a substantial convenience. Sure, one can look through all the shortcuts, or View > Panes... but may not, or could use a quick reminder.
If it is implemented for one such tab, I could fill for others, as it doesn't seem complicated - I just don't know how to get the user shortcut setting or add a tooltip.