source: sasview/src/sas/qtgui/convertUI.py @ 2e27cdb6

ESS_GUIESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalc
Last change on this file since 2e27cdb6 was 2e27cdb6, checked in by Piotr Rozyczko <rozyczko@…>, 6 years ago

Fixed runtime UI conversion

  • Property mode set to 100644
File size: 1.1 KB
RevLine 
[83eb5208]1# Convert all .ui files in all subdirectories of the current script
2import os
[2e27cdb6]3import sys
[83eb5208]4
5def pyrrc(in_file, out_file):
6    """ Run the pyrcc4 script"""
[4992ff2]7    execute = 'pyrcc5 %s -o %s' % (in_file, out_file)
[83eb5208]8    os.system(execute)
9
10def pyuic(in_file, out_file):
[b3e8629]11    """ Run the pyuic5 script"""
[4992ff2]12    execute = 'pyuic5 -o %s %s' % (out_file, in_file)
[83eb5208]13    os.system(execute)
14
15# look for .ui files
16for root, dirs, files in os.walk("."):
17    for file in files:
18        if file.endswith(".ui"):
19            file_in = os.path.join(root, file)
20            file_out = os.path.splitext(file_in)[0]+'.py'
21            pyuic(file_in, file_out)
22
23# RC file in UI directory
[2e27cdb6]24execute_root = os.path.split(sys.modules[__name__].__file__)[0]
25ui_root = os.path.join(execute_root, 'UI')
[83eb5208]26rc_file = 'main_resources.qrc'
27out_file = 'main_resources_rc.py'
[2e27cdb6]28
[83eb5208]29pyrrc(os.path.join(ui_root, rc_file), os.path.join(ui_root, out_file))
30
31# Images
[2e27cdb6]32images_root = os.path.join(execute_root, 'images')
[83eb5208]33rc_file = 'images.qrc'
34out_file = 'images_rc.py'
[2e27cdb6]35pyrrc(os.path.join(images_root, rc_file), os.path.join(images_root, out_file))
Note: See TracBrowser for help on using the repository browser.