diff --git a/documentation/conf.py b/documentation/conf.py index 26b4bda..f334caa 100644 --- a/documentation/conf.py +++ b/documentation/conf.py @@ -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 @@ -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. diff --git a/documentation/errors Quintijn.txt b/documentation/errors Quintijn.txt new file mode 100644 index 0000000..654a028 --- /dev/null +++ b/documentation/errors Quintijn.txt @@ -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 "", line 1050, in _gcd_import + File "", line 1027, in _find_and_load + File "", line 1006, in _find_and_load_unlocked + File "", line 688, in _load_unlocked + File "", line 883, in exec_module + File "", line 241, in _call_with_frames_removed + File "C:\Program Files (x86)\Natlink\site-packages\natlink\__init__.py", line 90, in + _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 "", line 1050, in _gcd_import + File "", line 1027, in _find_and_load + File "", line 1006, in _find_and_load_unlocked + File "", line 688, in _load_unlocked + File "", line 883, in exec_module + File "", line 241, in _call_with_frames_removed + File "C:\Program Files (x86)\Natlink\site-packages\natlink\__init__.py", line 90, in + _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 "", line 1050, in _gcd_import + File "", line 1027, in _find_and_load + File "", line 1006, in _find_and_load_unlocked + File "", line 688, in _load_unlocked + File "", line 883, in exec_module + File "", line 241, in _call_with_frames_removed + File "C:\DT\NatlinkcoreDoug\src\natlinkcore\natlinkstatus.py", line 110, in + import natlink + File "C:\Program Files (x86)\Natlink\site-packages\natlink\__init__.py", line 90, in + _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> \ No newline at end of file diff --git a/documentation/index.rst b/documentation/index.rst index bc554b4..cc04de3 100644 --- a/documentation/index.rst +++ b/documentation/index.rst @@ -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 diff --git a/documentation/loader.rst b/documentation/loader.rst index ae63471..3a9b184 100644 --- a/documentation/loader.rst +++ b/documentation/loader.rst @@ -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. diff --git a/documentation/modules.rst b/documentation/modules.rst index 15d2067..f880302 100644 --- a/documentation/modules.rst +++ b/documentation/modules.rst @@ -5,6 +5,8 @@ This section includes the available modules in the natlink project .. toctree:: :maxdepth: 2 - + config + loader natlinkstatus + \ No newline at end of file diff --git a/documentation/natlinkstatus.rst b/documentation/natlinkstatus.rst index acca30e..c97467d 100644 --- a/documentation/natlinkstatus.rst +++ b/documentation/natlinkstatus.rst @@ -1,7 +1,7 @@ -.. _RefSendkeys: +.. _RefNatlinkstatus: -natlinkstatus +Natlinkstatus ==================== The :code:`natlinkstatus` module keeps the status information of natlink diff --git a/src/natlinkcore/config.py b/src/natlinkcore/config.py index e10313b..3ac4aff 100644 --- a/src/natlinkcore/config.py +++ b/src/natlinkcore/config.py @@ -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 = \ diff --git a/src/natlinkcore/natlinkstatus.py b/src/natlinkcore/natlinkstatus.py index 5f5745d..dfffe41 100644 --- a/src/natlinkcore/natlinkstatus.py +++ b/src/natlinkcore/natlinkstatus.py @@ -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 diff --git a/src/natlinkcore/natlinktimer.py b/src/natlinkcore/natlinktimer.py index 1140753..f5abfb7 100644 --- a/src/natlinkcore/natlinktimer.py +++ b/src/natlinkcore/natlinktimer.py @@ -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 @@ -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: diff --git a/src/natlinkcore/natlinkutils.py b/src/natlinkcore/natlinkutils.py index 1dcc1a7..44e1b05 100644 --- a/src/natlinkcore/natlinkutils.py +++ b/src/natlinkcore/natlinkutils.py @@ -42,7 +42,7 @@ import struct import sys import traceback - +import time import natlink from natlinkcore import gramparser @@ -1320,4 +1320,14 @@ def debug_print(msg): """ if debugLoad: print(msg) - \ No newline at end of file + +if __name__ == "__main__": + try: + natlink.natConnect() + buttonClick('right') + time.sleep(1) + natlink.playString('{esc}') + finally: + natlink.natDisconnect() + + \ No newline at end of file diff --git a/tests/test_natlinktimer.py b/tests/test_natlinktimer.py index f5ea785..00a0846 100644 --- a/tests/test_natlinktimer.py +++ b/tests/test_natlinktimer.py @@ -174,6 +174,7 @@ def testStopAtMicOff(): finally: natlinktimer.stopTimerCallback() + natlink.natDisconnect() # def testStopAtMicOff():