src/eric7/Plugins/ViewManagerPlugins/Listspace/Listspace.py

branch
eric7
changeset 10212
68b6b5127363
parent 10069
435cc5875135
child 10380
7c14ccd2a0e1
--- a/src/eric7/Plugins/ViewManagerPlugins/Listspace/Listspace.py	Fri Sep 22 17:24:02 2023 +0200
+++ b/src/eric7/Plugins/ViewManagerPlugins/Listspace/Listspace.py	Sat Sep 23 15:06:36 2023 +0200
@@ -634,43 +634,19 @@
             self.viewlist.setCurrentRow(currentRow)
             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
         """
         currentRow = self.viewlist.currentRow()
         index = self.editors.index(editor)
         keys = []
-        if m:
-            keys.append("fileModified")
-        if editor.hasSyntaxErrors():
-            keys.append("syntaxError22")
-        elif editor.hasWarnings():
-            keys.append("warning22")
-        if not keys:
-            keys.append("empty")
-        item = self.viewlist.item(index)
-        if item:
-            item.setIcon(EricPixmapCache.getCombinedIcon(keys))
-        self.viewlist.setCurrentRow(currentRow)
-        self._checkActions(editor)
-
-    def _syntaxErrorToggled(self, editor):
-        """
-        Protected slot to handle the syntaxerrorToggled signal.
-
-        @param editor editor that sent the signal
-        @type Editor
-        """
-        currentRow = self.viewlist.currentRow()
-        index = self.editors.index(editor)
-        keys = []
-        if editor.isModified():
+        if modified:
             keys.append("fileModified")
         if editor.hasSyntaxErrors():
             keys.append("syntaxError22")
@@ -683,6 +659,26 @@
             item.setIcon(EricPixmapCache.getCombinedIcon(keys))
         self.viewlist.setCurrentRow(currentRow)
 
+    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):
+        """
+        Protected slot to handle the syntaxerrorToggled signal.
+
+        @param editor editor that sent the signal
+        @type Editor
+        """
+        self.__setIcon(editor, editor.isModified())
         ViewManager._syntaxErrorToggled(self, editor)
 
     def addSplit(self):

eric ide

mercurial