eric6/QScintilla/EditorAssembly.py

changeset 8243
cc717c2ae956
parent 8220
006ee31b4835
diff -r aa713ac50c0d -r cc717c2ae956 eric6/QScintilla/EditorAssembly.py
--- a/eric6/QScintilla/EditorAssembly.py	Thu Apr 15 16:52:05 2021 +0200
+++ b/eric6/QScintilla/EditorAssembly.py	Thu Apr 15 18:11:24 2021 +0200
@@ -8,6 +8,8 @@
 combos and the editor widget.
 """
 
+import contextlib
+
 from PyQt5.QtCore import QTimer
 from PyQt5.QtWidgets import QWidget, QGridLayout, QComboBox
 
@@ -148,7 +150,7 @@
             line, _ = self.__editor.getCursorPosition()
             self.__editorCursorLineChanged(line)
         else:
-            try:
+            with contextlib.suppress(TypeError):
                 self.__globalsCombo.activated[int].disconnect(
                     self.__globalsActivated)
                 self.__membersCombo.activated[int].disconnect(
@@ -156,9 +158,6 @@
                 self.__editor.cursorLineChanged.disconnect(
                     self.__editorCursorLineChanged)
                 self.__parseTimer.timeout.disconnect(self.__parseEditor)
-            except TypeError:
-                # signals were not connected
-                pass
             
             self.__globalsCombo.clear()
             self.__membersCombo.clear()
@@ -449,14 +448,11 @@
         else:
             self.__sourceOutline.hide()
             
-            try:
+            with contextlib.suppress(TypeError):
                 self.__parseTimer.timeout.disconnect(
                     self.__sourceOutline.repopulate)
                 self.__editor.languageChanged.disconnect(self.__editorChanged)
                 self.__editor.editorRenamed.disconnect(self.__editorChanged)
-            except TypeError:
-                # signals were not connected
-                pass
     
     def __editorChanged(self):
         """

eric ide

mercurial