Ejemplo n.º 1
0
    def __init__(self, screen, titel, data, options, callback):
        AbstractList.AbstractList.__init__(self, screen, titel, options)

        self.options = options
        self.callback = callback
        self.data = data

        self.yFolderOffset = (self.listEntryHeight -
                              self.folderIcon.get_height()) / 2
        self.xFolderOffset = (self.listEntryHeight -
                              self.folderIcon.get_width()) / 2

        self.yFileOffset = (self.listEntryHeight -
                            self.fileIcon.get_height()) / 2
        self.xFileOffset = (self.listEntryHeight -
                            self.fileIcon.get_width()) / 2

        self.initList()

        res = ResumeHandler.getResumeFile()

        if (res != None and res["line"] != None
                and ("type" in options and options["type"] != "lastPlayed"
                     and options["type"] != "favourites")):
            self.setSelection(res["line"])
            self.onChange()

            if (not self.currentSelection == None):
                self.previewPath = self.currentSelection["preview"]
                self.preview_final = self.previewPath

            RenderControl.setDirty()

        AbstractList.AbstractList.updatePreview(self)
        self.onChange()
Ejemplo n.º 2
0
    def __init__(self, screen, suspend):
        print("Main Menu Init")
        self.screen = screen
        self.suspend = suspend
        self.banderole = pygame.Surface((self.config["screenWidth"], 80),
                                        pygame.SRCALPHA)

        self.header = Header.Header(24)

        res = ResumeHandler.getResumeFile()
        if (res != None and res["mainIndex"] != None and res["main"] != None):
            self.currentIndex = res["mainIndex"]

            if ("useSelection" in self.config["mainMenu"][self.currentIndex]
                    and
                    self.config["mainMenu"][self.currentIndex]["useSelection"]
                    != None):
                if (self.config["mainMenu"][self.currentIndex]["useSelection"]
                        == True):
                    self.openSelection(
                        self.config["mainMenu"][self.currentIndex])
                else:
                    ResumeHandler.clearResume()

            else:
                self.openSelection(self.config["mainMenu"][self.currentIndex])

        else:
            if ("firstStart" in self.config and self.config["firstStart"]):
                self.overlay = InfoOverlay.InfoOverlay("theme/info.png",
                                                       self.infoCallback)

        self.loadSystemImages()
Ejemplo n.º 3
0
    def __init__(self, screen, titel, initialPath, selectFolder, options,
                 callback):
        AbstractList.AbstractList.__init__(self, screen, titel, options)

        if (initialPath == None or initialPath == "/"):
            initialPath = "/"

        self.getExistingParent(initialPath)

        if (os.path.exists(initialPath) and not os.path.isfile(initialPath)):
            self.currentPath = initialPath
        else:
            self.currentPath = self.getExistingParent(initialPath)

        if ("directPreview" in self.options and self.options["directPreview"]):
            self.previewEnabled = True

        if ("previews" in self.options and self.options["previews"] != None
                and os.path.exists(self.options["previews"])):
            self.previewEnabled = True

        self.currentSelection = initialPath
        self.initialPath = initialPath
        self.selectFolder = selectFolder
        self.callback = callback

        self.yFolderOffset = (self.listEntryHeight -
                              self.folderIcon.get_height()) / 2
        self.xFolderOffset = (self.listEntryHeight -
                              self.folderIcon.get_width()) / 2 + 2

        self.yFileOffset = 0

        self.res = ResumeHandler.getResumeFile()
        if (self.res != None and self.res["path"] != None):
            self.currentSelection = self.res["path"]
            self.currentPath = self.res["path"]
            self.initialPath = self.res["path"]

        self.initList()

        if (self.res != None and self.res["line"] != None):
            self.setInitialSelection(self.res["line"])
        else:
            if (os.path.isfile(initialPath) and self.fileList is not None):
                name = ntpath.basename(initialPath)
                index = self.fileList.index(name)
                if (index != -1):
                    self.setInitialSelection(index + 1)

        if (initialPath == None or initialPath == "/"):
            self.moveFolderUp()
Ejemplo n.º 4
0
    def __init__(self, screen, titel, initialPath, selectFolder, options,
                 callback):
        AbstractList.AbstractList.__init__(self, screen, titel, options)

        print("Opening selection with options: " + str(options))

        if (initialPath == None or initialPath == "/"):
            initialPath = "/"

        self.getExistingParent(initialPath)

        if (os.path.exists(initialPath) and not os.path.isfile(initialPath)):
            self.currentPath = initialPath
        else:
            self.currentPath = self.getExistingParent(initialPath)

        if ("directPreview" in self.options and self.options["directPreview"]):
            self.previewEnabled = True

        if ("previews" in self.options and self.options["previews"] != None
                and os.path.exists(self.options["previews"])):
            self.previewEnabled = True

        self.currentSelection = initialPath
        self.initialPath = initialPath
        self.selectFolder = selectFolder
        self.callback = callback

        #tint folder icon in text color
        self.folderIcon = self.folderIcon.convert_alpha().copy()
        self.folderIcon.fill(self.textColor, None, pygame.BLEND_RGBA_MULT)

        self.yFolderOffset = (self.listEntryHeight -
                              self.folderIcon.get_height()) / 2
        self.xFolderOffset = (self.listEntryHeight -
                              self.folderIcon.get_width()) / 2 + 2

        self.yFileOffset = 0

        self.res = ResumeHandler.getResumeFile()
        if (self.res != None and self.res["path"] != None):
            self.currentSelection = self.res["path"]
            self.currentPath = self.res["path"]
            self.initialPath = self.res["path"]

        self.initList()

        if (initialPath == None or initialPath == "/"):
            self.moveFolderUp()

        self.onChange()