Kodi Community Forum

Full Version: close busydialog on ESC
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I want to display busy dialog then do some thing when finished then close the busy dialog.
I do it like this:
PHP Code:
xbmc.executebuiltin('ActivateWindow(busydialog)')
#Do something....
xbmc.executebuiltin('Dialog.Close(busydialog,true)'

That is working but what I want now is that if user presses ESC on busy dialog and I am still doing my stuffs then end the work and animation both.
As it happens normally in xbmc and in any gui application.
How can I do that?

Thanks for help in advance.
How can we do this in python addon/script?
If the progress of your
PHP Code:
#Do something.... 
can be measured in a numeric value, then you can use DialogProgress instead. It has a method to determine if it has been closed by a user.
Otherwise, I think, you need to create a Window/WindowDialog instance, then run your
PHP Code:
xbmc.executebuiltin('ActivateWindow(busydialog)')
#Do something....
xbmc.executebuiltin('Dialog.Close(busydialog,true)'
in a separate thread. And the Window/WindowDialog instance needs to signal somehow to your "Do something" thread if ESC has been pressed.
Thanks for answer, Roman