Commit ac091a0e authored by Savici, Andrei T's avatar Savici, Andrei T Committed by Peterson, Peter
Browse files

Port all interfaces to new convention

parent c7539143
...@@ -84,7 +84,7 @@ def __get_collection_file(collection_file: str) -> str: ...@@ -84,7 +84,7 @@ def __get_collection_file(collection_file: str) -> str:
return os.path.abspath(collection_file) return os.path.abspath(collection_file)
def show_interface_help(mantidplot_name, assistant_process, section: str='', def show_interface_help(mantidplot_name, assistant_process, area: str='',
collection_file: str='', collection_file: str='',
qt_url: str='', external_url: str=""): qt_url: str='', external_url: str=""):
''' Shows the help page for a custom interface ''' Shows the help page for a custom interface
...@@ -117,7 +117,7 @@ def show_interface_help(mantidplot_name, assistant_process, section: str='', ...@@ -117,7 +117,7 @@ def show_interface_help(mantidplot_name, assistant_process, section: str='',
try: try:
# try using built-in help in mantid # try using built-in help in mantid
import mantidqt import mantidqt
mantidqt.interfacemanager.InterfaceManager().showCustomInterfaceHelp(mantidplot_name, section) mantidqt.interfacemanager.InterfaceManager().showCustomInterfaceHelp(mantidplot_name, area)
except: #(ImportError, ModuleNotFoundError) raises the wrong type of error except: #(ImportError, ModuleNotFoundError) raises the wrong type of error
# built-in help failed, try external qtassistant then give up and launch a browser # built-in help failed, try external qtassistant then give up and launch a browser
......
...@@ -22,7 +22,7 @@ ALFCustomInstrumentView::ALFCustomInstrumentView(const std::string &instrument, ...@@ -22,7 +22,7 @@ ALFCustomInstrumentView::ALFCustomInstrumentView(const std::string &instrument,
m_extractSingleTubeObservable(nullptr), m_averageTubeObservable(nullptr), m_extractSingleTubeObservable(nullptr), m_averageTubeObservable(nullptr),
m_extractAction(nullptr), m_averageAction(nullptr), m_extractAction(nullptr), m_averageAction(nullptr),
m_analysisPane(nullptr) { m_analysisPane(nullptr) {
m_helpPage = "ALF View"; m_helpPage = "direct/ALF View";
} }
void ALFCustomInstrumentView::setUpInstrument( void ALFCustomInstrumentView::setUpInstrument(
...@@ -97,4 +97,4 @@ void ALFCustomInstrumentView::addSpectrum(const std::string &wsName) { ...@@ -97,4 +97,4 @@ void ALFCustomInstrumentView::addSpectrum(const std::string &wsName) {
} }
} // namespace CustomInterfaces } // namespace CustomInterfaces
} // namespace MantidQt } // namespace MantidQt
\ No newline at end of file
...@@ -1101,7 +1101,7 @@ void EnggDiffractionViewQtGUI::closeEvent(QCloseEvent *event) { ...@@ -1101,7 +1101,7 @@ void EnggDiffractionViewQtGUI::closeEvent(QCloseEvent *event) {
void EnggDiffractionViewQtGUI::openHelpWin() { void EnggDiffractionViewQtGUI::openHelpWin() {
MantidQt::API::HelpWindow::showCustomInterface( MantidQt::API::HelpWindow::showCustomInterface(
nullptr, QString("Engineering Diffraction")); nullptr, QString("Engineering Diffraction"), QString("diffraction"));
} }
void EnggDiffractionViewQtGUI::updateTabsInstrument( void EnggDiffractionViewQtGUI::updateTabsInstrument(
......
...@@ -507,7 +507,7 @@ void MantidEV::setDefaultState_slot() { ...@@ -507,7 +507,7 @@ void MantidEV::setDefaultState_slot() {
*/ */
void MantidEV::help_slot() { void MantidEV::help_slot() {
MantidQt::API::HelpWindow::showCustomInterface( MantidQt::API::HelpWindow::showCustomInterface(
nullptr, QString("SCD Event Data Reduction")); nullptr, QString("SCD Event Data Reduction"), QString("diffraction"));
} }
/** /**
......
...@@ -55,7 +55,7 @@ void SampleTransmission::initLayout() { ...@@ -55,7 +55,7 @@ void SampleTransmission::initLayout() {
*/ */
void SampleTransmission::showHelp() { void SampleTransmission::showHelp() {
MantidQt::API::HelpWindow::showCustomInterface( MantidQt::API::HelpWindow::showCustomInterface(
nullptr, QString("Sample Transmission Calculator")); nullptr, QString("Sample Transmission Calculator"), QString("general"));
} }
/** /**
......
...@@ -306,8 +306,7 @@ void MainWindowPresenter::initNewBatch(IBatchPresenter *batchPresenter, ...@@ -306,8 +306,7 @@ void MainWindowPresenter::initNewBatch(IBatchPresenter *batchPresenter,
} }
void MainWindowPresenter::showHelp() { void MainWindowPresenter::showHelp() {
MantidQt::API::HelpWindow::showCustomInterface(nullptr, MantidQt::API::HelpWindow::showCustomInterface(nullptr,std::string("ISIS Reflectometry"), std::string("reflectometry"));
QString("ISIS Reflectometry"));
} }
void MainWindowPresenter::notifySaveBatchRequested(int tabIndex) { void MainWindowPresenter::notifySaveBatchRequested(int tabIndex) {
......
...@@ -25,7 +25,7 @@ IndirectInterface::IndirectInterface(QWidget *parent) ...@@ -25,7 +25,7 @@ IndirectInterface::IndirectInterface(QWidget *parent)
void IndirectInterface::help() { void IndirectInterface::help() {
HelpWindow::showCustomInterface(nullptr, HelpWindow::showCustomInterface(nullptr,
QString::fromStdString(documentationPage())); QString::fromStdString(documentationPage()),QString("indirect"));
} }
void IndirectInterface::settings() { void IndirectInterface::settings() {
......
...@@ -32,7 +32,7 @@ void IndirectSettingsView::emitCancelClicked() { emit cancelClicked(); } ...@@ -32,7 +32,7 @@ void IndirectSettingsView::emitCancelClicked() { emit cancelClicked(); }
void IndirectSettingsView::openHelp() { void IndirectSettingsView::openHelp() {
MantidQt::API::HelpWindow::showCustomInterface(nullptr, MantidQt::API::HelpWindow::showCustomInterface(nullptr,
QString("Indirect Settings")); QString("Indirect Settings"), QString("indirect"));
} }
void IndirectSettingsView::setSelectedFacility(QString const &text) { void IndirectSettingsView::setSelectedFacility(QString const &text) {
......
...@@ -226,7 +226,7 @@ void ALCBaselineModellingView::setSelectorValues( ...@@ -226,7 +226,7 @@ void ALCBaselineModellingView::setSelectorValues(
} }
void ALCBaselineModellingView::help() { void ALCBaselineModellingView::help() {
MantidQt::API::HelpWindow::showCustomInterface(nullptr, QString("Muon ALC")); MantidQt::API::HelpWindow::showCustomInterface(nullptr, QString("Muon ALC"), QString("muon"));
} }
void ALCBaselineModellingView::emitFitRequested() { emit fitRequested(); } void ALCBaselineModellingView::emitFitRequested() { emit fitRequested(); }
......
...@@ -316,7 +316,7 @@ void ALCDataLoadingView::setTimeRange(double tMin, double tMax) { ...@@ -316,7 +316,7 @@ void ALCDataLoadingView::setTimeRange(double tMin, double tMax) {
} }
void ALCDataLoadingView::help() { void ALCDataLoadingView::help() {
MantidQt::API::HelpWindow::showCustomInterface(nullptr, QString("Muon ALC")); MantidQt::API::HelpWindow::showCustomInterface(nullptr, QString("Muon ALC"), QString("muon"));
} }
void ALCDataLoadingView::disableAll() { void ALCDataLoadingView::disableAll() {
......
...@@ -124,7 +124,7 @@ void ALCPeakFittingView::setPeakPicker(const IPeakFunction_const_sptr &peak) { ...@@ -124,7 +124,7 @@ void ALCPeakFittingView::setPeakPicker(const IPeakFunction_const_sptr &peak) {
} }
void ALCPeakFittingView::help() { void ALCPeakFittingView::help() {
MantidQt::API::HelpWindow::showCustomInterface(nullptr, QString("Muon ALC")); MantidQt::API::HelpWindow::showCustomInterface(nullptr, QString("Muon ALC"), QString("muon"));
} }
void ALCPeakFittingView::displayError(const QString &message) { void ALCPeakFittingView::displayError(const QString &message) {
......
...@@ -386,7 +386,7 @@ void MuonAnalysis::setChosenGroupAndPeriods(const QString &wsName) { ...@@ -386,7 +386,7 @@ void MuonAnalysis::setChosenGroupAndPeriods(const QString &wsName) {
*/ */
void MuonAnalysis::muonAnalysisHelpClicked() { void MuonAnalysis::muonAnalysisHelpClicked() {
MantidQt::API::HelpWindow::showCustomInterface(nullptr, MantidQt::API::HelpWindow::showCustomInterface(nullptr,
QString("Muon Analysis")); QString("Muon Analysis"), QString("muon"));
} }
/** /**
...@@ -394,7 +394,7 @@ void MuonAnalysis::muonAnalysisHelpClicked() { ...@@ -394,7 +394,7 @@ void MuonAnalysis::muonAnalysisHelpClicked() {
*/ */
void MuonAnalysis::muonAnalysisHelpGroupingClicked() { void MuonAnalysis::muonAnalysisHelpGroupingClicked() {
MantidQt::API::HelpWindow::showCustomInterface( MantidQt::API::HelpWindow::showCustomInterface(
nullptr, QString("Muon Analysis"), QString(""), nullptr, QString("Muon Analysis"), QString("muon"),
QString("grouping-options")); QString("grouping-options"));
} }
......
...@@ -37,7 +37,7 @@ void MuonAnalysisFitDataTab::init() { ...@@ -37,7 +37,7 @@ void MuonAnalysisFitDataTab::init() {
*/ */
void MuonAnalysisFitDataTab::muonAnalysisHelpDataAnalysisClicked() { void MuonAnalysisFitDataTab::muonAnalysisHelpDataAnalysisClicked() {
MantidQt::API::HelpWindow::showCustomInterface( MantidQt::API::HelpWindow::showCustomInterface(
nullptr, QString("Muon Analysis"), QString("data-analysis")); nullptr, QString("Muon Analysis"), QString("muon"), QString("data-analysis"));
} }
/** /**
......
...@@ -131,7 +131,7 @@ void HelpWindow::showCustomInterface(QWidget *parent, const QString &name, ...@@ -131,7 +131,7 @@ void HelpWindow::showCustomInterface(QWidget *parent, const QString &name,
MantidHelpInterface *gui = interfaceManager.createHelpWindow(); MantidHelpInterface *gui = interfaceManager.createHelpWindow();
if (gui) { if (gui) {
connectParent(gui, parent); connectParent(gui, parent);
gui->showCustomInterface(name, section); gui->showCustomInterface(name, area, section);
} else { } else {
// Open online help // Open online help
QString baseUrl = "https://docs.mantidproject.org/interfaces/"; QString baseUrl = "https://docs.mantidproject.org/interfaces/";
......
...@@ -245,7 +245,7 @@ QListWidget *ManageUserDirectories::listWidget(QObject *sender) { ...@@ -245,7 +245,7 @@ QListWidget *ManageUserDirectories::listWidget(QObject *sender) {
/// Show the help for ManageUserDirectories /// Show the help for ManageUserDirectories
void ManageUserDirectories::helpClicked() { void ManageUserDirectories::helpClicked() {
HelpWindow::showCustomInterface(nullptr, HELP_ID); HelpWindow::showCustomInterface(nullptr, HELP_ID, "framework");
} }
/// Close the dialog without saving the configuration /// Close the dialog without saving the configuration
......
...@@ -154,7 +154,7 @@ class DGSPlannerGUI(QtWidgets.QWidget): ...@@ -154,7 +154,7 @@ class DGSPlannerGUI(QtWidgets.QWidget):
self.masterDict.update(copy.deepcopy(d)) self.masterDict.update(copy.deepcopy(d))
def help(self): def help(self):
show_interface_help(self.mantidplot_name, self.assistant_process, section='direct') show_interface_help(self.mantidplot_name, self.assistant_process, area='direct')
def closeEvent(self, event): def closeEvent(self, event):
self.assistant_process.close() self.assistant_process.close()
......
...@@ -142,7 +142,7 @@ class EngineeringDiffractionGui(QtWidgets.QMainWindow, Ui_main_window): ...@@ -142,7 +142,7 @@ class EngineeringDiffractionGui(QtWidgets.QMainWindow, Ui_main_window):
self.comboBox_instrument.currentIndexChanged.connect(slot) self.comboBox_instrument.currentIndexChanged.connect(slot)
def open_help_window(self): def open_help_window(self):
InterfaceManager().showCustomInterfaceHelp(self.doc) InterfaceManager().showCustomInterfaceHelp(self.doc,'diffraction')
def open_settings(self): def open_settings(self):
self.settings_presenter.show() self.settings_presenter.show()
......
...@@ -1070,7 +1070,7 @@ class MainWindow(QMainWindow): ...@@ -1070,7 +1070,7 @@ class MainWindow(QMainWindow):
def helpClicked(self): def helpClicked(self):
try: try:
import mantidqt import mantidqt
mantidqt.interfacemanager.InterfaceManager().showCustomInterfaceHelp("Filter Events") mantidqt.interfacemanager.InterfaceManager().showCustomInterfaceHelp("Filter Events","utility")
except ImportError: except ImportError:
url = ("http://docs.mantidproject.org/nightly/interfaces/{}.html" url = ("http://docs.mantidproject.org/nightly/interfaces/{}.html"
"".format("Filter Events")) "".format("Filter Events"))
......
...@@ -140,6 +140,9 @@ class DrillView(QMainWindow): ...@@ -140,6 +140,9 @@ class DrillView(QMainWindow):
super(DrillView, self).__init__(None, Qt.Window) super(DrillView, self).__init__(None, Qt.Window)
self.here = os.path.dirname(os.path.realpath(__file__)) self.here = os.path.dirname(os.path.realpath(__file__))
# help
self.assistant_process = QProcess(self)
# setup ui # setup ui
uic.loadUi(os.path.join(self.here, 'ui/main.ui'), self) uic.loadUi(os.path.join(self.here, 'ui/main.ui'), self)
self.setup_header() self.setup_header()
...@@ -254,6 +257,8 @@ class DrillView(QMainWindow): ...@@ -254,6 +257,8 @@ class DrillView(QMainWindow):
Args: Args:
event (QCloseEvent): the close event event (QCloseEvent): the close event
""" """
self.assistant_process.close()
self.assistant_process.waitForFinished()
children = self.findChildren(QDialog) children = self.findChildren(QDialog)
for child in children: for child in children:
child.close() child.close()
...@@ -421,8 +426,8 @@ class DrillView(QMainWindow): ...@@ -421,8 +426,8 @@ class DrillView(QMainWindow):
""" """
Popup the help window. Popup the help window.
""" """
InterfaceManager().showHelpPage( from mantidqt.gui_helper import show_interface_help
"qthelp://org.mantidproject/doc/interfaces/DrILL.html") show_interface_help("DrILL",self.assistant_process,area="ILL")
def automatic_filling(self): def automatic_filling(self):
""" """
......
...@@ -98,7 +98,7 @@ class SANSSaveOtherDialog(QtWidgets.QDialog, Ui_SaveOtherDialog): ...@@ -98,7 +98,7 @@ class SANSSaveOtherDialog(QtWidgets.QDialog, Ui_SaveOtherDialog):
def _on_help_button_clicked(self): def _on_help_button_clicked(self):
try: try:
import mantidqt import mantidqt
mantidqt.interfacemanager.InterfaceManager().showCustomInterfaceHelp('sans_save_other') mantidqt.interfacemanager.InterfaceManager().showCustomInterfaceHelp('sans_save_other','isis_sans')
except: except:
pass pass
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment