nvaccess / nvda

NVDA, the free and open source Screen Reader for Microsoft Windows
https://www.nvaccess.org/
Other
2.12k stars 638 forks source link

Make Python console opening more robust #17392

Closed CyrilleB79 closed 1 week ago

CyrilleB79 commented 1 week ago

Link to issue number:

Closes #17391

Summary of the issue:

When opening Python console with NVDA+control+Z, NVDA initialize snapshot variables. If an error occurs during the initialization of these variables, the console cannot open.

Description of user facing changes

The Python console will not fail to open anymore in case an error occurs while retrieving snapshot variables. If an exception occurs while retrieving a snapshot variable, this variable is set to None.

Note: I have imagined to display an error dialog if one or more variable cannot be retrieved successfully, but:

Description of development approach

For each snapshot variable, catch any exception that can occur during its retrieval and initialize the variable to None if retrieval has failed. Also log the corresponding error.

Note: I have added one more #noqa E402. I am tempted to remove all of them but have not done so because I do not know why they have been added in the first place.

Testing strategy:

Manual test: Steps of #17391.

Known issues with pull request:

None

Code Review Checklist:

@coderabbitai summary

AppVeyorBot commented 1 week ago

See test results for failed build of commit b8192d5a63

CyrilleB79 commented 1 week ago

@seanbudd thanks for your review. I'll remove alll other lambda function following your example where not necessary.

In addition, I'd like to know your opinion on:

AppVeyorBot commented 1 week ago

See test results for failed build of commit 4967d080ed

CyrilleB79 commented 1 week ago

@seanbudd, finally, I have removed the noqa's for imports; maybe they appeared during Ruff's introduction.

Just let me know for the message box in case of error.