Exemplo n.º 1
0
    def addFilesToModel(self, *args):
        colour = guiutils.guiConfig.getCompositeValue("file_colours", "static")
        importedFiles = {}
        allTitles = self.getApplicationTitles()
        for index, app in enumerate(self.allApps):
            headerRow = [
                "Files for " + allTitles[index], None,
                app.getDirectory(), None, "", ""
            ]
            confiter = self.model.insert_before(None, None, headerRow)
            for file in self.getConfigFiles(app):
                self.addFileToModel(confiter, file, colour, [app])
                for importedFile in self.getImportedFiles(file, app):
                    importedFiles[importedFile] = importedFile
            storytextDir = self.storytextDirs.get(app)
            if storytextDir:
                files = self.getAllFiles(storytextDir, app)
                self.addDataFilesUnderIter(confiter,
                                           files,
                                           colour,
                                           app.getDirectory(),
                                           associatedObject=self.allApps)
            testScripts = self.testScripts.get(app.name)
            if testScripts:
                headerRow = [
                    "Scripts for " + allTitles[index], None,
                    app.getDirectory(), None, "", ""
                ]
                scriptiter = self.model.insert_before(None, None, headerRow)
                self.addDataFilesUnderIter(scriptiter,
                                           sorted(testScripts),
                                           colour,
                                           app.getDirectory(),
                                           associatedObject=self.allApps)

        # Handle recursive imports here ...

        if len(importedFiles) > 0:
            importediter = self.model.insert_before(None, None)
            self.model.set_value(importediter, 0, "Imported Files")
            sortedFiles = list(importedFiles.values())
            sortedFiles.sort()
            for importedFile in sortedFiles:
                self.addFileToModel(importediter, importedFile, colour,
                                    self.allApps)

        personalDir = plugins.getPersonalConfigDir()
        personalFiles = self.getPersonalFiles(personalDir)
        if len(personalFiles) > 0:
            headerRow = ["Personal Files", None, personalDir, None, "", ""]
            persiter = self.model.insert_before(None, None, headerRow)
            self.addDataFilesUnderIter(persiter,
                                       personalFiles,
                                       colour,
                                       personalDir,
                                       associatedObject=self.allApps)
Exemplo n.º 2
0
 def getAllPersonalConfigFiles(self):
     allPersonalFiles = []
     # Always include app-independent version
     appIndep = os.path.join(plugins.getPersonalConfigDir(), "config")
     if os.path.isfile(appIndep):
         allPersonalFiles.append(appIndep)
     for app in self.apps:
         for fileName in app.getPersonalConfigFiles():
             if not fileName in allPersonalFiles:
                 allPersonalFiles.append(fileName)
     return allPersonalFiles