Add debouncer (#19702)
Inspired by #19686
Summary of the issue:
We regularly run into problems where the GUI being updated frequently causing issues.
We fix this using a ratelimiter/debouncer.
We do not have a generic debouncer in NVDA.
Description of user facing changes:
none
Description of developer facing changes:
Adds a generic debouncer to NVDA
Description of development approach:
This pull request introduces a new debouncing utility for limiting the frequency of function calls, primarily to improve GUI responsiveness and reduce unnecessary processing in NVDA. The main changes include the addition of the debounceLimiter decorator, its integration into the browseMode.py file for filtering elements, and comprehensive unit tests to verify its behavior. The pull request also modernizes type annotations throughout browseMode.py for improved readability and consistency.
Debounce utility and integration:
Added a new debounceLimiter decorator in utils/debounce.py to control the execution rate of functions, supporting both GUI and daemon threads.
Integrated debounceLimiter into the filtering logic of the elements list dialog in browseMode.py, replacing manual timer handling for improved efficiency and code clarity