diff --git a/addon/globalPlugins/speechLogger/__init__.py b/addon/globalPlugins/speechLogger/__init__.py index da1bf6a..aa7d575 100644 --- a/addon/globalPlugins/speechLogger/__init__.py +++ b/addon/globalPlugins/speechLogger/__init__.py @@ -111,7 +111,9 @@ def __init__(self): # Should we log during Say All/Read To End? logSayAll=True, # Should we start logging when launched? - logAtStartup=False + logAtStartup=False, + # Becomes True if we were initially set to log at startup + loggedAtStartup=False ) #: Filenames are obtained from NVDA configuration, and setup in applyUserConfig(). self.files: ImmutableKeyObj = ImmutableKeyObj(local=None, remote=None) @@ -133,7 +135,8 @@ def __init__(self): self.rotateLogs() # If we are supposed to start logging at NVDA startup, register a handler for that if self.flags.logAtStartup: - postNVDAStartup.register(self.startLocalLog) + postNvdaStartup.register(self.startLocalLog) + self.flags.loggedAtStartup = True # Wrap speech.speech.speak, so we can get its output first self._speak_orig = speech.speech.speak @wraps(speech.speech.speak) @@ -176,7 +179,8 @@ def terminate(self) -> None: speech.speech.speak = self._speak_orig SpeechWithoutPauses.speakWithoutPauses = SpeechWithoutPauses._speakWithoutPauses_orig # Unregister extensionPoints - postNVDAStartup.unregister(self.startLocalLog) + if self.flags.loggedAtStartup: + postNvdaStartup.unregister(self.startLocalLog) extensionPoint._configChanged.unregister(self.applyUserConfig) super().terminate() diff --git a/buildVars.py b/buildVars.py index 2a56ab4..37a0a55 100644 --- a/buildVars.py +++ b/buildVars.py @@ -25,7 +25,7 @@ def _(arg): # Translators: Long description to be shown for this add-on on add-on information from add-ons manager "addon_description": _("""Logs speech utterances to a file. Can also log NVDA remote session speech from the NVDA Remote add-on, to the same or another file."""), # version - "addon_version": "23.3.001", + "addon_version": "23.3.002", # Author(s) "addon_author": "Luke Davis , James Scholes", # URL for the add-on documentation support