def import_kopete(target_file): log.debug("import from kopete jisp started...%s", target_file) try: content = _read_content_from_zip(target_file, "icondef.xml") except IOError, (errno, strerror): log.warn("import from kopete failed : %s", strerror) raise ImportPackError("Error during importing : " + strerror)
def _import_pidgin(target_path, read_function): try: content = read_function(target_path, "theme") except IOError, (errno, strerror): log.warn("import from pidgin failed : %s", strerror) raise ImportPackError("Error during importing : " + strerror)
if xml_name: pack.name = str(xml_name[0].firstChild.data) log.debug(" pack name : %s", pack.name) xml_icons = dom.getElementsByTagName("icon") for xml_icon in xml_icons: icon = Icon([], str(xml_icon.getElementsByTagName("object")[0].firstChild.data)) for text in xml_icon.getElementsByTagName("text"): icon.add_text(str(text.firstChild.data)) log.debug(" importing image : %s ", icon.image) try: image_content = _read_content_from_zip(target_file, icon.image) fout = open(os.path.join(config.temp_dir, icon.image), "wb") fout.write(image_content) fout.close() except IOError, (errno, strerror): log.warn("error during loading image : " + strerror + " -> skipping") pack.add_icon(icon) log.debug("import from kopete jisp finished") return pack; @timing def import_pidgin_zip(target_file): log.debug("import from pidgin zip started...%s", target_file) pack = _import_pidgin(target_file, _read_content_from_zip) log.debug("import from pidgin zip finished") return pack @timing def import_pidgin_dir(target_dir): log.debug("import from pidgin dir started...%s", target_dir) pack = _import_pidgin(target_dir, _read_content_from_file)