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