18 Convert Qt Designer UI files to Python files.
20 for file_name
in os.listdir(ui_source_dir):
21 if file_name.endswith(
'.ui'):
22 ui_file_path = os.path.join(ui_source_dir, file_name).replace(
"\\",
"/")
23 py_file_name = f
"ui{os.path.splitext(file_name)[0]}.py"
24 py_file_path = os.path.join(py_target_dir, py_file_name).replace(
"\\",
"/")
26 if os.path.exists(ui_file_path):
27 command = f
'./pyside6-uic "{ui_file_path}" -o "{py_file_path}"'
29 result = subprocess.run(command, check=
True, shell=
True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
30 print(f
"Successfully converted {ui_file_path} to {py_file_path}.")
32 except subprocess.CalledProcessError
as e:
33 print(f
"Converting {ui_file_path} failed: {e}")
35 print(f
"File does not exist: {ui_file_path}")
49 Convert ressource files to Python files.
51 for file_name
in os.listdir(qrc_source_dir):
52 if file_name.endswith(
'.qrc'):
53 qrc_file_path = os.path.join(qrc_source_dir, file_name)
54 py_file_name = f
"{os.path.splitext(file_name)[0]}_rc.py"
55 py_file_path = os.path.join(py_target_dir, py_file_name).replace(
"\\",
"/")
57 if os.path.exists(qrc_file_path):
58 command = f
'./pyside6-rcc "{qrc_file_path}" -o "{py_file_path}"'
60 result = subprocess.run(command, check=
True, shell=
True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
61 print(f
"Successfully converted {qrc_file_path} to {py_file_path}")
62 except subprocess.CalledProcessError
as e:
63 print(f
"Converting {qrc_file_path} failed: {e}")
65 print(f
"The file does not exist:{qrc_file_path}")