Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- import os
- import sys
- from subprocess import call
- # файлы исходники с расширениеми .ui и .qrc
- src_dirname = 'ui'
- # готовые модули
- dst_dirname = 'compiled'
- puic_path = 'C:\Python27\Lib\site-packages\PyQt4\uic\pyuic.py'
- curpath = os.path.dirname(__file__)
- items = os.listdir(src_dirname)
- for it in items:
- path = os.path.join(src_dirname, it)
- if os.path.isfile(path):
- name, extension = os.path.splitext(it)
- extension = extension.lower()
- if extension in ['.ui', '.qrc']:
- infile = os.path.join(curpath, path)
- if extension == '.ui':
- outfile = os.path.join(curpath, dst_dirname, 'Ui_' + name + '.py')
- call([sys.executable, puic_path, infile, '-o', outfile])
- else:
- outfile = os.path.join(curpath, dst_dirname, name + '_rc.py')
- call(['pyrcc4', '-o', outfile, infile])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement