Add utility func for setting window icon
This commit is contained in:
parent
f0d7e6f4d1
commit
7eec241c82
@ -14,6 +14,7 @@ from aqt.utils import (
|
|||||||
qconnect,
|
qconnect,
|
||||||
restoreGeom,
|
restoreGeom,
|
||||||
saveGeom,
|
saveGeom,
|
||||||
|
setWindowIcon,
|
||||||
tr,
|
tr,
|
||||||
)
|
)
|
||||||
from aqt.webview import AnkiWebView
|
from aqt.webview import AnkiWebView
|
||||||
@ -47,9 +48,7 @@ class CardInfoDialog(QDialog):
|
|||||||
disable_help_button(self)
|
disable_help_button(self)
|
||||||
restoreGeom(self, self.GEOMETRY_KEY)
|
restoreGeom(self, self.GEOMETRY_KEY)
|
||||||
addCloseShortcut(self)
|
addCloseShortcut(self)
|
||||||
icon = QIcon()
|
setWindowIcon(self)
|
||||||
icon.addPixmap(QPixmap("icons:anki.png"), QIcon.Mode.Normal, QIcon.State.Off)
|
|
||||||
self.setWindowIcon(icon)
|
|
||||||
|
|
||||||
self.web = AnkiWebView(title=self.TITLE)
|
self.web = AnkiWebView(title=self.TITLE)
|
||||||
self.web.setVisible(False)
|
self.web.setVisible(False)
|
||||||
|
@ -17,9 +17,7 @@ from aqt.qt import (
|
|||||||
QCheckBox,
|
QCheckBox,
|
||||||
QDialog,
|
QDialog,
|
||||||
QDialogButtonBox,
|
QDialogButtonBox,
|
||||||
QIcon,
|
|
||||||
QKeySequence,
|
QKeySequence,
|
||||||
QPixmap,
|
|
||||||
QShortcut,
|
QShortcut,
|
||||||
Qt,
|
Qt,
|
||||||
QTimer,
|
QTimer,
|
||||||
@ -30,7 +28,7 @@ from aqt.qt import (
|
|||||||
from aqt.reviewer import replay_audio
|
from aqt.reviewer import replay_audio
|
||||||
from aqt.sound import av_player, play_clicked_audio
|
from aqt.sound import av_player, play_clicked_audio
|
||||||
from aqt.theme import theme_manager
|
from aqt.theme import theme_manager
|
||||||
from aqt.utils import disable_help_button, restoreGeom, saveGeom, tr
|
from aqt.utils import disable_help_button, restoreGeom, saveGeom, setWindowIcon, tr
|
||||||
from aqt.webview import AnkiWebView
|
from aqt.webview import AnkiWebView
|
||||||
|
|
||||||
LastStateAndMod = tuple[str, int, int]
|
LastStateAndMod = tuple[str, int, int]
|
||||||
@ -52,10 +50,8 @@ class Previewer(QDialog):
|
|||||||
self._parent = parent
|
self._parent = parent
|
||||||
self._close_callback = on_close
|
self._close_callback = on_close
|
||||||
self.mw = mw
|
self.mw = mw
|
||||||
icon = QIcon()
|
|
||||||
icon.addPixmap(QPixmap("icons:anki.png"), QIcon.Mode.Normal, QIcon.State.Off)
|
|
||||||
disable_help_button(self)
|
disable_help_button(self)
|
||||||
self.setWindowIcon(icon)
|
setWindowIcon(self)
|
||||||
|
|
||||||
def card(self) -> Card | None:
|
def card(self) -> Card | None:
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
@ -406,6 +406,12 @@ def disable_help_button(widget: QWidget) -> None:
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def setWindowIcon(widget: QWidget) -> None:
|
||||||
|
icon = QIcon()
|
||||||
|
icon.addPixmap(QPixmap("icons:anki.png"), QIcon.Mode.Normal, QIcon.State.Off)
|
||||||
|
widget.setWindowIcon(icon)
|
||||||
|
|
||||||
|
|
||||||
# File handling
|
# File handling
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user