mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-06 10:00:40 +02:00
fixed bugs to do with stacked trace and fixed file input range for scan
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@22 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
parent
63f9d04981
commit
2dbdf8ff17
@ -62,19 +62,47 @@
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioConstant">
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioRange">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Constant Step Size</string>
|
||||
</property>
|
||||
@ -84,7 +112,11 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioSpecific">
|
||||
<widget class="QRadioButton" name="radioCustom">
|
||||
<property name="toolTip">
|
||||
<string><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></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Specific Values</string>
|
||||
</property>
|
||||
@ -94,13 +126,17 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioValue">
|
||||
<widget class="QRadioButton" name="radioFile">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><nobr>Measures only at the specific values listed in a file.</nobr><br>
|
||||
<nobr>Select the file, where these values are listed.</nobr></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Values from File</string>
|
||||
</property>
|
||||
@ -109,6 +145,22 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
@ -283,13 +335,13 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1000000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>2</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -55,6 +55,10 @@
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="chkFlatField">
|
||||
<property name="toolTip">
|
||||
<string>Flat field corrections.
|
||||
#flatfield# filename</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Flat Field File:</string>
|
||||
</property>
|
||||
@ -81,6 +85,10 @@
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Flat field corrections.
|
||||
#flatfield# filename</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
@ -219,6 +227,10 @@
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Flat field corrections.
|
||||
#flatfield# filename</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Browse</string>
|
||||
</property>
|
||||
@ -236,6 +248,9 @@
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="chkAngular">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Angular Conversion</string>
|
||||
</property>
|
||||
@ -299,56 +314,6 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QLabel" name="lblNote">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>245</x>
|
||||
<y>327</y>
|
||||
<width>256</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>193</red>
|
||||
<green>193</green>
|
||||
<blue>193</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>* Note: Enter valid file to enable Flat Field.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
@ -427,13 +427,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Timing Mode:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" colspan="2">
|
||||
<widget class="QComboBox" name="comboTimingMode">
|
||||
<property name="sizePolicy">
|
||||
@ -632,6 +625,10 @@
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Frame period between exposures.
|
||||
#period#</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Acquisition Period:</string>
|
||||
</property>
|
||||
@ -731,6 +728,13 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblTimingMode">
|
||||
<property name="text">
|
||||
<string>Timing Mode:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
@ -873,56 +877,6 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QLabel" name="lblNote">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>130</x>
|
||||
<y>330</y>
|
||||
<width>521</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>193</red>
|
||||
<green>193</green>
|
||||
<blue>193</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>* Note: The Acquisition Period should be greater than or equal to the Exposure Time.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
@ -196,7 +196,7 @@
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>20</y>
|
||||
<width>358</width>
|
||||
<width>356</width>
|
||||
<height>26</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -220,7 +220,7 @@
|
||||
<item row="0" column="3">
|
||||
<widget class="QCheckBox" name="checkBox">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
@ -236,7 +236,7 @@
|
||||
<item row="0" column="4">
|
||||
<widget class="QCheckBox" name="checkBox_2">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
@ -380,7 +380,7 @@
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkAutoFName">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
@ -412,7 +412,7 @@
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkSaveAll">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
@ -1458,7 +1458,7 @@
|
||||
<item row="0" column="4">
|
||||
<widget class="QPushButton" name="btnCloseClones_2">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
|
@ -58,9 +58,9 @@ private:
|
||||
|
||||
private slots:
|
||||
/** Sets the scan or script. Accordingly enables, disables other widgets
|
||||
* @param index value chosen
|
||||
* @param mode value chosen
|
||||
* */
|
||||
void SetScript(int index);
|
||||
void SetMode(int mode);
|
||||
|
||||
/** Browse for the script
|
||||
* */
|
||||
@ -71,9 +71,8 @@ void BrowsePath();
|
||||
void SetScriptFile();
|
||||
|
||||
/** Set Parameter
|
||||
* @param parameter is the parameter to be set to
|
||||
* */
|
||||
void SetParameter(const QString& parameter);
|
||||
void SetParameter();
|
||||
|
||||
};
|
||||
|
||||
|
@ -22,6 +22,11 @@ public:
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
enum{
|
||||
OK,
|
||||
FAIL
|
||||
};
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
/** unit of time
|
||||
*/
|
||||
enum timeUnit{
|
||||
|
@ -16,6 +16,7 @@ class multiSlsDetector;
|
||||
#include <QStackedLayout>
|
||||
/** C++ Include Headers */
|
||||
#include <string>
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
|
||||
|
||||
@ -42,17 +43,34 @@ private:
|
||||
multiSlsDetector *myDet;
|
||||
/**id of the scan widget*/
|
||||
int id;
|
||||
/**type of steps*/
|
||||
enum sizeIndex{RangeValues, CustomValues, FileValues};
|
||||
enum modes{None,EnergyScan,ThresholdScan,TrimbitsScan,CustomScript,NumModes};
|
||||
static const string modeNames[NumModes];
|
||||
|
||||
QStackedLayout *stackedLayout;
|
||||
QLabel *lblFrom;
|
||||
QSpinBox *spinFrom;
|
||||
QLabel *lblTo;
|
||||
QSpinBox *spinTo;
|
||||
QLabel *lblSize;
|
||||
QSpinBox *spinSize;
|
||||
QComboBox *comboSpecific;
|
||||
QLineEdit *dispValues;
|
||||
QPushButton *btnValues;
|
||||
/**values*/
|
||||
int actualNumSteps;
|
||||
vector <double> positions;
|
||||
|
||||
/**non error font*/
|
||||
QPalette normal;
|
||||
QPalette red;
|
||||
QString customTip;
|
||||
QString fileTip;
|
||||
|
||||
/**widgets needed for diff size types*/
|
||||
QButtonGroup *btnGroup;
|
||||
QStackedLayout *stackedLayout;
|
||||
QLabel *lblFrom;
|
||||
QDoubleSpinBox *spinFrom;
|
||||
QLabel *lblTo;
|
||||
QDoubleSpinBox *spinTo;
|
||||
QLabel *lblSize;
|
||||
QDoubleSpinBox *spinSize;
|
||||
QComboBox *comboCustom;
|
||||
QPushButton *btnCustom;
|
||||
QLineEdit *dispFile;
|
||||
QPushButton *btnFile;
|
||||
|
||||
|
||||
/** Sets up the widget
|
||||
@ -62,17 +80,24 @@ private:
|
||||
/** Sets up all the slots and signals */
|
||||
void Initialization();
|
||||
|
||||
/** Sets up all the parameters from server/client */
|
||||
void LoadPositions();
|
||||
|
||||
/** Sets up the scan parameters
|
||||
* returns if it was set
|
||||
*/
|
||||
int SetScan(int mode);
|
||||
|
||||
private slots:
|
||||
/** Sets the scan or script. Accordingly enables, disables other widgets
|
||||
* @param index value chosen*/
|
||||
void SetScript(int index);
|
||||
|
||||
/** Enables widgets depending on which size is clicked.
|
||||
* Options: constant size,specific values,values from file */
|
||||
* Options: constant size,specific values,values from file
|
||||
* */
|
||||
void EnableSizeWidgets();
|
||||
|
||||
/** Sets the scan or script. Accordingly enables, disables other widgets
|
||||
* @param mode value chosen*/
|
||||
void SetMode(int mode);
|
||||
|
||||
/** Browse for the script
|
||||
* */
|
||||
void BrowsePath();
|
||||
@ -82,9 +107,34 @@ void BrowsePath();
|
||||
void SetScriptFile();
|
||||
|
||||
/** Set Parameter
|
||||
* @param parameter is the parameter to be set to
|
||||
* */
|
||||
void SetParameter(const QString& parameter);
|
||||
void SetParameter();
|
||||
|
||||
/** Set precision
|
||||
* @param value value of precision to be set
|
||||
* */
|
||||
void SetPrecision(int value);
|
||||
|
||||
/** Set number of steps
|
||||
* */
|
||||
void SetNSteps();
|
||||
|
||||
/** Set custom steps
|
||||
* returns OK if set properly
|
||||
* */
|
||||
int SetCustomSteps();
|
||||
|
||||
/** Delete custom steps
|
||||
* */
|
||||
void DeleteCustomSteps();
|
||||
|
||||
/** Reads the file to get the steps
|
||||
* */
|
||||
void SetFileSteps();
|
||||
|
||||
/** Browses for the file path for steps
|
||||
* */
|
||||
void BrowseFileStepsPath();
|
||||
|
||||
|
||||
|
||||
|
@ -77,7 +77,7 @@ private:
|
||||
QCheckBox *chkSeparate;
|
||||
QCheckBox *chkReturn;
|
||||
|
||||
float *positions;
|
||||
double *positions;
|
||||
QPalette normal;
|
||||
|
||||
|
||||
|
@ -51,6 +51,10 @@ private:
|
||||
/** detector type */
|
||||
slsDetectorDefs::detectorType detType;
|
||||
|
||||
QString flatFieldTip;
|
||||
QString errFlatFieldTip;
|
||||
QPalette red;
|
||||
|
||||
/** methods */
|
||||
/** Sets up the widget */
|
||||
void SetupWidgetWindow();
|
||||
|
@ -56,6 +56,10 @@ private:
|
||||
|
||||
int currentMeasurement;
|
||||
|
||||
QString acqPeriodTip;
|
||||
QString errPeriodTip;
|
||||
QPalette red;
|
||||
|
||||
/** methods */
|
||||
/** Sets up the widget
|
||||
*/
|
||||
|
@ -53,40 +53,40 @@ void qActionsWidget::SetupWidgetWindow(){
|
||||
|
||||
void qActionsWidget::Initialization(){
|
||||
//mode
|
||||
connect(comboScript, SIGNAL(currentIndexChanged(int)), this,SLOT(SetScript(int)));
|
||||
connect(comboScript, SIGNAL(currentIndexChanged(int)), this,SLOT(SetMode(int)));
|
||||
//file
|
||||
connect(dispScript, SIGNAL(editingFinished()), this, SLOT(SetScriptFile()));
|
||||
connect(btnBrowse, SIGNAL(clicked()), this, SLOT(BrowsePath()));
|
||||
//parameter
|
||||
connect(dispParameter, SIGNAL(textChanged(const QString&)), this, SLOT(SetParameter(const QString&)));
|
||||
connect(dispParameter, SIGNAL(editingFinished()), this, SLOT(SetParameter()));
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qActionsWidget::SetScript(int index){
|
||||
void qActionsWidget::SetMode(int mode){
|
||||
#ifdef VERBOSE
|
||||
cout << "Setting mode of action widget:" << id << " to " << index << endl;
|
||||
cout << "Setting\taction:" << id << "\tmode:" << mode << endl;
|
||||
#endif
|
||||
//enabling/disabling
|
||||
dispScript->setEnabled(index);
|
||||
btnBrowse->setEnabled(index);
|
||||
lblParameter->setEnabled(index);
|
||||
dispParameter->setEnabled(index);
|
||||
dispScript->setEnabled(mode);
|
||||
btnBrowse->setEnabled(mode);
|
||||
lblParameter->setEnabled(mode);
|
||||
dispParameter->setEnabled(mode);
|
||||
|
||||
QString fName = dispScript->text();
|
||||
//set the mode
|
||||
if(index) myDet->setActionScript(id,fName.toAscii().constData());
|
||||
if(mode) myDet->setActionScript(id,fName.toAscii().constData());
|
||||
else myDet->setActionScript(id,"");
|
||||
//mode is not set when fname is blank
|
||||
if(!fName.isEmpty()){
|
||||
//check if mode didnt get set
|
||||
if(index!=myDet->getActionMode(id)){
|
||||
if(mode!=myDet->getActionMode(id)){
|
||||
qDefs::WarningMessage("The mode could not be changed.","ActionsWidget");
|
||||
comboScript->setCurrentIndex(myDet->getActionMode(id));
|
||||
}//if mode got set and its custom script
|
||||
else if(index){
|
||||
else if(mode){
|
||||
//when the file name did not get set correctly
|
||||
if(fName.compare(QString(myDet->getActionScript(id).c_str()))){
|
||||
qDefs::WarningMessage("The file path could not be set.","ActionsWidget");
|
||||
@ -123,10 +123,8 @@ void qActionsWidget::BrowsePath(){
|
||||
void qActionsWidget::SetScriptFile(){
|
||||
QString fName = dispScript->text();
|
||||
#ifdef VERBOSE
|
||||
cout << "Setting script file of action widget:" << id << " to " << fName.toAscii().constData() << endl;
|
||||
cout << "Setting\taction:" << id << "\tscript:" << fName.toAscii().constData() << endl;
|
||||
#endif
|
||||
disconnect(dispScript, SIGNAL(editingFinished()), this, SLOT(SetScriptFile()));
|
||||
|
||||
bool set = false;
|
||||
|
||||
//blank
|
||||
@ -166,19 +164,20 @@ void qActionsWidget::SetScriptFile(){
|
||||
//dont display if theres a none
|
||||
if(!dispScript->text().compare("none")) dispScript->setText("");
|
||||
|
||||
connect(dispScript, SIGNAL(editingFinished()), this, SLOT(SetScriptFile()));
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qActionsWidget::SetParameter(const QString& parameter){
|
||||
void qActionsWidget::SetParameter(){
|
||||
QString parameter = dispParameter->text();
|
||||
#ifdef VERBOSE
|
||||
cout << "Setting parameter of action widget:" << id << " to " << parameter.toAscii().constData() << endl;
|
||||
cout << "Setting\taction:" << id << "\tparameter:" << parameter.toAscii().constData() << endl;
|
||||
#endif
|
||||
myDet->setActionParameter(id,parameter.toAscii().constData());
|
||||
//dont display if theres a none
|
||||
if(!dispParameter->text().compare("none")) dispParameter->setText("");
|
||||
}
|
||||
|
||||
|
||||
@ -189,16 +188,19 @@ void qActionsWidget::Refresh(){
|
||||
int mode = (myDet->getActionMode(id)>0?1:0);
|
||||
string script = myDet->getActionScript(id);
|
||||
string parameter = myDet->getActionParameter(id);
|
||||
//defaults
|
||||
if(script == "none") script="";
|
||||
if(parameter == "none") parameter="";
|
||||
//settings values
|
||||
|
||||
//settings values and checking for none
|
||||
dispScript->setText(QString(script.c_str()));
|
||||
SetScriptFile();
|
||||
dispParameter->setText(QString(parameter.c_str()));
|
||||
SetParameter();
|
||||
//set mode which also checks everything
|
||||
comboScript->setCurrentIndex(mode);
|
||||
#ifdef VERBOSE
|
||||
cout << "Updated action widget " << id << "\tmode:"<<mode<<"\tscript:" << script << "\tparameter:" << parameter << endl;
|
||||
cout << "Updated\taction:" << id << "\t"
|
||||
"mode:"<<mode<<"\t"
|
||||
"script:" << script << "\t"
|
||||
"parameter:" << parameter << endl << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -157,6 +157,7 @@ void qDetectorMain::SetUpWidgetWindow(){
|
||||
heightCentralWidget = centralwidget->size().height();
|
||||
// Default zoom Tool Tip
|
||||
zoomToolTip = dockWidgetPlot->toolTip();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -306,8 +306,8 @@ int qDrawPlot::GetData(detectorData *data){
|
||||
for(int i=currentPersistency;i>0;i--)
|
||||
memcpy(yvalues[i],yvalues[i-1],nPixelsX*sizeof(double));
|
||||
nHists = currentPersistency+1;
|
||||
//memcpy(yvalues[0],data->values,nPixelsX*sizeof(double));
|
||||
for(int i=0;i<(int)nPixelsX;i++) *(yvalues[0]+i) = (double)*(data->values+i);
|
||||
memcpy(yvalues[0],data->values,nPixelsX*sizeof(double));
|
||||
//for(int i=0;i<(int)nPixelsX;i++) *(yvalues[0]+i) = (double)*(data->values+i);
|
||||
}
|
||||
/**2d*/
|
||||
else{
|
||||
|
@ -16,18 +16,24 @@
|
||||
|
||||
// C++ Include Headers
|
||||
#include<iostream>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
using namespace std;
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
int qScanWidget::NUM_SCAN_WIDGETS(0);
|
||||
const string qScanWidget::modeNames[NumModes]={"","energy","threshold","trimbits","custom script"};
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
qScanWidget::qScanWidget(QWidget *parent,multiSlsDetector*& detector):
|
||||
QWidget(parent),myDet(detector){
|
||||
QWidget(parent),myDet(detector),actualNumSteps(0){
|
||||
setupUi(this);
|
||||
SetupWidgetWindow();
|
||||
Initialization();
|
||||
LoadPositions();
|
||||
}
|
||||
|
||||
|
||||
@ -49,63 +55,92 @@ void qScanWidget::SetupWidgetWindow(){
|
||||
|
||||
setFixedHeight(125);
|
||||
|
||||
btnGroup = new QButtonGroup(this);
|
||||
btnGroup->addButton(radioRange,0);
|
||||
btnGroup->addButton(radioCustom,1);
|
||||
btnGroup->addButton(radioFile,2);
|
||||
|
||||
|
||||
normal = radioCustom->palette();
|
||||
red = QPalette();
|
||||
red.setColor(QPalette::Active,QPalette::WindowText,Qt::red);
|
||||
fileTip = radioFile->toolTip();
|
||||
customTip = radioCustom->toolTip();
|
||||
|
||||
//layout for the size widgets
|
||||
stackedLayout = new QStackedLayout;
|
||||
stackedLayout->setSpacing(0);
|
||||
|
||||
// Constant Size Layout
|
||||
QWidget *constantWidget = new QWidget;
|
||||
QHBoxLayout *layoutConstant = new QHBoxLayout(constantWidget);
|
||||
layoutConstant->setContentsMargins(0, 0, 0, 0);
|
||||
layoutConstant->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
|
||||
lblFrom = new QLabel("from",constantWidget);
|
||||
// Range Size Layout
|
||||
QWidget *widgetRange = new QWidget;
|
||||
QHBoxLayout *layoutRange = new QHBoxLayout(widgetRange);
|
||||
layoutRange->setContentsMargins(0, 0, 0, 0);
|
||||
lblFrom = new QLabel("from",widgetRange);
|
||||
spinFrom = new QDoubleSpinBox(widgetRange);
|
||||
lblTo = new QLabel("to",widgetRange);
|
||||
spinTo = new QDoubleSpinBox(widgetRange);
|
||||
lblSize = new QLabel("Size",widgetRange);
|
||||
spinSize = new QDoubleSpinBox(widgetRange);
|
||||
lblFrom->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||
layoutConstant->addWidget(lblFrom);
|
||||
spinFrom = new QSpinBox(constantWidget);
|
||||
layoutConstant->addWidget(spinFrom);
|
||||
lblTo = new QLabel("to",constantWidget);
|
||||
spinFrom->setValue(0);
|
||||
lblTo->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||
layoutConstant->addWidget(lblTo);
|
||||
spinTo = new QSpinBox(constantWidget);
|
||||
layoutConstant->addWidget(spinTo);
|
||||
layoutConstant->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
|
||||
lblSize = new QLabel("Size",constantWidget);
|
||||
spinTo->setValue(1);
|
||||
lblSize->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||
layoutConstant->addWidget(lblSize);
|
||||
spinSize = new QSpinBox(constantWidget);
|
||||
layoutConstant->addWidget(spinSize);
|
||||
layoutConstant->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
|
||||
|
||||
// Specific Values Layout
|
||||
QWidget *specificWidget = new QWidget;
|
||||
QHBoxLayout *layoutSpecific = new QHBoxLayout(specificWidget);
|
||||
layoutSpecific->setContentsMargins(0, 0, 0, 0);
|
||||
layoutSpecific->addItem(new QSpacerItem(200,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
|
||||
comboSpecific = new QComboBox(specificWidget);
|
||||
comboSpecific->setEditable(true);
|
||||
comboSpecific->setCompleter(false);
|
||||
layoutSpecific->addWidget(comboSpecific);
|
||||
layoutSpecific->addItem(new QSpacerItem(200,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
|
||||
|
||||
// Values From a File Layout
|
||||
QWidget *valuesWidget = new QWidget;
|
||||
QHBoxLayout *layoutValues = new QHBoxLayout(valuesWidget);
|
||||
layoutValues->setContentsMargins(0, 0, 0, 0);
|
||||
layoutValues->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
|
||||
dispValues = new QLineEdit("steps.txt",valuesWidget);
|
||||
dispValues->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);
|
||||
layoutValues->addWidget(dispValues);
|
||||
btnValues = new QPushButton("Browse",valuesWidget);
|
||||
btnValues->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||
layoutValues->addWidget(btnValues);
|
||||
layoutValues->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
|
||||
spinSize->setValue(1);
|
||||
layoutRange->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
|
||||
layoutRange->addWidget(lblFrom);
|
||||
layoutRange->addWidget(spinFrom);
|
||||
layoutRange->addWidget(lblTo);
|
||||
layoutRange->addWidget(spinTo);
|
||||
layoutRange->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
|
||||
layoutRange->addWidget(lblSize);
|
||||
layoutRange->addWidget(spinSize);
|
||||
layoutRange->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
|
||||
|
||||
|
||||
stackedLayout->addWidget(constantWidget);
|
||||
stackedLayout->addWidget(specificWidget);
|
||||
stackedLayout->addWidget(valuesWidget);
|
||||
// Custom Values Layout
|
||||
QWidget *widgetCustom = new QWidget;
|
||||
QHBoxLayout *layoutCustom = new QHBoxLayout(widgetCustom);
|
||||
layoutCustom->setContentsMargins(0, 0, 0, 0);
|
||||
comboCustom = new QComboBox(widgetCustom);
|
||||
btnCustom = new QPushButton("Delete",widgetCustom);
|
||||
comboCustom->setEditable(true);
|
||||
comboCustom->setCompleter(false);
|
||||
QDoubleValidator *validate = new QDoubleValidator(comboCustom);
|
||||
comboCustom->setValidator(validate);
|
||||
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);
|
||||
layoutCustom->addItem(new QSpacerItem(160,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
|
||||
layoutCustom->addWidget(comboCustom);
|
||||
layoutCustom->addItem(new QSpacerItem(5,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
|
||||
layoutCustom->addWidget(btnCustom);
|
||||
layoutCustom->addItem(new QSpacerItem(160,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
|
||||
|
||||
// File values From a File Layout
|
||||
QWidget *widgetFile = new QWidget;
|
||||
QHBoxLayout *layoutFile = new QHBoxLayout(widgetFile);
|
||||
layoutFile->setContentsMargins(0, 0, 0, 0);
|
||||
layoutFile->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
|
||||
dispFile = new QLineEdit(widgetFile);
|
||||
dispFile->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);
|
||||
layoutFile->addWidget(dispFile);
|
||||
btnFile = new QPushButton("Browse",widgetFile);
|
||||
btnFile->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||
layoutFile->addWidget(btnFile);
|
||||
layoutFile->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
|
||||
|
||||
|
||||
stackedLayout->addWidget(widgetRange);
|
||||
stackedLayout->addWidget(widgetCustom);
|
||||
stackedLayout->addWidget(widgetFile);
|
||||
stackedWidget->setLayout(stackedLayout);
|
||||
|
||||
radioCustom->setChecked(true);
|
||||
stackedLayout->setCurrentIndex(CustomValues);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -114,16 +149,26 @@ void qScanWidget::SetupWidgetWindow(){
|
||||
|
||||
void qScanWidget::Initialization(){
|
||||
//mode
|
||||
connect(comboScript, SIGNAL(currentIndexChanged(int)), this,SLOT(SetScript(int)));
|
||||
connect(comboScript, SIGNAL(currentIndexChanged(int)), this,SLOT(SetMode(int)));
|
||||
//file
|
||||
connect(dispScript, SIGNAL(editingFinished()), this, SLOT(SetScriptFile()));
|
||||
connect(btnBrowse, SIGNAL(clicked()), this, SLOT(BrowsePath()));
|
||||
//parameter
|
||||
connect(dispParameter, SIGNAL(textChanged(const QString&)), this, SLOT(SetParameter(const QString&)));
|
||||
connect(dispParameter, SIGNAL(editingFinished()), this, SLOT(SetParameter()));
|
||||
//sizewidgets
|
||||
connect(radioConstant, SIGNAL(toggled(bool)),this,SLOT(EnableSizeWidgets()));
|
||||
connect(radioSpecific, SIGNAL(toggled(bool)),this,SLOT(EnableSizeWidgets()));
|
||||
connect(radioValue, SIGNAL(toggled(bool)),this,SLOT(EnableSizeWidgets()));
|
||||
connect(btnGroup, SIGNAL(buttonClicked(QAbstractButton*)),this,SLOT(EnableSizeWidgets()));
|
||||
// connect(radioRange, SIGNAL(toggled(bool)),this,SLOT(EnableSizeWidgets()));
|
||||
//numsteps
|
||||
connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps()));
|
||||
//precision
|
||||
connect(spinPrecision, SIGNAL(valueChanged(int)), this, SLOT(SetPrecision(int)));
|
||||
//range values
|
||||
//custom values
|
||||
connect(comboCustom, SIGNAL(currentIndexChanged(int)), this, SLOT(SetCustomSteps()));
|
||||
connect(btnCustom, SIGNAL(clicked()), this, SLOT(DeleteCustomSteps()));
|
||||
//file values
|
||||
connect(dispFile, SIGNAL(editingFinished()), this, SLOT(SetFileSteps()));
|
||||
connect(btnFile, SIGNAL(clicked()), this, SLOT(BrowseFileStepsPath()));
|
||||
}
|
||||
|
||||
|
||||
@ -131,21 +176,86 @@ void qScanWidget::Initialization(){
|
||||
|
||||
|
||||
void qScanWidget::EnableSizeWidgets(){
|
||||
if(radioConstant->isChecked())
|
||||
stackedLayout->setCurrentIndex(0);
|
||||
else if(radioSpecific->isChecked())
|
||||
stackedLayout->setCurrentIndex(1);
|
||||
else
|
||||
stackedLayout->setCurrentIndex(2);
|
||||
#ifdef VERBOSE
|
||||
cout << "Entering enable size widgets" << endl;
|
||||
#endif
|
||||
//scan is none
|
||||
if(!comboScript->currentIndex()){
|
||||
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);
|
||||
}
|
||||
else{
|
||||
// Steps are enabled for all except Range step size
|
||||
lblSteps->setEnabled(!radioRange->isChecked());
|
||||
spinSteps->setEnabled(!radioRange->isChecked());
|
||||
//range values
|
||||
if(radioRange->isChecked()){
|
||||
#ifdef VERBOSE
|
||||
cout << "Constant Range Values" << endl;
|
||||
#endif
|
||||
stackedLayout->setCurrentIndex(RangeValues);
|
||||
/**refresh this part*/
|
||||
}
|
||||
//custom values
|
||||
else if(radioCustom->isChecked()){
|
||||
#ifdef VERBOSE
|
||||
cout << "Custom Values" << endl;
|
||||
#endif
|
||||
//defaults for other mode
|
||||
radioFile->setPalette(normal);
|
||||
radioFile->setText("Values from File:");
|
||||
radioFile->setToolTip(fileTip);
|
||||
dispFile->setToolTip(fileTip);
|
||||
btnFile->setToolTip(fileTip);
|
||||
|
||||
//change it back as this list is what will be loaded.
|
||||
//also numstpes could have been changed in other modes too
|
||||
disconnect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps()));
|
||||
spinSteps ->setValue(comboCustom->count());
|
||||
connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps()));
|
||||
|
||||
stackedLayout->setCurrentIndex(CustomValues);
|
||||
//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
|
||||
if(SetCustomSteps()==qDefs::OK){
|
||||
char cNum[200];sprintf(cNum,"%d",actualNumSteps);
|
||||
char cId[5];sprintf(cId,"%d",id);
|
||||
qDefs::InfoMessage(string("Scan Level ")+string(cId)+(" - ")+string(" Number of positions added from list : ")+string(cNum),"ScanWidget");
|
||||
}
|
||||
}
|
||||
//file values
|
||||
else{
|
||||
#ifdef VERBOSE
|
||||
cout << "File Values" << endl;
|
||||
#endif
|
||||
//defaults for other mode
|
||||
radioCustom->setText("Specific Values");
|
||||
radioCustom->setPalette(normal);
|
||||
radioCustom->setToolTip(customTip);
|
||||
comboCustom->setToolTip(customTip);
|
||||
|
||||
stackedLayout->setCurrentIndex(FileValues);
|
||||
SetFileSteps();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qScanWidget::SetScript(int index){
|
||||
void qScanWidget::SetMode(int mode){
|
||||
#ifdef VERBOSE
|
||||
cout << "Setting mode of scan widget:" << id << " to " << index << endl;
|
||||
cout << "Setting\tscan:" << id << "\tmode:" << mode << endl;
|
||||
#endif
|
||||
// defaults
|
||||
dispScript->setEnabled(false);
|
||||
@ -159,9 +269,12 @@ void qScanWidget::SetScript(int index){
|
||||
spinPrecision->setEnabled(false);
|
||||
|
||||
// If anything other than None is selected
|
||||
if(index){
|
||||
if(mode){
|
||||
// Steps are enabled for all except Range step size
|
||||
lblSteps->setEnabled(!radioRange->isChecked());
|
||||
spinSteps->setEnabled(!radioRange->isChecked());
|
||||
// Custom Script only enables the first layout with addnl parameters etc
|
||||
if(index==4){
|
||||
if(mode==CustomScript){
|
||||
dispScript->setEnabled(true);
|
||||
btnBrowse->setEnabled(true);
|
||||
lblParameter->setEnabled(true);
|
||||
@ -170,36 +283,63 @@ void qScanWidget::SetScript(int index){
|
||||
group->setEnabled(true);
|
||||
lblPrecision->setEnabled(true);
|
||||
spinPrecision->setEnabled(true);
|
||||
// Steps are enabled only if constant step size is not checked
|
||||
lblSteps->setEnabled(!radioConstant->isChecked());
|
||||
spinSteps->setEnabled(!radioConstant->isChecked());
|
||||
|
||||
}
|
||||
|
||||
//set the group box widgets
|
||||
EnableSizeWidgets();
|
||||
|
||||
//emit signal to enable scanbox in plot tab
|
||||
emit EnableScanBox(index,id);
|
||||
emit EnableScanBox(mode,id);
|
||||
|
||||
|
||||
QString fName = dispScript->text();
|
||||
//set the mode
|
||||
if(index) myDet->setActionScript(id,fName.toAscii().constData());
|
||||
else myDet->setActionScript(id,"");
|
||||
//mode is not set when fname is blank
|
||||
if(!fName.isEmpty()){
|
||||
//check if mode didnt get set
|
||||
if(index!=myDet->getActionMode(id)){
|
||||
qDefs::WarningMessage("The mode could not be changed.","ScanWidget");
|
||||
comboScript->setCurrentIndex(myDet->getActionMode(id));
|
||||
}//if mode got set and its custom script
|
||||
else if(index){
|
||||
//when the file name did not get set correctly
|
||||
if(fName.compare(QString(myDet->getActionScript(id).c_str()))){
|
||||
qDefs::WarningMessage("The file path could not be set.","ScanWidget");
|
||||
dispScript->setText(QString(myDet->getActionScript(id).c_str()));
|
||||
SetScriptFile();
|
||||
}
|
||||
SetScan(mode);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
int qScanWidget::SetScan(int mode){
|
||||
string parameter = string(dispParameter->text().toAscii().constData());
|
||||
string script = string(dispScript->text().toAscii().constData());
|
||||
#ifdef VERBOSE
|
||||
cout << "SETTING scan:" << id << "\tmode:" << comboScript->currentIndex() <<
|
||||
"\tnumSteps:" << actualNumSteps <<
|
||||
"\tscript:" << script << "\tparameter:" << parameter << endl;
|
||||
#endif
|
||||
double *values;
|
||||
if(actualNumSteps) values = new double[actualNumSteps];
|
||||
else values = NULL;
|
||||
for(int i=0;i<actualNumSteps;i++) values[i] = positions[i];
|
||||
|
||||
//setting the mode
|
||||
switch(mode){
|
||||
case None:
|
||||
myDet->setScan(id,modeNames[mode],actualNumSteps,values,parameter);
|
||||
break;
|
||||
case EnergyScan:
|
||||
myDet->setScan(id,modeNames[mode],actualNumSteps,values,parameter);
|
||||
break;
|
||||
case ThresholdScan:
|
||||
myDet->setScan(id,modeNames[mode],actualNumSteps,values,parameter);
|
||||
break;
|
||||
case TrimbitsScan:
|
||||
myDet->setScan(id,modeNames[mode],actualNumSteps,values,parameter);
|
||||
break;
|
||||
case CustomScript:
|
||||
myDet->setScan(id,script,actualNumSteps,values,parameter);
|
||||
break;
|
||||
}
|
||||
|
||||
if(mode!=CustomScript){
|
||||
if((mode!=myDet->getScanMode(id))&&(actualNumSteps)){
|
||||
qDefs::WarningMessage("The mode could not be changed for an unknown reason.","ScanWidget");
|
||||
comboScript->setCurrentIndex(myDet->getScanMode(id));
|
||||
return qDefs::FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
return qDefs::OK;
|
||||
}
|
||||
|
||||
|
||||
@ -207,11 +347,11 @@ void qScanWidget::SetScript(int index){
|
||||
|
||||
void qScanWidget::BrowsePath(){
|
||||
#ifdef VERBOSE
|
||||
cout << "Browsing Script File Path" << endl;
|
||||
cout << "Browsing Script File Path\tscan:" << id << endl;
|
||||
#endif
|
||||
QString fName = dispScript->text();
|
||||
QString dir = fName.section('/',0,-2,QString::SectionIncludeLeadingSep);
|
||||
if(dir.isEmpty()) dir = "/home";
|
||||
if(dir.isEmpty()) dir = "/home/";
|
||||
//dialog
|
||||
fName = QFileDialog::getOpenFileName(this,
|
||||
tr("Load Script File"),dir,
|
||||
@ -228,13 +368,18 @@ void qScanWidget::BrowsePath(){
|
||||
void qScanWidget::SetScriptFile(){
|
||||
QString fName = dispScript->text();bool set = false;
|
||||
#ifdef VERBOSE
|
||||
cout << "Setting script file of scan widget:" << id << " to " << fName.toAscii().constData() << endl;
|
||||
cout << "Setting\tscan:" << id << "\tscript:" << fName.toAscii().constData() << endl;
|
||||
#endif
|
||||
disconnect(dispScript, SIGNAL(editingFinished()), this, SLOT(SetScriptFile()));
|
||||
|
||||
|
||||
//blank
|
||||
if(fName.isEmpty()) set = true;
|
||||
else if(!fName.compare("none")) set = true;
|
||||
if(fName.isEmpty())
|
||||
set = true;
|
||||
else if( (!fName.compare("none"))||
|
||||
(!fName.compare("energy"))||
|
||||
(!fName.compare("threshold"))||
|
||||
(!fName.compare("trimbits")) )
|
||||
set = true;
|
||||
//not blank
|
||||
else{
|
||||
QString file = dispScript->text().section('/',-1);
|
||||
@ -246,31 +391,34 @@ void qScanWidget::SetScriptFile(){
|
||||
//if the file doesnt exist, set it to what it was before
|
||||
else{
|
||||
qDefs::WarningMessage("The script file entered does not exist","ScanWidget");
|
||||
dispScript->setText(QString(myDet->getActionScript(id).c_str()));
|
||||
dispScript->setText(QString(myDet->getScanScript(id).c_str()));
|
||||
}
|
||||
}//not a file, set it to what it was before
|
||||
else {
|
||||
qDefs::WarningMessage("The script file path entered is not a file","ScanWidget");
|
||||
dispScript->setText(QString(myDet->getActionScript(id).c_str()));
|
||||
dispScript->setText(QString(myDet->getScanScript(id).c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
//if blank or valid file
|
||||
if(set){
|
||||
myDet->setActionScript(id,fName.toAscii().constData());
|
||||
if(fName.compare(QString(myDet->getActionScript(id).c_str()))){
|
||||
myDet->setScanScript(id,fName.toAscii().constData());
|
||||
if(fName.compare(QString(myDet->getScanScript(id).c_str()))){
|
||||
//did not get set, write what is was before
|
||||
if(!fName.isEmpty())
|
||||
qDefs::WarningMessage("The script file could not be set. Reverting to previous file.","ScanWidget");
|
||||
dispScript->setText(QString(myDet->getActionScript(id).c_str()));
|
||||
dispScript->setText(QString(myDet->getScanScript(id).c_str()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//dont display if theres a none
|
||||
if(!dispScript->text().compare("none")) dispScript->setText("");
|
||||
|
||||
connect(dispScript, SIGNAL(editingFinished()), this, SLOT(SetScriptFile()));
|
||||
fName = dispScript->text();
|
||||
if( (!fName.compare("none"))||
|
||||
(!fName.compare("energy"))||
|
||||
(!fName.compare("threshold"))||
|
||||
(!fName.compare("trimbits")) )
|
||||
dispScript->setText("");
|
||||
|
||||
}
|
||||
|
||||
@ -278,13 +426,345 @@ void qScanWidget::SetScriptFile(){
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qScanWidget::SetParameter(const QString& parameter){
|
||||
void qScanWidget::SetParameter(){
|
||||
QString parameter = dispParameter->text();
|
||||
#ifdef VERBOSE
|
||||
cout << "Setting parameter of scan widget:" << id << " to " << parameter.toAscii().constData() << endl;
|
||||
cout << "Setting\tscan:" << id << "\tparameter:" << parameter.toAscii().constData() << endl;
|
||||
#endif
|
||||
|
||||
myDet->setActionParameter(id,parameter.toAscii().constData());
|
||||
myDet->setScanParameter(id,parameter.toAscii().constData());
|
||||
//dont display if theres a none
|
||||
parameter = dispParameter->text();
|
||||
if( (!parameter.compare("none"))||
|
||||
(!parameter.compare("energy"))||
|
||||
(!parameter.compare("threshold"))||
|
||||
(!parameter.compare("trimbits")) )
|
||||
dispParameter->setText("");
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qScanWidget::SetPrecision(int value){
|
||||
#ifdef VERBOSE
|
||||
cout << "Setting\tscan:" << id << "\tprecision:" << value << endl;
|
||||
#endif
|
||||
myDet->setScanPrecision(id,value);
|
||||
if(myDet->getScanPrecision(id)!=value)
|
||||
qDefs::WarningMessage("The precision was not set for an unknown reason.","ScanWidget");;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qScanWidget::SetNSteps(){
|
||||
|
||||
#ifdef VERBOSE
|
||||
cout << "Setting number of steps" << endl;
|
||||
#endif
|
||||
|
||||
int numSteps = spinSteps->value();
|
||||
comboCustom->setMaxCount(numSteps);
|
||||
|
||||
//check if its ok
|
||||
if(radioCustom->isChecked()){
|
||||
SetCustomSteps();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
int qScanWidget::SetCustomSteps(){
|
||||
|
||||
#ifdef VERBOSE
|
||||
cout << "Setting\tscan:" << id << "\tcustom\tnum pos:" << comboCustom->count() << endl;
|
||||
#endif
|
||||
disconnect(comboCustom, SIGNAL(currentIndexChanged(int)), this, SLOT(SetCustomSteps()));
|
||||
|
||||
//get number of positions
|
||||
int numSteps = spinSteps->value();
|
||||
comboCustom->setMaxCount(numSteps);
|
||||
comboCustom->setEnabled(numSteps);
|
||||
btnCustom->setEnabled(numSteps);
|
||||
|
||||
//deleting too many or not entering enough
|
||||
if(numSteps>comboCustom->count()){
|
||||
#ifdef VERBOSE
|
||||
cout << "Too few entries" << endl;
|
||||
#endif
|
||||
int diff = numSteps - (comboCustom->count());
|
||||
radioCustom->setPalette(red);
|
||||
radioCustom->setText("Specific Values*");
|
||||
QString tip = customTip + QString("<br><br><font color=\"red\"><nobr>Add ")+
|
||||
(QString("%1").arg(diff))+
|
||||
QString(" more positions to the list to match <b>Number of Steps</b>.<nobr><br>"
|
||||
"<nobr><nobr>Or reduce <b>Number of Steps</b>.</nobr></font>");
|
||||
radioCustom->setToolTip(tip);
|
||||
comboCustom->setToolTip(tip);
|
||||
}else{
|
||||
radioCustom->setText("Specific Values");
|
||||
radioCustom->setPalette(normal);
|
||||
radioCustom->setToolTip(customTip);
|
||||
comboCustom->setToolTip(customTip);
|
||||
}
|
||||
|
||||
actualNumSteps = comboCustom->count();
|
||||
//delete existing positions
|
||||
positions.resize(actualNumSteps);
|
||||
//copying the list
|
||||
for(int i=0;i<actualNumSteps;i++){
|
||||
positions[i] = comboCustom->itemText(i).toDouble();
|
||||
cout<<"positions["<<i<<"]:"<<positions[i]<<endl;
|
||||
}
|
||||
//setting the list
|
||||
//cout<<"output:"<<myDet->setScanSteps(id,actualNumSteps,positions)<<endl;
|
||||
|
||||
//sets the scan
|
||||
if(SetScan(comboScript->currentIndex())==qDefs::OK){
|
||||
if(myDet->getScanSteps(id)!=actualNumSteps){
|
||||
qDefs::WarningMessage("The positions list was not set for an unknown reason.","ScanWidget");
|
||||
LoadPositions();
|
||||
comboScript->setCurrentIndex(myDet->getScanMode(id));
|
||||
return qDefs::FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
//if num of steps = 0
|
||||
if(!spinSteps->value()){
|
||||
comboCustom->setEnabled(false);
|
||||
btnCustom->setEnabled(false);
|
||||
radioCustom->setPalette(red);
|
||||
radioCustom->setText("Specific Values*");
|
||||
QString tip = customTip + QString("<br><br><nobr><font color=\"red\">First, increase <b>Number of Steps</b>. "
|
||||
"Then, enter values here.</font></nobr>");
|
||||
radioCustom->setToolTip(tip);
|
||||
comboCustom->setToolTip(tip);
|
||||
}
|
||||
connect(comboCustom, SIGNAL(currentIndexChanged(int)), this, SLOT(SetCustomSteps()));
|
||||
|
||||
return qDefs::OK;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qScanWidget::DeleteCustomSteps(){
|
||||
QString pos = comboCustom->currentText();
|
||||
bool found = false;
|
||||
//loops through to find the index and to make sure its in the list
|
||||
for(int i=0;i<comboCustom->count();i++){
|
||||
if(!comboCustom->itemText(i).compare(pos)){
|
||||
found = true;
|
||||
comboCustom->removeItem(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(found){
|
||||
#ifdef VERBOSE
|
||||
cout << "Deleting Position " << endl;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qScanWidget::SetFileSteps(){
|
||||
QString fName = dispFile->text();
|
||||
#ifdef VERBOSE
|
||||
cout << "Setting\tscan:" << id << "\tfile\t:" << fName.toAscii().constData() << endl;
|
||||
#endif
|
||||
bool set = false;
|
||||
|
||||
if(fName.isEmpty()){ //blank
|
||||
#ifdef VERBOSE
|
||||
cout << "Empty file" << endl;
|
||||
#endif
|
||||
radioFile->setPalette(red);
|
||||
radioFile->setText("Values from File:*");
|
||||
QString errTip = fileTip + QString("<br><br><nobr><font color=\"red\">The file path is empty.</font></nobr>");;
|
||||
radioFile->setToolTip(errTip);dispFile->setToolTip(errTip);btnFile->setToolTip(errTip);
|
||||
}else{
|
||||
QString file = dispFile->text().section('/',-1);
|
||||
if(file.contains('.')){ //is a file
|
||||
//check if it exists and set the script file
|
||||
if(QFile::exists(fName)) set = true;
|
||||
else{//if the file doesnt exist, set it to what it was before
|
||||
#ifdef VERBOSE
|
||||
cout << "The file entered does not exist." << endl;
|
||||
#endif
|
||||
radioFile->setPalette(red);
|
||||
radioFile->setText("Values from File:*");
|
||||
QString errTip = fileTip + QString("<br><br><nobr><font color=\"red\">The file entered does not exist.</font></nobr>");
|
||||
radioFile->setToolTip(errTip);dispFile->setToolTip(errTip);btnFile->setToolTip(errTip);
|
||||
}
|
||||
} else {//not a file, set it to what it was before
|
||||
#ifdef VERBOSE
|
||||
cout << "The file path entered is not a file." << endl;
|
||||
#endif
|
||||
radioFile->setPalette(red);
|
||||
radioFile->setText("Values from File:*");
|
||||
QString errTip = fileTip + QString("<br><br><nobr><font color=\"red\">The file path entered is not a file.</font></nobr>");
|
||||
radioFile->setToolTip(errTip); dispFile->setToolTip(errTip);btnFile->setToolTip(errTip);
|
||||
}
|
||||
}
|
||||
|
||||
//if valid file
|
||||
if(set){
|
||||
ifstream inFile;string sLine;char sArg[200]="";
|
||||
//open file
|
||||
inFile.open(fName.toAscii().constData(), ifstream::in);
|
||||
if(inFile.is_open()){
|
||||
//delete existing positions
|
||||
positions.resize(0);
|
||||
actualNumSteps = 0;
|
||||
#ifdef VERBOSE
|
||||
cout<< "Opening file "<< fName.toAscii().constData() << endl;
|
||||
#endif
|
||||
while(inFile.good()) {
|
||||
getline(inFile,sLine);
|
||||
if(sLine.find('#')!=string::npos) continue;//commented out
|
||||
else if(sLine.length()<2) continue;// empty line
|
||||
else {
|
||||
istringstream sstr(sLine);
|
||||
if(sstr.good()){
|
||||
actualNumSteps++;
|
||||
positions.resize(actualNumSteps);
|
||||
sstr>>sArg;
|
||||
if(!sscanf(sArg,"%lf",&positions[actualNumSteps-1])){
|
||||
actualNumSteps--;
|
||||
positions.resize(actualNumSteps);
|
||||
}
|
||||
else cout<<"value["<<actualNumSteps-1<<"]:"<<positions[actualNumSteps-1]<<endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
disconnect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps()));
|
||||
spinSteps->setValue(actualNumSteps);
|
||||
connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps()));
|
||||
inFile.close();
|
||||
}else {//could not open file
|
||||
#ifdef VERBOSE
|
||||
cout << "Could not open file" << endl;
|
||||
#endif
|
||||
set = false;
|
||||
radioFile->setPalette(red);
|
||||
radioFile->setText("Values from File:*");
|
||||
QString errTip = fileTip + QString("<br><br><nobr><font color=\"red\">Could not read file.</font></nobr>");
|
||||
radioFile->setToolTip(errTip);dispFile->setToolTip(errTip); btnFile->setToolTip(errTip);
|
||||
}
|
||||
}
|
||||
if(set){//no error while reading file
|
||||
//sets the scan and positions
|
||||
if(SetScan(comboScript->currentIndex())==qDefs::OK){
|
||||
radioFile->setPalette(normal);
|
||||
radioFile->setText("Values from File:");
|
||||
radioFile->setToolTip(fileTip);dispFile->setToolTip(fileTip);btnFile->setToolTip(fileTip);
|
||||
//error loading positions
|
||||
if(myDet->getScanSteps(id)!=actualNumSteps){
|
||||
qDefs::WarningMessage("The positions list was not set for an unknown reason.","ScanWidget");
|
||||
}else{//SUCCESS
|
||||
char cNum[200];sprintf(cNum,"%d",actualNumSteps);
|
||||
char cId[5];sprintf(cId,"%d",id);
|
||||
qDefs::InfoMessage(string("Scan Level ")+string(cId)+(" - ")+string(" Number of positions added from file : ")+string(cNum),"ScanWidget");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qScanWidget::BrowseFileStepsPath(){
|
||||
#ifdef VERBOSE
|
||||
cout << "Browsing Steps File Path\tscan:" << id << endl;
|
||||
#endif
|
||||
QString fName = dispFile->text();
|
||||
QString dir = fName.section('/',0,-2,QString::SectionIncludeLeadingSep);
|
||||
if(dir.isEmpty()) dir = "/home/";
|
||||
//dialog
|
||||
fName = QFileDialog::getOpenFileName(this,
|
||||
tr("Load Scan Steps Script File"),dir,
|
||||
tr("Scan Steps Script Files(*.awk);;All Files(*)"));
|
||||
//if empty, set the file name and it calls SetFileSteps, else ignore
|
||||
if (!fName.isEmpty()){
|
||||
dispFile->setText(fName);
|
||||
SetFileSteps();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qScanWidget::LoadPositions(){
|
||||
#ifdef VERBOSE
|
||||
cout << "Loading positions" << endl;
|
||||
#endif
|
||||
disconnect(comboCustom, SIGNAL(currentIndexChanged(int)), this, SLOT(SetCustomSteps()));
|
||||
disconnect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps()));
|
||||
disconnect(btnGroup, SIGNAL(buttonClicked(QAbstractButton*)),this,SLOT(EnableSizeWidgets()));
|
||||
|
||||
|
||||
int mode = myDet->getScanMode(id);
|
||||
radioCustom->setChecked(true);
|
||||
|
||||
int numSteps = myDet->getScanSteps(id);
|
||||
actualNumSteps = numSteps;
|
||||
comboCustom->setMaxCount(numSteps);
|
||||
positions.resize(actualNumSteps);
|
||||
|
||||
//set the number of steps in the gui
|
||||
spinSteps->setValue(numSteps);
|
||||
|
||||
//load the positions
|
||||
double *values = NULL;
|
||||
if(actualNumSteps){
|
||||
values = new double[actualNumSteps];
|
||||
myDet->getScanSteps(id,values);
|
||||
}
|
||||
for(int i=0;i<actualNumSteps;i++)
|
||||
positions[i] = values[i];
|
||||
|
||||
|
||||
|
||||
//if there are no step sizes
|
||||
if(numSteps){
|
||||
radioCustom->setText("Specific Values");
|
||||
radioCustom->setPalette(normal);
|
||||
radioCustom->setToolTip(customTip);
|
||||
comboCustom->setToolTip(customTip);
|
||||
}else{
|
||||
radioCustom->setPalette(red);
|
||||
radioCustom->setText("Specific Values*");
|
||||
QString tip = customTip + QString("<br><br><nobr><font color=\"red\">First, increase <b>Number of Steps</b>. "
|
||||
"Then, enter values here.</font></nobr>");
|
||||
radioCustom->setToolTip(tip);
|
||||
comboCustom->setToolTip(tip);
|
||||
}
|
||||
for(int i=0;i<comboCustom->count();i++)
|
||||
comboCustom->removeItem(i);
|
||||
for(int i=0;i<numSteps;i++)
|
||||
comboCustom->insertItem(i,QString("%1").arg(positions[i]));
|
||||
|
||||
//delete the combolist and reload it
|
||||
comboCustom->setEnabled(numSteps&&mode);
|
||||
btnCustom->setEnabled(numSteps&&mode);
|
||||
|
||||
|
||||
|
||||
connect(comboCustom, SIGNAL(currentIndexChanged(int)), this, SLOT(SetCustomSteps()));
|
||||
connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps()));
|
||||
connect(btnGroup, SIGNAL(buttonClicked(QAbstractButton*)),this,SLOT(EnableSizeWidgets()));
|
||||
}
|
||||
|
||||
|
||||
@ -292,28 +772,32 @@ void qScanWidget::SetParameter(const QString& parameter){
|
||||
|
||||
|
||||
void qScanWidget::Refresh(){
|
||||
int mode = (myDet->getScanMode(id)>0?1:0);
|
||||
int mode = (myDet->getScanMode(id));
|
||||
string script = myDet->getScanScript(id);
|
||||
string parameter = myDet->getScanParameter(id);
|
||||
double precision = myDet->getScanPrecision(id);
|
||||
int precision = myDet->getScanPrecision(id);
|
||||
|
||||
//defaults
|
||||
if(script == "none") script="";
|
||||
if(parameter == "none") parameter="";
|
||||
//settings values
|
||||
|
||||
//settings values and checking for none
|
||||
dispScript->setText(QString(script.c_str()));
|
||||
SetScriptFile();
|
||||
dispParameter->setText(QString(parameter.c_str()));
|
||||
SetParameter();
|
||||
spinPrecision->setValue(precision);
|
||||
//set mode which also checks everything
|
||||
|
||||
//set mode which also checks number of steps
|
||||
//and enable size widgets and set the positions from combolist to server
|
||||
comboScript->setCurrentIndex(mode);
|
||||
|
||||
|
||||
#ifdef VERBOSE
|
||||
cout << "Updated scan widget " << id << "\t"
|
||||
cout << "Updated\tscan:" << id << "\t"
|
||||
"mode:"<<mode<<"\t"
|
||||
"script:" << script << "\t"
|
||||
"numSteps:" << actualNumSteps << "\t"
|
||||
//"values:" << arrSteps << "\t"
|
||||
"parameter:" << parameter << "\t"
|
||||
"precision:" << precision << endl;
|
||||
"precision:" << precision << endl << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -123,20 +123,20 @@ void qTabActions::CreatePositionsWidget(){
|
||||
layout->setHorizontalSpacing(0);
|
||||
layout->setVerticalSpacing(5);
|
||||
|
||||
lblNumPos = new QLabel("Number of Positions:");
|
||||
lblNumPos = new QLabel("Number of Positions: ");
|
||||
lblNumPos->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||
layout->addWidget(lblNumPos,0,0);
|
||||
layout->addItem(new QSpacerItem(5,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,1);
|
||||
spinNumPos = new QSpinBox(this);
|
||||
layout->addWidget(spinNumPos,0,2);
|
||||
layout->addItem(new QSpacerItem(80,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,3);
|
||||
lblPosList = new QLabel("List of Positions:");
|
||||
lblPosList = new QLabel("List of Positions: ");
|
||||
lblPosList->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||
lblPosList->setFixedWidth(108);
|
||||
lblPosList->setEnabled(false);
|
||||
lblPosList->setToolTip("<nobr>Enter the positions at which the detector should be moved.</nobr><br>"
|
||||
"<nobr>Number of entries is restricted to <b>Number of Positions</b> field.</tnobr>");
|
||||
layout->addWidget(lblPosList,0,4);
|
||||
layout->addItem(new QSpacerItem(5,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,5);
|
||||
comboPos = new QComboBox(this);
|
||||
comboPos->setEditable(true);
|
||||
comboPos->setCompleter(false);
|
||||
@ -144,11 +144,11 @@ void qTabActions::CreatePositionsWidget(){
|
||||
comboPos->setEnabled(false);
|
||||
QDoubleValidator *validate = new QDoubleValidator(comboPos);
|
||||
comboPos->setValidator(validate);
|
||||
layout->addWidget(comboPos,0,6);
|
||||
layout->addItem(new QSpacerItem(5,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,7);
|
||||
layout->addWidget(comboPos,0,5);
|
||||
layout->addItem(new QSpacerItem(5,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,6);
|
||||
btnDelete = new QPushButton("Delete");
|
||||
btnDelete->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||
layout->addWidget(btnDelete,0,8);
|
||||
layout->addWidget(btnDelete,0,7);
|
||||
|
||||
//might be included at some point
|
||||
/* QGroupBox *w = new QGroupBox;
|
||||
@ -251,19 +251,20 @@ void qTabActions::SetPosition(){
|
||||
lblPosList->setPalette(red);
|
||||
QString tip = QString("<nobr>Enter the positions at which the detector should be moved.</nobr><br>"
|
||||
"<nobr>Number of entries is restricted to <b>Number of Positions</b> field.</nobr><br><br>")+
|
||||
QString("<nobr><font color=\"red\">Add ")+
|
||||
QString("<font color=\"red\"><nobr>Add ")+
|
||||
(QString("%1").arg(((numPos)-(comboPos->count()))))+
|
||||
QString(" more positions to the list to match <b>Number of Positions</b>.</font></nobr>");
|
||||
QString(" more positions to the list to match <b>Number of Positions</b>.</nobr><br>"
|
||||
"<nobr><nobr>Or reduce <b>Number of Positions</b>.</nobr></font>");
|
||||
lblPosList->setToolTip(tip);
|
||||
lblPosList->setText("List of Positions:*");
|
||||
}else{
|
||||
lblPosList->setText("List of Positions:");
|
||||
lblPosList->setText("List of Positions: ");
|
||||
lblPosList->setPalette(normal);
|
||||
lblPosList->setToolTip("<nobr>Enter the positions at which the detector should be moved.</nobr><br>"
|
||||
"<nobr>Number of entries is restricted to <b>Number of Positions</b> field.</tnobr>");
|
||||
"<nobr>Number of entries is restricted to <b>Number of Positions</b> field.</nobr>");
|
||||
//delete existing positions
|
||||
if (positions) delete [] positions;
|
||||
positions=new float[numPos];
|
||||
positions=new double[numPos];
|
||||
//copying the list
|
||||
for(int i=0;i<numPos;i++)
|
||||
positions[i] = comboPos->itemText(i).toDouble();
|
||||
@ -302,7 +303,7 @@ void qTabActions::DeletePosition(){
|
||||
|
||||
void qTabActions::Refresh(){
|
||||
#ifdef VERBOSE
|
||||
cout << "Updating all action widgets " << endl;
|
||||
cout << "\nUpdating all action widgets " << endl;
|
||||
#endif
|
||||
if(lblName[NumPositions]->isEnabled()){
|
||||
//delete existing positions
|
||||
@ -316,7 +317,7 @@ void qTabActions::Refresh(){
|
||||
spinNumPos->setValue(numPos);
|
||||
connect(spinNumPos, SIGNAL(valueChanged(int)), this, SLOT(SetPosition()));
|
||||
|
||||
positions=new float[numPos];
|
||||
positions=new double[numPos];
|
||||
//load the positions
|
||||
myDet->getPositions(positions);
|
||||
|
||||
@ -324,7 +325,7 @@ void qTabActions::Refresh(){
|
||||
disconnect(comboPos,SIGNAL(currentIndexChanged(int)), this, SLOT(SetPosition()));
|
||||
comboPos->setEnabled(numPos);
|
||||
lblPosList->setEnabled(numPos);
|
||||
lblPosList->setText("List of Positions:");
|
||||
lblPosList->setText("List of Positions: ");
|
||||
lblPosList->setPalette(normal);
|
||||
for(int i=0;i<comboPos->count();i++)
|
||||
comboPos->removeItem(i);
|
||||
@ -334,7 +335,7 @@ void qTabActions::Refresh(){
|
||||
|
||||
|
||||
#ifdef VERBOSE
|
||||
cout << "Updated position widget\tnum:" << numPos << endl;
|
||||
cout << "Updated position widget\tnum:" << numPos << endl << endl;
|
||||
#endif
|
||||
}
|
||||
for(int i=0;i<qScanWidget::NUM_SCAN_WIDGETS;i++)
|
||||
|
@ -64,11 +64,11 @@ void qTabAdvanced::Enable(bool enable){
|
||||
void qTabAdvanced::getTemperature(){
|
||||
char ctemp[200];
|
||||
/** adc */
|
||||
float tempadc = myDet->getADC(slsDetectorDefs::TEMPERATURE_ADC);
|
||||
double tempadc = myDet->getADC(slsDetectorDefs::TEMPERATURE_ADC);
|
||||
sprintf(ctemp,"%f%cC",tempadc,0x00B0);
|
||||
dispTempAdc->setText(QString(ctemp));
|
||||
/** fpga */
|
||||
float tempfpga = myDet->getADC(slsDetectorDefs::TEMPERATURE_FPGA);
|
||||
double tempfpga = myDet->getADC(slsDetectorDefs::TEMPERATURE_FPGA);
|
||||
sprintf(ctemp,"%f%cC",tempfpga,0x00B0);
|
||||
dispTempFpga->setText(QString(ctemp));
|
||||
#ifdef VERBOSE
|
||||
|
@ -52,6 +52,19 @@ void qTabDataOutput::SetupWidgetWindow(){
|
||||
//rate correction - not for charge integrating detectors
|
||||
if((detType == slsDetectorDefs::MYTHEN)||(detType == slsDetectorDefs::EIGER))
|
||||
chkRate->setEnabled(true);
|
||||
|
||||
if((detType == slsDetectorDefs::MYTHEN)||(detType == slsDetectorDefs::GOTTHARD))
|
||||
chkAngular->setEnabled(true);
|
||||
|
||||
/** error message **/
|
||||
red = QPalette();
|
||||
red.setColor(QPalette::Active,QPalette::WindowText,Qt::red);
|
||||
flatFieldTip = dispFlatField->toolTip();
|
||||
errFlatFieldTip = QString("<nobr>Flat field corrections.</nobr><br>"
|
||||
"<nobr> #flatfield# filename</nobr><br><br>")+
|
||||
QString("<nobr><font color=\"red\">"
|
||||
"Enter a valid file to enable Flat Field.</font></nobr>");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -114,8 +127,9 @@ void qTabDataOutput::SetFlatField(){
|
||||
|
||||
if(chkFlatField->isChecked()){
|
||||
if(dispFlatField->text().isEmpty()){
|
||||
lblNote->show();
|
||||
chkFlatField->setPalette(lblNote->palette());
|
||||
chkFlatField->setToolTip(errFlatFieldTip);
|
||||
dispFlatField->setToolTip(errFlatFieldTip);
|
||||
chkFlatField->setPalette(red);
|
||||
chkFlatField->setText("Flat Field File:*");
|
||||
#ifdef VERBOSE
|
||||
cout << "Flat Field File is not set." << endl;
|
||||
@ -125,7 +139,8 @@ void qTabDataOutput::SetFlatField(){
|
||||
QString file = fName.section('/',-1);
|
||||
QString dir = fName.section('/',0,-2,QString::SectionIncludeLeadingSep);
|
||||
|
||||
lblNote->hide();
|
||||
chkFlatField->setToolTip(flatFieldTip);
|
||||
dispFlatField->setToolTip(flatFieldTip);
|
||||
chkFlatField->setPalette(chkRate->palette());
|
||||
chkFlatField->setText("Flat Field File:");
|
||||
//set ff dir
|
||||
@ -133,15 +148,16 @@ void qTabDataOutput::SetFlatField(){
|
||||
//set ff file and catch error if -1
|
||||
if(myDet->setFlatFieldCorrectionFile(file.toAscii().constData())<0){
|
||||
string sDir = dir.toAscii().constData(),sFile = file.toAscii().constData();
|
||||
if(sDir.length()<1) sDir = "/home";
|
||||
qDefs::WarningMessage("Invalid Flat Field file - "+sDir+sFile+
|
||||
if(sDir.length()<1) {sDir = string(QDir::current().absolutePath().toAscii().constData()); /*"/home/";*/}
|
||||
qDefs::WarningMessage("Invalid Flat Field file: "+sDir+"/"+sFile+
|
||||
".\nUnsetting Flat Field.","Data Output");
|
||||
|
||||
//Unsetting flat field
|
||||
myDet->setFlatFieldCorrectionFile("");
|
||||
dispFlatField->setText("");
|
||||
lblNote->show();
|
||||
chkFlatField->setPalette(lblNote->palette());
|
||||
chkFlatField->setToolTip(errFlatFieldTip);
|
||||
dispFlatField->setToolTip(errFlatFieldTip);
|
||||
chkFlatField->setPalette(red);
|
||||
chkFlatField->setText("Flat Field File:*");
|
||||
#ifdef VERBOSE
|
||||
cout << "Invalid Flat Field File - "<< sDir << sFile << ". Unsetting Flat Field." << endl;
|
||||
@ -154,7 +170,8 @@ void qTabDataOutput::SetFlatField(){
|
||||
}
|
||||
}
|
||||
}else{
|
||||
lblNote->hide();
|
||||
chkFlatField->setToolTip(flatFieldTip);
|
||||
dispFlatField->setToolTip(flatFieldTip);
|
||||
chkFlatField->setPalette(chkRate->palette());
|
||||
chkFlatField->setText("Flat Field File:");
|
||||
//Unsetting flat field
|
||||
@ -188,7 +205,11 @@ void qTabDataOutput::UpdateFlatFieldFromServer(){
|
||||
else
|
||||
chkFlatField->setChecked(true);
|
||||
|
||||
lblNote->hide();
|
||||
chkFlatField->setToolTip(flatFieldTip);
|
||||
dispFlatField->setToolTip(flatFieldTip);
|
||||
chkFlatField->setPalette(chkRate->palette());
|
||||
chkFlatField->setText("Flat Field File:");
|
||||
|
||||
connect(dispFlatField, SIGNAL(editingFinished()), this, SLOT(SetFlatField()));
|
||||
}
|
||||
|
||||
@ -198,10 +219,10 @@ void qTabDataOutput::BrowseFlatFieldPath()
|
||||
{
|
||||
QString fName = dispFlatField->text();
|
||||
QString dir = fName.section('/',0,-2,QString::SectionIncludeLeadingSep);
|
||||
if(dir.isEmpty()) dir = "/home";
|
||||
if(dir.isEmpty()) dir = QString(myDet->getFlatFieldCorrectionDir().c_str());/*"/home/";*/
|
||||
fName = QFileDialog::getOpenFileName(this,
|
||||
tr("Load Flat Field Correction File"),dir,
|
||||
tr("Flat Field Correction Files(*.dat)"));//,0,QFileDialog::ShowDirsOnly);
|
||||
tr("Flat Field Correction Files(*.dat)"),0,QFileDialog::ShowDirsOnly);
|
||||
if (!fName.isEmpty()){
|
||||
dispFlatField->setText(fName);
|
||||
SetFlatField();
|
||||
@ -237,7 +258,7 @@ void qTabDataOutput::SetRateCorrection(){
|
||||
}//custom dead time
|
||||
else{
|
||||
spinDeadTime->setEnabled(true);
|
||||
s->setRateCorrection((float)spinDeadTime->value());
|
||||
s->setRateCorrection((double)spinDeadTime->value());
|
||||
#ifdef VERBOSE
|
||||
cout << "Setting rate corrections with dead time "<< spinDeadTime->value() << endl;
|
||||
#endif
|
||||
@ -368,8 +389,11 @@ void qTabDataOutput::Refresh(){
|
||||
if((detType == slsDetectorDefs::MYTHEN)||(detType == slsDetectorDefs::EIGER))
|
||||
UpdateRateCorrectionFromServer();
|
||||
//update angular conversion from server
|
||||
int ang;
|
||||
if(myDet->getAngularConversion(ang)) chkAngular->setChecked(true);
|
||||
if((detType == slsDetectorDefs::MYTHEN)||(detType == slsDetectorDefs::GOTTHARD)){
|
||||
int ang;
|
||||
if(myDet->getAngularConversion(ang))
|
||||
chkAngular->setChecked(true);
|
||||
}
|
||||
//discard bad channels from server
|
||||
if(myDet->getBadChannelCorrection()) chkDiscardBad->setChecked(true);
|
||||
}
|
||||
|
@ -59,7 +59,13 @@ void qTabMeasurement::SetupWidgetWindow(){
|
||||
spinExpTime->setValue(time);
|
||||
comboExpUnit->setCurrentIndex((int)unit);
|
||||
/** Hide the error message **/
|
||||
lblNote->hide();
|
||||
red = QPalette();
|
||||
red.setColor(QPalette::Active,QPalette::WindowText,Qt::red);
|
||||
acqPeriodTip = spinPeriod->toolTip();
|
||||
errPeriodTip = QString("<nobr>Frame period between exposures.</nobr><br>"
|
||||
"<nobr> #period#</nobr><br><br>")+
|
||||
QString("<nobr><font color=\"red\"><b>Acquisition Period</b> should be"
|
||||
" greater than or equal to <b>Exposure Time</b>.</font></nobr>");
|
||||
/** File Name **/
|
||||
dispFileName->setText(QString(myDet->getFileName().c_str()));
|
||||
/** File Index **/
|
||||
@ -358,13 +364,15 @@ void qTabMeasurement::setExposureTime(){
|
||||
double acqtimeNS;
|
||||
acqtimeNS = qDefs::getNSTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value());
|
||||
if(exptimeNS>acqtimeNS) {
|
||||
lblNote->show();
|
||||
lblPeriod->setPalette(lblNote->palette());
|
||||
spinPeriod->setToolTip(errPeriodTip);
|
||||
lblPeriod->setToolTip(errPeriodTip);
|
||||
lblPeriod->setPalette(red);
|
||||
lblPeriod->setText("Acquisition Period:*");
|
||||
}
|
||||
else {
|
||||
lblNote->hide();
|
||||
lblPeriod->setPalette(lblNumFrames->palette());
|
||||
spinPeriod->setToolTip(acqPeriodTip);
|
||||
lblPeriod->setToolTip(acqPeriodTip);
|
||||
lblPeriod->setPalette(lblTimingMode->palette());
|
||||
lblPeriod->setText("Acquisition Period:");
|
||||
}
|
||||
}
|
||||
@ -386,13 +394,15 @@ void qTabMeasurement::setAcquisitionPeriod(){
|
||||
double exptimeNS;
|
||||
exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value());
|
||||
if(exptimeNS>acqtimeNS){
|
||||
lblNote->show();
|
||||
lblPeriod->setPalette(lblNote->palette());
|
||||
spinPeriod->setToolTip(errPeriodTip);
|
||||
lblPeriod->setToolTip(errPeriodTip);
|
||||
lblPeriod->setPalette(red);
|
||||
lblPeriod->setText("Acquisition Period:*");
|
||||
}
|
||||
else {
|
||||
lblNote->hide();
|
||||
lblPeriod->setPalette(lblNumFrames->palette());
|
||||
spinPeriod->setToolTip(acqPeriodTip);
|
||||
lblPeriod->setToolTip(acqPeriodTip);
|
||||
lblPeriod->setPalette(lblTimingMode->palette());
|
||||
lblPeriod->setText("Acquisition Period:");
|
||||
}
|
||||
|
||||
@ -582,18 +592,23 @@ void qTabMeasurement::setTimingMode(int mode){
|
||||
exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value());
|
||||
acqtimeNS = qDefs::getNSTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value());
|
||||
if(exptimeNS>acqtimeNS) {
|
||||
lblNote->show();
|
||||
lblPeriod->setPalette(lblNote->palette());
|
||||
|
||||
spinPeriod->setToolTip(errPeriodTip);
|
||||
lblPeriod->setToolTip(errPeriodTip);
|
||||
lblPeriod->setPalette(red);
|
||||
lblPeriod->setText("Acquisition Period:*");
|
||||
}
|
||||
else {
|
||||
lblNote->hide();
|
||||
lblPeriod->setPalette(lblNumFrames->palette());
|
||||
|
||||
spinPeriod->setToolTip(acqPeriodTip);
|
||||
lblPeriod->setToolTip(acqPeriodTip);
|
||||
lblPeriod->setPalette(lblTimingMode->palette());
|
||||
lblPeriod->setText("Acquisition Period:");
|
||||
}
|
||||
}else {
|
||||
lblNote->hide();
|
||||
lblPeriod->setPalette(lblNumFrames->palette());
|
||||
spinPeriod->setToolTip(acqPeriodTip);
|
||||
lblPeriod->setToolTip(acqPeriodTip);
|
||||
lblPeriod->setPalette(lblTimingMode->palette());
|
||||
lblPeriod->setText("Acquisition Period:");
|
||||
}
|
||||
|
||||
|
@ -451,7 +451,6 @@ void qTabPlot::SetFrequency(){
|
||||
|
||||
|
||||
void qTabPlot::EnableScanBox(bool enable,int id){
|
||||
cout<<"enable:"<<enable<<" id:"<<id<<endl;
|
||||
/**find out when this is enabled*/
|
||||
|
||||
scanLevel[id]=enable;
|
||||
|
Loading…
x
Reference in New Issue
Block a user