1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
# -*- coding: utf-8 -*-
import glob
import subprocess
def get_files():
return glob.glob('*.ui')
def make_py(cmd):
subprocess.Popen(cmd, universal_newlines=True,
stdout=subprocess.PIPE).communicate()
def build_command(name, exc=False):
if exc:
return ['pyuic4', '-x', name, '-o', name[:-2] + 'py']
return ['pyuic4', name, '-o', name[:-2] + 'py']
if __name__ == '__main__':
files = get_files()
for idx, f in enumerate(files):
print 'Process file: {0} ({1}-{2})'.format(f, idx+1, len(files))
make_py(build_command(f, True))
print 'Done' |
Partager