Make alert show for time set in cfg (default 4s)

This commit is contained in:
miruka 2019-08-16 15:07:30 -04:00
parent 0c493f88d8
commit be18a5db41
3 changed files with 4 additions and 8 deletions

View File

@ -107,6 +107,7 @@ class UISettings(JSONConfigFile):
async def default_data(self) -> JsonData: async def default_data(self) -> JsonData:
return { return {
"alertOnMessageForMsec": 4000,
"theme": "Default.qpl", "theme": "Default.qpl",
"writeAliases": {}, "writeAliases": {},
"keys": { "keys": {

View File

@ -37,15 +37,10 @@ class ExitRequested(PyOtherSideEvent):
@dataclass @dataclass
class AlertRequested(PyOtherSideEvent): class AlertRequested(PyOtherSideEvent):
"""Request an alert to be shown for msec milliseconds. """Request an alert to be shown for msec milliseconds.
If msec is 0 (default), the alert should be shown indefinitely until
the window is focused.
The Alert state for example sets the urgency hint on X11/Wayland, The Alert state for example sets the urgency hint on X11/Wayland,
or flashes the taskbar icon on Windows. or flashes the taskbar icon on Windows.
""" """
msec: int = 0
@dataclass @dataclass
class CoroutineDone(PyOtherSideEvent): class CoroutineDone(PyOtherSideEvent):

View File

@ -6,9 +6,9 @@ function onExitRequested(exitCode) {
} }
function onAlertRequested(msec) { function onAlertRequested() {
if (Qt.application.state != Qt.ApplicationActive) { if (Qt.application.state != Qt.ApplicationActive) {
window.alert(msec) window.alert(window.settings.alertOnMessageForMsec)
} }
} }