src/eric7/Plugins/ViewManagerPlugins/Tabview/Tabview.py

branch
eric7
changeset 10212
68b6b5127363
parent 10069
435cc5875135
child 10380
7c14ccd2a0e1
--- a/src/eric7/Plugins/ViewManagerPlugins/Tabview/Tabview.py	Fri Sep 22 17:24:02 2023 +0200
+++ b/src/eric7/Plugins/ViewManagerPlugins/Tabview/Tabview.py	Sat Sep 23 15:06:36 2023 +0200
@@ -1195,21 +1195,21 @@
             self.currentTabWidget.setTabToolTip(index, newName)
             self.changeCaption.emit(newName)
 
-    def _modificationStatusChanged(self, m, editor):
+    def __setIcon(self, editor, modified):
         """
-        Protected slot to handle the modificationStatusChanged signal.
+        Private method to set the icon for the given editor.
 
-        @param m flag indicating the modification status
+        @param editor reference to the editor to set the icon for
+        @type Editor
+        @param modified flag indicating the modification status
         @type bool
-        @param editor editor window changed
-        @type Editor
         """
         for tw in self.tabWidgets:
             if tw.hasEditor(editor):
                 break
         index = tw.indexOf(editor)
         keys = []
-        if m:
+        if modified:
             keys.append("fileModified")
         if editor.hasSyntaxErrors():
             keys.append("syntaxError22")
@@ -1218,6 +1218,17 @@
         if not keys:
             keys.append("empty")
         tw.setTabIcon(index, EricPixmapCache.getCombinedIcon(keys))
+
+    def _modificationStatusChanged(self, modified, editor):
+        """
+        Protected slot to handle the modificationStatusChanged signal.
+
+        @param modified flag indicating the modification status
+        @type bool
+        @param editor editor that sent the signal
+        @type Editor
+        """
+        self.__setIcon(editor, modified)
         self._checkActions(editor)
 
     def _syntaxErrorToggled(self, editor):
@@ -1227,20 +1238,7 @@
         @param editor editor that sent the signal
         @type Editor
         """
-        for tw in self.tabWidgets:
-            if tw.hasEditor(editor):
-                break
-        index = tw.indexOf(editor)
-        keys = []
-        if editor.isModified():
-            keys.append("fileModified")
-        if editor.hasSyntaxErrors():
-            keys.append("syntaxError22")
-        elif editor.hasWarnings():
-            keys.append("warning22")
-        if not keys:
-            keys.append("empty")
-        tw.setTabIcon(index, EricPixmapCache.getCombinedIcon(keys))
+        self.__setIcon(editor, editor.isModified())
 
         ViewManager._syntaxErrorToggled(self, editor)
 

eric ide

mercurial