Fixed some bugs in the ui conversion script.
This commit is contained in:
parent
5cf5885d4b
commit
d3b3dbc754
1 changed files with 15 additions and 11 deletions
|
@ -2,31 +2,35 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
working_dir = os.getcwd()
|
|
||||||
|
|
||||||
if not working_dir.split('/')[-1] == "raw_ui": # cd into the right directory if this gets executed from somewhere else
|
def convert_ui():
|
||||||
os.chdir(os.path.dirname(os.path.abspath(__file__)))
|
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__)))
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__": # dont ask for debug on setup
|
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): ")
|
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"
|
||||||
|
|
||||||
|
convert_ui()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
debug = False
|
debug = False
|
||||||
|
|
||||||
params = "-o"
|
params = "-o"
|
||||||
|
|
||||||
if debug:
|
if debug:
|
||||||
params = "-xo"
|
params = "-xo"
|
||||||
|
|
||||||
paths = {
|
paths = {
|
||||||
"main_window.ui": "main_window.py"
|
"main_window.ui": "main_window.py"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue