From 34d20aa712d7aa53837de32ee2db15c9da0d7521 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Mon, 17 Sep 2012 12:12:25 +0000 Subject: [PATCH] change filename in plot only when you get to plot git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@58 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qDrawPlot.h | 6 ++- slsDetectorGui/include/qTabPlot.h | 69 +++++++++++++++------------- slsDetectorGui/slsDetectorGui.pro | 2 +- slsDetectorGui/src/qDetectorMain.cpp | 3 +- slsDetectorGui/src/qDrawPlot.cpp | 32 ++++++++----- 5 files changed, 66 insertions(+), 46 deletions(-) diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index 3a5aba2a0..6b9ba3a72 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -52,7 +52,7 @@ public: int GetProgress(){return progress;}; /** sets plot Title */ - void SetPlotTitle(QString title) {boxPlot->setTitle(title);} + void SetPlotTitle(QString title) {plotTitle = title;} /** sets 1D X Axis Title */ void SetHistXAxisTitle(QString title) {histXAxisTitle = title;} /** sets 1D Y Axis Title */ @@ -116,7 +116,7 @@ public slots: @param i is 1 for 1D, else 2D plot */ void SelectPlot(int i=2); /** To select 1D plot */ -void Select1DPlot() {Clear1DPlot();SelectPlot(1);} +void Select1DPlot() {SelectPlot(1);} /** To select 2D plot */ void Select2DPlot() {SelectPlot(2);} /** To clear plot */ @@ -332,6 +332,8 @@ QString histYAxisTitle; std::string histTitle[MAX_1DPLOTS]; /** Title in 2D */ std::string imageTitle; +/** plot Title */ +QString plotTitle; /** 1D or 2D */ unsigned int plot_in_scope; /** Number of Pixels in X Axis */ diff --git a/slsDetectorGui/include/qTabPlot.h b/slsDetectorGui/include/qTabPlot.h index 1be27aed2..538f32e97 100644 --- a/slsDetectorGui/include/qTabPlot.h +++ b/slsDetectorGui/include/qTabPlot.h @@ -42,37 +42,6 @@ public: private: - /** The sls detector object */ - multiSlsDetector *myDet; - - /** The Plot widget */ - qDrawPlot *myPlot; - - /** 1d/2d plot */ - bool isOneD; - bool isOrginallyOneD; - - /**whether to enable nth frame according to timing mode*/ - bool enableNFrame; - - QStackedLayout *stackedLayout; - QSpinBox *spinNthFrame; - QDoubleSpinBox *spinTimeGap; - QComboBox *comboTimeGapUnit; - QButtonGroup *btnGroupScan; - - /** some Default Values */ - static QString defaultPlotTitle; - static QString defaultHistXAxisTitle; - static QString defaultHistYAxisTitle; - static QString defaultImageXAxisTitle; - static QString defaultImageYAxisTitle; - static QString defaultImageZAxisTitle; - - /** scans */ - static const QString modeNames[5]; - - /** methods */ /** Sets up the widget @@ -114,6 +83,12 @@ void SetScanArgument(); void Refresh(); +/** Disables scanbox while running + * @param disable true to disable + */ +//void DisableScanBoxWhileRunning(bool disable); + + private slots: /** Selects the plot to display, enables/disables widgets @@ -140,6 +115,38 @@ void EnableZRange(); void SetPlot(); +private: +/** The sls detector object */ +multiSlsDetector *myDet; + +/** The Plot widget */ +qDrawPlot *myPlot; + +/** 1d/2d plot */ +bool isOneD; +bool isOrginallyOneD; + +/**whether to enable nth frame according to timing mode*/ +bool enableNFrame; + +QStackedLayout *stackedLayout; +QSpinBox *spinNthFrame; +QDoubleSpinBox *spinTimeGap; +QComboBox *comboTimeGapUnit; +QButtonGroup *btnGroupScan; + +/** some Default Values */ +static QString defaultPlotTitle; +static QString defaultHistXAxisTitle; +static QString defaultHistYAxisTitle; +static QString defaultImageXAxisTitle; +static QString defaultImageYAxisTitle; +static QString defaultImageZAxisTitle; + +/** scans */ +static const QString modeNames[5]; + + signals: void DisableZoomSignal(bool); void SetZRangeSignal(double,double); diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index c6eb217ad..5fd91c07c 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -6,7 +6,7 @@ UI_HEADERS_DIR = forms/include RESOURCES += icons.qrc -DEFINES += VERBOSE DACS_INT #VERYVERBOSE +DEFINES += VERBOSE VERYVERBOSE #DACS_INT #VERYVERBOSE target.path += $(DESTDIR) diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 21f8e557d..c97da8e0a 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -246,7 +246,8 @@ void qDetectorMain::Initialization(){ // When the acquisition is finished, must update the meas tab connect(myPlot, SIGNAL(UpdatingPlotFinished()), this, SLOT(EnableTabs())); connect(myPlot, SIGNAL(UpdatingPlotFinished()), tab_measurement, SLOT(UpdateFinished())); - connect(myPlot, SIGNAL(UpdatingPlotFinished()), tab_plot, SLOT(Refresh())); + //This should not be called as it will change file name to measurement when run finished + //connect(myPlot, SIGNAL(UpdatingPlotFinished()), tab_plot, SLOT(Refresh())); connect(myPlot, SIGNAL(SetCurrentMeasurementSignal(int)), tab_measurement, SLOT(SetCurrentMeasurement(int))); // menubar // Modes Menu diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index b98cfb571..99421e7b8 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -127,6 +127,7 @@ void qDrawPlot::SetupWidgetWindow(){ // Default titles- only for the initial picture histXAxisTitle="Channel Number"; histYAxisTitle="Counts"; + plotTitle = "Measurement"; for(int i=0;igetFilePath().c_str()); fileName = QString(myDet->getFileName().c_str()); + + + // Setting the callback function to get data from detector class + myDet->registerDataCallback(&(GetDataCallBack),this); + //Setting the callback function to alert when acquisition finished from detector class + myDet->registerAcquisitionFinishedCallback(&(GetAcquisitionFinishedCallBack),this); + //Setting the callback function to alert when each measurement finished from detector class + myDet->registerMeasurementFinishedCallback(&(GetMeasurementFinishedCallBack),this); + } @@ -261,6 +271,7 @@ void qDrawPlot::StartStopDaqToggle(bool stop_if_running){ fileName = QString(myDet->getFileName().c_str()); + StartDaq(true); running=!running; } @@ -323,12 +334,6 @@ bool qDrawPlot::StartOrStopThread(bool start){ SetupMeasurement(myDet->getFileIndex()); cout << "Starting new acquisition threadddd ...." << endl; - // Setting the callback function to get data from detector class - myDet->registerDataCallback(&(GetDataCallBack),this); - //Setting the callback function to alert when acquisition finished from detector class - myDet->registerAcquisitionFinishedCallback(&(GetAcquisitionFinishedCallBack),this); - //Setting the callback function to alert when each measurement finished from detector class - myDet->registerMeasurementFinishedCallback(&(GetMeasurementFinishedCallBack),this); // Start acquiring data from server if(!firstTime) pthread_join(gui_acquisition_thread,NULL);//wait until he's finished, ie. exits pthread_create(&gui_acquisition_thread, NULL,DataStartAcquireThread, (void*) this); @@ -353,8 +358,11 @@ void qDrawPlot::SetScanArgument(int scanArg){ #endif scanArgument = scanArg; + if(plot_in_scope==1) Clear1DPlot(); + LockLastImageArray(); + nPixelsX = myDet->getTotalNumberOfChannels(); nPixelsY = 100;//if number of exposures, this should be checked before acquisition @@ -418,7 +426,8 @@ void qDrawPlot::SetupMeasurement(int currentIndex){ currentFrame = 0; //for 2d scans currentScanDivLevel = 0; - lastImageNumber = 0; + //if(plot_in_scope==2) + if(!running) lastImageNumber = 0;/**Just now */ //initializing 2d array for(int py=0;py<(int)nPixelsY;py++) @@ -495,7 +504,7 @@ int qDrawPlot::GetDataCallBack(detectorData *data, void *this_pointer){ int qDrawPlot::GetData(detectorData *data){ #ifdef VERYVERBOSE - cout << "Entering GetDatafunction" << endl; + cout << "******Entering GetDatafunction********" << endl; #endif if(!stop_signal){ @@ -774,7 +783,7 @@ int qDrawPlot::MeasurementFinished(int currentMeasurementIndex, int fileIndex){ void qDrawPlot::SelectPlot(int i){ //1 for 1D otherwise 2D if(i==1){ - Clear1DPlot(); + //Clear1DPlot(); it clears the last measurement plot1D->SetXTitle(histXAxisTitle.toAscii().constData()); plot1D->SetYTitle(histYAxisTitle.toAscii().constData()); plot1D->show(); @@ -810,7 +819,8 @@ void qDrawPlot::UpdatePlot(){ cout << "Entering UpdatePlot function" << endl; #endif plot_update_timer->stop(); - + //set plot title + boxPlot->setTitle(plotTitle); // only if no plot isnt enabled if(plotEnable){ LockLastImageArray(); @@ -1195,7 +1205,7 @@ int qDrawPlot::UpdateTrimbitPlot(bool fromDetector,bool Histogram){ if(histYAxis[0]) delete [] histYAxis[0];histYAxis[0] = new double [nPixelsX]; //initializing for(unsigned int px=0;px