eric6/Plugins/VcsPlugins/vcsPySvn/SvnDialogMixin.py

changeset 7771
787a6b3f8c9f
parent 7759
51aa6c6b66f7
child 7923
91e843545d9a
--- a/eric6/Plugins/VcsPlugins/vcsPySvn/SvnDialogMixin.py	Fri Oct 09 17:19:29 2020 +0200
+++ b/eric6/Plugins/VcsPlugins/vcsPySvn/SvnDialogMixin.py	Sat Oct 10 12:20:51 2020 +0200
@@ -8,9 +8,9 @@
 the pysvn client.
 """
 
+from PyQt5.QtWidgets import QApplication, QDialog, QWidget
 
-from PyQt5.QtCore import Qt
-from PyQt5.QtWidgets import QApplication, QDialog, QWidget
+from E5Gui.E5OverrideCursor import E5OverridenCursor
 
 
 class SvnDialogMixin(object):
@@ -63,14 +63,12 @@
             password should be saved.
         """
         from .SvnLoginDialog import SvnLoginDialog
-        cursor = QApplication.overrideCursor()
-        if cursor is not None:
-            QApplication.restoreOverrideCursor()
-        parent = isinstance(self, QWidget) and self or None
-        dlg = SvnLoginDialog(realm, username, may_save, parent)
-        res = dlg.exec()
-        if cursor is not None:
-            QApplication.setOverrideCursor(Qt.WaitCursor)
+        
+        with E5OverridenCursor():
+            parent = isinstance(self, QWidget) and self or None
+            dlg = SvnLoginDialog(realm, username, may_save, parent)
+            res = dlg.exec()
+        
         if res == QDialog.Accepted:
             loginData = dlg.getData()
             return (True, loginData[0], loginData[1], loginData[2])
@@ -90,37 +88,34 @@
         """
         from E5Gui import E5MessageBox
 
-        cursor = QApplication.overrideCursor()
-        if cursor is not None:
-            QApplication.restoreOverrideCursor()
-        parent = isinstance(self, QWidget) and self or None
-        msgBox = E5MessageBox.E5MessageBox(
-            E5MessageBox.Question,
-            self.tr("Subversion SSL Server Certificate"),
-            self.tr("""<p>Accept the following SSL certificate?</p>"""
-                    """<table>"""
-                    """<tr><td>Realm:</td><td>{0}</td></tr>"""
-                    """<tr><td>Hostname:</td><td>{1}</td></tr>"""
-                    """<tr><td>Fingerprint:</td><td>{2}</td></tr>"""
-                    """<tr><td>Valid from:</td><td>{3}</td></tr>"""
-                    """<tr><td>Valid until:</td><td>{4}</td></tr>"""
-                    """<tr><td>Issuer name:</td><td>{5}</td></tr>"""
-                    """</table>""")
-                .format(trust_dict["realm"],
-                        trust_dict["hostname"],
-                        trust_dict["finger_print"],
-                        trust_dict["valid_from"],
-                        trust_dict["valid_until"],
-                        trust_dict["issuer_dname"]),
-            modal=True, parent=parent)
-        permButton = msgBox.addButton(self.tr("&Permanent accept"),
-                                      E5MessageBox.AcceptRole)
-        tempButton = msgBox.addButton(self.tr("&Temporary accept"),
-                                      E5MessageBox.AcceptRole)
-        msgBox.addButton(self.tr("&Reject"), E5MessageBox.RejectRole)
-        msgBox.exec()
-        if cursor is not None:
-            QApplication.setOverrideCursor(Qt.WaitCursor)
+        with E5OverridenCursor():
+            parent = isinstance(self, QWidget) and self or None
+            msgBox = E5MessageBox.E5MessageBox(
+                E5MessageBox.Question,
+                self.tr("Subversion SSL Server Certificate"),
+                self.tr("""<p>Accept the following SSL certificate?</p>"""
+                        """<table>"""
+                        """<tr><td>Realm:</td><td>{0}</td></tr>"""
+                        """<tr><td>Hostname:</td><td>{1}</td></tr>"""
+                        """<tr><td>Fingerprint:</td><td>{2}</td></tr>"""
+                        """<tr><td>Valid from:</td><td>{3}</td></tr>"""
+                        """<tr><td>Valid until:</td><td>{4}</td></tr>"""
+                        """<tr><td>Issuer name:</td><td>{5}</td></tr>"""
+                        """</table>""")
+                    .format(trust_dict["realm"],
+                            trust_dict["hostname"],
+                            trust_dict["finger_print"],
+                            trust_dict["valid_from"],
+                            trust_dict["valid_until"],
+                            trust_dict["issuer_dname"]),
+                modal=True, parent=parent)
+            permButton = msgBox.addButton(self.tr("&Permanent accept"),
+                                          E5MessageBox.AcceptRole)
+            tempButton = msgBox.addButton(self.tr("&Temporary accept"),
+                                          E5MessageBox.AcceptRole)
+            msgBox.addButton(self.tr("&Reject"), E5MessageBox.RejectRole)
+            msgBox.exec()
+        
         if msgBox.clickedButton() == permButton:
             return (True, trust_dict["failures"], True)
         elif msgBox.clickedButton() == tempButton:

eric ide

mercurial