From 5d305e7d7887f7c7f8793e703500e54affa818a5 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 7 Aug 2023 11:09:19 +0300 Subject: [PATCH] Remove scripts. --- .../share/resources/icons/replace_symlinks.py | 27 ---------------- src/libs/vmisc/share/resources/qrc_file.py | 31 ------------------- 2 files changed, 58 deletions(-) delete mode 100644 src/libs/vmisc/share/resources/icons/replace_symlinks.py delete mode 100644 src/libs/vmisc/share/resources/qrc_file.py diff --git a/src/libs/vmisc/share/resources/icons/replace_symlinks.py b/src/libs/vmisc/share/resources/icons/replace_symlinks.py deleted file mode 100644 index 9cd9f30a3..000000000 --- a/src/libs/vmisc/share/resources/icons/replace_symlinks.py +++ /dev/null @@ -1,27 +0,0 @@ -import os -import shutil - -def replace_symlinks_with_real_files(folder_path): - # Stage 1: Replace symbolic links with real files for files - for root, _, files in os.walk(folder_path): - for filename in files: - file_path = os.path.join(root, filename) - if os.path.islink(file_path): - real_path = os.path.realpath(file_path) - os.unlink(file_path) # Remove the symbolic link - shutil.copy(real_path, file_path) # Replace with the real file - - # Stage 2: Replace symbolic links with real files for folders - for root, dirs, _ in os.walk(folder_path, topdown=False): - for dirname in dirs: - dir_path = os.path.join(root, dirname) - if os.path.islink(dir_path): - real_path = os.path.realpath(dir_path) - os.unlink(dir_path) # Remove the symbolic link (empty directory) - shutil.copytree(real_path, dir_path) # Replace with the real directory - -if __name__ == "__main__": - folder_path = "/home/dismine/CAD/Valentina_0.7.x/valentina/src/libs/vmisc/share/resources/icons/La-Sierra-Light" # Replace this with the folder you want to scan - replace_symlinks_with_real_files(folder_path) - - diff --git a/src/libs/vmisc/share/resources/qrc_file.py b/src/libs/vmisc/share/resources/qrc_file.py deleted file mode 100644 index 0bc39b5eb..000000000 --- a/src/libs/vmisc/share/resources/qrc_file.py +++ /dev/null @@ -1,31 +0,0 @@ -import os - -def traverse_directory(root_dir, relative_dir="", file_list=[]): - current_path = os.path.join(root_dir, relative_dir) - for entry in os.listdir(current_path): - entry_path = os.path.join(current_path, entry) - relative_path = os.path.join(relative_dir, entry) - if os.path.isdir(entry_path): - traverse_directory(root_dir, relative_path, file_list) - else: - file_list.append(relative_path) - -def generate_qrc_file(icon_theme_dir, root_folder, qrc_filename): - file_list = [] - traverse_directory(icon_theme_dir, "", file_list) - - qrc_content = f'\n \n' - for file_path in file_list: - qrc_content += f' {root_folder}{file_path}\n' - qrc_content += ' \n' - - with open(qrc_filename, 'w', encoding='utf-8') as qrc_file: - qrc_file.write(qrc_content) - -if __name__ == "__main__": - root_folder = "icons/La-Sierra-Dark/" - icon_theme_directory = "/home/dismine/CAD/Valentina_0.7.x/valentina/src/libs/vmisc/share/resources/icons/La-Sierra-Dark" - qrc_file_name = "mac_dark_theme.qrc" - - generate_qrc_file(icon_theme_directory, root_folder, qrc_file_name) -