Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleAddBuiltinIgnoreDialog.py

changeset 5619
ab999dc48132
child 5621
80cce672d505
equal deleted inserted replaced
5618:b50da40b6bc9 5619:ab999dc48132
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2017 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 class CodeStyleAddBuiltinIgnoreDialog(QDialog,
19 Ui_CodeStyleAddBuiltinIgnoreDialog):
20 """
21 Class implementing a dialog to enter the data for a built-in assignment to
22 be ignored.
23 """
24 def __init__(self, parent=None):
25 """
26 Constructor
27
28 @param parent reference to the parent widget
29 @type QWidget
30 """
31 super(CodeStyleAddBuiltinIgnoreDialog, self).__init__(parent)
32 self.setupUi(self)
33
34 self.__updateOkButton
35
36 msh = self.minimumSizeHint()
37 self.resize(max(self.width(), msh.width()), msh.height())
38
39 def __updateOkButton(self):
40 """
41 Private slot to set the state of the OK button.
42 """
43 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(
44 bool(self.leftEdit.text()) and
45 bool(self.rightEdit.text()))
46
47 @pyqtSlot(str)
48 def on_leftEdit_textChanged(self, txt):
49 """
50 Private slot to handle a change of the text of the left side edit.
51
52 @param txt text of the line edit
53 @type str
54 """
55 self.__updateOkButton()
56
57 @pyqtSlot(str)
58 def on_rightEdit_textChanged(self, txt):
59 """
60 Private slot to handle a change of the text of the right side edit.
61
62 @param txt text of the line edit
63 @type str
64 """
65 self.__updateOkButton()
66
67 def getData(self):
68 """
69 Public method to get the entered data.
70
71 @return tuple containing the left and right hand side of the assignment
72 @rtype tuple of two str
73 """
74 return self.leftEdit.text(), self.rightEdit.text()

eric ide

mercurial