diff --git a/Menu/GameShell/10_Settings/Airplane/__init__.py b/Menu/GameShell/10_Settings/Airplane/__init__.py index 5a04717..78bf10d 100644 --- a/Menu/GameShell/10_Settings/Airplane/__init__.py +++ b/Menu/GameShell/10_Settings/Airplane/__init__.py @@ -88,8 +88,6 @@ class AirplanePage(Page): _DrawOnce = False _Scroller = None - - _InAirPlaneMode = False def __init__(self): Page.__init__(self) @@ -143,22 +141,20 @@ class AirplanePage(Page): self._Scrolled += dis def ToggleMode(self): - print("ToggleMode") out = commands.getstatusoutput('rfkill list | grep yes | cut -d " " -f3') print out if out[1] == "yes": - self._InAirPlaneMode = True - self._Screen._MsgBox.SetText("Turning On") self._Screen._MsgBox.Draw() commands.getstatusoutput("rfkill unblock all") + self._Screen._TitleBar._InAirPlaneMode = False else: - self._InAirPlaneMode = False self._Screen._MsgBox.SetText("Turning Off") self._Screen._MsgBox.Draw() commands.getstatusoutput("rfkill block all") - + self._Screen._TitleBar._InAirPlaneMode = True + def OnLoadCb(self): self._Scrolled = 0 @@ -166,9 +162,9 @@ class AirplanePage(Page): self._DrawOnce = False out = commands.getstatusoutput('rfkill list | grep yes | cut -d " " -f3') if out[1] == "yes": - self._InAirPlaneMode = True + self._Screen._TitleBar._InAirPlaneMode = True else: - self._InAirPlaneMode = False + self._Screen._TitleBar._InAirPlaneMode = False def OnReturnBackCb(self): diff --git a/sys.py/UI/main_screen.py b/sys.py/UI/main_screen.py index 8dcbe01..6def24e 100644 --- a/sys.py/UI/main_screen.py +++ b/sys.py/UI/main_screen.py @@ -136,6 +136,7 @@ class MainScreen(object): _IconFont = fonts["varela15"] _SkinManager = None + def __init__(self): self._Pages = [] self._MyPageStack = PageStack() diff --git a/sys.py/UI/title_bar.py b/sys.py/UI/title_bar.py index eda0378..ae70624 100644 --- a/sys.py/UI/title_bar.py +++ b/sys.py/UI/title_bar.py @@ -3,6 +3,7 @@ import pygame import os import sys +import commands from datetime import datetime @@ -46,6 +47,7 @@ class TitleBar: _SkinManager = None + _InAirPlaneMode = False def __init__(self): self._Icons = {} @@ -237,7 +239,13 @@ class TitleBar: if is_wifi_connected_now(): print("wifi is connected") print( wifi_strength()) - + else: + out = commands.getstatusoutput('rfkill list | grep yes | cut -d " " -f3') + if out[1] == "yes": + self._InAirPlaneMode = True + else: + self._InAirPlaneMode = False + def ClearCanvas(self): self._CanvasHWND.fill( self._SkinManager.GiveColor("TitleBg") ) @@ -293,7 +301,11 @@ class TitleBar: self._Icons["wifistatus"].Draw() print("strength error") else: - self._Icons["wifistatus"]._IconIndex = 0 + if self._InAirPlaneMode == False: + self._Icons["wifistatus"]._IconIndex = 0 + else: + self._Icons["wifistatus"]._IconIndex = 5 ## airplane mode icon + self._Icons["wifistatus"].NewCoord(start_x+self._icon_width+5,self._icon_height/2+(self._BarHeight-self._icon_height)/2) self._Icons["wifistatus"].Draw()