eric7/Utilities/uic.py

branch
eric7
changeset 8312
800c432b34c8
parent 7923
91e843545d9a
child 8318
962bce857696
diff -r 4e8b98454baa -r 800c432b34c8 eric7/Utilities/uic.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/eric7/Utilities/uic.py	Sat May 15 18:45:04 2021 +0200
@@ -0,0 +1,34 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2009 - 2021 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