src/eric7/Project/ProjectBrowser.py

branch
eric7
changeset 9647
e4c2ae118781
parent 9613
7154cc0373dd
child 9653
e67609152c5e
diff -r ab5678db972f -r e4c2ae118781 src/eric7/Project/ProjectBrowser.py
--- a/src/eric7/Project/ProjectBrowser.py	Sat Dec 24 17:31:46 2022 +0100
+++ b/src/eric7/Project/ProjectBrowser.py	Sun Dec 25 11:34:05 2022 +0100
@@ -11,6 +11,7 @@
 
 from PyQt6.QtCore import Qt, pyqtSignal
 from PyQt6.QtGui import QColor, QIcon
+from PyQt6.QtWidgets import QToolButton
 
 from eric7 import Preferences
 from eric7.EricGui import EricPixmapCache
@@ -104,9 +105,6 @@
 
         self.setUsesScrollButtons(True)
 
-        self.vcsStatusIndicator = EricClickableLed(self)
-        self.setCornerWidget(self.vcsStatusIndicator, Qt.Corner.TopLeftCorner)
-        self.vcsStatusIndicator.clicked.connect(self.__vcsStatusIndicatorClicked)
         self.vcsStatusColorNames = {
             "A": "VcsAdded",
             "M": "VcsModified",
@@ -124,6 +122,16 @@
             "U": self.tr("update required"),
             "Z": self.tr("conflict"),
         }
+        self.vcsStatusIndicator = EricClickableLed(self)
+        self.vcsStatusIndicator.clicked.connect(self.__vcsStatusIndicatorClicked)
+        self.setCornerWidget(self.vcsStatusIndicator, Qt.Corner.TopLeftCorner)
+        self.vcsCheckStatusButton = QToolButton(self)
+        self.vcsCheckStatusButton.setIcon(EricPixmapCache.getIcon("reload"))
+        self.vcsCheckStatusButton.setToolTip(
+            self.tr("Press to check the current VCS status.")
+        )
+        self.vcsCheckStatusButton.clicked.connect(self.project.checkVCSStatus)
+        self.setCornerWidget(self.vcsCheckStatusButton, Qt.Corner.TopRightCorner)
         self.__vcsStateChanged(" ")
 
         self.__currentBrowsersList = []
@@ -340,6 +348,8 @@
         self.__projectPropertiesChanged()
         self.setCurrentIndex(0)
         self.__vcsStateChanged(" ")
+        self.vcsStatusIndicator.setVisible(self.project.isVcsControlled())
+        self.vcsCheckStatusButton.setVisible(self.project.isVcsControlled())
 
     def __projectClosed(self):
         """
@@ -349,6 +359,8 @@
         self.setCurrentIndex(0)
         self.__setSourcesIcon()
         self.__vcsStateChanged(" ")
+        self.vcsStatusIndicator.setVisible(False)
+        self.vcsCheckStatusButton.setVisible(False)
 
     def __newProject(self):
         """
@@ -431,8 +443,12 @@
         """
         Private slot to handle a change in the vcs state.
 
-        @param state new vcs state (string)
+        @param state new vcs state
+        @type str
         """
+        self.vcsStatusIndicator.setVisible(self.project.isVcsControlled())
+        self.vcsCheckStatusButton.setVisible(self.project.isVcsControlled())
+
         self.currentVcsStatus = state
         if state == " " or state not in self.vcsStatusColorNames:
             self.vcsStatusIndicator.setColor(QColor(Qt.GlobalColor.lightGray))

eric ide

mercurial