mirror of
https://github.com/clockworkpi/launcher.git
synced 2025-12-12 09:48:50 +01:00
Merge pull request #245 from cuu/master
make a confirmation when switch to launchergo
This commit is contained in:
commit
954f158f73
@ -7,9 +7,29 @@ import pygame
|
||||
from libs.roundrects import aa_round_rect
|
||||
|
||||
## local UI import
|
||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||
from UI.util_funcs import ArmSystem
|
||||
from UI.lang_manager import MyLangManager
|
||||
from UI.confirm_page import ConfirmPage
|
||||
|
||||
class SwitchToLauncherGoConfirmPage(ConfirmPage):
|
||||
|
||||
def KeyDown(self,event):
|
||||
|
||||
if IsKeyMenuOrB(event.key):
|
||||
self.ReturnToUpLevelPage()
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
if IsKeyStartOrA(event.key):
|
||||
self._Screen._MsgBox.SetText("Rebooting to LauncherGo")
|
||||
self._Screen._MsgBox.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
pygame.time.delay(300)
|
||||
ArmSystem("sed -i s/launcher/launchergo/g ~/.bashrc" )
|
||||
ArmSystem("sudo reboot")
|
||||
|
||||
|
||||
class APIOBJ(object):
|
||||
|
||||
_Page = None
|
||||
@ -17,15 +37,16 @@ class APIOBJ(object):
|
||||
def __init__(self):
|
||||
pass
|
||||
def Init(self,main_screen):
|
||||
pass
|
||||
self._Page = SwitchToLauncherGoConfirmPage()
|
||||
self._Page._Screen = main_screen
|
||||
self._Page._Name ="Switch To LauncherGo"
|
||||
self._Page.Init()
|
||||
|
||||
def API(self,main_screen):
|
||||
if main_screen !=None:
|
||||
main_screen._MsgBox.SetText("Rebooting to LauncherGo")
|
||||
main_screen._MsgBox.Draw()
|
||||
main_screen.SwapAndShow()
|
||||
pygame.time.delay(300)
|
||||
ArmSystem("sed -i s/launcher/launchergo/g ~/.bashrc" )
|
||||
ArmSystem("sudo reboot")
|
||||
main_screen.PushPage(self._Page)
|
||||
main_screen.Draw()
|
||||
main_screen.SwapAndShow()
|
||||
|
||||
OBJ = APIOBJ()
|
||||
def Init(main_screen):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user