void AMGenericStepScanConfigurationView::onAxisControlChoice1Changed() { if (axisControlChoice1_->currentIndex() == 0){ axisStart1_->setEnabled(false); axisStep1_->setEnabled(false); axisEnd1_->setEnabled(false); axisControlChoice2_->setEnabled(false); configuration_->removeControl(0); setStart1(-1.0); setStep1(-1.0); setEnd1(-1.0); } else{ axisStart1_->setEnabled(true); axisStep1_->setEnabled(true); axisEnd1_->setEnabled(true); axisControlChoice2_->setEnabled(true); AMControl *control = controlNameMap_.value( axisControlChoice1_->itemText(axisControlChoice1_->currentIndex()), 0 ); if (control) { configuration_->setControl(0, control->toInfo()); setStart1(control->value()); setStep1(1.0); setEnd1(control->value()+10); } onStart1Changed(); onStep1Changed(); onEnd1Changed(); onDwellTimeChanged(); } onAxisControlChoice2Changed(); QStandardItemModel *model = qobject_cast<QStandardItemModel *>(axisControlChoice2_->model()); for (int i = 1; i < axisControlChoice2_->count(); i++) model->item(i)->setFlags(i == axisControlChoice1_->currentIndex() ? Qt::NoItemFlags : Qt::ItemIsEnabled | Qt::ItemIsSelectable); updateScanInformation(); }
void BioXASSSRLMonochromatorConfigurationView::onCalibrateGoniometerButtonClicked() { if (mono_) { AMControl *braggMotor = mono_->braggMotor(); if (braggMotor) { bool inputOK = false; double oldPosition = braggMotor->value(); double newPosition = QInputDialog::getDouble(this, "Goniometer Calibration", "Enter calibrated goniometer position:", oldPosition, BRAGG_POSITION_MIN, BRAGG_POSITION_MAX, 2, &inputOK); if (inputOK) braggMotor->calibrate(oldPosition, newPosition); } } }
void BioXASSSRLMonochromatorConfigurationView::onCalibrateEnergyButtonClicked() { if (mono_) { AMControl *energyControl = mono_->energyControl(); if (energyControl) { bool inputOK = false; double oldEnergy = energyControl->value(); double newEnergy = QInputDialog::getDouble(this, "Energy Calibration", "Enter calibrated energy:", oldEnergy, ENERGY_MIN, ENERGY_MAX, 2, &inputOK); if (inputOK) energyControl->calibrate(oldEnergy, newEnergy); } } }
/// Loops through the children of the control, makes an AMControlStatus for each, and appends it to the list. /// If the child has children, then an AMControlState is made for the child, added to the index paired list. /// By creating the AMControlState, the searchChildren is effectively called recursively. bool AMControlState::searchChildren(AMControl *ctrl) { QString tmpName = ""; int tmpCan = 0; int tmpShould = 0; double tmpValue = -1; double tmpTolerance = 0; AMControl *tmpCtrl = NULL; AMControlStatus *tmpStatus = NULL; for(int x = 0; x < ctrl->childControlCount(); x++){ tmpCtrl = ctrl->childControlAt(x); tmpName = tmpCtrl->objectName(); tmpValue = tmpCtrl->value(); tmpTolerance = tmpCtrl->tolerance(); tmpCan = (tmpCtrl->canMeasure() & 1) | (tmpCtrl->canMove() & 2); // TODO TODO TODO // tmpShould = tmpCtrl->shouldMeasure() ? (tmpCtrl->shouldMove() ? 2 : 1) : 0; tmpShould = tmpCtrl->shouldMeasure() ? 1 : 0; tmpShould |= tmpCtrl->shouldMove() ? 2 : 0; tmpStatus = new AMControlStatus(tmpName, tmpCan, tmpShould, tmpValue, tmpTolerance, this); state_.append( tmpStatus ); if(tmpCtrl->childControlCount() > 0 ){ AMControlState *ctrlSt = new AMControlState(tmpCtrl, this); subState_.append( QPair<int, AMControlState*>(x, ctrlSt)); } } /* QString tmpStr = ""; for(int x = 0; x < ctrl->numChildren(); x++){ tmpStr.setNum(ctrl->child(x)->value()); state_.append(QPair<QString, QString>(ctrl->child(x)->objectName(), tmpStr)); if(ctrl->child(x)->numChildren() > 0 ){ AMControlState *ctrlSt = new AMControlState(ctrl->child(x), this); subState_.append( QPair<int, AMControlState*>(x, ctrlSt)); } } */ if(ctrl->childControlCount() > 0) return TRUE; return FALSE; }