|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2018 - 2021 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing a dialog to enter some non-common rcc compiler options. |
|
8 """ |
|
9 |
|
10 from PyQt5.QtWidgets import QDialog |
|
11 |
|
12 from .Ui_RccCompilerOptionsDialog import Ui_RccCompilerOptionsDialog |
|
13 |
|
14 |
|
15 class RccCompilerOptionsDialog(QDialog, Ui_RccCompilerOptionsDialog): |
|
16 """ |
|
17 Class implementing a dialog to enter some non-common rcc compiler options. |
|
18 """ |
|
19 def __init__(self, compilerOptions, parent=None): |
|
20 """ |
|
21 Constructor |
|
22 |
|
23 @param compilerOptions dictionary containing the rcc compiler options |
|
24 @type dict |
|
25 @param parent reference to the parent widget |
|
26 @type QWidget |
|
27 """ |
|
28 super().__init__(parent) |
|
29 self.setupUi(self) |
|
30 |
|
31 self.thresholdSpinBox.setValue(compilerOptions["CompressionThreshold"]) |
|
32 self.compressionSpinBox.setValue(compilerOptions["CompressLevel"]) |
|
33 self.disableCheckBox.setChecked(compilerOptions["CompressionDisable"]) |
|
34 self.rootEdit.setText(compilerOptions["PathPrefix"]) |
|
35 |
|
36 msh = self.minimumSizeHint() |
|
37 self.resize(max(self.width(), msh.width()), msh.height()) |
|
38 |
|
39 def getData(self): |
|
40 """ |
|
41 Public method to get the entered data. |
|
42 |
|
43 @return tuple containing the compression threshold, compression level, |
|
44 flag indicating to disable compression and the resource access path |
|
45 prefix |
|
46 @rtype tuple of (int, int, bool, str) |
|
47 """ |
|
48 return ( |
|
49 self.thresholdSpinBox.value(), |
|
50 self.compressionSpinBox.value(), |
|
51 self.disableCheckBox.isChecked(), |
|
52 self.rootEdit.text().strip(), |
|
53 ) |