going to start actions

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@19 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
l_maliakal_d 2012-07-19 14:20:51 +00:00
parent d2b9b6ae1d
commit 3b59d03526
30 changed files with 1433 additions and 610 deletions

View File

@ -19,6 +19,124 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>185</red>
<green>185</green>
<blue>185</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>185</red>
<green>185</green>
<blue>185</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>185</red>
<green>185</green>
<blue>185</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>89</red>
<green>89</green>
<blue>89</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
@ -130,7 +248,6 @@
<property name="title">
<string>&amp;Help</string>
</property>
<addaction name="actionVersion"/>
<addaction name="actionAbout"/>
</widget>
<addaction name="menuUtilities"/>

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>775</width>
<height>339</height>
<height>345</height>
</rect>
</property>
<property name="sizePolicy">
@ -35,7 +35,7 @@
<property name="geometry">
<rect>
<x>20</x>
<y>75</y>
<y>110</y>
<width>731</width>
<height>206</height>
</rect>
@ -43,114 +43,24 @@
<property name="title">
<string>Correction</string>
</property>
<widget class="QWidget" name="gridLayoutWidget">
<widget class="QWidget" name="gridLayoutWidget_2">
<property name="geometry">
<rect>
<x>10</x>
<x>15</x>
<y>20</y>
<width>711</width>
<height>181</height>
<width>701</width>
<height>176</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QCheckBox" name="checkBox_3">
<widget class="QCheckBox" name="chkFlatField">
<property name="text">
<string>Flat Field File</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkBox_2">
<property name="text">
<string>Rate Correction</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="checkBox_4">
<property name="text">
<string>Angular Conversion</string>
</property>
</widget>
</item>
<item row="0" column="3" colspan="5">
<widget class="QLineEdit" name="lineEdit_2"/>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="checkBox_5">
<property name="text">
<string>Discard Bad Channels</string>
<string>Flat Field File:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_3">
<property name="text">
<string>:</string>
</property>
</widget>
</item>
<item row="0" column="8">
<widget class="QPushButton" name="pushButton_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Browse</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QRadioButton" name="radioButton_3">
<property name="text">
<string>Auto</string>
</property>
</widget>
</item>
<item row="1" column="4">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="5">
<widget class="QRadioButton" name="radioButton">
<property name="text">
<string>Custom dead time(ns):</string>
</property>
</widget>
</item>
<item row="1" column="6">
<widget class="QSpinBox" name="spinBox"/>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -166,6 +76,178 @@
</property>
</spacer>
</item>
<item row="0" column="2" colspan="6">
<widget class="QLineEdit" name="dispFlatField">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="chkRate">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Rate Correction:</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QRadioButton" name="radioAuto">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Auto</string>
</property>
</widget>
</item>
<item row="1" column="6" colspan="3">
<widget class="QDoubleSpinBox" name="spinDeadTime">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="suffix">
<string> ns</string>
</property>
<property name="decimals">
<number>6</number>
</property>
<property name="maximum">
<double>2000000000.000000000000000</double>
</property>
</widget>
</item>
<item row="3" column="6">
<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>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="4">
<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>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="3">
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="8">
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="7">
<spacer name="horizontalSpacer_9">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="8">
<widget class="QPushButton" name="btnFlatField">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Browse</string>
</property>
</widget>
</item>
<item row="1" column="5">
<widget class="QRadioButton" name="radioDeadTime">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Custom dead time:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="chkAngular">
<property name="text">
<string>Angular Conversion</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="chkDiscardBad">
<property name="text">
<string>Discard Bad Channels</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
@ -187,9 +269,9 @@
<widget class="QWidget" name="horizontalLayoutWidget">
<property name="geometry">
<rect>
<x>0</x>
<x>10</x>
<y>6</y>
<width>731</width>
<width>706</width>
<height>28</height>
</rect>
</property>
@ -217,6 +299,56 @@
</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/>

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>748</width>
<height>350</height>
<width>775</width>
<height>345</height>
</rect>
</property>
<property name="sizePolicy">
@ -31,20 +31,164 @@
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QPushButton" name="pushButton">
<widget class="QWidget" name="horizontalLayoutWidget">
<property name="geometry">
<rect>
<x>232</x>
<y>141</y>
<width>75</width>
<x>265</x>
<y>30</y>
<width>251</width>
<height>36</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="lblModule">
<property name="text">
<string>Module Number:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboModule">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<item>
<property name="text">
<string>All Modules</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>30</x>
<y>165</y>
<width>321</width>
<height>156</height>
</rect>
</property>
<property name="title">
<string>Digital Tests</string>
</property>
<widget class="QWidget" name="gridLayoutWidget_2">
<property name="geometry">
<rect>
<x>15</x>
<y>20</y>
<width>141</width>
<height>51</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QCheckBox" name="chk">
<property name="text">
<string>Detector Module</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkBox_2">
<property name="text">
<string>Test xxx</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QPushButton" name="btnDigital">
<property name="geometry">
<rect>
<x>15</x>
<y>115</y>
<width>291</width>
<height>25</height>
</rect>
</property>
<property name="text">
<string>PushButton</string>
<string>Run</string>
</property>
</widget>
</widget>
<widget class="QPushButton" name="btnGetInfo">
<property name="geometry">
<rect>
<x>265</x>
<y>95</y>
<width>251</width>
<height>25</height>
</rect>
</property>
<property name="text">
<string>Get Detector Information</string>
</property>
</widget>
<widget class="QGroupBox" name="groupBox_2">
<property name="geometry">
<rect>
<x>425</x>
<y>165</y>
<width>321</width>
<height>156</height>
</rect>
</property>
<property name="title">
<string>Analog Tests</string>
</property>
<widget class="QWidget" name="gridLayoutWidget_3">
<property name="geometry">
<rect>
<x>15</x>
<y>20</y>
<width>141</width>
<height>51</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QCheckBox" name="checkBox_3">
<property name="text">
<string>Detector Module</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkBox_4">
<property name="text">
<string>Test xxx</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QPushButton" name="btnAnalog">
<property name="geometry">
<rect>
<x>15</x>
<y>115</y>
<width>291</width>
<height>25</height>
</rect>
</property>
<property name="text">
<string>Run</string>
</property>
</widget>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -28,124 +28,6 @@
<height>345</height>
</size>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</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>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>188</red>
<green>188</green>
<blue>188</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>192</red>
<green>192</green>
<blue>192</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="windowTitle">
<string>Form</string>
</property>

View File

@ -494,7 +494,7 @@
<string>Scan - Y Axis Values</string>
</property>
<property name="checkable">
<bool>true</bool>
<bool>false</bool>
</property>
<property name="checked">
<bool>false</bool>

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>748</width>
<height>339</height>
<width>775</width>
<height>345</height>
</rect>
</property>
<property name="sizePolicy">
@ -34,10 +34,10 @@
<widget class="QWidget" name="gridLayoutWidget">
<property name="geometry">
<rect>
<x>13</x>
<y>16</y>
<width>311</width>
<height>151</height>
<x>30</x>
<y>20</y>
<width>316</width>
<height>171</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
@ -48,7 +48,7 @@
</property>
</widget>
</item>
<item row="0" column="1">
<item row="0" column="2" colspan="2">
<widget class="QComboBox" name="comboSettings">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@ -107,17 +107,19 @@
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Threshold:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<item row="1" column="2" colspan="2">
<widget class="QSpinBox" name="spinThreshold">
<property name="suffix">
<string>eV</string>
</property>
<property name="minimum">
<number>-1</number>
<number>-100000</number>
</property>
<property name="maximum">
<number>100000</number>
</property>
<property name="singleStep">
<number>100</number>
</property>
<property name="value">
<number>-1</number>
@ -138,22 +140,59 @@
</property>
</widget>
</item>
<item row="3" column="1">
<item row="3" column="2" colspan="2">
<widget class="QComboBox" name="comboDynamicRange">
<item>
<property name="text">
<string>16</string>
<string>1.67772e+07</string>
</property>
</item>
<item>
<property name="text">
<string>32</string>
<string>65535</string>
</property>
</item>
<item>
<property name="text">
<string>255</string>
</property>
</item>
<item>
<property name="text">
<string>7</string>
</property>
</item>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="spinNumModules"/>
<item row="2" column="2" colspan="2">
<widget class="QSpinBox" name="spinNumModules">
<property name="minimum">
<number>1</number>
</property>
</widget>
</item>
<item row="1" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lblThreshold">
<property name="text">
<string>Threshold:</string>
</property>
</widget>
</item>
</layout>
</widget>

View File

@ -24,13 +24,19 @@ class ActionsWidget : public QFrame{
public:
/** \short The constructor
* @param parent is the parent tab widget
* @param detector is the detector returned from the detector tab
* @param scanType is if its an energy/threshold scan type
* @param id is the id of the widget. to know which one was emitting it
*/
ActionsWidget(QWidget *parent, int scanType);
ActionsWidget(QWidget *parent, int scanType, int id);
~ActionsWidget();
private:
/**if its a scan type*/
int scanType;
/**id of the action widget*/
int id;
QGridLayout *layout;
QComboBox *comboScript;
QLineEdit *dispScript;
@ -56,8 +62,8 @@ private:
QPushButton *btnValues;
/** Sets up the widget
* @param scanType 1 if it includes Threshold Scan,Energy Scan and Trimbits Scan, else 0*/
void SetupWidgetWindow(int scanType);
*/
void SetupWidgetWindow();
/** Sets up all the slots and signals */
void Initialization();
@ -72,6 +78,14 @@ void SetScript(int index);
* Options: constant size,specific values,values from file */
void EnableSizeWidgets();
/** Browse for the script
* */
void BrowsePath();
signals:
void EnableScanBox(bool,int);
void SetScriptSignal(QString&,int);
};

View File

@ -21,7 +21,7 @@ class qTabDebugging;
class qTabDeveloper;
class qTabMessages;
/** Project Class Headers */
class slsDetectorUtils;
class multiSlsDetector;
#include "sls_detector_defs.h"
/** Qt Include Headers */
#include <QScrollArea>
@ -63,7 +63,7 @@ private:
/** The Qt Application */
QApplication *theApp;
/** The sls detector object */
slsDetectorUtils *myDet;
multiSlsDetector *myDet;
/** sls detector id */
int detID;
/** The Plot widget */

View File

@ -9,7 +9,7 @@
/** Project Class Headers */
class slsDetectorUtils;
class multiSlsDetector;
#include "detectorData.h"
/** Qt Project Class Headers */
#include "SlsQt1DPlot.h"
@ -38,7 +38,7 @@ class qDrawPlot:public QWidget{
public:
/** \short The constructor */
qDrawPlot(QWidget *parent,slsDetectorUtils*& detector);
qDrawPlot(QWidget *parent,multiSlsDetector*& detector);
/** Destructor */
~qDrawPlot();
@ -96,7 +96,7 @@ public:
private:
/** The sls detector object */
slsDetectorUtils *myDet;
multiSlsDetector *myDet;
/** Widgets needed to plot the clone */

View File

@ -9,7 +9,7 @@
#define QTABACTIONS_H_
/** Project Class Headers */
class slsDetectorUtils;
class multiSlsDetector;
class ActionsWidget;
#include <QWidget>
@ -31,7 +31,7 @@ public:
* @param parent is the parent tab widget
* @param detector is the detector returned from the detector tab
*/
qTabActions(QWidget *parent,slsDetectorUtils*& detector);
qTabActions(QWidget *parent,multiSlsDetector*& detector);
/** Destructor
*/
@ -44,7 +44,7 @@ public:
private:
/** The sls detector object */
slsDetectorUtils *myDet;
multiSlsDetector *myDet;
static const int NUM_ACTION_WIDGETS = 9;
@ -57,6 +57,9 @@ private:
QPushButton *btnExpand[NUM_ACTION_WIDGETS];
QLabel *lblName[NUM_ACTION_WIDGETS];
enum{Start,Scan0,Scan1,ActionBefore,NumPositions,
HeaderBefore,HeaderAfter,ActionAfter,Stop};
/** Sets up the widget */
void SetupWidgetWindow();
@ -68,6 +71,14 @@ private slots:
/** To Expand the Action Widget */
void Expand(QAbstractButton *button);
/** To set the script of action widget
* @param fName name of script
* @param index id of action widget*/
void SetScript(const QString& fName,int index);
signals:
void EnableScanBox(bool,int);
};
#endif /* QTABACTIONS_H_ */

View File

@ -11,7 +11,7 @@
/** Form Header */
#include "ui_form_tab_advanced.h"
/** Project Class Headers */
class slsDetectorUtils;
class multiSlsDetector;
/**
*@short sets up the advanced parameters
@ -24,7 +24,7 @@ public:
* @param parent is the parent tab widget
* @param detector is the detector returned from the detector tab
*/
qTabAdvanced(QWidget *parent,slsDetectorUtils*& detector);
qTabAdvanced(QWidget *parent,multiSlsDetector*& detector);
/** Destructor
*/
@ -37,7 +37,7 @@ public:
private:
/** The sls detector object */
slsDetectorUtils *myDet;
multiSlsDetector *myDet;
/** The sls detector object type*/
int myDetType;

View File

@ -11,7 +11,8 @@
/** Form Header */
#include "ui_form_tab_dataoutput.h"
/** Project Class Headers */
class slsDetectorUtils;
class multiSlsDetector;
#include "sls_detector_defs.h"
/** Qt Include Headers */
#include <QString>
@ -26,8 +27,9 @@ public:
/** \short The constructor
* @param parent is the parent tab widget
* @param detector is the detector returned from the detector tab
* @param detID is the id of the detector
*/
qTabDataOutput(QWidget *parent,slsDetectorUtils*& detector);
qTabDataOutput(QWidget *parent,multiSlsDetector*& detector,int detID);
/** Destructor
*/
@ -41,7 +43,13 @@ public:
private:
/** The sls detector object */
slsDetectorUtils *myDet;
multiSlsDetector *myDet;
/**detector id */
int detID;
/** detector type */
slsDetectorDefs::detectorType detType;
/** methods */
/** Sets up the widget */
@ -59,6 +67,27 @@ void setOutputDir(const QString& path);
/** Open dialog to choose the output directory */
void browseOutputDir();
/**set flat field file*/
void SetFlatField();
/** update flat field correction from server */
void UpdateFlatFieldFromServer();
/**browse flat field*/
void BrowseFlatFieldPath();
/**rate correction*/
void SetRateCorrection();
/** update rate correction from server */
void UpdateRateCorrectionFromServer();
/**angular correction*/
void SetAngularCorrection();
/**discard bad channels*/
void DiscardBadChannels();
};

View File

@ -11,7 +11,11 @@
/** Form Header */
#include "ui_form_tab_debugging.h"
/** Project Class Headers */
class slsDetectorUtils;
class multiSlsDetector;
/** Qt Include Headers */
/** C++ Include Headers */
#include "sls_detector_defs.h"
/**
*@short sets up the Debugging parameters
@ -24,7 +28,7 @@ public:
* @param parent is the parent tab widget
* @param detector is the detector returned from the detector tab
*/
qTabDebugging(QWidget *parent,slsDetectorUtils*& detector);
qTabDebugging(QWidget *parent,multiSlsDetector*& detector);
/** Destructor
*/
@ -36,7 +40,10 @@ public:
private:
/** The sls detector object */
slsDetectorUtils *myDet;
multiSlsDetector *myDet;
/** detector type */
slsDetectorDefs::detectorType detType;
/** Sets up the widget
*/

View File

@ -11,7 +11,7 @@
/** Form Header */
#include "ui_form_tab_developer.h"
/** Project Class Headers */
class slsDetectorUtils;
class multiSlsDetector;
/**
*@short sets up the Developer parameters
@ -24,7 +24,7 @@ public:
* @param parent is the parent tab widget
* @param detector is the detector returned from the detector tab
*/
qTabDeveloper(QWidget *parent,slsDetectorUtils*& detector);
qTabDeveloper(QWidget *parent,multiSlsDetector*& detector);
/** Destructor
*/
@ -36,7 +36,7 @@ public:
private:
/** The sls detector object */
slsDetectorUtils *myDet;
multiSlsDetector *myDet;
/** Sets up the widget
*/

View File

@ -10,7 +10,7 @@
/** Form Header */
#include "ui_form_tab_measurement.h"
/** Project Class Headers */
class slsDetectorUtils;
class multiSlsDetector;
/** Qt Project Class Headers */
class qDrawPlot;
@ -30,7 +30,7 @@ public:
* @param detector is the detector returned from the detector tab
* @param plot plot object reference
*/
qTabMeasurement(QWidget *parent,slsDetectorUtils*& detector, qDrawPlot*& plot);
qTabMeasurement(QWidget *parent,multiSlsDetector*& detector, qDrawPlot*& plot);
/** Destructor
*/
@ -43,7 +43,7 @@ public:
private:
/** The sls detector object */
slsDetectorUtils *myDet;
multiSlsDetector *myDet;
/** The Plot widget */
qDrawPlot *myPlot;

View File

@ -11,7 +11,7 @@
/** Project Class Headers */
class slsDetectorUtils;
class multiSlsDetector;
/** Qt Include Headers */
#include <QWidget>
#include <QTextEdit>
@ -30,7 +30,7 @@ public:
* @param parent is the parent tab widget
* @param detector is the detector returned from the detector tab
*/
qTabMessages(QWidget *parent,slsDetectorUtils*& detector);
qTabMessages(QWidget *parent,multiSlsDetector*& detector);
/** Destructor
*/
@ -39,7 +39,7 @@ public:
private:
/** The sls detector object */
slsDetectorUtils *myDet;
multiSlsDetector *myDet;
/** Log of executed commands */
QTextEdit *dispLog;

View File

@ -11,7 +11,7 @@
/** Form Header */
#include "ui_form_tab_plot.h"
/** Project Class Headers */
class slsDetectorUtils;
class multiSlsDetector;
/** Qt Project Class Headers */
class qDrawPlot;
/** Qt Include Headers */
@ -29,7 +29,7 @@ public:
* @param detector is the detector returned from the detector tab
* @param plot plot object reference
*/
qTabPlot(QWidget *parent,slsDetectorUtils*& detector, qDrawPlot*& plot);
qTabPlot(QWidget *parent,multiSlsDetector*& detector, qDrawPlot*& plot);
/** Destructor
*/
@ -42,7 +42,7 @@ public:
private:
/** The sls detector object */
slsDetectorUtils *myDet;
multiSlsDetector *myDet;
/** The Plot widget */
qDrawPlot *myPlot;
@ -50,6 +50,8 @@ private:
/** 1d/2d plot */
bool isOneD;
bool scanLevel[2];
QStackedLayout* stackedLayout;
QSpinBox *spinNthFrame;
QDoubleSpinBox *spinTimeGap;
@ -76,10 +78,13 @@ private:
public slots:
/** Set frequency between plots
* returns 0 if there were no errors(important
* while editing acquisition period in measurement tab) */
int SetFrequency();
/** Set frequency between plots*/
void SetFrequency();
/** Enable Scan box
* @param enable to enable the scan group box
* @param id is 0 if its scan level 0 or scan level 1
*/
void EnableScanBox(bool enable,int id);

View File

@ -11,7 +11,7 @@
/** Form Header */
#include "ui_form_tab_settings.h"
/** Project Class Headers */
class slsDetectorUtils;
class multiSlsDetector;
#include "sls_detector_defs.h"
/** Qt Include Headers */
#include <QStandardItemModel>
@ -28,7 +28,7 @@ public:
* @param detector is the detector returned from the detector tab
* @param detID is the id of the detector
*/
qTabSettings(QWidget *parent,slsDetectorUtils*& detector,int detID);
qTabSettings(QWidget *parent,multiSlsDetector*& detector,int detID);
/** Destructor
*/
@ -38,15 +38,25 @@ public:
*/
void Refresh();
/** enable expert mode
* @param enable true if expert mode is enabled
*/
void EnableExpertMode(bool enable){expertMode=enable;Refresh();};
private:
/** The sls detector object */
slsDetectorUtils *myDet;
/**etector id */
multiSlsDetector *myDet;
/**detector id */
int detID;
/** detector type */
slsDetectorDefs::detectorType detType;
bool expertMode;
enum{Standard,Fast,HighGain,DynamicGain,LowGain,MediumGain,VeryHighGain,Undefined,Uninitialized,NumSettings};
/** To be able to index items on a combo box */
@ -68,12 +78,27 @@ private:
private slots:
/** Set settings according to selection
* @param index index of selection
*/
void setSettings(int index);
/** Set number of modules if possible
* @param index number of modules
*/
void SetNumberOfModules(int index);
/** Set dynamic range if possible
* @param index selection
*/
void SetDynamicRange(int index);
/** Set threshold energy
*/
void SetEnergy();
};

View File

@ -5,9 +5,9 @@
* Author: l_maliakal_d
*/
/** Qt Project Class Headers */
// Qt Project Class Headers
#include "qActionsWidget.h"
/** Qt Include Headers */
// Qt Include Headers
#include <QGridLayout>
#include <QHBoxLayout>
#include <QComboBox>
@ -19,20 +19,23 @@
#include <QSpinBox>
#include <QGroupBox>
#include <QRadioButton>
/** C++ Include Headers */
#include <QFileDialog>
// C++ Include Headers
#include<iostream>
using namespace std;
//-------------------------------------------------------------------------------------------------------------------------------------------------
ActionsWidget::ActionsWidget(QWidget *parent, int scanType): QFrame(parent){
SetupWidgetWindow(scanType);
ActionsWidget::ActionsWidget(QWidget *parent, int scanType, int id):
QFrame(parent),scanType(scanType),id(id){
SetupWidgetWindow();
Initialization();
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
ActionsWidget::~ActionsWidget(){
@ -40,24 +43,25 @@ ActionsWidget::~ActionsWidget(){
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void ActionsWidget::SetupWidgetWindow(int scanType){
/** Widget Settings */
void ActionsWidget::SetupWidgetWindow(){
// Widget Settings
//setFrameStyle(QFrame::Box);
//setFrameShadow(QFrame::Raised);
setFixedHeight(25);
if(scanType) setFixedHeight(125);
/** Main Layout Settings */
// Main Layout Settings
layout = new QGridLayout(this);
setLayout(layout);
layout->setContentsMargins(0,0,0,0);
if(scanType) layout->setVerticalSpacing(5);
/** Main Widgets*/
// Main Widgets
comboScript = new QComboBox(this);
if(!scanType){
comboScript->addItem("None");
@ -88,7 +92,7 @@ void ActionsWidget::SetupWidgetWindow(int scanType){
/** Scan Levels Widgets*/
// Scan Levels Widgets
if(scanType){
lblSteps = new QLabel("Number of Steps:");
lblSteps->setEnabled(false);
@ -104,13 +108,13 @@ void ActionsWidget::SetupWidgetWindow(int scanType){
layout->addWidget(spinPrecision,1,6);
group = new QGroupBox(this);
group->setEnabled(false);
/** Fix the size of the groupbox*/
// Fix the size of the groupbox
group->setFixedSize(513,66);
layout->addWidget(group,2,2,1,5);
/** Group Box for step size */
/** Radio Buttons Layout */
// Group Box for step size
// Radio Buttons Layout
QWidget *h1Widget = new QWidget(group);
h1Widget->setGeometry(QRect(10, 5, group->width()-20, 23));
QHBoxLayout *h1 = new QHBoxLayout(h1Widget);
@ -124,7 +128,7 @@ void ActionsWidget::SetupWidgetWindow(int scanType){
radioValue->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
h1->addWidget(radioValue);
/** Constant Size Layout */
// Constant Size Layout
QWidget *h2ConstantWidget = new QWidget(group);
h2ConstantWidget->setGeometry(QRect(10, 30, group->width()-20, 31));
QHBoxLayout *h2Constant = new QHBoxLayout(h2ConstantWidget);
@ -149,7 +153,7 @@ void ActionsWidget::SetupWidgetWindow(int scanType){
h2Constant->addWidget(spinSize);
h2Constant->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
/** Specific Values Layout */
// Specific Values Layout
QWidget *h2SpecificWidget = new QWidget(group);
h2SpecificWidget->setGeometry(QRect(10, 30, group->width()-20, 31));
QHBoxLayout *h2Specific = new QHBoxLayout(h2SpecificWidget);
@ -160,7 +164,7 @@ void ActionsWidget::SetupWidgetWindow(int scanType){
comboSpecific->hide();
h2Specific->addItem(new QSpacerItem(200,20,QSizePolicy::Fixed,QSizePolicy::Fixed));
/** Values From a File Layout */
// Values From a File Layout
QWidget *h2ValuesWidget = new QWidget(group);
h2ValuesWidget->setGeometry(QRect(10, 30, group->width()-20, 31));
QHBoxLayout *h2Values = new QHBoxLayout(h2ValuesWidget);
@ -181,57 +185,67 @@ void ActionsWidget::SetupWidgetWindow(int scanType){
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void ActionsWidget::Initialization(){
connect(comboScript,SIGNAL(currentIndexChanged(int)),this,SLOT(SetScript(int)));
if(comboScript->count()>2){
if(scanType){
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(btnBrowse, SIGNAL(clicked()), this, SLOT(BrowsePath()));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void ActionsWidget::SetScript(int index){
/** defaults */
// defaults
dispScript->setEnabled(false);
btnBrowse->setEnabled(false);
lblParameter->setEnabled(false);
dispParameter->setEnabled(false);
if(comboScript->count()>2){
if(scanType){
group->setEnabled(false);
lblSteps->setEnabled(false);
spinSteps->setEnabled(false);
lblPrecision->setEnabled(false);
spinPrecision->setEnabled(false);
}
/** If anything other than None is selected*/
// If anything other than None is selected
if(index){
/** Custom Script only enables the first layout with addnl parameters etc */
// Custom Script only enables the first layout with addnl parameters etc
if(!comboScript->currentText().compare("Custom Script")){
dispScript->setEnabled(true);
btnBrowse->setEnabled(true);
lblParameter->setEnabled(true);
dispParameter->setEnabled(true);
}
/** If this group includes Energy scan , threhold scan etc */
if(comboScript->count()>2){
// If this group includes Energy scan , threhold scan etc
if(scanType){
group->setEnabled(true);
lblPrecision->setEnabled(true);
spinPrecision->setEnabled(true);
/** Steps are enabled only if constant step size is not checked*/
// Steps are enabled only if constant step size is not checked
lblSteps->setEnabled(!radioConstant->isChecked());
spinSteps->setEnabled(!radioConstant->isChecked());
}
}
//emit signal to enable scanbox and the radiobuttons
if(scanType) emit EnableScanBox(index,((id==2)?1:0));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void ActionsWidget::EnableSizeWidgets(){
/** defaults */
// defaults
lblFrom->hide();
spinFrom->hide();
lblTo->hide();
@ -243,7 +257,7 @@ void ActionsWidget::EnableSizeWidgets(){
btnValues->hide();
lblSteps->setEnabled(true);
spinSteps->setEnabled(true);
/** Constant Step Size */
// Constant Step Size
if(radioConstant->isChecked()){
lblFrom->show();
spinFrom->show();
@ -253,13 +267,28 @@ void ActionsWidget::EnableSizeWidgets(){
spinSize->show();
lblSteps->setEnabled(false);
spinSteps->setEnabled(false);
}/** Specific Values */
}// Specific Values
else if(radioSpecific->isChecked())
comboSpecific->show();
/** Values from a File */
// Values from a File
else{
dispValues->show();
btnValues->show();
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void ActionsWidget::BrowsePath(){
QString fName = dispScript->text();
QString dir = fName.section('/',0,-2,QString::SectionIncludeLeadingSep);
if(dir.isEmpty()) dir = "/home";
fName = QFileDialog::getOpenFileName(this,
tr("Load Script File"),dir,
tr("Script Files(*.awk);;All Files(*)"));//,0,QFileDialog::ShowDirsOnly);
if (!fName.isEmpty()){
dispScript->setText(fName);
emit SetScriptSignal(fName,id);
}
}

View File

@ -1,4 +1,8 @@
/** Qt Project Class Headers */
/**********************************************************************
* TO DO
* 1. settcpsocket is done with slsdetector.maybe do for all detectors connected: mythen
* ********************************************************************/
// Qt Project Class Headers
#include "qDetectorMain.h"
#include "qDefs.h"
#include "qDrawPlot.h"
@ -11,14 +15,14 @@
#include "qTabDebugging.h"
#include "qTabDeveloper.h"
#include "qTabMessages.h"
/** Project Class Headers */
// Project Class Headers
#include "slsDetector.h"
#include "multiSlsDetector.h"
#include "sls_detector_defs.h"
/** Qt Include Headers */
// Qt Include Headers
#include <QSizePolicy>
#include <QFileDialog>
/** C++ Include Headers */
// C++ Include Headers
#include<iostream>
#include <string>
using namespace std;
@ -44,7 +48,7 @@ int main (int argc, char **argv) {
qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app, QWidget *parent) :
QMainWindow(parent), theApp(app),myDet(0),detID(0),myPlot(NULL),tabs(NULL),isDeveloper(0){
/** Getting all the command line arguments */
// Getting all the command line arguments
for(int iarg=1; iarg<argc; iarg++){
if(!strcasecmp(argv[iarg],"-developer")) {isDeveloper=1;}
if(!strcasecmp(argv[iarg],"-id")) {detID=atoi(argv[iarg+1]);}
@ -81,33 +85,33 @@ qDetectorMain::~qDetectorMain(){
void qDetectorMain::SetUpWidgetWindow(){
/** Layout */
// Layout
layoutTabs= new QGridLayout;
centralwidget->setLayout(layoutTabs);
/** plot setup*/
// plot setup
myPlot = new qDrawPlot(dockWidgetPlot,myDet);
dockWidgetPlot->setWidget(myPlot);
/**tabs setup*/
//tabs setup
tabs = new MyTabWidget(this);
layoutTabs->addWidget(tabs);
/** creating all the tab widgets */
// creating all the tab widgets
tab_messages = new qTabMessages (this, myDet);
tab_measurement = new qTabMeasurement (this, myDet,myPlot);
tab_dataoutput = new qTabDataOutput (this, myDet);
tab_dataoutput = new qTabDataOutput (this, myDet, detID);
tab_plot = new qTabPlot (this, myDet,myPlot);
tab_actions = new qTabActions (this, myDet);
tab_settings = new qTabSettings (this, myDet, detID);
tab_advanced = new qTabAdvanced (this, myDet);
tab_debugging = new qTabDebugging (this, myDet);
tab_developer = new qTabDeveloper (this, myDet);
/** creating the scroll area widgets for the tabs */
// creating the scroll area widgets for the tabs
for(int i=0;i<NumberOfTabs;i++){
scroll[i] = new QScrollArea;
scroll[i]->setFrameShape(QFrame::NoFrame);
}
/** setting the tab widgets to the scrollareas*/
// setting the tab widgets to the scrollareas
scroll[Measurement] ->setWidget(tab_measurement);
scroll[DataOutput] ->setWidget(tab_dataoutput);
scroll[Plot] ->setWidget(tab_plot);
@ -116,7 +120,7 @@ void qDetectorMain::SetUpWidgetWindow(){
scroll[Advanced] ->setWidget(tab_advanced);
scroll[Debugging] ->setWidget(tab_debugging);
scroll[Developer] ->setWidget(tab_developer);
/** inserting all the tabs*/
// inserting all the tabs
tabs->insertTab(Measurement, scroll[Measurement], "Measurement");
tabs->insertTab(DataOutput, scroll[DataOutput], "Data Output");
tabs->insertTab(Plot, scroll[Plot], "Plot");
@ -125,16 +129,16 @@ void qDetectorMain::SetUpWidgetWindow(){
tabs->insertTab(Advanced, scroll[Advanced], "Advanced");
tabs->insertTab(Debugging, scroll[Debugging], "Debugging");
tabs->insertTab(Developer, scroll[Developer], "Developer");
/** Prefer this to expand and not have scroll buttons*/
// Prefer this to expand and not have scroll buttons
tabs->insertTab(Messages, tab_messages, "Messages");
/** Default tab color*/
// Default tab color
defaultTabColor = tabs->tabBar()->tabTextColor(DataOutput);
/**Set the current tab(measurement) to blue as it is the current one*/
//Set the current tab(measurement) to blue as it is the current one
tabs->tabBar()->setTabTextColor(0,QColor(0,0,200,255));
/** increase the width so it uses all the empty space for the tab titles*/
// increase the width so it uses all the empty space for the tab titles
tabs->tabBar()->setFixedWidth(width()+61);
/** mode setup - to set up the tabs initially as disabled, not in form so done here */
// mode setup - to set up the tabs initially as disabled, not in form so done here
#ifdef VERBOSE
cout << "Setting Debug Mode to 0\nSetting Beamline Mode to 0\n"
"Setting Expert Mode to 0\nSetting Dockable Mode to false\n"
@ -147,11 +151,11 @@ void qDetectorMain::SetUpWidgetWindow(){
dockWidgetPlot->setFeatures(QDockWidget::NoDockWidgetFeatures);
tabs->setTabEnabled(Developer,isDeveloper);
/** Other setup*/
/**Height of plot and central widget*/
// Other setup
//Height of plot and central widget
heightPlotWindow = dockWidgetPlot->size().height();
heightCentralWidget = centralwidget->size().height();
/** Default zoom Tool Tip */
// Default zoom Tool Tip
zoomToolTip = dockWidgetPlot->toolTip();
}
@ -162,38 +166,43 @@ void qDetectorMain::SetUpWidgetWindow(){
void qDetectorMain::SetUpDetector(){
/**instantiate detector and set window title*/
//instantiate detector and set window title
myDet = new multiSlsDetector(detID);
if(!myDet->getHostname(detID).length()){
string host = myDet->getHostname(detID);
slsDetector *s = myDet->getSlsDetector(detID);
//if hostname doesnt exist even in shared memory
if(!host.length()){
#ifdef VERBOSE
cout << endl << "No Detector Connected at id:" << detID << endl;
cout<<myDet->getHostname(detID)<<endl;
#endif
char cIndex[10];
sprintf(cIndex,"%d",detID);
qDefs::ErrorMessage(string("No Detector Connected at id : ")+string(cIndex),"Main");
exit(-1);
}//if the detector is not even connected
else if(s->setTCPSocket()==slsDetectorDefs::FAIL){
qDefs::ErrorMessage(string("The detector ")+host+string(" is not connected. Exiting GUI."),"Main");
cout << "The detector " << host << "is not connected. Exiting GUI." << endl;
exit(-1);
}
else{
/** Check if type valid. If not, exit*/
switch(myDet->getDetectorsType()){
slsDetectorDefs::detectorType detType = myDet->getDetectorsType();
// Check if type valid. If not, exit
switch(detType){
case slsDetectorDefs::MYTHEN: break;
case slsDetectorDefs::EIGER: break;
case slsDetectorDefs::GOTTHARD: break;
default:
string detName = myDet->slsDetectorBase::getDetectorType(myDet->getDetectorsType());
string hostname = myDet->getHostname(detID);
string errorMess = hostname+string(" has unknown detector type \"")+
string detName = myDet->slsDetectorBase::getDetectorType(detType);
string errorMess = host+string(" has unknown detector type \"")+
detName+string("\". Exiting GUI.");
qDefs::ErrorMessage(errorMess,"Main");
exit(-1);
}
setWindowTitle("SLS Detector GUI : "+
QString(slsDetectorBase::getDetectorType(myDet->getDetectorsType()).c_str())+
" - "+QString(myDet->getHostname(detID).c_str()));
QString(slsDetectorBase::getDetectorType(detType).c_str())+ " - "+QString(host.c_str()));
#ifdef VERBOSE
cout<<endl<<"Type : "<<slsDetectorBase::getDetectorType(myDet->getDetectorsType())<<"\t\t\tDetector : "
""<<myDet->getHostname(detID)<<endl;
cout << endl << "Type : " << slsDetectorBase::getDetectorType(detType) << "\nDetector : " << host << endl;
#endif
myDet->setOnline(slsDetectorDefs::ONLINE_FLAG);
}
@ -204,27 +213,30 @@ void qDetectorMain::SetUpDetector(){
void qDetectorMain::Initialization(){
/** Dockable Plot*/
// Dockable Plot
connect(dockWidgetPlot, SIGNAL(topLevelChanged(bool)), this,SLOT(ResizeMainWindow(bool)));
/** tabs */
// tabs
connect(tabs, SIGNAL(currentChanged(int)), this, SLOT(Refresh(int)));//( QWidget*)));
/** Measurement tab*/
// Measurement tab
connect(tab_measurement, SIGNAL(StartSignal()), this,SLOT(EnableTabs()));
connect(tab_measurement, SIGNAL(StopSignal()), this,SLOT(EnableTabs()));
connect(tab_measurement, SIGNAL(CheckPlotIntervalSignal()), tab_plot,SLOT(SetFrequency()));
/** Plot tab */
// Plot tab
connect(tab_plot, SIGNAL(DisableZoomSignal(bool)), this,SLOT(SetZoomToolTip(bool)));
/** Plotting */
/** When the acquisition is finished, must update the meas tab */
// Actions tab
connect(tab_actions, SIGNAL(EnableScanBox(bool,int)), tab_plot,SLOT(EnableScanBox(bool,int)));
// Plotting
// When the acquisition is finished, must update the meas tab
connect(myPlot, SIGNAL(UpdatingPlotFinished()), this, SLOT(EnableTabs()));
connect(myPlot, SIGNAL(UpdatingPlotFinished()), tab_measurement, SLOT(UpdateFinished()));
connect(myPlot, SIGNAL(SetCurrentMeasurementSignal(int)), tab_measurement, SLOT(SetCurrentMeasurement(int)));
/** menubar */
/** Modes Menu */
// menubar
// Modes Menu
connect(menuModes, SIGNAL(triggered(QAction*)), this,SLOT(EnableModes(QAction*)));
/** Utilities Menu */
// Utilities Menu
connect(menuUtilities, SIGNAL(triggered(QAction*)), this,SLOT(ExecuteUtilities(QAction*)));
/** Help Menu */
// Help Menu
connect(menuHelp, SIGNAL(triggered(QAction*)), this,SLOT(ExecuteHelp(QAction*)));
}
@ -235,7 +247,7 @@ void qDetectorMain::Initialization(){
void qDetectorMain::EnableModes(QAction *action){
bool enable;
/**Set DebugMode */
//Set DebugMode
if(action==actionDebug){
enable = actionDebug->isChecked();
tabs->setTabEnabled(Debugging,enable);
@ -244,7 +256,7 @@ void qDetectorMain::EnableModes(QAction *action){
#endif
}
/**Set BeamlineMode */
//Set BeamlineMode
else if(action==actionBeamline){
enable = actionBeamline->isChecked();
#ifdef VERBOSE
@ -252,16 +264,17 @@ void qDetectorMain::EnableModes(QAction *action){
#endif
}
/**Set ExpertMode */
//Set ExpertMode
else if(action==actionExpert){
enable = actionExpert->isChecked();
tabs->setTabEnabled(Advanced,enable);
tab_settings->EnableExpertMode(enable);
#ifdef VERBOSE
cout << "Setting Expert Mode to " << enable << endl;
#endif
}
/**Set DockableMode */
//Set DockableMode
else{
enable = actionDockable->isChecked();
if(enable)
@ -290,7 +303,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
fName = QFileDialog::getOpenFileName(this,
tr("Load Detector Setup"),fName,
tr("Detector Setup files (*.det)"));
/** Gets called when cancelled as well*/
// Gets called when cancelled as well
if (!fName.isEmpty()){
myDet->retrieveDetectorSetup(string(fName.toAscii().constData()));
qDefs::InfoMessage("The parameters have been successfully setup.","Main");
@ -304,7 +317,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
fName = QFileDialog::getSaveFileName(this,
tr("Save Current Detector Setup"),fName,
tr("Detector Setup files (*.det) "));
/** Gets called when cancelled as well*/
// Gets called when cancelled as well
if (!fName.isEmpty()){
myDet->dumpDetectorSetup(string(fName.toAscii().constData()));
qDefs::InfoMessage("The setup parameters have been successfully saved.","Main");
@ -323,7 +336,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
fName = QFileDialog::getOpenFileName(this,
tr("Load Detector Configuration"),fName,
tr("Configuration files (*.config)"));
/** Gets called when cancelled as well*/
// Gets called when cancelled as well
if (!fName.isEmpty()){
myDet->readConfigurationFile(string(fName.toAscii().constData()));
qDefs::InfoMessage("The parameters have been successfully configured.","Main");
@ -337,7 +350,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
fName = QFileDialog::getSaveFileName(this,
tr("Save Current Detector Configuration"),fName,
tr("Configuration files (*.config) "));
/** Gets called when cancelled as well*/
// Gets called when cancelled as well
if (!fName.isEmpty()){
myDet->writeConfigurationFile(string(fName.toAscii().constData()));
qDefs::InfoMessage("The configuration parameters have been successfully saved.","Main");
@ -362,15 +375,18 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
void qDetectorMain::ExecuteHelp(QAction *action){
if(action==actionVersion){
if(action==actionAbout){
#ifdef VERBOSE
cout<<"Version"<<endl;
#endif
}
else{
#ifdef VERBOSE
cout<<"About"<<endl;
cout << "About: Common GUI for Mythen, Eiger, Gotthard and Agipd detectors" << endl;
#endif
//<h1 style="font-family:verdana;">A heading</h1>
qDefs::InfoMessage("<p style=\"font-family:verdana;\">SLS Detector GUI version: 1.0<br><br>"
"Common GUI to control the SLS Detectors: "
"Mythen, Eiger, Gotthard and Agipd.<br><br>"
"It can be operated in parallel with the command line interface:<br>"
"sls_detector_put,<br>sls_detector_get,<br>sls_detector_acquire and<br>sls_detector_help.<br><br>"
"The software is still in progress. "
"Please report bugs to dhanya.maliakal@psi.ch.<\\p>","About SLS Detector GUI");
}
}
@ -407,16 +423,16 @@ void qDetectorMain::ResizeMainWindow(bool b){
#ifdef VERBOSE
cout << "Resizing Main Window: height:" << height() << endl;
#endif
/** undocked from the main window */
// undocked from the main window
if(b){
/** sets the main window height to a smaller maximum to get rid of space*/
// sets the main window height to a smaller maximum to get rid of space
setMaximumHeight(height()-heightPlotWindow-9);
dockWidgetPlot->setMinimumHeight(0);
cout << "undocking it from main window" << endl;
}
else{
setMaximumHeight(QWIDGETSIZE_MAX);
/** the minimum for plot will be set when the widget gets resized automatically*/
// the minimum for plot will be set when the widget gets resized automatically
}
}
@ -451,20 +467,20 @@ void qDetectorMain::EnableTabs(){
enable=!(tabs->isTabEnabled(DataOutput));
// or use the Enable/Disable button
/** normal tabs*/
// normal tabs
tabs->setTabEnabled(DataOutput,enable);
tabs->setTabEnabled(Actions,enable);
tabs->setTabEnabled(Settings,enable);
tabs->setTabEnabled(Messages,enable);
/** special tabs */
// special tabs
if(enable==false){
tabs->setTabEnabled(Debugging,enable);
tabs->setTabEnabled(Advanced,enable);
tabs->setTabEnabled(Developer,enable);
}
else{
/** enable these tabs only if they were enabled earlier */
// enable these tabs only if they were enabled earlier
if(actionDebug->isChecked())
tabs->setTabEnabled(Debugging,enable);
if(actionExpert->isChecked())

View File

@ -27,7 +27,7 @@ using namespace std;
//-------------------------------------------------------------------------------------------------------------------------------------------------
qDrawPlot::qDrawPlot(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){
qDrawPlot::qDrawPlot(QWidget *parent,multiSlsDetector*& detector):QWidget(parent),myDet(detector){
SetupWidgetWindow();
Initialization();
StartStopDaqToggle(); //as default

View File

@ -4,23 +4,24 @@
* Created on: May 10, 2012
* Author: l_maliakal_d
*/
/** Qt Project Class Headers */
// Qt Project Class Headers
#include "qTabActions.h"
#include "qDefs.h"
#include "qActionsWidget.h"
/** Project Class Headers */
// Project Class Headers
#include "slsDetector.h"
#include "multiSlsDetector.h"
/** Qt Include Headers */
// Qt Include Headers
#include <QButtonGroup>
/** C++ Include Headers */
// C++ Include Headers
#include<iostream>
using namespace std;
qTabActions::qTabActions(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){
qTabActions::qTabActions(QWidget *parent,multiSlsDetector*& detector):
QWidget(parent),myDet(detector){
SetupWidgetWindow();
Initialization();
}
@ -36,32 +37,32 @@ qTabActions::~qTabActions(){
void qTabActions::SetupWidgetWindow(){
/** Window Settings*/
// Window Settings
setFixedSize(705,350);
setContentsMargins(0,0,0,0);
/** Scroll Area Settings*/
// Scroll Area Settings
QScrollArea *scroll = new QScrollArea;
scroll->setWidget(this);
scroll->setWidgetResizable(true);
/** Layout Settings*/
// Layout Settings
gridLayout = new QGridLayout(scroll);
setLayout(gridLayout);
gridLayout->setContentsMargins(10,5,0,0);
gridLayout->setVerticalSpacing(2);
/** Buttongroup to know which +/- button was clicked*/
// Buttongroup to know which +/- button was clicked
group = new QButtonGroup(this);
palette = new QPalette();
/** For each level of Actions */
// For each level of Actions
for(int i=0;i<NUM_ACTION_WIDGETS;i++){
/** Add the extra widgets only for the 1st 2 levels*/
if((i==1)||(i==2))
actionWidget[i] = new ActionsWidget(this,1);
// Add the extra widgets only for the 1st 2 levels
if((i==Scan0)||(i==Scan1))
actionWidget[i] = new ActionsWidget(this,1,i);
else
actionWidget[i] = new ActionsWidget(this,0);
actionWidget[i] = new ActionsWidget(this,0,i);
btnExpand[i] = new QPushButton("+");
btnExpand[i]->setFixedSize(20,20);
@ -70,22 +71,26 @@ void qTabActions::SetupWidgetWindow(){
gridLayout->addWidget(btnExpand[i],(i*2),0);
gridLayout->addWidget(lblName[i],(i*2),1);
gridLayout->addWidget(actionWidget[i],(i*2)+1,1,1,2);
/* gridLayout->addWidget(btnExpand[i],(i*2),i);
gridLayout->addWidget(lblName[i],(i*2),i+1);
gridLayout->addWidget(actionWidget[i],(i*2)+1,i+1,1,2);*/
}
/** Label Values */
lblName[0]->setText("Action at Start");
lblName[1]->setText("Scan Level 0");
lblName[2]->setText("Scan Level 1");
lblName[3]->setText("Action before each Frame");
lblName[4]->setText("Number of Positions");
lblName[5]->setText("Header before Frame");
lblName[6]->setText("Header after Frame");
lblName[7]->setText("Action after each Frame");
lblName[8]->setText("Action at Stop");
// Label Values
lblName[Start]->setText("Action at Start");
lblName[Scan0]->setText("Scan Level 0");
lblName[Scan1]->setText("Scan Level 1");
lblName[ActionBefore]->setText("Action before each Frame");
lblName[NumPositions]->setText("Number of Positions");
lblName[HeaderBefore]->setText("Header before Frame");
lblName[HeaderAfter]->setText("Header after Frame");
lblName[ActionAfter]->setText("Action after each Frame");
lblName[Stop]->setText("Action at Stop");
/** initially hide all the widgets*/
for(int i=0;i<NUM_ACTION_WIDGETS;i++) actionWidget[i]->hide();
// initially hide all the widgets
for(int i=0;i<NUM_ACTION_WIDGETS;i++)
actionWidget[i]->hide();
}
@ -93,145 +98,53 @@ void qTabActions::SetupWidgetWindow(){
void qTabActions::Initialization(){
connect(group, SIGNAL(buttonClicked(QAbstractButton*)), this,SLOT(Expand(QAbstractButton*)));
connect(actionWidget[Scan0],SIGNAL(EnableScanBox(bool,int)), this,SIGNAL(EnableScanBox(bool,int)));
connect(actionWidget[Scan1],SIGNAL(EnableScanBox(bool,int)), this,SIGNAL(EnableScanBox(bool,int)));
for(int i=0;i<NUM_ACTION_WIDGETS;i++){
connect(actionWidget[i],SIGNAL(SetScriptSignal(QString&,int)), this,SLOT(SetScript(QString&,int)));
}
}
void qTabActions::Expand(QAbstractButton *button ){
int index = group->id(button);
/** Collapse */
// Collapse
if(!QString::compare(button->text(), "-")){
palette->setColor(QPalette::WindowText,Qt::black);
lblName[index]->setPalette(*palette);
actionWidget[index]->hide();
button->setText("+");
if((index==1)||(index==2))
if((index==Scan0)||(index==Scan1))
setFixedHeight(height()-130);
else
setFixedHeight(height()-30);
}else{
/** Expand */
// Expand
palette->setColor(QPalette::WindowText,QColor(0,0,200,255));
lblName[index]->setPalette(*palette);
actionWidget[index]->show();
button->setText("-");
if((index==1)||(index==2))
if((index==Scan0)||(index==Scan1))
setFixedHeight(height()+130);
else
setFixedHeight(height()+30);
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
/*
void qTabActions::Initialization(){
connect(radio0Constant, SIGNAL(toggled(bool)),this,SLOT(ChangeStepSize(bool)));
connect(radio0Specific, SIGNAL(toggled(bool)),this,SLOT(ChangeStepSize(bool)));
connect(radio0Value, SIGNAL(toggled(bool)),this,SLOT(ChangeStepSize(bool)));
connect(radio1Constant, SIGNAL(toggled(bool)),this,SLOT(ChangeStepSize(bool)));
connect(radio1Specific, SIGNAL(toggled(bool)),this,SLOT(ChangeStepSize(bool)));
connect(radio1Value, SIGNAL(toggled(bool)),this,SLOT(ChangeStepSize(bool)));
connect(btntry, SIGNAL(clicked()),this,SLOT(Trial()));
void qTabActions::SetScript(const QString& fName,int index){
#ifdef VERBOSE
cout << "Setting script file of action widget:" << index << " to " << fName.toAscii().constData() << endl;
#endif
}
void qTabActions::Enable(bool enable){
}
void qTabActions::ChangeStepSize(bool b){
* defaults
lbl0From->hide();
lbl0Size->hide();
lbl0To->hide();
spin0From->hide();
spin0Size->hide();
spin0To->hide();
combo0Specific->hide();
btn0Browse->hide();
disp0File->hide();
lbl1From->hide();
lbl1Size->hide();
lbl1To->hide();
spin1From->hide();
spin1Size->hide();
spin1To->hide();
combo1Specific->hide();
btn1Browse->hide();
disp1File->hide();
*Scan 0
* constant step size
if(radio0Constant->isChecked()){
lbl0From->show();
lbl0Size->show();
lbl0To->show();
spin0From->show();
spin0Size->show();
spin0To->show();
}
* specific values
else if(radio0Specific->isChecked())
combo0Specific->show();
* values from a file
else{
btn0Browse->show();
disp0File->show();
}
*Scan 1
* constant step size
if(radio1Constant->isChecked()){
lbl1From->show();
lbl1Size->show();
lbl1To->show();
spin1From->show();
spin1Size->show();
spin1To->show();
}
* specific values
else if(radio1Specific->isChecked())
combo1Specific->show();
* values from a file
else{
btn1Browse->show();
disp1File->show();
}
//groupBox->hide();
}
//if(!QString::compare(btntry->text(),"+")){
*/
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabActions::Refresh(){

View File

@ -16,7 +16,7 @@ using namespace std;
qTabAdvanced::qTabAdvanced(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){
qTabAdvanced::qTabAdvanced(QWidget *parent,multiSlsDetector*& detector):QWidget(parent),myDet(detector){
setupUi(this);
myDetType = (int)myDet->getDetectorsType();
SetupWidgetWindow();

View File

@ -4,14 +4,19 @@
* Created on: May 10, 2012
* Author: l_maliakal_d
*/
/**********************************************************************
* TO DO
* 1. Rate correction auto: for eiger depends on settings, tdeadtime{vv,vv,vv} in postprocessing.h
* ********************************************************************/
#include "qTabDataOutput.h"
#include "qDefs.h"
/** Project Class Headers */
// Project Class Headers
#include "slsDetector.h"
#include "multiSlsDetector.h"
/** Qt Include Headers */
// Qt Include Headers
#include <QFileDialog>
/** C++ Include Headers */
// C++ Include Headers
#include <iostream>
#include <string>
using namespace std;
@ -20,11 +25,12 @@ using namespace std;
//-------------------------------------------------------------------------------------------------------------------------------------------------
qTabDataOutput::qTabDataOutput(QWidget *parent,slsDetectorUtils*& detector):
QWidget(parent),myDet(detector){
qTabDataOutput::qTabDataOutput(QWidget *parent,multiSlsDetector*& detector,int detID):
QWidget(parent),myDet(detector),detID(detID){
setupUi(this);
SetupWidgetWindow();
Initialization();
Refresh();
}
@ -40,7 +46,12 @@ qTabDataOutput::~qTabDataOutput(){
void qTabDataOutput::SetupWidgetWindow(){
dispOutputDir->setText(QString(myDet->getFilePath().c_str()));
// Detector Type
detType=myDet->getDetectorsType();
//rate correction - not for charge integrating detectors
if((detType == slsDetectorDefs::MYTHEN)||(detType == slsDetectorDefs::EIGER))
chkRate->setEnabled(true);
}
@ -48,11 +59,23 @@ void qTabDataOutput::SetupWidgetWindow(){
void qTabDataOutput::Initialization(){
//output dir
connect(dispOutputDir, SIGNAL(textChanged(const QString&)), this, SLOT(setOutputDir(const QString&)));
connect(btnOutputBrowse, SIGNAL(clicked()), this, SLOT(browseOutputDir()));
//flat field correction
connect(chkFlatField, SIGNAL(toggled(bool)), this, SLOT(SetFlatField()));
connect(btnFlatField, SIGNAL(clicked()), this, SLOT(BrowseFlatFieldPath()));
//rate correction
connect(chkRate, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
connect(radioAuto, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
connect(radioDeadTime, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
connect(spinDeadTime, SIGNAL(valueChanged(double)), this, SLOT(SetRateCorrection()));
//angular correction
connect(chkAngular, SIGNAL(toggled(bool)), this, SLOT(SetAngularCorrection()));
//discard bad channels
connect(chkDiscardBad, SIGNAL(toggled(bool)), this, SLOT(DiscardBadChannels()));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
@ -67,15 +90,6 @@ void qTabDataOutput::setOutputDir(const QString& path){
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabDataOutput::Refresh(){
/** output dir*/
dispOutputDir->setText(QString(myDet->getFilePath().c_str()));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabDataOutput::browseOutputDir()
{
QString directory = QFileDialog::getExistingDirectory(this,tr("Choose Output Directory "),dispOutputDir->text());
@ -84,4 +98,281 @@ void qTabDataOutput::browseOutputDir()
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabDataOutput::SetFlatField(){
#ifdef VERYVERBOSE
cout << "Entering Set Flat Field Correction Function" << endl;
#endif
// so that it doesnt call it twice
disconnect(dispFlatField, SIGNAL(editingFinished()), this, SLOT(SetFlatField()));
//enable/disable
dispFlatField->setEnabled(chkFlatField->isChecked());
btnFlatField->setEnabled(chkFlatField->isChecked());
if(chkFlatField->isChecked()){
if(dispFlatField->text().isEmpty()){
lblNote->show();
chkFlatField->setPalette(lblNote->palette());
chkFlatField->setText("Flat Field File:*");
#ifdef VERBOSE
cout << "Flat Field File is not set." << endl;
#endif
}else{
QString fName = dispFlatField->text();
QString file = fName.section('/',-1);
QString dir = fName.section('/',0,-2,QString::SectionIncludeLeadingSep);
lblNote->hide();
chkFlatField->setPalette(chkRate->palette());
chkFlatField->setText("Flat Field File:");
//set ff dir
myDet->setFlatFieldCorrectionDir(dir.toAscii().constData());
//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+
".\nUnsetting Flat Field.","Data Output");
//Unsetting flat field
myDet->setFlatFieldCorrectionFile("");
dispFlatField->setText("");
lblNote->show();
chkFlatField->setPalette(lblNote->palette());
chkFlatField->setText("Flat Field File:*");
#ifdef VERBOSE
cout << "Invalid Flat Field File - "<< sDir << sFile << ". Unsetting Flat Field." << endl;
#endif
}
else{
#ifdef VERBOSE
cout << "Setting flat field file to "<< dispFlatField->text().toAscii().constData() << endl;
#endif
}
}
}else{
lblNote->hide();
chkFlatField->setPalette(chkRate->palette());
chkFlatField->setText("Flat Field File:");
//Unsetting flat field
myDet->setFlatFieldCorrectionFile("");
dispFlatField->setText("");
#ifdef VERBOSE
cout << "Unsetting flat field correction file" << endl;
#endif
}
connect(dispFlatField,SIGNAL(editingFinished()),this,SLOT(SetFlatField()));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabDataOutput::UpdateFlatFieldFromServer(){
disconnect(dispFlatField, SIGNAL(editingFinished()), this, SLOT(SetFlatField()));
dispFlatField->setText(QString(myDet->getFlatFieldCorrectionDir().c_str())+"/"+QString(myDet->getFlatFieldCorrectionFile().c_str()));
#ifdef VERBOSE
cout << "Getting flat field correction file" << dispFlatField->text().toAscii().constData() << endl;
#endif
//calls setflatfield to ensure the file still exists or disable it
if(!QString(myDet->getFlatFieldCorrectionFile().c_str()).compare("none")){
dispFlatField->setText("");
chkFlatField->setChecked(false);
#ifdef VERBOSE
cout << "Flat Field is not set." << endl;
#endif
}
else
chkFlatField->setChecked(true);
lblNote->hide();
connect(dispFlatField, SIGNAL(editingFinished()), this, SLOT(SetFlatField()));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabDataOutput::BrowseFlatFieldPath()
{
QString fName = dispFlatField->text();
QString dir = fName.section('/',0,-2,QString::SectionIncludeLeadingSep);
if(dir.isEmpty()) dir = "/home";
fName = QFileDialog::getOpenFileName(this,
tr("Load Flat Field Correction File"),dir,
tr("Flat Field Correction Files(*.dat)"));//,0,QFileDialog::ShowDirsOnly);
if (!fName.isEmpty()){
dispFlatField->setText(fName);
SetFlatField();
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabDataOutput::SetRateCorrection(){
disconnect(radioAuto, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
disconnect(radioDeadTime, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
disconnect(spinDeadTime, SIGNAL(valueChanged(double)), this, SLOT(SetRateCorrection()));
#ifdef VERBOSE
cout << "Entering Set Rate Correction function" << endl;
#endif
slsDetector *s = myDet->getSlsDetector(detID);
if(chkRate->isChecked()){
radioAuto->setEnabled(true);
radioDeadTime->setEnabled(true);
//set auto as default if nothing selected
if(!radioAuto->isChecked()&&!radioDeadTime->isChecked())
radioAuto->setChecked(true);
//auto
if(radioAuto->isChecked()){
spinDeadTime->setEnabled(false);
s->setRateCorrection(-1);
#ifdef VERBOSE
cout << "Setting rate corrections with default dead time" << endl;
#endif
}//custom dead time
else{
spinDeadTime->setEnabled(true);
s->setRateCorrection((float)spinDeadTime->value());
#ifdef VERBOSE
cout << "Setting rate corrections with dead time "<< spinDeadTime->value() << endl;
#endif
}
}//unsetting
else{
radioAuto->setEnabled(false);
radioDeadTime->setEnabled(false);
spinDeadTime->setEnabled(false);
//Unsetting rate correction
s->setRateCorrection(0);
#ifdef VERBOSE
cout << "Unsetting rate correction" << endl;
#endif
}
connect(radioAuto, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
connect(radioDeadTime, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
connect(spinDeadTime, SIGNAL(valueChanged(double)), this, SLOT(SetRateCorrection()));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabDataOutput::UpdateRateCorrectionFromServer(){
disconnect(chkRate, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
disconnect(radioAuto, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
disconnect(radioDeadTime, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
disconnect(spinDeadTime, SIGNAL(valueChanged(double)), this, SLOT(SetRateCorrection()));
double rate;
slsDetector *s = myDet->getSlsDetector(detID);
rate = (double)s->getRateCorrectionTau();
#ifdef VERBOSE
cout << "Getting rate correction from server:" << rate << " : ";
#endif
if(rate==0){
#ifdef VERBOSE
cout << "None" << endl;
#endif
radioAuto->setEnabled(false);
radioDeadTime->setEnabled(false);
spinDeadTime->setEnabled(false);
chkRate->setChecked(false);
}else if(rate<0){
#ifdef VERBOSE
cout << "Auto" << endl;
#endif
radioAuto->setEnabled(true);
radioDeadTime->setEnabled(true);
spinDeadTime->setEnabled(false);
chkRate->setChecked(true);
radioAuto->setChecked(true);
}else{
#ifdef VERBOSE
cout << "Custom" << endl;
#endif
radioAuto->setEnabled(true);
radioDeadTime->setEnabled(true);
spinDeadTime->setEnabled(true);
chkRate->setChecked(true);
radioDeadTime->setChecked(true);
spinDeadTime->setValue((double)rate);
}
connect(chkRate, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
connect(radioAuto, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
connect(radioDeadTime, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
connect(spinDeadTime, SIGNAL(valueChanged(double)), this, SLOT(SetRateCorrection()));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabDataOutput::SetAngularCorrection(){
#ifdef VERYVERBOSE
cout << "Entering Set Angular Correction function" << endl;
#endif
if(chkAngular->isChecked()){
myDet->setAngularConversionFile("default");
#ifdef VERBOSE
cout << "Setting angular conversion to default" << endl;
#endif
}else{
myDet->setAngularConversionFile("");
#ifdef VERBOSE
cout << "Unsetting angular correction" << endl;
#endif
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabDataOutput::DiscardBadChannels(){
#ifdef VERYVERBOSE
cout << "Entering Discard bad channels function" << endl;
#endif
if(chkDiscardBad->isChecked()){
myDet->setBadChannelCorrection("default");
#ifdef VERBOSE
cout << "Setting bad channel correction to default" << endl;
#endif
}else{
myDet->setBadChannelCorrection("");
#ifdef VERBOSE
cout << "Unsetting bad channel correction" << endl;
#endif
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabDataOutput::Refresh(){
// output dir
dispOutputDir->setText(QString(myDet->getFilePath().c_str()));
//flat field correction from server
UpdateFlatFieldFromServer();
//rate correction - not for charge integrating detectors
if((detType == slsDetectorDefs::MYTHEN)||(detType == slsDetectorDefs::EIGER))
UpdateRateCorrectionFromServer();
//update angular conversion from server
int ang;
if(myDet->getAngularConversion(ang)) chkAngular->setChecked(true);
//discard bad channels from server
if(myDet->getBadChannelCorrection()) chkDiscardBad->setChecked(true);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------

View File

@ -6,17 +6,17 @@
*/
#include "qTabDebugging.h"
#include "qDefs.h"
/** Project Class Headers */
// Project Class Headers
#include "slsDetector.h"
#include "multiSlsDetector.h"
/** C++ Include Headers */
// C++ Include Headers
#include<iostream>
using namespace std;
qTabDebugging::qTabDebugging(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){
qTabDebugging::qTabDebugging(QWidget *parent,multiSlsDetector*& detector):QWidget(parent),myDet(detector){
setupUi(this);
SetupWidgetWindow();
Initialization();
@ -33,6 +33,20 @@ qTabDebugging::~qTabDebugging(){
void qTabDebugging::SetupWidgetWindow(){
// Detector Type
detType=myDet->getDetectorsType();
if(detType==slsDetectorDefs::EIGER) lblModule->setText("Half Module Number:");
else lblModule->setText("Module Number:");
// loading combo box module numbers
int max = myDet->setNumberOfModules(GET_FLAG,slsDetectorDefs::X)*myDet->setNumberOfModules(GET_FLAG,slsDetectorDefs::Y);
for(int i=0;i<max;i++){
slsDetector *s = myDet->getSlsDetector(i);
if(s->setTCPSocket()!=slsDetectorDefs::FAIL){
comboModule->addItem(QString::number(i));
}
}
}

View File

@ -16,7 +16,7 @@ using namespace std;
qTabDeveloper::qTabDeveloper(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){
qTabDeveloper::qTabDeveloper(QWidget *parent,multiSlsDetector*& detector):QWidget(parent),myDet(detector){
setupUi(this);
SetupWidgetWindow();
Initialization();

View File

@ -25,7 +25,7 @@ using namespace std;
//-------------------------------------------------------------------------------------------------------------------------------------------------
qTabMeasurement::qTabMeasurement(QWidget *parent,slsDetectorUtils*& detector, qDrawPlot*& plot):
qTabMeasurement::qTabMeasurement(QWidget *parent,multiSlsDetector*& detector, qDrawPlot*& plot):
QWidget(parent),myDet(detector),myPlot(plot){
setupUi(this);
SetupWidgetWindow();

View File

@ -24,7 +24,7 @@ using namespace std;
//-------------------------------------------------------------------------------------------------------------------------------------------------
qTabMessages::qTabMessages(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){
qTabMessages::qTabMessages(QWidget *parent,multiSlsDetector*& detector):QWidget(parent),myDet(detector){
SetupWidgetWindow();
Initialization();
}

View File

@ -32,18 +32,9 @@ QString qTabPlot::defaultImageZAxisTitle("Intensity");
//-------------------------------------------------------------------------------------------------------------------------------------------------
qTabPlot::qTabPlot(QWidget *parent,slsDetectorUtils*& detector, qDrawPlot*& plot):QWidget(parent),myDet(detector),myPlot(plot){
qTabPlot::qTabPlot(QWidget *parent,multiSlsDetector*& detector, qDrawPlot*& plot):QWidget(parent),myDet(detector),myPlot(plot){
setupUi(this);
SetupWidgetWindow();
/** Depending on whether the detector is 1d or 2d*/
switch(myDet->getDetectorsType()){
case slsDetectorDefs::MYTHEN: Select1DPlot(true); break;
case slsDetectorDefs::EIGER: Select1DPlot(false);break;
case slsDetectorDefs::GOTTHARD: Select1DPlot(true);break;
default:
cout<<"ERROR: Detector Type is Generic"<<endl;
exit(-1);
}
Initialization();
}
@ -61,6 +52,9 @@ qTabPlot::~qTabPlot(){
void qTabPlot::SetupWidgetWindow(){
scanLevel[0]=false;
scanLevel[1]=false;
/** Plot Axis*/
myPlot->SetPlotTitle(defaultPlotTitle);
dispTitle->setText(defaultPlotTitle);
@ -109,13 +103,18 @@ void qTabPlot::SetupWidgetWindow(){
stackedLayout->addWidget(w);
stackedLayout->addWidget(spinNthFrame);
stackWidget->setLayout(stackedLayout);
/** Depending on whether the detector is 1d or 2d*/
switch(myDet->getDetectorsType()){
case slsDetectorDefs::MYTHEN: Select1DPlot(true); break;
case slsDetectorDefs::EIGER: Select1DPlot(false);break;
case slsDetectorDefs::GOTTHARD: Select1DPlot(true);break;
default:
cout<<"ERROR: Detector Type is Generic"<<endl;
exit(-1);
}
}
@ -149,6 +148,8 @@ void qTabPlot::Select1DPlot(bool b){
dispZAxis->setText(defaultImageZAxisTitle);
myPlot->Select2DPlot();
}
boxScan->setEnabled(false);
}
@ -368,16 +369,6 @@ void qTabPlot::SetPlot(){
boxFrequency->setEnabled(false);
boxPlotAxis->setEnabled(false);
boxScan->setEnabled(false);
}else if(radioHistogram->isChecked()){
myPlot->EnablePlot(true);
/**if enable is true, disable everything */
if(isOneD) box1D->show(); else box1D->hide();
if(!isOneD) box2D->show(); else box2D->hide();
boxSnapshot->setEnabled(true);
boxSave->setEnabled(true);
boxFrequency->setEnabled(true);
boxPlotAxis->setEnabled(true);
boxScan->setEnabled(false);
}else {
myPlot->EnablePlot(true);
/**if enable is true, disable everything */
@ -387,15 +378,20 @@ void qTabPlot::SetPlot(){
boxSave->setEnabled(true);
boxFrequency->setEnabled(true);
boxPlotAxis->setEnabled(true);
boxScan->setEnabled(true);
if(radioHistogram->isChecked())
boxScan->setEnabled(false);
else
//check first if there is a scan from actions tab
boxScan->setEnabled(false);
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
int qTabPlot::SetFrequency(){
int ret=0;
void qTabPlot::SetFrequency(){
disconnect(comboTimeGapUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency()));
disconnect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
disconnect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
@ -411,7 +407,6 @@ int qTabPlot::SetFrequency(){
/* Get the time interval from gui in ms*/
timeMS = (qDefs::getNSTime((qDefs::timeUnit)comboTimeGapUnit->currentIndex(),spinTimeGap->value()))/(1e6);
if(timeMS<minPlotTimer){
ret = 1;
qDefs::WarningMessage("Interval between Plots - The Time Interval between plots "
"must be atleast "+string(cplotms)+".","Plot");
spinTimeGap->setValue(minPlotTimer);
@ -431,7 +426,6 @@ int qTabPlot::SetFrequency(){
timeMS = (spinNthFrame->value())*acqPeriodMS;
/** To make sure the period between plotting is not less than minimum plot timer in ms*/
if(timeMS<minPlotTimer){
ret = 1;
int minFrame = (ceil)(minPlotTimer/acqPeriodMS);
qDefs::WarningMessage("<b>Plot Tab:</b> Interval between Plots - The nth Image must be larger.<br><br>"
"Condition to be satisfied:\n(Acquisition Period)*(nth Image) >= 500ms."
@ -450,14 +444,49 @@ int qTabPlot::SetFrequency(){
connect(comboTimeGapUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency()));
connect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
connect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
return ret;
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabPlot::EnableScanBox(bool enable,int id){
cout<<"enable:"<<enable<<" id:"<<id<<endl;
/**find out when this is enabled*/
scanLevel[id]=enable;
//both are disabled
if((!scanLevel[0])&&(!scanLevel[1])){
boxScan->setEnabled(false);
}//both are enabled
else if((scanLevel[0])&&(scanLevel[1])){
//disable none and check the other
if(id) {radioLevel1->setEnabled(true);radioLevel1->setChecked(true);}
else {radioLevel0->setEnabled(true);radioLevel0->setChecked(true);}
}//either 1 is enabled/disabled
else{
if(!boxScan->isEnabled()) {
boxScan->setEnabled(true);
radioFileIndex->setEnabled(false);
}
//disable one and check the other
if(id) {
radioLevel0->setEnabled(!enable);
radioLevel0->setChecked(!enable);
radioLevel1->setEnabled(enable);
radioLevel1->setChecked(enable);
}else{
radioLevel0->setEnabled(enable);
radioLevel0->setChecked(enable);
radioLevel1->setEnabled(!enable);
radioLevel1->setChecked(!enable);
}
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabPlot::Refresh(){
SetFrequency();
}

View File

@ -16,8 +16,8 @@ using namespace std;
//-------------------------------------------------------------------------------------------------------------------------------------------------
qTabSettings::qTabSettings(QWidget *parent,slsDetectorUtils*& detector,int detID):
QWidget(parent),myDet(detector),detID(detID){
qTabSettings::qTabSettings(QWidget *parent,multiSlsDetector*& detector,int detID):
QWidget(parent),myDet(detector),detID(detID), expertMode(false){
setupUi(this);
SetupWidgetWindow();
@ -41,6 +41,22 @@ void qTabSettings::SetupWidgetWindow(){
SetupDetectorSettings();
comboSettings->setCurrentIndex(myDet->getSettings(detID));
/**expert mode is not enabled initially*/
lblThreshold->setEnabled(false);
spinThreshold->setEnabled(false);
/** Number of Modules */
spinNumModules->setMaximum(myDet->getMaxNumberOfModules());
spinNumModules->setValue(myDet->setNumberOfModules());
/** Dynamic Range */
switch(myDet->setDynamicRange(-1)){
case 32: comboDynamicRange->setCurrentIndex(0); break;
case 16: comboDynamicRange->setCurrentIndex(1); break;
case 8: comboDynamicRange->setCurrentIndex(2); break;
case 4: comboDynamicRange->setCurrentIndex(3); break;
default: comboDynamicRange->setCurrentIndex(0); break;
}
}
@ -112,10 +128,7 @@ void qTabSettings::SetupDetectorSettings(){
exit(-1);
}
/** Setting the detector settings */
else {
comboSettings->setCurrentIndex((int)sett);
}
else comboSettings->setCurrentIndex((int)sett);
}
}
@ -124,6 +137,12 @@ void qTabSettings::SetupDetectorSettings(){
void qTabSettings::Initialization(){
/** Settings */
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int)));
/** Number of Modules */
connect(spinNumModules, SIGNAL(valueChanged(int)), this, SLOT(SetNumberOfModules(int)));
/** Dynamic Range */
connect(comboDynamicRange, SIGNAL(activated(int)), this, SLOT(SetDynamicRange(int)));
/** Threshold */
connect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy()));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
@ -144,9 +163,89 @@ void qTabSettings::setSettings(int index){
#ifdef VERBOSE
cout << "Settings have been set to "<<myDet->slsDetectorBase::getDetectorSettings(sett) << endl;
#endif
if((detType==slsDetectorDefs::GOTTHARD)||(detType==slsDetectorDefs::AGIPD)){
lblThreshold->setEnabled(false);
spinThreshold->setEnabled(false);
}else{
if((index==Undefined)||(index==Uninitialized)){
lblThreshold->setEnabled(false);
spinThreshold->setEnabled(false);
}else{
lblThreshold->setEnabled(expertMode);
spinThreshold->setEnabled(expertMode);
if(expertMode) SetEnergy();
}
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabSettings::SetNumberOfModules(int index){
#ifdef VERBOSE
cout << "Setting number of modules to "<< index << endl;
#endif
int i = myDet->setNumberOfModules(index);
if(index!=i)
qDefs::WarningMessage("Number of modules cannot be set for this value.","Settings");
#ifdef VERBOSE
cout << "ERROR: Setting number of modules to "<< i << endl;
#endif
spinNumModules->setValue(i);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabSettings::SetDynamicRange(int index){
int ret,dr;
switch (index) {
case 0: dr=32; break;
case 1: dr=16; break;
case 2: dr=8; break;
case 3: dr=4; break;
default: dr=32; break;
}
#ifdef VERBOSE
cout << "Setting dynamic range to "<< dr << endl;
#endif
ret=myDet->setDynamicRange(dr);
if(ret!=dr){
qDefs::WarningMessage("Dynamic Range cannot be set for this value.","Settings");
#ifdef VERBOSE
cout << "ERROR: Setting dynamic range to "<< ret << endl;
#endif
switch(ret){
case 32: comboDynamicRange->setCurrentIndex(0); break;
case 16: comboDynamicRange->setCurrentIndex(1); break;
case 8: comboDynamicRange->setCurrentIndex(2); break;
case 4: comboDynamicRange->setCurrentIndex(3); break;
default: comboDynamicRange->setCurrentIndex(0); break;
}
}
};
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabSettings::SetEnergy(){
#ifdef VERBOSE
cout << "Settings threshold energy to "<< index << endl;
#endif
int index = spinThreshold->value();
myDet->setThresholdEnergy(index);
int ret = (int)myDet->getThresholdEnergy();
if(ret!=index){
qDefs::WarningMessage("Threshold energy could not be set.","Settings");
disconnect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy()));
spinThreshold->setValue(ret);
connect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy()));
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
@ -154,6 +253,33 @@ void qTabSettings::Refresh(){
/** Settings */
SetupDetectorSettings();
comboSettings->setCurrentIndex(myDet->getSettings(detID));
/** Number of Modules */
spinNumModules->setValue(myDet->setNumberOfModules());
/** Dynamic Range */
switch(myDet->setDynamicRange(-1)){
case 32: comboDynamicRange->setCurrentIndex(0); break;
case 16: comboDynamicRange->setCurrentIndex(1); break;
case 8: comboDynamicRange->setCurrentIndex(2); break;
case 4: comboDynamicRange->setCurrentIndex(3); break;
default: comboDynamicRange->setCurrentIndex(0); break;
}
if((detType==slsDetectorDefs::GOTTHARD)||(detType==slsDetectorDefs::AGIPD)){
lblThreshold->setEnabled(false);
spinThreshold->setEnabled(false);
}else{
if((comboSettings->currentIndex()==Undefined)||(comboSettings->currentIndex()==Uninitialized)){
lblThreshold->setEnabled(false);
spinThreshold->setEnabled(false);
}else{
lblThreshold->setEnabled(expertMode);
spinThreshold->setEnabled(expertMode);
if(expertMode) SetEnergy();
}
}
}