Last change
on this file since 4a9786d8 was
cd2cc745,
checked in by Piotr Rozyczko <rozyczko@…>, 8 years ago
|
Workaround for the resource file requirement in each UI directory
|
-
Property mode set to
100755
|
File size:
959 bytes
|
Rev | Line | |
---|
[83eb5208] | 1 | # Convert all .ui files in all subdirectories of the current script |
---|
| 2 | import os |
---|
| 3 | |
---|
| 4 | def pyrrc(in_file, out_file): |
---|
| 5 | """ Run the pyrcc4 script""" |
---|
| 6 | execute = 'pyrcc4 -py3 %s -o %s' % (in_file, out_file) |
---|
| 7 | os.system(execute) |
---|
| 8 | |
---|
| 9 | def pyuic(in_file, out_file): |
---|
| 10 | """ Run the pyuic4 script""" |
---|
| 11 | execute = 'pyuic4 -o %s %s' % (out_file, in_file) |
---|
| 12 | os.system(execute) |
---|
| 13 | |
---|
| 14 | # look for .ui files |
---|
| 15 | for root, dirs, files in os.walk("."): |
---|
| 16 | for file in files: |
---|
| 17 | if file.endswith(".ui"): |
---|
| 18 | file_in = os.path.join(root, file) |
---|
| 19 | file_out = os.path.splitext(file_in)[0]+'.py' |
---|
| 20 | pyuic(file_in, file_out) |
---|
| 21 | |
---|
| 22 | # RC file in UI directory |
---|
| 23 | ui_root = 'UI' |
---|
| 24 | rc_file = 'main_resources.qrc' |
---|
| 25 | out_file = 'main_resources_rc.py' |
---|
| 26 | pyrrc(os.path.join(ui_root, rc_file), os.path.join(ui_root, out_file)) |
---|
| 27 | |
---|
| 28 | # Images |
---|
[cd2cc745] | 29 | images_root = 'images' |
---|
[83eb5208] | 30 | rc_file = 'images.qrc' |
---|
| 31 | out_file = 'images_rc.py' |
---|
[cd2cc745] | 32 | pyrrc(os.path.join(images_root, rc_file), os.path.join(ui_root, out_file)) |
---|
Note: See
TracBrowser
for help on using the repository browser.