eric6/UI/AuthenticationDialog.py

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

eric ide

mercurial