eric6/Project/UicCompilerOptionsDialog.py

Sun, 07 Jul 2019 11:25:08 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 07 Jul 2019 11:25:08 +0200
changeset 7050
b66cac9a6560
parent 6942
2602857055c5
child 7201
6b42677d7043
permissions
-rw-r--r--

Project: added an option to the UIC parameters to specify the packages root directory relative to the project directory.

6597
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
6645
ad476851d7e0 Updated copyright for 2019.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6597
diff changeset
3 # Copyright (c) 2018 - 2019 Detlev Offenbach <detlev@die-offenbachs.de>
6597
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing a dialog to enter some non-common uic compiler options.
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 from __future__ import unicode_literals
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12 from PyQt5.QtCore import PYQT_VERSION
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13 from PyQt5.QtWidgets import QDialog
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15 from .Ui_UicCompilerOptionsDialog import Ui_UicCompilerOptionsDialog
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 class UicCompilerOptionsDialog(QDialog, Ui_UicCompilerOptionsDialog):
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 """
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20 Class implementing a dialog to enter some non-common uic compiler options.
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 """
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 def __init__(self, compilerOptions, compiler, parent=None):
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 """
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 Constructor
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 @param compilerOptions dictionary containing the uic compiler options
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 @type dict
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 @param compiler name of the uic compiler executable
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 @type str
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 @param parent reference to the parent widget
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 @type QWidget
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 """
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 super(UicCompilerOptionsDialog, self).__init__(parent)
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 self.setupUi(self)
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 self.packageEdit.setText(compilerOptions["Package"])
7050
b66cac9a6560 Project: added an option to the UIC parameters to specify the packages root directory relative to the project directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
37 self.packageRootEdit.setText(compilerOptions["PackagesRoot"])
6597
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 self.suffixEdit.setText(compilerOptions["RcSuffix"])
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 if 'uic5' not in compiler or PYQT_VERSION < 0x050600:
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 # only supported for PyQt5 >= 5.6 (April 2016)
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 self.packageGroup.setEnabled(False)
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 msh = self.minimumSizeHint()
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 self.resize(max(self.width(), msh.width()), msh.height())
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 def getData(self):
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 """
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 Public method to get the entered data.
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50
7050
b66cac9a6560 Project: added an option to the UIC parameters to specify the packages root directory relative to the project directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
51 @return tuple containing the package, the rc-file suffix and the
b66cac9a6560 Project: added an option to the UIC parameters to specify the packages root directory relative to the project directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
52 project relative root of the packages directory
b66cac9a6560 Project: added an option to the UIC parameters to specify the packages root directory relative to the project directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
53 @rtype tuple of (str, str, str)
6597
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 """
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 return (
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 self.packageEdit.text().strip(),
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 self.suffixEdit.text().strip(),
7050
b66cac9a6560 Project: added an option to the UIC parameters to specify the packages root directory relative to the project directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
58 self.packageRootEdit.text().strip(),
6597
dc668f774d3d Project Forms Browser: added support for the --resource-suffix= and --import-from= options of pyuic (the PyQt forms compiler).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 )

eric ide

mercurial