mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-25 15:50:03 +02:00
file dialogs now show option to show all files, trimbits is possible to open non existing file, copying clones does not get rid of the old plot
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@257 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
parent
28e0cae2e2
commit
534be9f942
@ -47,7 +47,7 @@ class qCloneWidget:public QMainWindow{
|
|||||||
public:
|
public:
|
||||||
/** \short The constructor
|
/** \short The constructor
|
||||||
*/
|
*/
|
||||||
qCloneWidget(QWidget *parent,int id,QString title,int numDim,SlsQt1DPlot*& plot1D,SlsQt2DPlotLayout*& plot2D,string FilePath,
|
qCloneWidget(QWidget *parent,int id,QString title,QString xTitle, QString yTitle, QString zTitle, int numDim,string FilePath,
|
||||||
bool displayStats, QString min, QString max, QString sum);
|
bool displayStats, QString min, QString max, QString sum);
|
||||||
|
|
||||||
/** Destructor
|
/** Destructor
|
||||||
@ -56,11 +56,12 @@ public:
|
|||||||
|
|
||||||
/** Sets up the widget window
|
/** Sets up the widget window
|
||||||
* @param title title of the image with frame number
|
* @param title title of the image with frame number
|
||||||
|
* @param xTitle title of x axis
|
||||||
|
* @param yTitle title of y axis
|
||||||
|
* @param zTitle title of z axis
|
||||||
* @param numDim 1D or 2D
|
* @param numDim 1D or 2D
|
||||||
* @param plot1D plot1d object reference
|
|
||||||
* @param plot2D plot2d object reference
|
|
||||||
* */
|
* */
|
||||||
void SetupWidgetWindow(QString title,int numDim,SlsQt1DPlot*& plot1D,SlsQt2DPlotLayout*& plot2D);
|
void SetupWidgetWindow(QString title, QString xTitle, QString yTitle, QString zTitle, int numDim);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -86,6 +87,17 @@ public:
|
|||||||
* */
|
* */
|
||||||
void SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis,string histTitle[],bool lines,bool markers);
|
void SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis,string histTitle[],bool lines,bool markers);
|
||||||
|
|
||||||
|
/** Get the 1D hist values to plot for angle plotting
|
||||||
|
* @param nbinsx number of bins in x axis
|
||||||
|
* @param xmin minimum in x axis
|
||||||
|
* @param xmax maximum in x axis
|
||||||
|
* @param nbinsy number of bins in y axis
|
||||||
|
* @param ymin minimum in y axis
|
||||||
|
* @param ymax maximum in y axis
|
||||||
|
* @param d data
|
||||||
|
* */
|
||||||
|
void SetCloneHists2D(int nbinsx,double xmin,double xmax,int nbinsy, double ymin, double ymax, double *d);
|
||||||
|
|
||||||
/**Set the range of the 1d plot
|
/**Set the range of the 1d plot
|
||||||
* @param IsXYRange array of x,y,min,max if these values are set
|
* @param IsXYRange array of x,y,min,max if these values are set
|
||||||
* @param XYRangeValues array of set values of x,y, min, max
|
* @param XYRangeValues array of set values of x,y, min, max
|
||||||
@ -115,9 +127,11 @@ private:
|
|||||||
/** vector of 1D hist values */
|
/** vector of 1D hist values */
|
||||||
QVector<SlsQtH1D*> cloneplot1D_hists;
|
QVector<SlsQtH1D*> cloneplot1D_hists;
|
||||||
|
|
||||||
|
/** markers for the plot*/
|
||||||
|
QwtSymbol *marker;
|
||||||
|
QwtSymbol *nomarker;
|
||||||
|
|
||||||
QMenuBar *menubar;
|
QMenuBar *menubar;
|
||||||
// QMenu *menuFile;
|
|
||||||
QAction *actionSave;
|
QAction *actionSave;
|
||||||
|
|
||||||
QGridLayout *mainLayout;
|
QGridLayout *mainLayout;
|
||||||
|
@ -579,7 +579,6 @@ void ResetZMinZMaxSignal(bool,bool,double,double);
|
|||||||
void SetCurrentMeasurementSignal(int);
|
void SetCurrentMeasurementSignal(int);
|
||||||
void saveErrorSignal(QString);
|
void saveErrorSignal(QString);
|
||||||
void AcquisitionErrorSignal(QString);
|
void AcquisitionErrorSignal(QString);
|
||||||
void UpdateAfterCloningSignal();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -107,10 +107,6 @@ public slots:
|
|||||||
*/
|
*/
|
||||||
void EnableScanBox(bool Histo=false);
|
void EnableScanBox(bool Histo=false);
|
||||||
|
|
||||||
/** Update all ranges, interpolate etc after cloning
|
|
||||||
*/
|
|
||||||
void UpdateAfterCloning();
|
|
||||||
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
/** Selects the plot to display, enables/disables widgets
|
/** Selects the plot to display, enables/disables widgets
|
||||||
|
@ -18,18 +18,23 @@
|
|||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
qCloneWidget::qCloneWidget(QWidget *parent,int id,QString title,int numDim,SlsQt1DPlot*& plot1D,SlsQt2DPlotLayout*& plot2D,string FilePath,
|
qCloneWidget::qCloneWidget(QWidget *parent,int id,QString title,QString xTitle, QString yTitle, QString zTitle,
|
||||||
bool displayStats, QString min, QString max, QString sum):
|
int numDim,string FilePath,bool displayStats, QString min, QString max, QString sum):
|
||||||
QMainWindow(parent),id(id),cloneplot2D(0),cloneplot1D(0),filePath(FilePath)
|
QMainWindow(parent),id(id),cloneplot2D(0),cloneplot1D(0),filePath(FilePath)
|
||||||
{
|
{
|
||||||
/** Window title*/
|
// Window title
|
||||||
char winTitle[300],currTime[50];
|
char winTitle[300],currTime[50];
|
||||||
strcpy(currTime,GetCurrentTimeStamp());
|
strcpy(currTime,GetCurrentTimeStamp());
|
||||||
sprintf(winTitle,"Snapshot:%d - %s",id,currTime);
|
sprintf(winTitle,"Snapshot:%d - %s",id,currTime);
|
||||||
setWindowTitle(QString(winTitle));
|
setWindowTitle(QString(winTitle));
|
||||||
|
|
||||||
/** Set up widget*/
|
marker = new QwtSymbol();
|
||||||
SetupWidgetWindow(title,numDim,plot1D,plot2D);
|
nomarker = new QwtSymbol();
|
||||||
|
marker->setStyle(QwtSymbol::Cross);
|
||||||
|
marker->setSize(5,5);
|
||||||
|
|
||||||
|
// Set up widget
|
||||||
|
SetupWidgetWindow(title,xTitle, yTitle, zTitle, numDim);
|
||||||
DisplayStats(displayStats,min,max,sum);
|
DisplayStats(displayStats,min,max,sum);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,51 +48,61 @@ qCloneWidget::~qCloneWidget(){
|
|||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
void qCloneWidget::SetupWidgetWindow(QString title,int numDim,SlsQt1DPlot*& plot1D,SlsQt2DPlotLayout*& plot2D){
|
void qCloneWidget::SetupWidgetWindow(QString title, QString xTitle, QString yTitle, QString zTitle, int numDim){
|
||||||
|
|
||||||
menubar = new QMenuBar(this);
|
menubar = new QMenuBar(this);
|
||||||
//menuFile = new QMenu("&File",menubar);
|
|
||||||
actionSave = new QAction("&Save",this);
|
actionSave = new QAction("&Save",this);
|
||||||
// menubar->addAction(menuFile->menuAction());
|
|
||||||
menubar->addAction(actionSave);
|
menubar->addAction(actionSave);
|
||||||
setMenuBar(menubar);
|
setMenuBar(menubar);
|
||||||
|
|
||||||
|
|
||||||
/** Main Window Layout */
|
//Main Window Layout
|
||||||
QWidget *centralWidget = new QWidget(this);
|
QWidget *centralWidget = new QWidget(this);
|
||||||
mainLayout = new QGridLayout(centralWidget);
|
mainLayout = new QGridLayout(centralWidget);
|
||||||
centralWidget->setLayout(mainLayout);
|
centralWidget->setLayout(mainLayout);
|
||||||
|
|
||||||
/** plot group box*/
|
//plot group box
|
||||||
cloneBox = new QGroupBox(this);
|
cloneBox = new QGroupBox(this);
|
||||||
gridClone = new QGridLayout(cloneBox);
|
gridClone = new QGridLayout(cloneBox);
|
||||||
cloneBox->setLayout(gridClone);
|
cloneBox->setLayout(gridClone);
|
||||||
cloneBox->setContentsMargins(0,0,0,0);
|
cloneBox->setContentsMargins(0,0,0,0);
|
||||||
cloneBox->setTitle(title);
|
|
||||||
cloneBox->setAlignment(Qt::AlignHCenter);
|
cloneBox->setAlignment(Qt::AlignHCenter);
|
||||||
cloneBox->setFont(QFont("Sans Serif",11,QFont::Normal));
|
cloneBox->setFont(QFont("Sans Serif",11,QFont::Normal));
|
||||||
/** According to dimensions, create appropriate 1D or 2Dplot */
|
cloneBox->setTitle(title);
|
||||||
|
// According to dimensions, create appropriate 1D or 2Dplot
|
||||||
if(numDim==1){
|
if(numDim==1){
|
||||||
cloneplot1D = plot1D;
|
cloneplot1D = new SlsQt1DPlot(cloneBox);
|
||||||
gridClone->addWidget(cloneplot1D,0,0);
|
|
||||||
|
cloneplot1D->setFont(QFont("Sans Serif",9,QFont::Normal));
|
||||||
|
cloneplot1D->SetXTitle(xTitle.toAscii().constData());
|
||||||
|
cloneplot1D->SetYTitle(yTitle.toAscii().constData());
|
||||||
|
|
||||||
|
|
||||||
cloneBox->setFlat(false);
|
cloneBox->setFlat(false);
|
||||||
cloneBox->setContentsMargins(0,30,0,0);
|
cloneBox->setContentsMargins(0,30,0,0);
|
||||||
|
gridClone->addWidget(cloneplot1D,0,0);
|
||||||
|
|
||||||
lblHistTitle = new QLabel("");
|
lblHistTitle = new QLabel("");
|
||||||
mainLayout->addWidget(lblHistTitle,0,0);
|
mainLayout->addWidget(lblHistTitle,0,0);
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
cloneplot2D = plot2D;
|
cloneplot2D = new SlsQt2DPlotLayout(cloneBox);
|
||||||
//cloneplot2D->setContentsMargins(0,0,0,0);
|
cloneplot2D->setFont(QFont("Sans Serif",9,QFont::Normal));
|
||||||
gridClone->addWidget(cloneplot2D,0,0);
|
cloneplot2D->SetXTitle(xTitle);
|
||||||
|
cloneplot2D->SetYTitle(yTitle);
|
||||||
|
cloneplot2D->SetZTitle(zTitle);
|
||||||
|
cloneplot2D->setAlignment(Qt::AlignLeft);
|
||||||
|
|
||||||
cloneBox->setFlat(true);
|
cloneBox->setFlat(true);
|
||||||
cloneBox->setContentsMargins(0,20,0,0);
|
cloneBox->setContentsMargins(0,20,0,0);
|
||||||
|
gridClone->addWidget(cloneplot2D,0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** main window widgets */
|
// main window widgets
|
||||||
mainLayout->addWidget(cloneBox,1,0);
|
mainLayout->addWidget(cloneBox,1,0);
|
||||||
setCentralWidget(centralWidget);
|
setCentralWidget(centralWidget);
|
||||||
|
|
||||||
/** Save */
|
// Save
|
||||||
connect(actionSave,SIGNAL(triggered()),this,SLOT(SavePlot()));
|
connect(actionSave,SIGNAL(triggered()),this,SLOT(SavePlot()));
|
||||||
|
|
||||||
setMinimumHeight(300);
|
setMinimumHeight(300);
|
||||||
@ -97,43 +112,35 @@ void qCloneWidget::SetupWidgetWindow(QString title,int numDim,SlsQt1DPlot*& plot
|
|||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
void qCloneWidget::SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis[],string histTitle[],bool lines,bool markers){
|
void qCloneWidget::SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis[],string histTitle[],bool lines,bool markers){
|
||||||
/** for each plot*/
|
//for each plot, create hists
|
||||||
for(int hist_num=0;hist_num<nHists;hist_num++){
|
for(int hist_num=0;hist_num<nHists;hist_num++){
|
||||||
/** create hists */
|
|
||||||
SlsQtH1D* k;
|
SlsQtH1D* k;
|
||||||
if(hist_num+1>cloneplot1D_hists.size()){
|
if(hist_num+1>cloneplot1D_hists.size()){
|
||||||
cloneplot1D_hists.append(k=new SlsQtH1D("1d plot",histNBins,histXAxis,histYAxis[hist_num]));
|
cloneplot1D_hists.append(k=new SlsQtH1D("1d plot",histNBins,histXAxis,histYAxis[hist_num]));
|
||||||
k->SetLineColor(hist_num+1);
|
k->SetLineColor(0);
|
||||||
}else{
|
}else{
|
||||||
k=cloneplot1D_hists.at(hist_num);
|
k=cloneplot1D_hists.at(hist_num);
|
||||||
k->SetData(histNBins,histXAxis,histYAxis[hist_num]);
|
k->SetData(histNBins,histXAxis,histYAxis[hist_num]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//style of plot
|
//style of plot
|
||||||
if(lines) k->setStyle(QwtPlotCurve::Lines);
|
if(lines) k->setStyle(QwtPlotCurve::Lines);
|
||||||
else k->setStyle(QwtPlotCurve::Dots);
|
else k->setStyle(QwtPlotCurve::Dots);
|
||||||
if(markers) {
|
|
||||||
QwtSymbol *marker = new QwtSymbol();
|
|
||||||
marker->setStyle(QwtSymbol::Cross);
|
|
||||||
marker->setSize(5,5);
|
|
||||||
#if QWT_VERSION<0x060000
|
#if QWT_VERSION<0x060000
|
||||||
k->setSymbol(*marker);
|
if(markers) k->setSymbol(*marker);
|
||||||
|
else k->setSymbol(*nomarker);
|
||||||
#else
|
#else
|
||||||
k->setSymbol(marker);
|
if(markers) k->setSymbol(marker);
|
||||||
|
else k->setSymbol(nomarker);
|
||||||
#endif
|
#endif
|
||||||
}else {
|
|
||||||
QwtSymbol *noMarker = new QwtSymbol();
|
|
||||||
#if QWT_VERSION<0x060000
|
|
||||||
k->setSymbol(*noMarker);
|
|
||||||
#else
|
|
||||||
k->setSymbol(noMarker);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
//set title and attach plot
|
//set title and attach plot
|
||||||
lblHistTitle->setText(QString(histTitle[0].c_str()));
|
lblHistTitle->setText(QString(histTitle[0].c_str()));
|
||||||
//k->setTitle(histTitle[hist_num].c_str());
|
|
||||||
k->Attach(cloneplot1D);
|
k->Attach(cloneplot1D);
|
||||||
}
|
}
|
||||||
//cloneplot1D->UnZoom();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -141,9 +148,8 @@ void qCloneWidget::SetCloneHists(int nHists,int histNBins,double* histXAxis,doub
|
|||||||
|
|
||||||
|
|
||||||
void qCloneWidget::SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis,string histTitle[],bool lines,bool markers){
|
void qCloneWidget::SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis,string histTitle[],bool lines,bool markers){
|
||||||
/** for each plot*/
|
// for each plot create hists
|
||||||
for(int hist_num=0;hist_num<nHists;hist_num++){
|
for(int hist_num=0;hist_num<nHists;hist_num++){
|
||||||
/** create hists */
|
|
||||||
SlsQtH1D* k;
|
SlsQtH1D* k;
|
||||||
if(hist_num+1>cloneplot1D_hists.size()){
|
if(hist_num+1>cloneplot1D_hists.size()){
|
||||||
cloneplot1D_hists.append(k=new SlsQtH1D("1d plot",histNBins,histXAxis,histYAxis));
|
cloneplot1D_hists.append(k=new SlsQtH1D("1d plot",histNBins,histXAxis,histYAxis));
|
||||||
@ -174,27 +180,53 @@ void qCloneWidget::SetCloneHists(int nHists,int histNBins,double* histXAxis,doub
|
|||||||
}
|
}
|
||||||
//set title and attach plot
|
//set title and attach plot
|
||||||
lblHistTitle->setText(QString(histTitle[0].c_str()));
|
lblHistTitle->setText(QString(histTitle[0].c_str()));
|
||||||
//k->setTitle(histTitle[hist_num].c_str());
|
|
||||||
k->Attach(cloneplot1D);
|
k->Attach(cloneplot1D);
|
||||||
}
|
}
|
||||||
//cloneplot1D->UnZoom();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
void qCloneWidget::SetCloneHists2D(int nbinsx,double xmin,double xmax,int nbinsy, double ymin, double ymax, double *d){
|
||||||
|
cloneplot2D->GetPlot()->SetData(nbinsx,xmin,xmax,nbinsy,ymin,ymax,d);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void qCloneWidget::SetRange(bool IsXYRange[],double XYRangeValues[]){
|
void qCloneWidget::SetRange(bool IsXYRange[],double XYRangeValues[]){
|
||||||
double XYCloneRangeValues[4];
|
double XYCloneRangeValues[4];
|
||||||
if(!IsXYRange[qDefs::XMINIMUM]) XYCloneRangeValues[qDefs::XMINIMUM]= cloneplot1D->GetXMinimum();
|
|
||||||
else XYCloneRangeValues[qDefs::XMINIMUM]= XYRangeValues[qDefs::XMINIMUM];
|
if(!IsXYRange[qDefs::XMINIMUM]){
|
||||||
if(!IsXYRange[qDefs::XMAXIMUM]) XYCloneRangeValues[qDefs::XMAXIMUM]= cloneplot1D->GetXMaximum();
|
if(cloneplot1D) XYCloneRangeValues[qDefs::XMINIMUM]= cloneplot1D->GetXMinimum();
|
||||||
else XYCloneRangeValues[qDefs::XMAXIMUM]= XYRangeValues[qDefs::XMAXIMUM];
|
else XYCloneRangeValues[qDefs::XMINIMUM]= cloneplot2D->GetPlot()->GetXMinimum();
|
||||||
if(!IsXYRange[qDefs::YMINIMUM]) XYCloneRangeValues[qDefs::YMINIMUM]= cloneplot1D->GetYMinimum();
|
}else XYCloneRangeValues[qDefs::XMINIMUM]= XYRangeValues[qDefs::XMINIMUM];
|
||||||
else XYCloneRangeValues[qDefs::YMINIMUM]= XYRangeValues[qDefs::YMINIMUM];
|
|
||||||
if(!IsXYRange[qDefs::YMAXIMUM]) XYCloneRangeValues[qDefs::YMAXIMUM]= cloneplot1D->GetYMaximum();
|
if(!IsXYRange[qDefs::XMAXIMUM]){
|
||||||
else XYCloneRangeValues[qDefs::YMAXIMUM]= XYRangeValues[qDefs::YMAXIMUM];
|
if(cloneplot1D) XYCloneRangeValues[qDefs::XMAXIMUM]= cloneplot1D->GetXMaximum();
|
||||||
cloneplot1D->SetXMinMax(XYCloneRangeValues[qDefs::XMINIMUM],XYCloneRangeValues[qDefs::XMAXIMUM]);
|
else XYCloneRangeValues[qDefs::XMINIMUM]= cloneplot2D->GetPlot()->GetXMaximum();
|
||||||
cloneplot1D->SetYMinMax(XYCloneRangeValues[qDefs::YMINIMUM],XYCloneRangeValues[qDefs::YMAXIMUM]);
|
}else XYCloneRangeValues[qDefs::XMAXIMUM]= XYRangeValues[qDefs::XMAXIMUM];
|
||||||
|
|
||||||
|
if(!IsXYRange[qDefs::YMINIMUM]){
|
||||||
|
if(cloneplot1D) XYCloneRangeValues[qDefs::YMINIMUM]= cloneplot1D->GetYMinimum();
|
||||||
|
else XYCloneRangeValues[qDefs::XMINIMUM]= cloneplot2D->GetPlot()->GetYMinimum();
|
||||||
|
}else XYCloneRangeValues[qDefs::YMINIMUM]= XYRangeValues[qDefs::YMINIMUM];
|
||||||
|
|
||||||
|
if(!IsXYRange[qDefs::YMAXIMUM]){
|
||||||
|
if(cloneplot1D) XYCloneRangeValues[qDefs::YMAXIMUM]= cloneplot1D->GetYMaximum();
|
||||||
|
else XYCloneRangeValues[qDefs::XMINIMUM]= cloneplot2D->GetPlot()->GetYMaximum();
|
||||||
|
}else XYCloneRangeValues[qDefs::YMAXIMUM]= XYRangeValues[qDefs::YMAXIMUM];
|
||||||
|
|
||||||
|
if(cloneplot1D){
|
||||||
|
cloneplot1D->SetXMinMax(XYCloneRangeValues[qDefs::XMINIMUM],XYCloneRangeValues[qDefs::XMAXIMUM]);
|
||||||
|
cloneplot1D->SetYMinMax(XYCloneRangeValues[qDefs::YMINIMUM],XYCloneRangeValues[qDefs::YMAXIMUM]);
|
||||||
|
}else{
|
||||||
|
cloneplot2D->GetPlot()->SetXMinMax(XYRangeValues[qDefs::XMINIMUM],XYRangeValues[qDefs::XMAXIMUM]);
|
||||||
|
cloneplot2D->GetPlot()->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -278,8 +278,7 @@ void qDetectorMain::Initialization(){
|
|||||||
//This should not be called as it will change file name to measurement when run finished
|
//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(UpdatingPlotFinished()), tab_plot, SLOT(Refresh()));
|
||||||
connect(myPlot, SIGNAL(SetCurrentMeasurementSignal(int)), tab_measurement, SLOT(SetCurrentMeasurement(int)));
|
connect(myPlot, SIGNAL(SetCurrentMeasurementSignal(int)), tab_measurement, SLOT(SetCurrentMeasurement(int)));
|
||||||
//to update all ranges when a clone has been made
|
|
||||||
connect(myPlot, SIGNAL(UpdateAfterCloningSignal()), tab_plot,SLOT(UpdateAfterCloning()));
|
|
||||||
|
|
||||||
// menubar
|
// menubar
|
||||||
// Modes Menu
|
// Modes Menu
|
||||||
@ -397,7 +396,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
|
|||||||
qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities");
|
qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities");
|
||||||
fName = QFileDialog::getOpenFileName(this,
|
fName = QFileDialog::getOpenFileName(this,
|
||||||
tr("Load Detector Setup"),fName,
|
tr("Load Detector Setup"),fName,
|
||||||
tr("Detector Setup files (*.det)"));
|
tr("Detector Setup files (*.det);;All Files(*)"));
|
||||||
// Gets called when cancelled as well
|
// Gets called when cancelled as well
|
||||||
if (!fName.isEmpty()){
|
if (!fName.isEmpty()){
|
||||||
if(myDet->retrieveDetectorSetup(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL){
|
if(myDet->retrieveDetectorSetup(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL){
|
||||||
@ -415,7 +414,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
|
|||||||
qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities");
|
qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities");
|
||||||
fName = QFileDialog::getSaveFileName(this,
|
fName = QFileDialog::getSaveFileName(this,
|
||||||
tr("Save Current Detector Setup"),fName,
|
tr("Save Current Detector Setup"),fName,
|
||||||
tr("Detector Setup files (*.det) "));
|
tr("Detector Setup files (*.det);;All Files(*) "));
|
||||||
// Gets called when cancelled as well
|
// Gets called when cancelled as well
|
||||||
if (!fName.isEmpty()){
|
if (!fName.isEmpty()){
|
||||||
if(myDet->dumpDetectorSetup(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL)
|
if(myDet->dumpDetectorSetup(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL)
|
||||||
@ -432,7 +431,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
|
|||||||
qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities");
|
qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities");
|
||||||
fName = QFileDialog::getOpenFileName(this,
|
fName = QFileDialog::getOpenFileName(this,
|
||||||
tr("Load Detector Configuration"),fName,
|
tr("Load Detector Configuration"),fName,
|
||||||
tr("Configuration files (*.config)"));
|
tr("Configuration files (*.config);;All Files(*)"));
|
||||||
// Gets called when cancelled as well
|
// Gets called when cancelled as well
|
||||||
if (!fName.isEmpty()){
|
if (!fName.isEmpty()){
|
||||||
if(myDet->readConfigurationFile(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL){
|
if(myDet->readConfigurationFile(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL){
|
||||||
@ -450,7 +449,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
|
|||||||
qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities");
|
qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities");
|
||||||
fName = QFileDialog::getSaveFileName(this,
|
fName = QFileDialog::getSaveFileName(this,
|
||||||
tr("Save Current Detector Configuration"),fName,
|
tr("Save Current Detector Configuration"),fName,
|
||||||
tr("Configuration files (*.config) "));
|
tr("Configuration files (*.config) ;;All Files(*)"));
|
||||||
// Gets called when cancelled as well
|
// Gets called when cancelled as well
|
||||||
if (!fName.isEmpty()){
|
if (!fName.isEmpty()){
|
||||||
if(myDet->writeConfigurationFile(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL)
|
if(myDet->writeConfigurationFile(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL)
|
||||||
@ -469,7 +468,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
|
|||||||
#endif
|
#endif
|
||||||
fName = QFileDialog::getOpenFileName(this,
|
fName = QFileDialog::getOpenFileName(this,
|
||||||
tr("Load Detector Settings"),fName,
|
tr("Load Detector Settings"),fName,
|
||||||
tr("Settings files (*.settings settings.sn*)"));
|
tr("Settings files (*.settings settings.sn*);;All Files(*)"));
|
||||||
// Gets called when cancelled as well
|
// Gets called when cancelled as well
|
||||||
if (!fName.isEmpty()){
|
if (!fName.isEmpty()){
|
||||||
if(myDet->loadSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL)
|
if(myDet->loadSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL)
|
||||||
@ -483,10 +482,14 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
|
|||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Loading Trimbits" << endl;
|
cout << "Loading Trimbits" << endl;
|
||||||
#endif
|
#endif
|
||||||
|
//so that even nonexisting files can be selected
|
||||||
fName = QFileDialog::getOpenFileName(this,
|
QFileDialog *fileDialog = new QFileDialog(this,
|
||||||
tr("Load Detector Trimbits"),fName,
|
tr("Load Detector Trimbits"),fName,
|
||||||
tr("Trimbit files (*.trim noise.sn*)"));
|
tr("Trimbit files (*.trim noise.sn*);;All Files(*)"));
|
||||||
|
fileDialog->setFileMode(QFileDialog::AnyFile );
|
||||||
|
if ( fileDialog->exec() == QDialog::Accepted )
|
||||||
|
fName = fileDialog->selectedFiles()[0];
|
||||||
|
|
||||||
// Gets called when cancelled as well
|
// Gets called when cancelled as well
|
||||||
if (!fName.isEmpty()){
|
if (!fName.isEmpty()){
|
||||||
if(myDet->loadSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL)
|
if(myDet->loadSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL)
|
||||||
@ -507,7 +510,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
|
|||||||
qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities");
|
qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities");
|
||||||
fName = QFileDialog::getSaveFileName(this,
|
fName = QFileDialog::getSaveFileName(this,
|
||||||
tr("Save Current Detector Settings"),fName,
|
tr("Save Current Detector Settings"),fName,
|
||||||
tr("Settings files (*.settings settings.sn*) "));
|
tr("Settings files (*.settings settings.sn*);;All Files(*) "));
|
||||||
// Gets called when cancelled as well
|
// Gets called when cancelled as well
|
||||||
if (!fName.isEmpty()){
|
if (!fName.isEmpty()){
|
||||||
if(myDet->saveSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL)
|
if(myDet->saveSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL)
|
||||||
@ -524,7 +527,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
|
|||||||
qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities");
|
qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities");
|
||||||
fName = QFileDialog::getSaveFileName(this,
|
fName = QFileDialog::getSaveFileName(this,
|
||||||
tr("Save Current Detector Trimbits"),fName,
|
tr("Save Current Detector Trimbits"),fName,
|
||||||
tr("Trimbit files (*.trim noise.sn*) "));
|
tr("Trimbit files (*.trim noise.sn*) ;;All Files(*)"));
|
||||||
// Gets called when cancelled as well
|
// Gets called when cancelled as well
|
||||||
if (!fName.isEmpty()){
|
if (!fName.isEmpty()){
|
||||||
if(myDet->saveSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL)
|
if(myDet->saveSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL)
|
||||||
@ -540,9 +543,15 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
|
|||||||
#endif
|
#endif
|
||||||
QString fName = QString(myDet->getCalDir());
|
QString fName = QString(myDet->getCalDir());
|
||||||
qDefs::checkErrorMessage(myDet);
|
qDefs::checkErrorMessage(myDet);
|
||||||
fName = QFileDialog::getOpenFileName(this,
|
|
||||||
|
//so that even nonexisting files can be selected
|
||||||
|
QFileDialog *fileDialog = new QFileDialog(this,
|
||||||
tr("Load Detector Calibration Data"),fName,
|
tr("Load Detector Calibration Data"),fName,
|
||||||
tr("Calibration files (*.cal calibration.sn*)"));
|
tr("Calibration files (*.cal calibration.sn*);;All Files(*)"));
|
||||||
|
fileDialog->setFileMode(QFileDialog::AnyFile );
|
||||||
|
if ( fileDialog->exec() == QDialog::Accepted )
|
||||||
|
fName = fileDialog->selectedFiles()[0];
|
||||||
|
|
||||||
// Gets called when cancelled as well
|
// Gets called when cancelled as well
|
||||||
if (!fName.isEmpty()){
|
if (!fName.isEmpty()){
|
||||||
if(myDet->loadCalibrationFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL)
|
if(myDet->loadCalibrationFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL)
|
||||||
@ -559,7 +568,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
|
|||||||
qDefs::checkErrorMessage(myDet);
|
qDefs::checkErrorMessage(myDet);
|
||||||
fName = QFileDialog::getSaveFileName(this,
|
fName = QFileDialog::getSaveFileName(this,
|
||||||
tr("Save Current Detector Calibration Data"),fName,
|
tr("Save Current Detector Calibration Data"),fName,
|
||||||
tr("Calibration files (*.cal calibration.sn*) "));
|
tr("Calibration files (*.cal calibration.sn*);;All Files(*) "));
|
||||||
// Gets called when cancelled as well
|
// Gets called when cancelled as well
|
||||||
if (!fName.isEmpty()){
|
if (!fName.isEmpty()){
|
||||||
if(myDet->saveCalibrationFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL)
|
if(myDet->saveCalibrationFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL)
|
||||||
|
@ -1413,21 +1413,23 @@ void qDrawPlot::StopUpdatePlot(){
|
|||||||
|
|
||||||
|
|
||||||
void qDrawPlot::ClonePlot(){
|
void qDrawPlot::ClonePlot(){
|
||||||
int i=0;
|
int i;
|
||||||
|
|
||||||
|
//check for space for more clone widget references
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for(i=0;i<MAXCloneWindows;i++)
|
for(i=0;i<MAXCloneWindows;i++)
|
||||||
if(!winClone[i]){
|
if(!winClone[i]){
|
||||||
found=true;
|
found=true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// no space for more clone widget references
|
// no space
|
||||||
if(!found){
|
if(!found){
|
||||||
cout << "Too many clones" << endl;
|
cout << "Too many clones" << endl;
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
// save height to keep maintain same height of plot
|
|
||||||
int preheight = height();
|
|
||||||
|
|
||||||
|
|
||||||
|
//get file path while acquisition runnign without accessing shared memory
|
||||||
string sFilePath;
|
string sFilePath;
|
||||||
if(running) sFilePath = filePath.toAscii().constData();
|
if(running) sFilePath = filePath.toAscii().constData();
|
||||||
else {
|
else {
|
||||||
@ -1439,73 +1441,35 @@ void qDrawPlot::ClonePlot(){
|
|||||||
|
|
||||||
LockLastImageArray();
|
LockLastImageArray();
|
||||||
|
|
||||||
//disconnect
|
|
||||||
disconnect(this, SIGNAL(InterpolateSignal(bool)), plot2D, SIGNAL(InterpolateSignal(bool)));
|
|
||||||
disconnect(this, SIGNAL(ContourSignal(bool)), plot2D, SIGNAL(ContourSignal(bool)));
|
|
||||||
disconnect(this, SIGNAL(LogzSignal(bool)), plot2D, SLOT(SetZScaleToLog(bool)));
|
|
||||||
disconnect(this, SIGNAL(LogySignal(bool)), plot1D, SLOT(SetLogY(bool)));
|
|
||||||
disconnect(this, SIGNAL(ResetZMinZMaxSignal(bool,bool,double,double)),plot2D, SLOT(ResetZMinZMax(bool,bool,double,double)));
|
|
||||||
disconnect(this, SIGNAL(SetZRangeSignal(double,double)), plot2D, SLOT(SetZRange(double,double)));
|
|
||||||
|
|
||||||
// create clone
|
// create clone & copy data
|
||||||
winClone[i] = new qCloneWidget(this,i,boxPlot->title(),(int)plot_in_scope,plot1D,plot2D,sFilePath,
|
|
||||||
displayStatistics,lblMinDisp->text(),lblMaxDisp->text(),lblSumDisp->text());
|
|
||||||
if(plot_in_scope==1){
|
if(plot_in_scope==1){
|
||||||
plot1D = new SlsQt1DPlot(boxPlot);
|
winClone[i] = new qCloneWidget(this,i,boxPlot->title(),histXAxisTitle,histYAxisTitle,"",
|
||||||
plot1D->setFont(QFont("Sans Serif",9,QFont::Normal));
|
(int)plot_in_scope,sFilePath,displayStatistics,lblMinDisp->text(),lblMaxDisp->text(),lblSumDisp->text());
|
||||||
plot1D->SetXTitle(histXAxisTitle.toAscii().constData());
|
if(!anglePlot)
|
||||||
plot1D->SetYTitle(histYAxisTitle.toAscii().constData());
|
winClone[i]->SetCloneHists((int)nHists,histNBins,histXAxis,histYAxis,histTitle,lines,markers);
|
||||||
plotLayout->addWidget(plot1D,0,0,1,1);
|
else
|
||||||
plotLayout->setContentsMargins(10,10,10,10);
|
winClone[i]->SetCloneHists((int)nHists,histNBins,histXAngleAxis,histYAngleAxis,histTitle,lines,markers);
|
||||||
if(running){
|
|
||||||
// update range
|
|
||||||
bool found =false;
|
|
||||||
for(int index=0;index<4;index++)
|
|
||||||
if(IsXYRange[index]){
|
|
||||||
found=true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if(found) winClone[i]->SetRange(IsXYRange,XYRangeValues);
|
|
||||||
//copy data
|
|
||||||
//LockLastImageArray();
|
|
||||||
if(!anglePlot)
|
|
||||||
winClone[i]->SetCloneHists((int)nHists,histNBins,histXAxis,histYAxis,histTitle,lines,markers);
|
|
||||||
else
|
|
||||||
winClone[i]->SetCloneHists((int)nHists,histNBins,histXAngleAxis,histYAngleAxis,histTitle,lines,markers);
|
|
||||||
//UnlockLastImageArray();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
|
|
||||||
plot2D = new SlsQt2DPlotLayout(boxPlot);
|
}else{
|
||||||
plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,startPixel,endPixel,lastImageArray);
|
winClone[i] = new qCloneWidget(this,i,boxPlot->title(),imageXAxisTitle, imageYAxisTitle, imageZAxisTitle,
|
||||||
plot2D->setFont(QFont("Sans Serif",9,QFont::Normal));
|
(int)plot_in_scope,sFilePath,displayStatistics,lblMinDisp->text(),lblMaxDisp->text(),lblSumDisp->text());
|
||||||
plot2D->setTitle(GetImageTitle());
|
winClone[i]->SetCloneHists2D(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,startPixel,endPixel,lastImageArray);
|
||||||
plot2D->SetXTitle(imageXAxisTitle);
|
|
||||||
plot2D->SetYTitle(imageYAxisTitle);
|
|
||||||
plot2D->SetZTitle(imageZAxisTitle);
|
|
||||||
plotLayout->addWidget(plot2D,0,0,1,1);
|
|
||||||
plotLayout->setContentsMargins(0,0,0,0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// update range
|
||||||
|
found =false;
|
||||||
|
for(int index=0;index<4;index++)
|
||||||
|
if(IsXYRange[index]){
|
||||||
|
found=true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(found)
|
||||||
|
winClone[i]->SetRange(IsXYRange,XYRangeValues);
|
||||||
|
|
||||||
|
|
||||||
UnlockLastImageArray();
|
UnlockLastImageArray();
|
||||||
|
|
||||||
|
|
||||||
setMinimumHeight(preheight);
|
|
||||||
resize(width(),preheight);
|
|
||||||
|
|
||||||
// update the actual plot only if running, else it doesnt know when its over
|
|
||||||
if(running) UpdatePlot();
|
|
||||||
connect(this, SIGNAL(InterpolateSignal(bool)), plot2D, SIGNAL(InterpolateSignal(bool)));
|
|
||||||
connect(this, SIGNAL(ContourSignal(bool)), plot2D, SIGNAL(ContourSignal(bool)));
|
|
||||||
connect(this, SIGNAL(LogzSignal(bool)), plot2D, SLOT(SetZScaleToLog(bool)));
|
|
||||||
connect(this, SIGNAL(LogySignal(bool)), plot1D, SLOT(SetLogY(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)));
|
|
||||||
|
|
||||||
//update ranges on current plot
|
|
||||||
emit UpdateAfterCloningSignal();
|
|
||||||
|
|
||||||
winClone[i]->show();
|
winClone[i]->show();
|
||||||
|
|
||||||
// to remember which all clone widgets were closed
|
// to remember which all clone widgets were closed
|
||||||
|
@ -368,9 +368,13 @@ void qTabAdvanced::BrowseOutputFile(){
|
|||||||
#endif
|
#endif
|
||||||
QString fName = dispFile->text();
|
QString fName = dispFile->text();
|
||||||
//dialog
|
//dialog
|
||||||
fName = QFileDialog::getSaveFileName(this,
|
QFileDialog *fileDialog = new QFileDialog(this,
|
||||||
tr("Choose file to write the trimbits to"),fName,
|
tr("Save Trimbits"),fName,
|
||||||
tr("Trimbit files (*.trim noise.sn*) "));
|
tr("Trimbit files (*.trim noise.sn*);;All Files(*) "));
|
||||||
|
fileDialog->setFileMode(QFileDialog::AnyFile );
|
||||||
|
if ( fileDialog->exec() == QDialog::Accepted )
|
||||||
|
fName = fileDialog->selectedFiles()[0];
|
||||||
|
|
||||||
//if empty, set the file name and it calls SetFileSteps, else ignore
|
//if empty, set the file name and it calls SetFileSteps, else ignore
|
||||||
if (!fName.isEmpty()){
|
if (!fName.isEmpty()){
|
||||||
dispFile->setText(fName);
|
dispFile->setText(fName);
|
||||||
|
@ -94,7 +94,7 @@ void qTabMessages::SaveLog() {
|
|||||||
QString fName = QString(myMainTab->GetFilePath());
|
QString fName = QString(myMainTab->GetFilePath());
|
||||||
fName = fName+"/LogFile.txt";
|
fName = fName+"/LogFile.txt";
|
||||||
fName = QFileDialog::getSaveFileName(this,tr("Save Snapshot "),
|
fName = QFileDialog::getSaveFileName(this,tr("Save Snapshot "),
|
||||||
fName,tr("Text files (*.txt)"));
|
fName,tr("Text files (*.txt);;All Files(*)"));
|
||||||
if (!fName.isEmpty()){
|
if (!fName.isEmpty()){
|
||||||
QFile outfile;
|
QFile outfile;
|
||||||
outfile.setFileName(fName);
|
outfile.setFileName(fName);
|
||||||
|
@ -962,32 +962,6 @@ void qTabPlot::Refresh(){
|
|||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
void qTabPlot::UpdateAfterCloning(){
|
|
||||||
#ifdef VERBOSE
|
|
||||||
cout << endl << "**Updating Plot After Cloning" << endl;
|
|
||||||
#endif
|
|
||||||
EnableRange();
|
|
||||||
EnableTitles();
|
|
||||||
myPlot->UpdateAfterCloning(
|
|
||||||
chkPoints->isChecked(),
|
|
||||||
chk1DLog->isChecked(),
|
|
||||||
chkInterpolate->isChecked(),
|
|
||||||
chkContour->isChecked(),
|
|
||||||
chkLogz->isChecked());
|
|
||||||
|
|
||||||
//1d
|
|
||||||
if(isOneD)
|
|
||||||
EnablePersistency(chkSuperimpose->isChecked());
|
|
||||||
//2d
|
|
||||||
else
|
|
||||||
EnableZRange();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
void qTabPlot::SetBinary(){
|
void qTabPlot::SetBinary(){
|
||||||
//1d
|
//1d
|
||||||
if(isOneD){
|
if(isOneD){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user