Plugins/VcsPlugins/vcsMercurial/HgClientPromptDialog.py

Sun, 27 Sep 2015 18:18:14 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 27 Sep 2015 18:18:14 +0200
changeset 4471
2dedc0c4a8fa
parent 4021
195a471c327b
child 4475
dde2aa51ac0b
permissions
-rw-r--r--

Fixed an issue causing a password being entered in visible and shown in the output of the Mercurial command server client.

1323
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
4021
195a471c327b Updated copyright for 2015.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
3 # Copyright (c) 2011 - 2015 Detlev Offenbach <detlev@die-offenbachs.de>
1323
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing a prompt dialog for the Mercurial command server.
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
3145
a9de05d4a22f # __IGNORE_WARNING__ added/ removed.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2525
diff changeset
10 from __future__ import unicode_literals
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2302
diff changeset
11
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3178
diff changeset
12 from PyQt5.QtCore import pyqtSlot
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3178
diff changeset
13 from PyQt5.QtGui import QTextCursor
4471
2dedc0c4a8fa Fixed an issue causing a password being entered in visible and shown in the output of the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
14 from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QLineEdit
1323
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16 from .Ui_HgClientPromptDialog import Ui_HgClientPromptDialog
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 class HgClientPromptDialog(QDialog, Ui_HgClientPromptDialog):
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20 """
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 Class implementing a prompt dialog for the Mercurial command server.
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 """
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 def __init__(self, size, message, parent=None):
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 """
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 Constructor
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 @param size maximum length of the requested input (integer)
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 @param message message sent by the server (string)
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 @param parent reference to the parent widget (QWidget)
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2302
diff changeset
31 super(HgClientPromptDialog, self).__init__(parent)
1323
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 self.setupUi(self)
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 self.inputEdit.setMaxLength(size)
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 self.messageEdit.setPlainText(message)
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 tc = self.messageEdit.textCursor()
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 tc.movePosition(QTextCursor.End)
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 self.messageEdit.setTextCursor(tc)
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 self.messageEdit.ensureCursorVisible()
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 @pyqtSlot(str)
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 def on_inputEdit_textChanged(self, txt):
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 """
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 Private slot to handle changes of the user input.
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 @param txt text entered by the user (string)
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 """
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(bool(txt))
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52
4471
2dedc0c4a8fa Fixed an issue causing a password being entered in visible and shown in the output of the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
53 @pyqtSlot(bool)
2dedc0c4a8fa Fixed an issue causing a password being entered in visible and shown in the output of the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
54 def on_passwordCheckBox_toggled(self, isOn):
2dedc0c4a8fa Fixed an issue causing a password being entered in visible and shown in the output of the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
55 """
2dedc0c4a8fa Fixed an issue causing a password being entered in visible and shown in the output of the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
56 Private slot to handle the password checkbox toggled.
2dedc0c4a8fa Fixed an issue causing a password being entered in visible and shown in the output of the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
57
2dedc0c4a8fa Fixed an issue causing a password being entered in visible and shown in the output of the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
58 @param isOn flag indicating the status of the check box (boolean)
2dedc0c4a8fa Fixed an issue causing a password being entered in visible and shown in the output of the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
59 """
2dedc0c4a8fa Fixed an issue causing a password being entered in visible and shown in the output of the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
60 if isOn:
2dedc0c4a8fa Fixed an issue causing a password being entered in visible and shown in the output of the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
61 self.inputEdit.setEchoMode(QLineEdit.Password)
2dedc0c4a8fa Fixed an issue causing a password being entered in visible and shown in the output of the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
62 else:
2dedc0c4a8fa Fixed an issue causing a password being entered in visible and shown in the output of the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
63 self.inputEdit.setEchoMode(QLineEdit.Normal)
2dedc0c4a8fa Fixed an issue causing a password being entered in visible and shown in the output of the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
64
1323
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65 def getInput(self):
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 """
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 Public method to get the user input.
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 @return user input (string)
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 """
3126121aeb4f Added a prompt window for the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 return self.inputEdit.text()
4471
2dedc0c4a8fa Fixed an issue causing a password being entered in visible and shown in the output of the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
72
2dedc0c4a8fa Fixed an issue causing a password being entered in visible and shown in the output of the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
73 def isPassword(self):
2dedc0c4a8fa Fixed an issue causing a password being entered in visible and shown in the output of the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
74 """
2dedc0c4a8fa Fixed an issue causing a password being entered in visible and shown in the output of the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
75 Public method to check, if the input was a password.
2dedc0c4a8fa Fixed an issue causing a password being entered in visible and shown in the output of the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
76
2dedc0c4a8fa Fixed an issue causing a password being entered in visible and shown in the output of the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
77 @return flag indicating a password
2dedc0c4a8fa Fixed an issue causing a password being entered in visible and shown in the output of the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
78 @rtype bool
2dedc0c4a8fa Fixed an issue causing a password being entered in visible and shown in the output of the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
79 """
2dedc0c4a8fa Fixed an issue causing a password being entered in visible and shown in the output of the Mercurial command server client.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
80 return self.passwordCheckBox.isChecked()

eric ide

mercurial