17 class IdlCompilerDefineNameDialog(QDialog, Ui_IdlCompilerDefineNameDialog): |
17 class IdlCompilerDefineNameDialog(QDialog, Ui_IdlCompilerDefineNameDialog): |
18 """ |
18 """ |
19 Class implementing a dialog to enter the name-value pair to define a |
19 Class implementing a dialog to enter the name-value pair to define a |
20 variable for the IDL compiler. |
20 variable for the IDL compiler. |
21 """ |
21 """ |
|
22 |
22 def __init__(self, name="", value="", parent=None): |
23 def __init__(self, name="", value="", parent=None): |
23 """ |
24 """ |
24 Constructor |
25 Constructor |
25 |
26 |
26 @param name name of the variable |
27 @param name name of the variable |
27 @type str |
28 @type str |
28 @param value value of the variable |
29 @param value value of the variable |
29 @type str |
30 @type str |
30 @param parent reference to the parent widget |
31 @param parent reference to the parent widget |
31 @type QWidget |
32 @type QWidget |
32 """ |
33 """ |
33 super().__init__(parent) |
34 super().__init__(parent) |
34 self.setupUi(self) |
35 self.setupUi(self) |
35 |
36 |
36 self.nameEdit.setText(name) |
37 self.nameEdit.setText(name) |
37 self.valueEdit.setText(value) |
38 self.valueEdit.setText(value) |
38 |
39 |
39 msh = self.minimumSizeHint() |
40 msh = self.minimumSizeHint() |
40 self.resize(max(self.width(), msh.width()), msh.height()) |
41 self.resize(max(self.width(), msh.width()), msh.height()) |
41 |
42 |
42 self.__updateOkButton() |
43 self.__updateOkButton() |
43 |
44 |
44 def __updateOkButton(self): |
45 def __updateOkButton(self): |
45 """ |
46 """ |
46 Private slot to update the enable state of the OK button. |
47 Private slot to update the enable state of the OK button. |
47 """ |
48 """ |
48 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( |
49 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( |
49 bool(self.nameEdit.text())) |
50 bool(self.nameEdit.text()) |
50 |
51 ) |
|
52 |
51 @pyqtSlot(str) |
53 @pyqtSlot(str) |
52 def on_nameEdit_textChanged(self, txt): |
54 def on_nameEdit_textChanged(self, txt): |
53 """ |
55 """ |
54 Private slot to handle changes of the name. |
56 Private slot to handle changes of the name. |
55 |
57 |
56 @param txt current text of the name edit |
58 @param txt current text of the name edit |
57 @type str |
59 @type str |
58 """ |
60 """ |
59 self.__updateOkButton() |
61 self.__updateOkButton() |
60 |
62 |
61 def getData(self): |
63 def getData(self): |
62 """ |
64 """ |
63 Public method to get the entered data. |
65 Public method to get the entered data. |
64 |
66 |
65 @return tuple containing the variable name and value |
67 @return tuple containing the variable name and value |
66 @rtype tuple of (str, str) |
68 @rtype tuple of (str, str) |
67 """ |
69 """ |
68 return ( |
70 return ( |
69 self.nameEdit.text().strip(), |
71 self.nameEdit.text().strip(), |