def apply(self, software, theme):
new_files = theme.files[software]
files = self.get_supported_software()[software]
for name, theme_path in new_files.items():
if name in files:
for orig_path in files[name]:
filename = os.path.expanduser(orig_path)
if os.access(filename, os.W_OK):
theme.themes.backup_if_necessary(software, name, filename)
# reload orig files because the original theme might have
# changed (in case a backup was necessary)
orig_files = theme.themes.original.files[software]
with open(filename, "w") as f:
logging.debug("Merging %s with %s" %
(orig_files[name], theme_path))
f.writelines(self.merge(software, name,
orig_files[name], theme_path))
break
评论列表
文章目录