mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-22 22:40:02 +02:00
constant size scan widget works properly now
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@42 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
parent
86ccd014ab
commit
fa5817ab77
@ -101,7 +101,15 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QRadioButton" name="radioRange">
|
<widget class="QRadioButton" name="radioRange">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><nobr>Defines scan range for a constant step size.</nobr></string>
|
<string><nobr>
|
||||||
|
Defines scan range for a <b>Constant Step Size</b> with the following constraints:
|
||||||
|
</nobr><br><nobr>
|
||||||
|
1. <b>Number of Steps</b> >=2.
|
||||||
|
</nobr><br><nobr>
|
||||||
|
2. <b>Size</b> not equal to 0.
|
||||||
|
</nobr><br><nobr>
|
||||||
|
3. <b>From</b> not equal to <b>To</b>.
|
||||||
|
</nobr><br></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Constant Step Size</string>
|
<string>Constant Step Size</string>
|
||||||
@ -334,6 +342,9 @@
|
|||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="keyboardTracking">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -117,9 +117,17 @@ void SetParameter();
|
|||||||
void SetPrecision(int value);
|
void SetPrecision(int value);
|
||||||
|
|
||||||
/** Set number of steps
|
/** Set number of steps
|
||||||
* @param int num is the number of steps
|
|
||||||
* */
|
* */
|
||||||
void SetNSteps(int num);
|
void SetNSteps();
|
||||||
|
|
||||||
|
/** Range type: If size is changed,
|
||||||
|
* the Number of steps is calculated
|
||||||
|
* */
|
||||||
|
void RangeCalculateNumSteps();
|
||||||
|
|
||||||
|
/** Range type: If size is changed, the To is calculated
|
||||||
|
* */
|
||||||
|
void RangeCalculateTo();
|
||||||
|
|
||||||
/** Set range for scan
|
/** Set range for scan
|
||||||
* */
|
* */
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include<iostream>
|
#include<iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <cmath>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
@ -72,6 +73,7 @@ void qScanWidget::SetupWidgetWindow(){
|
|||||||
stackedLayout = new QStackedLayout;
|
stackedLayout = new QStackedLayout;
|
||||||
stackedLayout->setSpacing(0);
|
stackedLayout->setSpacing(0);
|
||||||
|
|
||||||
|
|
||||||
// Range Size Layout
|
// Range Size Layout
|
||||||
QWidget *widgetRange = new QWidget;
|
QWidget *widgetRange = new QWidget;
|
||||||
QHBoxLayout *layoutRange = new QHBoxLayout(widgetRange);
|
QHBoxLayout *layoutRange = new QHBoxLayout(widgetRange);
|
||||||
@ -88,12 +90,16 @@ void qScanWidget::SetupWidgetWindow(){
|
|||||||
spinFrom->setToolTip(rangeTip);
|
spinFrom->setToolTip(rangeTip);
|
||||||
spinFrom->setMaximum(1000000);
|
spinFrom->setMaximum(1000000);
|
||||||
spinFrom->setKeyboardTracking(false);
|
spinFrom->setKeyboardTracking(false);
|
||||||
|
spinFrom->setFixedWidth(80);
|
||||||
|
spinFrom->setDecimals(4);
|
||||||
lblTo->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
lblTo->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||||
lblTo->setToolTip(rangeTip);
|
lblTo->setToolTip(rangeTip);
|
||||||
spinTo->setValue(1);
|
spinTo->setValue(1);
|
||||||
spinTo->setToolTip(rangeTip);
|
spinTo->setToolTip(rangeTip);
|
||||||
spinTo->setMaximum(1000000);
|
spinTo->setMaximum(1000000);
|
||||||
spinTo->setKeyboardTracking(false);
|
spinTo->setKeyboardTracking(false);
|
||||||
|
spinTo->setFixedWidth(80);
|
||||||
|
spinTo->setDecimals(4);
|
||||||
lblSize->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
lblSize->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||||
lblSize->setToolTip(rangeTip);
|
lblSize->setToolTip(rangeTip);
|
||||||
lblSize->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
lblSize->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||||
@ -102,6 +108,8 @@ void qScanWidget::SetupWidgetWindow(){
|
|||||||
spinSize->setSingleStep(0.1);
|
spinSize->setSingleStep(0.1);
|
||||||
spinSize->setToolTip(rangeTip);
|
spinSize->setToolTip(rangeTip);
|
||||||
spinSize->setKeyboardTracking(false);
|
spinSize->setKeyboardTracking(false);
|
||||||
|
spinSize->setDecimals(4);
|
||||||
|
spinSize->setMinimum(0.0001);
|
||||||
layoutRange->addItem(new QSpacerItem(40,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
|
layoutRange->addItem(new QSpacerItem(40,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
|
||||||
layoutRange->addWidget(lblFrom);
|
layoutRange->addWidget(lblFrom);
|
||||||
layoutRange->addItem(new QSpacerItem(5,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
|
layoutRange->addItem(new QSpacerItem(5,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
|
||||||
@ -175,13 +183,13 @@ void qScanWidget::Initialization(){
|
|||||||
//sizewidgets
|
//sizewidgets
|
||||||
connect(btnGroup, SIGNAL(buttonClicked(QAbstractButton*)),this,SLOT(EnableSizeWidgets()));
|
connect(btnGroup, SIGNAL(buttonClicked(QAbstractButton*)),this,SLOT(EnableSizeWidgets()));
|
||||||
//numsteps
|
//numsteps
|
||||||
connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps(int)));
|
connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps()));
|
||||||
//precision
|
//precision
|
||||||
connect(spinPrecision, SIGNAL(valueChanged(int)), this, SLOT(SetPrecision(int)));
|
connect(spinPrecision, SIGNAL(valueChanged(int)), this, SLOT(SetPrecision(int)));
|
||||||
//range values
|
//range values
|
||||||
connect(spinFrom, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps()));
|
connect(spinFrom, SIGNAL(valueChanged(double)), this, SLOT(RangeCalculateNumSteps()));
|
||||||
connect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps()));
|
connect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(RangeCalculateNumSteps()));
|
||||||
connect(spinSize, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps()));
|
connect(spinSize, SIGNAL(valueChanged(double)), this, SLOT(RangeCalculateTo()));
|
||||||
//custom values
|
//custom values
|
||||||
connect(comboCustom, SIGNAL(currentIndexChanged(int)), this, SLOT(SetCustomSteps()));
|
connect(comboCustom, SIGNAL(currentIndexChanged(int)), this, SLOT(SetCustomSteps()));
|
||||||
connect(btnCustom, SIGNAL(clicked()), this, SLOT(DeleteCustomSteps()));
|
connect(btnCustom, SIGNAL(clicked()), this, SLOT(DeleteCustomSteps()));
|
||||||
@ -223,6 +231,7 @@ void qScanWidget::EnableSizeWidgets(){
|
|||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Constant Range Values" << endl;
|
cout << "Constant Range Values" << endl;
|
||||||
#endif
|
#endif
|
||||||
|
spinSteps->setMinimum(2);
|
||||||
radioCustom->setText("Specific Values");
|
radioCustom->setText("Specific Values");
|
||||||
radioCustom->setPalette(normal);
|
radioCustom->setPalette(normal);
|
||||||
radioCustom->setToolTip(customTip);
|
radioCustom->setToolTip(customTip);
|
||||||
@ -235,6 +244,7 @@ void qScanWidget::EnableSizeWidgets(){
|
|||||||
btnFile->setToolTip(fileTip);
|
btnFile->setToolTip(fileTip);
|
||||||
|
|
||||||
stackedLayout->setCurrentIndex(RangeValues);
|
stackedLayout->setCurrentIndex(RangeValues);
|
||||||
|
|
||||||
SetRangeSteps();
|
SetRangeSteps();
|
||||||
}
|
}
|
||||||
//custom values
|
//custom values
|
||||||
@ -242,6 +252,7 @@ void qScanWidget::EnableSizeWidgets(){
|
|||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Custom Values" << endl;
|
cout << "Custom Values" << endl;
|
||||||
#endif
|
#endif
|
||||||
|
spinSteps->setMinimum(0);
|
||||||
//defaults for other mode
|
//defaults for other mode
|
||||||
radioFile->setPalette(normal);
|
radioFile->setPalette(normal);
|
||||||
radioFile->setText("Values from File:");
|
radioFile->setText("Values from File:");
|
||||||
@ -251,19 +262,21 @@ void qScanWidget::EnableSizeWidgets(){
|
|||||||
|
|
||||||
//change it back as this list is what will be loaded.
|
//change it back as this list is what will be loaded.
|
||||||
//also numstpes could have been changed in other modes too
|
//also numstpes could have been changed in other modes too
|
||||||
disconnect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps(int)));
|
disconnect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps()));
|
||||||
spinSteps ->setValue(comboCustom->count());
|
spinSteps ->setValue(comboCustom->count());
|
||||||
connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps(int)));
|
connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps()));
|
||||||
|
|
||||||
stackedLayout->setCurrentIndex(CustomValues);
|
stackedLayout->setCurrentIndex(CustomValues);
|
||||||
//only for custom steps out here because many signals go through
|
//only for custom steps out here because many signals go through
|
||||||
//custom steps and we want to give the info msg only when changig range types
|
//custom steps and we want to give the info msg only when changig range types
|
||||||
if(SetCustomSteps()==qDefs::OK){
|
if(SetCustomSteps()==qDefs::OK){
|
||||||
|
#ifdef VERYVERBOSE
|
||||||
char cNum[200];sprintf(cNum,"%d",actualNumSteps);
|
char cNum[200];sprintf(cNum,"%d",actualNumSteps);
|
||||||
char cId[5];sprintf(cId,"%d",id);
|
char cId[5];sprintf(cId,"%d",id);
|
||||||
qDefs::InfoMessage(string("<nobr><font color=\"blue\">Scan Level ")+string(cId)+
|
qDefs::InfoMessage(string("<nobr><font color=\"blue\">Scan Level ")+string(cId)+
|
||||||
string(": Specific Values</font></nobr><br><br><nobr>Number of positions added: ")+
|
string(": Specific Values</font></nobr><br><br><nobr>Number of positions added: ")+
|
||||||
string(cNum)+string("</nobr>"),"ScanWidget");
|
string(cNum)+string("</nobr>"),"ScanWidget");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -272,6 +285,7 @@ void qScanWidget::EnableSizeWidgets(){
|
|||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "File Values" << endl;
|
cout << "File Values" << endl;
|
||||||
#endif
|
#endif
|
||||||
|
spinSteps->setMinimum(0);
|
||||||
//defaults for other mode
|
//defaults for other mode
|
||||||
radioCustom->setText("Specific Values");
|
radioCustom->setText("Specific Values");
|
||||||
radioCustom->setPalette(normal);
|
radioCustom->setPalette(normal);
|
||||||
@ -354,15 +368,15 @@ int qScanWidget::SetScan(int mode){
|
|||||||
else values = NULL;
|
else values = NULL;
|
||||||
for(int i=0;i<actualNumSteps;i++) values[i] = positions[i];
|
for(int i=0;i<actualNumSteps;i++) values[i] = positions[i];
|
||||||
|
|
||||||
cout<<"modeNames[mode]:"<<modeNames[mode]<<endl;cout<<"actualNumSteps:"<<actualNumSteps<<endl;
|
|
||||||
//setting the mode
|
//setting the mode
|
||||||
if(mode==CustomScript)
|
if(mode==CustomScript)
|
||||||
myDet->setScan(id,script,actualNumSteps,values,parameter);
|
myDet->setScan(id,script,actualNumSteps,values,parameter);
|
||||||
else
|
else
|
||||||
cout<<"return values:"<<myDet->setScan(id,modeNames[mode],actualNumSteps,values,parameter)<<endl;
|
myDet->setScan(id,modeNames[mode],actualNumSteps,values,parameter);
|
||||||
|
|
||||||
//custom script
|
//custom script
|
||||||
int actualMode = myDet->getScanMode(id);cout<<"actualmode:"<<actualMode<<endl;
|
int actualMode = myDet->getScanMode(id);
|
||||||
if((mode==CustomScript)&&((script=="")||(script=="none"))){
|
if((mode==CustomScript)&&((script=="")||(script=="none"))){
|
||||||
return qDefs::OK;
|
return qDefs::OK;
|
||||||
}else{//mode NOT set
|
}else{//mode NOT set
|
||||||
@ -513,7 +527,7 @@ void qScanWidget::SetPrecision(int value){
|
|||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
void qScanWidget::SetNSteps(int num){
|
void qScanWidget::SetNSteps(){
|
||||||
#ifdef VERYVERBOSE
|
#ifdef VERYVERBOSE
|
||||||
cout << "Entering SetNSteps()" << endl;
|
cout << "Entering SetNSteps()" << endl;
|
||||||
#endif
|
#endif
|
||||||
@ -521,25 +535,16 @@ void qScanWidget::SetNSteps(int num){
|
|||||||
cout << "Setting number of steps" << endl;
|
cout << "Setting number of steps" << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int numSteps = spinSteps->value();
|
|
||||||
comboCustom->setMaxCount(numSteps);
|
|
||||||
|
|
||||||
//check if its ok
|
//check if its ok
|
||||||
if(radioRange->isChecked()){
|
if(radioRange->isChecked()){
|
||||||
//calculate the step size and display it
|
double oldSize = spinSize->value();
|
||||||
if(num==1){
|
//calculate size = (to - from)/(num-1)
|
||||||
disconnect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps()));
|
double size = (abs((spinTo->value())-(spinFrom->value()))) / (spinSteps->value()-1);
|
||||||
spinTo->setValue(spinFrom->value());
|
spinSize->setValue(size);
|
||||||
connect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps()));
|
|
||||||
}else if(num>1)
|
|
||||||
num--;
|
|
||||||
double stepSize = (spinTo->value()-spinFrom->value())/num;
|
|
||||||
disconnect(spinSize,SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps()));
|
|
||||||
spinSize->setValue(stepSize);
|
|
||||||
connect(spinSize, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps()));
|
|
||||||
//set these positions
|
//set these positions
|
||||||
SetRangeSteps();
|
if(oldSize==size) SetRangeSteps();
|
||||||
}else if(radioCustom->isChecked()){
|
}else if(radioCustom->isChecked()){
|
||||||
|
comboCustom->setMaxCount(spinSteps->value());
|
||||||
SetCustomSteps();
|
SetCustomSteps();
|
||||||
}else if(radioFile->isChecked()){
|
}else if(radioFile->isChecked()){
|
||||||
SetFileSteps();
|
SetFileSteps();
|
||||||
@ -551,6 +556,45 @@ void qScanWidget::SetNSteps(int num){
|
|||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
void qScanWidget::RangeCalculateNumSteps(){
|
||||||
|
#ifdef VERYVERBOSE
|
||||||
|
cout << "Entering RangeCalculateNumSteps()" << endl;
|
||||||
|
#endif
|
||||||
|
//check if to=from
|
||||||
|
if(spinTo->value()==spinFrom->value()){
|
||||||
|
spinTo->setValue( ((spinSize->value())*(spinSteps->value())) - (spinSize->value()) + (spinFrom->value()) );
|
||||||
|
SetRangeSteps();
|
||||||
|
}else{
|
||||||
|
//num = ((to-from)/(size)) +1
|
||||||
|
double size = spinSize->value();
|
||||||
|
double numerator = abs((spinTo->value())-(spinFrom->value()));
|
||||||
|
//check if (to-from)/size is an int and that its =1 cuz numSteps minimum=2
|
||||||
|
bool valid = (fmod(numerator,size)==0) && ((numerator/size)>0);
|
||||||
|
|
||||||
|
if(valid) //calculate num steps
|
||||||
|
spinSteps->setValue( (int)(numerator / size) + 1);
|
||||||
|
else //change size instead
|
||||||
|
spinSize->setValue(numerator / (spinSteps->value()-1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
void qScanWidget::RangeCalculateTo(){
|
||||||
|
#ifdef VERYVERBOSE
|
||||||
|
cout << "Entering RangeCalculateTo()" << endl;
|
||||||
|
#endif
|
||||||
|
//to = size*num - size + from
|
||||||
|
spinTo->setValue( ((spinSize->value())*(spinSteps->value())) - (spinSize->value()) + (spinFrom->value()) );
|
||||||
|
SetRangeSteps();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
void qScanWidget::SetRangeSteps(){
|
void qScanWidget::SetRangeSteps(){
|
||||||
#ifdef VERYVERBOSE
|
#ifdef VERYVERBOSE
|
||||||
cout << "Entering SetRangeSteps()" << endl;
|
cout << "Entering SetRangeSteps()" << endl;
|
||||||
@ -560,37 +604,9 @@ void qScanWidget::SetRangeSteps(){
|
|||||||
#endif
|
#endif
|
||||||
double fromVal = spinFrom->value();
|
double fromVal = spinFrom->value();
|
||||||
double sizeVal = spinSize->value();
|
double sizeVal = spinSize->value();
|
||||||
//if step size is 0, min and max should be same
|
actualNumSteps = spinSteps->value();
|
||||||
if(!sizeVal){
|
|
||||||
disconnect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps()));
|
|
||||||
spinTo->setValue(fromVal);
|
|
||||||
connect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps()));
|
|
||||||
QString tip = rangeTip + QString("<br><br><font color=\"red\">"
|
|
||||||
"<nobr>Note: Increase the <b>step size</b> from zero to be able to change the range.</nobr></font>");
|
|
||||||
lblSize->setToolTip(tip);
|
|
||||||
spinSize->setToolTip(tip);
|
|
||||||
lblSize->setText("step size:*");
|
|
||||||
lblSize->setPalette(red);
|
|
||||||
}else{
|
|
||||||
lblSize->setToolTip(rangeTip);
|
|
||||||
spinSize->setToolTip(rangeTip);
|
|
||||||
lblSize->setText("step size:");
|
|
||||||
lblSize->setPalette(normal);
|
|
||||||
}
|
|
||||||
//if min and max is the same
|
|
||||||
if(fromVal==spinTo->value()) actualNumSteps = 0;
|
|
||||||
else actualNumSteps = (int)((spinTo->value()-fromVal)/sizeVal);
|
|
||||||
|
|
||||||
//actualNumSteps will be negative if from<to and size wasnt negative.so change it to positive
|
|
||||||
if(actualNumSteps<0){
|
|
||||||
actualNumSteps*=-1;
|
|
||||||
disconnect(spinSize,SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps()));
|
|
||||||
spinSize->setValue(-1*sizeVal);
|
|
||||||
connect(spinSize, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps()));
|
|
||||||
sizeVal = spinSize->value();
|
|
||||||
}
|
|
||||||
//increment is required like vice versa in setNSteps
|
|
||||||
actualNumSteps++;
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "num pos:" << actualNumSteps << endl;
|
cout << "num pos:" << actualNumSteps << endl;
|
||||||
#endif
|
#endif
|
||||||
@ -600,24 +616,16 @@ void qScanWidget::SetRangeSteps(){
|
|||||||
for(int i=0;i<actualNumSteps;i++){
|
for(int i=0;i<actualNumSteps;i++){
|
||||||
positions[i] = fromVal + i * sizeVal;
|
positions[i] = fromVal + i * sizeVal;
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "positions[" << i << "]:\t" << positions[i] <<endl;
|
cout << "positions[" << i << "]:\t" << positions[i] << endl;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//correcting the number of steps
|
|
||||||
disconnect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps(int)));
|
|
||||||
spinSteps->setValue(actualNumSteps);
|
|
||||||
connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps(int)));
|
|
||||||
|
|
||||||
|
|
||||||
//sets the scan
|
//sets the scan
|
||||||
if(SetScan(comboScript->currentIndex())==qDefs::OK){
|
if(SetScan(comboScript->currentIndex())==qDefs::OK){
|
||||||
char cId[5];sprintf(cId,"%d",id);
|
char cId[5];sprintf(cId,"%d",id);
|
||||||
QString script = dispScript->text();
|
QString script = dispScript->text();
|
||||||
|
|
||||||
disconnect(spinFrom, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps()));
|
|
||||||
disconnect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps()));
|
|
||||||
disconnect(spinSize, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps()));
|
|
||||||
|
|
||||||
//positions wont be loaded if its custom script
|
//positions wont be loaded if its custom script
|
||||||
if((comboScript->currentIndex()==CustomScript)&&((script=="")||(script=="none"))){
|
if((comboScript->currentIndex()==CustomScript)&&((script=="")||(script=="none"))){
|
||||||
@ -632,22 +640,18 @@ void qScanWidget::SetRangeSteps(){
|
|||||||
"<nobr>The positions list was not set for an unknown reason.</nobr>"),"ScanWidget");
|
"<nobr>The positions list was not set for an unknown reason.</nobr>"),"ScanWidget");
|
||||||
/*LoadPositions();
|
/*LoadPositions();
|
||||||
comboScript->setCurrentIndex(myDet->getScanMode(id))*/
|
comboScript->setCurrentIndex(myDet->getScanMode(id))*/
|
||||||
}else{//SUCCESS
|
}
|
||||||
|
#ifdef VERYVERBOSE
|
||||||
|
else{//SUCCESS
|
||||||
char cNum[200];sprintf(cNum,"%d",actualNumSteps);
|
char cNum[200];sprintf(cNum,"%d",actualNumSteps);
|
||||||
qDefs::InfoMessage(string("<nobr><font color=\"blue\">Scan Level ")+string(cId)+
|
qDefs::InfoMessage(string("<nobr><font color=\"blue\">Scan Level ")+string(cId)+
|
||||||
string(": Constant Step Size</font></nobr><br><br><nobr>Number of positions added: ")+
|
string(": Constant Step Size</font></nobr><br><br><nobr>Number of positions added: ")+
|
||||||
string(cNum)+string("</nobr>"),"ScanWidget");
|
string(cNum)+string("</nobr>"),"ScanWidget");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(spinFrom, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps()));
|
|
||||||
connect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps()));
|
|
||||||
connect(spinSize, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps()));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
@ -694,7 +698,7 @@ int qScanWidget::SetCustomSteps(){
|
|||||||
for(int i=0;i<actualNumSteps;i++){
|
for(int i=0;i<actualNumSteps;i++){
|
||||||
positions[i] = comboCustom->itemText(i).toDouble();
|
positions[i] = comboCustom->itemText(i).toDouble();
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout<<"positions["<<i<<"]:"<<positions[i]<<endl;
|
cout << "positions[" << i << "]:" << positions[i] << endl;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -817,7 +821,7 @@ void qScanWidget::SetFileSteps(){
|
|||||||
positions.resize(0);
|
positions.resize(0);
|
||||||
actualNumSteps = 0;
|
actualNumSteps = 0;
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout<< "Opening file "<< fName.toAscii().constData() << endl;
|
cout << "Opening file "<< fName.toAscii().constData() << endl;
|
||||||
#endif
|
#endif
|
||||||
while(inFile.good()) {
|
while(inFile.good()) {
|
||||||
getline(inFile,sLine);
|
getline(inFile,sLine);
|
||||||
@ -833,13 +837,13 @@ void qScanWidget::SetFileSteps(){
|
|||||||
actualNumSteps--;
|
actualNumSteps--;
|
||||||
positions.resize(actualNumSteps);
|
positions.resize(actualNumSteps);
|
||||||
}
|
}
|
||||||
else cout<<"value["<<actualNumSteps-1<<"]:"<<positions[actualNumSteps-1]<<endl;
|
else cout << "value[" << actualNumSteps-1 << "]:" << positions[actualNumSteps-1] << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps(int)));
|
disconnect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps()));
|
||||||
spinSteps->setValue(actualNumSteps);
|
spinSteps->setValue(actualNumSteps);
|
||||||
connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps(int)));
|
connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps()));
|
||||||
inFile.close();
|
inFile.close();
|
||||||
}else {//could not open file
|
}else {//could not open file
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
@ -871,12 +875,15 @@ void qScanWidget::SetFileSteps(){
|
|||||||
qDefs::WarningMessage(string("<nobr><font color=\"blue\">Scan Level ")+string(cId)+
|
qDefs::WarningMessage(string("<nobr><font color=\"blue\">Scan Level ")+string(cId)+
|
||||||
string(": Values From File</font></nobr><br><br>"
|
string(": Values From File</font></nobr><br><br>"
|
||||||
"<nobr>The positions list was not set for an unknown reason.</nobr>"),"ScanWidget");
|
"<nobr>The positions list was not set for an unknown reason.</nobr>"),"ScanWidget");
|
||||||
}else{//SUCCESS
|
}
|
||||||
|
#ifdef VERYVERBOSE
|
||||||
|
else{//SUCCESS
|
||||||
char cNum[200];sprintf(cNum,"%d",actualNumSteps);
|
char cNum[200];sprintf(cNum,"%d",actualNumSteps);
|
||||||
qDefs::InfoMessage(string("<nobr><font color=\"blue\">Scan Level ")+string(cId)+
|
qDefs::InfoMessage(string("<nobr><font color=\"blue\">Scan Level ")+string(cId)+
|
||||||
string(": Values From File</font></nobr><br><br><nobr>Number of positions added: ")+
|
string(": Values From File</font></nobr><br><br><nobr>Number of positions added: ")+
|
||||||
string(cNum)+string("</nobr>"),"ScanWidget");
|
string(cNum)+string("</nobr>"),"ScanWidget");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -917,7 +924,7 @@ void qScanWidget::LoadPositions(){
|
|||||||
cout << "Entering LoadPositions()" << endl;
|
cout << "Entering LoadPositions()" << endl;
|
||||||
#endif
|
#endif
|
||||||
disconnect(comboCustom, SIGNAL(currentIndexChanged(int)), this, SLOT(SetCustomSteps()));
|
disconnect(comboCustom, SIGNAL(currentIndexChanged(int)), this, SLOT(SetCustomSteps()));
|
||||||
disconnect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps(int)));
|
disconnect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps()));
|
||||||
disconnect(btnGroup, SIGNAL(buttonClicked(QAbstractButton*)),this,SLOT(EnableSizeWidgets()));
|
disconnect(btnGroup, SIGNAL(buttonClicked(QAbstractButton*)),this,SLOT(EnableSizeWidgets()));
|
||||||
|
|
||||||
|
|
||||||
@ -966,7 +973,7 @@ void qScanWidget::LoadPositions(){
|
|||||||
btnCustom->setEnabled(numSteps&&mode);
|
btnCustom->setEnabled(numSteps&&mode);
|
||||||
|
|
||||||
connect(comboCustom, SIGNAL(currentIndexChanged(int)), this, SLOT(SetCustomSteps()));
|
connect(comboCustom, SIGNAL(currentIndexChanged(int)), this, SLOT(SetCustomSteps()));
|
||||||
connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps(int)));
|
connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps()));
|
||||||
connect(btnGroup, SIGNAL(buttonClicked(QAbstractButton*)),this,SLOT(EnableSizeWidgets()));
|
connect(btnGroup, SIGNAL(buttonClicked(QAbstractButton*)),this,SLOT(EnableSizeWidgets()));
|
||||||
|
|
||||||
|
|
||||||
@ -1002,7 +1009,7 @@ void qScanWidget::Refresh(){
|
|||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Updated\tscan:" << id << "\t"
|
cout << "Updated\tscan:" << id << "\t"
|
||||||
"mode:"<<mode<<"\t"
|
"mode:" << mode << "\t"
|
||||||
"script:" << script << "\t"
|
"script:" << script << "\t"
|
||||||
"numSteps:" << actualNumSteps << "\t"
|
"numSteps:" << actualNumSteps << "\t"
|
||||||
//"values:" << arrSteps << "\t"
|
//"values:" << arrSteps << "\t"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user