15#include <Qsci/qscilexerpython.h>
45 ui.algoSelector->update();
48 ui.editor->setLexer(
new QsciLexerPython);
53 sizes.push_back(1000);
54 ui.splitter->setSizes(sizes);
55 ui.splitter->setStretchFactor(0, 0);
56 ui.splitter->setStretchFactor(1, 0);
59 connect(
ui.algoSelector, SIGNAL(algorithmSelectionChanged(
const QString &,
int)),
this, SLOT(
changeAlgorithm()));
65 settings.beginGroup(
"Mantid/ProcessingAlgoWidget");
74 settings.beginGroup(
"Mantid/ProcessingAlgoWidget");
96 QString fileselection = QFileDialog::getSaveFileName(
97 this,
"Save a Python Script", QFileInfo(
m_lastFile).absoluteFilePath(),
"Python scripts (*.py);;All files (*)");
98 if (!fileselection.isEmpty()) {
101 file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
103 file.open(fileselection.toStdString().c_str());
104 file <<
ui.editor->text().toStdString();
106 }
catch (std::ifstream::failure &e) {
107 QMessageBox::critical(
this,
"Exception saving file " +
m_lastFile,
108 QString(
"The file could not be saved due to the following exception:\n") +
118 QString fileselection = QFileDialog::getOpenFileName(
119 this,
"Load a Python Script", QFileInfo(
m_lastFile).absoluteFilePath(),
"Python scripts (*.py);;All files (*)");
120 if (!fileselection.isEmpty()) {
122 std::ifstream file(fileselection.toStdString().c_str());
123 std::stringstream buffer;
124 buffer << file.rdbuf();
125 ui.editor->setText(QString::fromStdString(buffer.str()));
134 auto alg =
ui.algoSelector->getSelectedAlgorithm();
136 m_alg = AlgorithmManager::Instance().createUnmanaged(alg.name.toStdString(), alg.version);
138 }
catch (std::runtime_error &) {
146 QStringList disabled;
147 disabled.push_back(
"OutputWorkspace");
148 disabled.push_back(
"InputWorkspace");
149 disabled.push_back(
"Workspace");
150 ui.algoProperties->addEnabledAndDisableLists(QStringList(), disabled);
152 ui.algoProperties->setAlgorithm(
m_alg);
153 ui.algoProperties->hideOrDisableProperties();
166 ui.algoSelector->setSelectedAlgorithm(algo);
Mantid::Kernel::SingletonHolder< AlgorithmManagerImpl > AlgorithmManager
std::shared_ptr< Algorithm > Algorithm_sptr
Typedef for a shared pointer to an Algorithm.
std::string toString(const T &value)
Convert values to strings.