-
Notifications
You must be signed in to change notification settings - Fork 129
Python Help Window Feature Addition - Use ConfigService for Docs Path #39201
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
Conversation
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.
Tested as described and verified docs were obtained through ConfigService.
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 have some questions on how the behavior works on getting the local path set when there is or isn't an exception. I think it needs some comments or a little bit better of organization to clarify what is going on.
As is, it looks like it is "always" online, but it sets the base URL to be the offline version.
qt/python/mantidqt/mantidqt/widgets/helpwindow/helpwindowmodel.py
Outdated
Show resolved
Hide resolved
051d27a
to
d804d2d
Compare
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.
One more changes for rhobustness:
- Build the offline docs
- remove
docs/html/index.html
- start the main help page
It would be helpful to add a warning/error message that the HTML file is not found.
Otherwise the code looks good.
Description of work
Summary of work
Modified the Python Help Window (
HelpWindowModel
) to retrieve the local HTML documentation path from Mantid'sConfigService
using the existingdocs.html.root
property. This removes the need to explicitly pass this path as a parameter when creating the help window components.This change utilizes the existing
docs.html.root
configuration property within Mantid'sConfigService
, centralizing the definition of the local help documentation path and simplifying the Help Window's interface and instantiation. It makes the Help Window consistent with how other parts of Mantid locate configured resources.Issues #37248
Here is the EWM link: EWM 10007
Further detail of work
localDocs
/localDocsBase
parameter fromHelpWindowModel.__init__
,HelpWindowPresenter.__init__
, and theshow_help_page
function inhelpwindowbridge.py
.--local-docs
command-line argument andMANTID_LOCAL_DOCS_BASE
environment variable handling fromhelpwindowbridge.py
.HelpWindowModel.__init__
,mantid.kernel.ConfigService
is now imported at the top level and used to retrieve the path:try...except
) around theConfigService
import and calls ensures robustness in environments whereConfigService
might not be fully initialized or the property is absent/empty.docs.html.root
, the model configures itself for "Offline Docs" mode using that path. Otherwise, it defaults gracefully to "Online Docs" mode.test_helpwindowmodel.py
significantly to reflect the removal of thelocalDocsBase
parameter and to useunittest.mock.patch
to simulate various return values fromConfigService.Instance().getString("docs.html.root", True)
. This allows testing of different scenarios (valid path, invalid path, no path found) without requiring a liveConfigService
.To test:
In order to test this, you need to first build mantid workbench with the python help window enabled. Follow these steps in order to achieve this:
cmake . -DCMAKE_BUILD_TYPE=Debug -DENABLE_QTASSISTANT=OFF
ninja all docs-html
./bin/lauch_mantidworkbench.sh
Following this use the command
./bin/launch_mantidworkbench.sh
to launch the workbench.Within the workbench window navigate to the Algorithm Manager window and select any algo:

Double left click to open the algo menu:

Press the "?" button and to launch the python help window and notice within the debug logs that ConfigService is being employed to retrieve the local docs location:
Reviewer
Please comment on the points listed below (full description).
Your comments will be used as part of the gatekeeper process, so please comment clearly on what you have checked during your review. If changes are made to the PR during the review process then your final comment will be the most important for gatekeepers. In this comment you should make it clear why any earlier review is still valid, or confirm that all requested changes have been addressed.
Code Review
Functional Tests
Does everything look good? Mark the review as Approve. A member of
@mantidproject/gatekeepers
will take care of it.Gatekeeper
If you need to request changes to a PR then please add a comment and set the review status to "Request changes". This will stop the PR from showing up in the list for other gatekeepers.