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._PngSize["bg"] = (48, 79)
        self._PngSize["needwifi_bg"] = (253, 132)

        bgpng = IconItem()
        bgpng._ImgSurf = MyIconPool.GiveIconSurface("rom_download")
        bgpng._MyType = ICON_TYPES["STAT"]
        bgpng._Parent = self
        bgpng.Adjust(0, 0, self._PngSize["bg"][0], self._PngSize["bg"][1], 0)
        self._Icons["bg"] = bgpng

        needwifi_bg = IconItem()
        needwifi_bg._ImgSurf = MyIconPool.GiveIconSurface("needwifi_bg")
        needwifi_bg._MyType = ICON_TYPES["STAT"]
        needwifi_bg._Parent = self
        needwifi_bg.Adjust(0, 0, self._PngSize["needwifi_bg"][0],
                           self._PngSize["needwifi_bg"][1], 0)

        self._Icons["needwifi_bg"] = needwifi_bg

        self._FileNameLabel = Label()
        self._FileNameLabel.SetCanvasHWND(self._CanvasHWND)
        self._FileNameLabel.Init("", MyLangManager.TrFont("varela12"))

        self._SizeLabel = Label()
        self._SizeLabel.SetCanvasHWND(self._CanvasHWND)
        self._SizeLabel.Init("0/0Kb", MyLangManager.TrFont("varela12"))
        self._SizeLabel.SetColor(self._URLColor)
Ejemplo n.º 2
0
    def Init(self):

        
        if self._Screen != None:
            if self._Screen._CanvasHWND != None and self._CanvasHWND == None:
                self._HWND = self._Screen._CanvasHWND
                self._CanvasHWND = pygame.Surface( (self._Screen._Width,self._Screen._Height) )
        
        self._PosX = self._Index*self._Screen._Width 
        self._Width = self._Screen._Width ## equal to screen width
        self._Height = self._Screen._Height

        self._PngSize["bg"] = (253,114)
        self._PngSize["online"] = (75,122)
        
        bgpng = IconItem()
        bgpng._ImgSurf = MyIconPool.GiveIconSurface("needwifi_bg")
        bgpng._MyType = ICON_TYPES["STAT"]
        bgpng._Parent = self
        bgpng.Adjust(0,0,self._PngSize["bg"][0],self._PngSize["bg"][1],0)

        self._Icons["bg"] = bgpng
        
        onlinepng = IconItem()
        onlinepng._ImgSurf = MyIconPool.GiveIconSurface("online")
        onlinepng._MyType = ICON_TYPES["STAT"]
        onlinepng._Parent = self
        onlinepng.Adjust(0,0,self._PngSize["online"][0], self._PngSize["online"][1],0)

        self._Icons["online"] = onlinepng

        self.SetLabels()
Ejemplo n.º 3
0
    def Init(self):
        if self._Screen != None:
            if self._Screen._CanvasHWND != None and self._CanvasHWND == None:
                self._HWND = self._Screen._CanvasHWND
                self._CanvasHWND = pygame.Surface(
                    (self._Screen._Width, self._BGheight))

        self._PosX = self._Index * self._Screen._Width
        self._Width = self._Screen._Width  ## equal to screen width
        self._Height = self._Screen._Height

        airwire = IconItem()
        airwire._ImgSurf = MyIconPool.GiveIconSurface("airwire")
        airwire._MyType = ICON_TYPES["STAT"]
        airwire._Parent = self
        airwire.Adjust(0, 0, 5, 43, 0)
        self._Icons["airwire"] = airwire

        GS = IconItem()
        GS._ImgSurf = MyIconPool.GiveIconSurface("GS")
        GS._MyType = ICON_TYPES["STAT"]
        GS._Parent = self
        GS.Adjust(0, 0, 72, 95, 0)
        self._Icons["GS"] = GS

        DialogBoxs = MultiIconItem()
        DialogBoxs._ImgSurf = MyIconPool.GiveIconSurface("DialogBoxs")
        DialogBoxs._MyType = ICON_TYPES["STAT"]
        DialogBoxs._Parent = self
        DialogBoxs._IconWidth = 134
        DialogBoxs._IconHeight = 93
        DialogBoxs.Adjust(0, 0, 134, 372, 0)
        self._Icons["DialogBoxs"] = DialogBoxs
        """
        bgpng = MultiIconItem()
        bgpng._ImgSurf = MyIconPool.GiveIconSurface("about_bg")
        bgpng._MyType = ICON_TYPES["STAT"]
        bgpng._Parent = self
        bgpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
        self._Icons["bg"] = bgpng
        """

        self.GenList()

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

        self.OnLoadCb()
Ejemplo n.º 4
0
    def Init(self, text):

        #self._Fonts["normal"] = fonts["veramono12"]

        l = Label()
        l._PosX = 10
        l.SetCanvasHWND(self._Parent._CanvasHWND)

        l.Init(text, self._Fonts["normal"])
        self._Labels["Text"] = l

        add_icon = IconItem()
        add_icon._ImgSurf = MyIconPool.GiveIconSurface("add")
        add_icon._CanvasHWND = self._CanvasHWND
        add_icon._Parent = self
        add_icon.Init(0, 0, MyIconPool.Width("add"), MyIconPool.Height("add"),
                      0)

        ware_icon = IconItem()
        ware_icon._ImgSurf = MyIconPool.GiveIconSurface("ware")
        ware_icon._CanvasHWND = self._CanvasHWND
        ware_icon._Parent = self
        ware_icon.Init(0, 0, MyIconPool.Width("ware"),
                       MyIconPool.Height("ware"), 0)

        app_icon = IconItem()
        app_icon._ImgSurf = MyIconPool.GiveIconSurface("app")
        app_icon._CanvasHWND = self._CanvasHWND
        app_icon._Parent = self
        app_icon.Init(0, 0, MyIconPool.Width("app"), MyIconPool.Height("app"),
                      0)

        appdling_icon = IconItem()
        appdling_icon._ImgSurf = MyIconPool.GiveIconSurface("appdling")
        appdling_icon._CanvasHWND = self._CanvasHWND
        appdling_icon._Parent = self
        appdling_icon.Init(0, 0, MyIconPool.Width("appdling"),
                           MyIconPool.Height("appdling"), 0)

        blackheart_icon = IconItem()
        blackheart_icon._ImgSurf = MyIconPool.GiveIconSurface("blackheart")
        blackheart_icon._Width = MyIconPool.Width("blackheart")
        blackheart_icon._Height = MyIconPool.Height("blackheart")
        blackheart_icon._CanvasHWND = self._CanvasHWND
        blackheart_icon._Parent = self

        self._Icons["add"] = add_icon
        self._Icons["ware"] = ware_icon
        self._Icons["app"] = app_icon
        self._Icons["appdling"] = appdling_icon
        self._Icons["blackheart"] = blackheart_icon
Ejemplo n.º 5
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)
    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.GiveIconSurface("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()
Ejemplo n.º 7
0
    def Init(self):
        if self._Screen != None:
            if self._Screen._CanvasHWND != None and self._CanvasHWND == None:
                self._HWND = self._Screen._CanvasHWND
                self._CanvasHWND = pygame.Surface(
                    (self._Screen._Width, self._BGheight))

        self._PosX = self._Index * self._Screen._Width
        self._Width = self._Screen._Width  ## equal to screen width
        self._Height = self._Screen._Height

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

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

        self.GenList()

        self._Scroller = ListScroller()
        self._Scroller._Parent = self
        self._Scroller._PosX = self._Width - 10
        self._Scroller._PosY = 2
        self._Scroller.Init()
        self._Scroller.SetCanvasHWND(self._HWND)
Ejemplo n.º 8
0
    def Init(self):
        if self._Screen != None:
            if self._Screen._CanvasHWND != None and self._CanvasHWND == None:
                self._HWND = self._Screen._CanvasHWND
                self._CanvasHWND = pygame.Surface(
                    (self._Screen._Width, self._BGheight + 50))

        self._PosX = self._Index * self._Screen._Width
        self._Width = self._Screen._Width  ## equal to screen width
        self._Height = self._Screen._Height

        bgpng = MultiIconItem()
        bgpng._ImgSurf = MyIconPool.GiveIconSurface("about_bg")
        bgpng._MyType = ICON_TYPES["STAT"]
        bgpng._Parent = self
        bgpng.Adjust(0, 0, self._BGwidth, self._BGheight, 0)

        self._Icons["bg"] = bgpng

        self.CpuInfo()
        self.MemInfo()
        self.CpuMhz()
        self.Uname()

        self.LauncherVersion()
        self.OsImageVersion()

        self.GenList()

        self._Scroller = ListScroller()
        self._Scroller._Parent = self
        self._Scroller._PosX = self._Width - 10
        self._Scroller._PosY = 2
        self._Scroller.Init()
        self._Scroller.SetCanvasHWND(self._HWND)
Ejemplo n.º 9
0
    def Init(self):
        if self._Screen != None:
            if self._Screen._CanvasHWND != None and self._CanvasHWND == None:
                self._HWND = self._Screen._CanvasHWND
                self._CanvasHWND = pygame.Surface(
                    (self._Screen._Width, self._BGheight))

        self._PosX = self._Index * self._Screen._Width
        self._Width = self._Screen._Width  ## equal to screen width
        self._Height = self._Screen._Height

        DialogBoxs = MultiIconItem()
        DialogBoxs._ImgSurf = MyIconPool.GiveIconSurface("buttonslayout")
        DialogBoxs._MyType = ICON_TYPES["STAT"]
        DialogBoxs._Parent = self
        DialogBoxs._IconWidth = 300
        DialogBoxs._IconHeight = 150
        DialogBoxs.Adjust(0, 0, 134, 372, 0)
        self._Icons["DialogBoxs"] = DialogBoxs

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

        self._ConfirmPage = UpdateConfirmPage()
        self._ConfirmPage._LayoutMode = GetButtonsLayoutMode()
        self._ConfirmPage._Screen = self._Screen
        self._ConfirmPage._Name = "Overwrite RA conf"
        self._ConfirmPage._Parent = self
        self._ConfirmPage.Init()
Ejemplo n.º 10
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.GiveIconSurface("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.GiveIconSurface("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.GiveIconSurface("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.GiveIconSurface("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('Text'))


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

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


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

        
        self.Start()
Ejemplo n.º 11
0
    def Init(self):
        if self._Screen != None:
            if self._Screen._CanvasHWND != None and self._CanvasHWND == None:
                self._HWND = self._Screen._CanvasHWND
                self._CanvasHWND = pygame.Surface(
                    (self._Screen._Width, self._BGheight))

        self._PosX = self._Index * self._Screen._Width
        self._Width = self._Screen._Width  ## equal to screen width
        self._Height = self._Screen._Height

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

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

        self.SyncList()

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

        self._remove_page = YesCancelConfirmPage()
        self._remove_page._Screen = self._Screen
        self._remove_page._StartOrA_Event = self.RemoveGame

        self._remove_page._Name = "Are you sure?"
        self._remove_page.Init()

        self._Keyboard = Keyboard()
        self._Keyboard._Name = "Enter warehouse addr"
        self._Keyboard._FootMsg = ["Nav.", "Add", "ABC", "Backspace", "Enter"]
        self._Keyboard._Screen = self._Screen
        self._Keyboard.Init()
        self._Keyboard.SetPassword("github.com/clockworkpi/warehouse")
        self._Keyboard._Caller = self

        self._PreviewPage = ImageDownloadProcessPage()
        self._PreviewPage._Screen = self._Screen
        self._PreviewPage._Name = "Preview"
        self._PreviewPage.Init()

        self._LoadHousePage = LoadHousePage()
        self._LoadHousePage._Screen = self._Screen
        self._LoadHousePage._Name = "Warehouse"
        self._LoadHousePage._Caller = self
        self._LoadHousePage.Init()
Ejemplo n.º 12
0
    def Init(self):
        self._Width = self._Parent._Width
        self._Height = self._Parent._Height
        
        self._BGpng = IconItem()
        self._BGpng._ImgSurf = MyIconPool.GiveIconSurface("vol")
        self._BGpng._MyType = ICON_TYPES["STAT"]
        self._BGpng._Parent = self
        self._BGpng.Adjust(0,0,self._BGwidth,self._BGheight,0)

        ##self._NeedleSurf = pygame.Surface( (38,12),pygame.SRCALPHA )
        
        self._Scale = MultiIconItem()
        self._Scale._MyType = ICON_TYPES["STAT"]
        self._Scale._Parent = self
        self._Scale._ImgSurf = MyIconPool.GiveIconSurface("scale")
        self._Scale._IconWidth = 82
        self._Scale._IconHeight = 63
        self._Scale.Adjust(0,0,82,63,0)
Ejemplo n.º 13
0
 def load_icons(self):
     """
     basepath = os.path.dirname(os.path.realpath(__file__))
     files = os.listdir(basepath+"/icons")
     for i in files:
         if os.path.isfile(basepath+"/"+i) and i.endswith(".png"):
             keyname = i.split(".")[0]
             self._Icons[keyname] = pygame.image.load(basepath+"/"+i).convert_alpha()
     """
     self._Icons["sys"] = MyIconPool.GiveIconSurface("sys")
    def Init(self):
        self._Width = self._Parent._Width
        self._Height = self._Parent._Height

        bgpng = IconItem()
        bgpng._ImgSurf = MyIconPool.GiveIconSurface("light")
        bgpng._MyType = ICON_TYPES["STAT"]
        bgpng._Parent = self
        bgpng.Adjust(0, 0, self._BGwidth, self._BGheight, 0)
        self._Icons["bg"] = bgpng
        ##self._NeedleSurf = pygame.Surface( (38,12),pygame.SRCALPHA )

        scale = MultiIconItem()
        scale._MyType = ICON_TYPES["STAT"]
        scale._Parent = self
        scale._ImgSurf = MyIconPool.GiveIconSurface("scale")
        scale._IconWidth = 82
        scale._IconHeight = 63
        scale.Adjust(0, 0, 82, 63, 0)
        self._Icons["scale"] = scale
    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.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("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()
Ejemplo n.º 16
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.GiveIconSurface("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
Ejemplo n.º 17
0
    def Init(self, text):

        #self._Fonts["normal"] = fonts["veramono12"]
        self._CanvasHWND = self._Parent._CanvasHWND

        l = Label()
        l._PosX = 10
        l.SetCanvasHWND(self._Parent._CanvasHWND)

        l.Init(text, self._Fonts["normal"])
        self._Labels["Text"] = l

        done_icon = IconItem()
        done_icon._ImgSurf = MyIconPool.GiveIconSurface("done")
        done_icon._CanvasHWND = self._Parent._CanvasHWND
        done_icon._Parent = self

        self._Icons["done"] = done_icon
Ejemplo n.º 18
0
    def Init(self, path, object):
        self._Path = path
        self._Atts = object

        is_active = False
        if "Address" in object:
            self._MacAddr = object["Address"]

        if "Connected" in object:
            if object["Connected"] == 1:
                is_active = True

        if is_active:
            self.SetActive(is_active)

        name_label = Label()
        name_label._PosX = 12
        name_label._CanvasHWND = self._Parent._CanvasHWND

        mac_addr = self._MacAddr

        if "Name" in object:
            if len(object["Name"]) > 3:
                mac_addr = object["Name"]

        if "RSSI" in object:
            print(object["RSSI"])
            self._RSSI = int(object["RSSI"])

        mac_addr = mac_addr[:34]

        name_label.Init(mac_addr, self._FontObj)

        self._Labels["mac_addr"] = name_label

        done_icon = NetItemIcon()
        done_icon._ImgSurf = MyIconPool.GiveIconSurface("done")
        done_icon._CanvasHWND = self._Parent._CanvasHWND
        done_icon._Parent = self

        self._Icons["done"] = done_icon
Ejemplo n.º 19
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._BGpng = IconItem()
        self._BGpng._ImgSurf = MyIconPool.GiveIconSurface(self._BG)
        self._BGpng._MyType = ICON_TYPES["STAT"]
        self._BGpng._Parent = self
        #print( MyIconPool.Width(self._BG),MyIconPool.Height(self._BG) )
        self._BGpng.Adjust(0, 0, MyIconPool.Width(self._BG),
                           MyIconPool.Height(self._BG), 0)

        self._Board = Textbulletinboard()

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

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

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

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

                self._Board.SetAndBlitText(d)
Ejemplo n.º 20
0
    def Init(self):
        self._CanvasHWND = self._Screen._CanvasHWND
        self.ReadLayoutFile(self._KeyboardLayoutFile)  ## assign to _Secs
        self._SectionNumbers = len(self._Secs)
        self._PosX = self._Index * self._Screen._Width
        self._Width = self._Screen._Width
        self._Height = self._Screen._Height

        fontobj = MySkinManager.GiveFont("veramono24")
        word_margin = 15

        start_x = (self._Width - fontobj.size("".join(self._Secs[0][0]))[0] -
                   len(self._Secs[0][0]) * word_margin) / 2 + word_margin / 2
        start_y = 0
        cnt = 0
        for i in range(0, self._SectionNumbers):
            self._SecsKeys[i] = []
            for j in range(0, len(self._Secs[i])):
                self._SecsKeys[i].append([])

                start_x = (
                    self._Width - fontobj.size("".join(self._Secs[i][j]))[0] -
                    len(self._Secs[i][j]) * word_margin) / 2 + word_margin / 2
                start_x = start_x + i * Width
                start_y = 84 + j * (word_margin + 14)
                for idx, val in enumerate(self._Secs[i][j]):
                    ti = TextItem()
                    ti._FontObj = fontobj
                    ti._Parent = self

                    if val == "_L" or val == "_R":
                        it = KeyboardIcon()
                        it._ImgSurf = MyIconPool.GiveIconSurface(val)
                        it._Parent = self
                        it._Str = val
                        it.Init(start_x + it._ImgSurf.get_width() / 2, start_y,
                                it._ImgSurf.get_width(),
                                it._ImgSurf.get_height(), 0)
                        #self._Icons[val] = it
                        self._SecsKeys[i][j].append(it)
                        self._IconNumbers += 1
                        start_x = start_x + it._ImgSurf.get_width(
                        ) + word_margin

                    else:
                        if val == "_S":
                            val = "Space"
                            ti._FontObj = MySkinManager.GiveFont("veramono15")
                            ti._Bold = True

                        cur_alpha_size = ti._FontObj.size(val)
                        ti.Init(start_x + cur_alpha_size[0] / 2, start_y,
                                cur_alpha_size[0], cur_alpha_size[1], 0)
                        ti._Str = val

                        start_x = start_x + cur_alpha_size[
                            0] + word_margin  # prepare for next alpha
                        self._SecsKeys[i][j].append(ti)

        self._SectionIndex = 0

        self._Textarea = Textarea()

        self._Textarea._PosX = 4
        self._Textarea._PosY = 4
        self._Textarea._Width = self._Width - 4 * 2
        self._Textarea._Height = 60
        self._Textarea._CanvasHWND = self._CanvasHWND
        self._Textarea.Init()

        ps = KeyboardSelector()
        ps._Parent = self
        ps.Init(start_x, start_y, 25, 25, 128)
        self._Ps = ps
        self._PsIndex = 0
        self._Ps._OnShow = True
Ejemplo n.º 21
0
    def Init(self, i, is_active):
        # Pick which strength measure to use based on what the daemon says
        # gap allocates more space to the first module
        if self._Parent._Daemon.GetSignalDisplayType() == 0:
            strenstr = 'quality'
            gap = 4  # Allow for 100%
        else:
            strenstr = 'strength'
            gap = 7  # -XX dbm = 7
        self._NetId = i
        # All of that network property stuff
        self._Stren = self._Parent._Daemon.FormatSignalForPrinting(
            str(
                self._Parent._Wireless.GetWirelessProperty(
                    self._NetId, strenstr)))

        self._Essid = self._Parent._Wireless.GetWirelessProperty(
            self._NetId, 'essid')
        self._Bssid = self._Parent._Wireless.GetWirelessProperty(
            self._NetId, 'bssid')

        if self._Parent._Wireless.GetWirelessProperty(self._NetId,
                                                      'encryption'):
            self._Encrypt = \
                self._Parent._Wireless.GetWirelessProperty(self._NetId, 'encryption_method')
        else:
            self._Encrypt = 'Unsecured'

        self._Mode = \
            self._Parent._Wireless.GetWirelessProperty(self._NetId, 'mode')  # Master, Ad-Hoc
        self._Channel = self._Parent._Wireless.GetWirelessProperty(
            self._NetId, 'channel')
        theString = '  %-*s %25s %9s %17s %6s %4s' % \
            (gap, self._Stren, self._Essid, self._Encrypt, self._Bssid, self._Mode,
                self._Channel)

        if is_active:
            theString = ">> " + theString[1:]
            self.SetActive(is_active)

        essid_label = Label()
        essid_label._PosX = 36
        #essid_label._PosY = self._PosY +  (self._Height - self._FontObj.render(self._Essid,True,(83,83,83)).get_height())/2
        essid_label._CanvasHWND = self._Parent._CanvasHWND

        if len(self._Essid) > 19:
            essid_ = self._Essid[:20]
        else:
            essid_ = self._Essid

        essid_label.Init(essid_, self._FontObj)
        self._Labels["essid"] = essid_label

        stren_label = Label()
        #stren_label._PosY = self._PosY +  (self._Height - self._FontObj.render(self._Stren,True,(83,83,83)).get_height())/2
        stren_label._CanvasHWND = self._Parent._CanvasHWND

        stren_label.Init(self._Stren, self._FontObj)
        stren_label._PosX = self._Width - 23 - stren_label.Width() - 2
        self._Labels["stren"] = stren_label

        lock_icon = NetItemIcon()
        lock_icon._ImgSurf = MyIconPool.GiveIconSurface("lock")
        lock_icon._CanvasHWND = self._Parent._CanvasHWND
        lock_icon._Parent = self
        self._Icons["lock"] = lock_icon

        done_icon = NetItemIcon()
        done_icon._ImgSurf = MyIconPool.GiveIconSurface("done")
        done_icon._CanvasHWND = self._Parent._CanvasHWND
        done_icon._Parent = self

        self._Icons["done"] = done_icon

        ## reuse the resource from TitleBar
        nimt = NetItemMultiIcon()
        nimt._ImgSurf = self._Parent._Screen._TitleBar._Icons[
            "wifistatus"]._ImgSurf
        nimt._CanvasHWND = self._Parent._CanvasHWND
        nimt._Parent = self
        self._Icons["wifistatus"] = nimt
    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"])

        ### will also mkdir of the ***ROM self
        try:
            os.makedirs(self._Emulator["ROM"] + "/.Trash")
        except OSError:
            if not os.path.isdir(self._Emulator["ROM"] + "/.Trash"):
                raise

        try:
            os.makedirs(self._Emulator["ROM"] + "/.Fav")
        except OSError:
            if not os.path.isdir(self._Emulator["ROM"] + "/.Fav"):
                raise

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