Help needed: Yes/No dialog with timer for default action
#1
I'm writing a script that will suspend XBMC and set an ACPI wakeup alarm based on the next scheduled MythTV recording.

The script currently uses a pop-up to ask the user if they want the system to shutdown.

However, there may be scenarios where it's appropriate to shutdown but the user is not there. So I'd like to be able to shutdown if the user doesn't respon in, say, 10 seconds.

Is that possible? Huh

The code for the box is:
Code:
def showDialog(title, body):
    dialog = xbmcgui.Dialog()
    if dialog.yesno(title, body):
        doSuspend()
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply
#2
Ok, I think I've managed a work around on this.

I can use a DialogProgress with a countdown time and listen out for the user pressing cancel. This should work if the script runs automatically i.e. via a cron job, and so will suspend with no input required from the user.

I'll try to set it so that the script looks for an argument passed by the cron job (not sure if this is possible with xbmc-send or not...)

If the user runs the script manually then I'll just ask yes/no "do you want to shut down?".

Should have this available by the weekend.
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply

Logout Mark Read Team Forum Stats Members Help
Help needed: Yes/No dialog with timer for default action0