eric6/Utilities/uic.py

changeset 6942
2602857055c5
parent 6645
ad476851d7e0
child 7229
53054eb5b15a
diff -r f99d60d6b59b -r 2602857055c5 eric6/Utilities/uic.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/eric6/Utilities/uic.py	Sun Apr 14 15:09:21 2019 +0200
@@ -0,0 +1,36 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2009 - 2019 Detlev Offenbach <detlev@die-offenbachs.de>
+#
+
+"""
+Module implementing a function to compile all user interface files of a
+directory or directory tree.
+"""
+
+from __future__ import unicode_literals
+
+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