diff --git a/Menu/GameShell/10_Settings/Airplane/__init__.py b/Menu/GameShell/10_Settings/Airplane/__init__.py index 78bf10d..8a83987 100644 --- a/Menu/GameShell/10_Settings/Airplane/__init__.py +++ b/Menu/GameShell/10_Settings/Airplane/__init__.py @@ -18,6 +18,8 @@ from UI.keys_def import CurKeys from UI.scroller import ListScroller from UI.icon_pool import MyIconPool from UI.icon_item import IconItem +from UI.multi_icon_item import MultiIconItem + from UI.multilabel import MultiLabel class InfoPageListItem(object): @@ -88,6 +90,11 @@ class AirplanePage(Page): _DrawOnce = False _Scroller = None + + _EasingDur = 30 + + _airwire_y = 0 + _dialog_index = 0 def __init__(self): Page.__init__(self) @@ -109,8 +116,34 @@ class AirplanePage(Page): self._Width = self._Screen._Width ## equal to screen width self._Height = self._Screen._Height + + + airwire = IconItem() + airwire._ImgSurf = MyIconPool._Icons["airwire"] + airwire._MyType = ICON_TYPES["STAT"] + airwire._Parent = self + airwire.Adjust(0,0,5,43,0) + self._Icons["airwire"] = airwire + + GS = IconItem() + GS._ImgSurf = MyIconPool._Icons["GS"] + GS._MyType = ICON_TYPES["STAT"] + GS._Parent = self + GS.Adjust(0,0,72,95,0) + self._Icons["GS"] = GS + + DialogBoxs = MultiIconItem() + DialogBoxs._ImgSurf = MyIconPool._Icons["DialogBoxs"] + DialogBoxs._MyType = ICON_TYPES["STAT"] + DialogBoxs._Parent = self + DialogBoxs._IconWidth = 134 + DialogBoxs._IconHeight = 93 + DialogBoxs.Adjust(0,0,134,372,0) + self._Icons["DialogBoxs"] = DialogBoxs + + """ - bgpng = IconItem() + bgpng = MultiIconItem() bgpng._ImgSurf = MyIconPool._Icons["about_bg"] bgpng._MyType = ICON_TYPES["STAT"] bgpng._Parent = self @@ -140,6 +173,34 @@ class AirplanePage(Page): self._PosY += dis self._Scrolled += dis + def ToggleModeAni(self): ## with animation + out = commands.getstatusoutput('rfkill list | grep yes | cut -d " " -f3') + if out[1] == "yes": + data = self.EasingData(0,43) + for _,v in enumerate(data): + self._airwire_y -= v + self._dialog_index = 2 + pygame.time.delay(40) + + self._Screen.Draw() + self._Screen.SwapAndShow() + + commands.getstatusoutput("rfkill unblock all") + self._Screen._TitleBar._InAirPlaneMode = False + + else: + data = self.EasingData(0,43) + for _,v in enumerate(data): + self._airwire_y += v + self._dialog_index = 3 + pygame.time.delay(40) + self._Screen.Draw() + self._Screen.SwapAndShow() + + commands.getstatusoutput("rfkill block all") + self._Screen._TitleBar._InAirPlaneMode = True + + def ToggleMode(self): out = commands.getstatusoutput('rfkill list | grep yes | cut -d " " -f3') print out @@ -163,7 +224,11 @@ class AirplanePage(Page): out = commands.getstatusoutput('rfkill list | grep yes | cut -d " " -f3') if out[1] == "yes": self._Screen._TitleBar._InAirPlaneMode = True + self._airwire_y = 50+43 + self._dialog_index = 1 else: + self._airwire_y = 50 + self._dialog_index = 0 self._Screen._TitleBar._InAirPlaneMode = False @@ -179,6 +244,8 @@ class AirplanePage(Page): self._Screen.SwapAndShow() if event.key == CurKeys["B"]: + self.ToggleModeAni() + """ self.ToggleMode() self._Screen.SwapAndShow() @@ -186,7 +253,7 @@ class AirplanePage(Page): self._Screen.Draw() self._Screen.SwapAndShow() - + """ """ if event.key == CurKeys["Up"]: self.ScrollUp() @@ -200,12 +267,18 @@ class AirplanePage(Page): def Draw(self): self.ClearCanvas() + + self._Icons["DialogBoxs"].NewCoord(145,23) + self._Icons["airwire"].NewCoord(80,self._airwire_y) + + self._Icons["DialogBoxs"]._IconIndex = self._dialog_index + + self._Icons["DialogBoxs"].DrawTopLeft() + self._Icons["airwire"].Draw() + + self._Icons["GS"].NewCoord(98,118) + self._Icons["GS"].Draw() - if "bg" in self._Icons: - self._Icons["bg"].NewCoord(self._Width/2,self._Height/2 + (self._BGheight - Height)/2 + self._Screen._TitleBar._Height) - self._Icons["bg"].Draw() - - if self._HWND != None: self._HWND.fill((255,255,255)) diff --git a/skin/default/sys.py/gameshell/icons/DialogBox.png b/skin/default/sys.py/gameshell/icons/DialogBox.png new file mode 100644 index 0000000..eac3a7d Binary files /dev/null and b/skin/default/sys.py/gameshell/icons/DialogBox.png differ diff --git a/skin/default/sys.py/gameshell/icons/DialogBoxs.png b/skin/default/sys.py/gameshell/icons/DialogBoxs.png new file mode 100644 index 0000000..ccdfe84 Binary files /dev/null and b/skin/default/sys.py/gameshell/icons/DialogBoxs.png differ diff --git a/skin/default/sys.py/gameshell/icons/GS.png b/skin/default/sys.py/gameshell/icons/GS.png new file mode 100644 index 0000000..68b8aff Binary files /dev/null and b/skin/default/sys.py/gameshell/icons/GS.png differ diff --git a/skin/default/sys.py/gameshell/icons/airwire.png b/skin/default/sys.py/gameshell/icons/airwire.png new file mode 100644 index 0000000..625d004 Binary files /dev/null and b/skin/default/sys.py/gameshell/icons/airwire.png differ diff --git a/sys.py/UI/multi_icon_item.py b/sys.py/UI/multi_icon_item.py index 4690aca..58b2af1 100644 --- a/sys.py/UI/multi_icon_item.py +++ b/sys.py/UI/multi_icon_item.py @@ -23,6 +23,27 @@ class MultiIconItem(IconItem): self._ImgSurf = pygame.image.load( self._ImageName ).convert_alpha() + def DrawTopLeft(self): + if self._Align==ALIGN["VCenter"]: #default + if self._Label != None: + self._Label._PosX = self._PosX - self._Label._Width/2 + self._Parent._PosX + self._Label._PosY = self._PosY + self._Height/2 +6 + self._Parent._PosY + + elif self._Align ==ALIGN["HLeft"]: + if self._Label != None: + self._Label._PosX = self._PosX + self._Width/2 + 3 + self._Parent._PosX + self._Label._PosY = self._PosY - self._Label._Height/2 + self._Parent._PosY + + if self._Label!=None: + self._Label.Draw() + + + if self._ImgSurf != None: + self._Parent._CanvasHWND.blit(self._ImgSurf,pygame.Rect(self._PosX+self._Parent._PosX, + self._PosY+self._Parent._PosY, + self._Width,self._Height), + (0,self._IconIndex*self._IconHeight,self._IconWidth,self._IconHeight)) + def Draw(self): if self._Align==ALIGN["VCenter"]: #default if self._Label != None: @@ -36,9 +57,11 @@ class MultiIconItem(IconItem): if self._Label!=None: self._Label.Draw() - + + if self._ImgSurf != None: self._Parent._CanvasHWND.blit(self._ImgSurf,midRect(self._PosX+self._Parent._PosX, self._PosY+self._Parent._PosY, self._Width,self._Height,Width,Height), (0,self._IconIndex*self._IconHeight,self._IconWidth,self._IconHeight)) +