示例#1
0
    def UpdateNavText(self, texts):
        self._State = "tips"
        texts = MyLangManager.Tr(texts)
        my_text = self._LabelFont.render(texts, True,
                                         self._SkinManager.GiveColor("Text"))
        """
        _w = 0
        for i, x in enumerate(("b","a","y","x")):
            if self._Icons[x]._Label._Text!="":
                if i==0:
                    _w += self._Icons[x].TotalWidth()
                else:
                    _w += self._Icons[x].TotalWidth()+5
        """
        left_width = self._Width - 18

        final_piece = ""
        for i, v in enumerate(texts):
            text_slice = texts[:i + 1]
            my_text = self._LabelFont.render(
                text_slice, True, self._SkinManager.GiveColor("Text"))
            final_piece = text_slice
            if my_text.get_width() >= left_width:
                break

        print("finalpiece %s" % final_piece)
        self._Icons["nav"]._Label.SetText(final_piece)

        self.Draw()
示例#2
0
    def SetLabelTexts(self,texts):
        barr = ["nav","y","x","b","a","select"]
        texts2 = texts + [""] if len(texts) == 5 else texts

        for idx,x in enumerate(barr):
            try:
                self._Icons[x]._Label.SetText(MyLangManager.Tr(texts2[idx]))
            except IndexError:
                print("Index "+x+" doesn't exist!")
    def Draw(self,title):
        self.ClearCanvas()
        title = MyLangManager.Tr(title)
        self._Title = title
        
        cur_time =  datetime.now().strftime("%H:%M")
        time_text_font = MySkinManager.GiveFont("varela12")
        time_text_size = time_text_font.size(cur_time)
        title_text_size = MyLangManager.TrFont("varela16").size(title)

        self._CanvasHWND.blit(MyLangManager.TrFont("varela16").render(title,True,self._SkinManager.GiveColor("Text")),midRect(title_text_size[0]/2+self._LOffset,
                                                                    title_text_size[1]/2+(self._BarHeight-title_text_size[1])/2,
                                                                    title_text_size[0],title_text_size[1],Width,Height))
        self._CanvasHWND.blit( time_text_font.render(cur_time,True,self._SkinManager.GiveColor("Text")),midRect(Width-time_text_size[0]/2-self._ROffset,
                                                                        time_text_size[1]/2+(self._BarHeight-time_text_size[1])/2,
                                                                        time_text_size[0],time_text_size[1],Width,Height))

        start_x = Width-time_text_size[0]-self._ROffset-self._icon_width*3 # near by the time_text
        
        self._Icons["bluetooth"].NewCoord(start_x - self._icon_width,self._icon_height/2+(self._BarHeight-self._icon_height)/2)
        
        self._Icons["sound"].NewCoord(start_x, self._icon_height/2+(self._BarHeight-self._icon_height)/2)
        
        #self._Icons["wifi"].NewCoord(start_x+self._icon_width+5,    self._icon_height/2+(self._BarHeight-self._icon_height)/2)
        
        self._Icons["battery"].NewCoord(start_x+self._icon_width+self._icon_width+8,self._icon_height/2+(self._BarHeight-self._icon_height)/2)

        
        if is_wifi_connected_now():
            ge = self.GetWifiStrength(wifi_strength())
            if ge > 0:
                self._Icons["wifistatus"]._IconIndex = ge
                self._Icons["wifistatus"].NewCoord(start_x+self._icon_width+5,self._icon_height/2+(self._BarHeight-self._icon_height)/2)
                self._Icons["wifistatus"].Draw()
            else:
                self._Icons["wifistatus"]._IconIndex = 0
                self._Icons["wifistatus"].Draw()
                print("wifi strength error")
        else:
            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()
        
        self._Icons["sound"].Draw()
        
        self._Icons["battery"].Draw()
        
        self._Icons["bluetooth"].Draw()
        
        pygame.draw.line(self._CanvasHWND,self._SkinManager.GiveColor("Line"),(0,self._BarHeight),(self._Width,self._BarHeight),self._BorderWidth)

        if self._HWND != None:
            self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width,self._Height))
示例#4
0
    def SetLabelTexts(self, texts):

        barr = ["nav", "x", "y", "a", "b"]
        if self.GetButtonsLayoutMode() == "snes":
            barr = ["nav", "y", "x", "b", "a"]

        for idx, x in enumerate(barr):
            try:
                self._Icons[x]._Label.SetText(MyLangManager.Tr(texts[idx]))
            except IndexError:
                print("Index " + x + " doesn't exist!")
class DeleteConfirmPage(ConfirmPage):

    _FileName = ""
    _TrashDir = ""
    _ConfirmText = MyLangManager.Tr("ConfirmDeleteQ")

    def SetTrashDir(self, d):
        self._TrashDir = d

        if os.path.isdir(self._TrashDir) == False:
            raise IOError("Trash not existed")

    def SetFileName(self, fn):
        self._FileName = fn

    def KeyDown(self, event):

        if event.key == CurKeys["Menu"] or event.key == CurKeys["A"]:

            self.ReturnToUpLevelPage()
            self._Screen.Draw()
            self._Screen.SwapAndShow()

        if event.key == CurKeys["B"]:
            try:
                os.remove(self._TrashDir + "/" +
                          os.path.basename(self._FileName))
            except:
                pass

            try:
                shutil.move(self._FileName, self._TrashDir)
            except shutil.Error as e:
                if "already exists" in str(e):
                    self._Screen._MsgBox.SetText("AlreadyExisted")
                else:
                    self._Screen._MsgBox.SetText("Error")

                self._Screen._MsgBox.Draw()
                self._Screen.SwapAndShow()
            else:
                self.SnapMsg(MyLangManager.Tr("Deleting"))
                self._Screen.Draw()
                self._Screen.SwapAndShow()
                self.Reset()

                pygame.time.delay(300)
                self.ReturnToUpLevelPage()
                self._Screen.Draw()
                self._Screen.SwapAndShow()

            print(self._FileName)
    def KeyDown(self, event):

        if event.key == CurKeys["Menu"] or event.key == CurKeys["A"]:

            self.ReturnToUpLevelPage()
            self._Screen.Draw()
            self._Screen.SwapAndShow()

        if event.key == CurKeys["B"]:
            try:
                os.remove(self._TrashDir + "/" +
                          os.path.basename(self._FileName))
            except:
                pass

            try:
                shutil.move(self._FileName, self._TrashDir)
            except shutil.Error as e:
                if "already exists" in str(e):
                    self._Screen._MsgBox.SetText("AlreadyExisted")
                else:
                    self._Screen._MsgBox.SetText("Error")

                self._Screen._MsgBox.Draw()
                self._Screen.SwapAndShow()
            else:
                self.SnapMsg(MyLangManager.Tr("Deleting"))
                self._Screen.Draw()
                self._Screen.SwapAndShow()
                self.Reset()

                pygame.time.delay(300)
                self.ReturnToUpLevelPage()
                self._Screen.Draw()
                self._Screen.SwapAndShow()

            print(self._FileName)
示例#7
0
 def ResetNavText(self):
     self._Icons["nav"]._Label.SetText(MyLangManager.Tr("Nav"))
     self._State = "normal"
     self.Draw()
     return False
示例#8
0
 def DrawRun(self):
     self._MsgBox.SetText(MyLangManager.Tr("Launching"))
     self._MsgBox.Draw()
示例#9
0
 def SetText(self, text):
     self._Text = MyLangManager.Tr(text)
示例#10
0
    def ReadTheDirIntoPages(self, _dir, pglevel, cur_page):
        global commercialsoftware_flag

        if FileExists(_dir) == False and os.path.isdir(_dir) == False:
            return

        files = os.listdir(_dir)
        for i in sorted(files):
            if os.path.isdir(_dir + "/" + i) and i.startswith(
                    ".") == False:  # TOPLEVEL only is dir
                if pglevel == 0:
                    page = Page()
                    page._Name = self.ExtraName(i)
                    page._Icons = []
                    self._Pages.append(page)
                    self.ReadTheDirIntoPages(_dir + "/" + i, pglevel + 1,
                                             self._Pages[len(self._Pages) - 1])
                else:  ## On CurPage now
                    i2 = self.ExtraName(i)
                    iconitem = IconItem()
                    iconitem._FileName = i
                    iconitem._CmdPath = ""
                    iconitem.AddLabel(MyLangManager.Tr(i2), self._IconFont)
                    if FileExists(_dir + "/" + i + "/" + i2 +
                                  ".png"):  ### 20_Prog/Prog.png , cut 20_
                        iconitem._ImageName = _dir + "/" + i + "/" + i2 + ".png"
                    elif FileExists(
                            MySkinManager.GiveIcon(_dir + "/" + i2 + ".png")):
                        iconitem._ImageName = MySkinManager.GiveIcon(_dir +
                                                                     "/" + i2 +
                                                                     ".png")
                    else:
                        untitled = UntitledIcon()
                        untitled.Init()
                        if len(i2) > 1:
                            untitled.SetWords(i2[:2])
                        elif len(i2) == 1:
                            untitled.SetWords([i2[0], i2[0]])
                        else:
                            untitled.SetWords(["G", "s"])

                        iconitem._ImgSurf = untitled.Surface()
                        iconitem._ImageName = ""

                    if self.IsPythonPackage(_dir + "/" + i):
                        iconitem._MyType = ICON_TYPES["FUNC"]
                        sys.path.append(_dir)
                        iconitem._CmdPath = __import__(i)
                        init_cb = getattr(iconitem._CmdPath, "Init", None)
                        if init_cb != None:
                            if callable(init_cb):
                                iconitem._CmdPath.Init(self)
                                cur_page._Icons.append(iconitem)

                    elif self.IsEmulatorPackage(_dir + "/" + i):
                        obj = {}
                        obj["ROM"] = ""
                        obj["ROM_SO"] = ""
                        obj["EXT"] = []
                        obj["EXCLUDE"] = []
                        obj["FILETYPE"] = "file"
                        obj["LAUNCHER"] = ""
                        obj["TITLE"] = "Game"
                        obj["SO_URL"] = ""
                        obj["RETRO_CONFIG"] = ""  ##
                        try:
                            f = open(_dir + "/" + i + "/" + emulator_flag)
                        except IOError:
                            print("action config open failed")
                            return
                        else:
                            with f:
                                content = f.readlines()
                                content = [x.strip() for x in content]
                        for c in content:
                            pis = c.split("=")
                            if len(pis) > 1:
                                if "EXT" in pis[0]:
                                    obj[pis[0]] = pis[1].split(",")
                                elif "EXCLUDE" in pis[0]:
                                    obj[pis[0]] = pis[1].split(",")
                                else:
                                    obj[pis[0]] = pis[1]

                        if FileExists(_dir + "/" + i + "/retroarch-local.cfg"):
                            obj["RETRO_CONFIG"] = CmdClean(
                                os.path.abspath(_dir + "/" + i +
                                                "/retroarch-local.cfg"))
                            print("a local retroarch cfg:",
                                  obj["RETRO_CONFIG"])

                        em = MyEmulator()
                        em._Emulator = obj

                        em.Init(self)
                        iconitem._CmdPath = em
                        iconitem._MyType = ICON_TYPES["Emulator"]
                        cur_page._Icons.append(iconitem)

                    elif self.IsCommercialPackage(os.path.join(_dir, i)):
                        data = None
                        em = MyCommercialSoftwarePackage()
                        if FileExists(_dir + "/" + i + "/.done"):
                            print(_dir + "/" + i + "/.done")
                            em._Done = os.path.realpath(_dir + "/" + i + "/" +
                                                        i2 + ".sh")
                        else:
                            with open(
                                    os.path.join(_dir, i) + "/" +
                                    commercialsoftware_flag) as f:
                                data = json.load(f)
                            em._ComPkgInfo = data
                            em._Done = ""

                        em._InvokeDir = os.path.realpath(os.path.join(_dir, i))
                        em.Init(self)

                        iconitem._CmdPath = em
                        iconitem._MyType = ICON_TYPES["Commercial"]
                        cur_page._Icons.append(iconitem)

                    elif self.IsExecPackage(
                            _dir + "/" +
                            i):  ## ExecPackage is the last one to check
                        iconitem._MyType = ICON_TYPES["EXE"]
                        iconitem._CmdPath = os.path.realpath(_dir + "/" + i +
                                                             "/" + i2 + ".sh")
                        MakeExecutable(iconitem._CmdPath)
                        cur_page._Icons.append(iconitem)
                    else:
                        iconitem._MyType = ICON_TYPES["DIR"]
                        iconitem._LinkPage = Page()
                        iconitem._LinkPage._Name = i2
                        cur_page._Icons.append(iconitem)
                        self.ReadTheDirIntoPages(_dir + "/" + i, pglevel + 1,
                                                 iconitem._LinkPage)

            elif os.path.isfile(_dir + "/" + i) and i.startswith(
                    ".") == False and pglevel > 0:
                if i.lower().endswith(icon_ext):
                    i2 = self.ExtraName(i)

                    #cmd      =  ReadTheFileContent(_dir+"/"+i)
                    iconitem = IconItem()
                    iconitem._FileName = i
                    iconitem._CmdPath = os.path.realpath(_dir + "/" + i)
                    MakeExecutable(iconitem._CmdPath)
                    iconitem._MyType = ICON_TYPES["EXE"]
                    if FileExists(
                            MySkinManager.GiveIcon(_dir + "/" +
                                                   ReplaceSuffix(i2, "png"))):
                        iconitem._ImageName = MySkinManager.GiveIcon(
                            _dir + "/" + ReplaceSuffix(i2, "png"))
                    else:
                        untitled = UntitledIcon()
                        untitled.Init()
                        if len(i2) > 1:
                            untitled.SetWords(i2[:2])
                        elif len(i2) == 1:
                            untitled.SetWords([i2[0], i2[0]])
                        else:
                            untitled.SetWords(["G", "s"])

                        iconitem._ImgSurf = untitled.Surface()

                        iconitem._ImageName = ""

                    iconitem.AddLabel(MyLangManager.Tr(i2.split(".")[0]),
                                      self._IconFont)
                    iconitem._LinkPage = None
                    cur_page._Icons.append(iconitem)
示例#11
0
    def Draw(self, title):
        self.ClearCanvas()
        title = MyLangManager.Tr(title)
        self._Title = title

        # get battery percentage, but not for music spectrum(GameShell RTA)
        RTA_title = "GameShell RTA"
        bat_pct = ""
        if title != RTA_title and title != MyLangManager.Tr(RTA_title):
            out = commands.getstatusoutput(
                "upower -i /org/freedesktop/UPower/devices/battery_axp20x_battery | grep percentage | tail -c 5"
            )
            bat_pct = "".join(out[1]).strip() + "  "

        cur_time = datetime.now().strftime("%H:%M")
        cur_time = bat_pct + cur_time
        time_text_font = MySkinManager.GiveFont("Eurostile12")
        time_text_size = time_text_font.size(cur_time)
        title_text_size = MyLangManager.TrFont("Eurostile16").size(title)

        self._CanvasHWND.blit(
            MyLangManager.TrFont("Eurostile16").render(
                title, True, self._SkinManager.GiveColor("Text")),
            midRect(
                title_text_size[0] / 2 + self._LOffset,
                title_text_size[1] / 2 +
                (self._BarHeight - title_text_size[1]) / 2, title_text_size[0],
                title_text_size[1], Width, Height))
        self._CanvasHWND.blit(
            time_text_font.render(cur_time, True,
                                  self._SkinManager.GiveColor("Text")),
            midRect(
                Width - time_text_size[0] / 2 - self._ROffset,
                time_text_size[1] / 2 +
                (self._BarHeight - time_text_size[1]) / 2, time_text_size[0],
                time_text_size[1], Width, Height))

        start_x = Width - time_text_size[
            0] - self._ROffset - self._icon_width * 3  # near by the time_text

        self._Icons["dlstatus"].NewCoord(
            start_x - self._icon_width * 2,
            self._icon_height / 2 + (self._BarHeight - self._icon_height) / 2)

        self._Icons["bluetooth"].NewCoord(
            start_x - self._icon_width,
            self._icon_height / 2 + (self._BarHeight - self._icon_height) / 2)

        self._Icons["sound"].NewCoord(
            start_x,
            self._icon_height / 2 + (self._BarHeight - self._icon_height) / 2)

        #self._Icons["wifi"].NewCoord(start_x+self._icon_width+5,    self._icon_height/2+(self._BarHeight-self._icon_height)/2)

        self._Icons["battery"].NewCoord(
            start_x + self._icon_width + self._icon_width + 8,
            self._icon_height / 2 + (self._BarHeight - self._icon_height) / 2)

        if is_wifi_connected_now():
            ge = self.GetWifiStrength(wifi_strength())
            if ge > 0:
                self._Icons["wifistatus"]._IconIndex = ge
                self._Icons["wifistatus"].NewCoord(
                    start_x + self._icon_width + 5, self._icon_height / 2 +
                    (self._BarHeight - self._icon_height) / 2)
                self._Icons["wifistatus"].Draw()
            else:
                self._Icons["wifistatus"]._IconIndex = 0
                self._Icons["wifistatus"].Draw()
                print("wifi strength error")
        else:
            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()

        self._Icons["sound"].Draw()

        self._Icons["battery"].Draw()

        self._Icons["bluetooth"].Draw()

        #self._Icons["dlstatus"].Draw()

        pygame.draw.line(self._CanvasHWND, self._SkinManager.GiveColor("Line"),
                         (0, self._BarHeight), (self._Width, self._BarHeight),
                         self._BorderWidth)

        if self._HWND != None:
            self._HWND.blit(
                self._CanvasHWND,
                (self._PosX, self._PosY, self._Width, self._Height))
示例#12
0
    def Draw(self, title):
        self.ClearCanvas()
        title = MyLangManager.Tr(title)

        # Couldn't see where to change this anywhere, so let's be super explicit
        if title == "GameShell":
            title = "PocketCHIP"
        self._Title = title
        title_text_size = MyLangManager.TrFont("varela16").size(title)
        self._CanvasHWND.blit(
            MyLangManager.TrFont("varela16").render(
                title, True, self._SkinManager.GiveColor("Text")),
            # x,y,width,height,canWidth,canHeight
            midRect(
                title_text_size[0] / 2 + self._LOffset,
                title_text_size[1] / 2 +
                (self._BarHeight - title_text_size[1]) / 2, title_text_size[0],
                title_text_size[1], Width, Height))

        cur_time = datetime.now().strftime("%H:%M")
        time_text_font = MySkinManager.GiveFont("varela12")
        time_text_size = time_text_font.size(cur_time)
        self._CanvasHWND.blit(
            time_text_font.render(cur_time, True,
                                  self._SkinManager.GiveColor("Text")),
            # x,y,width,height,canWidth,canHeight
            midRect(
                Width - time_text_size[0] / 2 - self._ROffset,
                time_text_size[1] / 2 +
                (self._BarHeight - time_text_size[1]) / 2, time_text_size[0],
                time_text_size[1], Width, Height))

        #### Debug: Output the battery value as text...
        # cur_batt =  "Batt: %s, %s" % (str(BatteryAbstraction.AsPercentage()), str(BatteryAbstraction.IsCharging()))
        # batt_text_font = MySkinManager.GiveFont("varela12")
        # batt_text_size = batt_text_font.size(cur_batt)
        # self._CanvasHWND.blit(batt_text_font.render(
        #     cur_batt,
        #     True,
        #     self._SkinManager.GiveColor("Text")),
        #     # x,y,width,height,canWidth,canHeight
        #     midRect(
        #         # Width-batt_text_size[0]/2-self._ROffset,
        #         200,
        #         batt_text_size[1]/2+(self._BarHeight-batt_text_size[1])/2,
        #         batt_text_size[0],
        #         batt_text_size[1],
        #         Width,
        #         Height
        #     )
        # )

        start_x = Width - time_text_size[
            0] - self._ROffset - self._icon_width * 3  # near by the time_text

        self._Icons["bluetooth"].NewCoord(
            start_x - self._icon_width,
            self._icon_height / 2 + (self._BarHeight - self._icon_height) / 2)

        self._Icons["sound"].NewCoord(
            start_x,
            self._icon_height / 2 + (self._BarHeight - self._icon_height) / 2)

        #self._Icons["wifi"].NewCoord(start_x+self._icon_width+5,    self._icon_height/2+(self._BarHeight-self._icon_height)/2)

        self._Icons["battery"].NewCoord(
            start_x + self._icon_width + self._icon_width + 8,
            self._icon_height / 2 + (self._BarHeight - self._icon_height) / 2)

        if is_wifi_connected_now():
            ge = self.GetWifiStrength(wifi_strength())
            if ge > 0:
                self._Icons["wifistatus"]._IconIndex = ge
                self._Icons["wifistatus"].NewCoord(
                    start_x + self._icon_width + 5, self._icon_height / 2 +
                    (self._BarHeight - self._icon_height) / 2)
                # self._Icons["wifistatus"].Draw()
            else:
                self._Icons["wifistatus"]._IconIndex = 0
                # self._Icons["wifistatus"].Draw()
                print("wifi strength error")
        else:
            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()

        # Draw the title bar icons
        self._Icons["wifistatus"].Draw()
        self._Icons["sound"].Draw()
        self._Icons["battery"].Draw()
        # self._Icons["bluetooth"].Draw()

        pygame.draw.line(self._CanvasHWND, self._SkinManager.GiveColor("Line"),
                         (0, self._BarHeight), (self._Width, self._BarHeight),
                         self._BorderWidth)

        if self._HWND != None:
            self._HWND.blit(
                self._CanvasHWND,
                (self._PosX, self._PosY, self._Width, self._Height))
示例#13
0
class ConfirmPage(Page):

    _Icons = {}
    _Selector = None
    _FootMsg = ["Nav", "", "", "Cancel", "Yes"]
    _MyList = []
    _ListFont = MyLangManager.TrFont("Eurostile20")
    _MyStack = None
    _FileName = ""
    _TrashDir = ""
    _ConfirmText = MyLangManager.Tr("ConfirmQ")
    _BGPosX = 0
    _BGPosY = 0
    _BGWidth = 0
    _BGHeight = 0
    _Parent = None

    def __init__(self):
        Page.__init__(self)
        self._Icons = {}
        self._CanvasHWND = None
        self._MyList = []

    def Reset(self):
        self._MyList[0].SetText(self._ConfirmText)
        self._MyList[0]._PosX = (self._Width - self._MyList[0]._Width) / 2
        self._MyList[0]._PosY = (self._Height - self._MyList[0]._Height) / 2

        self._BGPosX = self._MyList[0]._PosX - 10
        self._BGPosY = self._MyList[0]._PosY - 10
        self._BGWidth = self._MyList[0]._Width + 20
        self._BGHeight = self._MyList[0]._Height + 20

    def SnapMsg(self, msg):
        self._MyList[0].SetText(msg)
        self._MyList[0]._PosX = (self._Width - self._MyList[0]._Width) / 2
        self._MyList[0]._PosY = (self._Height - self._MyList[0]._Height) / 2

        self._BGPosX = self._MyList[0]._PosX - 10
        self._BGPosY = self._MyList[0]._PosY - 10
        self._BGWidth = self._MyList[0]._Width + 20
        self._BGHeight = self._MyList[0]._Height + 20

    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

        ps = ListPageSelector()
        ps._Parent = self
        self._Ps = ps
        self._PsIndex = 0

        li = Label()
        li.SetCanvasHWND(self._CanvasHWND)
        li.Init(self._ConfirmText, self._ListFont)

        li._PosX = (self._Width - li._Width) / 2
        li._PosY = (self._Height - li._Height) / 2

        self._BGPosX = li._PosX - 10
        self._BGPosY = li._PosY - 10
        self._BGWidth = li._Width + 20
        self._BGHeight = li._Height + 20

        self._MyList.append(li)

    def KeyDown(self, event):

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

    def DrawBG(self):
        _rect = pygame.Rect(self._BGPosX, self._BGPosY, self._BGWidth,
                            self._BGHeight)

        pygame.draw.rect(self._CanvasHWND, MySkinManager.GiveColor('White'),
                         _rect, 0)
        pygame.draw.rect(self._CanvasHWND, MySkinManager.GiveColor('Text'),
                         _rect, 1)

    def Draw(self):
        #self.ClearCanvas()

        self.DrawBG()
        for i in self._MyList:
            i.Draw()

        self.Reset()