Decouple contextHelp from the GUI module to avoid circular imports when installing add--ons#11951
Decouple contextHelp from the GUI module to avoid circular imports when installing add--ons#11951lukaszgo1 wants to merge 6 commits into
Conversation
|
I've no idea why AppVeyor fails to report status for this one - when looking at it on AppVeyor's website build is successful. |
See test results for failed build of commit b0b47f77bb |
feerrenrut
left a comment
There was a problem hiding this comment.
I think it would be good to move the classes out of gui/__init__ however, is it necessary for this PR? It looks like the import cycle is broken by moving getDocFilePath out of gui, and dynamically importing it in contextHelp (no longer importing gui)
Moving the classes (and not importing them back to expose them as gui.X) is technically an API break. This isn't a problem for getDocFilePath because it is imported back into Gui. That said, it probably isn't necessary to move that either?
| import os | ||
| import sys | ||
| import threading | ||
| import codecs |
There was a problem hiding this comment.
This may be unused here, but it is possible some add-on may depend on it. It should be marked as 'noqa' with the appropriate code to disable error from flake 8 for unused includes. A comment should also be added that this is deprecated and will be removed in 2021.1
|
@feerrenrut wrote:
It unfortunately is since
I don't think any add-on should modify these classes. If you're really worried about This I can define a module level |
|
I have created an alternative approach which I think resolves the issue. Would you please take a look? #11958 |
|
Since #11958 has been merged I will close this. As I said before, I'd be happy for the various |
This is opened against beta, since this PR fixes regression introduced during 2020.4 dev cycle
Link to issue number:
Fixes #11950
Summary of the issue:
When installing add-ons which imported gui in their InstallTasks module NVDA failed to restart properly. This was caused by the fact that when gui was imported it also imported contextHelp.ContextHelpMixin and contextHelp in turn also imports gui causing circular import.
Description of how this pull request fixes the issue:
I've decoupled gui from the ContextHelp. Specific changes:
documentationUtilsmodule - to preserve backwards compatibility it is imported into the main gui module.Testing performed:
Known issues with pull request:
Since this is a large change it would be great to merge it into beta as soon as possible to give it plenty of testing.
Change log entry:
None needed - this regression is not in a release yet.