src/eric7/Project/ProjectBrowser.py

branch
eric7-maintenance
changeset 9654
7328efba128b
parent 9554
fe8c29d7cf96
parent 9653
e67609152c5e
child 9832
3885b9d7bd31
--- a/src/eric7/Project/ProjectBrowser.py	Thu Dec 01 10:18:07 2022 +0100
+++ b/src/eric7/Project/ProjectBrowser.py	Mon Jan 02 11:16:03 2023 +0100
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 
-# Copyright (c) 2002 - 2022 Detlev Offenbach <detlev@die-offenbachs.de>
+# Copyright (c) 2002 - 2023 Detlev Offenbach <detlev@die-offenbachs.de>
 #
 
 """
@@ -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
@@ -20,9 +21,7 @@
 
 from .ProjectBrowserRepositoryItem import ProjectBrowserRepositoryItem
 from .ProjectFormsBrowser import ProjectFormsBrowser
-from .ProjectInterfacesBrowser import ProjectInterfacesBrowser
 from .ProjectOthersBrowser import ProjectOthersBrowser
-from .ProjectProtocolsBrowser import ProjectProtocolsBrowser
 from .ProjectResourcesBrowser import ProjectResourcesBrowser
 from .ProjectSourcesBrowser import ProjectSourcesBrowser
 from .ProjectTranslationsBrowser import ProjectTranslationsBrowser
@@ -106,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",
@@ -126,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 = []
@@ -141,9 +147,6 @@
             ProjectResourcesBrowser,
             ProjectTranslationsBrowser,
             ProjectOthersBrowser,
-            # TODO: move the next two browsers to plugins
-            ProjectInterfacesBrowser,
-            ProjectProtocolsBrowser,
         ):
             browserClass(self.project, self)
 
@@ -313,7 +316,7 @@
 
         # step 2: add browsers
         for browser in sorted(
-            browsersList,
+            [b for b in browsersList if b in self.__browserRepository],
             key=lambda x: self.__browserRepository[x].priority,
             reverse=True,
         ):
@@ -345,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):
         """
@@ -354,6 +359,8 @@
         self.setCurrentIndex(0)
         self.__setSourcesIcon()
         self.__vcsStateChanged(" ")
+        self.vcsStatusIndicator.setVisible(False)
+        self.vcsCheckStatusButton.setVisible(False)
 
     def __newProject(self):
         """
@@ -436,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