Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor wxWidgets app creation from core.main #16081

Merged
merged 1 commit into from
Jan 29, 2024
Merged

Conversation

seanbudd
Copy link
Member

Cleanup of 64e6413

@seanbudd seanbudd requested a review from a team as a code owner January 23, 2024 00:00
@seanbudd seanbudd requested review from michaelDCurran and gerald-hartig and removed request for michaelDCurran January 23, 2024 00:00
@@ -9,6 +9,7 @@

from dataclasses import dataclass
from typing import (
TYPE_CHECKING,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love this. TIL about TYPE_CHECKING variable.


import wx
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that you're importing wx in 3 different places, including in the main execution flow, can we just put the single import up at the top of the core.py file? If there's no way to avoid loading it (which it looks like from def main()), we can simplify the imports and remove the TYPE_CHECKING logic.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we are intentionally avoiding the wx import until further down. Dependency importing is incredibly order specific in nvda.pyw and core.py

@@ -527,6 +531,66 @@ def _doLoseFocus():
log.exception("Lose focus error")


def _setUpWxApp() -> "wx.App":
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like the refactor of this out of main(). Much better.

@seanbudd seanbudd merged commit 9586ed0 into master Jan 29, 2024
3 checks passed
@seanbudd seanbudd deleted the fix-ghsa-h7pp-refactor branch January 29, 2024 00:26
@nvaccessAuto nvaccessAuto added this to the 2024.2 milestone Jan 29, 2024
Nael-Sayegh pushed a commit to Nael-Sayegh/nvda that referenced this pull request Feb 15, 2024
SaschaCowley pushed a commit to SaschaCowley/nvda that referenced this pull request Feb 27, 2024
Adriani90 pushed a commit to Adriani90/nvda that referenced this pull request Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants