-
-
Notifications
You must be signed in to change notification settings - Fork 651
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
Conversation
@@ -9,6 +9,7 @@ | |||
|
|||
from dataclasses import dataclass | |||
from typing import ( | |||
TYPE_CHECKING, |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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": |
There was a problem hiding this comment.
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.
Cleanup of 64e6413