-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The help button in the operations window now links to the new user docs. THe new docs have a link to the API docs if needed.
- Loading branch information
1 parent
a50e52e
commit effe368
Showing
3 changed files
with
20 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,26 @@ | ||
# Copyright (C) 2021 ISIS Rutherford Appleton Laboratory UKRI | ||
# SPDX - License - Identifier: GPL-3.0-or-later | ||
|
||
from typing import Optional | ||
|
||
from PyQt5.QtCore import QUrl | ||
from PyQt5.QtGui import QDesktopServices | ||
|
||
DOCS_BASE = "https://mantidproject.github.io/mantidimaging" | ||
SECTION_API = f"{DOCS_BASE}/api/" | ||
SECTION_USER_GUIDE = f"{DOCS_BASE}/user_guide/" | ||
|
||
|
||
def open_api_webpage(page_url: str): | ||
open_help_webpage(SECTION_API, page_url) | ||
def open_user_operation_docs(operation_name: str): | ||
page_url = "operations/index" | ||
section = operation_name.lower().replace(" ", "-") | ||
open_help_webpage(SECTION_USER_GUIDE, page_url, section) | ||
|
||
|
||
def open_help_webpage(section_url: str, page_url: str, section: Optional[str] = None): | ||
if section is not None: | ||
url = f"{section_url}{page_url}.html#{section}" | ||
else: | ||
url = f"{section_url}{page_url}.html" | ||
|
||
def open_help_webpage(section_url: str, page_url: str): | ||
url = QUrl(f"{section_url}{page_url}.html") | ||
if not QDesktopServices.openUrl(url): | ||
raise RuntimeError(f"Url could not be opened: {url.toString()}") | ||
if not QDesktopServices.openUrl(QUrl(url)): | ||
raise RuntimeError(f"Url could not be opened: {url}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters