From 5d3ec61a68879427c2e01f1f5bb67b637506bc3a Mon Sep 17 00:00:00 2001 From: hi80482 <66435094+hi80482@users.noreply.github.com> Date: Sat, 4 Jul 2020 01:47:40 +0800 Subject: [PATCH] show sleep option in kernel 5.7 only --- Menu/GameShell/99_PowerOFF/__init__.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/Menu/GameShell/99_PowerOFF/__init__.py b/Menu/GameShell/99_PowerOFF/__init__.py index 925b701..9fa6a04 100644 --- a/Menu/GameShell/99_PowerOFF/__init__.py +++ b/Menu/GameShell/99_PowerOFF/__init__.py @@ -14,7 +14,16 @@ import config class PowerOffConfirmPage(ConfirmPage): _ConfirmText = MyLangManager.Tr("Awaiting Input") - _FootMsg = ["Nav","Suspend","Reboot","Cancel","Shutdown"] + #_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: @@ -68,10 +77,11 @@ class PowerOffConfirmPage(ConfirmPage): pygame.event.post( pygame.event.Event(RUNSYS, message=cmdpath)) if event.key == CurKeys["Y"]: - 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)) + 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):