Esempio n. 1
0
    def Init(self):

        self._DskUsg = self.DiskUsage()

        self._CanvasHWND = self._Screen._CanvasHWND
        self._Width = self._Screen._Width
        self._Height = self._Screen._Height

        self._GBLabel = Label()
        self._GBLabel.SetCanvasHWND(self._CanvasHWND)
        self._GBLabel.Init(
            self._GBmsg % (self._DskUsg[1] - self._DskUsg[0], self._DskUsg[1]),
            MySkinManager.GiveFont("varela11"))
        self._GBLabel.SetColor(self._TextColor)

        self._PctLabel = Label()
        self._PctLabel.SetCanvasHWND(self._CanvasHWND)

        usage_percent = (self._DskUsg[0] / self._DskUsg[1]) * 100.0

        self._PctLabel.Init("%d%%" % int(usage_percent),
                            MySkinManager.GiveFont("EurostileBold30"))
        self._PctLabel.SetColor(self._TextColor)

        self._FreeLabel = Label()
        self._FreeLabel.SetCanvasHWND(self._CanvasHWND)
        self._FreeLabel.Init("FREE", MySkinManager.GiveFont("varela12"))
        self._FreeLabel.SetColor(self._PctLabel._Color)
Esempio n. 2
0
    def Draw(self):

        if self._MyType == ICON_TYPES["DIR"] and self._Path != "[..]":
            self._Parent._Icons["sys"]._IconIndex = 0
            self._Parent._Icons["sys"].NewCoord(self._PosX+12,self._PosY+ (self._Height - self._Parent._Icons["sys"]._Height)/2+self._Parent._Icons["sys"]._Height/2)
            self._Parent._Icons["sys"].Draw()

        if self._MyType == ICON_TYPES["FILE"]:
            self._Parent._Icons["sys"]._IconIndex = 1
            self._Parent._Icons["sys"].NewCoord(self._PosX+12,self._PosY+ (self._Height - self._Parent._Icons["sys"]._Height)/2+self._Parent._Icons["sys"]._Height/2)
            self._Parent._Icons["sys"].Draw()
        
        if self._Active == True:
            self._Labels["Text"]._Active = True
        else:
            self._Labels["Text"]._Active = False

        
        self._Labels["Text"]._PosY = self._PosY + (self._Height - self._Labels["Text"]._Height)/2
            
        pygame.draw.line(self._Parent._CanvasHWND,MySkinManager.GiveColor('Line'),(self._PosX,self._PosY+self._Height-1),(self._PosX+self._Width,self._PosY+self._Height-1),1)

        if self._Playing == True:
            self._Labels["Text"]._Active =True
            self._Labels["Text"].Draw()
            #_rect = midRect(10,self._PosY+15,10,10,self._Parent._Width,self._Parent._Height)
            #aa_round_rect(self._Parent._CanvasHWND,_rect,(0,0,0),3,0,(0,0,0))
            #pygame.draw.polygon(self._Parent._CanvasHWND, (0,0,0), [[6, self._PosY+7], [11, self._PosY+14],[6, self._PosY+21]], 2)
            
            if self._PlayingProcess > 0:
                seek_posx = int(self._Width * self._PlayingProcess/100.0)
                pygame.draw.line(self._Parent._CanvasHWND,MySkinManager.GiveColor('Active'),(self._PosX,self._PosY+self._Height-2),(self._PosX+seek_posx,self._PosY+self._Height-2),2)   

        else:
            self._Labels["Text"].Draw()
Esempio n. 3
0
    def Init(self):

        self._DskUsg = self.DiskUsage()

        self._CanvasHWND = self._Screen._CanvasHWND
        self._Width = self._Screen._Width
        self._Height = self._Screen._Height

        self._BGpng = IconItem()
        self._BGpng._ImgSurf = MyIconPool.GiveIconSurface("icon_sd")
        self._BGpng._MyType = ICON_TYPES["STAT"]
        self._BGpng._Parent = self

        self._BGpng.AddLabel(
            self._BGmsg % (self._DskUsg[1] - self._DskUsg[0], self._DskUsg[1]),
            MySkinManager.GiveFont("varela15"))
        self._BGpng.Adjust(0, 0, self._BGwidth, self._BGheight, 0)

        self._BGlabel = Label()
        self._BGlabel.SetCanvasHWND(self._CanvasHWND)

        usage_percent = (self._DskUsg[0] / self._DskUsg[1]) * 100.0

        self._BGlabel.Init("%d%%" % int(usage_percent),
                           MySkinManager.GiveFont("varela25"))
        self._BGlabel.SetColor(self._HighColor)

        self._FreeLabel = Label()
        self._FreeLabel.SetCanvasHWND(self._CanvasHWND)
        self._FreeLabel.Init("Free", MySkinManager.GiveFont("varela13"))
        self._FreeLabel.SetColor(self._BGlabel._Color)
Esempio n. 4
0
    def KeyDown(self,event):
        
        if IsKeyMenuOrB(event.key):
            self.ReturnToUpLevelPage()
            self._Screen.Draw()
            self._Screen.SwapAndShow()

        if IsKeyStartOrA(event.key):
            if self.CheckBattery() < 20:
                cmdpath = "feh --bg-center %s;" % MySkinManager.GiveWallpaper("gameover.png")
            else:
                cmdpath = "feh --bg-center %s;" % MySkinManager.GiveWallpaper("seeyou.png")
            
            cmdpath += "sleep 3;"
            
            #cmdpath += "echo 'halt -p' > /tmp/halt_cmd"
            
            cmdpath += "sudo halt -p"
            pygame.event.post( pygame.event.Event(RUNSYS, message=cmdpath))
            
        if event.key == CurKeys["X"]:
            cmdpath = "feh --bg-center %s;" % MySkinManager.GiveWallpaper("seeyou.png")
            cmdpath += "sleep 3;"
            cmdpath += "sudo reboot"
            pygame.event.post( pygame.event.Event(RUNSYS, message=cmdpath))

        if event.key == CurKeys["Y"]:
            if self._FootMsg[1] != "":
                cmdpath = "feh --bg-center %s;" % MySkinManager.GiveWallpaper("seeyou.png")
                cmdpath += "sleep 3;"
                cmdpath += "sudo pm-suspend"
                pygame.event.post( pygame.event.Event(RUNSYS, message=cmdpath))
Esempio n. 5
0
    def Draw(self):
        if self._ReadOnly == False:
            self._Labels["Text"].SetColor(
                MySkinManager.GiveColor("ReadOnlyText"))
        else:
            self._Labels["Text"].SetColor(MySkinManager.GiveColor("Text"))

        self._Labels["Text"]._PosX = self._Labels["Text"]._PosX + self._PosX
        self._Labels["Text"]._PosY = self._PosY + (
            self._Height - self._Labels["Text"]._Height) / 2
        self._Labels["Text"].Draw()
        self._Labels["Text"]._PosX = self._Labels["Text"]._PosX - self._PosX

        if "Small" in self._Labels:
            self._Labels[
                "Small"]._PosX = self._Width - self._Labels["Small"]._Width - 5

            self._Labels["Small"]._PosY = self._PosY + (
                self._Height - self._Labels["Small"]._Height) / 2
            self._Labels["Small"].Draw()

        if self._ReadOnly:
            self._Icons["done"].NewCoord(self._Width - 25, 5)
            self._Icons["done"].Draw()

        pygame.draw.line(
            self._Parent._CanvasHWND, MySkinManager.GiveColor('Line'),
            (self._PosX, self._PosY + self._Height - 1),
            (self._PosX + self._Width, self._PosY + self._Height - 1), 1)
Esempio n. 6
0
    def Draw(self):
        self.ClearCanvas()

        self._BGpng.NewCoord(self._Width / 2, self._Height / 2 - 10)
        self._BGpng.Draw()
        self._BGlabel.NewCoord(self._Width / 2 - 28, self._Height / 2 - 30)
        self._BGlabel.Draw()

        self._FreeLabel.NewCoord(self._BGlabel._PosX + 10, self._Height / 2)
        self._FreeLabel.Draw()

        #bgcolor = (238,238,238), fgcolor = (126,206,244)
        #aa_round_rect
        usage_percent = (self._DskUsg[0] / self._DskUsg[1])
        if usage_percent < 0.1:
            usage_percent = 0.1

        rect_ = midRect(self._Width / 2, self._Height - 30, 170, 17, Width,
                        Height)

        aa_round_rect(self._CanvasHWND, rect_, MySkinManager.GiveColor('Line'),
                      5, 0, MySkinManager.GiveColor('Line'))

        rect2 = midRect(self._Width / 2, self._Height - 30,
                        int(170 * (1.0 - usage_percent)), 17, Width, Height)

        rect2.left = rect_.left
        rect2.top = rect_.top

        aa_round_rect(self._CanvasHWND, rect2,
                      MySkinManager.GiveColor('Front'), 5, 0,
                      MySkinManager.GiveColor('Front'))
Esempio n. 7
0
    def Draw(self):
        self.ClearCanvas()

        if is_wifi_connected_now() == False:
            self._Icons["needwifi_bg"].NewCoord(self._Width/2, self._Height/2)
            self._Icons["needwifi_bg"].Draw()
            return
        
        self._Icons["bg"].NewCoord(self._Width/2,self._Height/2-20)
        self._Icons["bg"].Draw()
        
        percent = self._Value
        if percent < 10:
            percent = 10

        
        rect_ = midRect(self._Width/2,self._Height/2+33,170,17, Width,Height)
        aa_round_rect(self._CanvasHWND,rect_,MySkinManager.GiveColor('TitleBg'),5,0,MySkinManager.GiveColor('TitleBg'))
        
        rect2 = midRect(self._Width/2,self._Height/2+33,int(170*(percent/100.0)),17, Width,Height)
        rect2.left = rect_.left
        rect2.top  = rect_.top
        aa_round_rect(self._CanvasHWND,rect2,MySkinManager.GiveColor('Front'),5,0,MySkinManager.GiveColor('Front'))

        rect3 = midRect(self._Width/2,self._Height/2+53,self._FileNameLabel._Width, self._FileNameLabel._Height,Width,Height)

        rect4 = midRect(self._Width/2,self._Height/2+70,self._SizeLabel._Width, self._SizeLabel._Height,Width,Height)

        self._FileNameLabel.NewCoord(rect3.left,rect3.top)
        self._SizeLabel.NewCoord(rect4.left, rect4.top)

        self._FileNameLabel.Draw()
        self._SizeLabel.Draw()
Esempio n. 8
0
 def Init(self):
     self._Width = self._Parent._Width
     self._Height = self._Parent._Height
     
     self._BrightnessLabel = Label()
     self._BrightnessLabel.SetCanvasHWND(self._CanvasHWND)
     self._BrightnessLabel.Init("BRIGHT",MySkinManager.GiveFont("EurostileBold13"))
     self._BrightnessLabel.SetColor(MySkinManager.GiveColor('Text'))
Esempio n. 9
0
    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._RollCanvas = pygame.Surface(( self._RollW,self._RollH))
        
        """
        self._BGpng = IconItem()
        self._BGpng._ImgSurf = MyIconPool._Icons["sheep_bg"]
        self._BGpng._MyType = ICON_TYPES["STAT"]
        self._BGpng._Parent = self
        self._BGpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
        
        self._SheepHead = IconItem()
        self._SheepHead._ImgSurf = MyIconPool._Icons["sheep_head"]
        self._SheepHead._MyType = ICON_TYPES["STAT"]
        self._SheepHead._Parent = self
        self._SheepHead.Adjust(0,0,self._SheepHeadW,self._SheepHeadH,0)

        self._SheepBody = IconItem()
        self._SheepBody._ImgSurf = MyIconPool._Icons["sheep_body"]
        self._SheepBody._MyType = ICON_TYPES["STAT"]
        self._SheepBody._Parent = self
        self._SheepBody.Adjust(0,0,self._SheepBodyW,self._SheepBodyH,0)
        """
        
        self._cwp_png = IconItem()
        self._cwp_png._ImgSurf = MyIconPool._Icons["tape"]
        self._cwp_png._MyType = ICON_TYPES["STAT"]
        self._cwp_png._Parent = self
        self._cwp_png.Adjust(0,0,79,79,0)


        self._song_title = Label()
        self._song_title.SetCanvasHWND(self._RollCanvas)
        self._song_title.Init("Untitled",self._SongFont,MySkinManager.GiveColor('White'))


        self._title = Label()
        self._title.SetCanvasHWND(self._CanvasHWND)
        self._title.Init("Title:",self._ListFont,MySkinManager.GiveColor('White'))

        self._time = Label()
        self._time.SetCanvasHWND(self._CanvasHWND)
        self._time.Init("Time:",self._ListFont,MySkinManager.GiveColor('White'))        


        self._time2 = Label()
        self._time2.SetCanvasHWND(self._CanvasHWND)
        self._time2.Init("00:00-00:00", self._ListFont,
                         MySkinManager.GiveColor('White'))

        
        self.Start()
Esempio n. 10
0
    def Draw(self):
        my_text = self._FontObj.render( self._Text,True,self._Color)
        w  = my_text.get_width()
        h  = my_text.get_height()
        x  = (self._Parent._Width - w)/2
        y =  (self._Parent._Height - h)/2
        padding = 10 
        pygame.draw.rect(self._CanvasHWND,MySkinManager.GiveColor('White'),(x-padding,y-padding, w+padding*2,h+padding*2))        

        pygame.draw.rect(self._CanvasHWND,MySkinManager.GiveColor('Black'),(x-padding,y-padding, w+padding*2,h+padding*2),1)

        self._CanvasHWND.blit(my_text,(x,y,w,h))
Esempio n. 11
0
    def Draw(self):
        if self._ReadOnly == True:
            self._Labels["Text"].SetColor(
                MySkinManager.GiveColor("ReadOnlyText"))
        else:
            self._Labels["Text"].SetColor(MySkinManager.GiveColor("Text"))

        padding = 17

        if self._Type == None:
            padding = 0

        if self._Type == "source" or self._Type == "dir":
            self._Icons["ware"].NewCoord(
                4, (self._Height - self._Icons["ware"]._Height) / 2)
            self._Icons["ware"].DrawTopLeft()

        if self._Type == "launcher" or self._Type == "pico8" or self._Type == "tic80":
            _icon = "app"
            if self._ReadOnly == True:
                _icon = "appdling"

            self._Icons[_icon].NewCoord(
                4, (self._Height - self._Icons[_icon]._Height) / 2)
            self._Icons[_icon].DrawTopLeft()

        if self._Type == "add_house":
            self._Icons["add"].NewCoord(
                4, (self._Height - self._Icons["add"]._Height) / 2)
            self._Icons["add"].DrawTopLeft()

        self._Labels[
            "Text"]._PosX = self._Labels["Text"]._PosX + self._PosX + padding
        self._Labels["Text"]._PosY = self._PosY + (
            self._Height - self._Labels["Text"]._Height) / 2
        self._Labels["Text"].Draw()
        self._Labels[
            "Text"]._PosX = self._Labels["Text"]._PosX - self._PosX - padding

        if "Small" in self._Labels:
            self._Labels[
                "Small"]._PosX = self._Width - self._Labels["Small"]._Width - 5

            self._Labels["Small"]._PosY = self._PosY + (
                self._Height - self._Labels["Small"]._Height) / 2
            self._Labels["Small"].Draw()

        pygame.draw.line(
            self._Parent._CanvasHWND, MySkinManager.GiveColor('Line'),
            (self._PosX, self._PosY + self._Height - 1),
            (self._PosX + self._Width, self._PosY + self._Height - 1), 1)
Esempio n. 12
0
    def Draw(self):
        self.ClearCanvas()

        self._Icons["DialogBoxs"].NewCoord(70, 58)
        #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()

        self.DrawCross(10, 10)
        self.DrawCross(self._Screen._Width - 20, 10)
        self.DrawCross(10, self._Screen._Height - 20)
        self.DrawCross(self._Screen._Width - 20, self._Screen._Height - 20)

        if self._HWND != None:
            self._HWND.fill(MySkinManager.GiveColor("White"))

            self._HWND.blit(
                self._CanvasHWND,
                (self._PosX, self._PosY, self._Width, self._Height))
Esempio n. 13
0
    def Draw(self):
        if self._DrawOnce == False:
            self.ClearCanvas()

            if is_wifi_connected_now():
                
                self._Icons["online"].NewCoord(self._Coords["online"].x, self._Coords["online"].y)
                self._Icons["online"].Draw()

                self.SetLabels()
                
                for i in self._Labels:
                    if i in self._Coords:
                        self._Labels[i].NewCoord( self._Coords[i].x, self._Coords[i].y)
                        self._Labels[i].Draw()

                self._Labels["key_and_pass"].NewCoord( 103,self._Coords["key_and_pass"].y)
                self._Labels["key_and_pass"].Draw()

            else:
                self._Labels["for-usb-eth"].NewCoord(self._Coords["for-usb-eth"].x+55, self._Coords["for-usb-eth"].y)
                self._Labels["for-usb-eth"].Draw()
                
                self._Labels["usb-eth-addr"].NewCoord(self._Coords["usb-eth-addr"].x+55, self._Coords["usb-eth-addr"].y)
                self._Labels["usb-eth-addr"].Draw()                
                
                self._Icons["bg"].NewCoord(self._Coords["bg"].x, self._Coords["bg"].y)
                self._Icons["bg"].Draw()

                
            self._DrawOnce = True
            
        if self._HWND != None:
            self._HWND.fill(MySkinManager.GiveColor('White'))
            self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
Esempio n. 14
0
    def GenList(self):
        
        self._MyList = []
        
        start_x  = 0
        start_y  = 10
        last_height = 0

        for i,u in enumerate( ["processor","armcores","cpuscalemhz","features","memory","uname","launcher_ver","os_image_ver"] ):
        #for i,u in enumerate( ["processor","cpucores","cpumhz","flags","memory","uname"] ):
            if u not in self._AList:
                continue
            
            v = self._AList[u]
            
            li = InfoPageListItem()
            li._Parent = self
            li._PosX   = start_x
            li._PosY   = start_y + last_height
            li._Width  = Width
            li._Fonts["normal"] = self._ListFontObj
            li._Fonts["small"] = MySkinManager.GiveFont("varela12")
            
            if self._AList[u]["label"] != "":
                li.Init(  self._AList[u]["label"] )
            else:
                li.Init( self._AList[u]["key"] )

            li._Flag = self._AList[u]["key"]

            li.SetSmallText( self._AList[u]["value"] )
            
            last_height += li._Height
            
            self._MyList.append(li)
Esempio n. 15
0
class ListPageSelector(PageSelector):
    _BackgroundColor = MySkinManager.GiveColor('Front')

    def __init__(self):
        self._PosX = 0
        self._PosY = 0
        self._Height = 0
        self._Width = Width - 12

    def AnimateDraw(self, x2, y2):
        pass

    def Draw(self):
        idx = self._Parent._PsIndex
        if idx > (len(self._Parent._MyList) - 1):
            idx = len(self._Parent._MyList)
            if idx > 0:
                idx -= 1
            elif idx == 0:  ##nothing in _MyList
                return

        self._Parent._PsIndex = idx  ## sync PsIndex

        x = self._Parent._MyList[idx]._PosX + 2
        y = self._Parent._MyList[idx]._PosY + 1
        h = self._Parent._MyList[idx]._Height - 3

        self._PosX = x
        self._PosY = y
        self._Height = h

        aa_round_rect(self._Parent._CanvasHWND, (x, y, self._Width - 4, h),
                      self._BackgroundColor, 4, 0, self._BackgroundColor)
Esempio n. 16
0
    def Draw(self):
        if self._Path != "[..]":
            self._Labels["Text"]._PosX = 23
        else:
            self._Labels["Text"]._PosX = 3

        self._Labels["Text"]._PosY = self._PosY + (
            self._Height - self._Labels["Text"]._Height) / 2
        self._Labels["Text"].Draw()
        """
        if self._Active == True:
            pass
        """
        if self._MyType == ICON_TYPES["DIR"] and self._Path != "[..]":
            self._Parent._Icons["sys"]._IconIndex = 0
            self._Parent._Icons["sys"].NewCoord(
                self._PosX + 12, self._PosY +
                (self._Height - self._Parent._Icons["sys"]._Height) / 2 +
                self._Parent._Icons["sys"]._Height / 2)
            self._Parent._Icons["sys"].Draw()

        if self._MyType == ICON_TYPES["FILE"]:
            self._Parent._Icons["sys"]._IconIndex = 1
            self._Parent._Icons["sys"].NewCoord(
                self._PosX + 12, self._PosY +
                (self._Height - self._Parent._Icons["sys"]._Height) / 2 +
                self._Parent._Icons["sys"]._Height / 2)
            self._Parent._Icons["sys"].Draw()

        pygame.draw.line(
            self._Parent._CanvasHWND, MySkinManager.GiveColor('Line'),
            (self._PosX, self._PosY + self._Height - 1),
            (self._PosX + self._Width, self._PosY + self._Height - 1), 1)
Esempio n. 17
0
    def Draw(self):

        self.ClearCanvas()
        if len(self._MyList) == 0:
            return
        
        else:
            if len(self._MyList) * self._MyList[0]._Height > self._Height:
                self._Ps._Width = self._Width - 11
                self._Ps.Draw()
                for i in self._MyList:
                    if i._PosY > self._Height + self._Height/2:
                        break
                    if i._PosY < 0:
                        continue
                    i.Draw()
                self._Scroller.UpdateSize( len(self._MyList)*self._MyList[0]._Height, self._PsIndex*self._MyList[0]._Height)
                self._Scroller.Draw()
                
            else:
                self._Ps._Width = self._Width
                self._Ps.Draw()
                for i in self._MyList:
                    if i._PosY > self._Height + self._Height/2:
                        break
                    if i._PosY < 0:
                        continue
                    i.Draw()                

        if self._HWND != None:
            self._HWND.fill(MySkinManager.GiveColor("White"))
            
            self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
Esempio n. 18
0
class ListPageSelector(PageSelector):
    _BackgroundColor = MySkinManager.GiveColor('Front')

    def __init__(self):
        self._PosX = 0
        self._PosY = 0
        self._Height = 0
        self._Width = Width

    def AnimateDraw(self, x2, y2):
        pass

    def Draw(self):
        idx = self._Parent._PsIndex

        if idx < len(self._Parent._MyList):
            x = self._Parent._MyList[idx]._PosX + 2
            y = self._Parent._MyList[idx]._PosY + 1
            h = self._Parent._MyList[idx]._Height - 3

            self._PosX = x
            self._PosY = y
            self._Height = h

            aa_round_rect(self._Parent._CanvasHWND, (x, y, self._Width - 4, h),
                          self._BackgroundColor, 4, 0, self._BackgroundColor)
Esempio n. 19
0
    def Draw(self):

        if self._DrawOnce == False:
            self.ClearCanvas()
            #self._Ps.Draw()

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

            self._DrawOnce = True

            self._Icons["bg"].DrawRect((230, 0, 82, 184), (228, 0, 82, 184))

            y = self._MyList[len(self._MyList) - 1]._PosY + 30

            self._Icons["bg"].DrawRect(((self._Width - 191) / 2, y, 191, 68),
                                       (65, 232, 191, 68))

        if self._HWND != None:
            self._HWND.fill(MySkinManager.GiveColor("White"))

            self._HWND.blit(
                self._CanvasHWND,
                (self._PosX, self._PosY, self._Width, self._Height))

            self._Scroller.UpdateSize(self._BGheight, abs(self._Scrolled) * 3)
            self._Scroller.Draw()
Esempio n. 20
0
    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

        self.SyncList()
        gobject.timeout_add(850, self.GObjectInterval)

        self._BGpng = IconItem()
        self._BGpng._ImgSurf = MyIconPool._Icons["heart"]
        self._BGpng._MyType = ICON_TYPES["STAT"]
        self._BGpng._Parent = self
        self._BGpng.AddLabel(MyLangManager.Tr("my favorite music"),
                             MyLangManager.TrFont("varela18"))
        self._BGpng.SetLableColor(MySkinManager.GiveColor('Disabled'))
        self._BGpng.Adjust(0, 0, self._BGwidth, self._BGheight, 0)

        self._Scroller = ListScroller()
        self._Scroller._Parent = self
        self._Scroller._PosX = self._Width - 10
        self._Scroller._PosY = 2
        self._Scroller.Init()
Esempio n. 21
0
    def Draw(self):
        #pygame.draw.line(self._Parent._CanvasHWND,(169,169,169),(self._PosX,self._PosY),(self._PosX+self._Width,self._PosY),1)        
        for i in self._Labels:
            self._Labels[i]._PosY = self._PosY + (self._Height - self._Labels[i]._Height)/2
            self._Labels[i].Draw()
            
        if self._IsActive:
            self._Icons["done"].NewCoord(14,self._PosY)
            self._Icons["done"].Draw()

        if self._Encrypt != "Unsecured":
            self._Icons["lock"].NewCoord( self._Width -23 - self._Labels["stren"].Width() - 2 - 18, self._PosY)
            self._Icons["lock"].Draw()
        
        ge = self._Parent._Screen._TitleBar.GetWifiStrength( self._Stren.replace('%',''))
        
        if ge > 0:
            self._Icons["wifistatus"]._IconIndex = ge
            self._Icons["wifistatus"].NewCoord(self._Width-23,self._PosY)
            self._Icons["wifistatus"].Draw()
            
        else:
            self._Icons["wifistatus"]._IconIndex = 0
            self._Icons["wifistatus"].NewCoord(self._Width-23,self._PosY)
            self._Icons["wifistatus"].Draw()
        
        pygame.draw.line(self._Parent._CanvasHWND,MySkinManager.GiveColor('Line'),(self._PosX,self._PosY+self._Height-1),(self._PosX+self._Width,self._PosY+self._Height-1),1)        
Esempio n. 22
0
    def Init(self):
        self._CanvasHWND = self._Screen._CanvasHWND
        self._Width = self._Screen._Width
        self._Height = self._Screen._Height

        self._Label = Label()
        self._Label.SetCanvasHWND(self._CanvasHWND)
        self._Label.Init('', MySkinManager.GiveFont('varela25'))
Esempio n. 23
0
    def Draw(self):
        start_x = 82
        start_y = self._Parent._Screen._Height/2-5
        height = 30
        width = 4
        padding = 15
        seg = self._Value-1

        for i in range(0,9):
            rect = pygame.Rect(start_x+i*(width+padding),start_y,width,height)
            if i > seg:
                pygame.draw.rect(self._CanvasHWND,MySkinManager.GiveColor('Text'),rect, 1)
                #aa_round_rect(self._CanvasHWND,rect, MySkinManager.GiveColor('Text'),1,1, MySkinManager.GiveColor('White'))
            else:
                pygame.draw.rect(self._CanvasHWND,MySkinManager.GiveColor('Text'),rect, 0)   
                #aa_round_rect(self._CanvasHWND,rect, MySkinManager.GiveColor('Text'),1,0, MySkinManager.GiveColor('White'))
        
        self._BrightnessLabel.NewCoord(118,self._Parent._Screen._Height/2-30)
        self._BrightnessLabel.Draw(True)
        
        minus_box_rect = pygame.Rect(start_x- (4+6)*4,start_y,6*4,30)
        pygame.draw.rect(self._CanvasHWND,MySkinManager.GiveColor('Text'),minus_box_rect, 0) 
        
        minus_rect     = pygame.Rect(start_x-8*4,start_y+14,2*4,2)
        pygame.draw.rect(self._CanvasHWND,MySkinManager.GiveColor('White'),minus_rect, 0) 
        
        plus_box_rect = pygame.Rect(start_x + 39*4 +4*4,start_y,6*4,30)
        pygame.draw.rect(self._CanvasHWND,MySkinManager.GiveColor('Text'),plus_box_rect, 0) 
        
        cross1_rect     = pygame.Rect(start_x+39*4+4*4+2*4,start_y+14,2*4,2)
        pygame.draw.rect(self._CanvasHWND,MySkinManager.GiveColor('White'),cross1_rect, 0) 
        cross2_rect     = pygame.Rect(start_x+39*4+4*4+2*4+3,start_y+14-3,2,2*4)
        pygame.draw.rect(self._CanvasHWND,MySkinManager.GiveColor('White'),cross2_rect, 0) 
Esempio n. 24
0
class KeyboardIcon(IconItem):
    _Color = MySkinManager.GiveColor('Text')
    _MyType = ICON_TYPES["NAV"]
    _Parent = None
    _Str = ""

    def Draw(self):
        self._Parent._CanvasHWND.blit(self._ImgSurf, \
            midRect(self._PosX,self._PosY,self._Width,self._Height,Width,Height))
Esempio n. 25
0
    def Draw(self):

        self._Labels["Text"]._PosY = self._PosY + (
            self._Height - self._Labels["Text"]._Height) / 2
        self._Labels["Text"].Draw()

        pygame.draw.line(
            self._Parent._CanvasHWND, MySkinManager.GiveColor('Line'),
            (self._PosX, self._PosY + self._Height - 1),
            (self._PosX + self._Width, self._PosY + self._Height - 1), 1)
Esempio n. 26
0
    def Draw(self):
        self.ClearCanvas()

        self._PctLabel.NewCoord(32, 102 - 33)
        self._PctLabel.Draw()

        self._FreeLabel.NewCoord(33, 130 - 25)
        self._FreeLabel.Draw()

        self._GBLabel.NewCoord(145, 103 - 29)
        self._GBLabel.Draw()

        #bgcolor = (238,238,238), fgcolor = (126,206,244)

        usage_percent = (self._DskUsg[0] / self._DskUsg[1])
        if usage_percent < 0.1:
            usage_percent = 0.1

        rect_ = pygame.Rect(144, 118 - 25, 283 - 144, 139 - 117)

        pygame.draw.rect(self._CanvasHWND, MySkinManager.GiveColor('Text'),
                         rect_, 1)

        rect2 = pygame.Rect(144, 118 - 25,
                            int((283 - 144) * (1.0 - usage_percent)),
                            139 - 117)

        rect2.left = rect_.left
        rect2.top = rect_.top

        pygame.draw.rect(self._CanvasHWND, MySkinManager.GiveColor('Text'),
                         rect2, 0)

        sep_rect = pygame.Rect(129, 99 - 25, 2, 42)

        pygame.draw.rect(self._CanvasHWND, MySkinManager.GiveColor('Text'),
                         sep_rect, 0)

        ##4 cross
        self.DrawCross(10, 10)
        self.DrawCross(self._Screen._Width - 20, 10)
        self.DrawCross(10, self._Screen._Height - 20)
        self.DrawCross(self._Screen._Width - 20, self._Screen._Height - 20)
Esempio n. 27
0
    def Init(self):
        self._SubPage = SelectPage()
        self._SubPage._Screen = self._Screen
        self._SubPage._Name = "Select Branch"
        self._SubPage.Init()

        self._ListFontObj = MyLangManager.TrFont("varela15")
        self._ListSmFontObj = MySkinManager.GiveFont("varela12")
        if self._Screen != None:
            if self._Screen._CanvasHWND != None and self._CanvasHWND == None:
                self._HWND = self._Screen._CanvasHWND
                self._CanvasHWND = self._Screen._CanvasHWND
        
        self._PosX = self._Index*self._Screen._Width 
        self._Width = self._Screen._Width ## equal to screen width
        self._Height = self._Screen._Height

        ps = GamePageSelector()
        ps._Parent = self 

        self._Ps = ps
        self._PsIndex = 0

        self._Scroller = ListScroller()
        self._Scroller._Parent = self
        self._Scroller._PosX = 2
        self._Scroller._PosY = 2
        self._Scroller.Init()

        start_x  = 0
        start_y  = 0
        i = 0
        games = git.get_games()
        for game in games:
            li = InfoPageListItem()
            li._Parent = self
            li._PosX   = start_x
            li._PosY   = start_y + i*InfoPageListItem._Height

            li._Width  = Width
            li._Fonts["normal"] = self._ListFontObj
            
            li._Fonts["small"] = self._ListSmFontObj
            
            li._LinkObj = game

            li.Init( game.split("/")[-1] )
            
            sm_text = str(len(git.get_branches(game)[0]))
            li.SetSmallText(sm_text)
            
            li._PosX = 2
            self._MyList.append(li)

            i = i + 1
Esempio n. 28
0
class ListItemLabel(Label):

    _ActiveColor = MySkinManager.GiveColor('Active')
    _Active = False

    def Draw(self):

        self._FontObj.set_bold(self._Active)

        my_text = self._FontObj.render(self._Text, True, self._Color)
        self._CanvasHWND.blit(
            my_text, (self._PosX, self._PosY, self._Width, self._Height))
Esempio n. 29
0
    def Draw(self):
        #pygame.draw.line(self._Parent._CanvasHWND,(224,220,206),(self._PosX,self._PosY),(self._PosX+self._Width,self._PosY),1)
        for i in self._Labels:
            self._Labels[i]._PosY = self._PosY + (self._Height -
                                                  self._Labels[i]._Height) / 2
            self._Labels[i].Draw()

        if self._IsActive:
            self._Icons["done"].NewCoord(320 - 22, self._PosY)
            self._Icons["done"].Draw()

        pygame.draw.line(
            self._Parent._CanvasHWND, MySkinManager.GiveColor('Line'),
            (self._PosX, self._PosY + self._Height - 1),
            (self._PosX + self._Width, self._PosY + self._Height - 1), 1)
Esempio n. 30
0
    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

        self.SyncList(self._Emulator["ROM"])

        self._MyStack._Emulator = self._Emulator

        icon_for_list = MultiIconItem()
        icon_for_list._ImgSurf = self._Parent._Icons["sys"]
        icon_for_list._MyType = ICON_TYPES["STAT"]
        icon_for_list._Parent = self
        icon_for_list.Adjust(0, 0, 18, 18, 0)

        self._Icons["sys"] = icon_for_list

        bgpng = IconItem()
        bgpng._ImgSurf = MyIconPool._Icons["star"]
        bgpng._MyType = ICON_TYPES["STAT"]
        bgpng._Parent = self
        bgpng.AddLabel(MyLangManager.Tr("MyFavGames"),
                       MyLangManager.TrFont("varela18"))
        bgpng.SetLableColor(MySkinManager.GiveColor('Disabled'))
        bgpng.Adjust(0, 0, self._BGwidth, self._BGheight, 0)

        self._Icons["bg"] = bgpng

        self._Scroller = ListScroller()
        self._Scroller._Parent = self
        self._Scroller._PosX = self._Width - 10
        self._Scroller._PosY = 2
        self._Scroller.Init()

        rom_so_confirm_page = RomSoConfirmPage()
        rom_so_confirm_page._Screen = self._Screen
        rom_so_confirm_page._Name = "Download Confirm"
        rom_so_confirm_page._Parent = self
        rom_so_confirm_page.Init()

        self._RomSoConfirmDownloadPage = rom_so_confirm_page