mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-05-03 11:20:03 +02:00
scans work as of now
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@23 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
parent
2dbdf8ff17
commit
e88e24178c
@ -101,7 +101,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QRadioButton" name="radioRange">
|
<widget class="QRadioButton" name="radioRange">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string/>
|
<string><nobr>Defines scan range for a constant step size.</nobr></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Constant Step Size</string>
|
<string>Constant Step Size</string>
|
||||||
|
@ -57,6 +57,7 @@ private:
|
|||||||
QPalette red;
|
QPalette red;
|
||||||
QString customTip;
|
QString customTip;
|
||||||
QString fileTip;
|
QString fileTip;
|
||||||
|
QString rangeTip;
|
||||||
|
|
||||||
/**widgets needed for diff size types*/
|
/**widgets needed for diff size types*/
|
||||||
QButtonGroup *btnGroup;
|
QButtonGroup *btnGroup;
|
||||||
@ -116,8 +117,13 @@ 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();
|
void SetNSteps(int num);
|
||||||
|
|
||||||
|
/** Set range for scan
|
||||||
|
* */
|
||||||
|
void SetRangeSteps();
|
||||||
|
|
||||||
/** Set custom steps
|
/** Set custom steps
|
||||||
* returns OK if set properly
|
* returns OK if set properly
|
||||||
|
@ -66,6 +66,7 @@ void qScanWidget::SetupWidgetWindow(){
|
|||||||
red.setColor(QPalette::Active,QPalette::WindowText,Qt::red);
|
red.setColor(QPalette::Active,QPalette::WindowText,Qt::red);
|
||||||
fileTip = radioFile->toolTip();
|
fileTip = radioFile->toolTip();
|
||||||
customTip = radioCustom->toolTip();
|
customTip = radioCustom->toolTip();
|
||||||
|
rangeTip = radioRange->toolTip();
|
||||||
|
|
||||||
//layout for the size widgets
|
//layout for the size widgets
|
||||||
stackedLayout = new QStackedLayout;
|
stackedLayout = new QStackedLayout;
|
||||||
@ -79,23 +80,36 @@ void qScanWidget::SetupWidgetWindow(){
|
|||||||
spinFrom = new QDoubleSpinBox(widgetRange);
|
spinFrom = new QDoubleSpinBox(widgetRange);
|
||||||
lblTo = new QLabel("to",widgetRange);
|
lblTo = new QLabel("to",widgetRange);
|
||||||
spinTo = new QDoubleSpinBox(widgetRange);
|
spinTo = new QDoubleSpinBox(widgetRange);
|
||||||
lblSize = new QLabel("Size",widgetRange);
|
lblSize = new QLabel("step size:",widgetRange);
|
||||||
spinSize = new QDoubleSpinBox(widgetRange);
|
spinSize = new QDoubleSpinBox(widgetRange);
|
||||||
lblFrom->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
lblFrom->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||||
|
lblFrom->setToolTip(rangeTip);
|
||||||
spinFrom->setValue(0);
|
spinFrom->setValue(0);
|
||||||
|
spinFrom->setToolTip(rangeTip);
|
||||||
|
spinFrom->setMaximum(1000000);
|
||||||
lblTo->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
lblTo->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||||
|
lblTo->setToolTip(rangeTip);
|
||||||
spinTo->setValue(1);
|
spinTo->setValue(1);
|
||||||
|
spinTo->setToolTip(rangeTip);
|
||||||
|
spinTo->setMaximum(1000000);
|
||||||
lblSize->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
lblSize->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||||
|
lblSize->setToolTip(rangeTip);
|
||||||
|
lblSize->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||||
|
lblSize->setFixedWidth(67);
|
||||||
spinSize->setValue(1);
|
spinSize->setValue(1);
|
||||||
layoutRange->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
|
spinSize->setToolTip(rangeTip);
|
||||||
|
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->addWidget(spinFrom);
|
layoutRange->addWidget(spinFrom);
|
||||||
|
layoutRange->addItem(new QSpacerItem(5,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
|
||||||
layoutRange->addWidget(lblTo);
|
layoutRange->addWidget(lblTo);
|
||||||
|
layoutRange->addItem(new QSpacerItem(5,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
|
||||||
layoutRange->addWidget(spinTo);
|
layoutRange->addWidget(spinTo);
|
||||||
layoutRange->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
|
layoutRange->addItem(new QSpacerItem(30,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
|
||||||
layoutRange->addWidget(lblSize);
|
layoutRange->addWidget(lblSize);
|
||||||
layoutRange->addWidget(spinSize);
|
layoutRange->addWidget(spinSize);
|
||||||
layoutRange->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
|
layoutRange->addItem(new QSpacerItem(40,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
|
||||||
|
|
||||||
|
|
||||||
// Custom Values Layout
|
// Custom Values Layout
|
||||||
@ -106,13 +120,10 @@ void qScanWidget::SetupWidgetWindow(){
|
|||||||
btnCustom = new QPushButton("Delete",widgetCustom);
|
btnCustom = new QPushButton("Delete",widgetCustom);
|
||||||
comboCustom->setEditable(true);
|
comboCustom->setEditable(true);
|
||||||
comboCustom->setCompleter(false);
|
comboCustom->setCompleter(false);
|
||||||
QDoubleValidator *validate = new QDoubleValidator(comboCustom);
|
comboCustom->setValidator(new QDoubleValidator(comboCustom));
|
||||||
comboCustom->setValidator(validate);
|
comboCustom->setToolTip(customTip);
|
||||||
radioCustom->setToolTip("<nobr>Measures only at specific values listed by the user.</nobr><br>"
|
|
||||||
"<nobr>Number of entries is restricted to <b>Number of Steps</b> field.</nobr>");
|
|
||||||
comboCustom->setToolTip("<nobr>Measures only at specific values listed by the user.</nobr><br>"
|
|
||||||
"<nobr>Number of entries is restricted to <b>Number of Steps</b> field.</nobr>");
|
|
||||||
btnCustom->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
btnCustom->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||||
|
btnCustom->setToolTip("<nobr>Deletes current position from list and reduces <b>Number of Positions</b> by 1.</nobr>");
|
||||||
layoutCustom->addItem(new QSpacerItem(160,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
|
layoutCustom->addItem(new QSpacerItem(160,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
|
||||||
layoutCustom->addWidget(comboCustom);
|
layoutCustom->addWidget(comboCustom);
|
||||||
layoutCustom->addItem(new QSpacerItem(5,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
|
layoutCustom->addItem(new QSpacerItem(5,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
|
||||||
@ -126,9 +137,11 @@ void qScanWidget::SetupWidgetWindow(){
|
|||||||
layoutFile->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
|
layoutFile->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
|
||||||
dispFile = new QLineEdit(widgetFile);
|
dispFile = new QLineEdit(widgetFile);
|
||||||
dispFile->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);
|
dispFile->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);
|
||||||
|
dispFile->setToolTip(fileTip);
|
||||||
layoutFile->addWidget(dispFile);
|
layoutFile->addWidget(dispFile);
|
||||||
btnFile = new QPushButton("Browse",widgetFile);
|
btnFile = new QPushButton("Browse",widgetFile);
|
||||||
btnFile->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
btnFile->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||||
|
btnFile->setToolTip(fileTip);
|
||||||
layoutFile->addWidget(btnFile);
|
layoutFile->addWidget(btnFile);
|
||||||
layoutFile->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
|
layoutFile->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
|
||||||
|
|
||||||
@ -157,12 +170,14 @@ void qScanWidget::Initialization(){
|
|||||||
connect(dispParameter, SIGNAL(editingFinished()), this, SLOT(SetParameter()));
|
connect(dispParameter, SIGNAL(editingFinished()), this, SLOT(SetParameter()));
|
||||||
//sizewidgets
|
//sizewidgets
|
||||||
connect(btnGroup, SIGNAL(buttonClicked(QAbstractButton*)),this,SLOT(EnableSizeWidgets()));
|
connect(btnGroup, SIGNAL(buttonClicked(QAbstractButton*)),this,SLOT(EnableSizeWidgets()));
|
||||||
// connect(radioRange, SIGNAL(toggled(bool)),this,SLOT(EnableSizeWidgets()));
|
|
||||||
//numsteps
|
//numsteps
|
||||||
connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps()));
|
connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps(int)));
|
||||||
//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(spinTo, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps()));
|
||||||
|
connect(spinSize, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps()));
|
||||||
//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()));
|
||||||
@ -179,6 +194,9 @@ void qScanWidget::EnableSizeWidgets(){
|
|||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Entering enable size widgets" << endl;
|
cout << "Entering enable size widgets" << endl;
|
||||||
#endif
|
#endif
|
||||||
|
//setting to defaults is not done here as this is called even if mode changes
|
||||||
|
//so only if its to change the size widget type, its set to default for the others
|
||||||
|
|
||||||
//scan is none
|
//scan is none
|
||||||
if(!comboScript->currentIndex()){
|
if(!comboScript->currentIndex()){
|
||||||
radioCustom->setText("Specific Values");
|
radioCustom->setText("Specific Values");
|
||||||
@ -194,15 +212,26 @@ void qScanWidget::EnableSizeWidgets(){
|
|||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
// Steps are enabled for all except Range step size
|
// Steps are enabled for all except Range step size
|
||||||
lblSteps->setEnabled(!radioRange->isChecked());
|
/**lblSteps->setEnabled(!radioRange->isChecked());
|
||||||
spinSteps->setEnabled(!radioRange->isChecked());
|
spinSteps->setEnabled(!radioRange->isChecked());*/
|
||||||
//range values
|
//range values
|
||||||
if(radioRange->isChecked()){
|
if(radioRange->isChecked()){
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Constant Range Values" << endl;
|
cout << "Constant Range Values" << endl;
|
||||||
#endif
|
#endif
|
||||||
|
radioCustom->setText("Specific Values");
|
||||||
|
radioCustom->setPalette(normal);
|
||||||
|
radioCustom->setToolTip(customTip);
|
||||||
|
comboCustom->setToolTip(customTip);
|
||||||
|
|
||||||
|
radioFile->setPalette(normal);
|
||||||
|
radioFile->setText("Values from File:");
|
||||||
|
radioFile->setToolTip(fileTip);
|
||||||
|
dispFile->setToolTip(fileTip);
|
||||||
|
btnFile->setToolTip(fileTip);
|
||||||
|
|
||||||
stackedLayout->setCurrentIndex(RangeValues);
|
stackedLayout->setCurrentIndex(RangeValues);
|
||||||
/**refresh this part*/
|
SetRangeSteps();
|
||||||
}
|
}
|
||||||
//custom values
|
//custom values
|
||||||
else if(radioCustom->isChecked()){
|
else if(radioCustom->isChecked()){
|
||||||
@ -218,9 +247,9 @@ 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()));
|
disconnect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps(int)));
|
||||||
spinSteps ->setValue(comboCustom->count());
|
spinSteps ->setValue(comboCustom->count());
|
||||||
connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps()));
|
connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps(int)));
|
||||||
|
|
||||||
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
|
||||||
@ -228,9 +257,12 @@ void qScanWidget::EnableSizeWidgets(){
|
|||||||
if(SetCustomSteps()==qDefs::OK){
|
if(SetCustomSteps()==qDefs::OK){
|
||||||
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("Scan Level ")+string(cId)+(" - ")+string(" Number of positions added from list : ")+string(cNum),"ScanWidget");
|
qDefs::InfoMessage(string("<nobr><font color=\"blue\">Scan Level ")+string(cId)+
|
||||||
|
string(": Specific Values</font></nobr><br><br><nobr>Number of positions added: ")+
|
||||||
|
string(cNum)+string("</nobr>"),"ScanWidget");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//file values
|
//file values
|
||||||
else{
|
else{
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
@ -271,8 +303,10 @@ void qScanWidget::SetMode(int mode){
|
|||||||
// If anything other than None is selected
|
// If anything other than None is selected
|
||||||
if(mode){
|
if(mode){
|
||||||
// Steps are enabled for all except Range step size
|
// Steps are enabled for all except Range step size
|
||||||
lblSteps->setEnabled(!radioRange->isChecked());
|
/**lblSteps->setEnabled(!radioRange->isChecked());
|
||||||
spinSteps->setEnabled(!radioRange->isChecked());
|
spinSteps->setEnabled(!radioRange->isChecked());*/
|
||||||
|
lblSteps->setEnabled(true);
|
||||||
|
spinSteps->setEnabled(true);
|
||||||
// Custom Script only enables the first layout with addnl parameters etc
|
// Custom Script only enables the first layout with addnl parameters etc
|
||||||
if(mode==CustomScript){
|
if(mode==CustomScript){
|
||||||
dispScript->setEnabled(true);
|
dispScript->setEnabled(true);
|
||||||
@ -283,6 +317,7 @@ void qScanWidget::SetMode(int mode){
|
|||||||
group->setEnabled(true);
|
group->setEnabled(true);
|
||||||
lblPrecision->setEnabled(true);
|
lblPrecision->setEnabled(true);
|
||||||
spinPrecision->setEnabled(true);
|
spinPrecision->setEnabled(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//set the group box widgets
|
//set the group box widgets
|
||||||
@ -331,7 +366,9 @@ int qScanWidget::SetScan(int mode){
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mode!=CustomScript){
|
if((mode==CustomScript)&&((script=="")||(script=="none"))){
|
||||||
|
return qDefs::OK;
|
||||||
|
}else{
|
||||||
if((mode!=myDet->getScanMode(id))&&(actualNumSteps)){
|
if((mode!=myDet->getScanMode(id))&&(actualNumSteps)){
|
||||||
qDefs::WarningMessage("The mode could not be changed for an unknown reason.","ScanWidget");
|
qDefs::WarningMessage("The mode could not be changed for an unknown reason.","ScanWidget");
|
||||||
comboScript->setCurrentIndex(myDet->getScanMode(id));
|
comboScript->setCurrentIndex(myDet->getScanMode(id));
|
||||||
@ -459,7 +496,7 @@ void qScanWidget::SetPrecision(int value){
|
|||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
void qScanWidget::SetNSteps(){
|
void qScanWidget::SetNSteps(int num){
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Setting number of steps" << endl;
|
cout << "Setting number of steps" << endl;
|
||||||
@ -469,8 +506,24 @@ void qScanWidget::SetNSteps(){
|
|||||||
comboCustom->setMaxCount(numSteps);
|
comboCustom->setMaxCount(numSteps);
|
||||||
|
|
||||||
//check if its ok
|
//check if its ok
|
||||||
if(radioCustom->isChecked()){
|
if(radioRange->isChecked()){
|
||||||
|
//calculate the step size and display it
|
||||||
|
if(num==1){
|
||||||
|
disconnect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps()));
|
||||||
|
spinTo->setValue(spinFrom->value());
|
||||||
|
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
|
||||||
|
SetRangeSteps();
|
||||||
|
}else if(radioCustom->isChecked()){
|
||||||
SetCustomSteps();
|
SetCustomSteps();
|
||||||
|
}else if(radioFile->isChecked()){
|
||||||
|
SetFileSteps();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -479,6 +532,93 @@ void qScanWidget::SetNSteps(){
|
|||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
void qScanWidget::SetRangeSteps(){
|
||||||
|
#ifdef VERBOSE
|
||||||
|
cout << "Setting\tscan:" << id << "\trange\t";
|
||||||
|
#endif
|
||||||
|
double fromVal = spinFrom->value();
|
||||||
|
double sizeVal = spinSize->value();
|
||||||
|
//if step size is 0, min and max should be same
|
||||||
|
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
|
||||||
|
cout << "num pos:" << actualNumSteps << endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//set the vector positions
|
||||||
|
positions.resize(actualNumSteps);
|
||||||
|
for(int i=0;i<actualNumSteps;i++){
|
||||||
|
positions[i] = fromVal + i * sizeVal;
|
||||||
|
#ifdef VERBOSE
|
||||||
|
cout << "positions[" << i << "]:\t" << positions[i] <<endl;
|
||||||
|
#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
|
||||||
|
if(SetScan(comboScript->currentIndex())==qDefs::OK){
|
||||||
|
char cId[5];sprintf(cId,"%d",id);
|
||||||
|
QString script = dispScript->text();
|
||||||
|
//positions wont be loaded if its custom script
|
||||||
|
if((comboScript->currentIndex()==CustomScript)&&((script=="")||(script=="none"))){
|
||||||
|
qDefs::InfoMessage(string("<nobr><font color=\"blue\">Scan Level ")+string(cId)+
|
||||||
|
string(": Constant Step Size</font></nobr><br><br>"
|
||||||
|
"<nobr>Positions could not be loaded as the script file path is empty.</nobr>"),"ScanWidget");
|
||||||
|
}else{
|
||||||
|
//error loading positions
|
||||||
|
if(myDet->getScanSteps(id)!=actualNumSteps){
|
||||||
|
qDefs::WarningMessage(string("<nobr><font color=\"blue\">Scan Level ")+string(cId)+
|
||||||
|
string(": Values From File</font></nobr><br><br>"
|
||||||
|
"<nobr>The positions list was not set for an unknown reason.</nobr>"),"ScanWidget");
|
||||||
|
/*LoadPositions();
|
||||||
|
comboScript->setCurrentIndex(myDet->getScanMode(id))*/
|
||||||
|
}else{//SUCCESS
|
||||||
|
char cNum[200];sprintf(cNum,"%d",actualNumSteps);
|
||||||
|
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(cNum)+string("</nobr>"),"ScanWidget");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
int qScanWidget::SetCustomSteps(){
|
int qScanWidget::SetCustomSteps(){
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
@ -519,19 +659,30 @@ int qScanWidget::SetCustomSteps(){
|
|||||||
//copying the list
|
//copying the list
|
||||||
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
|
||||||
cout<<"positions["<<i<<"]:"<<positions[i]<<endl;
|
cout<<"positions["<<i<<"]:"<<positions[i]<<endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
//setting the list
|
|
||||||
//cout<<"output:"<<myDet->setScanSteps(id,actualNumSteps,positions)<<endl;
|
|
||||||
|
|
||||||
//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);
|
||||||
|
QString script = dispScript->text();
|
||||||
|
//positions wont be loaded if its custom script
|
||||||
|
if((comboScript->currentIndex()==CustomScript)&&((script=="")||(script=="none"))){
|
||||||
|
qDefs::InfoMessage(string("<nobr><font color=\"blue\">Scan Level ")+string(cId)+
|
||||||
|
string(": Values From File</font></nobr><br><br>"
|
||||||
|
"<nobr>Positions could not be loaded as the script file path is empty.</nobr>"),"ScanWidget");
|
||||||
|
return qDefs::FAIL;
|
||||||
|
}else{
|
||||||
if(myDet->getScanSteps(id)!=actualNumSteps){
|
if(myDet->getScanSteps(id)!=actualNumSteps){
|
||||||
qDefs::WarningMessage("The positions list was not set for an unknown reason.","ScanWidget");
|
qDefs::WarningMessage("The positions list was not set for an unknown reason.","ScanWidget");
|
||||||
LoadPositions();
|
LoadPositions();
|
||||||
comboScript->setCurrentIndex(myDet->getScanMode(id));
|
comboScript->setCurrentIndex(myDet->getScanMode(id));
|
||||||
return qDefs::FAIL;
|
return qDefs::FAIL;
|
||||||
}
|
}
|
||||||
|
//else success is checked in enabledsizewidgets , else it does this for every add, delete etc
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//if num of steps = 0
|
//if num of steps = 0
|
||||||
@ -646,9 +797,9 @@ void qScanWidget::SetFileSteps(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps()));
|
disconnect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps(int)));
|
||||||
spinSteps->setValue(actualNumSteps);
|
spinSteps->setValue(actualNumSteps);
|
||||||
connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps()));
|
connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps(int)));
|
||||||
inFile.close();
|
inFile.close();
|
||||||
}else {//could not open file
|
}else {//could not open file
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
@ -664,16 +815,28 @@ void qScanWidget::SetFileSteps(){
|
|||||||
if(set){//no error while reading file
|
if(set){//no error while reading file
|
||||||
//sets the scan and positions
|
//sets the scan and positions
|
||||||
if(SetScan(comboScript->currentIndex())==qDefs::OK){
|
if(SetScan(comboScript->currentIndex())==qDefs::OK){
|
||||||
|
char cId[5];sprintf(cId,"%d",id);
|
||||||
|
QString script = dispScript->text();
|
||||||
radioFile->setPalette(normal);
|
radioFile->setPalette(normal);
|
||||||
radioFile->setText("Values from File:");
|
radioFile->setText("Values from File:");
|
||||||
radioFile->setToolTip(fileTip);dispFile->setToolTip(fileTip);btnFile->setToolTip(fileTip);
|
radioFile->setToolTip(fileTip);dispFile->setToolTip(fileTip);btnFile->setToolTip(fileTip);
|
||||||
|
//positions wont be loaded if its custom script
|
||||||
|
if((comboScript->currentIndex()==CustomScript)&&((script=="")||(script=="none"))){
|
||||||
|
qDefs::InfoMessage(string("<nobr><font color=\"blue\">Scan Level ")+string(cId)+
|
||||||
|
string(": Values From File</font></nobr><br><br>"
|
||||||
|
"<nobr>Positions could not be loaded as the script file path is empty.</nobr>"),"ScanWidget");
|
||||||
|
}else{
|
||||||
//error loading positions
|
//error loading positions
|
||||||
if(myDet->getScanSteps(id)!=actualNumSteps){
|
if(myDet->getScanSteps(id)!=actualNumSteps){
|
||||||
qDefs::WarningMessage("The positions list was not set for an unknown reason.","ScanWidget");
|
qDefs::WarningMessage(string("<nobr><font color=\"blue\">Scan Level ")+string(cId)+
|
||||||
|
string(": Values From File</font></nobr><br><br>"
|
||||||
|
"<nobr>The positions list was not set for an unknown reason.</nobr>"),"ScanWidget");
|
||||||
}else{//SUCCESS
|
}else{//SUCCESS
|
||||||
char cNum[200];sprintf(cNum,"%d",actualNumSteps);
|
char cNum[200];sprintf(cNum,"%d",actualNumSteps);
|
||||||
char cId[5];sprintf(cId,"%d",id);
|
qDefs::InfoMessage(string("<nobr><font color=\"blue\">Scan Level ")+string(cId)+
|
||||||
qDefs::InfoMessage(string("Scan Level ")+string(cId)+(" - ")+string(" Number of positions added from file : ")+string(cNum),"ScanWidget");
|
string(": Values From File</font></nobr><br><br><nobr>Number of positions added: ")+
|
||||||
|
string(cNum)+string("</nobr>"),"ScanWidget");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -711,7 +874,7 @@ void qScanWidget::LoadPositions(){
|
|||||||
cout << "Loading positions" << endl;
|
cout << "Loading positions" << 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()));
|
disconnect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps(int)));
|
||||||
disconnect(btnGroup, SIGNAL(buttonClicked(QAbstractButton*)),this,SLOT(EnableSizeWidgets()));
|
disconnect(btnGroup, SIGNAL(buttonClicked(QAbstractButton*)),this,SLOT(EnableSizeWidgets()));
|
||||||
|
|
||||||
|
|
||||||
@ -735,15 +898,14 @@ void qScanWidget::LoadPositions(){
|
|||||||
for(int i=0;i<actualNumSteps;i++)
|
for(int i=0;i<actualNumSteps;i++)
|
||||||
positions[i] = values[i];
|
positions[i] = values[i];
|
||||||
|
|
||||||
|
//if there are positions
|
||||||
|
|
||||||
//if there are no step sizes
|
|
||||||
if(numSteps){
|
if(numSteps){
|
||||||
radioCustom->setText("Specific Values");
|
radioCustom->setText("Specific Values");
|
||||||
radioCustom->setPalette(normal);
|
radioCustom->setPalette(normal);
|
||||||
radioCustom->setToolTip(customTip);
|
radioCustom->setToolTip(customTip);
|
||||||
comboCustom->setToolTip(customTip);
|
comboCustom->setToolTip(customTip);
|
||||||
}else{
|
}//no positions and has a mode
|
||||||
|
else if(mode){
|
||||||
radioCustom->setPalette(red);
|
radioCustom->setPalette(red);
|
||||||
radioCustom->setText("Specific Values*");
|
radioCustom->setText("Specific Values*");
|
||||||
QString tip = customTip + QString("<br><br><nobr><font color=\"red\">First, increase <b>Number of Steps</b>. "
|
QString tip = customTip + QString("<br><br><nobr><font color=\"red\">First, increase <b>Number of Steps</b>. "
|
||||||
@ -760,11 +922,13 @@ void qScanWidget::LoadPositions(){
|
|||||||
comboCustom->setEnabled(numSteps&&mode);
|
comboCustom->setEnabled(numSteps&&mode);
|
||||||
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()));
|
connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps(int)));
|
||||||
connect(btnGroup, SIGNAL(buttonClicked(QAbstractButton*)),this,SLOT(EnableSizeWidgets()));
|
connect(btnGroup, SIGNAL(buttonClicked(QAbstractButton*)),this,SLOT(EnableSizeWidgets()));
|
||||||
|
|
||||||
|
|
||||||
|
//do not set the range variables because if the stepsize is by any chance 0..
|
||||||
|
//then the number of steps should change to 1. so only set custom steps
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -76,6 +76,9 @@ void qTabActions::SetupWidgetWindow(){
|
|||||||
lblName[i] = new QLabel(QString(names[i]));
|
lblName[i] = new QLabel(QString(names[i]));
|
||||||
btnExpand[i] = new QPushButton("+");
|
btnExpand[i] = new QPushButton("+");
|
||||||
btnExpand[i]->setFixedSize(20,20);
|
btnExpand[i]->setFixedSize(20,20);
|
||||||
|
QString tip = "<nobr>Click on the \"+\" to Expand or \"-\" to Collapse.</nobr>";
|
||||||
|
lblName[i]->setToolTip(tip);
|
||||||
|
btnExpand[i]->setToolTip(tip);
|
||||||
group->addButton(btnExpand[i],i);
|
group->addButton(btnExpand[i],i);
|
||||||
|
|
||||||
//Number of positions is only for mythen or gotthard
|
//Number of positions is only for mythen or gotthard
|
||||||
|
Loading…
x
Reference in New Issue
Block a user