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()
def addProjLevelFile(self, projName, path, obj=None, overwrite=True): if not overwrite and projName in self._projs: raise KeyError("Project already exists!") if obj is not None: file = obj else: file = RCStrTblFile( path ) if not file.load(): raise Exception("Could not load String Table File: %s"%path) self._projs[projName] = copy.deepcopy( file._table ) return True