src/eric7/EricWidgets/EricTextInputDialog.py

Fri, 04 Nov 2022 13:52:26 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 04 Nov 2022 13:52:26 +0100
branch
eric7
changeset 9473
3f23dbf37dbe
parent 9221
bf71ee032bb4
child 9653
e67609152c5e
permissions
-rw-r--r--

Resorted the import statements using isort.

6532
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
8881
54e42bc2437a Updated copyright for 2022.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8358
diff changeset
3 # Copyright (c) 2018 - 2022 Detlev Offenbach <detlev@die-offenbachs.de>
6532
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing a dialog to enter some text.
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
9473
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9221
diff changeset
10 from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QLabel, QLineEdit, QVBoxLayout
6532
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12
8356
68ec9c3d4de5 Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8350
diff changeset
13 class EricTextInputDialog(QDialog):
6532
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14 """
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15 Class implementing a dialog to enter some text.
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
17
6532
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 def __init__(self, parent=None):
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 """
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20 Constructor
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
21
6532
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 @param parent reference to the parent widget
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 @type QWidget
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 """
8218
7c09585bd960 Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8143
diff changeset
25 super().__init__(parent)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
26
6532
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 self.setMaximumWidth(600)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
28
6532
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 self.__layout = QVBoxLayout(self)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
30
6532
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 self.__label = QLabel(self)
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 self.__layout.addWidget(self.__label)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
33
8350
74a3b2a6a944 Removed all references to E5ComboBox and most references to E5LineEdit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
34 self.__lineEdit = QLineEdit(self)
74a3b2a6a944 Removed all references to E5ComboBox and most references to E5LineEdit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
35 self.__lineEdit.setClearButtonEnabled(True)
6532
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 self.__layout.addWidget(self.__lineEdit)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
37
6532
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 self.__buttonBox = QDialogButtonBox(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
39 QDialogButtonBox.StandardButton.Ok | QDialogButtonBox.StandardButton.Cancel,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
40 self,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
41 )
6532
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 self.__layout.addWidget(self.__buttonBox)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
43
6532
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 self.__buttonBox.accepted.connect(self.accept)
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 self.__buttonBox.rejected.connect(self.reject)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
46
6532
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 msh = self.minimumSizeHint()
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 self.resize(max(self.width(), msh.width()), msh.height())
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
49
6532
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 def setTextEchoMode(self, echoMode):
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 """
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 Public method to set the echo mode of the line edit.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
53
6532
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 @param echoMode echo mode of the line edit
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 @type QLineEdit.EchoMode
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 """
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 self.__lineEdit.setEchoMode(echoMode)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
58
6532
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 def textEchoMode(self):
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60 """
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 Public method to get the current echo mode of the line edit.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
62
6532
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63 @return echo mode of the line edit
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64 @rtype QLineEdit.EchoMode
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65 """
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 return self.__lineEdit.echoMode()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
67
6532
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 def setTextValue(self, text):
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 """
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 Public method to set the text of the line edit.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
71
6532
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 @param text text for the line edit
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 @type str
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 """
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75 self.__lineEdit.setText(text)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
76
6532
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77 def textValue(self):
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 """
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79 Public method to get the text of the line edit.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
80
6532
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81 @return text of the line edit
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82 @rtype str
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 """
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84 return self.__lineEdit.text()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
85
6532
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86 def setLabelText(self, text):
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87 """
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88 Public method to set the label text.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
89
6532
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90 @param text label text
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91 @type str
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92 """
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93 self.__label.setText(text)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
94
6533
b7df503cb673 E5TextInputDialog: did some finetuning.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6532
diff changeset
95 msh = self.minimumSizeHint()
b7df503cb673 E5TextInputDialog: did some finetuning.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6532
diff changeset
96 labelSizeHint = self.__label.sizeHint()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
97 self.resize(max(self.width(), msh.width(), labelSizeHint.width()), msh.height())
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
98
6532
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
99 def labelText(self):
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
100 """
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
101 Public method to get the current label text.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
102
6532
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103 @return current label text
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
104 @rtype str
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105 """
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
106 return self.label.text()
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
109 def getText(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
110 parent, title, label, mode=QLineEdit.EchoMode.Normal, text="", minimumWidth=300
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
111 ):
6532
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
112 """
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
113 Function to get create a dialog to enter some text and return it.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
114
6532
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115 @param parent reference to the parent widget
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116 @type QWidget
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
117 @param title title of the dialog
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
118 @type str
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
119 @param label label of the dialog
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
120 @type str
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
121 @param mode echo mode of the line edit
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
122 @type QLineEdit.EchoMode
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
123 @param text initial text of the line edit
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
124 @type str
6533
b7df503cb673 E5TextInputDialog: did some finetuning.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6532
diff changeset
125 @param minimumWidth minimum width of the dialog
b7df503cb673 E5TextInputDialog: did some finetuning.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6532
diff changeset
126 @type int
6532
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
127 @return tuple containing a flag indicating the dialog was accepted and the
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
128 entered text
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
129 @rtype tuple of (bool, str)
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130 """
8356
68ec9c3d4de5 Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8350
diff changeset
131 dlg = EricTextInputDialog(parent)
6532
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
132 dlg.setWindowTitle(title)
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
133 dlg.setLabelText(label)
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
134 dlg.setTextEchoMode(mode)
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
135 dlg.setTextValue(text)
6533
b7df503cb673 E5TextInputDialog: did some finetuning.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6532
diff changeset
136 dlg.setMinimumWidth(minimumWidth)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
137
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
138 if dlg.exec() == QDialog.DialogCode.Accepted:
6532
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
139 return True, dlg.textValue()
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
140 else:
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
141 return False, ""

eric ide

mercurial