Newer
Older
DateAndTime t = DateAndTime::getCurrentTime();
t.setFromISO8601(verifyAndSanitizeISO8601(value.toStdString()));
} catch (std::exception &) {
}
dateEdit->setDate(QDate(t.year(), t.month(), t.day()));
dateEdit->setTime(QTime(t.hour(), t.minute(), t.second(), 0));
Gigg, Martyn Anthony
committed
return;
Gigg, Martyn Anthony
committed
}
Gigg, Martyn Anthony
committed
QLineEdit *textfield = qobject_cast<QLineEdit *>(widget);
MantidWidget *mtdwidget = qobject_cast<MantidWidget *>(widget);
if (textfield || mtdwidget) {
if (!isForScript()) {
if (textfield)
textfield->setText(value);
else
mtdwidget->setUserInput(value);
} else {
// Need to check if this is the default value as we don't fill them in if
// they are
if (m_python_arguments.contains(propName) || !property->isDefault()) {
if (textfield)
textfield->setText(value);
else
mtdwidget->setUserInput(value);
Gigg, Martyn Anthony
committed
}
}
return;
Gigg, Martyn Anthony
committed
}
PropertyWidget *propWidget = qobject_cast<PropertyWidget *>(widget);
if (propWidget) {
propWidget->setPreviousValue(value);
// Reaching here means we have a widget type we don't understand. Tell the
// developer
QMessageBox::warning(
this, windowTitle(),
QString("Cannot set value for ") + widget->metaObject()->className() +
". Update AlgorithmDialog::setValue() to cope with this widget.");
Gigg, Martyn Anthony
committed
}
/**
* Observer the execution of the algorithm using an AlgorithmObserver.
*
* All notifications will be observed.
*
* @param observer Pointer to the AlgorithmObserver to add.
void AlgorithmDialog::addAlgorithmObserver(
Mantid::API::AlgorithmObserver *observer) {
m_observers.push_back(observer);
// turn off the keep open option - it would only confuse things if someone is
// watching
setShowKeepOpen(false);
}
/**Handle completion of algorithm started while staying open.
* emits another signal to marshal the call to the main ui thread
*
* @param alg Completed algorithm (unused)
*/
void AlgorithmDialog::finishHandle(const IAlgorithm *alg) {
UNUSED_ARG(alg);
emit algCompletedSignal();
}
/**Handle error signal of algorithm started while staying open.
* emits another signal to marshal the call to the main ui thread
*
* @param alg Completed algorithm (unused)
* @param what the error message (unused)
*/
void AlgorithmDialog::errorHandle(const IAlgorithm *alg,
const std::string &what) {
UNUSED_ARG(alg);
UNUSED_ARG(what);
emit algCompletedSignal();
}
/**
* Only allow close when close is enabled
*/
void AlgorithmDialog::closeEvent(QCloseEvent *evt) {
if (m_exitButton) {
if (m_exitButton->isEnabled()) {
evt->accept();
} else {
evt->ignore();
}
} else {
QDialog::closeEvent(evt);
/**Handle completion of algorithm started while staying open.
* reenables the OK button when the algorithms finishes.
*
*/
void AlgorithmDialog::algorithmCompleted() {
if (m_okButton)
m_okButton->setEnabled(true);