Mantid
Loading...
Searching...
No Matches
PythonHelpBridge.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 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 +
7
9
10#pragma push_macro("slots")
11#undef slots
12#include <Python.h>
13#pragma pop_macro("slots")
14
15#include <boost/python.hpp>
16#include <boost/python/str.hpp>
17#include <stdexcept>
18
19namespace {
20const std::string MOD_NAME("mantidqt.widgets.helpwindow.helpwindowbridge");
21boost::python::object getHelpWindowModule() {
22 boost::python::object mod = boost::python::import(boost::python::str(MOD_NAME));
23 return mod;
24}
25} // namespace
26
27namespace MantidQt {
28namespace MantidWidgets {
29
31
32void PythonHelpBridge::showHelpPage(const std::string &relative_url) {
33 PyGILState_STATE gstate = PyGILState_Ensure();
34 try {
35 auto module = getHelpWindowModule();
36 module.attr("show_help_page")(relative_url);
37 } catch (boost::python::error_already_set &) {
38 PyErr_Print();
39 PyGILState_Release(gstate);
40 throw std::runtime_error("Error calling show_help_page in Python.");
41 }
42 PyGILState_Release(gstate);
43}
44} // namespace MantidWidgets
45} // namespace MantidQt
void showHelpPage(const std::string &relative_url)
The AlgorithmProgressDialogPresenter keeps track of the running algorithms and displays a progress ba...