eric6/Plugins/VcsPlugins/vcsPySvn/SvnStatusDialog.py

changeset 7771
787a6b3f8c9f
parent 7360
9190402e4505
child 7774
9eed155411f0
--- a/eric6/Plugins/VcsPlugins/vcsPySvn/SvnStatusDialog.py	Fri Oct 09 17:19:29 2020 +0200
+++ b/eric6/Plugins/VcsPlugins/vcsPySvn/SvnStatusDialog.py	Sat Oct 10 12:20:51 2020 +0200
@@ -14,7 +14,6 @@
 import pysvn
 
 from PyQt5.QtCore import QMutexLocker, Qt, pyqtSlot
-from PyQt5.QtGui import QCursor
 from PyQt5.QtWidgets import (
     QWidget, QHeaderView, QApplication, QMenu, QDialogButtonBox,
     QTreeWidgetItem
@@ -22,6 +21,7 @@
 
 from E5Gui.E5Application import e5App
 from E5Gui import E5MessageBox
+from E5Gui.E5OverrideCursor import E5OverrideCursor
 
 from .SvnConst import svnStatusMap
 from .SvnDialogMixin import SvnDialogMixin
@@ -285,9 +285,6 @@
         self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True)
         self.refreshButton.setEnabled(False)
         
-        QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
-        QApplication.processEvents()
-        
         self.args = fn
         
         self.setWindowTitle(self.tr('Subversion Status'))
@@ -312,136 +309,142 @@
         hideHistoryColumn = True
         hideSwitchedColumn = True
         
-        locker = QMutexLocker(self.vcs.vcsExecutionMutex)
-        cwd = os.getcwd()
-        os.chdir(self.dname)
-        try:
-            for name in fnames:
-                # step 1: determine changelists and their files
-                changelistsDict = {}
-                if hasattr(self.client, 'get_changelist'):
-                    if recurse:
-                        depth = pysvn.depth.infinity
-                    else:
-                        depth = pysvn.depth.immediate
-                    changelists = self.client.get_changelist(name, depth=depth)
-                    for fpath, changelist in changelists:
-                        fpath = Utilities.normcasepath(fpath)
-                        changelistsDict[fpath] = changelist
-                hideChangelistColumn = (
-                    hideChangelistColumn and len(changelistsDict) == 0
-                )
-                
-                # step 2: determine status of files
-                allFiles = self.client.status(name, recurse=recurse,
-                                              get_all=verbose, ignore=True,
-                                              update=update)
-                counter = 0
-                for file in allFiles:
-                    uptodate = True
-                    if file.repos_text_status != pysvn.wc_status_kind.none:
-                        uptodate = (
-                            uptodate and
-                            file.repos_text_status !=
-                            pysvn.wc_status_kind.modified
-                        )
-                    if file.repos_prop_status != pysvn.wc_status_kind.none:
-                        uptodate = (
-                            uptodate and
-                            file.repos_prop_status !=
-                            pysvn.wc_status_kind.modified
-                        )
-                    
-                    lockState = " "
-                    if (
-                        file.entry is not None and
-                        hasattr(file.entry, 'lock_token') and
-                        file.entry.lock_token is not None
-                    ):
-                        lockState = "L"
-                    if hasattr(file, 'repos_lock') and update:
-                        if lockState == "L" and file.repos_lock is None:
-                            lockState = "B"
-                        elif lockState == " " and file.repos_lock is not None:
-                            lockState = "O"
-                        elif (
-                            lockState == "L" and
-                            file.repos_lock is not None and
-                            file.entry.lock_token !=
-                                file.repos_lock["token"]
-                        ):
-                            lockState = "S"
-                    
-                    fpath = Utilities.normcasepath(
-                        os.path.join(self.dname, file.path))
-                    if fpath in changelistsDict:
-                        changelist = changelistsDict[fpath]
-                    else:
-                        changelist = ""
-                    
-                    hidePropertyStatusColumn = (
-                        hidePropertyStatusColumn and
-                        file.prop_status in [
-                            pysvn.wc_status_kind.none,
-                            pysvn.wc_status_kind.normal
-                        ]
-                    )
-                    hideLockColumns = (
-                        hideLockColumns and
-                        not file.is_locked and
-                        lockState == " "
-                    )
-                    hideUpToDateColumn = hideUpToDateColumn and uptodate
-                    hideHistoryColumn = (
-                        hideHistoryColumn and
-                        not file.is_copied
-                    )
-                    hideSwitchedColumn = (
-                        hideSwitchedColumn and
-                        not file.is_switched
+        with E5OverrideCursor():
+            locker = QMutexLocker(self.vcs.vcsExecutionMutex)
+            cwd = os.getcwd()
+            os.chdir(self.dname)
+            try:
+                for name in fnames:
+                    # step 1: determine changelists and their files
+                    changelistsDict = {}
+                    if hasattr(self.client, 'get_changelist'):
+                        if recurse:
+                            depth = pysvn.depth.infinity
+                        else:
+                            depth = pysvn.depth.immediate
+                        changelists = self.client.get_changelist(
+                            name, depth=depth)
+                        for fpath, changelist in changelists:
+                            fpath = Utilities.normcasepath(fpath)
+                            changelistsDict[fpath] = changelist
+                    hideChangelistColumn = (
+                        hideChangelistColumn and len(changelistsDict) == 0
                     )
                     
-                    self.__generateItem(
-                        changelist,
-                        file.text_status,
-                        file.prop_status,
-                        file.is_locked,
-                        file.is_copied,
-                        file.is_switched,
-                        lockState,
-                        uptodate,
-                        file.entry and file.entry.revision.number or "",
-                        file.entry and file.entry.commit_revision.number or "",
-                        file.entry and file.entry.commit_author or "",
-                        file.path
-                    )
-                    counter += 1
-                    if counter == 30:
-                        # check for cancel every 30 items
-                        counter = 0
-                        if self._clientCancelCallback():
-                            break
-                if self._clientCancelCallback():
-                    break
-        except pysvn.ClientError as e:
-            self.__showError(e.args[0] + '\n')
-        
-        self.statusList.setColumnHidden(self.__propStatusColumn,
-                                        hidePropertyStatusColumn)
-        self.statusList.setColumnHidden(self.__lockedColumn,
-                                        hideLockColumns)
-        self.statusList.setColumnHidden(self.__lockinfoColumn,
-                                        hideLockColumns)
-        self.statusList.setColumnHidden(self.__upToDateColumn,
-                                        hideUpToDateColumn)
-        self.statusList.setColumnHidden(self.__historyColumn,
-                                        hideHistoryColumn)
-        self.statusList.setColumnHidden(self.__switchedColumn,
-                                        hideSwitchedColumn)
-        self.statusList.setColumnHidden(self.__changelistColumn,
-                                        hideChangelistColumn)
-        
-        locker.unlock()
+                    # step 2: determine status of files
+                    allFiles = self.client.status(name, recurse=recurse,
+                                                  get_all=verbose, ignore=True,
+                                                  update=update)
+                    counter = 0
+                    for file in allFiles:
+                        uptodate = True
+                        if file.repos_text_status != pysvn.wc_status_kind.none:
+                            uptodate = (
+                                uptodate and
+                                file.repos_text_status !=
+                                pysvn.wc_status_kind.modified
+                            )
+                        if file.repos_prop_status != pysvn.wc_status_kind.none:
+                            uptodate = (
+                                uptodate and
+                                file.repos_prop_status !=
+                                pysvn.wc_status_kind.modified
+                            )
+                        
+                        lockState = " "
+                        if (
+                            file.entry is not None and
+                            hasattr(file.entry, 'lock_token') and
+                            file.entry.lock_token is not None
+                        ):
+                            lockState = "L"
+                        if hasattr(file, 'repos_lock') and update:
+                            if lockState == "L" and file.repos_lock is None:
+                                lockState = "B"
+                            elif (
+                                lockState == " " and
+                                file.repos_lock is not None
+                            ):
+                                lockState = "O"
+                            elif (
+                                lockState == "L" and
+                                file.repos_lock is not None and
+                                file.entry.lock_token !=
+                                    file.repos_lock["token"]
+                            ):
+                                lockState = "S"
+                        
+                        fpath = Utilities.normcasepath(
+                            os.path.join(self.dname, file.path))
+                        if fpath in changelistsDict:
+                            changelist = changelistsDict[fpath]
+                        else:
+                            changelist = ""
+                        
+                        hidePropertyStatusColumn = (
+                            hidePropertyStatusColumn and
+                            file.prop_status in [
+                                pysvn.wc_status_kind.none,
+                                pysvn.wc_status_kind.normal
+                            ]
+                        )
+                        hideLockColumns = (
+                            hideLockColumns and
+                            not file.is_locked and
+                            lockState == " "
+                        )
+                        hideUpToDateColumn = hideUpToDateColumn and uptodate
+                        hideHistoryColumn = (
+                            hideHistoryColumn and
+                            not file.is_copied
+                        )
+                        hideSwitchedColumn = (
+                            hideSwitchedColumn and
+                            not file.is_switched
+                        )
+                        
+                        self.__generateItem(
+                            changelist,
+                            file.text_status,
+                            file.prop_status,
+                            file.is_locked,
+                            file.is_copied,
+                            file.is_switched,
+                            lockState,
+                            uptodate,
+                            file.entry.revision.number if file.entry else "",
+                            file.entry.commit_revision.number
+                            if file.entry else "",
+                            file.entry.commit_author if file.entry else "",
+                            file.path
+                        )
+                        counter += 1
+                        if counter == 30:
+                            # check for cancel every 30 items
+                            counter = 0
+                            if self._clientCancelCallback():
+                                break
+                    if self._clientCancelCallback():
+                        break
+            except pysvn.ClientError as e:
+                self.__showError(e.args[0] + '\n')
+            
+            self.statusList.setColumnHidden(self.__propStatusColumn,
+                                            hidePropertyStatusColumn)
+            self.statusList.setColumnHidden(self.__lockedColumn,
+                                            hideLockColumns)
+            self.statusList.setColumnHidden(self.__lockinfoColumn,
+                                            hideLockColumns)
+            self.statusList.setColumnHidden(self.__upToDateColumn,
+                                            hideUpToDateColumn)
+            self.statusList.setColumnHidden(self.__historyColumn,
+                                            hideHistoryColumn)
+            self.statusList.setColumnHidden(self.__switchedColumn,
+                                            hideSwitchedColumn)
+            self.statusList.setColumnHidden(self.__changelistColumn,
+                                            hideChangelistColumn)
+            
+            locker.unlock()
         self.__finish()
         os.chdir(cwd)
         
@@ -450,8 +453,6 @@
         Private slot called when the process finished or the user pressed
         the button.
         """
-        QApplication.restoreOverrideCursor()
-        
         self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True)
         self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False)
         self.buttonBox.button(QDialogButtonBox.Close).setDefault(True)

eric ide

mercurial