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,7 +107,8 @@ class UISettings(JSONConfigFile):
async def default_data(self) -> JsonData:
return {
"theme": "Default.qpl",
"alertOnMessageForMsec": 4000,
"theme": "Default.qpl",
"writeAliases": {},
"keys": {
"reloadConfig": ["Alt+R"],

View File

@ -37,15 +37,10 @@ class ExitRequested(PyOtherSideEvent):
@dataclass
class AlertRequested(PyOtherSideEvent):
"""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,
or flashes the taskbar icon on Windows.
"""
msec: int = 0
@dataclass
class CoroutineDone(PyOtherSideEvent):

View File

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