Mantid
Loading...
Searching...
No Matches
PythonHelpWindow.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2013 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
11#include <QString>
12#include <string>
13
14namespace MantidQt {
15namespace MantidWidgets {
16
17REGISTER_HELPWINDOW(PythonHelpWindow)
18
19PythonHelpWindow::PythonHelpWindow() : MantidQt::API::MantidHelpInterface() {}
20
21void PythonHelpWindow::showPage(const std::string &url) {
22 PythonHelpBridge bridge;
23 bridge.showHelpPage(url.empty() ? "index.html" : url);
24}
25
26void PythonHelpWindow::showPage(const QString &url) {
27 PythonHelpBridge bridge;
28 std::string page = url.isEmpty() ? "index.html" : url.toStdString();
29 bridge.showHelpPage(page);
30}
31
32void PythonHelpWindow::showPage(const QUrl &url) {
33 PythonHelpBridge bridge;
34 std::string page = url.isEmpty() ? "index.html" : url.toString().toStdString();
35 bridge.showHelpPage(page);
36}
37
38void PythonHelpWindow::showAlgorithm(const std::string &name, const int version) {
39 QString page = "algorithms/" + QString::fromStdString(name);
40 if (!name.empty() && version > 0)
41 page += "-v" + QString::number(version) + ".html";
42 else if (!name.empty())
43 page += ".html";
44 else
45 page = "algorithms/index.html";
46 showPage(page);
47}
48
49void PythonHelpWindow::showAlgorithm(const QString &name, const int version) {
50 std::string n = name.toStdString();
51 showAlgorithm(n, version);
52}
53
54void PythonHelpWindow::showConcept(const std::string &name) {
55 QString page = name.empty() ? "concepts/index.html" : "concepts/" + QString::fromStdString(name) + ".html";
56 showPage(page);
57}
58
59void PythonHelpWindow::showConcept(const QString &name) {
60 std::string n = name.toStdString();
62}
63
64void PythonHelpWindow::showFitFunction(const std::string &name) {
65 QString page = name.empty() ? "fitting/fitfunctions/index.html"
66 : "fitting/fitfunctions/" + QString::fromStdString(name) + ".html";
67 showPage(page);
68}
69
71 std::string n = name.toStdString();
73}
74
75void PythonHelpWindow::showCustomInterface(const std::string &name, const std::string &area,
76 const std::string &section) {
77 QString areaPath = area.empty() ? "" : QString::fromStdString(area) + "/";
78 QString page = "interfaces/" + areaPath + (name.empty() ? "index.html" : QString::fromStdString(name) + ".html");
79 if (!section.empty())
80 page += "#" + QString::fromStdString(section);
81 showPage(page);
82}
83
84void PythonHelpWindow::showCustomInterface(const QString &name, const QString &area, const QString &section) {
85 std::string n = name.toStdString();
86 std::string a = area.toStdString();
87 std::string s = section.toStdString();
89}
90
92
93} // namespace MantidWidgets
94} // namespace MantidQt
std::string name
Definition Run.cpp:60
#define REGISTER_HELPWINDOW(TYPE)
Used to register help window.
void showHelpPage(const std::string &relative_url)
void shutdown() override
Perform any clean up on main window shutdown.
void showFitFunction(const std::string &name=std::string()) override
void showCustomInterface(const std::string &name=std::string(), const std::string &area=std::string(), const std::string &section=std::string()) override
void showConcept(const std::string &name) override
void showPage(const std::string &url=std::string()) override
void showAlgorithm(const std::string &name=std::string(), const int version=-1) override
The AlgorithmProgressDialogPresenter keeps track of the running algorithms and displays a progress ba...