def SyncList(self): self._MyList = [] start_x = 0 start_y = 0 if myvars.Poller == None: return play_list = myvars.Poller.playlist() for i, v in enumerate(play_list): li = ListItem() li._Parent = self li._PosX = start_x li._PosY = start_y + i * ListItem._Height li._Width = Width li._Fonts["normal"] = self._ListFont if "title" in v: if isinstance(v["title"], (list, )): li.Init(" | ".join(v["title"])) else: li.Init(v["title"]) if "file" in v: li._Path = v["file"] elif "file" in v: li.Init(os.path.basename(v["file"])) li._Path = v["file"] else: li.Init("NoName") li._Labels["Text"]._PosX = 7 self._MyList.append(li) self.SyncPlaying()
def SyncList(self,path): alist = self.buildDirectoryList(path) if not alist: print("buildDirectoryList empty") return self._MyList = [] self._SwapMyList = [] start_x = 0 start_y = 0 hasparent = 0 if self._MyStack.Length() > 0: hasparent = 1 li = ListItem() li._Parent = self li._PosX = start_x li._PosY = start_y li._Width = Width li._Fonts["normal"] = self._ListFont li._MyType = ICON_TYPES["DIR"] li.Init("[..]") self._MyList.append(li) for i,v in enumerate(sorted(alist)): li = ListItem() li._Parent = self li._PosX = start_x li._PosY = start_y + (i+hasparent)*ListItem._Height li._Width = Width li._Fonts["normal"] = self._ListFont li._MyType = ICON_TYPES["FILE"] if not v['is_file']: li._MyType = ICON_TYPES["DIR"] else: li._MyType = ICON_TYPES["FILE"] li.Init( v['name'] ) li._Path = v["file_path"] self._MyList.append(li) for i in self._MyList: self._SwapMyList.append(i)
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 = InfoPageSelector() ps._Parent = self ps._PosX = 2 self._Ps = ps self._PsIndex = 0 # "" pkgname, label alist = [["", "Airplane", "Airplane Mode"], ["", "PowerOptions", "Power Options"], ["", "Wifi", "Wi-Fi"], ["", "Bluetooth", "Bluetooth"], ["", "Sound", "Sound Volume"], ["", "Brightness", "BackLight Brightness"], ["", "Storage", ""], ["", "Time", "Timezone"], ["", "Languages", "Languages"], ["", "Notification", "Notification"], ["", "Update", ""], ["", "About", "About"], ["", "PowerOFF", "Power off"], ["", "ButtonsLayout", "Buttons Layout"], ["", "LauncherGo", "Switch to LauncherGo"], ["", "Lima", "GPU driver switch"], ["", "GateWay", "Network gateway switch"]] start_x = 0 start_y = 0 sys.path.append(myvars.basepath) # add self as import path for i, v in enumerate(alist): li = ListItem() li._Parent = self li._PosX = start_x li._PosY = start_y + i * ListItem._Height li._Width = Width li._Fonts["normal"] = self._ListFontObj if v[2] != "": li.Init(v[2]) else: li.Init(v[1]) #if v[1] == "Wifi" or v[1] == "Sound" or v[1] == "Brightness" or v[1] == "Storage" or v[1] == "Update" or v[1] == "About" or v[1] == "PowerOFF" or v[1] == "HelloWorld": if FileExists(myvars.basepath + "/" + v[1]): li._LinkObj = __import__(v[1]) init_cb = getattr(li._LinkObj, "Init", None) if init_cb != None: if callable(init_cb): li._LinkObj.Init(self._Screen) self._MyList.append(li) self._Scroller = ListScroller() self._Scroller._Parent = self self._Scroller._PosX = self._Width - 10 self._Scroller._PosY = 2 self._Scroller.Init()
def SyncList(self,path): alist = self.GeneratePathList(path) if alist == False: print("listfiles return false") return self._MyList = [] start_x = 0 start_y = 0 hasparent = 0 if self._MyStack.Length() > 0: hasparent = 1 li = ListItem() li._Parent = self li._PosX = start_x li._PosY = start_y li._Width = Width li._Fonts["normal"] = self._ListFont li._MyType = ICON_TYPES["DIR"] li._Parent = self li.Init("[..]") self._MyList.append(li) for i,v in enumerate(sorted(alist)): li = ListItem() li._Parent = self li._PosX = start_x li._PosY = start_y + (i+hasparent)*ListItem._Height li._Width = Width li._Fonts["normal"] = self._ListFont li._MyType = ICON_TYPES["FILE"] li._Parent = self if "directory" in v: li._MyType = ICON_TYPES["DIR"] li.Init(v["directory"]) elif "file" in v: li.Init(v["file"]) else: li.Init("NoName") self._MyList.append(li)
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 # "" pkgname, label alist = [["", "Wifi", "Wi-Fi"], ["", "Sound", "Sound Volume"], ["", "Brightness", "BackLight Brightness"], ["", "Storage", ""], ["", "Update", ""], ["", "About", "About"], ["", "PowerOFF", "Power off"]] start_x = 0 start_y = 0 sys.path.append(myvars.basepath) # add self as import path for i, v in enumerate(alist): li = ListItem() li._Parent = self li._PosX = start_x li._PosY = start_y + i * ListItem._Height li._Width = Width li._Fonts["normal"] = self._ListFontObj if v[2] != "": li.Init(v[2]) else: li.Init(v[1]) if v[1] == "Wifi" or v[1] == "Sound" or v[1] == "Brightness" or v[ 1] == "Storage" or v[1] == "Update" or v[ 1] == "About" or v[1] == "PowerOFF": li._LinkObj = __import__(v[1]) init_cb = getattr(li._LinkObj, "Init", None) if init_cb != None: if callable(init_cb): li._LinkObj.Init(self._Screen) self._MyList.append(li) 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 = InfoPageSelector() ps._Parent = self ps._PosX = 2 self._Ps = ps self._PsIndex = 0 # "" pkgname, label alist = [ # ["","Airplane","Airplane Mode"], # haven't looked at this yet ["", "PowerOptions", "Power Options"], # haven't looked at this yet # ["","Wifi","Wi-Fi"], # currently lists networks, but doesn't know we're connected ["", "Bluetooth", "Bluetooth" ], # haven't looked at this much yet, but it lists devices ["", "Sound", "Sound Volume"], ["", "Brightness", "BackLight Brightness"], ["", "Storage", ""], # reports 6.6gb of total storage? I thought CHIP was 4gb # ["","Time","Timezone"], # lists timezones, but hangs on selection ["", "Languages", "Languages"], # works, but haven't localized new stuff yet # ["","Notification","Notification"], # ["","Update", ""], # not needed, we can update manually for now ["", "About", "About"], # ["","PowerOFF","Power OFF"], # ["","ButtonsLayout","Buttons Layout"], # not needed, this is just for switching between snes/xbox layouts # ["","LauncherGo","Switch to LauncherGo"], # not needed # ["","Lima","GPU driver switch"], # not needed # ["","GateWay","Network gateway switch"] # haven't looked at this yet ] start_x = 0 start_y = 0 sys.path.append(myvars.basepath) # add self as import path for i, v in enumerate(alist): li = ListItem() li._Parent = self li._PosX = start_x li._PosY = start_y + i * ListItem._Height li._Width = Width li._Fonts["normal"] = self._ListFontObj if v[2] != "": li.Init(v[2]) else: li.Init(v[1]) #if v[1] == "Wifi" or v[1] == "Sound" or v[1] == "Brightness" or v[1] == "Storage" or v[1] == "Update" or v[1] == "About" or v[1] == "PowerOFF" or v[1] == "HelloWorld": if FileExists(myvars.basepath + "/" + v[1]): li._LinkObj = __import__(v[1]) init_cb = getattr(li._LinkObj, "Init", None) if init_cb != None: if callable(init_cb): li._LinkObj.Init(self._Screen) self._MyList.append(li) self._Scroller = ListScroller() self._Scroller._Parent = self self._Scroller._PosX = self._Width - 10 self._Scroller._PosY = 2 self._Scroller.Init()