fixed zmin zmax bug, automatically online when refreshing advanced tab bug, outdir not checking properly

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@178 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
l_maliakal_d 2013-05-08 17:32:38 +00:00
parent 7701531ff3
commit e153c6fd58
8 changed files with 77 additions and 17 deletions

View File

@ -506,7 +506,7 @@ void ContourSignal(bool);
void LogzSignal(bool); void LogzSignal(bool);
void LogySignal(bool); void LogySignal(bool);
void SetZRangeSignal(double,double); void SetZRangeSignal(double,double);
void EnableZRangeSignal(bool); void ResetZMinZMaxSignal(bool,bool,double,double);
void SetCurrentMeasurementSignal(int); void SetCurrentMeasurementSignal(int);
void saveErrorSignal(QString); void saveErrorSignal(QString);
void AcquisitionErrorSignal(QString); void AcquisitionErrorSignal(QString);

View File

@ -151,7 +151,7 @@ private slots:
signals: signals:
void DisableZoomSignal(bool); void DisableZoomSignal(bool);
void SetZRangeSignal(double,double); void SetZRangeSignal(double,double);
void EnableZRangeSignal(bool); void ResetZMinZMaxSignal(bool,bool,double,double);
}; };

View File

@ -5,6 +5,7 @@
* 19.06.2012 All modifications with the Ian flag has been made since * 19.06.2012 All modifications with the Ian flag has been made since
* z_range_ne and the buttons are defined in another class. * z_range_ne and the buttons are defined in another class.
* Logz button and z_range_ne have wrappers to connect them * Logz button and z_range_ne have wrappers to connect them
* 05.05.2013 Added ResetZMinZMax
*/ */
@ -67,6 +68,8 @@ void ResetRange();
#ifndef IAN #ifndef IAN
void SetZRange(double,double); void SetZRange(double,double);
void EnableZRange(bool enable); void EnableZRange(bool enable);
void ResetZMinZMax(bool zmin, bool zmax, double min, double max);
#endif #endif
signals: signals:

View File

@ -99,12 +99,12 @@ void SlsQt2DPlotLayout::ConnectSignalsAndSlots(){
void SlsQt2DPlotLayout::UpdateNKeepSetRangeIfSet(){ void SlsQt2DPlotLayout::UpdateNKeepSetRangeIfSet(){
#ifdef IAN #ifdef IAN
if(z_range_ne->CheckBoxState()){ if(z_range_ne->CheckBoxState()){
#else
if(zRangeChecked){
#endif #endif
//just reset histogram range before update //just reset histogram range before update
the_plot->SetZMinMax(z_range_ne->GetValue(0),z_range_ne->GetValue(1)); the_plot->SetZMinMax(z_range_ne->GetValue(0),z_range_ne->GetValue(1));
#ifdef IAN
} }
#endif
the_plot->Update(); the_plot->Update();
} }
@ -131,6 +131,37 @@ void SlsQt2DPlotLayout::ResetRange(){
} }
void SlsQt2DPlotLayout::ResetZMinZMax(bool zmin, bool zmax, double min, double max){
z_range_ne->SetNumber(min,0);
z_range_ne->SetNumber(max,1);
//refind z limits
the_plot->SetZMinMax();
if(btnLogz->isChecked()) the_plot->SetZMinimumToFirstGreaterThanZero();
//first time check validity
if(zmax) z_range_ne->SetValue(max,0);
else z_range_ne->SetValue(the_plot->GetZMaximum(),1);
if(zmin) z_range_ne->SetValue(min,0);
else z_range_ne->SetValue(the_plot->GetZMinimum(),0);
if(zmin && zmax){
bool same = (z_range_ne->GetValue(0)==z_range_ne->GetValue(1)) ? 1:0;
if(!z_range_ne->IsValueOk(0)||same) z_range_ne->SetValue(the_plot->GetZMinimum(),0);
if(!z_range_ne->IsValueOk(1)||same) z_range_ne->SetValue(the_plot->GetZMaximum(),1);
}
z_range_ne->SetRange(the_plot->GetZMinimum(),z_range_ne->GetValue(1),0);
z_range_ne->SetRange(z_range_ne->GetValue(0),the_plot->GetZMaximum(),1);
//set histogram range
the_plot->SetZMinMax(z_range_ne->GetValue(0),z_range_ne->GetValue(1));
the_plot->Update();
}
void SlsQt2DPlotLayout::SetZScaleToLog(bool yes){ void SlsQt2DPlotLayout::SetZScaleToLog(bool yes){
#ifndef IAN #ifndef IAN
#ifdef VERBOSE #ifdef VERBOSE
@ -190,5 +221,6 @@ void SlsQt2DPlotLayout::EnableZRange(bool enable){
#endif #endif
zRangeChecked = enable; zRangeChecked = enable;
ResetRange(); ResetRange();
} }
#endif #endif

View File

@ -278,7 +278,7 @@ void qDrawPlot::Initialization(){
connect(this, SIGNAL(ContourSignal(bool)), plot2D, SIGNAL(ContourSignal(bool))); connect(this, SIGNAL(ContourSignal(bool)), plot2D, SIGNAL(ContourSignal(bool)));
connect(this, SIGNAL(LogzSignal(bool)), plot2D, SLOT(SetZScaleToLog(bool))); connect(this, SIGNAL(LogzSignal(bool)), plot2D, SLOT(SetZScaleToLog(bool)));
connect(this, SIGNAL(LogySignal(bool)), plot1D, SLOT(SetLogY(bool))); connect(this, SIGNAL(LogySignal(bool)), plot1D, SLOT(SetLogY(bool)));
connect(this, SIGNAL(EnableZRangeSignal(bool)),plot2D, SLOT(EnableZRange(bool))); connect(this, SIGNAL(ResetZMinZMaxSignal(bool,bool,double,double)),plot2D, SLOT(ResetZMinZMax(bool,bool,double,double)));
connect(this, SIGNAL(SetZRangeSignal(double,double)), plot2D, SLOT(SetZRange(double,double))); connect(this, SIGNAL(SetZRangeSignal(double,double)), plot2D, SLOT(SetZRange(double,double)));

View File

@ -140,8 +140,10 @@ void qTabAdvanced::SetupWidgetWindow(){
//check if its online and set it to red if offline //check if its online and set it to red if offline
det->checkOnline(); if(det->setOnline()==slsDetectorDefs::ONLINE_FLAG)
det->checkReceiverOnline(); det->checkOnline();
if(det->setReceiverOnline()==slsDetectorDefs::ONLINE_FLAG)
det->checkReceiverOnline();
comboOnline->setCurrentIndex(det->setOnline()); comboOnline->setCurrentIndex(det->setOnline());
comboRxrOnline->setCurrentIndex(det->setReceiverOnline()); comboRxrOnline->setCurrentIndex(det->setReceiverOnline());
if(!comboOnline->currentIndex()){ if(!comboOnline->currentIndex()){
@ -571,7 +573,10 @@ void qTabAdvanced::SetReceiverOnline(int index){
cout << "Setting Reciever Online to :" << index << endl; cout << "Setting Reciever Online to :" << index << endl;
#endif #endif
disconnect(comboRxrOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetReceiverOnline(int))); disconnect(comboRxrOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetReceiverOnline(int)));
comboRxrOnline->setCurrentIndex(det->setReceiverOnline(index)); if(index)
SetReceiver();
else
comboRxrOnline->setCurrentIndex(det->setReceiverOnline(index));
qDefs::checkErrorMessage(det); qDefs::checkErrorMessage(det);
connect(comboRxrOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetReceiverOnline(int))); connect(comboRxrOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetReceiverOnline(int)));
//highlight in red if offline //highlight in red if offline
@ -648,8 +653,11 @@ void qTabAdvanced::SetReceiver(){
#ifdef VERBOSE #ifdef VERBOSE
cout << "Setting Receiver" << endl; cout << "Setting Receiver" << endl;
#endif #endif
string outdir = myDet->getFilePath();
dispRxrHostname->setText(QString(det->setReceiver(dispRxrHostname->text().toAscii().constData()))); dispRxrHostname->setText(QString(det->setReceiver(dispRxrHostname->text().toAscii().constData())));
qDefs::checkErrorMessage(det); qDefs::checkErrorMessage(det);
det->setFilePath(outdir);
qDefs::checkErrorMessage(det);
Refresh(); Refresh();
} }
@ -909,8 +917,10 @@ void qTabAdvanced::SetDetector(int index){
//check if its online and set it to red if offline //check if its online and set it to red if offline
det->checkOnline(); if(det->setOnline()==slsDetectorDefs::ONLINE_FLAG)
det->checkReceiverOnline(); det->checkOnline();
if(det->setReceiverOnline()==slsDetectorDefs::ONLINE_FLAG)
det->checkReceiverOnline();
comboOnline->setCurrentIndex(det->setOnline()); comboOnline->setCurrentIndex(det->setOnline());
comboRxrOnline->setCurrentIndex(det->setReceiverOnline()); comboRxrOnline->setCurrentIndex(det->setReceiverOnline());
//highlight in red if detector or receiver is offline //highlight in red if detector or receiver is offline
@ -1026,7 +1036,8 @@ void qTabAdvanced::Refresh(){
disconnect(comboOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetOnline(int))); disconnect(comboOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetOnline(int)));
//so that updated status //so that updated status
det->checkOnline(); if(det->setOnline()==slsDetectorDefs::ONLINE_FLAG)
det->checkOnline();
comboOnline->setCurrentIndex(det->setOnline()); comboOnline->setCurrentIndex(det->setOnline());
spinControlPort->setValue(det->getControlPort()); spinControlPort->setValue(det->getControlPort());
spinStopPort->setValue(det->getStopPort()); spinStopPort->setValue(det->getStopPort());
@ -1053,7 +1064,8 @@ void qTabAdvanced::Refresh(){
dispMAC->setText(det->getDetectorMAC()); dispMAC->setText(det->getDetectorMAC());
//so that updated status //so that updated status
det->checkReceiverOnline(); if(det->setReceiverOnline()==slsDetectorDefs::ONLINE_FLAG)
det->checkReceiverOnline();
comboRxrOnline->setCurrentIndex(det->setReceiverOnline()); comboRxrOnline->setCurrentIndex(det->setReceiverOnline());
dispRxrHostname->setText(det->getReceiver()); dispRxrHostname->setText(det->getReceiver());

View File

@ -166,6 +166,7 @@ void qTabDataOutput::setOutputDir(){
for(int i=0;i<myDet->getNumberOfDetectors();i++){ for(int i=0;i<myDet->getNumberOfDetectors();i++){
slsDetector *det = myDet->getSlsDetector(i); slsDetector *det = myDet->getSlsDetector(i);
qDefs::checkErrorMessage(myDet); qDefs::checkErrorMessage(myDet);
oldPath = det->getFilePath();
det->setFilePath(string(path.toAscii().constData())); det->setFilePath(string(path.toAscii().constData()));
qDefs::checkErrorMessage(det); qDefs::checkErrorMessage(det);
if(det->getFilePath()!=(string(path.toAscii().constData()))){ if(det->getFilePath()!=(string(path.toAscii().constData()))){
@ -187,9 +188,20 @@ void qTabDataOutput::setOutputDir(){
myDet->setFilePath(string(path.toAscii().constData())); myDet->setFilePath(string(path.toAscii().constData()));
} }
else { else {
myDet->setFilePath(string(path.toAscii().constData())); for(int i=0;i<myDet->getNumberOfDetectors();i++){
slsDetector *det = myDet->getSlsDetector(i);
qDefs::checkErrorMessage(myDet);
det->setFilePath(string(path.toAscii().constData()));
qDefs::checkErrorMessage(det);
if(det->getFilePath()!=(string(path.toAscii().constData()))){
error=true;
qDefs::checkErrorMessage(det);
break;
}
}
/* myDet->setFilePath(string(path.toAscii().constData()));
if(myDet->getFilePath()!=(string(path.toAscii().constData()))) if(myDet->getFilePath()!=(string(path.toAscii().constData())))
error=true; error=true;*/
} }
if(!error){ if(!error){

View File

@ -261,7 +261,7 @@ void qTabPlot::Initialization(){
connect(chkYMax, SIGNAL(toggled(bool)), this, SLOT(EnableRange())); connect(chkYMax, SIGNAL(toggled(bool)), this, SLOT(EnableRange()));
connect(chkZMin, SIGNAL(toggled(bool)), this, SLOT(EnableZRange())); connect(chkZMin, SIGNAL(toggled(bool)), this, SLOT(EnableZRange()));
connect(chkZMax, SIGNAL(toggled(bool)), this, SLOT(EnableZRange())); connect(chkZMax, SIGNAL(toggled(bool)), this, SLOT(EnableZRange()));
connect(this, SIGNAL(EnableZRangeSignal(bool)), myPlot, SIGNAL(EnableZRangeSignal(bool))); connect(this, SIGNAL(ResetZMinZMaxSignal(bool,bool,double,double)), myPlot, SIGNAL(ResetZMinZMaxSignal(bool,bool,double,double)));
connect(dispXMin, SIGNAL(editingFinished()), this, SLOT(SetAxesRange())); connect(dispXMin, SIGNAL(editingFinished()), this, SLOT(SetAxesRange()));
connect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetAxesRange())); connect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetAxesRange()));
@ -418,7 +418,8 @@ void qTabPlot::SetAxesRange(){
void qTabPlot::SetZRange(){ void qTabPlot::SetZRange(){
emit SetZRangeSignal(dispZMin->text().toDouble(),dispZMax->text().toDouble()); // emit SetZRangeSignal(dispZMin->text().toDouble(),dispZMax->text().toDouble());
emit ResetZMinZMaxSignal(chkZMin->isChecked(),chkZMax->isChecked(),dispZMin->text().toDouble(),dispZMax->text().toDouble());
} }
@ -428,7 +429,7 @@ void qTabPlot::SetZRange(){
void qTabPlot::EnableZRange(){ void qTabPlot::EnableZRange(){
dispZMin->setEnabled(chkZMin->isChecked()); dispZMin->setEnabled(chkZMin->isChecked());
dispZMax->setEnabled(chkZMax->isChecked()); dispZMax->setEnabled(chkZMax->isChecked());
emit EnableZRangeSignal((chkZMin->isChecked())||(chkZMax->isChecked())); emit ResetZMinZMaxSignal(chkZMin->isChecked(),chkZMax->isChecked(),dispZMin->text().toDouble(),dispZMax->text().toDouble());
} }