9 """ |
9 """ |
10 |
10 |
11 from PyQt6.QtCore import pyqtSlot |
11 from PyQt6.QtCore import pyqtSlot |
12 from PyQt6.QtWidgets import QDialog, QDialogButtonBox |
12 from PyQt6.QtWidgets import QDialog, QDialogButtonBox |
13 |
13 |
14 from .Ui_CodeStyleAddBuiltinIgnoreDialog import ( |
14 from .Ui_CodeStyleAddBuiltinIgnoreDialog import Ui_CodeStyleAddBuiltinIgnoreDialog |
15 Ui_CodeStyleAddBuiltinIgnoreDialog |
|
16 ) |
|
17 |
15 |
18 |
16 |
19 class CodeStyleAddBuiltinIgnoreDialog(QDialog, |
17 class CodeStyleAddBuiltinIgnoreDialog(QDialog, Ui_CodeStyleAddBuiltinIgnoreDialog): |
20 Ui_CodeStyleAddBuiltinIgnoreDialog): |
|
21 """ |
18 """ |
22 Class implementing a dialog to enter the data for a built-in assignment to |
19 Class implementing a dialog to enter the data for a built-in assignment to |
23 be ignored. |
20 be ignored. |
24 """ |
21 """ |
|
22 |
25 def __init__(self, parent=None): |
23 def __init__(self, parent=None): |
26 """ |
24 """ |
27 Constructor |
25 Constructor |
28 |
26 |
29 @param parent reference to the parent widget |
27 @param parent reference to the parent widget |
30 @type QWidget |
28 @type QWidget |
31 """ |
29 """ |
32 super().__init__(parent) |
30 super().__init__(parent) |
33 self.setupUi(self) |
31 self.setupUi(self) |
34 |
32 |
35 self.__updateOkButton |
33 self.__updateOkButton |
36 |
34 |
37 msh = self.minimumSizeHint() |
35 msh = self.minimumSizeHint() |
38 self.resize(max(self.width(), msh.width()), msh.height()) |
36 self.resize(max(self.width(), msh.width()), msh.height()) |
39 |
37 |
40 def __updateOkButton(self): |
38 def __updateOkButton(self): |
41 """ |
39 """ |
42 Private slot to set the state of the OK button. |
40 Private slot to set the state of the OK button. |
43 """ |
41 """ |
44 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( |
42 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( |
45 bool(self.leftEdit.text()) and |
43 bool(self.leftEdit.text()) and bool(self.rightEdit.text()) |
46 bool(self.rightEdit.text())) |
44 ) |
47 |
45 |
48 @pyqtSlot(str) |
46 @pyqtSlot(str) |
49 def on_leftEdit_textChanged(self, txt): |
47 def on_leftEdit_textChanged(self, txt): |
50 """ |
48 """ |
51 Private slot to handle a change of the text of the left side edit. |
49 Private slot to handle a change of the text of the left side edit. |
52 |
50 |
53 @param txt text of the line edit |
51 @param txt text of the line edit |
54 @type str |
52 @type str |
55 """ |
53 """ |
56 self.__updateOkButton() |
54 self.__updateOkButton() |
57 |
55 |
58 @pyqtSlot(str) |
56 @pyqtSlot(str) |
59 def on_rightEdit_textChanged(self, txt): |
57 def on_rightEdit_textChanged(self, txt): |
60 """ |
58 """ |
61 Private slot to handle a change of the text of the right side edit. |
59 Private slot to handle a change of the text of the right side edit. |
62 |
60 |
63 @param txt text of the line edit |
61 @param txt text of the line edit |
64 @type str |
62 @type str |
65 """ |
63 """ |
66 self.__updateOkButton() |
64 self.__updateOkButton() |
67 |
65 |
68 def getData(self): |
66 def getData(self): |
69 """ |
67 """ |
70 Public method to get the entered data. |
68 Public method to get the entered data. |
71 |
69 |
72 @return tuple containing the left and right hand side of the assignment |
70 @return tuple containing the left and right hand side of the assignment |
73 @rtype tuple of two str |
71 @rtype tuple of two str |
74 """ |
72 """ |
75 return self.leftEdit.text(), self.rightEdit.text() |
73 return self.leftEdit.text(), self.rightEdit.text() |