2 |
2 |
3 # Copyright (c) 2003 - 2011 Detlev Offenbach <detlev@die-offenbachs.de> |
3 # Copyright (c) 2003 - 2011 Detlev Offenbach <detlev@die-offenbachs.de> |
4 # |
4 # |
5 |
5 |
6 """ |
6 """ |
7 Module implementing a dialog mixin class providing common callback methods for |
7 Module implementing a dialog mixin class providing common callback methods for |
8 the pysvn client. |
8 the pysvn client. |
9 """ |
9 """ |
10 |
10 |
11 from PyQt4.QtGui import QApplication, QDialog, QWidget, QCursor |
11 from PyQt4.QtGui import QApplication, QDialog, QWidget, QCursor |
12 |
12 |
|
13 |
13 class SvnDialogMixin(object): |
14 class SvnDialogMixin(object): |
14 """ |
15 """ |
15 Class implementing a dialog mixin providing common callback methods for |
16 Class implementing a dialog mixin providing common callback methods for |
16 the pysvn client. |
17 the pysvn client. |
17 """ |
18 """ |
18 def __init__(self, log = ""): |
19 def __init__(self, log=""): |
19 """ |
20 """ |
20 Constructor |
21 Constructor |
21 |
22 |
22 @param log optional log message (string) |
23 @param log optional log message (string) |
23 """ |
24 """ |
52 @param realm name of the realm of the requested credentials (string) |
53 @param realm name of the realm of the requested credentials (string) |
53 @param username username as supplied by subversion (string) |
54 @param username username as supplied by subversion (string) |
54 @param may_save flag indicating, that subversion is willing to save |
55 @param may_save flag indicating, that subversion is willing to save |
55 the answers returned (boolean) |
56 the answers returned (boolean) |
56 @return tuple of four values (retcode, username, password, save). |
57 @return tuple of four values (retcode, username, password, save). |
57 Retcode should be True, if username and password should be used |
58 Retcode should be True, if username and password should be used |
58 by subversion, username and password contain the relevant data |
59 by subversion, username and password contain the relevant data |
59 as strings and save is a flag indicating, that username and |
60 as strings and save is a flag indicating, that username and |
60 password should be saved. |
61 password should be saved. |
61 """ |
62 """ |
62 from .SvnLoginDialog import SvnLoginDialog |
63 from .SvnLoginDialog import SvnLoginDialog |
63 cursor = QApplication.overrideCursor() |
64 cursor = QApplication.overrideCursor() |
100 """<tr><td>Fingerprint:</td><td>{2}</td></tr>""" |
101 """<tr><td>Fingerprint:</td><td>{2}</td></tr>""" |
101 """<tr><td>Valid from:</td><td>{3}</td></tr>""" |
102 """<tr><td>Valid from:</td><td>{3}</td></tr>""" |
102 """<tr><td>Valid until:</td><td>{4}</td></tr>""" |
103 """<tr><td>Valid until:</td><td>{4}</td></tr>""" |
103 """<tr><td>Issuer name:</td><td>{5}</td></tr>""" |
104 """<tr><td>Issuer name:</td><td>{5}</td></tr>""" |
104 """</table>""")\ |
105 """</table>""")\ |
105 .format(trust_dict["realm"], |
106 .format(trust_dict["realm"], |
106 trust_dict["hostname"], |
107 trust_dict["hostname"], |
107 trust_dict["finger_print"], |
108 trust_dict["finger_print"], |
108 trust_dict["valid_from"], |
109 trust_dict["valid_from"], |
109 trust_dict["valid_until"], |
110 trust_dict["valid_until"], |
110 trust_dict["issuer_dname"]), |
111 trust_dict["issuer_dname"]), |
111 modal = True, parent = parent) |
112 modal=True, parent=parent) |
112 permButton = msgBox.addButton(self.trUtf8("&Permanent accept"), |
113 permButton = msgBox.addButton(self.trUtf8("&Permanent accept"), |
113 E5MessageBox.AcceptRole) |
114 E5MessageBox.AcceptRole) |
114 tempButton = msgBox.addButton(self.trUtf8("&Temporary accept"), |
115 tempButton = msgBox.addButton(self.trUtf8("&Temporary accept"), |
115 E5MessageBox.AcceptRole) |
116 E5MessageBox.AcceptRole) |
116 msgBox.addButton(self.trUtf8("&Reject"), E5MessageBox.RejectRole) |
117 msgBox.addButton(self.trUtf8("&Reject"), E5MessageBox.RejectRole) |
117 msgBox.exec_() |
118 msgBox.exec_() |
118 if cursor is not None: |
119 if cursor is not None: |
119 QApplication.setOverrideCursor(cursor) |
120 QApplication.setOverrideCursor(cursor) |