コード例 #1
0
ファイル: setup.py プロジェクト: glassmancody/nifixer-qt
from   setuptools         import setup, find_packages
from   setuptools.command import build_py

# run this script from within setup.py directory 
target_dir = os.path.dirname(os.path.abspath(__file__))
if os.getcwd() != target_dir:
    try:
        os.chdir(target_dir)
    except Exception as e:
        print('Failed changing to correct directory, please try and run this script from where setup.py is located')
        sys.exit(1)

try:
    # generate python files from ui files 
    pyside2uic.compileUiDir('resources',map=lambda dir,module: 
        (os.path.join('nifixer','ui'),  os.path.splitext(module)[0] + '_ui.py')
    )
        
except Exception as e:
    print('failed generating python class from ui files: ', e)
    sys.exit(1)

try:
    # generate python resource files
    subprocess.run(
        [
            'pyside2-rcc',
            '-o',
            os.path.join('nifixer','ui','resources_rc.py'),
            os.path.join('resources','resources.qrc')
        ],
コード例 #2
0
ファイル: convertisseur.py プロジェクト: Pozinux/Finder
import pyside2uic
import os

# With the pysideuic module you can convert a file
#.ui as a.py file. The "compileUiDir" function
# allows us to convert all files inside
# of the folder that is indicated
# The variable __file__ corresponds to the current file
# os.path.dirname() retrieves the name of the folder from
# of the full path of the file

pyside2uic.compileUiDir(os.path.dirname(__file__))
コード例 #3
0
import pyside2uic
import os
import qt_py_convert.run

print pyside2uic.__file__

def name_pattern(py_dir, py_file):
    py_file = os.path.splitext(py_file)[0] + "_UIs" + os.path.splitext(py_file)[1]
    return py_dir, py_file


currentDir = os.path.dirname(os.path.abspath(__file__))

pyside2uic.compileUiDir(currentDir, map=name_pattern)
qt_py_convert.run.process_folder(currentDir)