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