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
This commit is contained in:
l_maliakal_d 2012-09-17 12:12:25 +00:00
parent 4527e9f61b
commit 34d20aa712
5 changed files with 66 additions and 46 deletions

View File

@ -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 */

View File

@ -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);

View File

@ -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)

View File

@ -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

View File

@ -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;i<MAX_1DPLOTS;i++){
@ -176,6 +177,15 @@ void qDrawPlot::SetupWidgetWindow(){
filePath = QString(myDet->getFilePath().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<nPixelsX;px++) histXAxis[px] = px;
for(int i=0;i<nPixelsX;i++) histYAxis[0][i] = 0;
for(i=0;i<nPixelsX;i++) histYAxis[0][i] = 0;
//clear/select plot and set titles
Clear1DPlot();