Plugins/ViewManagerPlugins/Tabview/Tabview.py

changeset 6115
ac3a98f3ebc2
parent 6102
a5b9f6a38faf
child 6166
bace7fb85a01
child 6645
ad476851d7e0
diff -r 0cf5c9683a51 -r ac3a98f3ebc2 Plugins/ViewManagerPlugins/Tabview/Tabview.py
--- a/Plugins/ViewManagerPlugins/Tabview/Tabview.py	Sun Feb 04 10:56:30 2018 +0100
+++ b/Plugins/ViewManagerPlugins/Tabview/Tabview.py	Mon Feb 05 19:15:47 2018 +0100
@@ -379,7 +379,8 @@
         if editor not in self.editors:
             self.editors.append(editor)
             editor.captionChanged.connect(self.__captionChange)
-            editor.cursorLineChanged.connect(self.__cursorLineChanged)
+            editor.cursorLineChanged.connect(
+                lambda lineno: self.__cursorLineChanged(lineno, editor))
         
         emptyIndex = self.indexOf(self.emptyLabel)
         if emptyIndex > -1:
@@ -412,7 +413,8 @@
         if editor not in self.editors:
             self.editors.append(editor)
             editor.captionChanged.connect(self.__captionChange)
-            editor.cursorLineChanged.connect(self.__cursorLineChanged)
+            editor.cursorLineChanged.connect(
+                lambda lineno: self.__cursorLineChanged(lineno, editor))
         emptyIndex = self.indexOf(self.emptyLabel)
         if emptyIndex > -1:
             self.removeTab(emptyIndex)
@@ -451,14 +453,15 @@
                 self.setTabText(index, txt)
                 self.setTabToolTip(index, fn)
         
-    def __cursorLineChanged(self, lineno):
+    def __cursorLineChanged(self, lineno, editor):
         """
         Private slot to handle a change of the current editor's cursor line.
         
-        @param lineno line number of the current editor's cursor (zero based)
+        @param lineno line number of the editor's cursor (zero based)
         @type int
+        @param editor reference to the editor
+        @type Editor
         """
-        editor = self.sender()
         if editor and isinstance(editor, QScintilla.Editor.Editor):
             fn = editor.getFileName()
             if fn:
@@ -472,8 +475,8 @@
         @type QWidget
         """
         if isinstance(widget, QScintilla.Editor.Editor):
-            widget.cursorLineChanged.disconnect(self.__cursorLineChanged)
-            widget.captionChanged.disconnect(self.__captionChange)
+            widget.cursorLineChanged.disconnect()
+            widget.captionChanged.disconnect()
             self.editors.remove(widget)
             index = self.indexOf(widget.parent())
         else:

eric ide

mercurial