Jump to content


Photo

Dialog.yesno


  • Please log in to reply
1 reply to this topic

#1 tjoakim

tjoakim

    X-S Enthusiast

  • Members
  • 6 posts

Posted 21 May 2008 - 09:25 PM

Hello
I don't know how to program Python but I have managed to get a working script (only tested with XBMC_PC) by copy & paste from other scripts. rolleyes.gif

CODE
from telnetlib import Telnet
import xbmcgui

tn = Telnet("192.168.1.210", 3210)

tn.write("action poweroff\n")
tn.write("doit\n")

dialog=xbmcgui.Dialog()
dialog.ok("Poweroff","The server is shutting down...")


But I would like to get a question if I want to power off server.
I read here: http://xbmc.org/wiki/?title=ALEX's_Tutorial#dialog_box
But I don't understand how to do it... sad.gif

I'm sorry for my english but I hpoe someone understand what I mean and can help me.
Thanks

#2 tjoakim

tjoakim

    X-S Enthusiast

  • Members
  • 6 posts

Posted 25 May 2008 - 01:08 PM

I finally got it working the way I want... and now I understand "indented block" tongue.gif
Here is the code if someone else (newbie like me) might want it.
CODE
from telnetlib import Telnet
import xbmcgui

if xbmcgui.Dialog().yesno('Power OFF Server','Are You Really Sure?'):

  tn = Telnet("192.168.1.210", 3210)

  tn.write("action poweroff\n")
  tn.write("doit\n")

  dialog=xbmcgui.Dialog()
  dialog.ok("Power OFF Server","The server is shutting down...")


You'll need PowerOff 3.0.1.3 on the server. Just google it...
Thanks




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users