-
-
Notifications
You must be signed in to change notification settings - Fork 634
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
Move some classes from the main gui module. #12105
Conversation
cc @feerrenrut |
I've merged the latest master and fixed merge conflicts. |
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.
Thanks for this @lukaszgo1, left some minor feedback but otherwise looks good to me
from gui.startupDialogs import WelcomeDialog | ||
WelcomeDialog.run() |
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.
from gui.startupDialogs import WelcomeDialog | |
WelcomeDialog.run() | |
gui.startupDialogs.WelcomeDialog.run() |
I think we are trying to avoid these imports that aren't at the top of file, or the most outer scope when this isn't possible. Since gui
has already been imported at the top of doStartupDialogs
, if you want to import WelcomeDialog
directly, it would be preferable to add the from gui.startupDialogs import WelcomeDialog
statement to the top of doStartupDialogs
.
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.
It is a matter of style obviously, however since WelcomeDialog
is used only for users who haven't disabled it so a very small percentage isn't it wasteful to always import it rather than do it conditionally as it is done now?
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.
yes, definitely a matter of preference. From a discussion with another developer these are fine as is. However in this case wouldn't there be no performance changes because the entire gui
module has already been imported in the same scope?
Link to issue number:
Related to #11950 , #11951 and #11958
Summary of the issue:
Code layout in the gui module is sup optimal. This can easily cause cyclic imports for one such example see #11950
While the issue mentioned above has been resolved it makes sense to reorganize this part of the code to minimize likelihood of similar problems in the future.
Description of how this pull request fixes the issue:
LauncherDialog
,WelcomeDialog
andAskAllowUsageStatsDialog
were moved to thegui.startupDialogs
modulegetDocFilePath
has been moved into the newdocumentationUtils
module as there is no logical connection between it and guiTesting strategy:
Manual testing:
Known issues with pull request:
There are more places in the gui package which might benefit from the code reorganization.
Change log entry:
Section: Changes for developers:
WelcomeDialog
,LauncherDialog
andAskAllowUsageStatsDialog
are moved to thegui.startupDialogs
getDocFilePath
has been moved fromgui
to thedocumentationUtils
module.Code Review Checklist:
This checklist is a reminder of things commonly forgotten in a new PR.
Authors, please do a self-review and confirm you have considered the following items.
Mark items you have considered by checking them.
You can do this when editing the Pull request description with an x:
[ ]
becomes[x]
.You can also check the checkboxes after the PR is created.