Kodi Community Forum
Auto close Ok Dialog - 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: Auto close Ok Dialog (/showthread.php?tid=204131)



Auto close Ok Dialog - schumi2004 - 2014-09-11

I searched the documentation and forum but couldn't find an answer.

I'm looking for a way to auto close a Ok dialog after a certain amount of time.
I found a old thread from Martijn were it's mentioned for yes/no dialog but couldn't find this for the Ok dialog.

Is such possible and if yes, how?


RE: Auto close Ok Dialog - Karnagious - 2014-09-11

If it isnt available for the Ok dialog, couldnt you use the yes/no dialog and disable/hide the other button?


RE: Auto close Ok Dialog - schumi2004 - 2014-09-12

Is that possible, to hide button ?


RE: Auto close Ok Dialog - Karnagious - 2014-09-13

I think so, but you would need to launch your own dialog using the skins yesno.xml
http://wiki.xbmc.org/index.php?title=List_of_Built_In_Controls#DialogYesNo.xml
http://mirrors.xbmc.org/docs/python-docs/14.x-helix/xbmcgui.html#WindowXMLDialog

The I think you would get the control (button) and make it setVisible(False).
http://mirrors.xbmc.org/docs/python-docs/14.x-helix/xbmcgui.html#ControlButton


RE: Auto close Ok Dialog - schumi2004 - 2014-09-14

(2014-09-13, 08:32)Karnagious Wrote: I think so, but you would need to launch your own dialog using the skins yesno.xml
http://wiki.xbmc.org/index.php?title=List_of_Built_In_Controls#DialogYesNo.xml
http://mirrors.xbmc.org/docs/python-docs/14.x-helix/xbmcgui.html#WindowXMLDialog

The I think you would get the control (button) and make it setVisible(False).
http://mirrors.xbmc.org/docs/python-docs/14.x-helix/xbmcgui.html#ControlButton
Isn't that for skins only?
In my case I would like to use it in addon.

Anyway, I think I'll go for a different approach.
Or alter code to add autoclose like done for Yes No dialog here https://github.com/xbmc/xbmc/pull/2616/files
Or just use the Yes No dialog.


RE: Auto close Ok Dialog - Martijn - 2014-09-14

imo the OK dialog is there for a reason. If you don't want the OK form the user, use a notification. Else the whole point of the OK is moot


RE: Auto close Ok Dialog - black_eagle - 2014-09-14

+1 for what Martijn said. Why would you want to auto-close an OK dialog ? Either you want a response from the user (OK) or you don't, in which case just use a notification, which requires no user intervention.


RE: Auto close Ok Dialog - schumi2004 - 2014-09-14

I'll try to explain. I have created a sleeptimer addon that checks for inactivity. When timer reaches zero a dialog should appear and ask the user to continue watching. If no confirmation is given the system shuts down. When using notifications the input from remote seems to trigger the mapped key for that window. That's not what i wanted, i just want the user to press any key to reset timer without triggerring any xbmc action.


RE: Auto close Ok Dialog - Martijn - 2014-09-14

then use the yes/no button
"Do you want to continue watching?
YES - NO (and with NO, shutdown. Which is also the action for autoclose)


RE: Auto close Ok Dialog - schumi2004 - 2014-09-14

(2014-09-14, 14:13)Martijn Wrote: then use the yes/no button
"Do you want to continue watching?
YES - NO (and with NO, shutdown. Which is also the action for autoclose)
That's my second idea. I thought that the NO button was not going to be used anyway and only Ok button would be sufficient.


RE: Auto close Ok Dialog - schumi2004 - 2014-09-15

I added a yesnog dialog now but can't seem to get the autoclose to function, it always returns a syntax error.

userchoice = dialog.yesno("Playback stops in 30 sec", "Do you want to continue watching?",,,,,5000)

Also struggling with replacing 30 with a variable.
Any hints/tips/examples?


RE: Auto close Ok Dialog - Karnagious - 2014-09-15

prompt = DIALOG.yesno("Playback stops in %s sec" % promptduration, "Do you want to continue watching?", yeslabel = "Hells yeah", nolabel = "Hells no", autoclose=int(promptduration * 1000))

This works in my addon.

You could also use this instead for the text:
"Playback stops in {} sec".format(promptduration)


RE: Auto close Ok Dialog - schumi2004 - 2014-09-18

@Karnagious
Thanks Wink