eric6/Plugins/VcsPlugins/vcsPySvn/SvnRepoBrowserDialog.py

changeset 7771
787a6b3f8c9f
parent 7639
422fd05e9c91
child 7774
9eed155411f0
diff -r 49f3377aebf1 -r 787a6b3f8c9f eric6/Plugins/VcsPlugins/vcsPySvn/SvnRepoBrowserDialog.py
--- a/eric6/Plugins/VcsPlugins/vcsPySvn/SvnRepoBrowserDialog.py	Fri Oct 09 17:19:29 2020 +0200
+++ b/eric6/Plugins/VcsPlugins/vcsPySvn/SvnRepoBrowserDialog.py	Sat Oct 10 12:20:51 2020 +0200
@@ -11,12 +11,12 @@
 import pysvn
 
 from PyQt5.QtCore import QMutexLocker, Qt, pyqtSlot
-from PyQt5.QtGui import QCursor
 from PyQt5.QtWidgets import (
     QHeaderView, QDialog, QApplication, QDialogButtonBox, QTreeWidgetItem
 )
 
 from E5Gui import E5MessageBox
+from E5Gui.E5OverrideCursor import E5OverrideCursor
 
 from .SvnUtilities import formatTime
 from .SvnDialogMixin import SvnDialogMixin
@@ -150,65 +150,62 @@
         @param parent reference to the item, the data should be appended to
             (QTreeWidget or QTreeWidgetItem)
         """
-        QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
-        QApplication.processEvents()
-        
         if parent is None:
             parent = self.repoTree
         
-        locker = QMutexLocker(self.vcs.vcsExecutionMutex)
-        
-        try:
+        with E5OverrideCursor():
+            locker = QMutexLocker(self.vcs.vcsExecutionMutex)
             try:
-                entries = self.client.list(url, recurse=False)
-                firstTime = parent == self.repoTree
-                for dirent, _lock in entries:
-                    if (
-                        (firstTime and dirent["path"] != url) or
-                        (parent != self.repoTree and dirent["path"] == url)
-                    ):
-                        continue
-                    if firstTime:
-                        if dirent["repos_path"] != "/":
-                            repoUrl = dirent["path"].replace(
-                                dirent["repos_path"], "")
-                        else:
-                            repoUrl = dirent["path"]
-                        if repoUrl != url:
-                            self.__ignoreExpand = True
-                            itm = self.__generateItem(
-                                parent, "/", "", "", 0, "",
-                                pysvn.node_kind.dir, repoUrl)
-                            itm.setExpanded(True)
-                            parent = itm
-                            urlPart = repoUrl
-                            for element in (
-                                dirent["repos_path"].split("/")[:-1]
-                            ):
-                                if element:
-                                    urlPart = "{0}/{1}".format(urlPart,
-                                                               element)
-                                    itm = self.__generateItem(
-                                        parent, element, "", "", 0, "",
-                                        pysvn.node_kind.dir, urlPart)
-                                    itm.setExpanded(True)
-                                    parent = itm
-                            self.__ignoreExpand = False
-                    itm = self.__generateItem(
-                        parent, dirent["repos_path"], dirent["created_rev"],
-                        dirent["last_author"], dirent["size"], dirent["time"],
-                        dirent["kind"], dirent["path"])
-                self.__resort()
-                self.__resizeColumns()
-            except pysvn.ClientError as e:
-                self.__showError(e.args[0])
-            except AttributeError:
-                self.__showError(
-                    self.tr("The installed version of PySvn should be "
-                            "1.4.0 or better."))
-        finally:
-            locker.unlock()
-            QApplication.restoreOverrideCursor()
+                try:
+                    entries = self.client.list(url, recurse=False)
+                    firstTime = parent == self.repoTree
+                    for dirent, _lock in entries:
+                        if (
+                            (firstTime and dirent["path"] != url) or
+                            (parent != self.repoTree and dirent["path"] == url)
+                        ):
+                            continue
+                        if firstTime:
+                            if dirent["repos_path"] != "/":
+                                repoUrl = dirent["path"].replace(
+                                    dirent["repos_path"], "")
+                            else:
+                                repoUrl = dirent["path"]
+                            if repoUrl != url:
+                                self.__ignoreExpand = True
+                                itm = self.__generateItem(
+                                    parent, "/", "", "", 0, "",
+                                    pysvn.node_kind.dir, repoUrl)
+                                itm.setExpanded(True)
+                                parent = itm
+                                urlPart = repoUrl
+                                for element in (
+                                    dirent["repos_path"].split("/")[:-1]
+                                ):
+                                    if element:
+                                        urlPart = "{0}/{1}".format(urlPart,
+                                                                   element)
+                                        itm = self.__generateItem(
+                                            parent, element, "", "", 0, "",
+                                            pysvn.node_kind.dir, urlPart)
+                                        itm.setExpanded(True)
+                                        parent = itm
+                                self.__ignoreExpand = False
+                        itm = self.__generateItem(
+                            parent, dirent["repos_path"],
+                            dirent["created_rev"], dirent["last_author"],
+                            dirent["size"], dirent["time"], dirent["kind"],
+                            dirent["path"])
+                    self.__resort()
+                    self.__resizeColumns()
+                except pysvn.ClientError as e:
+                    self.__showError(e.args[0])
+                except AttributeError:
+                    self.__showError(
+                        self.tr("The installed version of PySvn should be "
+                                "1.4.0 or better."))
+            finally:
+                locker.unlock()
     
     def __normalizeUrl(self, url):
         """

eric ide

mercurial