fix night mode tooltips

This commit is contained in:
Damien Elmes 2020-01-24 07:55:14 +10:00
parent cc648195e4
commit e3fb184a84
2 changed files with 16 additions and 6 deletions

View File

@ -89,6 +89,13 @@ QTreeWidget {
}
"""
if self.night_mode:
buf += """
QToolTip {
border: 0;
}
"""
# allow addons to modify the styling
buf = gui_hooks.style_did_init(buf)
@ -104,7 +111,6 @@ QTreeWidget {
text_fg = self.qcolor("text-fg")
palette.setColor(QPalette.WindowText, text_fg)
palette.setColor(QPalette.ToolTipBase, text_fg)
palette.setColor(QPalette.ToolTipText, text_fg)
palette.setColor(QPalette.Text, text_fg)
palette.setColor(QPalette.ButtonText, text_fg)
@ -119,7 +125,9 @@ QTreeWidget {
palette.setColor(QPalette.AlternateBase, window_bg)
palette.setColor(QPalette.Button, window_bg)
palette.setColor(QPalette.Base, self.qcolor("frame-bg"))
frame_bg = self.qcolor("frame-bg")
palette.setColor(QPalette.Base, frame_bg)
palette.setColor(QPalette.ToolTipBase, frame_bg)
disabled_color = self.qcolor("disabled")
palette.setColor(QPalette.Disabled, QPalette.Text, disabled_color)

View File

@ -11,6 +11,7 @@ import aqt
from anki.lang import _
from anki.utils import invalidFilename, isMac, isWin, noBundledLibs, versionWithBuild
from aqt.qt import *
from aqt.theme import theme_manager
def aqt_data_folder() -> str:
@ -551,10 +552,11 @@ def tooltip(msg, period=3000, parent=None):
lab.setFrameStyle(QFrame.Panel)
lab.setLineWidth(2)
lab.setWindowFlags(Qt.ToolTip)
p = QPalette()
p.setColor(QPalette.Window, QColor("#feffc4"))
p.setColor(QPalette.WindowText, QColor("#000000"))
lab.setPalette(p)
if not theme_manager.night_mode:
p = QPalette()
p.setColor(QPalette.Window, QColor("#feffc4"))
p.setColor(QPalette.WindowText, QColor("#000000"))
lab.setPalette(p)
lab.move(aw.mapToGlobal(QPoint(0, -100 + aw.height())))
lab.show()
_tooltipTimer = aqt.mw.progress.timer(