Найти - Пользователи
Полная версия: vanished
Начало » Python для новичков » vanished
1
tz4678@gmail.com
vanished
den4ik
Тут как бы на вкус и цвет…

# -*- 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:
    infile = os.path.join(curpath, src_dirname, it)
    if os.path.isfile(infile):
        name, extension = os.path.splitext(it)
        if it.lower().endwith('.ui'):
            outfile = os.path.join(curpath, dst_dirname, 'Ui_' + name + '.py')
            call([sys.executable, puic_path, infile, '-o', outfile])
        elif it.lower().endwith('.qrc'):
            outfile = os.path.join(curpath, dst_dirname, name + '_rc.py')
            call(['pyrcc4', '-o', outfile, infile])
пс: и да, я не проф)
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB