2021-01-15, 23:20
Currently working on a v19 version of my addon and I'm implementing several dialogs, background progress dialogs, and notification dialogs.
I've found in testing that if I have one function generate a notification and a follow on function generate another notification, that problems can occur.
For example:
If I call the first function and notification, then the second function and notification there can be a race condition where the first notification isn't fully closed/removed and the second notification wont appear.
Is there a way to determine if a dialog or notification is visible/open to avoid any race conditions? It doesn't appear that xbmcgui.getCurrentWindowId() works for dialog.notification.
Thanks in advance
I've found in testing that if I have one function generate a notification and a follow on function generate another notification, that problems can occur.
For example:
python:
def func1():
current_dialog = xbmcgui.Dialog()
current_dialog.notification('Test1','Test1',xbmcgui.NOTIFICATION_INFO,5000,sound=False)
... do stuff...
xbmc.executebuiltin('Dialog.Close(notification,true)')
xbmc.sleep(NOTIFICATION_DEINIT_TIME) #Close the notification and wait for de-init to ensure any follow on notification are correctly shown, unsure if there's a better way to do this
del current_dialog
def func2():
current_dialog = xbmcgui.Dialog()
current_dialog.notification('Test2,'Test2',xbmcgui.NOTIFICATION_INFO,5000,sound=False)
... do stuff...
xbmc.executebuiltin('Dialog.Close(notification,true)')
xbmc.sleep(NOTIFICATION_DEINIT_TIME) #Close the notification and wait for de-init to ensure any follow on notification are correctly shown, unsure if there's a better way to do this
del current_dialog
If I call the first function and notification, then the second function and notification there can be a race condition where the first notification isn't fully closed/removed and the second notification wont appear.
Is there a way to determine if a dialog or notification is visible/open to avoid any race conditions? It doesn't appear that xbmcgui.getCurrentWindowId() works for dialog.notification.
Thanks in advance