Esempio n. 1
0
def setMediaPath(file=None):
    global mediaFolder
    if(file == None):
        FileChooser.pickMediaPath()
    else:	
        FileChooser.setMediaPath( file )
    mediaFolder = getMediaPath()
    return mediaFolder
Esempio n. 2
0
def setMediaPath(file=None):
    global mediaFolder
    if (file == None):
        FileChooser.pickMediaPath()
    else:
        FileChooser.setMediaPath(file)
    mediaFolder = getMediaPath()
    return mediaFolder
Esempio n. 3
0
    def openSelection(self):
        options = Theme.getSelectionOptions()
        options["textColor"] = (55, 55, 55)
        options["background"] = self.options["background"]
        options["useSidebar"] = False

        if ("selectDescription"
                in self.entryList[self.currentIndex]["options"]):
            options["description"] = self.entryList[
                self.currentIndex]["options"]["selectDescription"]

        if ("folderIcon" in self.options):
            options["folderIcon"] = self.options["folderIcon"]

        if ("fileFilter" in self.entryList[self.currentIndex]["options"]):
            options["fileFilter"] = self.entryList[
                self.currentIndex]["options"]["fileFilter"]

        if ("selectionPath" in self.entryList[self.currentIndex]["options"]):
            selectionPath = self.entryList[
                self.currentIndex]["options"]["selectionPath"]
        else:
            selectionPath = "/"

        self.subComponent = FileChooser.FileChooser(
            self.screen, self.entryList[self.currentIndex]["options"]["name"],
            selectionPath, False, options, self.selectionCallback)
        footer = Footer.Footer([("theme/direction.png", "select")],
                               [("theme/b_button.png", "back"),
                                ("theme/a_button.png", "select")],
                               (255, 255, 255))
        self.subComponent.setFooter(footer)
Esempio n. 4
0
def pickAFolder():
    ## Note: this needs to be done in a threadsafe manner, see FileChooser
    ## for details how this is accomplished.
    dir = FileChooser.pickADirectory()
    if ( dir != None ):
        return dir + os.sep
    return None
Esempio n. 5
0
def pickAFolder():
    ## Note: this needs to be done in a threadsafe manner, see FileChooser
    ## for details how this is accomplished.
    dir = FileChooser.pickADirectory()
    if (dir != None):
        return dir + os.sep
    return None
Esempio n. 6
0
    def installIPK(self):

        print("Opening ipk file selection")
        options = {}
        options["textColor"] = (55, 55, 55)

        options["useSidebar"] = False
        options["useGamelist"] = False
        options["fileFilter"] = [".ipk", ".IPK"]
        options["useFileFilter"] = True
        options["limitSelection"] = False
        options["hideFolders"] = False
        options["selectionPath"] = "/home/retrofw"

        self.subComponent = FileChooser.FileChooser(self.screen,
                                                    "IPK Selection",
                                                    "/home/retrofw", False,
                                                    options,
                                                    self.installIPKCallback)
        footer = Footer.Footer([("theme/direction.png", "select")],
                               [("theme/b_button.png", "back"),
                                ("theme/a_button.png", "select")],
                               (255, 255, 255))
        self.subComponent.setFooter(footer)
        RenderControl.setDirty()
Esempio n. 7
0
    def openSelection(self, current):
        print("Opening selection")
        ResumeHandler.setLastUsedMain(current, self.currentIndex)

        if (current["type"] == "emulator"):
            print("Opening emulator file selection")
            options = {}
            options["textColor"] = (55, 55, 55)
            options["background"] = current["background"]
            options["useSidebar"] = True

            if ("description" in current):
                options["description"] = current["description"]

            if ("folderIcon" in current):
                options["folderIcon"] = current["folderIcon"]

            if ("previews" in current):
                options["previews"] = current["previews"]

            if ("fileFilter" in current):
                options["fileFilter"] = current["fileFilter"]

            self.subComponent = FileChooser.FileChooser(
                self.screen, current["name"], current["selectionPath"], False,
                options, self.emulatorCallback)
            footer = Footer.Footer([("theme/direction.png", "select")],
                                   [("theme/b_button.png", "back"),
                                    ("theme/a_button.png", "select")],
                                   (255, 255, 255))
            self.subComponent.setFooter(footer)

        if (current["type"] == "native"):
            print("Opening native selection")
            options = {}
            options["background"] = current["background"]
            options["useSidebar"] = True
            self.subComponent = NativeAppList.NativeAppList(
                self.screen, current["name"], current["data"], options,
                self.nativeCallback)
            if ("allowEdit" in self.config["options"]
                    and self.config["options"]["allowEdit"]):
                footer = Footer.Footer(
                    [("theme/direction.png", "select")],
                    [("theme/b_button.png", "back"),
                     ("theme/a_button.png", "select"),
                     ("theme/select_button.png", "options")], (255, 255, 255))
            else:
                footer = Footer.Footer([("theme/direction.png", "select")],
                                       [("theme/b_button.png", "back"),
                                        ("theme/a_button.png", "select")],
                                       (255, 255, 255))
            self.subComponent.setFooter(footer)
Esempio n. 8
0
    def onSelect(self):        
        if(self.entryList[self.currentIndex]["type"] == "string"):
            self.subComponent = TextInput.TextInput(self.screen, self.entryList[self.currentIndex]["value"], self.textCallback)
            footer = Footer.Footer([("theme/direction.png","select")], [("theme/b_button.png", "back"), ("theme/a_button.png", "add"), ("theme/start_button.png", "save")], (255,255,255)) 
            self.subComponent.setFooter(footer)          
        if(self.entryList[self.currentIndex]["type"] == "boolean"):
           self.overlay = SelectionMenu.SelectionMenu(self.screen, ["True", "False"], self.booleanCallback)
        if(self.entryList[self.currentIndex]["type"] == "folder"):
            options = {}   
            options["preview"] = False        
            self.subComponent = FileChooser.FileChooser(self.screen, self.entryList[self.currentIndex]["name"] ,self.entryList[self.currentIndex]["value"], True, options, self.fileFolderCallback)
            footer = Footer.Footer([("theme/direction.png","select")], [("theme/b_button.png", "back"), ("theme/a_button.png", "enter"), ("theme/start_button.png", "save")], (255,255,255)) 
            self.subComponent.setFooter(footer)       
        if(self.entryList[self.currentIndex]["type"] == "file"):
            options = {}   
            options["preview"] = False  

            if("filter" in self.entryList[self.currentIndex]["options"]):
                options["fileFilter"] = self.entryList[self.currentIndex]["options"]["filter"]

            self.subComponent = FileChooser.FileChooser(self.screen, self.entryList[self.currentIndex]["name"] ,self.entryList[self.currentIndex]["value"], False, options, self.fileFolderCallback)
            footer = Footer.Footer([("theme/direction.png","select")], [("theme/b_button.png", "back"), ("theme/a_button.png", "select")], (255,255,255)) 
            self.subComponent.setFooter(footer) 
        if(self.entryList[self.currentIndex]["type"] == "image"):
            options = {}   
            options["preview"] = True
            options["useSidebar"] = True
            options["directPreview"] = True 
            options["fileFilter"] = [".png", ".jpg"] 
            options["textColor"] = self.textColor
            options["backgroundColor"] = self.backgroundColor
            self.subComponent = FileChooser.FileChooser(self.screen, self.entryList[self.currentIndex]["name"] ,self.entryList[self.currentIndex]["value"], False, options, self.fileFolderCallback)
            footer = Footer.Footer([("theme/direction.png","select")], [("theme/b_button.png", "back"), ("theme/a_button.png", "select")], (255,255,255)) 
            self.subComponent.setFooter(footer)
        if(self.entryList[self.currentIndex]["type"] == "list"):   
            if("names" in self.entryList[self.currentIndex]["options"]):
                self.overlay = SelectionMenu.SelectionMenu(self.screen, self.entryList[self.currentIndex]["options"]["names"], self.listCallback)
            else:
                self.overlay = SelectionMenu.SelectionMenu(self.screen, self.entryList[self.currentIndex]["options"]["values"], self.listCallback)
Esempio n. 9
0
def pickAFile():
    ## Note: this needs to be done in a threadsafe manner, see FileChooser
    ## for details how this is accomplished.
    return FileChooser.pickAFile()
Esempio n. 10
0
def getMediaPath( filename = "" ):
    return FileChooser.getMediaPath( filename )
Esempio n. 11
0
    def onSelect(self):
        if (self.entryList[self.currentIndex]["type"] == "string"):
            self.subComponent = TextInput.TextInput(
                self.screen, self.entryList[self.currentIndex]["value"],
                self.textCallback)
            footer = Footer.Footer([("theme/direction.png", "select")],
                                   [("theme/b_button.png", "back"),
                                    ("theme/a_button.png", "add"),
                                    ("theme/start_button.png", "save")],
                                   Theme.getColor("settings/footer/fontColor",
                                                  (255, 255, 255)),
                                   Theme.getColor("settings/footer/color",
                                                  (57, 58, 59)))
            self.subComponent.setFooter(footer)
        if (self.entryList[self.currentIndex]["type"] == "boolean"):
            self.overlay = SelectionMenu.SelectionMenu(self.screen,
                                                       ["True", "False"],
                                                       self.booleanCallback)
        if (self.entryList[self.currentIndex]["type"] == "folder"):
            options = Theme.getConfigOptions()
            options["preview"] = False
            self.subComponent = FileChooser.FileChooser(
                self.screen, self.entryList[self.currentIndex]["name"],
                self.entryList[self.currentIndex]["value"], True, options,
                self.fileFolderCallback)
            footer = Footer.Footer([("theme/direction.png", "select")],
                                   [("theme/b_button.png", "back"),
                                    ("theme/a_button.png", "enter"),
                                    ("theme/start_button.png", "save")],
                                   options["footerFontColor"],
                                   options["footerColor"])
            self.subComponent.setFooter(footer)
        if (self.entryList[self.currentIndex]["type"] == "file"):
            options = Theme.getConfigOptions()
            options["preview"] = False

            if ("filter" in self.entryList[self.currentIndex]["options"]):
                options["fileFilter"] = self.entryList[
                    self.currentIndex]["options"]["filter"]

            self.subComponent = FileChooser.FileChooser(
                self.screen, self.entryList[self.currentIndex]["name"],
                self.entryList[self.currentIndex]["value"], False, options,
                self.fileFolderCallback)
            footer = Footer.Footer([("theme/direction.png", "select")],
                                   [("theme/b_button.png", "back"),
                                    ("theme/a_button.png", "select")],
                                   options["footerFontColor"],
                                   options["footerColor"])
            self.subComponent.setFooter(footer)
        if (self.entryList[self.currentIndex]["type"] == "image"):
            options = Theme.getConfigOptions()
            options["preview"] = True
            options["useSidebar"] = True
            options["directPreview"] = True
            options["fileFilter"] = [".png", ".jpg"]

            self.subComponent = FileChooser.FileChooser(
                self.screen, self.entryList[self.currentIndex]["name"],
                self.entryList[self.currentIndex]["value"], False, options,
                self.fileFolderCallback)
            footer = Footer.Footer([("theme/direction.png", "select")],
                                   [("theme/b_button.png", "back"),
                                    ("theme/a_button.png", "select")],
                                   options["footerFontColor"],
                                   options["footerColor"])
            self.subComponent.setFooter(footer)
        if (self.entryList[self.currentIndex]["type"] == "list"):
            if ("names" in self.entryList[self.currentIndex]["options"]):
                self.overlay = SelectionMenu.SelectionMenu(
                    self.screen,
                    self.entryList[self.currentIndex]["options"]["names"],
                    self.listCallback)
            else:
                self.overlay = SelectionMenu.SelectionMenu(
                    self.screen,
                    self.entryList[self.currentIndex]["options"]["values"],
                    self.listCallback)
        if (self.entryList[self.currentIndex]["type"] == "emu"):
            options = Theme.getConfigOptions()
            options["useSidebar"] = False

            data = copy.deepcopy(self.entryList[self.currentIndex]["value"])
            ##inject default if non found
            if (data == None or len(data) == 0):
                data = []
                default = {}
                default["cmd"] = self.optionTarget[
                    "cmd"] if "cmd" in self.optionTarget else "."
                default["workingDir"] = self.optionTarget[
                    "workingDir"] if "workingDir" in self.optionTarget else "."
                default["name"] = "default"
                data.append(default)

            self.subComponent = EmulatorList.EmulatorList(
                self.screen, "Emulators", data, options, self.emuListCallback)
            footer = Footer.Footer([("theme/direction.png", "select")],
                                   [("theme/b_button.png", "back"),
                                    ("theme/select_button.png", "options"),
                                    ("theme/start_button.png", "save")],
                                   options["footerFontColor"],
                                   options["footerColor"])
            self.subComponent.setFooter(footer)

        if (self.entryList[self.currentIndex]["type"] == "selection"):
            options = Theme.getConfigOptions()
            options["useSidebar"] = False
            options["names"] = self.entryList[
                self.currentIndex]["options"]["names"]
            options["options"] = self.entryList[
                self.currentIndex]["options"]["options"]

            data = copy.deepcopy(self.entryList[self.currentIndex]["value"])
            ##inject default if non found
            if (data == None):
                data = []

            print(self.entryList[self.currentIndex]["options"])

            self.subComponent = SelectionList.SelectionList(
                self.screen, "Select", data, options,
                self.selectionListCallback)
            footer = Footer.Footer([("theme/direction.png", "select")],
                                   [("theme/b_button.png", "back"),
                                    ("theme/a_button.png", "change"),
                                    ("theme/start_button.png", "save")],
                                   options["footerFontColor"],
                                   options["footerColor"])
            self.subComponent.setFooter(footer)
Esempio n. 12
0
def getMediaPath(filename=""):
    return FileChooser.getMediaPath(filename)
Esempio n. 13
0
def pickAFile():
    ## Note: this needs to be done in a threadsafe manner, see FileChooser
    ## for details how this is accomplished.
    return FileChooser.pickAFile()
Esempio n. 14
0
    def openSelection(self, current):
        print("Opening selection")
        ResumeHandler.setLastUsedMain(current, self.currentIndex)

        options = Theme.getSelectionOptions()

        if (current["type"] == "emulator"):

            if ("useSelection" in current
                    and current["useSelection"] == False):
                print("Running emulator directly")
                self.emulatorCallback("", Keys.DINGOO_BUTTON_A, False)
                return

            print("Opening emulator file selection")

            options["entry"] = self.config["mainMenu"][self.currentIndex]
            options["background"] = current["background"]
            options["useSidebar"] = True
            options["useGamelist"] = current[
                "useGamelist"] if "useGamelist" in current else False

            options["backgroundColor"] = Theme.getColor(
                "selection/backgroundColor", (255, 255, 255, 160))

            if ("description" in current):
                options["description"] = current["description"]

            if ("folderIcon" in current):
                options["folderIcon"] = current["folderIcon"]

            if ("previews" in current):
                options["previews"] = current["previews"]

            if ("fileFilter" in current):
                options["fileFilter"] = current["fileFilter"]

            if ("useFileFilter" in current):
                options["useFileFilter"] = current["useFileFilter"]

            if ("limitSelection" in current):
                options["limitSelection"] = current["limitSelection"]

            if ("hideFolders" in current):
                options["hideFolders"] = current["hideFolders"]

            options["selectionPath"] = current["selectionPath"]

            self.subComponent = FileChooser.FileChooser(
                self.screen, current["name"], current["selectionPath"], False,
                options, self.emulatorCallback)
            footer = Footer.Footer([("theme/direction.png", "select")],
                                   [("theme/b_button.png", "back"),
                                    ("theme/start_button.png", "Open with"),
                                    ("theme/a_button.png", "select")],
                                   options["footerFontColor"],
                                   options["footerColor"])
            self.subComponent.setFooter(footer)

        if (current["type"] == "native"):
            print("Opening native selection")

            options["background"] = current["background"]
            options["useSidebar"] = True

            if ("linkPath" in current):
                options["linkPath"] = current["linkPath"]

            self.subComponent = NativeAppList.NativeAppList(
                self.screen, current["name"], current["data"], options,
                self.nativeCallback)
            if ("allowEdit" in self.config["options"]
                    and self.config["options"]["allowEdit"]):
                footer = Footer.Footer(
                    [("theme/direction.png", "select")],
                    [("theme/b_button.png", "back"),
                     ("theme/a_button.png", "select"),
                     ("theme/select_button.png", "options")],
                    options["footerFontColor"], options["footerColor"])
            else:
                footer = Footer.Footer([("theme/direction.png", "select")],
                                       [("theme/b_button.png", "back"),
                                        ("theme/a_button.png", "select")],
                                       options["footerFontColor"],
                                       options["footerFontColor"])
            self.subComponent.setFooter(footer)

        if (current["type"] == "lastPlayed"
                or current["type"] == "favourites"):
            print("Opening customList selection")

            options["background"] = current["background"]
            options["useSidebar"] = True
            options["type"] = current["type"]

            options["backgroundColor"] = Theme.getColor(
                "selection/backgroundColor", (255, 255, 255, 160))

            self.subComponent = NativeAppList.NativeAppList(
                self.screen, current["name"], current["data"], options,
                self.customListCallback)
            footer = Footer.Footer([("theme/direction.png", "select")],
                                   [("theme/b_button.png", "back"),
                                    ("theme/a_button.png", "select")],
                                   options["footerFontColor"],
                                   options["footerColor"])
            self.subComponent.setFooter(footer)
Esempio n. 15
0
def getFile(w, optionName):
    optionName = str(FileChooser.show())
    logging.info("Adding file" + optionName.split("/")[-1])
    menuitem_add(w, optionName)