mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 23:10:02 +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:
|
||||
/** \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);
|
||||
|
||||
/** Destructor
|
||||
@ -56,11 +56,12 @@ public:
|
||||
|
||||
/** Sets up the widget window
|
||||
* @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 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);
|
||||
|
||||
/** 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
|
||||
* @param IsXYRange array of x,y,min,max if these values are set
|
||||
* @param XYRangeValues array of set values of x,y, min, max
|
||||
@ -115,9 +127,11 @@ private:
|
||||
/** vector of 1D hist values */
|
||||
QVector<SlsQtH1D*> cloneplot1D_hists;
|
||||
|
||||
/** markers for the plot*/
|
||||
QwtSymbol *marker;
|
||||
QwtSymbol *nomarker;
|
||||
|
||||
QMenuBar *menubar;
|
||||
// QMenu *menuFile;
|
||||
QAction *actionSave;
|
||||
|
||||
QGridLayout *mainLayout;
|
||||
|
@ -579,7 +579,6 @@ void ResetZMinZMaxSignal(bool,bool,double,double);
|
||||
void SetCurrentMeasurementSignal(int);
|
||||
void saveErrorSignal(QString);
|
||||
void AcquisitionErrorSignal(QString);
|
||||
void UpdateAfterCloningSignal();
|
||||
};
|
||||
|
||||
|
||||
|
@ -107,10 +107,6 @@ public slots:
|
||||
*/
|
||||
void EnableScanBox(bool Histo=false);
|
||||
|
||||
/** Update all ranges, interpolate etc after cloning
|
||||
*/
|
||||
void UpdateAfterCloning();
|
||||
|
||||
|
||||
private slots:
|
||||
/** 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,
|
||||
bool displayStats, QString min, QString max, QString sum):
|
||||
qCloneWidget::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):
|
||||
QMainWindow(parent),id(id),cloneplot2D(0),cloneplot1D(0),filePath(FilePath)
|
||||
{
|
||||
/** Window title*/
|
||||
// Window title
|
||||
char winTitle[300],currTime[50];
|
||||
strcpy(currTime,GetCurrentTimeStamp());
|
||||
sprintf(winTitle,"Snapshot:%d - %s",id,currTime);
|
||||
setWindowTitle(QString(winTitle));
|
||||
|
||||
/** Set up widget*/
|
||||
SetupWidgetWindow(title,numDim,plot1D,plot2D);
|
||||
marker = new QwtSymbol();
|
||||
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);
|
||||
}
|
||||
|
||||
@ -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);
|
||||
//menuFile = new QMenu("&File",menubar);
|
||||
actionSave = new QAction("&Save",this);
|
||||
// menubar->addAction(menuFile->menuAction());
|
||||
menubar->addAction(actionSave);
|
||||
setMenuBar(menubar);
|
||||
|
||||
|
||||
/** Main Window Layout */
|
||||
//Main Window Layout
|
||||
QWidget *centralWidget = new QWidget(this);
|
||||
mainLayout = new QGridLayout(centralWidget);
|
||||
centralWidget->setLayout(mainLayout);
|
||||
|
||||
/** plot group box*/
|
||||
//plot group box
|
||||
cloneBox = new QGroupBox(this);
|
||||
gridClone = new QGridLayout(cloneBox);
|
||||
cloneBox->setLayout(gridClone);
|
||||
cloneBox->setContentsMargins(0,0,0,0);
|
||||
cloneBox->setTitle(title);
|
||||
cloneBox->setAlignment(Qt::AlignHCenter);
|
||||
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){
|
||||
cloneplot1D = plot1D;
|
||||
gridClone->addWidget(cloneplot1D,0,0);
|
||||
cloneplot1D = new SlsQt1DPlot(cloneBox);
|
||||
|
||||
cloneplot1D->setFont(QFont("Sans Serif",9,QFont::Normal));
|
||||
cloneplot1D->SetXTitle(xTitle.toAscii().constData());
|
||||
cloneplot1D->SetYTitle(yTitle.toAscii().constData());
|
||||
|
||||
|
||||
cloneBox->setFlat(false);
|
||||
cloneBox->setContentsMargins(0,30,0,0);
|
||||
gridClone->addWidget(cloneplot1D,0,0);
|
||||
|
||||
lblHistTitle = new QLabel("");
|
||||
mainLayout->addWidget(lblHistTitle,0,0);
|
||||
|
||||
}else{
|
||||
cloneplot2D = plot2D;
|
||||
//cloneplot2D->setContentsMargins(0,0,0,0);
|
||||
gridClone->addWidget(cloneplot2D,0,0);
|
||||
cloneplot2D = new SlsQt2DPlotLayout(cloneBox);
|
||||
cloneplot2D->setFont(QFont("Sans Serif",9,QFont::Normal));
|
||||
cloneplot2D->SetXTitle(xTitle);
|
||||
cloneplot2D->SetYTitle(yTitle);
|
||||
cloneplot2D->SetZTitle(zTitle);
|
||||
cloneplot2D->setAlignment(Qt::AlignLeft);
|
||||
|
||||
cloneBox->setFlat(true);
|
||||
cloneBox->setContentsMargins(0,20,0,0);
|
||||
gridClone->addWidget(cloneplot2D,0,0);
|
||||
}
|
||||
|
||||
/** main window widgets */
|
||||
// main window widgets
|
||||
mainLayout->addWidget(cloneBox,1,0);
|
||||
setCentralWidget(centralWidget);
|
||||
|
||||
/** Save */
|
||||
// Save
|
||||
connect(actionSave,SIGNAL(triggered()),this,SLOT(SavePlot()));
|
||||
|
||||
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){
|
||||
/** for each plot*/
|
||||
//for each plot, create hists
|
||||
for(int hist_num=0;hist_num<nHists;hist_num++){
|
||||
/** create hists */
|
||||
SlsQtH1D* k;
|
||||
if(hist_num+1>cloneplot1D_hists.size()){
|
||||
cloneplot1D_hists.append(k=new SlsQtH1D("1d plot",histNBins,histXAxis,histYAxis[hist_num]));
|
||||
k->SetLineColor(hist_num+1);
|
||||
k->SetLineColor(0);
|
||||
}else{
|
||||
k=cloneplot1D_hists.at(hist_num);
|
||||
k->SetData(histNBins,histXAxis,histYAxis[hist_num]);
|
||||
}
|
||||
|
||||
|
||||
//style of plot
|
||||
if(lines) k->setStyle(QwtPlotCurve::Lines);
|
||||
else k->setStyle(QwtPlotCurve::Dots);
|
||||
if(markers) {
|
||||
QwtSymbol *marker = new QwtSymbol();
|
||||
marker->setStyle(QwtSymbol::Cross);
|
||||
marker->setSize(5,5);
|
||||
if(lines) k->setStyle(QwtPlotCurve::Lines);
|
||||
else k->setStyle(QwtPlotCurve::Dots);
|
||||
#if QWT_VERSION<0x060000
|
||||
k->setSymbol(*marker);
|
||||
if(markers) k->setSymbol(*marker);
|
||||
else k->setSymbol(*nomarker);
|
||||
#else
|
||||
k->setSymbol(marker);
|
||||
if(markers) k->setSymbol(marker);
|
||||
else k->setSymbol(nomarker);
|
||||
#endif
|
||||
}else {
|
||||
QwtSymbol *noMarker = new QwtSymbol();
|
||||
#if QWT_VERSION<0x060000
|
||||
k->setSymbol(*noMarker);
|
||||
#else
|
||||
k->setSymbol(noMarker);
|
||||
#endif
|
||||
}
|
||||
|
||||
//set title and attach plot
|
||||
lblHistTitle->setText(QString(histTitle[0].c_str()));
|
||||
//k->setTitle(histTitle[hist_num].c_str());
|
||||
|
||||
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){
|
||||
/** for each plot*/
|
||||
// for each plot create hists
|
||||
for(int hist_num=0;hist_num<nHists;hist_num++){
|
||||
/** create hists */
|
||||
SlsQtH1D* k;
|
||||
if(hist_num+1>cloneplot1D_hists.size()){
|
||||
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
|
||||
lblHistTitle->setText(QString(histTitle[0].c_str()));
|
||||
//k->setTitle(histTitle[hist_num].c_str());
|
||||
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[]){
|
||||
double XYCloneRangeValues[4];
|
||||
if(!IsXYRange[qDefs::XMINIMUM]) XYCloneRangeValues[qDefs::XMINIMUM]= cloneplot1D->GetXMinimum();
|
||||
else XYCloneRangeValues[qDefs::XMINIMUM]= XYRangeValues[qDefs::XMINIMUM];
|
||||
if(!IsXYRange[qDefs::XMAXIMUM]) XYCloneRangeValues[qDefs::XMAXIMUM]= cloneplot1D->GetXMaximum();
|
||||
else XYCloneRangeValues[qDefs::XMAXIMUM]= XYRangeValues[qDefs::XMAXIMUM];
|
||||
if(!IsXYRange[qDefs::YMINIMUM]) XYCloneRangeValues[qDefs::YMINIMUM]= cloneplot1D->GetYMinimum();
|
||||
else XYCloneRangeValues[qDefs::YMINIMUM]= XYRangeValues[qDefs::YMINIMUM];
|
||||
if(!IsXYRange[qDefs::YMAXIMUM]) XYCloneRangeValues[qDefs::YMAXIMUM]= cloneplot1D->GetYMaximum();
|
||||
else XYCloneRangeValues[qDefs::YMAXIMUM]= XYRangeValues[qDefs::YMAXIMUM];
|
||||
cloneplot1D->SetXMinMax(XYCloneRangeValues[qDefs::XMINIMUM],XYCloneRangeValues[qDefs::XMAXIMUM]);
|
||||
cloneplot1D->SetYMinMax(XYCloneRangeValues[qDefs::YMINIMUM],XYCloneRangeValues[qDefs::YMAXIMUM]);
|
||||
|
||||
if(!IsXYRange[qDefs::XMINIMUM]){
|
||||
if(cloneplot1D) XYCloneRangeValues[qDefs::XMINIMUM]= cloneplot1D->GetXMinimum();
|
||||
else XYCloneRangeValues[qDefs::XMINIMUM]= cloneplot2D->GetPlot()->GetXMinimum();
|
||||
}else XYCloneRangeValues[qDefs::XMINIMUM]= XYRangeValues[qDefs::XMINIMUM];
|
||||
|
||||
if(!IsXYRange[qDefs::XMAXIMUM]){
|
||||
if(cloneplot1D) XYCloneRangeValues[qDefs::XMAXIMUM]= cloneplot1D->GetXMaximum();
|
||||
else XYCloneRangeValues[qDefs::XMINIMUM]= cloneplot2D->GetPlot()->GetXMaximum();
|
||||
}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
|
||||
//connect(myPlot, SIGNAL(UpdatingPlotFinished()), tab_plot, SLOT(Refresh()));
|
||||
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
|
||||
// Modes Menu
|
||||
@ -397,7 +396,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
|
||||
qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities");
|
||||
fName = QFileDialog::getOpenFileName(this,
|
||||
tr("Load Detector Setup"),fName,
|
||||
tr("Detector Setup files (*.det)"));
|
||||
tr("Detector Setup files (*.det);;All Files(*)"));
|
||||
// Gets called when cancelled as well
|
||||
if (!fName.isEmpty()){
|
||||
if(myDet->retrieveDetectorSetup(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL){
|
||||
@ -415,7 +414,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
|
||||
qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities");
|
||||
fName = QFileDialog::getSaveFileName(this,
|
||||
tr("Save Current Detector Setup"),fName,
|
||||
tr("Detector Setup files (*.det) "));
|
||||
tr("Detector Setup files (*.det);;All Files(*) "));
|
||||
// Gets called when cancelled as well
|
||||
if (!fName.isEmpty()){
|
||||
if(myDet->dumpDetectorSetup(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL)
|
||||
@ -432,7 +431,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
|
||||
qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities");
|
||||
fName = QFileDialog::getOpenFileName(this,
|
||||
tr("Load Detector Configuration"),fName,
|
||||
tr("Configuration files (*.config)"));
|
||||
tr("Configuration files (*.config);;All Files(*)"));
|
||||
// Gets called when cancelled as well
|
||||
if (!fName.isEmpty()){
|
||||
if(myDet->readConfigurationFile(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL){
|
||||
@ -450,7 +449,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
|
||||
qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities");
|
||||
fName = QFileDialog::getSaveFileName(this,
|
||||
tr("Save Current Detector Configuration"),fName,
|
||||
tr("Configuration files (*.config) "));
|
||||
tr("Configuration files (*.config) ;;All Files(*)"));
|
||||
// Gets called when cancelled as well
|
||||
if (!fName.isEmpty()){
|
||||
if(myDet->writeConfigurationFile(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL)
|
||||
@ -469,7 +468,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
|
||||
#endif
|
||||
fName = QFileDialog::getOpenFileName(this,
|
||||
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
|
||||
if (!fName.isEmpty()){
|
||||
if(myDet->loadSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL)
|
||||
@ -483,10 +482,14 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
|
||||
#ifdef VERBOSE
|
||||
cout << "Loading Trimbits" << endl;
|
||||
#endif
|
||||
|
||||
fName = QFileDialog::getOpenFileName(this,
|
||||
//so that even nonexisting files can be selected
|
||||
QFileDialog *fileDialog = new QFileDialog(this,
|
||||
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
|
||||
if (!fName.isEmpty()){
|
||||
if(myDet->loadSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL)
|
||||
@ -507,7 +510,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
|
||||
qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities");
|
||||
fName = QFileDialog::getSaveFileName(this,
|
||||
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
|
||||
if (!fName.isEmpty()){
|
||||
if(myDet->saveSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL)
|
||||
@ -524,7 +527,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
|
||||
qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities");
|
||||
fName = QFileDialog::getSaveFileName(this,
|
||||
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
|
||||
if (!fName.isEmpty()){
|
||||
if(myDet->saveSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL)
|
||||
@ -540,9 +543,15 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
|
||||
#endif
|
||||
QString fName = QString(myDet->getCalDir());
|
||||
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("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
|
||||
if (!fName.isEmpty()){
|
||||
if(myDet->loadCalibrationFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL)
|
||||
@ -559,7 +568,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
|
||||
qDefs::checkErrorMessage(myDet);
|
||||
fName = QFileDialog::getSaveFileName(this,
|
||||
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
|
||||
if (!fName.isEmpty()){
|
||||
if(myDet->saveCalibrationFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL)
|
||||
|
@ -1413,21 +1413,23 @@ void qDrawPlot::StopUpdatePlot(){
|
||||
|
||||
|
||||
void qDrawPlot::ClonePlot(){
|
||||
int i=0;
|
||||
int i;
|
||||
|
||||
//check for space for more clone widget references
|
||||
bool found = false;
|
||||
for(i=0;i<MAXCloneWindows;i++)
|
||||
if(!winClone[i]){
|
||||
found=true;
|
||||
break;
|
||||
}
|
||||
// no space for more clone widget references
|
||||
// no space
|
||||
if(!found){
|
||||
cout << "Too many clones" << endl;
|
||||
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;
|
||||
if(running) sFilePath = filePath.toAscii().constData();
|
||||
else {
|
||||
@ -1439,73 +1441,35 @@ void qDrawPlot::ClonePlot(){
|
||||
|
||||
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
|
||||
winClone[i] = new qCloneWidget(this,i,boxPlot->title(),(int)plot_in_scope,plot1D,plot2D,sFilePath,
|
||||
displayStatistics,lblMinDisp->text(),lblMaxDisp->text(),lblSumDisp->text());
|
||||
// create clone & copy data
|
||||
if(plot_in_scope==1){
|
||||
plot1D = new SlsQt1DPlot(boxPlot);
|
||||
plot1D->setFont(QFont("Sans Serif",9,QFont::Normal));
|
||||
plot1D->SetXTitle(histXAxisTitle.toAscii().constData());
|
||||
plot1D->SetYTitle(histYAxisTitle.toAscii().constData());
|
||||
plotLayout->addWidget(plot1D,0,0,1,1);
|
||||
plotLayout->setContentsMargins(10,10,10,10);
|
||||
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{
|
||||
winClone[i] = new qCloneWidget(this,i,boxPlot->title(),histXAxisTitle,histYAxisTitle,"",
|
||||
(int)plot_in_scope,sFilePath,displayStatistics,lblMinDisp->text(),lblMaxDisp->text(),lblSumDisp->text());
|
||||
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);
|
||||
|
||||
plot2D = new SlsQt2DPlotLayout(boxPlot);
|
||||
plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,startPixel,endPixel,lastImageArray);
|
||||
plot2D->setFont(QFont("Sans Serif",9,QFont::Normal));
|
||||
plot2D->setTitle(GetImageTitle());
|
||||
plot2D->SetXTitle(imageXAxisTitle);
|
||||
plot2D->SetYTitle(imageYAxisTitle);
|
||||
plot2D->SetZTitle(imageZAxisTitle);
|
||||
plotLayout->addWidget(plot2D,0,0,1,1);
|
||||
plotLayout->setContentsMargins(0,0,0,0);
|
||||
}else{
|
||||
winClone[i] = new qCloneWidget(this,i,boxPlot->title(),imageXAxisTitle, imageYAxisTitle, imageZAxisTitle,
|
||||
(int)plot_in_scope,sFilePath,displayStatistics,lblMinDisp->text(),lblMaxDisp->text(),lblSumDisp->text());
|
||||
winClone[i]->SetCloneHists2D(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,startPixel,endPixel,lastImageArray);
|
||||
}
|
||||
|
||||
// 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();
|
||||
|
||||
|
||||
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();
|
||||
|
||||
// to remember which all clone widgets were closed
|
||||
|
@ -368,9 +368,13 @@ void qTabAdvanced::BrowseOutputFile(){
|
||||
#endif
|
||||
QString fName = dispFile->text();
|
||||
//dialog
|
||||
fName = QFileDialog::getSaveFileName(this,
|
||||
tr("Choose file to write the trimbits to"),fName,
|
||||
tr("Trimbit files (*.trim noise.sn*) "));
|
||||
QFileDialog *fileDialog = new QFileDialog(this,
|
||||
tr("Save Trimbits"),fName,
|
||||
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 (!fName.isEmpty()){
|
||||
dispFile->setText(fName);
|
||||
|
@ -94,7 +94,7 @@ void qTabMessages::SaveLog() {
|
||||
QString fName = QString(myMainTab->GetFilePath());
|
||||
fName = fName+"/LogFile.txt";
|
||||
fName = QFileDialog::getSaveFileName(this,tr("Save Snapshot "),
|
||||
fName,tr("Text files (*.txt)"));
|
||||
fName,tr("Text files (*.txt);;All Files(*)"));
|
||||
if (!fName.isEmpty()){
|
||||
QFile outfile;
|
||||
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(){
|
||||
//1d
|
||||
if(isOneD){
|
||||
|
Loading…
x
Reference in New Issue
Block a user