def Click(self): if len(self._MyList) == 0: return if self._PsIndex > len(self._MyList) - 1: return cur_li = self._MyList[self._PsIndex] if cur_li._MyType == ICON_TYPES["DIR"]: if cur_li._Path == "[..]": self._MyStack.Pop() self.SyncList( self._MyStack.Last() ) self._PsIndex = 0 else: self._MyStack.Push( self._MyList[self._PsIndex]._Path ) self.SyncList( self._MyStack.Last() ) self._PsIndex = 0 if cur_li._MyType == ICON_TYPES["FILE"]: self._Screen._MsgBox.SetText("Launching") self._Screen._MsgBox.Draw() self._Screen.SwapAndShow() if self._Emulator["FILETYPE"] == "dir": path = cur_li._Path +"/"+self._Emulator["EXT"][0] else: path = cur_li._Path print("Run ",path) if self._Emulator["FILETYPE"] == "dir": escaped_path = CmdClean(path) else: escaped_path = CmdClean(path) custom_config = "" if self._Emulator["RETRO_CONFIG"] != "" and len(self._Emulator["RETRO_CONFIG"]) > 5: custom_config = " -c " + self._Emulator["RETRO_CONFIG"] cmdpath = " ".join( (self._Emulator["LAUNCHER"],self._Emulator["ROM_SO"], custom_config, escaped_path)) if self._Emulator["ROM_SO"] =="": #empty means No needs for rom so pygame.event.post( pygame.event.Event(RUNEVT, message=cmdpath)) else: if FileExists(self._Emulator["ROM_SO"]): pygame.event.post( pygame.event.Event(RUNEVT, message=cmdpath)) else: self._Screen.PushPage(self._RomSoConfirmDownloadPage) self._Screen.Draw() self._Screen.SwapAndShow() return self._Screen.Draw() self._Screen.SwapAndShow()
def Click(self): cur_li = self._MyList[self._PsIndex] if cur_li._MyType == ICON_TYPES["DIR"]: return if cur_li._MyType == ICON_TYPES["FILE"]: ## add to playlist only self._Screen._MsgBox.SetText("Launching...") self._Screen._MsgBox.Draw() self._Screen.SwapAndShow() print("Run ", cur_li._Path) # check ROM_SO exists if FileExists(self._Emulator["ROM_SO"]): escaped_path = CmdClean(cur_li._Path) cmdpath = " ".join((self._Emulator["LAUNCHER"], self._Emulator["ROM_SO"], escaped_path)) pygame.event.post(pygame.event.Event(RUNEVT, message=cmdpath)) return else: self._Screen.PushPage(self._RomSoConfirmDownloadPage) self._Screen.Draw() self._Screen.SwapAndShow() return self._Screen.Draw() self._Screen.SwapAndShow()
def GObjectUpdateProcessInterval(self): if self._Screen.CurPage() == self: if self._Downloader.isFinished(): if self._Downloader.isSuccessful(): print("Success!") # Do something with obj.get_dest() filename = self._Downloader.get_dest() if filename.endswith(".tar.gz"): #/home/cpi/apps/[launcher] cmdpath = "tar zxf " + CmdClean( filename ) + " -C /home/cpi/apps ;rm -rf " + filename pygame.event.post( pygame.event.Event(RUNEVT, message=cmdpath)) self.ReturnToUpLevelPage() self._Screen.Draw() self._Screen.SwapAndShow() else: print("Download failed with the following exceptions:") for e in self._Downloader.get_errors(): print(unicode(e)) try: self._Downloader.stop() except: pass filename = self._Downloader.get_dest() print(filename) os.system("rm -rf %s" % CmdClean(filename)) self._Screen._MsgBox.SetText("Download failed") self._Screen._MsgBox.Draw() self._Screen.SwapAndShow() return False else: self._Value = self._Downloader.get_progress() print("Progress: %d%%" % (self._Value)) self._Screen.Draw() self._Screen.SwapAndShow() return True else: return False
def ConfirmBoxCallbackA(self): if len(self._MyList) == 0: return cur_li = self._MyList[self._PsIndex] os.system("rm %s" % CmdClean(cur_li._Flag)) self.GenList() self.RefreshPsIndex()
def Click(self): if len(self._MyList) == 0: return if self._PsIndex > len(self._MyList) - 1: return cur_li = self._MyList[self._PsIndex] if cur_li._MyType == ICON_TYPES["DIR"]: return if cur_li._MyType == ICON_TYPES["FILE"]: ## add to playlist only self._Screen._MsgBox.SetText("Launching...") self._Screen._MsgBox.Draw() self._Screen.SwapAndShow() if self._Emulator["FILETYPE"] == "dir": path = cur_li._Path + "/" + self._Emulator["EXT"][0] else: path = cur_li._Path print("Run ", path) # check ROM_SO exists if FileExists(self._Emulator["ROM_SO"]): escaped_path = CmdClean(path) custom_config = "" if self._Emulator["RETRO_CONFIG"] != "" and len( self._Emulator["RETRO_CONFIG"]) > 5: custom_config = " -c " + self._Emulator["RETRO_CONFIG"] cmdpath = " ".join( (self._Emulator["LAUNCHER"], self._Emulator["ROM_SO"], custom_config, escaped_path)) pygame.event.post(pygame.event.Event(RUNEVT, message=cmdpath)) return else: self._Screen.PushPage(self._RomSoConfirmDownloadPage) self._Screen.Draw() self._Screen.SwapAndShow() return self._Screen.Draw() self._Screen.SwapAndShow()
def KeyDown(self, event): if event.key == CurKeys["Menu"]: self.ReturnToUpLevelPage() self._Screen.Draw() self._Screen.SwapAndShow() if event.key == CurKeys["Right"]: self._Screen.PushCurPage() self._Screen.SetCurPage(self._Parent.FavListPage) self._Screen.Draw() self._Screen.SwapAndShow() if event.key == CurKeys["Up"]: self.SpeedScroll(event.key) self.ScrollUp() self._Screen.Draw() self._Screen.SwapAndShow() if event.key == CurKeys["Down"]: self.SpeedScroll(event.key) self.ScrollDown() self._Screen.Draw() self._Screen.SwapAndShow() if event.key == CurKeys["Enter"]: self.Click() if event.key == CurKeys["A"]: if len(self._MyList) == 0: return cur_li = self._MyList[self._PsIndex] if cur_li.IsFile(): # remove any dup first try: os.system("chgrp " + self._Parent._FavGname + " " + CmdClean(cur_li._Path)) except: pass self._Screen._MsgBox.SetText("AddFavList") self._Screen._MsgBox.Draw() self._Screen.SwapAndShow() pygame.time.delay(600) self.ReScan() self._Screen.Draw() self._Screen.SwapAndShow() if event.key == CurKeys["X"]: #Scan current self.ReScan() self._Screen.Draw() self._Screen.SwapAndShow() if event.key == CurKeys["Y"]: #del if len(self._MyList) == 0: return cur_li = self._MyList[self._PsIndex] if cur_li.IsFile(): self._Parent.DeleteConfirmPage.SetFileName(cur_li._Path) self._Parent.DeleteConfirmPage.SetTrashDir( self._Emulator["ROM"] + "/.Trash") self._Screen.PushCurPage() self._Screen.SetCurPage(self._Parent.DeleteConfirmPage) self._Screen.Draw() self._Screen.SwapAndShow()