def install_file(self, user_file, font_path, commit=True, clear=True): doc_cache = DocumentCache() # If the file does not exist the following will fail doc_cache.add(user_file) # Install the file into every cached skin font file for skin_file in self.__doc_cache.list_files(): res_folder = self._get_res_folder(skin_file) res_file = self._get_res_filename(res_folder, user_file) # If an specific res file exists... if os.path.isfile(res_file): self._install_file(doc_cache, res_file, skin_file, font_path) # Otherwise use the dafault fallback else: self._install_file(doc_cache, user_file, skin_file, font_path) # If save was requested if commit: self.__doc_cache.write_all() # Clear cached docs after write (if requested) if clear: self.__doc_cache.clear_all()
def __init__(self): self.__installed_names = [] self.__doc_cache = DocumentCache() # Check if the environment is sane check_skin_writability() # Initialize the doc cache with found files for file in self._list_skin_include_files(): self.__doc_cache.add(file)
def __init__(self, script_path): self.__installed_names = [] self.__installed_fonts = [] self.__doc_cache = DocumentCache() self.script_path = script_path