Added support for shutdown
This commit is contained in:
parent
2bcbbaafd2
commit
ed0d28ab1c
3 changed files with 5 additions and 2 deletions
|
@ -27,7 +27,7 @@ class WallabyControl(Routing.ServerRoute):
|
|||
for wallaby in handler.broadcast.channels[Handler.Channels.WALLABY]:
|
||||
address_pair = "%s:%d" % (wallaby.address, wallaby.port)
|
||||
if address_pair in data.keys():
|
||||
if data[address_pair] in ("stop", "restart", "disconnect", "reboot"):
|
||||
if data[address_pair] in ("stop", "restart", "disconnect", "reboot", "shutdown"):
|
||||
wallaby.send(data[address_pair], "wallaby_control")
|
||||
elif type(data[address_pair]) is dict:
|
||||
if "run" in data[address_pair]:
|
||||
|
|
|
@ -104,7 +104,7 @@ class Fl0w:
|
|||
|
||||
def wallaby_control_submenu(self, wallaby):
|
||||
menu = Menu(subtitles=False)
|
||||
for command in ("Stop", "Restart", "Reboot", "Disconnect"):
|
||||
for command in ("Stop", "Restart", "Shutdown", "Reboot", "Disconnect"):
|
||||
menu.add(Entry(command, action=self.sock.send, kwargs={"data" : {wallaby : command.lower()}, "route" : "wallaby_control"}))
|
||||
menu.invoke(self.window)
|
||||
|
||||
|
|
|
@ -26,6 +26,9 @@ class WallabyControl(Routing.ClientRoute):
|
|||
os.system("reboot")
|
||||
exit(0)
|
||||
|
||||
def shutdown(self, handler):
|
||||
os.system("shutdown -h 0")
|
||||
|
||||
def disconnect(self, handler):
|
||||
handler.sock.close()
|
||||
|
||||
|
|
Reference in a new issue