Sat, 02 Feb 2019 11:12:54 +0100
Merged with default branch to prepare release 19.02.
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 | |
6645
ad476851d7e0
Updated copyright for 2019.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6533
diff
changeset
|
3 | # Copyright (c) 2018 - 2019 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 | |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
10 | from __future__ import unicode_literals |
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 | from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QVBoxLayout, QLabel, \ |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
13 | QLineEdit |
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 | 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
|
16 | |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
17 | |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
18 | class E5TextInputDialog(QDialog): |
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 | 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
|
21 | """ |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
22 | 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
|
23 | """ |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
24 | Constructor |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
25 | |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
26 | @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
|
27 | @type QWidget |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
28 | """ |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
29 | 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
|
30 | |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
31 | self.setMaximumWidth(600) |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
32 | |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
33 | 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
|
34 | |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
35 | 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
|
36 | 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
|
37 | |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
38 | 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
|
39 | 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
|
40 | |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
41 | self.__buttonBox = QDialogButtonBox( |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
42 | 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
|
43 | 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
|
44 | |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
45 | 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
|
46 | 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
|
47 | |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
48 | msh = self.minimumSizeHint() |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
49 | 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
|
50 | |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
51 | 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
|
52 | """ |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
53 | 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
|
54 | |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
55 | @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
|
56 | @type QLineEdit.EchoMode |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
57 | """ |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
58 | 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
|
59 | |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
60 | def textEchoMode(self): |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
61 | """ |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
62 | 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
|
63 | |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
64 | @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
|
65 | @rtype QLineEdit.EchoMode |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
66 | """ |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
67 | 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
|
68 | |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
69 | 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
|
70 | """ |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
71 | 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
|
72 | |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
73 | @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
|
74 | @type str |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
75 | """ |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
76 | 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
|
77 | |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
78 | def textValue(self): |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
79 | """ |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
80 | 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
|
81 | |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
82 | @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
|
83 | @rtype str |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
84 | """ |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
85 | 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
|
86 | |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
87 | 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
|
88 | """ |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
89 | 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
|
90 | |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
91 | @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
|
92 | @type str |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
93 | """ |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
94 | self.__label.setText(text) |
6533
b7df503cb673
E5TextInputDialog: did some finetuning.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6532
diff
changeset
|
95 | |
b7df503cb673
E5TextInputDialog: did some finetuning.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6532
diff
changeset
|
96 | msh = self.minimumSizeHint() |
b7df503cb673
E5TextInputDialog: did some finetuning.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6532
diff
changeset
|
97 | labelSizeHint = self.__label.sizeHint() |
b7df503cb673
E5TextInputDialog: did some finetuning.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6532
diff
changeset
|
98 | self.resize(max(self.width(), msh.width(), labelSizeHint.width()), |
b7df503cb673
E5TextInputDialog: did some finetuning.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6532
diff
changeset
|
99 | msh.height()) |
6532
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 | def labelText(self): |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
102 | """ |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
103 | 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
|
104 | |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
105 | @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
|
106 | @rtype str |
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 | 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
|
109 | |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
110 | |
6533
b7df503cb673
E5TextInputDialog: did some finetuning.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6532
diff
changeset
|
111 | def getText(parent, title, label, mode=QLineEdit.Normal, text="", |
b7df503cb673
E5TextInputDialog: did some finetuning.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6532
diff
changeset
|
112 | minimumWidth=300): |
6532
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
113 | """ |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
114 | 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
|
115 | |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
116 | @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
|
117 | @type QWidget |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
118 | @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
|
119 | @type str |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
120 | @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
|
121 | @type str |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
122 | @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
|
123 | @type QLineEdit.EchoMode |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
124 | @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
|
125 | @type str |
6533
b7df503cb673
E5TextInputDialog: did some finetuning.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6532
diff
changeset
|
126 | @param minimumWidth minimum width of the dialog |
b7df503cb673
E5TextInputDialog: did some finetuning.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6532
diff
changeset
|
127 | @type int |
6532
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
128 | @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
|
129 | entered text |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
130 | @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
|
131 | """ |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
132 | dlg = E5TextInputDialog(parent) |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
133 | dlg.setWindowTitle(title) |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
134 | dlg.setLabelText(label) |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
135 | dlg.setTextEchoMode(mode) |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
136 | dlg.setTextValue(text) |
6533
b7df503cb673
E5TextInputDialog: did some finetuning.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6532
diff
changeset
|
137 | dlg.setMinimumWidth(minimumWidth) |
b7df503cb673
E5TextInputDialog: did some finetuning.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6532
diff
changeset
|
138 | |
6532
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
139 | if dlg.exec_() == QDialog.Accepted: |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
140 | 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
|
141 | else: |
f253f0f9ea7f
E5TextInputDialog: added a text input dialog using the clearable line edit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
142 | return False, "" |