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