add Rescue in airplane mode

This commit is contained in:
cuu 2018-08-22 14:46:49 +08:00
parent 029e89737c
commit 33aa7f6154

View File

@ -77,7 +77,7 @@ class InfoPageListItem(object):
class AirplanePage(Page): class AirplanePage(Page):
_FootMsg = ["Nav.","","","Back","Toggle"] _FootMsg = ["Nav.","Rescue","","Back","Toggle"]
_MyList = [] _MyList = []
_ListFontObj = fonts["varela13"] _ListFontObj = fonts["varela13"]
@ -175,7 +175,7 @@ class AirplanePage(Page):
def ToggleModeAni(self): ## with animation def ToggleModeAni(self): ## with animation
out = commands.getstatusoutput('sudo rfkill list | grep yes | cut -d " " -f3') out = commands.getstatusoutput('sudo rfkill list | grep yes | cut -d " " -f3')
if out[1] == "yes": if "yes" in out[1]:
data = self.EasingData(0,43) data = self.EasingData(0,43)
for _,v in enumerate(data): for _,v in enumerate(data):
self._airwire_y -= v self._airwire_y -= v
@ -205,7 +205,7 @@ class AirplanePage(Page):
def ToggleMode(self): def ToggleMode(self):
out = commands.getstatusoutput('sudo rfkill list | grep yes | cut -d " " -f3') out = commands.getstatusoutput('sudo rfkill list | grep yes | cut -d " " -f3')
print out print out
if out[1] == "yes": if "yes" in out[1]:
self._Screen._MsgBox.SetText("Turning On") self._Screen._MsgBox.SetText("Turning On")
self._Screen._MsgBox.Draw() self._Screen._MsgBox.Draw()
commands.getstatusoutput("sudo rfkill unblock all") commands.getstatusoutput("sudo rfkill unblock all")
@ -216,7 +216,13 @@ class AirplanePage(Page):
self._Screen._MsgBox.Draw() self._Screen._MsgBox.Draw()
commands.getstatusoutput("sudo rfkill block all") commands.getstatusoutput("sudo rfkill block all")
self._Screen._TitleBar._InAirPlaneMode = True self._Screen._TitleBar._InAirPlaneMode = True
def UnBlockAll(self):
self._Screen._MsgBox.SetText("Turning On")
self._Screen._MsgBox.Draw()
commands.getstatusoutput("sudo rfkill unblock all")
self._Screen._TitleBar._InAirPlaneMode = False
def OnLoadCb(self): def OnLoadCb(self):
self._Scrolled = 0 self._Scrolled = 0
@ -265,7 +271,15 @@ class AirplanePage(Page):
self._Screen.Draw() self._Screen.Draw()
self._Screen.SwapAndShow() self._Screen.SwapAndShow()
""" """
if event.key == CurKeys["X"]:
self.UnBlockAll()
self._Screen.SwapAndShow()
pygame.time.delay(1000)
self._Screen.Draw()
self._Screen.SwapAndShow()
def Draw(self): def Draw(self):
self.ClearCanvas() self.ClearCanvas()