From f4dc6aab220dc5f881efe034c6b32c01ab8bfaba Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Thu, 11 Oct 2012 08:36:11 +0000 Subject: [PATCH] enhancement:nth frame changed to red, instead of error and changing it back git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@89 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_measurement.ui | 27 +++++++ slsDetectorGui/src/qDrawPlot.cpp | 2 +- slsDetectorGui/src/qTabPlot.cpp | 74 +++++++++++++------- 3 files changed, 77 insertions(+), 26 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_measurement.ui b/slsDetectorGui/forms/form_tab_measurement.ui index 0b5f0d48a..f30ef53c5 100644 --- a/slsDetectorGui/forms/form_tab_measurement.ui +++ b/slsDetectorGui/forms/form_tab_measurement.ui @@ -231,6 +231,9 @@ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + false + @@ -277,6 +280,9 @@ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + false + 9 @@ -385,6 +391,9 @@ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + false + @@ -443,6 +452,9 @@ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + false + @@ -545,6 +557,9 @@ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + false + @@ -597,6 +612,9 @@ Exposure Time of a frame. Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + false + 5 @@ -705,6 +723,9 @@ Frame period between exposures. Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + false + 5 @@ -854,6 +875,9 @@ Frame period between exposures. Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + false + @@ -913,6 +937,9 @@ Frame period between exposures. Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + false + diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 1a3364524..b3a9377de 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -755,8 +755,8 @@ int qDrawPlot::GetData(detectorData *data){ } pthread_mutex_unlock(&(last_image_complete_mutex)); } + cout<<"currentframe:"<setTimer(slsDetectorDefs::FRAME_PERIOD,-1)*(1E-6)); + //if period is 0, check exptime, if that is also 0, give warning and set to min timer + if(acqPeriodMS==0){ + acqPeriodMS = (myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-6)); + if(acqPeriodMS==0){ + qDefs::Message(qDefs::WARNING,"Interval between Plots:
" + "Every Nth Image: Period betwen Frames and Exposure Time cannot both be 0 ms.
" + "Resetting to minimum plotting time interval","Plot"); + comboFrequency->setCurrentIndex(0); + stackedLayout->setCurrentIndex(comboFrequency->currentIndex()); + spinTimeGap->setValue(minPlotTimer); + comboTimeGapUnit->setCurrentIndex(qDefs::MILLISECONDS); + timeMS=minPlotTimer; + //This is done so that its known which one was selected + myPlot->SetFrameFactor(0); + // Setting the timer value(ms) between plots + myPlot->SetPlotTimer(timeMS); + + connect(comboTimeGapUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency())); + connect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetFrequency())); + connect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency())); + connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency())); + return; + } + } + + stackedLayout->setCurrentIndex(comboFrequency->currentIndex()); switch(comboFrequency->currentIndex()){ case 0: @@ -457,16 +485,29 @@ void qTabPlot::SetFrequency(){ timeMS=minPlotTimer; } - //show red for warning + + //show red if min intervalInterval between Plots: You might be losing Images!","Plot"); + //qDefs::Message(qDefs::WARNING,"Interval between Plots: You might be losing Images!","Plot"); boxFrequency->setPalette(*red); boxFrequency->setTitle("Interval between Plots*"); QString errTip = intervalTip + QString("

" "Time Interval Condition: min of ")+QString("%1").arg(minPlotTimer)+ QString("ms.
You might be losing images!
"); boxFrequency->setToolTip(errTip); - }else{ + } + //show red if acqPeriodInterval between Plots: You might be losing Images!","Plot"); + boxFrequency->setPalette(*red); + boxFrequency->setTitle("Interval between Plots*"); + QString errTip = intervalTip + QString("

" + "Time Interval Acquisition Period should be >= Time Interval between plots.
" + "You might be losing images!
"); + boxFrequency->setToolTip(errTip); + } + //correct + else{ boxFrequency->setPalette(boxSnapshot->palette()); boxFrequency->setTitle("Interval between Plots"); boxFrequency->setToolTip(intervalTip); @@ -480,28 +521,11 @@ void qTabPlot::SetFrequency(){ cout << "Plotting Frequency: Time Gap - " << spinTimeGap->value() << qDefs::getUnitString((qDefs::timeUnit)comboTimeGapUnit->currentIndex()) << endl; #endif break; - case 1: - acqPeriodMS = (myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,-1)*(1E-6)); - //if period is 0, check exptime, if that is also 0, give warning and set to min timer - if(acqPeriodMS==0){ - acqPeriodMS = (myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-6)); - if(acqPeriodMS==0){ - qDefs::Message(qDefs::WARNING,"Interval between Plots:
" - "Every Nth Image: Period betwen Frames and Exposure Time cannot both be 0 ms.
" - "Resetting to minimum plotting time interval","Plot"); - comboFrequency->setCurrentIndex(0); - stackedLayout->setCurrentIndex(comboFrequency->currentIndex()); - spinTimeGap->setValue(minPlotTimer); - comboTimeGapUnit->setCurrentIndex(qDefs::MILLISECONDS); - timeMS=minPlotTimer; - //This is done so that its known which one was selected - myPlot->SetFrameFactor(0); - // Setting the timer value(ms) between plots - myPlot->SetPlotTimer(timeMS); - break; - } - } + + + + case 1: // gets the acq period * number of nth frames timeMS = (spinNthFrame->value())*acqPeriodMS; @@ -509,7 +533,7 @@ void qTabPlot::SetFrequency(){ //Show red to make sure the period between plotting is not less than minimum plot timer in ms if(timeMSInterval between Plots: You might be losing Images!","Plot"); + //qDefs::Message(qDefs::WARNING,"Interval between Plots: You might be losing Images!","Plot"); boxFrequency->setPalette(*red); boxFrequency->setTitle("Interval between Plots*"); QString errTip = intervalTip + QString("

"