mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-28 17:10:03 +02:00
bugfix:settings undefined and uninitialized not disabled anymore
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@87 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
parent
87410f09de
commit
55f7145b1b
@ -77,16 +77,7 @@ void qTabSettings::SetupDetectorSettings(){
|
|||||||
index[i] = model->index(i, comboSettings->modelColumn(), comboSettings->rootModelIndex());
|
index[i] = model->index(i, comboSettings->modelColumn(), comboSettings->rootModelIndex());
|
||||||
item[i] = model->itemFromIndex(index[i]);
|
item[i] = model->itemFromIndex(index[i]);
|
||||||
}
|
}
|
||||||
// Enabling/Disabling depending on the detector type
|
|
||||||
// Undefined and uninitialized are enabled for all detectors
|
|
||||||
if(sett==slsDetectorDefs::UNDEFINED)
|
|
||||||
item[(int)Uninitialized]->setEnabled(false);
|
|
||||||
else if(sett==slsDetectorDefs::UNINITIALIZED)
|
|
||||||
item[(int)Undefined]->setEnabled(false);
|
|
||||||
else{
|
|
||||||
item[(int)Uninitialized]->setEnabled(false);
|
|
||||||
item[(int)Undefined]->setEnabled(false);
|
|
||||||
}
|
|
||||||
switch(detType){
|
switch(detType){
|
||||||
case slsDetectorDefs::MYTHEN:
|
case slsDetectorDefs::MYTHEN:
|
||||||
item[(int)Standard]->setEnabled(true);
|
item[(int)Standard]->setEnabled(true);
|
||||||
@ -116,7 +107,7 @@ void qTabSettings::SetupDetectorSettings(){
|
|||||||
item[(int)VeryHighGain]->setEnabled(true);
|
item[(int)VeryHighGain]->setEnabled(true);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
qDefs::Message(qDefs::CRITICAL,"Unknown detector type.","Settings");
|
qDefs::Message(qDefs::CRITICAL,"Unknown detector type. Exiting GUI.","Settings");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -124,8 +115,7 @@ void qTabSettings::SetupDetectorSettings(){
|
|||||||
// This should not happen -only if the server and gui has a mismatch
|
// This should not happen -only if the server and gui has a mismatch
|
||||||
// on which all modes are allowed in detectors
|
// on which all modes are allowed in detectors
|
||||||
if(!(item[(int)sett]->isEnabled())){
|
if(!(item[(int)sett]->isEnabled())){
|
||||||
qDefs::Message(qDefs::CRITICAL,"Unknown Detector Settings retrieved from detector. "
|
qDefs::Message(qDefs::CRITICAL,"Unknown Detector Settings retrieved from detector. Exiting GUI.","Settings");
|
||||||
"Exiting GUI.","Settings");
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "ERROR: Unknown Detector Settings retrieved from detector." << endl;
|
cout << "ERROR: Unknown Detector Settings retrieved from detector." << endl;
|
||||||
#endif
|
#endif
|
||||||
@ -152,30 +142,22 @@ void qTabSettings::Initialization(){
|
|||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
void qTabSettings::setSettings(int index){
|
void qTabSettings::setSettings(int index){
|
||||||
// The first time settings is changed from undefined or uninitialized to a proper setting,
|
//dont set it if settings is set to undefined or uninitialized
|
||||||
// then undefined/uninitialized should be disabled
|
if((index==Undefined)||(index==Uninitialized)){
|
||||||
if(item[(int)Undefined]->isEnabled()){
|
qDefs::Message(qDefs::WARNING,"Cannot change settings to Undefined or Uninitialized.","Settings");
|
||||||
//Do not disable it if this wasnt selected again by mistake
|
disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int)));
|
||||||
if(index!=(int)Undefined)
|
comboSettings->setCurrentIndex((int)myDet->getSettings());
|
||||||
item[(int)Undefined]->setEnabled(false);
|
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int)));
|
||||||
}else if(item[(int)Uninitialized]->isEnabled()){
|
|
||||||
//Do not disable it if this wasnt selected again by mistake
|
|
||||||
if(index!=(int)Uninitialized)
|
|
||||||
item[(int)Uninitialized]->setEnabled(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else{
|
||||||
slsDetectorDefs::detectorSettings sett = myDet->setSettings((slsDetectorDefs::detectorSettings)index);
|
slsDetectorDefs::detectorSettings sett = myDet->setSettings((slsDetectorDefs::detectorSettings)index);
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Settings have been set to " << myDet->slsDetectorBase::getDetectorSettings(sett) << endl;
|
cout << "Settings have been set to " << myDet->slsDetectorBase::getDetectorSettings(sett) << endl;
|
||||||
#endif
|
#endif
|
||||||
if((detType==slsDetectorDefs::GOTTHARD)||(detType==slsDetectorDefs::AGIPD)){
|
|
||||||
lblThreshold->setEnabled(false);
|
|
||||||
spinThreshold->setEnabled(false);
|
|
||||||
}else{//mythen or eiger
|
|
||||||
if((index==Undefined)||(index==Uninitialized)){
|
|
||||||
|
|
||||||
lblThreshold->setEnabled(false);
|
//threshold
|
||||||
spinThreshold->setEnabled(false);
|
if((detType==slsDetectorDefs::MYTHEN)||(detType==slsDetectorDefs::EIGER)){
|
||||||
}else{
|
|
||||||
lblThreshold->setEnabled(true);
|
lblThreshold->setEnabled(true);
|
||||||
spinThreshold->setEnabled(true);
|
spinThreshold->setEnabled(true);
|
||||||
SetEnergy();
|
SetEnergy();
|
||||||
@ -183,8 +165,6 @@ void qTabSettings::setSettings(int index){
|
|||||||
if(expertMode) emit UpdateTrimbitSignal(0);
|
if(expertMode) emit UpdateTrimbitSignal(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -263,15 +243,6 @@ void qTabSettings::Refresh(){
|
|||||||
cout << endl << "**Updating Settings Tab" << endl;
|
cout << endl << "**Updating Settings Tab" << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Settings
|
|
||||||
#ifdef VERBOSE
|
|
||||||
cout << "Getting settings" << endl;
|
|
||||||
#endif
|
|
||||||
//changin the combo settings also plots the trimbits for mythen and eiger, so disconnect
|
|
||||||
disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int)));
|
|
||||||
SetupDetectorSettings();//comboSettings->setCurrentIndex(myDet->getSettings());
|
|
||||||
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int)));
|
|
||||||
|
|
||||||
|
|
||||||
// Number of Modules
|
// Number of Modules
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
@ -292,11 +263,20 @@ void qTabSettings::Refresh(){
|
|||||||
default: comboDynamicRange->setCurrentIndex(0); break;
|
default: comboDynamicRange->setCurrentIndex(0); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((detType==slsDetectorDefs::GOTTHARD)||(detType==slsDetectorDefs::AGIPD)){
|
|
||||||
lblThreshold->setEnabled(false);
|
// Settings
|
||||||
spinThreshold->setEnabled(false);
|
#ifdef VERBOSE
|
||||||
}else{
|
cout << "Getting settings" << endl;
|
||||||
if((comboSettings->currentIndex()==Undefined)||(comboSettings->currentIndex()==Uninitialized)){
|
#endif
|
||||||
|
disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int)));
|
||||||
|
comboSettings->setCurrentIndex((int)myDet->getSettings());
|
||||||
|
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int)));
|
||||||
|
|
||||||
|
|
||||||
|
//threshold
|
||||||
|
int sett = comboSettings->currentIndex();
|
||||||
|
if((detType==slsDetectorDefs::MYTHEN)||(detType==slsDetectorDefs::EIGER)){
|
||||||
|
if((sett==Undefined)||(sett==Uninitialized)){
|
||||||
lblThreshold->setEnabled(false);
|
lblThreshold->setEnabled(false);
|
||||||
spinThreshold->setEnabled(false);
|
spinThreshold->setEnabled(false);
|
||||||
}else{
|
}else{
|
||||||
@ -309,6 +289,7 @@ void qTabSettings::Refresh(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "**Updated Settings Tab" << endl << endl;
|
cout << "**Updated Settings Tab" << endl << endl;
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user