From 1a2547e55d7cc0a8b1bde3ba19c613fe58cd5bfb Mon Sep 17 00:00:00 2001 From: hi80482 <66435094+hi80482@users.noreply.github.com> Date: Wed, 9 Sep 2020 04:56:54 +0800 Subject: [PATCH] Update __init__.py --- .../10_Settings/PowerOFF/__init__.py | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/Menu/GameShell/10_Settings/PowerOFF/__init__.py b/Menu/GameShell/10_Settings/PowerOFF/__init__.py index d55fdbd..2ef02e4 100644 --- a/Menu/GameShell/10_Settings/PowerOFF/__init__.py +++ b/Menu/GameShell/10_Settings/PowerOFF/__init__.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- import pygame +import subprocess #UI lib from UI.constants import RUNSYS @@ -13,8 +14,18 @@ import config class PowerOffConfirmPage(ConfirmPage): - _ConfirmText = MyLangManager.Tr("Confirm Power OFF?") + _ConfirmText = MyLangManager.Tr("Awaiting Input") + #_FootMsg = ["Nav","Suspend","Reboot","Cancel","Shutdown"] + _FootMsg = ["Nav","","Reboot","Cancel","Shutdown"] + # uname -r + st = subprocess.check_output(["uname","-r"]) + st = st.strip("\n") + st = st.strip("\t") + + if "5.7" in st: + _FootMsg[1] = "Sleep" + def CheckBattery(self): try: f = open(config.Battery) @@ -43,7 +54,6 @@ class PowerOffConfirmPage(ConfirmPage): def KeyDown(self,event): if IsKeyMenuOrB(event.key): - self.ReturnToUpLevelPage() self._Screen.Draw() self._Screen.SwapAndShow() @@ -60,8 +70,19 @@ class PowerOffConfirmPage(ConfirmPage): cmdpath += "sudo halt -p" pygame.event.post( pygame.event.Event(RUNSYS, message=cmdpath)) + + if event.key == CurKeys["X"]: + cmdpath = "feh --bg-center %s;" % MySkinManager.GiveWallpaper("seeyou.png") + cmdpath += "sleep 3;" + cmdpath += "sudo reboot" + pygame.event.post( pygame.event.Event(RUNSYS, message=cmdpath)) - + if event.key == CurKeys["Y"]: + if self._FootMsg[1] != "": + cmdpath = "feh --bg-center %s;" % MySkinManager.GiveWallpaper("seeyou.png") + cmdpath += "sleep 3;" + cmdpath += "sudo pm-suspend" + pygame.event.post( pygame.event.Event(RUNSYS, message=cmdpath)) class APIOBJ(object): @@ -87,4 +108,3 @@ def Init(main_screen): OBJ.Init(main_screen) def API(main_screen): OBJ.API(main_screen) -