[skip ci] Don't block GUI thread on add-on updates#17055
Conversation
WalkthroughThe code changes primarily consist of formatting improvements across various files within the NVDA project. These adjustments focus on enhancing readability through consistent spacing, alignment, and comment formatting. The underlying functionality and control flow of the code remain unchanged, ensuring that no new features or significant alterations have been introduced. Changes
Assessment against linked issues
Recent review detailsConfiguration used: .coderabbit.yml Files selected for processing (54)
Files skipped from review due to trivial changes (47)
Additional context usedPath-based instructions (7)
Ruff
Additional comments not posted (87)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add Documentation and Community
|
| if len(self.elementList) == 0: | ||
| ui.message(self.name) | ||
| else: | ||
| if self.activeElement == None: self.activeElement = self.elementList[0] # noqa: E701, E711 | ||
| else: | ||
| if direction=="previous": self.activeElement = self.activeElement.previous # noqa: E701 | ||
| elif direction=="next": self.activeElement = self.activeElement.next # noqa: E701 | ||
| self.activeElement.select() | ||
| if self.activeElement == None: | ||
| self.activeElement = self.elementList[0] # noqa: E701, E711 | ||
| else: | ||
| if direction == "previous": | ||
| self.activeElement = self.activeElement.previous # noqa: E701 | ||
| elif direction == "next": | ||
| self.activeElement = self.activeElement.next # noqa: E701 | ||
| self.activeElement.select() |
There was a problem hiding this comment.
Replace == None with is None.
The method correctly navigates to the next or previous element in the element list. However, replace == None with is None for better readability and to follow best practices.
- if self.activeElement == None:
+ if self.activeElement is None:Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if len(self.elementList) == 0: | |
| ui.message(self.name) | |
| else: | |
| if self.activeElement == None: self.activeElement = self.elementList[0] # noqa: E701, E711 | |
| else: | |
| if direction=="previous": self.activeElement = self.activeElement.previous # noqa: E701 | |
| elif direction=="next": self.activeElement = self.activeElement.next # noqa: E701 | |
| self.activeElement.select() | |
| if self.activeElement == None: | |
| self.activeElement = self.elementList[0] # noqa: E701, E711 | |
| else: | |
| if direction == "previous": | |
| self.activeElement = self.activeElement.previous # noqa: E701 | |
| elif direction == "next": | |
| self.activeElement = self.activeElement.next # noqa: E701 | |
| self.activeElement.select() | |
| if len(self.elementList) == 0: | |
| ui.message(self.name) | |
| else: | |
| if self.activeElement is None: | |
| self.activeElement = self.elementList[0] # noqa: E701, E711 | |
| else: | |
| if direction == "previous": | |
| self.activeElement = self.activeElement.previous # noqa: E701 | |
| elif direction == "next": | |
| self.activeElement = self.activeElement.next # noqa: E701 | |
| self.activeElement.select() |
Tools
Ruff
520-520: Comparison to
Noneshould becond is NoneReplace with
cond is None(E711)
|
It looks like pre-commit-ci is still running here and is messing up the diff. Looking at your initial commit things look good though |
|
Thanks to @seanbudd for the quick fix. |
|
Closing as merged via 6ec1c74 |
Link to issue number:
Fixes #17036
Summary of the issue:
NVDA runs the add-on update check on the GUI thread. If the telemetry to the add-on store is slow, the NVDA GUI is blocked.
Description of user facing changes
NVDA no longer gets stuck if there is a bad connection to the add-on store
Description of development approach
Use a daemonized thread rather than the GUI Thread for add-on store update checks
Testing strategy:
Simulate a poor network connection with poorconn.
From the NVDA python console, trigger the add-on update notification job and set the base URL to the poor connection
Known issues with pull request:
Code Review Checklist:
Summary by CodeRabbit