Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dr16issues, starting to solve several issues that arose with Dragon 16 #70

Merged
merged 25 commits into from
Mar 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
a0ad16f
was lost in the flow, reentered from natlinkcore repository
quintijn Feb 2, 2024
cf994d4
entered getUnimacroGrammarsDirectory, and a lot of tidying up
quintijn Feb 2, 2024
eb6845c
multiple changes in natlinkstatus.py and natlinkconfigfunctions.py, l…
quintijn Feb 3, 2024
74f2554
add 2 tests execscriptest.py is ok, buttonclicktest.py fails. The cau…
quintijn Feb 3, 2024
3cfc5ce
the buttonclicktest.py shows the bug when natlink.playEvents is called.
quintijn Feb 4, 2024
2bf1f67
also enter dragonfly (dragonfly2) in the config procedure, including …
quintijn Feb 6, 2024
9b21667
add a few changes to nsformat.py (a\\determiner and I\\pronoun
quintijn Feb 8, 2024
10de328
small change in nsformat.py (formatPassword)
quintijn Feb 8, 2024
4cf7806
use pythong logging module to report output of pip etc.
dougransom Feb 17, 2024
15f8045
command line uses logging.
dougransom Feb 17, 2024
c53e016
logging to cli.
dougransom Feb 17, 2024
9932390
Merge branch 'dr16issues' of https://github.com/dougransom/natlinkcor…
dougransom Feb 17, 2024
761393e
tweak.
dougransom Feb 17, 2024
981733c
a few documentation details...
quintijn Feb 21, 2024
99b196a
try to catch an error when unloading a grammar, when it is not (corre…
quintijn Feb 21, 2024
c94dfe0
adapt load_or_reload_module function with force_load, so it works fro…
quintijn Feb 21, 2024
46d3213
Merge branch 'dr16issues' of github.com:dougransom/natlinkcore into d…
quintijn Feb 21, 2024
a82ff71
Merge branch 'main' into dr16issues
quintijn Feb 21, 2024
adecae7
Merge branch 'dictation-toolbox:main' into dr16issues
quintijn Feb 21, 2024
9636078
trying to get documentation (sphinx) up and running (not successful)
quintijn Feb 23, 2024
34420ca
tidying up a few messages natlinktimer.py
quintijn Feb 27, 2024
76cc9dd
small fix in natlinkstatus.py
quintijn Feb 29, 2024
32c1184
make a small test at bottom (buttonClick should be caught in __init__…
quintijn Feb 29, 2024
9a7d525
setting default port for settings.debugadapterprotocol to 7474...
quintijn Mar 2, 2024
433f59e
effort to fix a test error with test_natlinktimer.py failed.
quintijn Mar 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions documentation/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# -- Project information -----------------------------------------------------

project = 'natlinkcore'
copyright = '2021, Joel Gould, Quintijn Hoogenboom'
copyright = '1999: Joel Gould'
author = 'Joel Gould'

# The full version, including alpha/beta/rc tags
Expand Down Expand Up @@ -99,7 +99,7 @@ def __getattr__(cls, name):
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
language = 'en'

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand Down
82 changes: 82 additions & 0 deletions documentation/errors Quintijn.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@

Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS C:\Users\Gebruiker> cd C:\dt\NatlinkcoreDoug\documentation\
PS C:\dt\NatlinkcoreDoug\documentation> .\make html Running Sphinx v5.1.1
natlinkcore, version: "5.3", release: "5.3.8"
loading pickled environment... done
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 0 source files that are out of date
updating environment: 0 added, 3 changed, 0 removed
reading sources... [100%] natlinkstatus
WARNING: autodoc: failed to import module 'config' from module 'natlink'; the following exception was raised:
Traceback (most recent call last):
File "C:\Python310-32\lib\site-packages\sphinx\ext\autodoc\importer.py", line 58, in import_module
return importlib.import_module(modname)
File "C:\Python310-32\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "C:\Program Files (x86)\Natlink\site-packages\natlink\__init__.py", line 90, in <module>
_original_natconnect=natConnect
NameError: name 'natConnect' is not defined

WARNING: autodoc: failed to import module 'loader' from module 'natlink'; the following exception was raised:
Traceback (most recent call last):
File "C:\Python310-32\lib\site-packages\sphinx\ext\autodoc\importer.py", line 58, in import_module
return importlib.import_module(modname)
File "C:\Python310-32\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "C:\Program Files (x86)\Natlink\site-packages\natlink\__init__.py", line 90, in <module>
_original_natconnect=natConnect
NameError: name 'natConnect' is not defined

WARNING: autodoc: failed to import module 'natlinkstatus' from module 'natlinkcore'; the following exception was raised:
Traceback (most recent call last):
File "C:\Python310-32\lib\site-packages\sphinx\ext\autodoc\importer.py", line 58, in import_module
return importlib.import_module(modname)
File "C:\Python310-32\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "C:\DT\NatlinkcoreDoug\src\natlinkcore\natlinkstatus.py", line 110, in <module>
import natlink
File "C:\Program Files (x86)\Natlink\site-packages\natlink\__init__.py", line 90, in <module>
_original_natconnect=natConnect
NameError: name 'natConnect' is not defined

looking for now-outdated files... none found
pickling environment... done
checking consistency... C:\DT\NatlinkcoreDoug\documentation\config.rst: WARNING: document isn't included in any toctree
C:\DT\NatlinkcoreDoug\documentation\developers.rst: WARNING: document isn't included in any toctree
C:\DT\NatlinkcoreDoug\documentation\loader.rst: WARNING: document isn't included in any toctree
C:\DT\NatlinkcoreDoug\documentation\natlinkstatus.rst: WARNING: document isn't included in any toctree
done
preparing documents... done
writing output... [100%] natlinkstatus
generating indices... genindex done
writing additional pages... search done
copying static files... done
copying extra files... done
dumping search index in English (code: en)... done
dumping object inventory... done
build succeeded, 7 warnings.

The HTML pages are in _build\html.
PS C:\dt\NatlinkcoreDoug\documentation>
3 changes: 2 additions & 1 deletion documentation/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ These are the python modules of the Natlink project. "End users" should not need

Please read the [Natlink documentation](https://natlink.readthedocs.io/en/latest/) for installation, configuration and developing the C++ code.

:caption: Contents:

.. toctree::
:maxdepth: 2
:caption: Contents:

modules
project
Expand Down
2 changes: 1 addition & 1 deletion documentation/loader.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

loader
=================
The :code:`loader` is what was :code:`natlinkmain`: it loads the various
The :code:`loader` is what was :code:`natlinkmain` in python(2) NatLink: it loads the various
modules according to the config file `natlink.ini`.

Moreover, it also handles callbacks from Dragon/Natlink.
Expand Down
4 changes: 3 additions & 1 deletion documentation/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ This section includes the available modules in the natlink project

.. toctree::
:maxdepth: 2

config
loader
natlinkstatus


4 changes: 2 additions & 2 deletions documentation/natlinkstatus.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

.. _RefSendkeys:
.. _RefNatlinkstatus:

natlinkstatus
Natlinkstatus
====================

The :code:`natlinkstatus` module keeps the status information of natlink
Expand Down
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
Loading