Example #1
0
    def setContent(self):
        """
		This Method Initializes The DbSet Attributes.
		
		@return: DbSet Initialization Success. ( Boolean )
		"""

        parser = Parser(self.path)
        parser.read() and parser.parse()

        if parser.sections:
            self.title = parser.getValue("Name", "Header", encode=True)
            self.author = parser.getValue("Author", "Header", encode=True)
            self.link = parser.getValue("Link", "Header", encode=True)
            self.icon = (
                parser.getValue("ICOfile", "Header", encode=True)
                and os.path.normpath(
                    os.path.join(os.path.dirname(self.path), parser.getValue("ICOfile", "Header", encode=True))
                )
                or None
            )
            self.backgroundImage = (
                parser.getValue("BGfile", "Background", encode=True)
                and os.path.normpath(
                    os.path.join(os.path.dirname(self.path), parser.getValue("BGfile", "Background", encode=True))
                )
                or None
            )
            self.lightingImage = (
                parser.getValue("EVfile", "Enviroment", encode=True)
                and os.path.normpath(
                    os.path.join(os.path.dirname(self.path), parser.getValue("EVfile", "Enviroment", encode=True))
                )
                or None
            )
            self.reflectionImage = (
                parser.getValue("REFfile", "Reflection", encode=True)
                and os.path.normpath(
                    os.path.join(os.path.dirname(self.path), parser.getValue("REFfile", "Reflection", encode=True))
                )
                or None
            )
            self.location = parser.getValue("Location", "Header", encode=True)
            self.latitude = parser.getValue("GEOlat", "Header", encode=True)
            self.longitude = parser.getValue("GEOlong", "Header", encode=True)
            self.date = parser.getValue("Date", "Header", encode=True)
            self.time = parser.getValue("Time", "Header", encode=True)
            self.comment = parser.getValue("Comment", "Header", encode=True)

            return True

        else:
            raise foundations.exceptions.FileStructureError(
                "'{0}' No Sections Found, File Structure Seems Invalid !".format(self.path)
            )
def getTemplatesReleases():
	'''
	This Definition Gets Templates Releases.
	'''

	walker = Walker()
	walker.root = TEMPLATES_PATH
	templates = walker.walk( ( TEMPLATES_EXTENSION, ), ( "\._", ) )
	for template in sorted( templates.keys() ) :
		parser = Parser( templates[template] )
		parser.read() and parser.parse()

		LOGGER.info( "{0} | '{1}' : '{2}' !".format( getTemplatesReleases.__name__, template, foundations.parser.getAttributeCompound( "Release", parser.getValue( "Release", "Template", encode = True ) ).value ) )
Example #3
0
    def setContent(self):
        """
		This Method Initializes The DbTemplate Attributes.
		
		@return: DbTemplate Initialization Success. ( Boolean )
		"""

        parser = Parser(self.path)
        parser.read() and parser.parse(rawSections=("Script"))

        if parser.sections:
            self.helpFile = (
                foundations.parser.getAttributeCompound(
                    "HelpFile", parser.getValue("HelpFile", "Template", encode=True)
                ).value
                and os.path.join(
                    os.path.dirname(self.path),
                    foundations.parser.getAttributeCompound(
                        "HelpFile", parser.getValue("HelpFile", "Template", encode=True)
                    ).value,
                )
                or None
            )
            self.title = foundations.parser.getAttributeCompound(
                "Name", parser.getValue("Name", "Template", encode=True)
            ).value
            self.author = foundations.parser.getAttributeCompound(
                "Author", parser.getValue("Author", "Template", encode=True)
            ).value
            self.email = foundations.parser.getAttributeCompound(
                "Email", parser.getValue("Email", "Template", encode=True)
            ).value
            self.url = foundations.parser.getAttributeCompound(
                "Url", parser.getValue("Url", "Template", encode=True)
            ).value
            self.release = foundations.parser.getAttributeCompound(
                "Release", parser.getValue("Release", "Template", encode=True)
            ).value
            self.date = foundations.parser.getAttributeCompound(
                "Date", parser.getValue("Date", "Template", encode=True)
            ).value
            self.software = foundations.parser.getAttributeCompound(
                "Software", parser.getValue("Software", "Template", encode=True)
            ).value
            self.version = foundations.parser.getAttributeCompound(
                "Version", parser.getValue("Version", "Template", encode=True)
            ).value
            self.renderer = foundations.parser.getAttributeCompound(
                "Renderer", parser.getValue("Renderer", "Template", encode=True)
            ).value
            self.outputScript = foundations.parser.getAttributeCompound(
                "OutputScript", parser.getValue("OutputScript", "Template", encode=True)
            ).value
            self.comment = foundations.parser.getAttributeCompound(
                "Comment", parser.getValue("Comment", "Template", encode=True)
            ).value

            return True

        else:
            raise foundations.exceptions.FileStructureError(
                "'{0}' No Sections Found, File Structure Seems Invalid !".format(self.path)
            )