loader
The loader
is what was natlinkmain
: it loads the various
modules according to the config file natlink.ini.
Moreover, it also handles callbacks from Dragon/Natlink.
- class NatlinkMain(*args, **kwargs)[source]
main class of Natlink, make it a “singleton”
- get_load_on_begin_utterance() Any [source]
this value is most often True or False, taken from the config file
It can also be (set to) a positive int, with which it does the load_on_begin_utterance so many times. After these utterances, the value falls back to False.
With Vocola, there is one utterance delay in the updating of the changed vocola command files.
- get_user_language(DNSuserDirectory)[source]
return the user language (default “enx”) from Dragon inifiles
like “nld” for Dutch, etc.
- getconfigsetting(section: str, option: Optional[Any] = None, filepath: Optional[Any] = None, func: Optional[Any] = None) str [source]
get a setting from possibly an inifile other than natlink.ini
Take a string as input, which is obtained from readwritefile.py, handling different encodings and possible BOM marks.
When no “option” is passed, the contents of the section are returned (a list of options)
func can be configparser.getint or configparser.getboolean if needed, otherwise configparser.get (str) is taken. pass: func=’getboolean’ or func=’getint’.
- property language: str
holds the language of the current profile (default ‘enx’)
- property load_on_begin_utterance: Any
this value is most often True or False, taken from the config file
It can also be (set to) a positive int, with which it does the load_on_begin_utterance so many times. After these utterances, the value falls back to False.
With Vocola, there is one utterance delay in the updating of the changed vocola command files.
- on_change_callback(change_type: str, args: Any) None [source]
on_change_callback, when another user profile is chosen, or when the mic state changes
- property profile: str
holds the directory profile of current user profile
- set_load_on_begin_utterance(value: Any)[source]
set the value for loading at each utterance to True, False or positive int
For Vocola, setting this value to 1 did not work, setting to 2 does, so you need one extra utterance for a new vocola command to come through.
- set_user_language(args: Optional[Any] = None)[source]
can be called from other module to explicitly set the user language to ‘enx’, ‘nld’, etc
- property user: str
holds the name of the current user profile
- config_locations() Iterable[str] [source]
give two possible locations, the wanted and the “fallback” location
wanted: in the ‘.natlink’ subdirectory of home or in “NATLINK_USERDIR”. name is always ‘natlink.ini’
the fallback location is in the installed files, and provides the frame for the config file. with the configurenatlink (natlinkconfigfunction.py or configfurenatlink.pyw) the fallback version of the config file is copied into the wanted location.