Sat, 02 Feb 2019 11:12:54 +0100
Merged with default branch to prepare release 19.02.
6442
9d42b6c08a27
IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1 | # -*- coding: utf-8 -*- |
9d42b6c08a27
IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2 | |
6645
ad476851d7e0
Updated copyright for 2019.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6466
diff
changeset
|
3 | # Copyright (c) 2018 - 2019 Detlev Offenbach <detlev@die-offenbachs.de> |
6445
2b022e5ba54c
IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6442
diff
changeset
|
4 | # |
2b022e5ba54c
IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6442
diff
changeset
|
5 | |
6442
9d42b6c08a27
IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
6 | """ |
6445
2b022e5ba54c
IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6442
diff
changeset
|
7 | Module implementing a dialog to enter the name-value pair to define a variable |
2b022e5ba54c
IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6442
diff
changeset
|
8 | for the IDL compiler. |
6442
9d42b6c08a27
IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
9 | """ |
9d42b6c08a27
IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
10 | |
6466
dac80ad0de75
Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6445
diff
changeset
|
11 | from __future__ import unicode_literals |
dac80ad0de75
Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6445
diff
changeset
|
12 | |
6442
9d42b6c08a27
IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
13 | from PyQt5.QtCore import pyqtSlot |
6445
2b022e5ba54c
IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6442
diff
changeset
|
14 | from PyQt5.QtWidgets import QDialog, QDialogButtonBox |
6442
9d42b6c08a27
IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
15 | |
9d42b6c08a27
IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
16 | from .Ui_IdlCompilerDefineNameDialog import Ui_IdlCompilerDefineNameDialog |
9d42b6c08a27
IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
17 | |
9d42b6c08a27
IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
18 | |
9d42b6c08a27
IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
19 | class IdlCompilerDefineNameDialog(QDialog, Ui_IdlCompilerDefineNameDialog): |
9d42b6c08a27
IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
20 | """ |
6445
2b022e5ba54c
IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6442
diff
changeset
|
21 | Class implementing a dialog to enter the name-value pair to define a |
2b022e5ba54c
IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6442
diff
changeset
|
22 | variable for the IDL compiler. |
6442
9d42b6c08a27
IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
23 | """ |
6445
2b022e5ba54c
IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6442
diff
changeset
|
24 | def __init__(self, name="", value="", parent=None): |
6442
9d42b6c08a27
IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
25 | """ |
9d42b6c08a27
IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
26 | Constructor |
9d42b6c08a27
IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
27 | |
6445
2b022e5ba54c
IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6442
diff
changeset
|
28 | @param name name of the variable |
2b022e5ba54c
IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6442
diff
changeset
|
29 | @type str |
2b022e5ba54c
IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6442
diff
changeset
|
30 | @param value value of the variable |
2b022e5ba54c
IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6442
diff
changeset
|
31 | @type str |
6442
9d42b6c08a27
IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
32 | @param parent reference to the parent widget |
9d42b6c08a27
IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
33 | @type QWidget |
9d42b6c08a27
IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
34 | """ |
9d42b6c08a27
IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
35 | super(IdlCompilerDefineNameDialog, self).__init__(parent) |
9d42b6c08a27
IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
36 | self.setupUi(self) |
6445
2b022e5ba54c
IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6442
diff
changeset
|
37 | |
2b022e5ba54c
IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6442
diff
changeset
|
38 | self.nameEdit.setText(name) |
2b022e5ba54c
IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6442
diff
changeset
|
39 | self.valueEdit.setText(value) |
2b022e5ba54c
IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6442
diff
changeset
|
40 | |
2b022e5ba54c
IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6442
diff
changeset
|
41 | msh = self.minimumSizeHint() |
2b022e5ba54c
IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6442
diff
changeset
|
42 | self.resize(max(self.width(), msh.width()), msh.height()) |
2b022e5ba54c
IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6442
diff
changeset
|
43 | |
2b022e5ba54c
IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6442
diff
changeset
|
44 | self.__updateOkButton() |
2b022e5ba54c
IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6442
diff
changeset
|
45 | |
2b022e5ba54c
IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6442
diff
changeset
|
46 | def __updateOkButton(self): |
2b022e5ba54c
IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6442
diff
changeset
|
47 | """ |
2b022e5ba54c
IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6442
diff
changeset
|
48 | Private slot to update the enable state of the OK button. |
2b022e5ba54c
IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6442
diff
changeset
|
49 | """ |
2b022e5ba54c
IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6442
diff
changeset
|
50 | self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( |
2b022e5ba54c
IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6442
diff
changeset
|
51 | bool(self.nameEdit.text())) |
6442
9d42b6c08a27
IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
52 | |
9d42b6c08a27
IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
53 | @pyqtSlot(str) |
6445
2b022e5ba54c
IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6442
diff
changeset
|
54 | def on_nameEdit_textChanged(self, txt): |
6442
9d42b6c08a27
IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
55 | """ |
6445
2b022e5ba54c
IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6442
diff
changeset
|
56 | Private slot to handle changes of the name. |
6442
9d42b6c08a27
IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
57 | |
6445
2b022e5ba54c
IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6442
diff
changeset
|
58 | @param txt current text of the name edit |
6442
9d42b6c08a27
IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
59 | @type str |
9d42b6c08a27
IDLCompilerOptionsDialog: started to implement a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
60 | """ |
6445
2b022e5ba54c
IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6442
diff
changeset
|
61 | self.__updateOkButton() |
2b022e5ba54c
IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6442
diff
changeset
|
62 | |
2b022e5ba54c
IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6442
diff
changeset
|
63 | def getData(self): |
2b022e5ba54c
IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6442
diff
changeset
|
64 | """ |
2b022e5ba54c
IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6442
diff
changeset
|
65 | Public method to get the entered data. |
2b022e5ba54c
IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6442
diff
changeset
|
66 | |
2b022e5ba54c
IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6442
diff
changeset
|
67 | @return tuple containing the variable name and value |
2b022e5ba54c
IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6442
diff
changeset
|
68 | @rtype tuple of (str, str) |
2b022e5ba54c
IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6442
diff
changeset
|
69 | """ |
2b022e5ba54c
IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6442
diff
changeset
|
70 | return ( |
2b022e5ba54c
IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6442
diff
changeset
|
71 | self.nameEdit.text().strip(), |
2b022e5ba54c
IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6442
diff
changeset
|
72 | self.valueEdit.text().strip(), |
2b022e5ba54c
IDLCompilerOptionsDialog: finished implementing a dialog to enter options for the IDL compiler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6442
diff
changeset
|
73 | ) |