nvda
079eaca8 - Add methods to register and unregister custom sections in configuration (#20221)

Commit
6 days ago
Add methods to register and unregister custom sections in configuration (#20221) Fixes #7467 Summary of the issue: Though CONFIG.CONF.BASE_ONLY_SECTIONS is a public constant intended to be extended by add-ons, this is not really posible without using hacks like resetting the configuration, what can produce side effects like slowing down the startup of NVDA, and the inability to save the screen curtain before restarting NVDA. This is an error fixed in placeMarkers add-on, where I tried to extend BASE_ONLY_SECTIONS resetting the configuration. Description of user facing changes: None. Description of developer facing changes: Add-on developers can add sections which Will be applied to the base configuration, or to different profiles, with methods provided in this PR. Description of development approach: In config.conf, public methods to register and unregister sections have been added, as well as a private method to save custom registered sections in a dedicated yaml file. The config module contains a dictionary to host custom sections. Helper private functions at the module level have been added to update the customSections dictionary, the config.spec variable, and to extend config.conf.BASE_ONLY_SECTIONS. Using the customSections dictionary at the module level allows to update the spec, available at the module level, and the config.conf.BASE_ONLY_SECTIONS set when running the initialize function. In this way, custom sections are processed like other available sections when the ConfigManager.init() method is executed.
Author
Parents
Loading