setup.py now automatically executes the gui generation script.

This commit is contained in:
The Wobbler 2024-12-14 19:19:29 +01:00
parent ea8b7456cc
commit 47ede1e689
3 changed files with 18 additions and 8 deletions

View file

@ -7,9 +7,13 @@ working_dir = os.getcwd()
if not working_dir.split('/')[-1] == "raw_ui": # cd into the right directory if this gets executed from somewhere else
os.chdir(os.path.dirname(os.path.abspath(__file__)))
input_debug = input("Do you want to debug the gui scripts? (Make gui scripts executable.) (y/n): ")
if __name__ == "__main__": # dont ask for debug on setup
input_debug = input("Do you want to debug the gui scripts? (Make gui scripts executable.) (y/n): ")
debug = input_debug == "y"
debug = input_debug == "y"
else:
debug = False
params = "-o"
if debug:
@ -19,5 +23,10 @@ paths = {
"main_window.ui": "main_window.py"
}
for ui_file, script_out in paths.items():
os.system(f"pyuic6 {ui_file} {params} ../{script_out}")
def convert_ui():
for ui_file, script_out in paths.items():
os.system(f"pyuic6 {ui_file} {params} ../{script_out}")
os.chdir(working_dir) # switch back to the working directory from which the script was executed