Advertisement
stuppid_bot

Untitled

Dec 7th, 2014
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.96 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. import os
  3. import sys
  4. from subprocess import call
  5.  
  6. # файлы исходники с расширениеми .ui и .qrc
  7. src_dirname = 'ui'
  8. # готовые модули
  9. dst_dirname = 'compiled'
  10. puic_path = 'C:\Python27\Lib\site-packages\PyQt4\uic\pyuic.py'
  11.  
  12. curpath = os.path.dirname(__file__)
  13. items = os.listdir(src_dirname)
  14.  
  15. for it in items:
  16.     path = os.path.join(src_dirname, it)
  17.     if os.path.isfile(path):
  18.         name, extension = os.path.splitext(it)
  19.         extension = extension.lower()
  20.         if extension in ['.ui', '.qrc']:
  21.             infile = os.path.join(curpath, path)
  22.             if extension == '.ui':
  23.                 outfile = os.path.join(curpath, dst_dirname, 'Ui_' + name + '.py')
  24.                 call([sys.executable, puic_path, infile, '-o', outfile])
  25.             else:
  26.                 outfile = os.path.join(curpath, dst_dirname, name + '_rc.py')
  27.                 call(['pyrcc4', '-o', outfile, infile])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement