14#include <Qsci/qscilexerpython.h>
31 ui.algoSelector->update();
34 ui.editor->setLexer(
new QsciLexerPython);
39 sizes.push_back(1000);
40 ui.splitter->setSizes(sizes);
41 ui.splitter->setStretchFactor(0, 0);
42 ui.splitter->setStretchFactor(1, 0);
45 connect(
ui.algoSelector, SIGNAL(algorithmSelectionChanged(
const QString &,
int)),
this, SLOT(
changeAlgorithm()));
65 settings.beginGroup(
"Mantid/ProcessingAlgoWidget");
66 m_lastFile = settings.value(
"LastFile", QString()).toString();
74 settings.beginGroup(
"Mantid/ProcessingAlgoWidget");
83 QString fileselection = QFileDialog::getSaveFileName(
84 this,
"Save a Python Script", QFileInfo(
m_lastFile).absoluteFilePath(),
"Python scripts (*.py);;All files (*)");
85 if (!fileselection.isEmpty()) {
88 file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
90 file.open(fileselection.toStdString().c_str());
91 file <<
ui.editor->text().toStdString();
93 }
catch (std::ifstream::failure &e) {
94 QMessageBox::critical(
this,
"Exception saving file " +
m_lastFile,
95 QString(
"The file could not be saved due to the following exception:\n") +
105 QString fileselection = QFileDialog::getOpenFileName(
106 this,
"Load a Python Script", QFileInfo(
m_lastFile).absoluteFilePath(),
"Python scripts (*.py);;All files (*)");
107 if (!fileselection.isEmpty()) {
109 std::ifstream file(fileselection.toStdString().c_str());
110 std::stringstream buffer;
111 buffer << file.rdbuf();
112 ui.editor->setText(QString::fromStdString(buffer.str()));
121 auto alg =
ui.algoSelector->getSelectedAlgorithm();
125 }
catch (std::runtime_error &) {
133 QStringList disabled;
134 disabled.push_back(
"OutputWorkspace");
135 disabled.push_back(
"InputWorkspace");
136 disabled.push_back(
"Workspace");
137 ui.algoProperties->addEnabledAndDisableLists(QStringList(), disabled);
139 ui.algoProperties->setAlgorithm(
m_alg);
140 ui.algoProperties->hideOrDisableProperties();
153 ui.algoSelector->setSelectedAlgorithm(algo);
Manage the lifetime of a class intended to be a singleton.
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
std::shared_ptr< Algorithm > Algorithm_sptr
Typedef for a shared pointer to an Algorithm.