Skip to content

Commit

Permalink
Disable Kaldi debug logging workaround for Windows Key action bug
Browse files Browse the repository at this point in the history
Re: dictation-toolbox#182.

This disables the logging workaround for a bug that has previously
occurred on Windows using the Kaldi engine back-end.  I have reason
to believe the bug no longer occurs, so the verbose debug logging
can be disabled.

If I am mistaken in this, then the workaround may be enabled by
calling the KaldiEngine._apply_win32_kb_input_logging_fix() method.
  • Loading branch information
drmfinlay committed Jun 26, 2021
1 parent 10ecc47 commit d091452
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Added

Changed
~~~~~~~
* Disable Kaldi debug logging workaround for Windows Key action bug.
* Make Clipboard class instances comparable based on content difference.

Fixed
Expand Down
17 changes: 10 additions & 7 deletions dragonfly/engines/backend_kaldi/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,6 @@ def __init__(self, model_dir=None, tmp_dir=None, input_device_index=None,
if not os.environ.get('DRAGONFLY_DEVELOP'):
raise EngineError("Incompatible kaldi_active_grammar version")

# Hack to avoid bug processing keyboard actions on Windows
if os.name == 'nt':
action_exec_logger = logging.getLogger('action.exec')
if action_exec_logger.getEffectiveLevel() > logging.DEBUG:
self._log.warning("%s: Enabling logging of actions execution to avoid bug processing keyboard actions on Windows", self)
action_exec_logger.setLevel(logging.DEBUG)

# Handle engine parameters
if input_device_index is not None:
if audio_input_device is not None:
Expand Down Expand Up @@ -219,6 +212,16 @@ def disconnect(self):
def print_mic_list():
MicAudio.print_list()

def _apply_win32_kb_input_logging_fix(self):
# Hack to avoid bug processing keyboard actions on Windows
if os.name == 'nt':
action_exec_logger = logging.getLogger('action.exec')
if action_exec_logger.getEffectiveLevel() > logging.DEBUG:
self._log.warning("%s: Enabling logging of actions "
"execution to avoid bug processing "
"keyboard actions on Windows", self)
action_exec_logger.setLevel(logging.DEBUG)

#-----------------------------------------------------------------------
# Methods for working with grammars.

Expand Down

0 comments on commit d091452

Please sign in to comment.