eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleAddBuiltinIgnoreDialog.py

branch
eric7
changeset 8312
800c432b34c8
parent 8218
7c09585bd960
child 8318
962bce857696
equal deleted inserted replaced
8311:4e8b98454baa 8312:800c432b34c8
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2017 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing a dialog to enter the data for a built-in assignment to
8 be ignored.
9 """
10
11 from PyQt5.QtCore import pyqtSlot
12 from PyQt5.QtWidgets import QDialog, QDialogButtonBox
13
14 from .Ui_CodeStyleAddBuiltinIgnoreDialog import (
15 Ui_CodeStyleAddBuiltinIgnoreDialog
16 )
17
18
19 class CodeStyleAddBuiltinIgnoreDialog(QDialog,
20 Ui_CodeStyleAddBuiltinIgnoreDialog):
21 """
22 Class implementing a dialog to enter the data for a built-in assignment to
23 be ignored.
24 """
25 def __init__(self, parent=None):
26 """
27 Constructor
28
29 @param parent reference to the parent widget
30 @type QWidget
31 """
32 super().__init__(parent)
33 self.setupUi(self)
34
35 self.__updateOkButton
36
37 msh = self.minimumSizeHint()
38 self.resize(max(self.width(), msh.width()), msh.height())
39
40 def __updateOkButton(self):
41 """
42 Private slot to set the state of the OK button.
43 """
44 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(
45 bool(self.leftEdit.text()) and
46 bool(self.rightEdit.text()))
47
48 @pyqtSlot(str)
49 def on_leftEdit_textChanged(self, txt):
50 """
51 Private slot to handle a change of the text of the left side edit.
52
53 @param txt text of the line edit
54 @type str
55 """
56 self.__updateOkButton()
57
58 @pyqtSlot(str)
59 def on_rightEdit_textChanged(self, txt):
60 """
61 Private slot to handle a change of the text of the right side edit.
62
63 @param txt text of the line edit
64 @type str
65 """
66 self.__updateOkButton()
67
68 def getData(self):
69 """
70 Public method to get the entered data.
71
72 @return tuple containing the left and right hand side of the assignment
73 @rtype tuple of two str
74 """
75 return self.leftEdit.text(), self.rightEdit.text()

eric ide

mercurial