AssistantEric/Assistant.py

branch
eric7
changeset 208
5c77d52e97cd
parent 206
0e83bc0cc7fd
child 210
6b1440b975df
--- a/AssistantEric/Assistant.py	Wed Aug 30 11:39:07 2023 +0200
+++ b/AssistantEric/Assistant.py	Sat Oct 07 17:37:40 2023 +0200
@@ -121,9 +121,8 @@
             self.__setAutoCompletionHook(editor)
         if self.__plugin.getPreferences("CalltipsEnabled"):
             self.__setCalltipsHook(editor)
-        editor.editorSaved.connect(
-            self.__apisManager.getAPIs(ApisNameProject).editorSaved
-        )
+        if (api := self.__apisManager.getAPIs(ApisNameProject)) is not None:
+            editor.editorSaved.connect(api.editorSaved)
         self.__editors.append(editor)
 
         # preload the api to give the manager a chance to prepare the database
@@ -140,9 +139,8 @@
         @type Editor
         """
         if editor in self.__editors:
-            editor.editorSaved.disconnect(
-                self.__apisManager.getAPIs(ApisNameProject).editorSaved
-            )
+            if (api := self.__apisManager.getAPIs(ApisNameProject)) is not None:
+                editor.editorSaved.disconnect(api.editorSaved)
             self.__editors.remove(editor)
             if editor.getCompletionListHook("Assistant"):
                 self.__unsetAutoCompletionHook(editor)

eric ide

mercurial