Skip to content

Fix Help Window path #39826

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions Framework/Kernel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ set(CHECK_FOR_NEW_MANTID_VERSION "${ENABLE_NETWORK_ACCESS}")
set(ENABLE_USAGE_REPORTS "${ENABLE_NETWORK_ACCESS}")
set(DATADIRS "")
set(MANTIDPUBLISHER "https://upload.mantidproject.org/scriptrepository")
set(HTML_ROOT ${CMAKE_INSTALL_PREFIX}/share/doc/html)
set(HTML_ROOT ../share/doc/html)

# For a framework-only (e.g. MPI) build some of these are not relevant and should be left empty to avoid warnings on
# starting Mantid
Expand Down Expand Up @@ -644,17 +644,6 @@ mtd_install_files(
set(TARGET_EXPORT_NAME "MantidKernelTargets")
mtd_install_framework_lib(TARGETS Kernel INSTALL_EXPORT_FILE EXPORT_NAME ${TARGET_EXPORT_NAME})

# For a local build using documentation built in the tree
if(MANTID_FRAMEWORK_LIB STREQUAL "BUILD")
set(HTML_ROOT ${DOCS_BUILDDIR}/html)
else()
if(PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(HTML_ROOT ${CMAKE_INSTALL_PREFIX}/share/doc/html)
else()
set(HTML_ROOT "\\${Mantid_HTML_ROOT}")
endif()
endif()

# location of the properties file
if(NOT DEFINED PROPERTIES_FILE_LOCATION)
set(PROPERTIES_FILE_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/Mantid.properties.config)
Expand Down
Binary file added images/home.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/search.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 23 additions & 5 deletions qt/python/mantidqt/mantidqt/widgets/helpwindow/helpwindowview.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
QFrame,
QShortcut,
QApplication,
QStyle,
)
from qtpy.QtWebEngineWidgets import QWebEngineView, QWebEngineSettings
from qtpy.QtCore import QUrl, Qt, QEvent
from qtpy.QtGui import QIcon, QKeySequence
from pathlib import Path

# Attempt to import QWebEnginePage in a way that works across different Qt bindings/versions
try:
Expand Down Expand Up @@ -110,25 +112,25 @@ def __init__(self, presenter, interceptor=None):
# ---------------------------------

# Back
self.backButton.setIcon(QIcon.fromTheme("go-previous", QIcon(":/qt-project.org/styles/commonstyle/images/left-arrow-32.png")))
self.backButton.setIcon(self.style().standardIcon(QStyle.SP_ArrowBack))
self.backButton.setToolTip("Go Back")
self.backButton.clicked.connect(self.browser.back)
self.toolbar.addWidget(self.backButton)

# Forward
self.forwardButton.setIcon(QIcon.fromTheme("go-next", QIcon(":/qt-project.org/styles/commonstyle/images/right-arrow-32.png")))
self.forwardButton.setIcon(self.style().standardIcon(QStyle.SP_ArrowForward))
self.forwardButton.setToolTip("Go Forward")
self.forwardButton.clicked.connect(self.browser.forward)
self.toolbar.addWidget(self.forwardButton)

# Home
self.homeButton.setIcon(QIcon.fromTheme("go-home", QIcon(":/qt-project.org/styles/commonstyle/images/home-32.png")))
self.homeButton.setIcon(self.get_mantid_icon("home.png"))
self.homeButton.setToolTip("Go to Home Page")
self.homeButton.clicked.connect(self.on_home_clicked)
self.toolbar.addWidget(self.homeButton)

# Reload
self.reloadButton.setIcon(QIcon.fromTheme("view-refresh", QIcon(":/qt-project.org/styles/commonstyle/images/refresh-32.png")))
self.reloadButton.setIcon(self.style().standardIcon(QStyle.SP_BrowserReload))
self.reloadButton.setToolTip("Reload Current Page")
self.reloadButton.clicked.connect(self.browser.reload)
self.toolbar.addWidget(self.reloadButton)
Expand All @@ -139,7 +141,7 @@ def __init__(self, presenter, interceptor=None):

# Find button in toolbar
self.findButton = QPushButton()
self.findButton.setIcon(QIcon.fromTheme("edit-find", QIcon(":/qt-project.org/styles/commonstyle/images/find-32.png")))
self.findButton.setIcon(self.get_mantid_icon("search.png"))
self.findButton.setToolTip("Find in Page (Ctrl+F)")
self.findButton.clicked.connect(self.show_find_toolbar)
self.toolbar.addWidget(self.findButton)
Expand Down Expand Up @@ -168,6 +170,22 @@ def __init__(self, presenter, interceptor=None):

QApplication.instance().installEventFilter(self)

def get_mantid_icon(self, filename):
"""Get icon from mantid/images directory"""
current_file = Path(__file__).resolve()

# Find mantid root directory
for parent in current_file.parents:
if parent.name == "mantid":
images_dir = parent / "images"
icon_path = images_dir / filename

if icon_path.exists():
return QIcon(str(icon_path))
break

return QIcon() # Return empty if not found

def setup_find_toolbar(self, parent_layout):
"""Create and setup the find toolbar widget."""
self.find_frame = QFrame()
Expand Down