eric6/E5Gui/E5TextInputDialog.py

Sat, 27 Feb 2021 12:08:23 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 27 Feb 2021 12:08:23 +0100
changeset 8138
169e65a6787c
parent 7923
91e843545d9a
child 8143
2c730d5fd177
permissions
-rw-r--r--

Shell: added functionality to show a prompt when the main client process has exited (e.g. a script ended).

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
7923
91e843545d9a Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
3 # Copyright (c) 2018 - 2021 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
7252
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
10 from PyQt5.QtWidgets import (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
11 QDialog, QDialogButtonBox, QVBoxLayout, QLabel, QLineEdit
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
12 )
6532
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14 from E5Gui.E5LineEdit import E5ClearableLineEdit
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17 class E5TextInputDialog(QDialog):
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 """
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 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
20 """
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 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
22 """
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 Constructor
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 @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
26 @type QWidget
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 """
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 super(E5TextInputDialog, self).__init__(parent)
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 self.setMaximumWidth(600)
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 self.__layout = QVBoxLayout(self)
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 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
35 self.__layout.addWidget(self.__label)
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 self.__lineEdit = E5ClearableLineEdit(self)
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 self.__layout.addWidget(self.__lineEdit)
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 self.__buttonBox = QDialogButtonBox(
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 QDialogButtonBox.Ok | QDialogButtonBox.Cancel, self)
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)
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43
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)
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46
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())
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49
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.
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53
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)
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58
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.
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62
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()
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67
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.
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71
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)
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76
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.
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80
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()
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85
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.
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89
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)
6533
b7df503cb673 E5TextInputDialog: did some finetuning.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6532
diff changeset
94
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()
b7df503cb673 E5TextInputDialog: did some finetuning.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6532
diff changeset
97 self.resize(max(self.width(), msh.width(), labelSizeHint.width()),
b7df503cb673 E5TextInputDialog: did some finetuning.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6532
diff changeset
98 msh.height())
6532
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
99
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
100 def labelText(self):
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
101 """
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
102 Public method to get the current label text.
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
104 @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
105 @rtype str
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
106 """
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107 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
108
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109
6533
b7df503cb673 E5TextInputDialog: did some finetuning.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6532
diff changeset
110 def getText(parent, title, label, mode=QLineEdit.Normal, text="",
b7df503cb673 E5TextInputDialog: did some finetuning.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6532
diff changeset
111 minimumWidth=300):
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.
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
114
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 """
f253f0f9ea7f E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
131 dlg = E5TextInputDialog(parent)
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)
b7df503cb673 E5TextInputDialog: did some finetuning.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6532
diff changeset
137
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
138 if dlg.exec() == QDialog.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