Attacher: UI: another fix of status label

When no references were filled in, and modes were switched, it falsely
claimed 'Attached'. This has been fixed.
This commit is contained in:
DeepSOIC 2016-05-06 00:53:26 +03:00 committed by wmayer
parent 651be3dcd1
commit abf4ddf9f7

View File

@ -307,9 +307,9 @@ bool TaskDatumParameters::updatePreview()
{ {
Part::Datum* pcDatum = static_cast<Part::Datum*>(DatumView->getObject()); Part::Datum* pcDatum = static_cast<Part::Datum*>(DatumView->getObject());
QString errMessage; QString errMessage;
bool attached; bool attached = false;
try{ try{
pcDatum->positionBySupport(); attached = pcDatum->positionBySupport();
} catch (Base::Exception &err){ } catch (Base::Exception &err){
errMessage = QString::fromLatin1(err.what()); errMessage = QString::fromLatin1(err.what());
} catch (Standard_Failure &err){ } catch (Standard_Failure &err){
@ -320,17 +320,14 @@ bool TaskDatumParameters::updatePreview()
if (errMessage.length()>0){ if (errMessage.length()>0){
ui->message->setText(tr("Attachment mode failed: %1").arg(errMessage)); ui->message->setText(tr("Attachment mode failed: %1").arg(errMessage));
ui->message->setStyleSheet(QString::fromLatin1("QLabel{color: red;}")); ui->message->setStyleSheet(QString::fromLatin1("QLabel{color: red;}"));
attached = false;
} else { } else {
if (pcDatum->MapMode.getValue() == mmDeactivated){ if (!attached){
ui->message->setText(tr("Not attached")); ui->message->setText(tr("Not attached"));
ui->message->setStyleSheet(QString()); ui->message->setStyleSheet(QString());
attached = false;
} else { } else {
std::vector<QString> strs = AttacherGui::getUIStrings(pcDatum->attacher().getTypeId(),eMapMode(pcDatum->MapMode.getValue())); std::vector<QString> strs = AttacherGui::getUIStrings(pcDatum->attacher().getTypeId(),eMapMode(pcDatum->MapMode.getValue()));
ui->message->setText(tr("Attached with mode %1").arg(strs[0])); ui->message->setText(tr("Attached with mode %1").arg(strs[0]));
ui->message->setStyleSheet(QString::fromLatin1("QLabel{color: green;}")); ui->message->setStyleSheet(QString::fromLatin1("QLabel{color: green;}"));
attached = true;
} }
} }
QString splmLabelText = attached ? tr("Extra placement:") : tr("Extra placement (inactive - not attached):"); QString splmLabelText = attached ? tr("Extra placement:") : tr("Extra placement (inactive - not attached):");