Ejemplo n.º 1
0
 def __s2r(self): 
     logging.debug("Pushing strings into resources...")
     if isSystemLevelStringTable(self.__input):
         logging.debug("\tString table file is System Level.")
         file = SysStrTblFile( self.__input )
         file.load()
         for cpath,name in self.__output:
             resource = scanRCFile(cpath)
             if not self.__validLangcode(resource._langcode): 
                 logging.debug("\t\tIgnoring '%s' because its not the right langcode. @> %s"%(name,cpath)) 
                 continue
             try:
                 projFile = file.genProjLevelFile( resource._name, '' )
             except KeyError:
                 logging.warning("Project %s does not exist in %s"%(resource._name, self.__input))
                 continue
             resource.updateStringTables(projFile)
     else:
         logging.debug("\tString Table File is Project or Language Level.")
         projFile = RCStrTblFile( self.__input )
         projFile.load()
         langs = projFile._table.getPossibleLangs()
         for cpath,name in self.__output:
             resource = scanRCFile(cpath)
             if not self.__validLangcode(resource._langcode): 
                 logging.debug("\t\tIgnoring '%s' because its not the right langcode. @> %s"%(name,cpath)) 
                 continue
             if resource._langcode in langs: 
                 logging.debug("\t\tUpdating %s @> %s"%(name,cpath))
                 resource.updateStringTables(projFile)
             else: raise MissingLangCodeError()        
Ejemplo n.º 2
0
 def __init__(self, path): 
     if not isSystemLevelStringTable( path ):
         raise TypeError("Path given is not a system level string table file.")
     super().__init__( path )
     self.setHasSections( True )
     self._projs = {} #map: "projName" -> RCStrTbl