You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: devDocs/developerGuide.t2t
+26-1Lines changed: 26 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -195,8 +195,9 @@ The following few sections will talk separately about App Modules and Global Plu
195
195
After this point, discussion is again more general.
196
196
197
197
++ Basics of an App Module ++
198
-
App Module files have a .py extension, and are named the same as either the main executable of the application for which you wish them to be used or the package inside a host executable.
198
+
App Module files have a .py extension, and in most cases should be named the same as either the main executable of the application for which you wish them to be used or the package inside a host executable.
199
199
For example, an App Module for notepad would be called notepad.py, as notepad's main executable is called notepad.exe.
200
+
If you want to use a single App Module for multiple executables, or the name of the executable conflicts with the standard Python import rules read [Associating App Modules with an executable #AssociatingAppModule].
200
201
For apps hosted inside host executables, see the section on app modules for hosted apps.
201
202
202
203
App Module files must be placed in the appModules subdirectory of an add-on, or of the scratchpad directory of the NVDA user configuration directory.
@@ -208,6 +209,30 @@ This will all be covered in depth later.
208
209
NVDA loads an App Module for an application as soon as it notices the application is running.
209
210
The App Module is unloaded once the application is closed or when NVDA is exiting.
210
211
212
+
++ Associating App Modules with an executable ++[AssociatingAppModule]
213
+
As explained above, sometimes the default way of associating an App Module with an application is not flexible enough. Examples include:
214
+
- You want to use a single App Module for various binaries (perhaps both stable and preview versions of the application should have the same accessibility enhancements)
215
+
- The executable file is named in a way which conflicts with the Python naming rules. I.e. for an application named "time", naming the App Module "time.py" would conflict with the built-in module from the standard library
216
+
-
217
+
218
+
In such cases you can distribute a small global plugin along with your App Module which maps it to the executable.
219
+
For example to map the App Module named "time_app_mod" to the "time" executable the plugin may be written as follows:
220
+
```
221
+
import appModuleHandler
222
+
import globalPluginHandler
223
+
224
+
225
+
class GlobalPlugin(globalPluginHandler.GlobalPlugin):
Copy file name to clipboardExpand all lines: devDocs/technicalDesignOverview.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -181,6 +181,8 @@ An app module provides support specific to an application for these cases.
181
181
An app module is derived from the `appModuleHandler.AppModule` base class.
182
182
App modules receive events for all [NVDA objects](#nvda-objects) in the application and can bind scripts which can be executed anywhere in that application.
183
183
They can also implement their own NVDA objects for use within the application.
184
+
Usually the App Module should be named the same as the executable for which it should be loaded.
185
+
In cases where this is problematic (one App Module should support multiple applications, the binary is named in a way which conflicts with the Python import system) you can add an entry to the `appModules.EXECUTABLE_NAMES_TO_APP_MODS` where the binary name is the key and the name of the App Module is the value.
184
186
185
187
#### Global Plugins
186
188
Aside from application specific customisation using [app modules](#app-modules), it is also possible to extend NVDA on a global level.
0 commit comments