eric6/Utilities/uic.py

Sun, 21 Jun 2020 18:26:12 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 21 Jun 2020 18:26:12 +0200
changeset 7635
0cdead130a81
parent 7360
9190402e4505
child 7781
607a6098cb44
permissions
-rw-r--r--

Removed support for Python2 and removed support for Qt4 (PyQt4 and pyside).

# -*- coding: utf-8 -*-

# Copyright (c) 2009 - 2020 Detlev Offenbach <detlev@die-offenbachs.de>
#

"""
Module implementing a function to compile all user interface files of a
directory or directory tree.
"""


from PyQt5.uic import compileUiDir


def __pyName(py_dir, py_file):
    """
    Local function to create the Python source file name for the compiled
    .ui file.
    
    @param py_dir suggested name of the directory (string)
    @param py_file suggested name for the compile source file (string)
    @return tuple of directory name (string) and source file name (string)
    """
    return py_dir, "Ui_{0}".format(py_file)


def compileUiFiles(directory, recurse=False):
    """
    Module function to compile the .ui files of a directory tree to Python
    sources.
    
    @param directory name of a directory to scan for .ui files (string)
    @param recurse flag indicating to recurse into subdirectories (boolean)
    """
    compileUiDir(directory, recurse, __pyName)

eric ide

mercurial