Auto close Ok Dialog
#1
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?
Reply
#2
If it isnt available for the Ok dialog, couldnt you use the yes/no dialog and disable/hide the other button?
Reply
#3
Is that possible, to hide button ?
Reply
#4
I think so, but you would need to launch your own dialog using the skins yesno.xml
http://wiki.xbmc.org/index.php?title=Lis...gYesNo.xml
http://mirrors.xbmc.org/docs/python-docs...wXMLDialog

The I think you would get the control (button) and make it setVisible(False).
http://mirrors.xbmc.org/docs/python-docs...trolButton
Reply
#5
(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=Lis...gYesNo.xml
http://mirrors.xbmc.org/docs/python-docs...wXMLDialog

The I think you would get the control (button) and make it setVisible(False).
http://mirrors.xbmc.org/docs/python-docs...trolButton
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.
Reply
#6
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
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply
#7
+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.
Learning Linux the hard way !!
Reply
#8
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.
Reply
#9
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)
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply
#10
(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.
Reply
#11
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?
Reply
#12
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)
Reply
#13
@Karnagious
Thanks Wink
Reply

Logout Mark Read Team Forum Stats Members Help
Auto close Ok Dialog0