natlinkcore 5.4.1__tar.gz → 5.4.2.dev1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/PKG-INFO +49 -6
  2. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/pyproject.toml +4 -2
  3. natlinkcore-5.4.2.dev1/readme.md +81 -0
  4. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/__init__.py +4 -1
  5. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/config.py +14 -15
  6. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/configure/natlinkconfig_gui.py +4 -4
  7. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/loader.py +27 -0
  8. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/natlinkutils.py +5 -0
  9. natlinkcore-5.4.1/readme.md +0 -39
  10. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/DefaultConfig/_config_instructions.py +0 -0
  11. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/DefaultConfig/_information_config.py +0 -0
  12. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/DefaultConfig/natlink.ini +0 -0
  13. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/SampleMacros/OriginalSampleMacros/Index.htm +0 -0
  14. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/SampleMacros/OriginalSampleMacros/_globals.py +0 -0
  15. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/SampleMacros/OriginalSampleMacros/_mouse.py +0 -0
  16. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/SampleMacros/OriginalSampleMacros/_repeatthat.py +0 -0
  17. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/SampleMacros/OriginalSampleMacros/_sample1.py +0 -0
  18. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/SampleMacros/OriginalSampleMacros/_sample2.py +0 -0
  19. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/SampleMacros/OriginalSampleMacros/_sample3.py +0 -0
  20. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/SampleMacros/OriginalSampleMacros/_sample4.py +0 -0
  21. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/SampleMacros/OriginalSampleMacros/_sample5.py +0 -0
  22. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/SampleMacros/OriginalSampleMacros/_sample8.py +0 -0
  23. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/SampleMacros/OriginalSampleMacros/_sample9.py +0 -0
  24. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/SampleMacros/OriginalSampleMacros/_sleeping.py +0 -0
  25. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/SampleMacros/OriginalSampleMacros/excel_sample7.py +0 -0
  26. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/SampleMacros/OriginalSampleMacros/natspeak_sample6.py +0 -0
  27. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/SampleMacros/OriginalSampleMacros/trainuser.py +0 -0
  28. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/SampleMacros/OriginalSampleMacros/transcribe.py +0 -0
  29. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/SampleMacros/OriginalSampleMacros/wiki.css +0 -0
  30. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/SampleMacros/OriginalSampleMacros/windict.py +0 -0
  31. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/SampleMacros/OriginalSampleMacros/winspch.py +0 -0
  32. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/SampleMacros/OriginalSampleMacros/winword_styles_sample.py +0 -0
  33. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/SampleMacros/OriginalSampleMacros/wordpad.py +0 -0
  34. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/SampleMacros/__init__.py +0 -0
  35. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/SampleMacros/_debug_natlink.py +0 -0
  36. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/SampleMacros/_sample7.py +0 -0
  37. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/SampleMacros/_sample_activatedeactivate.py +0 -0
  38. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/SampleMacros/_sample_callback.py +0 -0
  39. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/SampleMacros/_sample_directory_information.py +0 -0
  40. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/SampleMacros/_sample_move_natlinktimer.py +0 -0
  41. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/SampleMacros/_sample_natlinkstatus.py +0 -0
  42. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/SampleMacros/_sample_runmimic.py +0 -0
  43. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/SampleMacros/_samplehypothesis.py +0 -0
  44. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/_natlink_core.pyi +0 -0
  45. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/callbackhandler.py +0 -0
  46. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/configure/README.md +0 -0
  47. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/configure/__init__.py +0 -0
  48. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/configure/foo.txt +0 -0
  49. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/configure/list of functions.txt +0 -0
  50. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/configure/loggert.py +0 -0
  51. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/configure/natlink_extensions.py +0 -0
  52. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/configure/natlinkconfig_cli.py +0 -0
  53. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/configure/natlinkconfigfunctions.py +0 -0
  54. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/gramparser.py +0 -0
  55. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/natlink.pyi +0 -0
  56. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/natlinkpydebug.py +0 -0
  57. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/natlinkstatus.py +0 -0
  58. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/natlinktimer.py +0 -0
  59. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/nsformat.py +0 -0
  60. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/py.typed +0 -0
  61. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/readwritefile.py +0 -0
  62. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/redirect_output.py +0 -0
  63. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/singleton.py +0 -0
  64. {natlinkcore-5.4.1 → natlinkcore-5.4.2.dev1}/src/natlinkcore/tkinter_dialogs.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: natlinkcore
3
- Version: 5.4.1
3
+ Version: 5.4.2.dev1
4
4
  Summary: Python portion of Natlink, a compatibility module for Dragon Naturally Speaking
5
5
  Author-email: "Quintijn Hoogenboom (maintainer)" <q.hoogenboom@antenna.nl>
6
6
  Requires-Python: >=3.9
@@ -17,6 +17,7 @@ Requires-Dist: FreeSimpleGUI>=5.1.0
17
17
  Requires-Dist: pydebugstring >= 1.0.0.1
18
18
  Requires-Dist: dtactions>=1.6.3
19
19
  Requires-Dist: platformdirs >= 4.2.0
20
+ Requires-Dist: natlink ~= 5.5, >= 5.5.7
20
21
  Requires-Dist: pyenvutils ; extra == "dev"
21
22
  Requires-Dist: entry-point-inspector ; extra == "dev"
22
23
  Requires-Dist: build ; extra == "dev"
@@ -54,10 +55,52 @@ Mandy Python IDEs such as [Visual Studio Code](https://code.visualstudio.com/) h
54
55
  Publishing to PyPi is done through the [trusted publisher mechanism](https://docs.pypi.org/trusted-publishers/using-a-publisher/) when a release is created on github using github actions.
55
56
 
56
57
 
57
- ## Publishing checklist
58
- Before you bump the version number in __init__.py and publish:
59
- - Check the pyroject.toml file for package dependancies. Do you need a specfic or newer version of
60
- a dependancy such as dtactions? Then add or update the version # requirement in dtactions.
58
+ ## Version Numbering and Publishing Checklist
59
+
60
+ While you are developing, use a .dev release number. When you are ready for alpha or beta or release candidate, use the appropriate version numbers.
61
+ If you are submitting a pull request, the review should review and adjust the version number.
62
+ The version specificier is in pyroject.toml.
63
+
64
+
65
+ The version number progression is explained in [PEP440](https://peps.python.org/pep-0440/#summary-of-permitted-suffixes-and-relative-ordering).
66
+
67
+ Hypothetical Progression of release numbers.
68
+
69
+ Working towards 5.4.0:
70
+ - 5.4.0.dev1
71
+ - 5.4.0.dev2
72
+ - 5.4.0.dev_feature_x
73
+ - 5.4.0a1
74
+ - 5.4.0b1dev1
75
+ - 5.4.0b1
76
+ - 5.4.0rc1
77
+ - 5.4.0rc2
78
+ - 5.4.0
79
+
80
+ Use alpha and beta specifiers (5.4a2, 5.4.b1, etc) to release alphas and betas.
81
+ If you go through a release candidate phase, use 5.4rc1 etc.
82
+
83
+ Non breaking changes, add a micro version number. ie from version 5.4.1 to 5.4.2.
84
+ Breaking changes, add a minor version number.
85
+
86
+ *Before you publish to pypi*:
87
+ - doublecheck the dependancies, especially on natlink. You may want to specify a minimum natlink (i.e. 5.5.3) and
88
+ normally you should also specify that natlink has not had a breaking change by specifying the major and minor version numbers are as expected. Note that this requires a release of natlinkcore if the minor version of natlink changes. At minimum this will require an update to pyproject.toml and a release to pypi, even if no python code has changed.
89
+
90
+
91
+
92
+ This is how the version specifier should look for natlink (subsituting the version numbers appropriate). In this case, we are saying that any natlink 5.5 is required, and that
93
+ we require greater than 5.5.7 as well because we are relying on a non-breaking change introduced in 5.5.7.
94
+ ` "natlink ~= 5.5, >= 5.5.7"
95
+ `
96
+ Often, the natlink dependancy should just specify the major and minor version:
97
+ `
98
+ "natlink ~= 5.5"
99
+ `
100
+
101
+ You could have a case where natlinkcore works with natlink 5.5 and 5.6, you could express this in pyproject.toml as
102
+ "natlink ~= 5.5, ~= 5.6".
103
+
61
104
 
62
105
  ## Debugging Instructions
63
106
 
@@ -5,7 +5,8 @@ build-backend = "flit_core.buildapi"
5
5
  [project]
6
6
  name = "natlinkcore"
7
7
  authors = [{name = "Quintijn Hoogenboom (maintainer)", email = "q.hoogenboom@antenna.nl"}]
8
- dynamic = ["version", "description"]
8
+ version="5.4.2.dev1"
9
+ dynamic = [ "description"]
9
10
  requires-python = ">=3.9"
10
11
  readme = "readme.md"
11
12
  dependencies= [
@@ -13,7 +14,8 @@ dependencies= [
13
14
  "FreeSimpleGUI>=5.1.0",
14
15
  "pydebugstring >= 1.0.0.1",
15
16
  "dtactions>=1.6.3",
16
- "platformdirs >= 4.2.0"
17
+ "platformdirs >= 4.2.0",
18
+ "natlink ~= 5.5, >= 5.5.7"
17
19
  ]
18
20
  classifiers=[
19
21
  "Development Status :: 4 - Beta",
@@ -0,0 +1,81 @@
1
+
2
+ # Natlinkcore
3
+
4
+ ## More Information
5
+ Please refer to the README file in the project repository [https://github.com/dictation-toolbox/natlink](https://github.com/dictation-toolbox/natlink) for more information about natlink.
6
+
7
+ ## Installing from PyPi
8
+ You can install from [The Python Package Index (PyPI)](https://pypi.org/) with
9
+
10
+ `py -m pip install natlinkcore`
11
+
12
+ Note that natlinkcore will not install if you have not installed Natlink first. Natlink is installed through running an installer.
13
+
14
+
15
+ ## Test Framework
16
+ Tests use the [pytest](https://docs.pytest.org/) framework.
17
+ For developers, if you are developing on the project, please add tests for any new features or bug
18
+ fixes.
19
+
20
+ Mandy Python IDEs such as [Visual Studio Code](https://code.visualstudio.com/) have build in support for test frameworks and make it easy to run and debug pytest. see [Visual Studio Code for testing](https://code.visualstudio.com/docs/python/testing).
21
+
22
+
23
+ ## Building the Python Package Locally
24
+
25
+ `py -m build` to build the Python package locally.
26
+
27
+ Publishing to PyPi is done through the [trusted publisher mechanism](https://docs.pypi.org/trusted-publishers/using-a-publisher/) when a release is created on github using github actions.
28
+
29
+
30
+ ## Version Numbering and Publishing Checklist
31
+
32
+ While you are developing, use a .dev release number. When you are ready for alpha or beta or release candidate, use the appropriate version numbers.
33
+ If you are submitting a pull request, the review should review and adjust the version number.
34
+ The version specificier is in pyroject.toml.
35
+
36
+
37
+ The version number progression is explained in [PEP440](https://peps.python.org/pep-0440/#summary-of-permitted-suffixes-and-relative-ordering).
38
+
39
+ Hypothetical Progression of release numbers.
40
+
41
+ Working towards 5.4.0:
42
+ - 5.4.0.dev1
43
+ - 5.4.0.dev2
44
+ - 5.4.0.dev_feature_x
45
+ - 5.4.0a1
46
+ - 5.4.0b1dev1
47
+ - 5.4.0b1
48
+ - 5.4.0rc1
49
+ - 5.4.0rc2
50
+ - 5.4.0
51
+
52
+ Use alpha and beta specifiers (5.4a2, 5.4.b1, etc) to release alphas and betas.
53
+ If you go through a release candidate phase, use 5.4rc1 etc.
54
+
55
+ Non breaking changes, add a micro version number. ie from version 5.4.1 to 5.4.2.
56
+ Breaking changes, add a minor version number.
57
+
58
+ *Before you publish to pypi*:
59
+ - doublecheck the dependancies, especially on natlink. You may want to specify a minimum natlink (i.e. 5.5.3) and
60
+ normally you should also specify that natlink has not had a breaking change by specifying the major and minor version numbers are as expected. Note that this requires a release of natlinkcore if the minor version of natlink changes. At minimum this will require an update to pyproject.toml and a release to pypi, even if no python code has changed.
61
+
62
+
63
+
64
+ This is how the version specifier should look for natlink (subsituting the version numbers appropriate). In this case, we are saying that any natlink 5.5 is required, and that
65
+ we require greater than 5.5.7 as well because we are relying on a non-breaking change introduced in 5.5.7.
66
+ ` "natlink ~= 5.5, >= 5.5.7"
67
+ `
68
+ Often, the natlink dependancy should just specify the major and minor version:
69
+ `
70
+ "natlink ~= 5.5"
71
+ `
72
+
73
+ You could have a case where natlinkcore works with natlink 5.5 and 5.6, you could express this in pyproject.toml as
74
+ "natlink ~= 5.5, ~= 5.6".
75
+
76
+
77
+ ## Debugging Instructions
78
+
79
+ Read the detailed developer instructions for setting up the debugger. You can look in this projects tree until
80
+ documentation/developers.rst.
81
+
@@ -1,7 +1,10 @@
1
1
  '''Python portion of Natlink, a compatibility module for Dragon Naturally Speaking
2
2
  The python stuff including test modules'''
3
3
 
4
- __version__="5.4.1"
4
+ import importlib.metadata
5
+
6
+ __version__ = importlib.metadata.version(__package__) #version set in pyproject.toml now.
7
+
5
8
  #pylint:disable=
6
9
  from pathlib import Path
7
10
 
@@ -144,20 +144,19 @@ class NatlinkConfig:
144
144
  raise NoGoodConfigFoundException('No natlink config file found, please run configure natlink program\n\t(***configurenatlink***)')
145
145
 
146
146
  def expand_path(input_path: str) -> str:
147
- r"""expand path if it starts with "~" or has environment variables (%XXXX%)
147
+ r"""expand path if it starts with "~" or starts with an environment variable or name of python package
148
148
 
149
- Paths can be:
150
-
151
- - the name of a python package, or a sub directory of a python package
152
- - Obsolete: natlink_userdir/...: the directory where natlink.ini is is searched for, either %(NATLINK_USERDIR) or ~/.natlink
153
- - ~/...: the home directory
154
- - Now: natlink_settingsdir/...: the directory where natlink.ini is is searched for, either %(NATLINK_SETTINGSDIR) or ~/.natlink
155
- - ~/...: the home directory
156
- - some environment variable: this environment variable is expanded.
157
-
158
- The Documents directory can be found by "~\Documents"...
159
-
160
- When nothing to expand, return input
149
+ Paths can be:
150
+
151
+ - the name of a python package, or a sub directory of a python package
152
+ - natlink_settingsdir/...: the directory where natlink.ini is is searched for, either`%(NATLINK_SETTINGSDIR)` or `~/.natlink`
153
+ - `~/...`: the home directory
154
+ - Obsolete: natlink_userdir/...: instead natlink_settingsdir will be searched for, and a message is thrown. In the config program things are checked more thoroughly.
155
+ - some other environment variable: this environment variable is expanded
156
+
157
+ The Documents directory can be found by "~\Documents"...
158
+
159
+ When there is nothing to expand, just return the input
161
160
  """
162
161
  expanduser, expandvars, normpath, isdir = os.path.expanduser, os.path.expandvars, os.path.normpath, os.path.isdir
163
162
 
@@ -228,10 +227,10 @@ def expand_path(input_path: str) -> str:
228
227
  return normpath(env_expanded)
229
228
 
230
229
  def expand_natlink_settingsdir():
231
- """not with envvariables, but special:
230
+ """Return the location of the natlink config files
232
231
 
233
232
  if NATLINK_SETTINGSDIR is set: return this, but... it should end with ".natlink"
234
- if NATLINK_SETTINGSDIR is NOT set: return Path.home()/'.natlink'
233
+ if NATLINK_SETTINGSDIR is NOT set: return `Path.home()/'.natlink'`
235
234
  """
236
235
  normpath = os.path.normpath
237
236
  nsd = os.getenv('natlink_settingsdir')
@@ -56,14 +56,14 @@ def collapse(layout, key, visible):
56
56
 
57
57
  #### Hidden UI Columns ####
58
58
  dragonfly2_section = [[sg.Text('Dragonfly', text_color='black')],
59
- [sg.T('Dragonfly user directory:', tooltip='The directory to dragonfly2 user scripts (UserDirectory can also be used)'), sg.Input(Status.getDragonflyUserDirectory(), key='Set_UserDir_Dragonfly2', enable_events=True, readonly=True), sg.FolderBrowse(), sg.B("Clear", key='Clear_UserDir_Dragonfly2', enable_events=True)]]
59
+ [sg.T('Dragonfly user directory:', tooltip='The directory to dragonfly2 user scripts (UserDirectory can also be used)'), sg.Input(Status.getDragonflyUserDirectory(), key='Set_UserDir_Dragonfly2', enable_events=False, readonly=False), sg.FolderBrowse(), sg.B("Clear", key='Clear_UserDir_Dragonfly2', enable_events=True)]]
60
60
 
61
61
  unimacro_section = [[sg.T('Unimacro', text_color='black')],
62
- [sg.T('Unimacro user directory:', tooltip=r'Where the Unimacro user INI files are located, and several other directories (~ or %HOME% allowed)'), sg.I(Status.getUnimacroUserDirectory(), key='Set_UserDir_Unimacro', enable_events=True, readonly=True), sg.FolderBrowse(), sg.B("Clear", key='Clear_UserDir_Unimacro', enable_events=True)]]
62
+ [sg.T('Unimacro user directory:', tooltip=r'Where the Unimacro user INI files are located, and several other directories (~ or %HOME% allowed)'), sg.I(Status.getUnimacroUserDirectory(), key='Set_UserDir_Unimacro', enable_events=False, readonly=False), sg.FolderBrowse(), sg.B("Clear", key='Clear_UserDir_Unimacro', enable_events=True)]]
63
63
 
64
64
  extras_section = [[sg.T('Natlink Loglevel:'), sg.Combo(default_value=Status.getLogging(), values=("Critical", "Fatal", "Error", "Warning", "Info" , "Debug"), key='Set_Logging_Natlink', enable_events=True, auto_size_text=True, readonly=True)],
65
- [sg.T('Autohotkey exe dir:'), sg.I(Status.getAhkExeDir(), key='Set_Exe_Ahk', enable_events=True, readonly=True), sg.FolderBrowse(), sg.B("Clear", key='Clear_Exe_Ahk', enable_events=True)],
66
- [sg.T('Autohotkey scripts dir:'), sg.I(Status.getAhkUserDir(), key='Set_ScriptsDir_Ahk', enable_events=True, readonly=True), sg.FolderBrowse(), sg.B("Clear", key='Clear_ScriptsDir_Ahk', enable_events=True)],
65
+ [sg.T('Autohotkey exe dir:'), sg.I(Status.getAhkExeDir(), key='Set_Exe_Ahk', enable_events=False, readonly=False), sg.FolderBrowse(), sg.B("Clear", key='Clear_Exe_Ahk', enable_events=False)],
66
+ [sg.T('Autohotkey scripts dir:'), sg.I(Status.getAhkUserDir(), key='Set_ScriptsDir_Ahk', enable_events=False, readonly=False), sg.FolderBrowse(), sg.B("Clear", key='Clear_ScriptsDir_Ahk', enable_events=False)],
67
67
  [sg.T('Natlink GUI Output')],
68
68
  [sg.Output(size=(40,10), echo_stdout_stderr=True, expand_x=True, key='-OUTPUT-')]]
69
69
 
@@ -19,6 +19,7 @@ import debugpy
19
19
 
20
20
  import natlink
21
21
  from natlinkcore.config import LogLevel, NatlinkConfig, expand_path
22
+ from natlinkcore.natlinkutils import idd_reload, idd_exit
22
23
  from natlinkcore.readwritefile import ReadWriteFile
23
24
  from natlinkcore.callbackhandler import CallbackHandler
24
25
  from natlinkcore.singleton import Singleton
@@ -257,6 +258,13 @@ class NatlinkMain(metaclass=Singleton):
257
258
  if d_expanded not in sys.path:
258
259
  sys.path.insert(0, d_expanded)
259
260
 
261
+ @staticmethod
262
+ def _del_dirs_from_path(directories: Iterable[str]) -> None:
263
+ for d in directories:
264
+ d_expanded = expand_path(d)
265
+ if d_expanded in sys.path:
266
+ sys.path.remove(d_expanded)
267
+
260
268
  def _call_and_catch_all_exceptions(self, fn: Callable[[], None]) -> None:
261
269
  try:
262
270
  fn()
@@ -455,6 +463,14 @@ class NatlinkMain(metaclass=Singleton):
455
463
  value -= 1
456
464
  self.load_on_begin_utterance = value
457
465
  self.trigger_load()
466
+
467
+ def on_message_window_callback(self, event):
468
+ if event == idd_reload:
469
+ self.trigger_load(force_load=True)
470
+ natlink.setBeginCallback(self.on_begin_callback)
471
+ natlink.setChangeCallback(self.on_change_callback)
472
+ elif event == idd_exit:
473
+ self.finish()
458
474
 
459
475
  def get_user_language(self, DNSuserDirectory):
460
476
  """return the user language (default "enx") from Dragon inifiles
@@ -545,6 +561,17 @@ class NatlinkMain(metaclass=Singleton):
545
561
  self.trigger_load()
546
562
  natlink.setBeginCallback(self.on_begin_callback)
547
563
  natlink.setChangeCallback(self.on_change_callback)
564
+ natlink.setMessageWindow(self.on_message_window_callback)
565
+
566
+ def finish(self) -> None:
567
+ # reverse changes made by start()
568
+ natlink.setMessageWindow(None)
569
+ natlink.setChangeCallback(None)
570
+ natlink.setBeginCallback(None)
571
+ self.unload_all_loaded_modules()
572
+ self._del_dirs_from_path(self.config.directories)
573
+ natlink.active_loader = None
574
+ self.logger.info('Stopping natlink loader')
548
575
 
549
576
  def setup_logger(self) -> None:
550
577
  for handler in list(self.logger.handlers):
@@ -124,6 +124,11 @@ dgnwordflag_title_mode = 0x02000000
124
124
  dgnwordflag_space_bar = 0x08000000
125
125
  dgnwordflag_topicadded = 0x40000000
126
126
  dgnwordflag_DNS8newwrdProp = 0x20000000
127
+
128
+ # The following constants define the window message codes which are passed
129
+ # to the message window callback on menu command activation.
130
+ idd_reload = 32768
131
+ idd_exit = 32769
127
132
 
128
133
  ## temporary fix, remove as soon as natlinkmain is more secure QH (Febr 2021)
129
134
 
@@ -1,39 +0,0 @@
1
-
2
- # Natlinkcore
3
-
4
- ## More Information
5
- Please refer to the README file in the project repository [https://github.com/dictation-toolbox/natlink](https://github.com/dictation-toolbox/natlink) for more information about natlink.
6
-
7
- ## Installing from PyPi
8
- You can install from [The Python Package Index (PyPI)](https://pypi.org/) with
9
-
10
- `py -m pip install natlinkcore`
11
-
12
- Note that natlinkcore will not install if you have not installed Natlink first. Natlink is installed through running an installer.
13
-
14
-
15
- ## Test Framework
16
- Tests use the [pytest](https://docs.pytest.org/) framework.
17
- For developers, if you are developing on the project, please add tests for any new features or bug
18
- fixes.
19
-
20
- Mandy Python IDEs such as [Visual Studio Code](https://code.visualstudio.com/) have build in support for test frameworks and make it easy to run and debug pytest. see [Visual Studio Code for testing](https://code.visualstudio.com/docs/python/testing).
21
-
22
-
23
- ## Building the Python Package Locally
24
-
25
- `py -m build` to build the Python package locally.
26
-
27
- Publishing to PyPi is done through the [trusted publisher mechanism](https://docs.pypi.org/trusted-publishers/using-a-publisher/) when a release is created on github using github actions.
28
-
29
-
30
- ## Publishing checklist
31
- Before you bump the version number in __init__.py and publish:
32
- - Check the pyroject.toml file for package dependancies. Do you need a specfic or newer version of
33
- a dependancy such as dtactions? Then add or update the version # requirement in dtactions.
34
-
35
- ## Debugging Instructions
36
-
37
- Read the detailed developer instructions for setting up the debugger. You can look in this projects tree until
38
- documentation/developers.rst.
39
-