src/eric7/UI/AuthenticationDialog.py

branch
eric7
changeset 9209
b99e7fd55fd3
parent 8881
54e42bc2437a
child 9221
bf71ee032bb4
equal deleted inserted replaced
9208:3fc8dfeb6ebe 9209:b99e7fd55fd3
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2008 - 2022 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing the authentication dialog for the help browser.
8 """
9
10 from PyQt6.QtWidgets import QDialog, QStyle
11
12 from .Ui_AuthenticationDialog import Ui_AuthenticationDialog
13
14
15 class AuthenticationDialog(QDialog, Ui_AuthenticationDialog):
16 """
17 Class implementing the authentication dialog for the help browser.
18 """
19 def __init__(self, info, username, showSave=False, saveIt=False,
20 parent=None):
21 """
22 Constructor
23
24 @param info information to be shown (string)
25 @param username username as supplied by subversion (string)
26 @param showSave flag to indicate to show the save checkbox (boolean)
27 @param saveIt flag indicating the value for the save checkbox (boolean)
28 @param parent reference to the parent widget (QWidget)
29 """
30 super().__init__(parent)
31 self.setupUi(self)
32
33 self.infoLabel.setText(info)
34 self.usernameEdit.setText(username)
35 self.saveCheckBox.setVisible(showSave)
36 self.saveCheckBox.setChecked(saveIt)
37
38 self.iconLabel.setText("")
39 self.iconLabel.setPixmap(
40 self.style().standardIcon(
41 QStyle.StandardPixmap.SP_MessageBoxQuestion)
42 .pixmap(32, 32))
43
44 msh = self.minimumSizeHint()
45 self.resize(max(self.width(), msh.width()), msh.height())
46
47 def setData(self, username, password):
48 """
49 Public method to set the login data.
50
51 @param username username (string)
52 @param password password (string)
53 """
54 self.usernameEdit.setText(username)
55 self.passwordEdit.setText(password)
56
57 def getData(self):
58 """
59 Public method to retrieve the login data.
60
61 @return tuple of two string values (username, password)
62 """
63 return (self.usernameEdit.text(), self.passwordEdit.text())
64
65 def shallSave(self):
66 """
67 Public method to check, if the login data shall be saved.
68
69 @return flag indicating that the login data shall be saved (boolean)
70 """
71 return self.saveCheckBox.isChecked()

eric ide

mercurial