Plugins/VcsPlugins/vcsPySvn/SvnDialogMixin.py

changeset 553
5af61623ae3c
parent 540
2631831b4052
child 791
9ec2ac20e54e
equal deleted inserted replaced
551:e1074b63ff08 553:5af61623ae3c
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.QtCore import Qt
12 from PyQt4.QtGui import QApplication, QDialog, QWidget, QCursor 11 from PyQt4.QtGui import QApplication, QDialog, QWidget, QCursor
13 12
14 class SvnDialogMixin(object): 13 class SvnDialogMixin(object):
15 """ 14 """
16 Class implementing a dialog mixin providing common callback methods for 15 Class implementing a dialog mixin providing common callback methods for
84 @return tuple of three values (retcode, acceptedFailures, save). 83 @return tuple of three values (retcode, acceptedFailures, save).
85 Retcode should be true, if the certificate should be accepted, 84 Retcode should be true, if the certificate should be accepted,
86 acceptedFailures should indicate the accepted certificate failures 85 acceptedFailures should indicate the accepted certificate failures
87 and save should be True, if subversion should save the certificate. 86 and save should be True, if subversion should save the certificate.
88 """ 87 """
89 from PyQt4.QtGui import QMessageBox 88 from E5Gui import E5MessageBox
90 89
91 cursor = QCursor(QApplication.overrideCursor()) 90 cursor = QCursor(QApplication.overrideCursor())
92 if cursor is not None: 91 if cursor is not None:
93 QApplication.restoreOverrideCursor() 92 QApplication.restoreOverrideCursor()
94 parent = isinstance(self, QWidget) and self or None 93 parent = isinstance(self, QWidget) and self or None
95 msgBox = QMessageBox.QMessageBox(QMessageBox.Question, 94 msgBox = E5MessageBox.E5MessageBox(E5MessageBox.Question,
96 self.trUtf8("Subversion SSL Server Certificate"), 95 self.trUtf8("Subversion SSL Server Certificate"),
97 self.trUtf8("""<p>Accept the following SSL certificate?</p>""" 96 self.trUtf8("""<p>Accept the following SSL certificate?</p>"""
98 """<table>""" 97 """<table>"""
99 """<tr><td>Realm:</td><td>{0}</td></tr>""" 98 """<tr><td>Realm:</td><td>{0}</td></tr>"""
100 """<tr><td>Hostname:</td><td>{1}</td></tr>""" 99 """<tr><td>Hostname:</td><td>{1}</td></tr>"""
107 trust_dict["hostname"], 106 trust_dict["hostname"],
108 trust_dict["finger_print"], 107 trust_dict["finger_print"],
109 trust_dict["valid_from"], 108 trust_dict["valid_from"],
110 trust_dict["valid_until"], 109 trust_dict["valid_until"],
111 trust_dict["issuer_dname"]), 110 trust_dict["issuer_dname"]),
112 QMessageBox.StandardButtons(QMessageBox.NoButton), 111 modal = True, parent = parent)
113 parent)
114 if parent is not None:
115 msgBox.setWindowModality(Qt.WindowModal)
116 permButton = msgBox.addButton(self.trUtf8("&Permanent accept"), 112 permButton = msgBox.addButton(self.trUtf8("&Permanent accept"),
117 QMessageBox.AcceptRole) 113 E5MessageBox.AcceptRole)
118 tempButton = msgBox.addButton(self.trUtf8("&Temporary accept"), 114 tempButton = msgBox.addButton(self.trUtf8("&Temporary accept"),
119 QMessageBox.AcceptRole) 115 E5MessageBox.AcceptRole)
120 msgBox.addButton(self.trUtf8("&Reject"), QMessageBox.RejectRole) 116 msgBox.addButton(self.trUtf8("&Reject"), E5MessageBox.RejectRole)
121 msgBox.exec_() 117 msgBox.exec_()
122 if cursor is not None: 118 if cursor is not None:
123 QApplication.setOverrideCursor(cursor) 119 QApplication.setOverrideCursor(cursor)
124 if msgBox.clickedButton() == permButton: 120 if msgBox.clickedButton() == permButton:
125 return (True, trust_dict["failures"], True) 121 return (True, trust_dict["failures"], True)

eric ide

mercurial