def export_to_file(self, file_path): from dao.XMLUtils import dump_activity_to_file AUX_FOLDER = os.path.join(os.path.expanduser('~'), "activity_auxiliary_folder") try: os.mkdir(AUX_FOLDER) except OSError: shutil.rmtree(AUX_FOLDER) os.mkdir(AUX_FOLDER) with open(os.path.join(AUX_FOLDER, "photo.xml"), "wt") as f: dump_activity_to_file(self, f) for i, t in enumerate(self.tags): # Make one aux folder for each tag to place media files tag_folder = os.path.join(AUX_FOLDER, str(i)) os.mkdir(tag_folder) for img in get_folder_images(t.path): file_name = os.path.basename(img) shutil.copyfile(img, os.path.join(tag_folder, file_name)) if len(t.sounds) > 0: sounds_dir = os.path.join(tag_folder, "sounds") try: os.mkdir(sounds_dir) except OSError: shutil.rmtree(sounds_dir) os.mkdir(sounds_dir) for sound in t.sounds: file_name = os.path.basename(sound.path) shutil.copyfile(sound.path, os.path.join(sounds_dir, file_name)) pack_folder_and_remove(AUX_FOLDER, file_path)
def export_to_file(self, file_path): from dao.XMLUtils import dump_activity_to_file AUX_FOLDER = os.path.join(os.path.expanduser('~'), "activity_auxiliary_folder") try: os.mkdir(AUX_FOLDER) except OSError: shutil.rmtree(AUX_FOLDER) os.mkdir(AUX_FOLDER) with open(os.path.join(AUX_FOLDER, "manual.xml"), "wt") as f: dump_activity_to_file(self, f) pack_folder_and_remove(AUX_FOLDER, file_path)
def export_to_file(self, file_path): from dao.XMLUtils import dump_activity_to_file AUX_FOLDER = os.path.join(os.path.expanduser('~'), "activity_auxiliary_folder") try: os.mkdir(AUX_FOLDER) except OSError: shutil.rmtree(AUX_FOLDER) os.mkdir(AUX_FOLDER) with open(os.path.join(AUX_FOLDER, "key.xml"), "wt") as f: dump_activity_to_file(self, f) pack_folder_and_remove(AUX_FOLDER, file_path)