Skip to content
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

Road to removing qtassistant (documentation) --> C Changes required for Python HelpWindow implementation #38903

Merged
merged 13 commits into from
Mar 5, 2025

Conversation

darshdinger
Copy link
Collaborator

@darshdinger darshdinger commented Feb 20, 2025

Description of work

This work is related to issue #37248. This PR contains the majority of the C based changes that are required to help support the new Python based implementation of the HelpWindow within Mantid Workbench. The main objective is to transition away from the older qtassistant -based implementation.

Summary of work

  • Removed Support for qtassistant in Documentation:

    • The DOCS_QTHELP option is now used to toggle the inclusion of the qtassistant-based help system. If DOCS_QTHELP is set to OFF, the Python-based HelpWindow will be included instead.
  • Introduced a Python Bridge:

    • Added PythonHelpBridge to handle interactions between the C++ layer and the Python HelpWindow implementation. This bridge initializes the Python interpreter and invokes the relevant Python methods for showing help pages.
  • Added a New HelpWindow Implementation:

    • Created PythonHelpWindow, a subclass of MantidHelpInterface, which redirects help requests to the Python layer via PythonHelpBridge. The new HelpWindow supports:
      • Displaying help pages (showPage).
      • Showing algorithm documentation.
      • Navigating to concepts, fit functions, and custom interface documentation.
  • CMake Updates:

    • Modified CMakeLists.txt in multiple directories to conditionally include the Python HelpWindow (PythonHelpBridge and PythonHelpWindow) when ENABLE_QTASSISTANT is OFF.
  • Code Registration:

    • Registered the new PythonHelpWindow implementation in the InterfaceManager using the REGISTER_HELPWINDOW macro.

Ref #37248

To test:

In order to test, please take the following steps:
Starting within mantid/ -

  1. cmake --preset=linux
  2. cd build
  3. cmake . -DENABLE_QTASSISTANT=OFF
  4. ninja all docs-html
  5. MANTID_LOCAL_DOCS_BASE="./build/docs/html" bin/launch_mantidworkbench.sh
  6. export PYTHONPATH="./qt/mantidqt/mantidqt/widgets/helpwindow:$PYTHONPATH"

Once mantid is launched, please use the F1 key to launch help window for testing purposes. Please also try checking algorithm help from within the AlgorithmDialog.


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

  • Is the code of an acceptable quality?
  • Does the code conform to the coding standards?
  • Are the unit tests small and test the class in isolation?
  • If there is GUI work does it follow the GUI standards?
  • If there are changes in the release notes then do they describe the changes appropriately?
  • Do the release notes conform to the release notes guide?

Functional Tests

  • Do changes function as described? Add comments below that describe the tests performed?
  • Do the changes handle unexpected situations, e.g. bad input?
  • Has the relevant (user and developer) documentation been added/updated?

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.

@sf1919 sf1919 added this to the Release 6.13 milestone Feb 20, 2025
@darshdinger darshdinger changed the title 37248 phw c portion python help window implementation Road to removing qtassistant (documentation) --> C Changes required for Python HelpWindow implementation Feb 21, 2025
@darshdinger darshdinger force-pushed the 37248-PHW-c-portion-python-help-window-implementation branch from 2b3126a to 598a835 Compare February 21, 2025 14:39
Copy link
Member

@peterfpeterson peterfpeterson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebuilding after cmake . -DDOCS_QTHELP=off and running workbench gives me the following message when I try to start the qwebengine-based helpwindow

InterfaceManager-[Information] Offline help is not available in this version of Workbench.

turning qtassistant back on goes back to the old behavior of opening a web browser for the online help.

I was still able to directly run the bridge from my build directory using

python ~/code/mantid/qt/python/mantidqt/mantidqt/widgets/helpwindow/helpwindowbridge.py

Q: Should this be using ConfigService for information about the docs build location? docs.html.root is the key in ConfigService.

@peterfpeterson
Copy link
Member

Adding some tests for PythonHelpWindow would be appreciated

@darshdinger darshdinger force-pushed the 37248-PHW-c-portion-python-help-window-implementation branch 2 times, most recently from d64b076 to 710114e Compare February 26, 2025 18:37
Copy link
Member

@peterfpeterson peterfpeterson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bad news. Closing mantid after the help window has been opened causes SIGSEV

FrameworkManager-[Notice] Welcome to Mantid 6.11.0.dev617
FrameworkManager-[Notice] Please cite: http://dx.doi.org/10.1016/j.nima.2014.07.029 and this release: http://dx.doi.org/10.5286/Software/Mantid
Help window closed.
Cleaning up Help Window resources.
Received signal: SIGSEGV
Segmentation fault

The shutdown needs to be investigated

@darshdinger
Copy link
Collaborator Author

darshdinger commented Feb 26, 2025

Uh oh... let me see if I can figure out why this is happening.

@darshdinger darshdinger force-pushed the 37248-PHW-c-portion-python-help-window-implementation branch from 8ab1a7a to 669dda2 Compare March 4, 2025 14:06
Copy link
Member

@peterfpeterson peterfpeterson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as expected and closes cleanly

@KedoKudo KedoKudo merged commit 41f49bc into main Mar 5, 2025
10 checks passed
@KedoKudo KedoKudo deleted the 37248-PHW-c-portion-python-help-window-implementation branch March 5, 2025 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants