Merge branch 'master' into prefDirs
This commit is contained in:
@@ -2301,12 +2301,7 @@ Py::Object FunctionExpression::evaluate(const Expression *expr, int f, const std
|
||||
_EXPR_THROW("Unknown function: " << f,expr);
|
||||
}
|
||||
|
||||
Quantity q(scaler * output, unit);
|
||||
if (!q.isValid()) {
|
||||
throw Base::ValueError("Not a number");
|
||||
}
|
||||
|
||||
return Py::asObject(new QuantityPy(new Quantity(q)));
|
||||
return Py::asObject(new QuantityPy(new Quantity(scaler * output, unit)));
|
||||
}
|
||||
|
||||
Py::Object FunctionExpression::_getPyValue() const {
|
||||
|
||||
@@ -156,13 +156,17 @@ void DlgExpressionInput::textChanged(const QString &text)
|
||||
Base::Quantity value = n->getQuantity();
|
||||
QString msg = value.getUserString();
|
||||
|
||||
if(!impliedUnit.isEmpty()) {
|
||||
if (!value.isValid()) {
|
||||
throw Base::ValueError("Not a number");
|
||||
}
|
||||
else if (!impliedUnit.isEmpty()) {
|
||||
if (!value.getUnit().isEmpty() && value.getUnit() != impliedUnit)
|
||||
throw Base::UnitsMismatchError("Unit mismatch between result and required unit");
|
||||
|
||||
value.setUnit(impliedUnit);
|
||||
|
||||
} else if (!value.getUnit().isEmpty()) {
|
||||
}
|
||||
else if (!value.getUnit().isEmpty()) {
|
||||
msg += QString::fromUtf8(" (Warning: unit discarded)");
|
||||
|
||||
QPalette p(ui->msg->palette());
|
||||
|
||||
Reference in New Issue
Block a user