Example #1
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()
Example #2
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'))
Example #3
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)
Example #4
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()
Example #5
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()
Example #6
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))
Example #7
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)
Example #8
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)
Example #9
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 ) )
Example #10
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 ) )
Example #11
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))
Example #12
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)
Example #13
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)        
Example #14
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()
Example #15
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()
Example #16
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)
Example #17
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'))
Example #18
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) 
Example #19
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))
Example #20
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)
Example #21
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)
Example #22
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))
Example #23
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)
Example #24
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
Example #25
0
    def Draw(self):
        self.ClearCanvas()

        if self._GameIcon != None:
            self._GameIcon.Draw()

        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()

        if self._HWND != None:
            self._HWND.fill(MySkinManager.GiveColor('White'))
            self._HWND.blit(
                self._CanvasHWND,
                (self._PosX, self._PosY, self._Width, self._Height))
Example #26
0
 def Draw(self):
     
     self._Labels["Text"]._PosY = self._PosY+ (self._Height-  self._Labels["Text"]._Height)/2
     
     if self._Active == True:
         self._Parent._Icons["done"].NewCoord( self._Parent._Width-30,self._PosY+5)
         self._Parent._Icons["done"].Draw()
         
     self._Labels["Text"].Draw(self._Active)
         
     if "Small" in self._Labels:
         self._Labels["Small"]._PosX = self._Width - self._Labels["Small"]._Width -10
         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)        
Example #27
0
def big_loop():
    global sound_patch, gobject_flash_led1

    title_bar = TitleBar()
    title_bar.Init(screen)
    foot_bar = FootBar()
    foot_bar.Init(screen)

    main_screen = MainScreen()
    main_screen._HWND = screen
    main_screen._TitleBar = title_bar
    main_screen._FootBar = foot_bar
    main_screen.Init()

    main_screen.ReadTheDirIntoPages("../Menu", 0, None)
    main_screen.ReadTheDirIntoPages(
        "/home/cpi/apps/Menu", 1,
        main_screen._Pages[len(main_screen._Pages) - 1])
    main_screen.ReunionPagesIcons()

    main_screen.FartherPages()

    title_bar._SkinManager = main_screen._SkinManager
    foot_bar._SkinManager = main_screen._SkinManager

    sound_patch = SoundPatch()
    sound_patch._Parent = main_screen
    sound_patch.Init()
    #pp(main_screen._Pages[0],True,6)

    screen.fill(MySkinManager.GiveColor("White"))
    main_screen.Draw()
    main_screen.SwapAndShow()

    #gobject.timeout_add(DT,gobject_pygame_event_timer,main_screen)
    gobject_flash_led1 = gobject.timeout_add(200, GobjectFlashLed1,
                                             main_screen)

    gobject.timeout_add(DT, gobject_pygame_event_poll_timer, main_screen)
    gobject.timeout_add(3000, title_bar.GObjectRoundRobin)

    socket_thread(main_screen)
    aria2_ws(main_screen)

    gobject_loop()
Example #28
0
class TextItem(IconItem):
    _PosX = 0
    _PosY = 0
    _Width = 0
    _Height = 0
    _Str    = ""
    _Color = MySkinManager.GiveColor('Text')
    _FontObj = None
    _Bold    = False
    _MyType  = ICON_TYPES["LETTER"] 
    _Parent  = None

    def Draw(self):
        self._FontObj.set_bold(self._Bold)
        my_text = self._FontObj.render(self._Str,True,self._Color)
        if my_text.get_width() != self._Width:
            self._Width = my_text.get_width()
        if my_text.get_height() != self._Height:
            self._Height = my_text.get_height()

        self._Parent._CanvasHWND.blit(my_text, \
            midRect(self._PosX,self._PosY,self._Width,self._Height,Width,Height))
    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("/usr/share/zoneinfo/posix")

        icon_for_list = MultiIconItem()
        icon_for_list._ImgSurf = MyIconPool._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


        self._BGpng = IconItem()
        self._BGpng._ImgSurf = MyIconPool._Icons["empty"]
        self._BGpng._MyType = ICON_TYPES["STAT"]
        self._BGpng._Parent = self
        self._BGpng.AddLabel("No timezones found on system!", MyLangManager.TrFont("varela22"))
        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()
    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("/")

        icon_for_list = MultiIconItem()
        icon_for_list._ImgSurf = MyIconPool.GiveIconSurface("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

        self._BGpng = IconItem()
        self._BGpng._ImgSurf = MyIconPool.GiveIconSurface("empty")
        self._BGpng._MyType = ICON_TYPES["STAT"]
        self._BGpng._Parent = self
        self._BGpng.AddLabel(MyLangManager.Tr("Please upload data over Wi-Fi"),
                             MyLangManager.TrFont("varela22"))
        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()