Skip to content

Commit

Permalink
Merge pull request #4 from CyrilleB79/compa2019.3
Browse files Browse the repository at this point in the history
Restore compatibiity with NVDA 2019.3
  • Loading branch information
davidacm committed Apr 27, 2023
2 parents 37d7c3f + 4865b6b commit 5d4a98a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions addon/globalPlugins/speechHistoryExplorer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@

import addonHandler, api, globalPluginHandler, gui, speech, speechViewer, tones, versionInfo, weakref, wx
from collections import deque
from eventHandler import FocusLossCancellableSpeechCommand
try:
from eventHandler import FocusLossCancellableSpeechCommand
except ImportError:
# For older versions where this class does not exist
pass
from gui import guiHelper, nvdaControls
from gui.dpiScalingHelper import DpiScalingHelperMixin, DpiScalingHelperMixinWithoutInit
from queueHandler import eventQueue, queueFunction
Expand Down Expand Up @@ -128,7 +132,10 @@ def terminate(self, *args, **kwargs):
gui.settingsDialogs.NVDASettingsDialog.categoryClasses.remove(speechHistoryExplorerSettingsPanel)

def append_to_history(self, seq):
seq = [command for command in seq if not isinstance(command, FocusLossCancellableSpeechCommand)]
try:
seq = [command for command in seq if not isinstance(command, FocusLossCancellableSpeechCommand)]
except NameError: # if FocusLossCancellableSpeechCommand does not exist
pass
self._history.appendleft(seq)
self.history_pos = 0

Expand Down Expand Up @@ -179,7 +186,6 @@ def onSave(self):

class HistoryDialog(
DpiScalingHelperMixinWithoutInit,
gui.contextHelp.ContextHelpMixin,
wx.Dialog # wxPython does not seem to call base class initializer, put last in MRO
):
@classmethod
Expand Down

0 comments on commit 5d4a98a

Please sign in to comment.