eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleAddBuiltinIgnoreDialog.py

Sun, 04 Oct 2020 15:25:17 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 04 Oct 2020 15:25:17 +0200
changeset 7749
285855999b4e
parent 7360
9190402e4505
child 7780
41420f82c0ac
permissions
-rw-r--r--

Configuration Dialog: optimized the display of the various configuration pages.

5619
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
7360
9190402e4505 Updated copyright for 2020.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7256
diff changeset
3 # Copyright (c) 2017 - 2020 Detlev Offenbach <detlev@die-offenbachs.de>
5619
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing a dialog to enter the data for a built-in assignment to
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 be ignored.
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9 """
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10
5624
cdd346d8858b Removed a bunch of __IGNORE_WARNING_M131__ markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5621
diff changeset
11
5619
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12 from PyQt5.QtCore import pyqtSlot
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13 from PyQt5.QtWidgets import QDialog, QDialogButtonBox
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14
7256
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
15 from .Ui_CodeStyleAddBuiltinIgnoreDialog import (
5619
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16 Ui_CodeStyleAddBuiltinIgnoreDialog
7256
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
17 )
5619
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19
5621
80cce672d505 Added a checker for using mutable types as default functiona rgument (M821).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5619
diff changeset
20 class CodeStyleAddBuiltinIgnoreDialog(QDialog,
5619
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 Ui_CodeStyleAddBuiltinIgnoreDialog):
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 """
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 Class implementing a dialog to enter the data for a built-in assignment to
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 be ignored.
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 """
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 def __init__(self, parent=None):
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 """
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 Constructor
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 @param parent reference to the parent widget
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 @type QWidget
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 """
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 super(CodeStyleAddBuiltinIgnoreDialog, self).__init__(parent)
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 self.setupUi(self)
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 self.__updateOkButton
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 msh = self.minimumSizeHint()
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 self.resize(max(self.width(), msh.width()), msh.height())
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 def __updateOkButton(self):
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 """
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 Private slot to set the state of the OK button.
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 """
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 bool(self.leftEdit.text()) and
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 bool(self.rightEdit.text()))
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 @pyqtSlot(str)
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 def on_leftEdit_textChanged(self, txt):
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 """
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 Private slot to handle a change of the text of the left side edit.
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 @param txt text of the line edit
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 @type str
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 """
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 self.__updateOkButton()
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 @pyqtSlot(str)
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60 def on_rightEdit_textChanged(self, txt):
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 """
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62 Private slot to handle a change of the text of the right side edit.
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64 @param txt text of the line edit
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65 @type str
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 """
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 self.__updateOkButton()
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 def getData(self):
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 """
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 Public method to get the entered data.
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 @return tuple containing the left and right hand side of the assignment
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 @rtype tuple of two str
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75 """
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 return self.leftEdit.text(), self.rightEdit.text()

eric ide

mercurial