def copyFile(self, link): link = _qstr(link) if link.isEmpty(): return url = QUtils.getGoodUrl(link) if url.isValid(): dst = self.getPathToFolder(Editor.FILES_FOLDER) make_dir_if_not_exist(dst) url = copy_file(unicode(url.toString(), 'utf-8')[7:], dst) return {"url":url, "name": get_name(url)}
def __delete_unnecessary(self, attr, elem, folder): necesary = [get_name(e.attribute(attr)) for e in self.findAllElements(elem)] delete_files(self.getPathToFolder(folder), lambda f:not f in necesary)