Move some classes from the main gui module.#12105
Conversation
|
cc @feerrenrut |
|
I've merged the latest master and fixed merge conflicts. |
seanbudd
left a comment
There was a problem hiding this comment.
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.
| 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.
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.
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,WelcomeDialogandAskAllowUsageStatsDialogwere moved to thegui.startupDialogsmodulegetDocFilePathhas been moved into the newdocumentationUtilsmodule 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,LauncherDialogandAskAllowUsageStatsDialogare moved to thegui.startupDialogsgetDocFilePathhas been moved fromguito thedocumentationUtilsmodule.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.