Skip to content

Commit

Permalink
Dr16issues, starting to solve several issues that arose with Dragon 16 (
Browse files Browse the repository at this point in the history
#70)

* natlinkstatus: entered getUnimacroGrammarsDirectory, and a lot of tidying up
* add 2 tests execscriptest.py is ok, buttonclicktest.py fails. The cause is playEvents.
* the buttonclicktest.py shows the bug when natlink.playEvents is called.
* also enter dragonfly (dragonfly2) in the config procedure, including testing for upgrades..
* add a few changes to nsformat.py (a\\determiner and I\\pronoun
* nsformat.py: changed (formatPassword)

* use pythong logging module to report output of pip etc.
* command line uses logging.
* logging to cli.
* loader.py: adapt load_or_reload_module function with force_load, so it works from Unimacro (_control.py grammar).
* trying to get documentation (sphinx) up and running (not successful)
* setting default port for settings.debugadapterprotocol to 7474...
* effort to fix a test error with test_natlinktimer.py failed.

---------

Co-authored-by: Doug Ransom <[email protected]>
  • Loading branch information
quintijn and dougransom authored Mar 24, 2024
1 parent 3aa4914 commit 2dd7df4
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/natlinkcore/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def from_config_parser(config: configparser.ConfigParser, config_path: str) -> '
if config.has_section('settings.debugadapterprotocol'):
dap_settings = config['settings.debugadapterprotocol']
dap_enabled = dap_settings.getboolean('dap_enabled', fallback=False)
dap_port = dap_settings.getint('dap_port', fallback=0)
dap_port = dap_settings.getint('dap_port', fallback=7474)
dap_wait_for_debugger_attach_on_startup= dap_settings.getboolean('dap_wait_for_debugger_attach_on_startup', fallback=False)

ret.dap_enabled,ret.dap_port,ret.dap_wait_for_debugger_attach_on_startup = \
Expand Down
2 changes: 2 additions & 0 deletions src/natlinkcore/natlinkstatus.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,8 @@ def getVocolaGrammarsDirectory(self):

key = 'vocolagrammarsdirectory'
value = self.natlinkmain.getconfigsetting(section='directories', option=key)
if not value:
return ""
voc_grammars_dir = natlinkcore.config.expand_path(value)
self.VocolaGrammarsDirectory = voc_grammars_dir
return voc_grammars_dir
Expand Down
4 changes: 2 additions & 2 deletions src/natlinkcore/natlinktimer.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def removeCallback(self, callback, debug=None):

# outside in_timer:
try:
print('remove 1 timer')
print(f'natlinktimer, remove timer {callback.__name__}')
del self.callbacks[callback]
except KeyError:
pass
Expand Down Expand Up @@ -361,7 +361,7 @@ def removeTimerCallback(callback, debug=None):
callback: the function to be called
"""
if not natlinktimer:
print(f'no timers active, cannot remove {callback} from natlinktimer')
# print(f'no timers active, cannot remove {callback} from natlinktimer')
return

if callback is None:
Expand Down
14 changes: 12 additions & 2 deletions src/natlinkcore/natlinkutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
import struct
import sys
import traceback

import time
import natlink
from natlinkcore import gramparser

Expand Down Expand Up @@ -1320,4 +1320,14 @@ def debug_print(msg):
"""
if debugLoad:
print(msg)


if __name__ == "__main__":
try:
natlink.natConnect()
buttonClick('right')
time.sleep(1)
natlink.playString('{esc}')
finally:
natlink.natDisconnect()


1 change: 1 addition & 0 deletions tests/test_natlinktimer.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ def testStopAtMicOff():

finally:
natlinktimer.stopTimerCallback()
natlink.natDisconnect()


# def testStopAtMicOff():
Expand Down

0 comments on commit 2dd7df4

Please sign in to comment.