Continued removing the use of QObject.sender().

Mon, 05 Feb 2018 19:59:18 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Mon, 05 Feb 2018 19:59:18 +0100
changeset 6116
f3d3c996c193
parent 6115
ac3a98f3ebc2
child 6117
4cc6c171ecf6

Continued removing the use of QObject.sender().

Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardCharactersDialog.py file | annotate | diff | comparison | revisions
Plugins/WizardPlugins/QRegExpWizard/QRegExpWizardCharactersDialog.py file | annotate | diff | comparison | revisions
Plugins/WizardPlugins/QRegularExpressionWizard/QRegularExpressionWizardCharactersDialog.py file | annotate | diff | comparison | revisions
Preferences/ConfigurationPages/ConfigurationPageBase.py file | annotate | diff | comparison | revisions
Preferences/ConfigurationPages/DiffColoursPage.py file | annotate | diff | comparison | revisions
Project/ProjectTranslationsBrowser.py file | annotate | diff | comparison | revisions
QScintilla/Editor.py file | annotate | diff | comparison | revisions
QScintilla/MiniEditor.py file | annotate | diff | comparison | revisions
QScintilla/SearchReplaceWidget.py file | annotate | diff | comparison | revisions
ViewManager/ViewManager.py file | annotate | diff | comparison | revisions
--- a/Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardCharactersDialog.py	Mon Feb 05 19:15:47 2018 +0100
+++ b/Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardCharactersDialog.py	Mon Feb 05 19:59:18 2018 +0100
@@ -158,8 +158,10 @@
         hboxLayout.addWidget(le2)
         self.singlesItemsBoxLayout.addWidget(hbox)
         
-        cb1.activated[int].connect(self.__singlesCharTypeSelected)
-        cb2.activated[int].connect(self.__singlesCharTypeSelected)
+        cb1.activated[int].connect(
+            lambda i: self.__singlesCharTypeSelected(i, cb1))
+        cb2.activated[int].connect(
+            lambda i: self.__singlesCharTypeSelected(i, cb2))
         hbox.show()
         
         self.singlesItemsBox.adjustSize()
@@ -192,7 +194,8 @@
         hboxLayout.addWidget(le2)
         self.rangesItemsBoxLayout.addWidget(hbox)
         
-        cb1.activated[int].connect(self.__rangesCharTypeSelected)
+        cb1.activated[int].connect(
+            lambda i: self.__rangesCharTypeSelected(i, cb1))
         
         hbox.show()
         
@@ -219,27 +222,31 @@
             lineedit.setEnabled(False)
         lineedit.clear()
         
-    def __singlesCharTypeSelected(self, index):
+    def __singlesCharTypeSelected(self, index, combo):
         """
         Private slot to handle the activated(int) signal of the single chars
         combo boxes.
         
-        @param index selected list index (integer)
+        @param index selected list index
+        @type int
+        @param combo reference to the combo box
+        @type QComboBox
         """
-        combo = self.sender()
         for entriesList in self.singlesEntries:
             if combo == entriesList[0]:
                 self.__performSelectedAction(index, entriesList[1])
                 break
         
-    def __rangesCharTypeSelected(self, index):
+    def __rangesCharTypeSelected(self, index, combo):
         """
         Private slot to handle the activated(int) signal of the char ranges
         combo boxes.
         
-        @param index selected list index (integer)
+        @param index selected list index
+        @type int
+        @param combo reference to the combo box
+        @type QComboBox
         """
-        combo = self.sender()
         for entriesList in self.rangesEntries:
             if combo == entriesList[0]:
                 self.__performSelectedAction(index, entriesList[1])
--- a/Plugins/WizardPlugins/QRegExpWizard/QRegExpWizardCharactersDialog.py	Mon Feb 05 19:15:47 2018 +0100
+++ b/Plugins/WizardPlugins/QRegExpWizard/QRegExpWizardCharactersDialog.py	Mon Feb 05 19:59:18 2018 +0100
@@ -448,8 +448,10 @@
         cb2a.hide()
         self.singlesItemsBoxLayout.addWidget(hbox)
         
-        cb1.activated[int].connect(self.__singlesCharTypeSelected)
-        cb2.activated[int].connect(self.__singlesCharTypeSelected)
+        cb1.activated[int].connect(
+            lambda i: self.__singlesCharTypeSelected(i, cb1))
+        cb2.activated[int].connect(
+            lambda i: self.__singlesCharTypeSelected(i, cb2))
         hbox.show()
         
         self.singlesItemsBox.adjustSize()
@@ -482,7 +484,9 @@
         hboxLayout.addWidget(le2)
         self.rangesItemsBoxLayout.addWidget(hbox)
         
-        cb1.activated[int].connect(self.__rangesCharTypeSelected)
+        cb1.activated[int].connect(
+            lambda i: self.__rangesCharTypeSelected(i, cb1))
+        
         hbox.show()
         
         self.rangesItemsBox.adjustSize()
@@ -547,14 +551,16 @@
                 combo.hide()
         lineedit.clear()
         
-    def __singlesCharTypeSelected(self, index):
+    def __singlesCharTypeSelected(self, index, combo):
         """
         Private slot to handle the activated(int) signal of the single chars
         combo boxes.
         
-        @param index selected list index (integer)
+        @param index selected list index
+        @type int
+        @param combo reference to the combo box
+        @type QComboBox
         """
-        combo = self.sender()
         for entriesList in self.singlesEntries:
             if combo == entriesList[0]:
                 formatIdentifier = combo.itemData(index)
@@ -562,14 +568,16 @@
                     formatIdentifier, entriesList[1], entriesList[2])
                 break
         
-    def __rangesCharTypeSelected(self, index):
+    def __rangesCharTypeSelected(self, index, combo):
         """
         Private slot to handle the activated(int) signal of the char ranges
         combo boxes.
         
-        @param index selected list index (integer)
+        @param index selected list index
+        @type int
+        @param combo reference to the combo box
+        @type QComboBox
         """
-        combo = self.sender()
         for entriesList in self.rangesEntries:
             if combo == entriesList[0]:
                 formatIdentifier = combo.itemData(index)
--- a/Plugins/WizardPlugins/QRegularExpressionWizard/QRegularExpressionWizardCharactersDialog.py	Mon Feb 05 19:15:47 2018 +0100
+++ b/Plugins/WizardPlugins/QRegularExpressionWizard/QRegularExpressionWizardCharactersDialog.py	Mon Feb 05 19:59:18 2018 +0100
@@ -362,8 +362,10 @@
         cb2a.hide()
         self.singlesItemsBoxLayout.addWidget(hbox)
         
-        cb1.activated[int].connect(self.__singlesCharTypeSelected)
-        cb2.activated[int].connect(self.__singlesCharTypeSelected)
+        cb1.activated[int].connect(
+            lambda i: self.__singlesCharTypeSelected(i, cb1))
+        cb2.activated[int].connect(
+            lambda i: self.__singlesCharTypeSelected(i, cb2))
         hbox.show()
         
         self.singlesItemsBox.adjustSize()
@@ -396,7 +398,9 @@
         hboxLayout.addWidget(le2)
         self.rangesItemsBoxLayout.addWidget(hbox)
         
-        cb1.activated[int].connect(self.__rangesCharTypeSelected)
+        cb1.activated[int].connect(
+            lambda i: self.__rangesCharTypeSelected(i, cb1))
+        
         hbox.show()
         
         self.rangesItemsBox.adjustSize()
@@ -464,14 +468,16 @@
                 combo.hide()
         lineedit.clear()
     
-    def __singlesCharTypeSelected(self, index):
+    def __singlesCharTypeSelected(self, index, combo):
         """
         Private slot to handle the activated(int) signal of the single chars
         combo boxes.
         
-        @param index selected list index (integer)
+        @param index selected list index
+        @type int
+        @param combo reference to the combo box
+        @type QComboBox
         """
-        combo = self.sender()
         for entriesList in self.singlesEntries:
             if combo == entriesList[0]:
                 formatIdentifier = combo.itemData(index)
@@ -479,14 +485,16 @@
                     formatIdentifier, entriesList[1], entriesList[2])
                 break
     
-    def __rangesCharTypeSelected(self, index):
+    def __rangesCharTypeSelected(self, index, combo):
         """
         Private slot to handle the activated(int) signal of the char ranges
         combo boxes.
         
-        @param index selected list index (integer)
+        @param index selected list index
+        @type int
+        @param combo reference to the combo box
+        @type QComboBox
         """
-        combo = self.sender()
         for entriesList in self.rangesEntries:
             if combo == entriesList[0]:
                 formatIdentifier = combo.itemData(index)
--- a/Preferences/ConfigurationPages/ConfigurationPageBase.py	Mon Feb 05 19:15:47 2018 +0100
+++ b/Preferences/ConfigurationPages/ConfigurationPageBase.py	Mon Feb 05 19:59:18 2018 +0100
@@ -66,15 +66,17 @@
         button.setIcon(QIcon(pm))
         button.setProperty("colorKey", colourKey)
         button.setProperty("hasAlpha", hasAlpha)
-        button.clicked.connect(self.__selectColourSlot)
+        button.clicked.connect(lambda: self.__selectColourSlot(button))
         self.__coloursDict[colourKey] = [colour, byName]
         
     @pyqtSlot()
-    def __selectColourSlot(self):
+    def __selectColourSlot(self, button):
         """
         Private slot to select a color.
+        
+        @param button reference to the button been pressed
+        @type QPushButton
         """
-        button = self.sender()
         colorKey = button.property("colorKey")
         hasAlpha = button.property("hasAlpha")
         
--- a/Preferences/ConfigurationPages/DiffColoursPage.py	Mon Feb 05 19:15:47 2018 +0100
+++ b/Preferences/ConfigurationPages/DiffColoursPage.py	Mon Feb 05 19:59:18 2018 +0100
@@ -42,27 +42,48 @@
             sample.setFont(monospacedFont)
         
         # set initial values
-        self.__initColour("TextColor", self.textButton,
-                          self.__updateSampleTextColour,
-                          self.__selectTextColour, self.textSample)
-        self.__initColour("AddedColor", self.addedButton,
-                          self.__updateSampleBackgroundColour,
-                          self.__selectBackgroundColour, self.addedSample)
-        self.__initColour("RemovedColor", self.removedButton,
-                          self.__updateSampleBackgroundColour,
-                          self.__selectBackgroundColour, self.removedSample)
-        self.__initColour("ReplacedColor", self.replacedButton,
-                          self.__updateSampleBackgroundColour,
-                          self.__selectBackgroundColour, self.replacedSample)
-        self.__initColour("ContextColor", self.contextButton,
-                          self.__updateSampleBackgroundColour,
-                          self.__selectBackgroundColour, self.contextSample)
-        self.__initColour("HeaderColor", self.headerButton,
-                          self.__updateSampleBackgroundColour,
-                          self.__selectBackgroundColour, self.headerSample)
-        self.__initColour("BadWhitespaceColor", self.whitespaceButton,
-                          self.__updateSampleBackgroundColour,
-                          self.__selectBackgroundColour, self.whitespaceSample)
+        self.__initColour(
+            "TextColor",
+            self.textButton,
+            self.__updateSampleTextColour,
+            lambda: self.__selectTextColour(self.textButton),
+            self.textSample)
+        self.__initColour(
+            "AddedColor",
+            self.addedButton,
+            self.__updateSampleBackgroundColour,
+            lambda: self.__selectBackgroundColour(self.addedButton),
+            self.addedSample)
+        self.__initColour(
+            "RemovedColor",
+            self.removedButton,
+            self.__updateSampleBackgroundColour,
+            lambda: self.__selectBackgroundColour(self.removedButton),
+            self.removedSample)
+        self.__initColour(
+            "ReplacedColor",
+            self.replacedButton,
+            self.__updateSampleBackgroundColour,
+            lambda: self.__selectBackgroundColour(self.replacedButton),
+            self.replacedSample)
+        self.__initColour(
+            "ContextColor",
+            self.contextButton,
+            self.__updateSampleBackgroundColour,
+            lambda: self.__selectBackgroundColour(self.contextButton),
+            self.contextSample)
+        self.__initColour(
+            "HeaderColor",
+            self.headerButton,
+            self.__updateSampleBackgroundColour,
+            lambda: self.__selectBackgroundColour(self.headerButton),
+            self.headerSample)
+        self.__initColour(
+            "BadWhitespaceColor",
+            self.whitespaceButton,
+            self.__updateSampleBackgroundColour,
+            lambda: self.__selectBackgroundColour(self.whitespaceButton),
+            self.whitespaceSample)
     
     def save(self):
         """
@@ -95,11 +116,13 @@
             initSlot(colourKey)
     
     @pyqtSlot()
-    def __selectTextColour(self):
+    def __selectTextColour(self, button):
         """
         Private slot to select the text colour.
+        
+        @param button reference to the button been pressed
+        @type QPushButton
         """
-        button = self.sender()
         colorKey = button.property("colorKey")
         
         colour = QColorDialog.getColor(self.__coloursDict[colorKey][0], self)
@@ -108,11 +131,13 @@
             self.__updateSampleTextColour(colorKey)
     
     @pyqtSlot()
-    def __selectBackgroundColour(self):
+    def __selectBackgroundColour(self, button):
         """
         Private slot to select a background colour.
+        
+        @param button reference to the button been pressed
+        @type QPushButton
         """
-        button = self.sender()
         colorKey = button.property("colorKey")
         
         colour = QColorDialog.getColor(self.__coloursDict[colorKey][0], self,
--- a/Project/ProjectTranslationsBrowser.py	Mon Feb 05 19:15:47 2018 +0100
+++ b/Project/ProjectTranslationsBrowser.py	Mon Feb 05 19:59:18 2018 +0100
@@ -830,27 +830,25 @@
             
         return True
     
-    def __readStdoutLupdate(self):
+    def __readStdoutLupdate(self, proc):
         """
         Private slot to handle the readyReadStandardOutput signal of the
         pylupdate process.
+        
+        @param proc reference to the process
+        @type QProcess
         """
-        proc = self.sender()
-        if proc is not None:
-            self.__readStdout(proc, '{0}: '.format(self.pylupdate))
-        else:
-            return
+        self.__readStdout(proc, '{0}: '.format(self.pylupdate))
         
-    def __readStdoutLrelease(self):
+    def __readStdoutLrelease(self, proc):
         """
         Private slot to handle the readyReadStandardOutput signal of the
         lrelease process.
+        
+        @param proc reference to the process
+        @type QProcess
         """
-        proc = self.sender()
-        if proc is not None:
-            self.__readStdout(proc, 'lrelease: ')
-        else:
-            return
+        self.__readStdout(proc, 'lrelease: ')
         
     def __readStdout(self, proc, ps):
         """
@@ -868,27 +866,25 @@
             s += output
             self.appendStdout.emit(s)
         
-    def __readStderrLupdate(self):
+    def __readStderrLupdate(self, proc):
         """
         Private slot to handle the readyReadStandardError signal of the
         pylupdate4/pylupdate5/pyside-lupdate process.
+        
+        @param proc reference to the process
+        @type QProcess
         """
-        proc = self.sender()
-        if proc is not None:
-            self.__readStderr(proc, '{0}: '.format(self.pylupdate))
-        else:
-            return
+        self.__readStderr(proc, '{0}: '.format(self.pylupdate))
         
-    def __readStderrLrelease(self):
+    def __readStderrLrelease(self, proc):
         """
         Private slot to handle the readyReadStandardError signal of the
         lrelease process.
+        
+        @param proc reference to the process
+        @type QProcess
         """
-        proc = self.sender()
-        if proc is not None:
-            self.__readStderr(proc, 'lrelease: ')
-        else:
-            return
+        self.__readStderr(proc, 'lrelease: ')
         
     def __readStderr(self, proc, ps):
         """
@@ -917,12 +913,16 @@
         if self.hooks["extractMessages"] is not None:
             self.hooks["extractMessages"]()
         
-    def __generateTSFileDone(self, exitCode, exitStatus):
+    def __generateTSFileDone(self, exitCode, exitStatus, proc):
         """
         Private slot to handle the finished signal of the pylupdate process.
         
-        @param exitCode exit code of the process (integer)
-        @param exitStatus exit status of the process (QProcess.ExitStatus)
+        @param exitCode exit code of the process
+        @type int
+        @param exitStatus exit status of the process
+        @type QProcess.ExitStatus
+        @param proc reference to the process
+        @type QProcess
         """
         if exitStatus == QProcess.NormalExit and exitCode == 0:
             ui = e5App().getObject("UserInterface")
@@ -952,7 +952,6 @@
                     "The generation of the translation files (*.ts) has"
                     " failed.{0}").format(info))
         
-        proc = self.sender()
         for index in range(len(self.__pylupdateProcesses)):
             if proc == self.__pylupdateProcesses[index][0]:
                 try:
@@ -1044,9 +1043,12 @@
             path, filename = os.path.split(tempProjectFile)
             args.append(filename)
             proc.setWorkingDirectory(os.path.join(self.project.ppath, path))
-            proc.finished.connect(self.__generateTSFileDone)
-            proc.readyReadStandardOutput.connect(self.__readStdoutLupdate)
-            proc.readyReadStandardError.connect(self.__readStderrLupdate)
+            proc.finished.connect(
+                lambda c, s: self.__generateTSFileDone(c, s, proc))
+            proc.readyReadStandardOutput.connect(
+                lambda: self.__readStdoutLupdate(proc))
+            proc.readyReadStandardError.connect(
+                lambda: self.__readStderrLupdate(proc))
             
             proc.start(self.pylupdate, args)
             procStarted = proc.waitForStarted()
@@ -1106,12 +1108,16 @@
     ##  Methods for the release commands
     ###########################################################################
     
-    def __releaseTSFileDone(self, exitCode, exitStatus):
+    def __releaseTSFileDone(self, exitCode, exitStatus, proc):
         """
         Private slot to handle the finished signal of the lrelease process.
         
-        @param exitCode exit code of the process (integer)
-        @param exitStatus exit status of the process (QProcess.ExitStatus)
+        @param exitCode exit code of the process
+        @type int
+        @param exitStatus exit status of the process
+        @type QProcess.ExitStatus
+        @param proc reference to the process
+        @type QProcess
         """
         if exitStatus == QProcess.NormalExit and exitCode == 0:
             ui = e5App().getObject("UserInterface")
@@ -1144,7 +1150,6 @@
                 self.tr(
                     "The release of the translation files (*.qm) has failed."))
         
-        proc = self.sender()
         for index in range(len(self.__lreleaseProcesses)):
             if proc == self.__lreleaseProcesses[index][0]:
                 try:
@@ -1214,9 +1219,12 @@
             path, filename = os.path.split(tempProjectFile)
             args.append(filename)
             proc.setWorkingDirectory(os.path.join(self.project.ppath, path))
-            proc.finished.connect(self.__releaseTSFileDone)
-            proc.readyReadStandardOutput.connect(self.__readStdoutLrelease)
-            proc.readyReadStandardError.connect(self.__readStderrLrelease)
+            proc.finished.connect(
+                lambda c, s: self.__releaseTSFileDone(c, s, proc))
+            proc.readyReadStandardOutput.connect(
+                lambda: self.__readStdoutLrelease(proc))
+            proc.readyReadStandardError.connect(
+                lambda: self.__readStderrLrelease(proc))
             
             proc.start(lrelease, args)
             procStarted = proc.waitForStarted()
--- a/QScintilla/Editor.py	Mon Feb 05 19:15:47 2018 +0100
+++ b/QScintilla/Editor.py	Mon Feb 05 19:59:18 2018 +0100
@@ -1169,7 +1169,8 @@
         self.marginMenuActs["ClearBookmark"] = self.bmMarginMenu.addAction(
             self.tr('Clear all bookmarks'), self.clearBookmarks)
         
-        self.bmMarginMenu.aboutToShow.connect(self.__showContextMenuMargin)
+        self.bmMarginMenu.aboutToShow.connect(
+            lambda: self.__showContextMenuMargin(self.bmMarginMenu))
         
         # breakpoint margin
         self.bpMarginMenu = QMenu()
@@ -1193,7 +1194,8 @@
         self.marginMenuActs["ClearBreakpoint"] = self.bpMarginMenu.addAction(
             self.tr('Clear all breakpoints'), self.__menuClearBreakpoints)
         
-        self.bpMarginMenu.aboutToShow.connect(self.__showContextMenuMargin)
+        self.bpMarginMenu.aboutToShow.connect(
+            lambda: self.__showContextMenuMargin(self.bpMarginMenu))
         
         # indicator margin
         self.indicMarginMenu = QMenu()
@@ -1246,7 +1248,8 @@
             self.indicMarginMenu.addAction(
                 self.tr('Clear changes'), self.__reinitOnlineChangeTrace)
         
-        self.indicMarginMenu.aboutToShow.connect(self.__showContextMenuMargin)
+        self.indicMarginMenu.aboutToShow.connect(
+            lambda: self.__showContextMenuMargin(self.indicMarginMenu))
         
     def __initContextMenuUnifiedMargins(self):
         """
@@ -1326,7 +1329,8 @@
         self.marginMenuActs["LMBbreakpoints"].setCheckable(True)
         self.marginMenuActs["LMBbreakpoints"].setChecked(True)
         
-        self.marginMenu.aboutToShow.connect(self.__showContextMenuMargin)
+        self.marginMenu.aboutToShow.connect(
+            lambda: self.__showContextMenuMargin(self.marginMenu))
         
     def __exportMenuTriggered(self, act):
         """
@@ -5374,10 +5378,13 @@
         
         self.showMenu.emit("Graphics", self.graphicsMenu, self)
         
-    def __showContextMenuMargin(self):
+    def __showContextMenuMargin(self, menu):
         """
         Private slot handling the aboutToShow signal of the margins context
         menu.
+        
+        @param menu reference to the menu to be shown
+        @type QMenu
         """
         if self.fileName and self.isPyFile():
             self.marginMenuActs["Breakpoint"].setEnabled(True)
@@ -5470,7 +5477,7 @@
             self.marginMenuActs["NextChangeMarker"].setEnabled(False)
             self.marginMenuActs["ClearChangeMarkers"].setEnabled(False)
         
-        self.showMenu.emit("Margin", self.sender(), self)
+        self.showMenu.emit("Margin", menu, self)
         
     def __showContextMenuChecks(self):
         """
--- a/QScintilla/MiniEditor.py	Mon Feb 05 19:15:47 2018 +0100
+++ b/QScintilla/MiniEditor.py	Mon Feb 05 19:59:18 2018 +0100
@@ -198,9 +198,9 @@
             self.__contextMenuRequested)
         
         self.__textEdit.selectionChanged.connect(
-            self.__searchWidget.selectionChanged)
+            lambda: self.__searchWidget.selectionChanged(self.__textEdit))
         self.__textEdit.selectionChanged.connect(
-            self.__replaceWidget.selectionChanged)
+            lambda: self.__replaceWidget.selectionChanged(self.__textEdit))
         
         if filename:
             self.__loadFile(filename, filetype)
--- a/QScintilla/SearchReplaceWidget.py	Mon Feb 05 19:15:47 2018 +0100
+++ b/QScintilla/SearchReplaceWidget.py	Mon Feb 05 19:59:18 2018 +0100
@@ -691,19 +691,22 @@
         
         self.__setShortcuts()
     
-    def selectionChanged(self):
+    def selectionChanged(self, editor):
         """
         Public slot tracking changes of selected text.
+        
+        @param editor reference to the editor
+        @type Editor
         """
-        aw = self.sender()
-        self.updateSelectionCheckBox(aw)
+        self.updateSelectionCheckBox(editor)
     
     @pyqtSlot(Editor)
     def updateSelectionCheckBox(self, editor):
         """
         Public slot to update the selection check box.
         
-        @param editor reference to the editor (Editor)
+        @param editor reference to the editor
+        @type Editor
         """
         if not self.__finding and isinstance(editor, Editor):
             if editor.hasSelectedText():
@@ -1108,11 +1111,13 @@
         """
         self.__searchReplaceWidget.replaceAll()
     
-    def selectionChanged(self):
+    def selectionChanged(self, editor):
         """
         Public slot tracking changes of selected text.
+        
+        @param editor reference to the editor
+        @type Editor
         """
-        editor = self.sender()
         self.__searchReplaceWidget.updateSelectionCheckBox(editor)
     
     @pyqtSlot(Editor)
--- a/ViewManager/ViewManager.py	Mon Feb 05 19:15:47 2018 +0100
+++ b/ViewManager/ViewManager.py	Mon Feb 05 19:59:18 2018 +0100
@@ -4658,9 +4658,12 @@
         editor.languageChanged.connect(self.__editorConfigChanged)
         editor.eolChanged.connect(self.__editorConfigChanged)
         editor.encodingChanged.connect(self.__editorConfigChanged)
-        editor.selectionChanged.connect(self.__searchWidget.selectionChanged)
-        editor.selectionChanged.connect(self.__replaceWidget.selectionChanged)
-        editor.selectionChanged.connect(self.__editorSelectionChanged)
+        editor.selectionChanged.connect(
+            lambda: self.__searchWidget.selectionChanged(editor))
+        editor.selectionChanged.connect(
+            lambda: self.__replaceWidget.selectionChanged(editor))
+        editor.selectionChanged.connect(
+            lambda: self.__editorSelectionChanged(editor))
         editor.lastEditPositionAvailable.connect(
             self.__lastEditPositionAvailable)
         editor.zoomValueChanged.connect(self.zoomValueChanged)
@@ -6887,18 +6890,17 @@
             fn, line + 1, pos, encoding=enc, language=lang, eol=eol, zoom=zoom)
         self._checkActions(editor, False)
     
-    def __editorSelectionChanged(self):
+    def __editorSelectionChanged(self, editor):
         """
         Private slot to handle changes of the current editors selection.
-        """
-        editor = self.sender()
-        if editor:
-            self.sortAct.setEnabled(editor.selectionIsRectangle())
-            enable = editor.hasSelection()
-            self.editUpperCaseAct.setEnabled(enable)
-            self.editLowerCaseAct.setEnabled(enable)
-        else:
-            self.sortAct.setEnabled(False)
+        
+        @param editor reference to the editor
+        @type Editor
+        """
+        self.sortAct.setEnabled(editor.selectionIsRectangle())
+        enable = editor.hasSelection()
+        self.editUpperCaseAct.setEnabled(enable)
+        self.editLowerCaseAct.setEnabled(enable)
     
     def __editSortSelectedLines(self):
         """

eric ide

mercurial