Kodi Community Forum
close busydialog on ESC - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+--- Thread: close busydialog on ESC (/showthread.php?tid=176214)



close busydialog on ESC - slinuxgeek - 2013-10-21

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.


RE: close busydialog on ESC - slinuxgeek - 2013-10-22

How can we do this in python addon/script?


RE: close busydialog on ESC - Roman_V_M - 2013-10-22

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.


RE: close busydialog on ESC - slinuxgeek - 2013-10-22

Thanks for answer, Roman