mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 01:58:00 +02:00
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:
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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,17 +48,17 @@ 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]);}
|
||||
|
||||
if(!strcasecmp(argv[iarg],"-help")){
|
||||
cout<<"Possible Arguments are:"<<endl;
|
||||
cout<<"-help \t\t : \t This help"<<endl;
|
||||
cout<<"-developer \t : \t Enables the developer tab"<<endl;
|
||||
cout<<"-id i \t : \t Sets the detector to id i (the default is 0). "
|
||||
"Required only when more than one detector is connected in parallel."<<endl;
|
||||
cout << "Possible Arguments are:" << endl;
|
||||
cout << "-help \t\t : \t This help" << endl;
|
||||
cout << "-developer \t : \t Enables the developer tab" << endl;
|
||||
cout << "-id i \t : \t Sets the detector to id i (the default is 0). "
|
||||
"Required only when more than one detector is connected in parallel." << endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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,20 +129,20 @@ 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"
|
||||
cout << "Setting Debug Mode to 0\nSetting Beamline Mode to 0\n"
|
||||
"Setting Expert Mode to 0\nSetting Dockable Mode to false\n"
|
||||
"Setting Developer Mode to "<<isDeveloper<<endl;
|
||||
"Setting Developer Mode to " << isDeveloper << endl;
|
||||
#endif
|
||||
tabs->setTabEnabled(Debugging,false);
|
||||
//beamline mode to false
|
||||
@ -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;
|
||||
cout << endl << "No Detector Connected at id:" << 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,33 +247,34 @@ void qDetectorMain::Initialization(){
|
||||
void qDetectorMain::EnableModes(QAction *action){
|
||||
bool enable;
|
||||
|
||||
/**Set DebugMode */
|
||||
//Set DebugMode
|
||||
if(action==actionDebug){
|
||||
enable = actionDebug->isChecked();
|
||||
tabs->setTabEnabled(Debugging,enable);
|
||||
#ifdef VERBOSE
|
||||
cout<<"Setting Debug Mode to "<<enable<<endl;
|
||||
cout << "Setting Debug Mode to " << enable << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**Set BeamlineMode */
|
||||
//Set BeamlineMode
|
||||
else if(action==actionBeamline){
|
||||
enable = actionBeamline->isChecked();
|
||||
#ifdef VERBOSE
|
||||
cout<<"Setting Beamline Mode to "<<enable<<endl;
|
||||
cout << "Setting Beamline Mode to " << enable << endl;
|
||||
#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;
|
||||
cout << "Setting Expert Mode to " << enable << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**Set DockableMode */
|
||||
//Set DockableMode
|
||||
else{
|
||||
enable = actionDockable->isChecked();
|
||||
if(enable)
|
||||
@ -271,7 +284,7 @@ void qDetectorMain::EnableModes(QAction *action){
|
||||
dockWidgetPlot->setFeatures(QDockWidget::NoDockWidgetFeatures);
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
cout<<"Setting Dockable Mode to "<<enable<<endl;
|
||||
cout << "Setting Dockable Mode to " << enable << endl;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -284,13 +297,13 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
|
||||
|
||||
if(action==actionOpenSetup){
|
||||
#ifdef VERBOSE
|
||||
cout<<"Opening Setup"<<endl;
|
||||
cout << "Opening Setup" << endl;
|
||||
#endif
|
||||
QString fName = QString(myDet->getFilePath().c_str());
|
||||
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");
|
||||
@ -298,13 +311,13 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
|
||||
}
|
||||
else if(action==actionSaveSetup){
|
||||
#ifdef VERBOSE
|
||||
cout<<"Saving Setup"<<endl;
|
||||
cout << "Saving Setup" << endl;
|
||||
#endif
|
||||
QString fName = QString(myDet->getFilePath().c_str());
|
||||
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");
|
||||
@ -312,18 +325,18 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
|
||||
}
|
||||
else if(action==actionMeasurementWizard){
|
||||
#ifdef VERBOSE
|
||||
cout<<"Measurement Wizard"<<endl;
|
||||
cout << "Measurement Wizard" << endl;
|
||||
#endif
|
||||
}
|
||||
else if(action==actionOpenConfiguration){
|
||||
#ifdef VERBOSE
|
||||
cout<<"Opening Configuration"<<endl;
|
||||
cout << "Opening Configuration" << endl;
|
||||
#endif
|
||||
QString fName = QString(myDet->getFilePath().c_str());
|
||||
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");
|
||||
@ -331,13 +344,13 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
|
||||
}
|
||||
else if(action==actionSaveConfiguration){
|
||||
#ifdef VERBOSE
|
||||
cout<<"Saving Configuration"<<endl;
|
||||
cout << "Saving Configuration" << endl;
|
||||
#endif
|
||||
QString fName = QString(myDet->getFilePath().c_str());
|
||||
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");
|
||||
@ -345,12 +358,12 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
|
||||
}
|
||||
else if(action==actionEnergyCalibration){
|
||||
#ifdef VERBOSE
|
||||
cout<<"Executing Energy Calibration"<<endl;
|
||||
cout << "Executing Energy Calibration" << endl;
|
||||
#endif
|
||||
}
|
||||
else{
|
||||
#ifdef VERBOSE
|
||||
cout<<"Executing Angular Calibration"<<endl;
|
||||
cout << "Executing Angular Calibration" << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
@ -405,18 +421,18 @@ void qDetectorMain::Refresh(int index){
|
||||
|
||||
void qDetectorMain::ResizeMainWindow(bool b){
|
||||
#ifdef VERBOSE
|
||||
cout<<"Resizing Main Window: height:"<<height()<<endl;
|
||||
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;
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
@ -445,26 +461,26 @@ void qDetectorMain::resizeEvent(QResizeEvent* event){
|
||||
|
||||
void qDetectorMain::EnableTabs(){
|
||||
#ifdef VERBOSE
|
||||
cout<<"Entering EnableTabs function"<<endl;
|
||||
cout << "Entering EnableTabs function" << endl;
|
||||
#endif
|
||||
bool enable;
|
||||
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())
|
||||
|
@ -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
|
||||
|
@ -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,168 +71,80 @@ 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();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void qTabActions::Initialization(){
|
||||
connect(group,SIGNAL(buttonClicked(QAbstractButton*)),this,SLOT(Expand(QAbstractButton*)));
|
||||
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(){
|
||||
|
@ -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();
|
||||
|
@ -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,18 +59,30 @@ 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()));
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabDataOutput::setOutputDir(const QString& path){
|
||||
myDet->setFilePath(string(path.toAscii().constData()));
|
||||
#ifdef VERBOSE
|
||||
cout<<"Output Directory changed to :"<<myDet->getFilePath()<<endl;
|
||||
cout << "Output Directory changed to :"<<myDet->getFilePath() << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -67,20 +90,288 @@ 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());
|
||||
if (!directory.isEmpty())
|
||||
dispOutputDir->setText(directory);
|
||||
QString directory = QFileDialog::getExistingDirectory(this,tr("Choose Output Directory "),dispOutputDir->text());
|
||||
if (!directory.isEmpty())
|
||||
dispOutputDir->setText(directory);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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,7 +369,7 @@ void qTabPlot::SetPlot(){
|
||||
boxFrequency->setEnabled(false);
|
||||
boxPlotAxis->setEnabled(false);
|
||||
boxScan->setEnabled(false);
|
||||
}else if(radioHistogram->isChecked()){
|
||||
}else {
|
||||
myPlot->EnablePlot(true);
|
||||
/**if enable is true, disable everything */
|
||||
if(isOneD) box1D->show(); else box1D->hide();
|
||||
@ -377,25 +378,20 @@ void qTabPlot::SetPlot(){
|
||||
boxSave->setEnabled(true);
|
||||
boxFrequency->setEnabled(true);
|
||||
boxPlotAxis->setEnabled(true);
|
||||
boxScan->setEnabled(false);
|
||||
}else{
|
||||
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(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();
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -107,15 +123,12 @@ void qTabSettings::SetupDetectorSettings(){
|
||||
qDefs::ErrorMessage("Unknown Detector Settings retrieved from detector. "
|
||||
"Exiting GUI.","Settings");
|
||||
#ifdef VERBOSE
|
||||
cout<<"ERROR: Unknown Detector Settings retrieved from detector."<<endl;
|
||||
cout << "ERROR: Unknown Detector Settings retrieved from detector." << endl;
|
||||
#endif
|
||||
exit(-1);
|
||||
}
|
||||
/** Setting the detector settings */
|
||||
else {
|
||||
comboSettings->setCurrentIndex((int)sett);
|
||||
|
||||
}
|
||||
else comboSettings->setCurrentIndex((int)sett);
|
||||
}
|
||||
}
|
||||
|
||||
@ -123,7 +136,13 @@ void qTabSettings::SetupDetectorSettings(){
|
||||
|
||||
void qTabSettings::Initialization(){
|
||||
/** Settings */
|
||||
connect(comboSettings,SIGNAL(currentIndexChanged(int)),this,SLOT(setSettings(int)));
|
||||
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()));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
@ -142,11 +161,91 @@ void qTabSettings::setSettings(int index){
|
||||
}
|
||||
slsDetectorDefs::detectorSettings sett = myDet->setSettings((slsDetectorDefs::detectorSettings)index,detID);
|
||||
#ifdef VERBOSE
|
||||
cout<<"Settings have been set to "<<myDet->slsDetectorBase::getDetectorSettings(sett)<<endl;
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user