mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 23:10:02 +02:00
bug fix: plot tab refresh doesnt change plot
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@79 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
parent
bdabf9e649
commit
1eb07b31f6
@ -38,7 +38,13 @@ public:
|
||||
*/
|
||||
~qTabPlot();
|
||||
|
||||
/** Sets the scan argument of the plot
|
||||
*/
|
||||
void SetScanArgument();
|
||||
|
||||
/** To refresh and update widgets
|
||||
*/
|
||||
void Refresh();
|
||||
|
||||
|
||||
private:
|
||||
@ -59,7 +65,6 @@ private:
|
||||
|
||||
|
||||
|
||||
|
||||
public slots:
|
||||
/** Set frequency between plots*/
|
||||
void SetFrequency();
|
||||
@ -74,13 +79,8 @@ void EnableScanBox();
|
||||
*/
|
||||
void EnableNthFrame(bool enable){enableNFrame = enable;};
|
||||
|
||||
/** Sets the scan argument of the plot
|
||||
*/
|
||||
void SetScanArgument();
|
||||
|
||||
/** To refresh and update widgets
|
||||
*/
|
||||
void Refresh();
|
||||
|
||||
|
||||
|
||||
/** Disables scanbox while running
|
||||
|
@ -6,7 +6,7 @@ UI_HEADERS_DIR = forms/include
|
||||
RESOURCES += icons.qrc
|
||||
|
||||
|
||||
DEFINES += VERBOSE DACS_INT #VERYVERBOSE
|
||||
DEFINES += VERBOSE DACS_INT VERYVERBOSE
|
||||
|
||||
|
||||
target.path += $(DESTDIR)
|
||||
|
@ -529,14 +529,7 @@ void qDetectorMain::Refresh(int index){
|
||||
tabs->setCurrentIndex((index++)<(tabs->count()-1)?index:Measurement);
|
||||
else{
|
||||
switch(tabs->currentIndex()){
|
||||
case Measurement:
|
||||
if(!myPlot->isRunning()) {
|
||||
tab_measurement->Refresh();
|
||||
//to recover from a trimbit plot mode
|
||||
tab_plot->Refresh();
|
||||
}
|
||||
break;
|
||||
|
||||
case Measurement: tab_measurement->Refresh(); break;
|
||||
case Settings: tab_settings->Refresh(); break;
|
||||
case DataOutput: tab_dataoutput->Refresh(); break;
|
||||
case Plot: tab_plot->Refresh(); break;
|
||||
@ -642,7 +635,7 @@ void qDetectorMain::EnableTabs(){
|
||||
//moved to here, so that its all in order, instead of signals and different threads
|
||||
if(!enable) {
|
||||
//set the plot type first(acccss shared memory)
|
||||
tab_plot->Refresh();
|
||||
tab_plot->SetScanArgument();
|
||||
//sets running to true
|
||||
myPlot->StartStopDaqToggle();
|
||||
}
|
||||
|
@ -530,8 +530,6 @@ int qDrawPlot::GetData(detectorData *data){
|
||||
#endif
|
||||
if(!stop_signal){
|
||||
|
||||
//set title
|
||||
SetPlotTitle(QString(data->fileName).section('/',-1));
|
||||
//set progress
|
||||
progress=(int)data->progressIndex;
|
||||
currentFileIndex = fileIOStatic::getFileIndexFromFileName(string(data->fileName));
|
||||
@ -548,6 +546,9 @@ int qDrawPlot::GetData(detectorData *data){
|
||||
//angle plotting
|
||||
if(anglePlot){
|
||||
if(!pthread_mutex_trylock(&(last_image_complete_mutex))){
|
||||
//set title
|
||||
SetPlotTitle(QString(data->fileName).section('/',-1));
|
||||
|
||||
cout<<"angle plot"<<endl;
|
||||
if(data->angles==NULL){
|
||||
cout<<"\n\nWARNING:RETURNED NULL instead of angles."<<endl;
|
||||
@ -614,6 +615,8 @@ int qDrawPlot::GetData(detectorData *data){
|
||||
if(scanArgument==AllFrames){
|
||||
while(1){
|
||||
if(!pthread_mutex_trylock(&(last_image_complete_mutex))){
|
||||
//set title
|
||||
SetPlotTitle(QString(data->fileName).section('/',-1));
|
||||
//variables
|
||||
lastImageNumber= currentFrame+1;
|
||||
//title
|
||||
@ -634,6 +637,8 @@ int qDrawPlot::GetData(detectorData *data){
|
||||
if(scanArgument==FileIndex){
|
||||
while(1){
|
||||
if(!pthread_mutex_trylock(&(last_image_complete_mutex))){
|
||||
//set title
|
||||
SetPlotTitle(QString(data->fileName).section('/',-1));
|
||||
//variables
|
||||
if(currentFileIndex == minPixelsY) currentScanDivLevel = 0;
|
||||
lastImageNumber= currentFrame+1;
|
||||
@ -655,6 +660,8 @@ int qDrawPlot::GetData(detectorData *data){
|
||||
if(scanArgument==Level0){
|
||||
while(1){
|
||||
if(!pthread_mutex_trylock(&(last_image_complete_mutex))){
|
||||
//set title
|
||||
SetPlotTitle(QString(data->fileName).section('/',-1));
|
||||
//get scanvariable0
|
||||
int ci = 0, p = 0; double cs0 = 0 , cs1 = 0;
|
||||
fileIOStatic::getVariablesFromFileName(string(data->fileName), ci, p, cs0, cs1);
|
||||
@ -683,6 +690,8 @@ int qDrawPlot::GetData(detectorData *data){
|
||||
//level1
|
||||
while(1){
|
||||
if(!pthread_mutex_trylock(&(last_image_complete_mutex))){
|
||||
//set title
|
||||
SetPlotTitle(QString(data->fileName).section('/',-1));
|
||||
//get scanvariable1
|
||||
int ci = 0, p = 0; double cs0 = 0 , cs1 = 0;
|
||||
fileIOStatic::getVariablesFromFileName(string(data->fileName), ci, p, cs0, cs1);
|
||||
@ -710,6 +719,8 @@ int qDrawPlot::GetData(detectorData *data){
|
||||
|
||||
//normal measurement or 1d scans
|
||||
if(!pthread_mutex_trylock(&(last_image_complete_mutex))){
|
||||
//set title
|
||||
SetPlotTitle(QString(data->fileName).section('/',-1));
|
||||
char temp_title[2000];
|
||||
// only if you got the lock, do u need to remember lastimagenumber to plot
|
||||
lastImageNumber= currentFrame+1;
|
||||
@ -879,8 +890,7 @@ 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();
|
||||
@ -957,6 +967,9 @@ void qDrawPlot::UpdatePlot(){
|
||||
}
|
||||
last_plot_number=lastImageNumber;
|
||||
|
||||
//set plot title
|
||||
boxPlot->setTitle(plotTitle);
|
||||
|
||||
if(plotEnable) UnlockLastImageArray();
|
||||
|
||||
|
||||
|
@ -150,6 +150,8 @@ void qTabPlot::SetupWidgetWindow(){
|
||||
}
|
||||
|
||||
Select1DPlot(isOrginallyOneD);
|
||||
if(isOrginallyOneD) myPlot->Select1DPlot();
|
||||
else myPlot->Select2DPlot();
|
||||
|
||||
//to check if this should be enabled
|
||||
EnableScanBox();
|
||||
@ -167,14 +169,12 @@ void qTabPlot::Select1DPlot(bool b){
|
||||
chkZAxis->setEnabled(false);
|
||||
chkZMin->setEnabled(false);
|
||||
chkZMax->setEnabled(false);
|
||||
myPlot->Select1DPlot();
|
||||
}else{
|
||||
box1D->hide();
|
||||
box2D->show();
|
||||
chkZAxis->setEnabled(true);
|
||||
chkZMin->setEnabled(true);
|
||||
chkZMax->setEnabled(true);
|
||||
myPlot->Select2DPlot();
|
||||
}
|
||||
}
|
||||
|
||||
@ -188,7 +188,7 @@ void qTabPlot::Initialization(){
|
||||
connect(radioHistogram, SIGNAL(toggled(bool)),this, SLOT(SetPlot()));
|
||||
connect(radioDataGraph, SIGNAL(toggled(bool)),this, SLOT(SetPlot()));
|
||||
// Scan box
|
||||
connect(btnGroupScan, SIGNAL(buttonClicked(QAbstractButton *)),this, SLOT(SetScanArgument()));
|
||||
/*connect(btnGroupScan, SIGNAL(buttonClicked(QAbstractButton *)),this, SLOT(SetScanArgument()));*/
|
||||
connect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox()));
|
||||
// Snapshot box
|
||||
connect(btnClone, SIGNAL(clicked()),myPlot, SLOT(ClonePlot()));
|
||||
@ -421,6 +421,8 @@ void qTabPlot::SetPlot(){
|
||||
if(isOrginallyOneD) {box1D->show(); box2D->hide();}
|
||||
if(!isOrginallyOneD) {box2D->show(); box1D->hide();}
|
||||
Select1DPlot(isOrginallyOneD);
|
||||
if(isOrginallyOneD) myPlot->Select1DPlot();
|
||||
else myPlot->Select2DPlot();
|
||||
boxSnapshot->setEnabled(true);
|
||||
boxSave->setEnabled(true);
|
||||
boxFrequency->setEnabled(true);
|
||||
@ -554,7 +556,7 @@ void qTabPlot::EnableScanBox(){
|
||||
|
||||
|
||||
//sets the scan argument
|
||||
SetScanArgument();
|
||||
/*SetScanArgument();*/
|
||||
}
|
||||
|
||||
|
||||
@ -602,30 +604,36 @@ void qTabPlot::SetScanArgument(){
|
||||
myPlot->SetImageZAxisTitle(defaultImageZAxisTitle);
|
||||
}
|
||||
Select1DPlot(isOrginallyOneD);
|
||||
if(isOrginallyOneD) myPlot->Select1DPlot();
|
||||
else myPlot->Select2DPlot();
|
||||
|
||||
int ang;
|
||||
//if scans(1D or 2D)
|
||||
if(boxScan->isEnabled()){
|
||||
//setting the title according to the scans
|
||||
QString mainTitle = QString(" Level 0 : ") + modeNames[myDet->getScanMode(0)] +
|
||||
QString(" | Level 1 : ") + modeNames[myDet->getScanMode(1)] + QString("");
|
||||
QString(" | Level 1 : ") + modeNames[myDet->getScanMode(1)] + QString("");
|
||||
dispTitle->setText(mainTitle);
|
||||
myPlot->SetPlotTitle(mainTitle);
|
||||
Select1DPlot(isOrginallyOneD);
|
||||
if(isOrginallyOneD) myPlot->Select1DPlot();
|
||||
else myPlot->Select2DPlot();
|
||||
|
||||
}//angles (1D)
|
||||
else if(myDet->getAngularConversion(ang)){
|
||||
//else if(myDet->getPositions()){
|
||||
//else if(myDet->getPositions()){
|
||||
//if scan, change title
|
||||
if((myDet->getScanMode(0))||(myDet->getScanMode(1))){
|
||||
QString mainTitle = QString(" Level 0 : ") + modeNames[myDet->getScanMode(0)] +
|
||||
QString(" | Level 1 : ") + modeNames[myDet->getScanMode(1)] + QString("");
|
||||
QString(" | Level 1 : ") + modeNames[myDet->getScanMode(1)] + QString("");
|
||||
dispTitle->setText(mainTitle);
|
||||
myPlot->SetPlotTitle(mainTitle);
|
||||
}
|
||||
dispXAxis->setText("Angles");
|
||||
myPlot->SetHistXAxisTitle("Angles");
|
||||
Select1DPlot(true);
|
||||
myPlot->Select1DPlot();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -669,11 +677,10 @@ void qTabPlot::SetScanArgument(){
|
||||
}else //done here so that it isnt set by default each time
|
||||
myPlot->SetScanArgument(0);
|
||||
|
||||
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qTabPlot::Refresh(){
|
||||
#ifdef VERBOSE
|
||||
|
Loading…
x
Reference in New Issue
Block a user