Пример #1
0
class NotFoundPage(Page):
    _FootMsg = ["Nav", "", "", "Back", ""]
    _BG = "pico8_notfound"
    _Leader = None
    _Padding = pygame.Rect(0, 12, 0, 6)

    def Init(self):
        self._PosX = self._Index * self._Screen._Width
        self._Width = self._Screen._Width
        self._Height = self._Screen._Height

        self._CanvasHWND = self._Screen._CanvasHWND

        self._BGpng = IconItem()
        self._BGpng._ImgSurf = MyIconPool.GiveIconSurface(self._BG)
        self._BGpng._MyType = ICON_TYPES["STAT"]
        self._BGpng._Parent = self
        #print( MyIconPool.Width(self._BG),MyIconPool.Height(self._BG) )
        self._BGpng.Adjust(0, 0, MyIconPool.Width(self._BG),
                           MyIconPool.Height(self._BG), 0)

        self._Board = Textbulletinboard()

        self._Board._PosX = 4
        self._Board._PosY = 100
        self._Board._Width = self._Width - 4 * 2
        self._Board._Height = 200
        self._Board._CanvasHWND = self._CanvasHWND
        self._Board._Align = "Center"
        self._Board._RowPitch = 28
        self._Board.Init()

        if self._Leader != None and self._Leader._ComPkgInfo != None:
            if "NotFoundMsg" in self._Leader._ComPkgInfo:
                d = []
                for i, v in enumerate(self._Leader._ComPkgInfo["NotFoundMsg"]):
                    Color = None
                    Font = None
                    Bold = False
                    Und = False
                    Txt = ""
                    parts = v.split("|")
                    if len(parts) > 0:
                        Txt = parts[0]

                    if len(parts) == 2:
                        if parts[1] != "None":
                            Color = MySkinManager.GiveColor(parts[1])
                    elif len(parts) == 3:
                        if parts[1] != "None":
                            Color = MySkinManager.GiveColor(parts[1])
                        if parts[2] != "None":
                            Font = MyLangManager.TrFont(parts[2])
                    elif len(parts) == 4:
                        if parts[1] != "None":
                            Color = MySkinManager.GiveColor(parts[1])
                        if parts[2] != "None":
                            Font = MyLangManager.TrFont(parts[2])
                        if parts[3] == "True":
                            Bold = True
                    elif len(parts) == 5:
                        if parts[1] != "None":
                            Color = MySkinManager.GiveColor(parts[1])
                        if parts[2] != "None":
                            Font = MyLangManager.TrFont(parts[2])
                        if parts[3] == "True":
                            Bold = True
                        if parts[4] == "True":
                            Und = True

                    a = Text(Txt, Color, Font, Bold, Und)
                    d = d + a.Words()

                self._Board.SetAndBlitText(d)

    def KeyDown(self, event):
        if event.key == CurKeys["A"] or event.key == CurKeys["Menu"]:
            self.ReturnToUpLevelPage()
            self._Screen.Draw()
            self._Screen.SwapAndShow()
            return

    def Draw(self):
        self.ClearCanvas()
        if self._BGpng != None:
            self._BGpng.NewCoord((self._Width - self._BGpng._Width) / 2,
                                 self._Padding.y)
            self._BGpng.DrawTopLeft()
            self._Board._PosY = self._BGpng._Height + self._Padding.y + self._Padding.h
        else:
            self._Board._PosY = self._Padding.y

        self._Board.Draw()
Пример #2
0
class HashErrPage(Page):
    _FootMsg = ["Nav", "", "", "Cancel", "Continue"]
    _BG = "pico8_md5_err"

    _Leader = None
    _Padding = pygame.Rect(0, 12, 0, 6)

    def Init(self):
        self._PosX = self._Index * self._Screen._Width
        self._Width = self._Screen._Width
        self._Height = self._Screen._Height

        self._CanvasHWND = self._Screen._CanvasHWND

        self._BGpng = IconItem()
        self._BGpng._ImgSurf = MyIconPool.GiveIconSurface(self._BG)
        self._BGpng._MyType = ICON_TYPES["STAT"]
        self._BGpng._Parent = self
        self._BGpng.Adjust(0, 0, MyIconPool.Width(self._BG),
                           MyIconPool.Height(self._BG), 0)

        self._Board = Textbulletinboard()

        self._Board._PosX = 4
        self._Board._PosY = self._Height / 2 - 30
        self._Board._Width = self._Width - 4 * 2
        self._Board._Height = 100
        self._Board._CanvasHWND = self._CanvasHWND
        self._Board._RowPitch = 28
        self._Board._Align = "Center"
        self._Board.Init()

        if self._Leader != None and self._Leader._ComPkgInfo != None:
            if "HashErrMsg" in self._Leader._ComPkgInfo:
                d = []
                for i, v in enumerate(self._Leader._ComPkgInfo["HashErrMsg"]):
                    Color = None
                    Font = None
                    Bold = False
                    Und = False
                    Txt = ""
                    parts = v.split("|")
                    if len(parts) > 0:
                        Txt = parts[0]

                    if len(parts) == 2:
                        if parts[1] != "None":
                            Color = MySkinManager.GiveColor(parts[1])
                    elif len(parts) == 3:
                        if parts[1] != "None":
                            Color = MySkinManager.GiveColor(parts[1])
                        if parts[2] != "None":
                            Font = MyLangManager.TrFont(parts[2])
                    elif len(parts) == 4:
                        if parts[1] != "None":
                            Color = MySkinManager.GiveColor(parts[1])
                        if parts[2] != "None":
                            Font = MyLangManager.TrFont(parts[2])
                        if parts[3] == "True":
                            Bold = True
                    elif len(parts) == 5:
                        if parts[1] != "None":
                            Color = MySkinManager.GiveColor(parts[1])
                        if parts[2] != "None":
                            Font = MyLangManager.TrFont(parts[2])
                        if parts[3] == "True":
                            Bold = True
                        if parts[4] == "True":
                            Und = True

                    a = Text(Txt, Color, Font, Bold, Und)
                    d = d + a.Words()

                self._Board.SetAndBlitText(d)

            else:
                a = Text("MD5 check Failed!\n", None,
                         MyLangManager.TrFont("varela16"))
                b = Text("Do you want to continue?", None,
                         MyLangManager.TrFont("varela16"))
                self._Board.SetAndBlitText(a.Words() + b.Words())

    def KeyDown(self, event):
        if IsKeyMenuOrB(event.key):
            self.ReturnToUpLevelPage()
            self._Screen.Draw()
            self._Screen.SwapAndShow()
            return

        if IsKeyStartOrA(event.key):
            self._Leader.InstallPackage(self._Screen)
            return

    def OnLoadCb(self):
        pass

    def Draw(self):
        self.ClearCanvas()
        if self._BGpng != None:
            self._BGpng.NewCoord((self._Width - self._BGpng._Width) / 2,
                                 self._Padding.y)
            self._BGpng.DrawTopLeft()
            self._Board._PosY = self._BGpng._Height + self._Padding.y + self._Padding.h
        else:
            self._Board._PosY = self._Padding.y

        self._Board.Draw()