openai-sql/gui/gui/convert.py
2023-05-04 15:51:52 +02:00

24 lines
718 B
Python

import os
import subprocess
def convert():
# get a list of all .ui files in the current directory
ui_files = [f for f in os.listdir('.') if f.endswith('.ui')]
# loop over each .ui file and convert it to a .py file
for ui_filename in ui_files:
# construct the name of the output .py file
py_filename = os.path.splitext(ui_filename)[0] + '.py'
# run the pyuic5 command to convert the .ui file to a .py file
cmd = f'pyuic5 {ui_filename} -o {py_filename}'
subprocess.call(cmd, shell=True)
# print a message to indicate that the conversion is complete
print(f'{ui_filename} converted to {py_filename}')
if __name__ == '__main__':
convert()