From 9f851d61561603e130c4446342494ac884a45a6d Mon Sep 17 00:00:00 2001 From: maliakal_d Date: Mon, 21 May 2012 16:00:26 +0000 Subject: [PATCH 001/332] Creating Classes, Libraries and Functions for the Common SLS Detector GUI git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@1 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/doxy.config | 102 ++++ slsDetectorGui/forms/form_detectormain.ui | 399 ++++++++++++++ slsDetectorGui/forms/form_drawplot.ui | 71 +++ slsDetectorGui/forms/form_tab_actions.ui | 44 ++ slsDetectorGui/forms/form_tab_advanced.ui | 139 +++++ slsDetectorGui/forms/form_tab_dataoutput.ui | 44 ++ slsDetectorGui/forms/form_tab_debugging.ui | 44 ++ slsDetectorGui/forms/form_tab_developer.ui | 44 ++ slsDetectorGui/forms/form_tab_measurement.ui | 346 ++++++++++++ slsDetectorGui/forms/form_tab_plot.ui | 372 +++++++++++++ slsDetectorGui/forms/form_tab_settings.ui | 44 ++ slsDetectorGui/include/qCloneWidget.h | 58 ++ slsDetectorGui/include/qDefs.h | 54 ++ slsDetectorGui/include/qDetectorMain.h | 161 ++++++ slsDetectorGui/include/qDrawPlot.h | 225 ++++++++ slsDetectorGui/include/qTabActions.h | 52 ++ slsDetectorGui/include/qTabAdvanced.h | 62 +++ slsDetectorGui/include/qTabDataOutput.h | 54 ++ slsDetectorGui/include/qTabDebugging.h | 54 ++ slsDetectorGui/include/qTabDeveloper.h | 54 ++ slsDetectorGui/include/qTabMeasurement.h | 108 ++++ slsDetectorGui/include/qTabPlot.h | 74 +++ slsDetectorGui/include/qTabSettings.h | 54 ++ slsDetectorGui/slsDetectorGui.pro | 92 ++++ .../slsDetectorPlotting/include/SlsQt1DPlot.h | 145 +++++ .../include/SlsQt1DZoomer.h | 59 ++ .../slsDetectorPlotting/include/SlsQt2DHist.h | 113 ++++ .../slsDetectorPlotting/include/SlsQt2DPlot.h | 79 +++ .../include/SlsQt2DPlotLayout.h | 112 ++++ .../include/SlsQt2DZoomer.h | 51 ++ .../include/SlsQtNumberEntry.h | 140 +++++ .../include/SlsQtValidators.h | 73 +++ .../slsDetectorPlotting/src/SlsQt1DPlot.cxx | 440 +++++++++++++++ .../slsDetectorPlotting/src/SlsQt1DZoomer.cxx | 99 ++++ .../slsDetectorPlotting/src/SlsQt2DHist.cxx | 122 +++++ .../slsDetectorPlotting/src/SlsQt2DPlot.cxx | 213 ++++++++ .../src/SlsQt2DPlotLayout.cxx | 212 ++++++++ .../src/SlsQtNumberEntry.cxx | 506 ++++++++++++++++++ slsDetectorGui/src/qCloneWidget.cpp | 56 ++ slsDetectorGui/src/qDetectorMain.cpp | 291 ++++++++++ slsDetectorGui/src/qDrawPlot.cpp | 434 +++++++++++++++ slsDetectorGui/src/qTabActions.cpp | 58 ++ slsDetectorGui/src/qTabAdvanced.cpp | 84 +++ slsDetectorGui/src/qTabDataOutput.cpp | 55 ++ slsDetectorGui/src/qTabDebugging.cpp | 55 ++ slsDetectorGui/src/qTabDeveloper.cpp | 55 ++ slsDetectorGui/src/qTabMeasurement.cpp | 195 +++++++ slsDetectorGui/src/qTabPlot.cpp | 68 +++ slsDetectorGui/src/qTabSettings.cpp | 56 ++ 49 files changed, 6522 insertions(+) create mode 100644 slsDetectorGui/doxy.config create mode 100644 slsDetectorGui/forms/form_detectormain.ui create mode 100644 slsDetectorGui/forms/form_drawplot.ui create mode 100644 slsDetectorGui/forms/form_tab_actions.ui create mode 100644 slsDetectorGui/forms/form_tab_advanced.ui create mode 100644 slsDetectorGui/forms/form_tab_dataoutput.ui create mode 100644 slsDetectorGui/forms/form_tab_debugging.ui create mode 100644 slsDetectorGui/forms/form_tab_developer.ui create mode 100644 slsDetectorGui/forms/form_tab_measurement.ui create mode 100644 slsDetectorGui/forms/form_tab_plot.ui create mode 100644 slsDetectorGui/forms/form_tab_settings.ui create mode 100644 slsDetectorGui/include/qCloneWidget.h create mode 100644 slsDetectorGui/include/qDefs.h create mode 100644 slsDetectorGui/include/qDetectorMain.h create mode 100644 slsDetectorGui/include/qDrawPlot.h create mode 100644 slsDetectorGui/include/qTabActions.h create mode 100644 slsDetectorGui/include/qTabAdvanced.h create mode 100644 slsDetectorGui/include/qTabDataOutput.h create mode 100644 slsDetectorGui/include/qTabDebugging.h create mode 100644 slsDetectorGui/include/qTabDeveloper.h create mode 100644 slsDetectorGui/include/qTabMeasurement.h create mode 100644 slsDetectorGui/include/qTabPlot.h create mode 100644 slsDetectorGui/include/qTabSettings.h create mode 100644 slsDetectorGui/slsDetectorGui.pro create mode 100644 slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h create mode 100644 slsDetectorGui/slsDetectorPlotting/include/SlsQt1DZoomer.h create mode 100644 slsDetectorGui/slsDetectorPlotting/include/SlsQt2DHist.h create mode 100644 slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h create mode 100644 slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlotLayout.h create mode 100644 slsDetectorGui/slsDetectorPlotting/include/SlsQt2DZoomer.h create mode 100644 slsDetectorGui/slsDetectorPlotting/include/SlsQtNumberEntry.h create mode 100644 slsDetectorGui/slsDetectorPlotting/include/SlsQtValidators.h create mode 100644 slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cxx create mode 100644 slsDetectorGui/slsDetectorPlotting/src/SlsQt1DZoomer.cxx create mode 100644 slsDetectorGui/slsDetectorPlotting/src/SlsQt2DHist.cxx create mode 100644 slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx create mode 100644 slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx create mode 100644 slsDetectorGui/slsDetectorPlotting/src/SlsQtNumberEntry.cxx create mode 100644 slsDetectorGui/src/qCloneWidget.cpp create mode 100644 slsDetectorGui/src/qDetectorMain.cpp create mode 100644 slsDetectorGui/src/qDrawPlot.cpp create mode 100644 slsDetectorGui/src/qTabActions.cpp create mode 100644 slsDetectorGui/src/qTabAdvanced.cpp create mode 100644 slsDetectorGui/src/qTabDataOutput.cpp create mode 100644 slsDetectorGui/src/qTabDebugging.cpp create mode 100644 slsDetectorGui/src/qTabDeveloper.cpp create mode 100644 slsDetectorGui/src/qTabMeasurement.cpp create mode 100644 slsDetectorGui/src/qTabPlot.cpp create mode 100644 slsDetectorGui/src/qTabSettings.cpp diff --git a/slsDetectorGui/doxy.config b/slsDetectorGui/doxy.config new file mode 100644 index 000000000..2fabbef2b --- /dev/null +++ b/slsDetectorGui/doxy.config @@ -0,0 +1,102 @@ +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = YES + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = YES + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = YES + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base +# name of the file that contains the anonymous namespace. By default +# anonymous namespace are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +INPUT = \ + slsDetectorPlotting/include/SlsQt1DPlot.h\ + slsDetectorPlotting/src/SlsQt1DPlot.cxx + slsDetectorPlotting/include/SlsQt1DZoomer.h\ + slsDetectorPlotting/src/SlsQt1DZoomer.cxx\ + slsDetectorPlotting/include/SlsQt2DHist.h\ + slsDetectorPlotting/src/SlsQt2DHist.cxx\ + slsDetectorPlotting/include/SlsQt2DPlot.h\ + slsDetectorPlotting/src/SlsQt2DPlot.cxx\ + slsDetectorPlotting/include/SlsQt2DPlotLayout.h\ + slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx\ + slsDetectorPlotting/include/SlsQtNumberEntry.h\ + slsDetectorPlotting/src/SlsQtNumberEntry.cxx\ + slsDetectorPlotting/include/SlsQt2DZoomer.h\ + slsDetectorPlotting/include/SlsQtValidators.h\ + include/qDetectorMain.h\ + src/qDetectorMain.cpp\ + include/qDrawPlot.h\ + src/qDrawPlot.cpp\ + include/qCloneWidget.h\ + src/qCloneWidget.cpp\ + include/qTabMeasurement.h\ + src/qTabMeasurement.cpp\ + include/qTabDataOutput.h\ + src/qTabDataOutput.cpp\ + include/qTabPlot.h\ + src/qTabPlot.cpp\ + include/qTabActions.h\ + src/qTabActions.cpp\ + include/qTabAdvanced.h\ + src/qTabAdvanced.cpp\ + include/qTabSettings.h\ + src/qTabSettings.cpp\ + include/qTabDebugging.h\ + src/qTabDebugging.cpp\ + include/qTabDeveloper.h\ + src/qTabDeveloper.cpp\ + include/qDefs.h + + +OUTPUT_DIRECTORY = docs + diff --git a/slsDetectorGui/forms/form_detectormain.ui b/slsDetectorGui/forms/form_detectormain.ui new file mode 100644 index 000000000..02fa824f5 --- /dev/null +++ b/slsDetectorGui/forms/form_detectormain.ui @@ -0,0 +1,399 @@ + + + DetectorMainObject + + + true + + + + 0 + 0 + 1000 + 956 + + + + + 0 + 0 + + + + + 9 + + + + SLS Detector GUI + + + Qt::ImhNone + + + false + + + QTabWidget::Rounded + + + false + + + QMainWindow::AllowTabbedDocks|QMainWindow::AnimatedDocks + + + + + 0 + 0 + + + + + 0 + 470 + + + + + 1000 + 470 + + + + + + 0 + 0 + 953 + 470 + + + + + + + + + 0 + 0 + 1000 + 25 + + + + + 9 + + + + false + + + true + + + + + 9 + + + + &Utilities + + + + + + + + + + + + + + + &Modes + + + + + + + + + &Help + + + + + + + + + + + + 0 + 0 + + + + + 40 + 54 + + + + + 524287 + 470 + + + + + 11 + 75 + true + + + + Undock, move and enlarge the window to use it + + + false + + + QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetVerticalTitleBar + + + Qt::BottomDockWidgetArea|Qt::RightDockWidgetArea + + + SLS Detector Terminal + + + 2 + + + + + 9 + 50 + false + + + + + + + + 0 + 0 + + + + + 58 + 455 + + + + + 524287 + 524287 + + + + + Sans Serif + 11 + 75 + true + + + + QDockWidget::DockWidgetMovable + + + Qt::BottomDockWidgetArea + + + SLS Detector Plot + + + 8 + + + + + 0 + 0 + + + + + 0 + 429 + + + + + 16777215 + 16777215 + + + + + 9 + 50 + false + + + + + + 0 + 0 + 1000 + 431 + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 9 + + + + QFrame::NoFrame + + + QFrame::Raised + + + 1 + + + + + + + &Open Setup + + + + + + + + &Save Setup + + + + + + + + &Measurement Wizard + + + + + &Open Configuration + + + + + &Save Configuration + + + + + &Energy Calibration + + + + + &Angular Calibration + + + + + true + + + false + + + &Debug + + + + + true + + + false + + + &Beamline + + + + + true + + + false + + + &Expert + + + + + true + + + false + + + &Configuration + + + + + &Version + + + + + &About + + + + + true + + + &Dockable Plot + + + + + + diff --git a/slsDetectorGui/forms/form_drawplot.ui b/slsDetectorGui/forms/form_drawplot.ui new file mode 100644 index 000000000..67c2cee30 --- /dev/null +++ b/slsDetectorGui/forms/form_drawplot.ui @@ -0,0 +1,71 @@ + + + DrawPlotObject + + + + 0 + 0 + 1000 + 435 + + + + + 0 + 0 + + + + Form + + + + + 3 + -2 + 1000 + 435 + + + + + 0 + 0 + + + + + 50 + false + + + + Startup Image + + + true + + + false + + + + + -3 + 16 + 1001 + 421 + + + + + QLayout::SetNoConstraint + + + + + + + + diff --git a/slsDetectorGui/forms/form_tab_actions.ui b/slsDetectorGui/forms/form_tab_actions.ui new file mode 100644 index 000000000..9f96ef508 --- /dev/null +++ b/slsDetectorGui/forms/form_tab_actions.ui @@ -0,0 +1,44 @@ + + + TabActionsObject + + + + 0 + 0 + 952 + 445 + + + + + 952 + 445 + + + + + 952 + 445 + + + + Form + + + + + 224 + 223 + 75 + 25 + + + + PushButton + + + + + + diff --git a/slsDetectorGui/forms/form_tab_advanced.ui b/slsDetectorGui/forms/form_tab_advanced.ui new file mode 100644 index 000000000..fb03a0ed6 --- /dev/null +++ b/slsDetectorGui/forms/form_tab_advanced.ui @@ -0,0 +1,139 @@ + + + TabAdvancedObject + + + + 0 + 0 + 952 + 445 + + + + + 952 + 445 + + + + + 952 + 445 + + + + Form + + + + + 3 + 412 + 75 + 25 + + + + PushButton + + + + + + 626 + 8 + 91 + 41 + + + + Qt::NoFocus + + + Gets both the temperature of ADC and FPGA + + + Get +Temperature + + + + + + 796 + 34 + 151 + 21 + + + + Reads temperature of FPGA. + #temp_fpga# + + + false + + + Qt::AlignCenter + + + true + + + + + + 736 + 4 + 41 + 20 + + + + ADC: + + + + + + 736 + 34 + 41 + 20 + + + + FPGA: + + + + + + 796 + 4 + 151 + 21 + + + + Reads temperature of ADC. + #temp_adc# + + + + + + false + + + Qt::AlignCenter + + + true + + + + + + diff --git a/slsDetectorGui/forms/form_tab_dataoutput.ui b/slsDetectorGui/forms/form_tab_dataoutput.ui new file mode 100644 index 000000000..a822cbda6 --- /dev/null +++ b/slsDetectorGui/forms/form_tab_dataoutput.ui @@ -0,0 +1,44 @@ + + + TabDataOutputObject + + + + 0 + 0 + 900 + 400 + + + + + 0 + 0 + + + + + 952 + 1000 + + + + Form + + + + + 157 + 256 + 75 + 25 + + + + PushButton + + + + + + diff --git a/slsDetectorGui/forms/form_tab_debugging.ui b/slsDetectorGui/forms/form_tab_debugging.ui new file mode 100644 index 000000000..8890e4adf --- /dev/null +++ b/slsDetectorGui/forms/form_tab_debugging.ui @@ -0,0 +1,44 @@ + + + TabDebuggingObject + + + + 0 + 0 + 952 + 445 + + + + + 952 + 445 + + + + + 952 + 445 + + + + Form + + + + + 232 + 141 + 75 + 25 + + + + PushButton + + + + + + diff --git a/slsDetectorGui/forms/form_tab_developer.ui b/slsDetectorGui/forms/form_tab_developer.ui new file mode 100644 index 000000000..074e6adf3 --- /dev/null +++ b/slsDetectorGui/forms/form_tab_developer.ui @@ -0,0 +1,44 @@ + + + TabDeveloperObject + + + + 0 + 0 + 952 + 445 + + + + + 952 + 445 + + + + + 952 + 445 + + + + Form + + + + + 232 + 141 + 75 + 25 + + + + PushButton + + + + + + diff --git a/slsDetectorGui/forms/form_tab_measurement.ui b/slsDetectorGui/forms/form_tab_measurement.ui new file mode 100644 index 000000000..1b05d7ad7 --- /dev/null +++ b/slsDetectorGui/forms/form_tab_measurement.ui @@ -0,0 +1,346 @@ + + + TabMeasurementObject + + + + 0 + 0 + 900 + 400 + + + + + 0 + 0 + + + + + 952 + 500 + + + + Form + + + + + 9 + 30 + 420 + 355 + + + + + + + + 0 + 0 + + + + Settings of the detector. + #settings# + + + + Standard + + + + + Fast + + + + + High Gain + + + + + Dynamic Gain + + + + + Low Gain + + + + + Medium Gain + + + + + Very High Gain + + + + + Undefined + + + + + Uninitialized + + + + + + + + Settings: + + + + + + + Number of measurements: + + + + + + + Acquisition Time: + + + + + + + + 0 + 0 + + + + Exposure time of each frame. + #exptime# + + + 2000000000.000000000000000 + + + 1.000000000000000 + + + + + + + + 0 + 0 + + + + 2 + + + + hr + + + + + min + + + + + s + + + + + ms + + + + + us + + + + + ns + + + + + + + + + 0 + 0 + + + + Frame period between exposures. + #period# + + + 2000000000.000000000000000 + + + 2.000000000000000 + + + + + + + 2 + + + + hr + + + + + min + + + + + s + + + + + ms + + + + + us + + + + + ns + + + + + + + + Frame Period: + + + + + + + File Name: + + + + + + + Root of the file name - please check that the output directory is correctly set and select the file name format. + #fname# + + + run + + + + + + + Run Index: + + + + + + + Run index (automatically incremented) + #index# + + + + + + + + + + + + 0 + + + 2000000000 + + + 0 + + + + + + + Qt::NoFocus + + + Starts Acquisition + + + Start + + + + + + + + 0 + 0 + + + + Number of measurements (not in real time) that will be acquired. + #frames# + + + + + + + + + + + + 1 + + + 2000000000 + + + 2000 + + + + + + + + + diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui new file mode 100644 index 000000000..b6ce36b03 --- /dev/null +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -0,0 +1,372 @@ + + + TabPlotObject + + + + 0 + 0 + 952 + 445 + + + + + 952 + 445 + + + + + 952 + 445 + + + + Form + + + + + 10 + 250 + 571 + 151 + + + + Plot Axis + + + + + 10 + 20 + 551 + 121 + + + + + + + X Axis: + + + + + + + + + + X min: + + + + + + + + + + X max: + + + + + + + + + + Y Axis: + + + + + + + + + + Y min: + + + + + + + + + + Y max: + + + + + + + + + + Z Axis: + + + + + + + + + + Z min: + + + + + + + + + + Z max: + + + + + + + + + + Qt::Horizontal + + + + 60 + 20 + + + + + + + + Qt::Horizontal + + + + 60 + 20 + + + + + + + + Title: + + + + + + + + + + + + + 10 + 170 + 571 + 61 + + + + 2D Plot Options + + + + + 10 + 20 + 551 + 31 + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + Interpolate + + + + + + + Contour + + + + + + + Log Scale (Z) + + + + + + + + + + 10 + 90 + 571 + 61 + + + + 1D Plot Options + + + + + 10 + 20 + 551 + 31 + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 430 + 20 + + + + + + + + + + + 10 + 10 + 571 + 61 + + + + Plot Options + + + + + 10 + 20 + 551 + 31 + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 20 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 300 + 20 + + + + + + + + Clone + + + + + + + Close All Clones + + + + + + + + + + diff --git a/slsDetectorGui/forms/form_tab_settings.ui b/slsDetectorGui/forms/form_tab_settings.ui new file mode 100644 index 000000000..779aaa9d2 --- /dev/null +++ b/slsDetectorGui/forms/form_tab_settings.ui @@ -0,0 +1,44 @@ + + + TabSettingsObject + + + + 0 + 0 + 952 + 445 + + + + + 952 + 445 + + + + + 952 + 445 + + + + Form + + + + + 333 + 161 + 75 + 25 + + + + PushButton + + + + + + diff --git a/slsDetectorGui/include/qCloneWidget.h b/slsDetectorGui/include/qCloneWidget.h new file mode 100644 index 000000000..af49e1bc1 --- /dev/null +++ b/slsDetectorGui/include/qCloneWidget.h @@ -0,0 +1,58 @@ +/* + * qCloneWidget.h + * + * Created on: May 18, 2012 + * Author: l_maliakal_d + */ + +#ifndef QCLONEWIDGET_H_ +#define QCLONEWIDGET_H_ + +/** Qt Project Class Headers */ +class SlsQt1DPlot; +class SlsQt2DPlotLayout; +/** Qt Include Headers */ +#include +#include + +/** + *@short Sets up the clone plot widget + */ +class qCloneWidget:public QFrame{ + Q_OBJECT + +public: + /** \short The constructor + */ + qCloneWidget(QWidget *parent,int id,QSize fSize,int numDim,SlsQt1DPlot*& plot1D,SlsQt2DPlotLayout*& plot2D); + + /** Destructor + */ + ~qCloneWidget(); + + + +public slots: + + + +private: + /** clone window id*/ + int id; + /** clone 1D Plot */ + SlsQt1DPlot* cloneplot1D; + /** clone 2D Plot */ + SlsQt2DPlotLayout* cloneplot2D; + +protected: + void closeEvent(QCloseEvent* event); + +signals: +void CloneClosedSignal(int); + +}; + + + + +#endif /* QCLONEWIDGET_H_ */ diff --git a/slsDetectorGui/include/qDefs.h b/slsDetectorGui/include/qDefs.h new file mode 100644 index 000000000..3785a7e34 --- /dev/null +++ b/slsDetectorGui/include/qDefs.h @@ -0,0 +1,54 @@ +/* + * qDefs.h + * + * Created on: May 4, 2012 + * Author: l_maliakal_d + */ + +#ifndef QDEFS_H +#define QDEFS_H + +class qDefs +{ +public: + /** Empty Constructor + */ + qDefs(){}; + + /** unit of time + */ + enum timeUnit{ + HOURS, /** hr */ + MINUTES, /** min */ + SECONDS, /** s */ + MILLISECONDS, /** ms */ + MICROSECONDS, /** us */ + NANOSECONDS /** ns */ + }; + + + /** returns the value in ns to send to server. + * @param unit unit of time + * @param value time + * returns time value in ns + */ + static int64_t get64bTime(timeUnit unit, double value){ + int64_t value64=value; + switch(unit){ + case HOURS: value64*=60; + case MINUTES: value64*=60; + case SECONDS: value64*=1000; + case MILLISECONDS: value64*=1000; + case MICROSECONDS: value64*=1000; + case NANOSECONDS: + default:; + } + return value64; + }; + + + +}; + + +#endif /* QDEFS_H */ diff --git a/slsDetectorGui/include/qDetectorMain.h b/slsDetectorGui/include/qDetectorMain.h new file mode 100644 index 000000000..1568303c7 --- /dev/null +++ b/slsDetectorGui/include/qDetectorMain.h @@ -0,0 +1,161 @@ +/* + * qDetectorMain.h + * Main Window of the GUI + * Created on: Apr 30, 2012 + * Author: l_maliakal_d + */ +#ifndef QDETECTORMAIN_H +#define QDETECTORMAIN_H + +/** Form Header */ +#include "ui_form_detectormain.h" +/** Qt Project Class Headers */ +class qDrawPlot; +class qTabMeasurement; +class qTabDataOutput; +class qTabPlot; +class qTabActions; +class qTabAdvanced; +class qTabSettings; +class qTabDebugging; +class qTabDeveloper; +/** Project Class Headers */ +class slsDetectorUtils; +#include "sls_detector_defs.h" +/** Qt Include Headers */ +#include + +/** + *@short Main window of the GUI. + */ +class qDetectorMain:public QMainWindow, private Ui::DetectorMainObject{ + Q_OBJECT + + +public: + /** \short Main Window constructor. + * This is mainly used to create detector object and all the tabs + * @param argc number of command line arguments for server options + * @param argv server options + * @param app the qapplication + * @param parent makes the parent window 0 by default + */ + qDetectorMain(int argc, char **argv, QApplication *app, QWidget *parent = 0); + + /**Destructor + */ + ~qDetectorMain(); + + +private: + /** The Qt Application */ + QApplication *theApp; + + /** The sls detector object */ + slsDetectorUtils *myDet; + + /** The Plot widget */ + qDrawPlot *myPlot; + + /**Tab Widget */ + QTabWidget *tabs; + + static const int NUMBER_OF_TABS = 8; + + /* Scroll Area for the tabs**/ + QScrollArea *scroll[NUMBER_OF_TABS]; + QScrollArea *scrollMain; + /**Measurement tab */ + qTabMeasurement *tab_measurement; + /**DataOutput tab */ + qTabDataOutput *tab_dataoutput; + /**Plot tab */ + qTabPlot *tab_plot; + /**Actions tab */ + qTabActions *tab_actions; + /**Advanced tab */ + qTabAdvanced *tab_advanced; + /**Settings tab */ + qTabSettings *tab_Settings; + /**Debugging tab */ + qTabDebugging *tab_debugging; + /**Developer tab */ + qTabDeveloper *tab_developer; + + /** enumeration of the tabs */ + enum {Measurement, DataOutput, Plot, Actions, Advanced, Settings, Debugging, Developer }; + + + /**Sets up the layout of the widget + */ + void SetUpWidgetWindow(); + + /**Sets up detector + */ + void SetUpDetector(); + + /**Sets up the signals and the slots + */ + void Initialization(); + + /** Enables the developer tab + */ + void SetDeveloperMode(); + +private slots: +/** Sets/unsets the debug mode i.e. enables/disables the debug tab + * @param b bool TRUE sets, FALSE unsets + */ +void SetDebugMode(bool b); + +/** Sets/unsets the beamline mode (at the moment it doesn't do anything) + * @param b bool TRUE sets, FALSE unsets + */ +void SetBeamlineMode(bool b); + +/** Sets/unsets the expert mode i.e. enables/disables the advanced and Settings tabs + * @param b bool TRUE sets, FALSE unsets + */ +void SetExpertMode(bool b); + +/** Sets/unsets the dockable plot mode + * @param b bool TRUE sets, FALSE unsets + */ +void SetDockableMode(bool b); + +/** Refreshes the tab each time the tab is changed. Also displays the next enabled tab */ +void refresh(int index); + +/** Opens Setup */ +void OpenSetup(); + +/** Saves Setup */ +void SaveSetup(); + +/** Measurement Wizard */ +void MeasurementWizard(); + +/** Open Configuration*/ +void OpenConfiguration(); + +/** Save Configuration */ +void SaveConfiguration(); + +/** Executing Energy Calibration */ +void EnergyCalibration(); + +/** Executing Angular Calibration */ +void AngularCalibration(); + +/** Executing Version */ +void Version(); + +/** Executing About */ +void About(); + + +signals: + +}; + +#endif /* QDETECTORMAIN_H */ diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h new file mode 100644 index 000000000..8401e2e1f --- /dev/null +++ b/slsDetectorGui/include/qDrawPlot.h @@ -0,0 +1,225 @@ +/* + * qDrawPlot.h + * + * Created on: May 7, 2012 + * Author: Ian Johnson + */ +#ifndef QDRAWPLOT_H +#define QDRAWPLOT_H + +/** Form Header */ +#include "ui_form_drawplot.h" +/** Project Class Headers */ +class slsDetectorUtils; +/** Qt Project Class Headers */ +class SlsQtH1D; +class SlsQt1DPlot; +class SlsQt2DPlotLayout; +class qCloneWidget; +/** Qt Include Headers */ +class QTimer; +class QGridLayout; + +/** + *@short Sets up the plot widget + */ +class qDrawPlot:public QWidget, private Ui::DrawPlotObject{ + Q_OBJECT + +public: + /** \short The constructor + */ + qDrawPlot(QWidget *parent,slsDetectorUtils*& detector); + + /** Destructor + */ + ~qDrawPlot(); + + /** Starts or stop acquisition + * Calls startDaq() function + * @param stop_if_running is 0 to stop acquisition and 1 to start acquisition + */ + void StartStopDaqToggle(bool stop_if_running=0); + +public slots: +/** To select 1D or 2D plot + * @param i is 1 for 1D, else 2D plot + */ +void SelectPlot(int i=2); + +/** To select 1D plot + */ +void Select1DPlot() {SelectPlot(1);} + +/** To select 2D plot + */ +void Select2DPlot() {SelectPlot(2);} + +/** To clear plot + */ +void Clear1DPlot(); + +/** Creates a clone of the plot + * */ +void ClonePlot(); + +/** Closes all the clone plots + * */ +void CloseClones(); + + +private: + /** The sls detector object */ + slsDetectorUtils *myDet; + /** Number of Exposures */ + int number_of_exposures; + /** Duration between Exposures */ + double framePeriod; + /** Acquisition Time */ + double acquisitionTime; + +/** Widgets needed to plot the clone */ + static const int MAXCloneWindows = 50; + /** */ + qCloneWidget *winClone[MAXCloneWindows]; + /** */ + QTimer* plot_update_timer; + /** */ + SlsQt1DPlot* plot1D; + /** */ + SlsQt2DPlotLayout* plot2D; + /** */ + QVector plot1D_hists; + + +/**variables for threads */ + /** */ + volatile bool stop_signal; + /** */ + pthread_mutex_t last_image_complete_mutex; + +/**variables for histograms */ + /** */ + unsigned int plot_in_scope; + /** */ + unsigned int lastImageNumber; + /** */ + std::string imageTitle; + /** */ + std::string imageXAxisTitle; + /** */ + std::string imageYAxisTitle; + /** */ + std::string imageZAxisTitle; + /** */ + unsigned int nPixelsX; + /** */ + unsigned int nPixelsY; + /** */ + double* lastImageArray; + /** */ + unsigned int nHists; + /** */ + std::string histTitle[10]; + /** */ + std::string histXAxisTitle; + /** */ + std::string histYAxisTitle; + /** */ + int histNBins; + /** */ + double* histXAxis; + /** */ + double* histYAxis[10]; + + + /** */ + int LockLastImageArray() {return pthread_mutex_lock(&last_image_complete_mutex); } + /** */ + int UnlockLastImageArray() {return pthread_mutex_unlock(&last_image_complete_mutex);} + /** */ + SlsQt1DPlot* Get1DPlotPtr() {return plot1D;} + /** */ + SlsQt2DPlotLayout* Get2DPlotPtr() {return plot2D;} + /** */ + int StartDaqForGui() {return StartOrStopThread(1) ? 1:0;} + /** */ + int StopDaqForGui() {return StartOrStopThread(0) ? 0:1;} + /** */ + unsigned int PlotInScope() {return plot_in_scope;} + /** */ + unsigned int GetLastImageNumber() {return lastImageNumber;} + /** */ + const char* GetImageTitle() {return imageTitle.c_str();} + /** */ + const char* GetImageXAxisTitle() {return imageXAxisTitle.c_str();} + /** */ + const char* GetImageYAxisTitle() {return imageYAxisTitle.c_str();} + /** */ + const char* GetImageZAxisTitle() {return imageZAxisTitle.c_str();} + /** */ + unsigned int GetNPixelsX() {return nPixelsX;} + /** */ + unsigned int GetNPixelsY() {return nPixelsY;} + /** */ + double* GetLastImageArray() {return lastImageArray;} + /** */ + unsigned int GetNHists() {return nHists;} + /** */ + const char* GetHistTitle(int i) {return (i>=0&&i<10) ? histTitle[i].c_str():0;} //int for hist number + /** */ + const char* GetHistXAxisTitle() {return histXAxisTitle.c_str();} + /** */ + const char* GetHistYAxisTitle() {return histYAxisTitle.c_str();} + /** */ + unsigned int GetHistNBins() {return histNBins;} + /** */ + double* GetHistXAxis() {return histXAxis;} + /** */ + double* GetHistYAxis(int i) {return (i>=0&&i<10) ? histYAxis[i]:0;} //int for hist number + + /** Initializes all its members and the thread */ + void Initialization(); + + /** Sets up the widget */ + void SetupWidgetWindow(); + + /** */ + int ResetDaqForGui(); + + /**acquisition thread stuff */ + /** */ + bool StartOrStopThread(bool start); + /** */ + static void* DataAcquisionThread(void *this_pointer); + /** */ + void* AcquireImages(); + + +private slots: +/** To update plot + */ +void UpdatePlot(); + +/** To stop updating plot + */ +void StopUpdatePlot(); + +/** To start or stop acquisition + * @param start is 1 to start and 0 to stop acquisition + */ +void StartDaq(bool start); + +void CloneCloseEvent(int id); +signals: + +void UpdatingPlotFinished(); +void InterpolateSignal(bool); +void ContourSignal(bool); +void LogzSignal(bool); + +}; + + + +#endif /* QDRAWPLOT_H */ diff --git a/slsDetectorGui/include/qTabActions.h b/slsDetectorGui/include/qTabActions.h new file mode 100644 index 000000000..5f9408c1d --- /dev/null +++ b/slsDetectorGui/include/qTabActions.h @@ -0,0 +1,52 @@ +/* + * qTabActions.h + * + * Created on: May 10, 2012 + * Author: l_maliakal_d + */ + +#ifndef QTABACTIONS_H_ +#define QTABACTIONS_H_ + +/** Form Header */ +#include "ui_form_tab_actions.h" +/** Project Class Headers */ +class slsDetectorUtils; + +/** + *@short sets up the acions parameters + */ +class qTabActions:public QWidget, private Ui::TabActionsObject{ + Q_OBJECT + +public: + /** \short The constructor + * @param parent is the parent tab widget + * @param detector is the detector returned from the detector tab + */ + qTabActions(QWidget *parent,slsDetectorUtils*& detector); + + /** Destructor + */ + ~qTabActions(); + + +private: + /** The sls detector object */ + slsDetectorUtils *myDet; + + /** Sets up the widget + */ + void SetupWidgetWindow(); + + /** Sets up all the slots and signals + */ + void Initialization(); + + /** Enables/Disables all the widgets + */ + void Enable(bool enable); + +}; + +#endif /* QTABACTIONS_H_ */ diff --git a/slsDetectorGui/include/qTabAdvanced.h b/slsDetectorGui/include/qTabAdvanced.h new file mode 100644 index 000000000..86cf27e8c --- /dev/null +++ b/slsDetectorGui/include/qTabAdvanced.h @@ -0,0 +1,62 @@ +/* + * qTabAdvanced.h + * + * Created on: May 10, 2012 + * Author: l_maliakal_d + */ + +#ifndef QTABADVANCED_H_ +#define QTABADVANCED_H_ + +/** Form Header */ +#include "ui_form_tab_advanced.h" +/** Project Class Headers */ +class slsDetectorUtils; + +/** + *@short sets up the advanced parameters + */ +class qTabAdvanced:public QWidget, private Ui::TabAdvancedObject{ + Q_OBJECT + +public: + /** \short The constructor + * @param parent is the parent tab widget + * @param detector is the detector returned from the detector tab + */ + qTabAdvanced(QWidget *parent,slsDetectorUtils*& detector); + + /** Destructor + */ + ~qTabAdvanced(); + + +private: + /** The sls detector object */ + slsDetectorUtils *myDet; + + /** The sls detector object type*/ + int myDetType; + + /** Sets up the widget + */ + void SetupWidgetWindow(); + + /** Sets up all the slots and signals + */ + void Initialization(); + + /** Enables/Disables all the widgets + */ + void Enable(bool enable); + +private slots: +/** Get Temperature data + */ +void getTemperature(); + +}; + + + +#endif /* QTABADVANCED_H_ */ diff --git a/slsDetectorGui/include/qTabDataOutput.h b/slsDetectorGui/include/qTabDataOutput.h new file mode 100644 index 000000000..9d3183a72 --- /dev/null +++ b/slsDetectorGui/include/qTabDataOutput.h @@ -0,0 +1,54 @@ +/* + * qTabDataOutput.h + * + * Created on: May 10, 2012 + * Author: l_maliakal_d + */ + +#ifndef QTABDATAOUTPUT_H_ +#define QTABDATAOUTPUT_H_ + +/** Form Header */ +#include "ui_form_tab_dataoutput.h" +/** Project Class Headers */ +class slsDetectorUtils; + +/** + *@short sets up the DataOutput parameters + */ +class qTabDataOutput:public QWidget, private Ui::TabDataOutputObject{ + Q_OBJECT + +public: + /** \short The constructor + * @param parent is the parent tab widget + * @param detector is the detector returned from the detector tab + */ + qTabDataOutput(QWidget *parent,slsDetectorUtils*& detector); + + /** Destructor + */ + ~qTabDataOutput(); + + +private: + /** The sls detector object */ + slsDetectorUtils *myDet; + + /** Sets up the widget + */ + void SetupWidgetWindow(); + + /** Sets up all the slots and signals + */ + void Initialization(); + + /** Enables/Disables all the widgets + */ + void Enable(bool enable); + +}; + + + +#endif /* QTABDATAOUTPUT_H_ */ diff --git a/slsDetectorGui/include/qTabDebugging.h b/slsDetectorGui/include/qTabDebugging.h new file mode 100644 index 000000000..a51e84c7d --- /dev/null +++ b/slsDetectorGui/include/qTabDebugging.h @@ -0,0 +1,54 @@ +/* + * qTabDebugging.h + * + * Created on: May 10, 2012 + * Author: l_maliakal_d + */ + +#ifndef QTABDEBUGGING_H_ +#define QTABDEBUGGING_H_ + +/** Form Header */ +#include "ui_form_tab_debugging.h" +/** Project Class Headers */ +class slsDetectorUtils; + +/** + *@short sets up the Debugging parameters + */ +class qTabDebugging:public QWidget, private Ui::TabDebuggingObject{ + Q_OBJECT + +public: + /** \short The constructor + * @param parent is the parent tab widget + * @param detector is the detector returned from the detector tab + */ + qTabDebugging(QWidget *parent,slsDetectorUtils*& detector); + + /** Destructor + */ + ~qTabDebugging(); + + +private: + /** The sls detector object */ + slsDetectorUtils *myDet; + + /** Sets up the widget + */ + void SetupWidgetWindow(); + + /** Sets up all the slots and signals + */ + void Initialization(); + + /** Enables/Disables all the widgets + */ + void Enable(bool enable); + +}; + + + +#endif /* QTABDEBUGGING_H_ */ diff --git a/slsDetectorGui/include/qTabDeveloper.h b/slsDetectorGui/include/qTabDeveloper.h new file mode 100644 index 000000000..9f82f7512 --- /dev/null +++ b/slsDetectorGui/include/qTabDeveloper.h @@ -0,0 +1,54 @@ +/* + * qTabDeveloper.h + * + * Created on: May 10, 2012 + * Author: l_maliakal_d + */ + +#ifndef QTABDEVELOPER_H_ +#define QTABDEVELOPER_H_ + +/** Form Header */ +#include "ui_form_tab_developer.h" +/** Project Class Headers */ +class slsDetectorUtils; + +/** + *@short sets up the Developer parameters + */ +class qTabDeveloper:public QWidget, private Ui::TabDeveloperObject{ + Q_OBJECT + +public: + /** \short The constructor + * @param parent is the parent tab widget + * @param detector is the detector returned from the detector tab + */ + qTabDeveloper(QWidget *parent,slsDetectorUtils*& detector); + + /** Destructor + */ + ~qTabDeveloper(); + + +private: + /** The sls detector object */ + slsDetectorUtils *myDet; + + /** Sets up the widget + */ + void SetupWidgetWindow(); + + /** Sets up all the slots and signals + */ + void Initialization(); + + /** Enables/Disables all the widgets + */ + void Enable(bool enable); + +}; + + + +#endif /* QTABDEVELOPER_H_ */ diff --git a/slsDetectorGui/include/qTabMeasurement.h b/slsDetectorGui/include/qTabMeasurement.h new file mode 100644 index 000000000..e4df24797 --- /dev/null +++ b/slsDetectorGui/include/qTabMeasurement.h @@ -0,0 +1,108 @@ +/* + * qTabMeasurement.h + * + * Created on: May 2, 2012 + * Author: l_maliakal_d + */ +#ifndef QTABMEASUREMENT +#define QTABMEASUREMENT + +/** Form Header */ +#include "ui_form_tab_measurement.h" +/** Project Class Headers */ +class slsDetectorUtils; +/** Qt Project Class Headers */ +class qDrawPlot; + +/** + *@short sets up the measurement parameters + */ +class qTabMeasurement:public QWidget, private Ui::TabMeasurementObject{ + Q_OBJECT + +public: + /** \short The constructor + * This tab allows to change the detector settings, the threshold, the number of (non real time) measurements, + * the acquisition time, the file name, the start run index and shows the current progress of the measurement + * via a progress bar and labels inidicating the current position, scan variable, frame number etc. + * Contains the start and stop acquisition button + * @param parent is the parent tab widget + * @param detector is the detector returned from the detector tab + * @param plot plot object reference + */ + qTabMeasurement(QWidget *parent,slsDetectorUtils*& detector, qDrawPlot*& plot); + + /** Destructor + */ + ~qTabMeasurement(); + + +private: + /** The sls detector object */ + slsDetectorUtils *myDet; + + /** The Plot widget */ + qDrawPlot *myPlot; + + +/** methods */ + /** Sets up the widget + */ + void SetupWidgetWindow(); + + /** Sets up all the slots and signals + */ + void Initialization(); + + /** Enables/Disables all the widgets + */ + void Enable(bool enable); + + +public slots: +/** update plot is finished, + * changes start/stop text and enables/disables all widgets + */ +void UpdateFinished(); + + +private slots: +/** Set settings according to selection + * @param index index of selection + */ +void setSettings(int index); +/** Set number of frames + * @param val number of frames to be set + */ +void setNumFrames(int val); + +/** Set acquisition time + */ +void setAcquisitionTime(); + +/** Set frame period between exposures + */ +void setFramePeriod(); + +/** Set file name + * @param fName name of file + */ +void setFileName(const QString& fName); + +/** Set index of file name + * @param index index of selection + */ +void setRunIndex(int index); + +/** starts/stops Acquisition + */ +void startStopAcquisition(); + +signals: + + +}; + + + +#endif /* QTABMEASUREMENT */ diff --git a/slsDetectorGui/include/qTabPlot.h b/slsDetectorGui/include/qTabPlot.h new file mode 100644 index 000000000..e5b2bedb9 --- /dev/null +++ b/slsDetectorGui/include/qTabPlot.h @@ -0,0 +1,74 @@ +/* + * qTabPlot.h + * + * Created on: May 10, 2012 + * Author: l_maliakal_d + */ + +#ifndef QTABPLOT_H_ +#define QTABPLOT_H_ + +/** Form Header */ +#include "ui_form_tab_plot.h" +/** Project Class Headers */ +class slsDetectorUtils; +/** Qt Project Class Headers */ +class qDrawPlot; + +/** + *@short sets up the Plot parameters + */ +class qTabPlot:public QWidget, private Ui::TabPlotObject{ + Q_OBJECT + +public: + /** \short The constructor + * @param parent is the parent tab widget + * @param detector is the detector returned from the detector tab + * @param plot plot object reference + */ + qTabPlot(QWidget *parent,slsDetectorUtils*& detector, qDrawPlot*& plot); + + /** Destructor + */ + ~qTabPlot(); + + +private: + /** The sls detector object */ + slsDetectorUtils *myDet; + + /** The Plot widget */ + qDrawPlot *myPlot; + + +/** methods */ + /** Sets up the widget + */ + void SetupWidgetWindow(); + + /** Sets up all the slots and signals + */ + void Initialization(); + + /** Enables/Disables all the widgets + */ + void Enable(bool enable); + + + +public slots: + + + + + +private slots: +signals: + + +}; + + + +#endif /* QTABPLOT_H_ */ diff --git a/slsDetectorGui/include/qTabSettings.h b/slsDetectorGui/include/qTabSettings.h new file mode 100644 index 000000000..3424d0129 --- /dev/null +++ b/slsDetectorGui/include/qTabSettings.h @@ -0,0 +1,54 @@ +/* + * qTabSettings.h + * + * Created on: May 10, 2012 + * Author: l_maliakal_d + */ + +#ifndef QTABSETTINGS_H_ +#define QTABSETTINGS_H_ + +/** Form Header */ +#include "ui_form_tab_settings.h" +/** Project Class Headers */ +class slsDetectorUtils; + +/** + *@short sets up the Settings parameters + */ +class qTabSettings:public QWidget, private Ui::TabSettingsObject{ + Q_OBJECT + +public: + /** \short The constructor + * @param parent is the parent tab widget + * @param detector is the detector returned from the detector tab + */ + qTabSettings(QWidget *parent,slsDetectorUtils*& detector); + + /** Destructor + */ + ~qTabSettings(); + + +private: + /** The sls detector object */ + slsDetectorUtils *myDet; + + /** Sets up the widget + */ + void SetupWidgetWindow(); + + /** Sets up all the slots and signals + */ + void Initialization(); + + /** Enables/Disables all the widgets + */ + void Enable(bool enable); + +}; + + + +#endif /* QTABSETTINGS_H_ */ diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro new file mode 100644 index 000000000..a10917037 --- /dev/null +++ b/slsDetectorGui/slsDetectorGui.pro @@ -0,0 +1,92 @@ +DESTDIR = bin +MOC_DIR = mocs +OBJECTS_DIR = objs +UI_HEADERS_DIR = forms/include + +DEFINES += VERBOSE + +target.path += $(DESTDIR) +documentation.path = /$(DOCPATH) +documentation.files = docs/* +INSTALLS += target +INSTALLS += documentation +QMAKE_CLEAN += docs/*/* \ + $(DESTDIR)* \ + forms/include/* + + +LIBS += -Wl,-Bstatic -L../slsDetectorSoftware -lSlsDetector -Wl,-Bdynamic\ + -L/usr/local/qwt-5.2.3-svn/lib -lqwt + +DEPENDPATH += \ + slsDetectorPlotting/include\ + include\ + forms/include + + +INCLUDEPATH += \ + /usr/local/qwt-5.2.3-svn/include\ + slsDetectorPlotting/include\ + include\ + forms/include\ + ../slsDetectorSoftware/commonFiles\ + ../slsDetectorSoftware/MySocketTCP\ + ../slsDetectorSoftware/slsDetector\ + ../slsDetectorSoftware/slsDetectorAnalysis\ + ../slsDetectorSoftware/multiSlsDetector\ + ../slsDetectorSoftware/usersFunctions + +SOURCES = \ + slsDetectorPlotting/src/SlsQt1DPlot.cxx\ + slsDetectorPlotting/src/SlsQt1DZoomer.cxx\ + slsDetectorPlotting/src/SlsQt2DHist.cxx\ + slsDetectorPlotting/src/SlsQt2DPlot.cxx\ + slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx\ + slsDetectorPlotting/src/SlsQtNumberEntry.cxx\ + src/qDetectorMain.cpp\ + src/qDrawPlot.cpp\ + src/qCloneWidget.cpp\ + src/qTabMeasurement.cpp\ + src/qTabDataOutput.cpp\ + src/qTabPlot.cpp\ + src/qTabActions.cpp\ + src/qTabAdvanced.cpp\ + src/qTabSettings.cpp\ + src/qTabDebugging.cpp\ + src/qTabDeveloper.cpp + +HEADERS = \ + slsDetectorPlotting/include/SlsQt1DPlot.h\ + slsDetectorPlotting/include/SlsQt1DZoomer.h\ + slsDetectorPlotting/include/SlsQt2DHist.h\ + slsDetectorPlotting/include/SlsQt2DPlot.h\ + slsDetectorPlotting/include/SlsQt2DPlotLayout.h\ + slsDetectorPlotting/include/SlsQt2DZoomer.h\ + slsDetectorPlotting/include/SlsQtValidators.h\ + slsDetectorPlotting/include/SlsQtNumberEntry.h\ + include/qDefs.h\ + include/qDetectorMain.h\ + include/qDrawPlot.h\ + include/qCloneWidget.h\ + include/qTabMeasurement.h\ + include/qTabDataOutput.h\ + include/qTabPlot.h\ + include/qTabActions.h\ + include/qTabAdvanced.h\ + include/qTabSettings.h\ + include/qTabDebugging.h\ + include/qTabDeveloper.h\ + ../slsDetectorSoftware/commonFiles/sls_detector_defs.h + + +FORMS = \ + forms/form_detectormain.ui\ + forms/form_drawplot.ui\ + forms/form_tab_measurement.ui\ + forms/form_tab_dataoutput.ui\ + forms/form_tab_plot.ui\ + forms/form_tab_actions.ui\ + forms/form_tab_advanced.ui\ + forms/form_tab_settings.ui\ + forms/form_tab_debugging.ui\ + forms/form_tab_developer.ui diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h new file mode 100644 index 000000000..43dc7781c --- /dev/null +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h @@ -0,0 +1,145 @@ + +/** + * @author Ian Johnson + * @version 1.0 + */ + +#ifndef SLSQT1DPLOT_H +#define SLSQT1DPLOT_H + +#include +#include +#include + +#include "SlsQt1DZoomer.h" + +class QPen; +class SlsQt1DPlot; + +class SlsQtH1D:public QwtPlotCurve{ + + public: + SlsQtH1D(QString title, int n, double xmin, double xmax, double* data=0); + SlsQtH1D(QString title, int n, double* data_x, double* data_y); + ~SlsQtH1D(); + + void Attach(SlsQt1DPlot* p); + void Detach(SlsQt1DPlot* p); + + int SetLineColor(int c=-1); + int SetLineWidth(int w=1); + void SetLineStyle(int s=0); + + void SetData(int n, double xmin, double xmax, double* d=0); + void SetData(int n, double* dx, double* dy); + + double* GetX() {return x;} + double* GetY() {return y;} + int GetNBinsX() {return ndata;} + + double FillBin(int bx, double v=1); + double Fill(double x, double v=1); + double SetBinContent(int bx,double v); + double SetContent(double x,double v); + int FindBinIndex(double px); + + double GetXMin() {return x[0];} + double GetFirstXgtZero() {return firstXgt0;} + double GetXMax() {return x[ndata-1];} + double GetYMin() {return ymin;} + double GetFirstYgtZero() {return firstYgt0;} + double GetYMax() {return ymax;} + + SlsQtH1D* Add(double v); + + + private: + int ndata; + int n_array; + double dx; + double *x,*y; + double ymin,ymax; + double firstXgt0,firstYgt0; + + void Initailize(); + int SetUpArrays(int n); + int CheckIndex(int bx); + + QPen* pen_ptr; +}; + + +class SlsQtH1DList{ + public: + SlsQtH1DList(SlsQtH1D* hist=0); + ~SlsQtH1DList(); + + SlsQtH1D* Add(SlsQtH1D* h); + void Remove(SlsQtH1D* h); + void Print(); + + SlsQtH1D* Hist() {return the_hist;} //if no hist returns 0 + SlsQtH1DList* Next() {return the_next;} + + +private: + SlsQtH1DList* the_next; + SlsQtH1D* the_hist; +}; + + +class SlsQt1DPlot:public QwtPlot{ + Q_OBJECT + + public: + SlsQt1DPlot(QWidget* = NULL); + ~SlsQt1DPlot(); + + void SetTitle(const char *t); + void SetXTitle(const char* title); + void SetYTitle(const char* title); + + void InsertHLine(double y); + void RemoveHLine(); + void InsertVLine(double v); + void RemoveVLine(); + + void SetZoom(double xmin,double ymin,double x_width,double y_width); + void SetZoomBase(double xmin,double ymin,double x_width, double y_width){ zoomer->SetZoomBase(xmin,ymin,x_width,y_width);} + + + private: + + SlsQtH1DList* hist_list; + SlsQt1DZoomer* zoomer; + QwtPlotPanner* panner; + + QwtPlotMarker *hline; + QwtPlotMarker *vline; + + void SetupZoom(); + void UnknownStuff(); + void alignScales(); + + void CalculateNResetZoomBase(); + void NewHistogramAttached(SlsQtH1D* h); + void HistogramDetached(SlsQtH1D* h); + + void SetLog(int axisId, bool yes); + + friend void SlsQtH1D::Attach(SlsQt1DPlot* p); + friend void SlsQtH1D::Detach(SlsQt1DPlot* p); + + + public slots: + void UnZoom(); + void Update(); + + void SetLogX(bool yes=1); + void SetLogY(bool yes=1); + + protected: + +}; + +#endif diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DZoomer.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DZoomer.h new file mode 100644 index 000000000..94afd2707 --- /dev/null +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DZoomer.h @@ -0,0 +1,59 @@ + +/** + * @author Ian Johnson + * @version 1.0 + */ + +#ifndef SLSQT1DZOOMER_H +#define SLSQT1DZOOMER_H + + +#include +#include +class SlsQtH1D; + +class SlsQt1DZoomer:public QwtPlotZoomer{ + private: + double x0,x1,y0,y1; + double firstXgt0,firstYgt0; + bool xIsLog,yIsLog; + + public: + SlsQt1DZoomer(QwtPlotCanvas *canvas):QwtPlotZoomer(canvas){ + setTrackerMode(AlwaysOn); + xIsLog=yIsLog=0; + } + + double x() {return x0;} + double x_firstGreaterThan0() {return firstXgt0;} + double w() {return x1-x0;} + + double y() {return y0;} + double y_firstGreaterThan0() {return firstYgt0;} + double h() {return y1-y0;} + + void SetZoomBase(double xmin,double ymin,double x_width, double y_width); + void SetZoomBase(SlsQtH1D* h); + void ExtendZoomBase(SlsQtH1D* h); + void ResetZoomBase(); + + bool IsLogX(){ return xIsLog;} + bool IsLogY(){ return yIsLog;} + bool SetLogX(bool yes) { return xIsLog=yes;} + bool SetLogY(bool yes) { return yIsLog=yes;} + + virtual QwtText trackerText(const QwtDoublePoint &pos) const{ + QColor bg(Qt::white); +#if QT_VERSION >= 0x040300 + bg.setAlpha(200); +#endif + + QwtText text = QwtPlotZoomer::trackerText(pos); + + text.setBackgroundBrush( QBrush( bg )); + return text; + } + +}; + +#endif diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DHist.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DHist.h new file mode 100644 index 000000000..b3d93a001 --- /dev/null +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DHist.h @@ -0,0 +1,113 @@ + +/** + * @author Ian Johnson + * @version 1.0 + */ + + +#ifndef SLSQT2DHIST_H +#define SLSQT2DHIST_H + + + +#if QT_VERSION >= 0x040000 +#include +#endif +#include +#include +#include +#include + + +class SlsQt2DHist: public QwtRasterData{ + + private: + + double x_min,x_max,y_min,y_max; + double x_width,y_width; + + int nx,ny,nb; + double *data; + double z_min,z_mean,z_max; + bool z_mean_has_been_calculated; + + int nx_array,ny_array; + + bool interp; + + static double value_between_points(double p1,double v1,double p2,double v2,double p){ //linear extrap + return (v2-v1)/(p2-p1)*(p-p1)+v1; + } + + public: + SlsQt2DHist(int nbinsx=10, double xmin=0, double xmax=10, int nbinsy=10, double ymin=0, double ymax=10, double* d=0,double zmin=0,double zmax=-1); + virtual ~SlsQt2DHist(); + + double GetXMin() {return x_min;} + double GetXMax() {return x_max;} + double GetXBinWidth() {return x_width;} + double GetYMin() {return y_min;} + double GetYMax() {return y_max;} + double GetYBinWidth() {return y_width;} + double GetMinimum() {return z_min;} + double GetMaximum() {return z_max;} + double GetMean(); + + int GetNBinsX(){return nx;} + int GetNBinsY(){return ny;} + double GetBinValue(int bx,int by); + int GetBinIndex(int bx,int by); + double* GetDataPtr(){return data;} + + void Interpolate(bool on=1) {interp=on;} + void SetBinValue(int bx,int by,double v); + void SetData(int nbinsx, double xmin, double xmax, int nbinsy,double ymin, double ymax,double *d,double zmin=0, double zmax=-1); + + double SetMinimumToFirstGreaterThanZero(); + void SetMinimum(double zmin) {z_min=zmin;} + void SetMaximum(double zmax) {z_max=zmax;} + void SetMinMax(double zmin=0,double zmax=-1); + + int FindBinIndex(double x, double y); + + + + virtual QwtRasterData *copy() const{ + //this function does not create a new SlsQt2DHistData instance, + //just passes a pointer so that data is common to both the copy and the original instance + return (QwtRasterData*) this; + } + virtual QwtDoubleInterval range() const{ return QwtDoubleInterval(z_min,z_max);} + + virtual double value(double x, double y) const{ + //if(!interp){ //default is box like plot + int index = int((x-x_min)/x_width) + int((y-y_min)/y_width)*nx; + if(index<0||index>nb) index = nb; + if(!interp) return data[index]; + //} + + + int x_int = int((x-x_min)/x_width-0.5); + if(x_int<0) x_int = 0; else if(x_int>nx-2) x_int = nx-2; + int y_int = int((y-y_min)/y_width-0.5); + if(y_int<0) y_int = 0; else if(y_int>ny-2) y_int = ny-2; + + int b00 = x_int*ny + y_int; + int b01 = x_int*ny + y_int+1; + int b10 = (x_int+1)*ny + y_int; + int b11 = (x_int+1)*ny + y_int+1; + + //vertical extrap + double y0 = y_min+(y_int+0.5)*y_width; + double y1 = y_min+(y_int+1.5)*y_width; + double left_v = value_between_points(y0,data[b00],y1,data[b01],y); + double right_v = value_between_points(y0,data[b10],y1,data[b11],y); + //horazontal extrap + return value_between_points(x_min+(x_int+0.5)*x_width,left_v, + x_min+(x_int+1.5)*x_width,right_v,x); + } + +}; + + +#endif diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h new file mode 100644 index 000000000..cc6db7ea3 --- /dev/null +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h @@ -0,0 +1,79 @@ + +/** + * @author Ian Johnson + * @version 1.0 + */ + + +#ifndef SLSQT2DPLOT_H +#define SLSQT2DPLOT_H + + +#include +#include + +#include "SlsQt2DZoomer.h" +#include "SlsQt2DHist.h" + + +class QwtPlotPanner; +class QwtScaleWidget; +class QwtLinearColorMap; + + +class SlsQt2DPlot: public QwtPlot{ + Q_OBJECT + +private: + QwtPlotSpectrogram *d_spectrogram; + SlsQt2DHist* hist; + SlsQt2DZoomer* zoomer; + QwtPlotPanner* panner; + QwtScaleWidget *rightAxis; + + QwtLinearColorMap* colorMapLinearScale; + QwtLinearColorMap* colorMapLogScale; + QwtValueList* contourLevelsLinear; + QwtValueList* contourLevelsLog; + + void SetupZoom(); + void SetupColorMap(); + +public: + SlsQt2DPlot(QWidget * = NULL); + + // SlsQt2DHist *GetHistogram(){ return hist; } + + void UnZoom(); + void SetZoom(double xmin,double ymin,double x_width,double y_width); + + double GetZMinimum(){ return hist->GetMinimum();} + double GetZMaximum(){ return hist->GetMaximum();} + void SetZMinMax(double zmin=0,double zmax=-1); + void SetZMinimumToFirstGreaterThanZero(){hist->SetMinimumToFirstGreaterThanZero();} + double GetZMean() { return hist->GetMean();} + + void SetData(int nbinsx, double xmin, double xmax, int nbinsy,double ymin, double ymax,double *d,double zmin=0, double zmax=-1){ + hist->SetData(nbinsx,xmin,xmax,nbinsy,ymin,ymax,d,zmin,zmax); + } + + double* GetDataPtr() {return hist->GetDataPtr();} + int GetBinIndex(int bx,int by) {return hist->GetBinIndex(bx,by);} + int FindBinIndex(double x,double y) {return hist->FindBinIndex(x,y);} + void SetBinValue(int bx,int by,double v) {hist->SetBinValue(bx,by,v);} + double GetBinValue(int bx,int by) {return hist->GetBinValue(bx,by);} + + + void FillTestPlot(int i=0); + void Update(); + +public slots: + void LogZ(bool on=1); + void InterpolatedPlot(bool on); + void showContour(bool on); + void showSpectrogram(bool on); + // void printPlot(); + +}; + +#endif diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlotLayout.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlotLayout.h new file mode 100644 index 000000000..2f11bd8c3 --- /dev/null +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlotLayout.h @@ -0,0 +1,112 @@ + +/** + * @author Ian Johnson + * @version 1.0 + */ +/* + + +#ifndef SLSQT2DPLOTLAYOUT_H +#define SLSQT2DPLOTLAYOUT_H + +#include +#include +#include + +#include "SlsQtNumberEntry.h" +#include "SlsQt2DPlot.h" + +//class QGridLayout; +//class QToolbar; + + + +class SlsQt2DPlotLayout: public QGroupBox{ + Q_OBJECT + +public: + + SlsQt2DPlotLayout(QWidget * = NULL); + ~SlsQt2DPlotLayout(); + + SlsQt2DPlot* GetPlot() {return the_plot;} + void SetXTitle(QString st); + void SetYTitle(QString st); + void SetZTitle(QString st); + + void UpdateNKeepSetRangeIfSet(); + +private: + //QGridLayout* the_layout; + SlsQt2DPlot* the_plot; + //SlsQtNumberEntry* z_range_ne; + + void ConnectSignalsAndSlots(); + + public slots: + void SetZScaleToLog(bool yes); + void ResetRange(); +}; + +#endif +*/ + + + +/** + * @author Ian Johnson + * @version 1.0 + */ + + +#ifndef SLSQT2DPLOTLAYOUT_H +#define SLSQT2DPLOTLAYOUT_H + +#include +#include + +#include "SlsQtNumberEntry.h" +#include "SlsQt2DPlot.h" + +class QGridLayout; + + + +class SlsQt2DPlotLayout: public QGroupBox{ + Q_OBJECT + +public: + + SlsQt2DPlotLayout(QWidget * = NULL); + ~SlsQt2DPlotLayout(); + + SlsQt2DPlot* GetPlot() {return the_plot;} + void SetXTitle(QString st); + void SetYTitle(QString st); + void SetZTitle(QString st); + + void UpdateNKeepSetRangeIfSet(); + +private: + QGridLayout* the_layout; + SlsQt2DPlot* the_plot; + + SlsQtNumberEntry* z_range_ne; + + bool logsChecked; + + void ConnectSignalsAndSlots(); + + void Layout(); + +public slots: +void SetZScaleToLog(bool yes); +void ResetRange(); + +signals: +void InterpolateSignal(bool); +void ContourSignal(bool); +}; + +#endif + diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DZoomer.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DZoomer.h new file mode 100644 index 000000000..0b665660b --- /dev/null +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DZoomer.h @@ -0,0 +1,51 @@ + +/** + * @author Ian Johnson + * @version 1.0 + */ + + +#ifndef SLSQT2DZOOMER_H +#define SLSQT2DZOOMER_H + + +#include +#include + +#include "SlsQt2DHist.h" + +class SlsQt2DZoomer:public QwtPlotZoomer{ + private: + SlsQt2DHist* hist; + + public: + SlsQt2DZoomer(QwtPlotCanvas *canvas):QwtPlotZoomer(canvas){ + setTrackerMode(AlwaysOn); + } + + void SetHist(SlsQt2DHist* h){ + hist=h; + } + + virtual QwtText trackerText(const QwtDoublePoint &pos) const{ + QColor bg(Qt::white); +#if QT_VERSION >= 0x040300 + bg.setAlpha(200); +#endif + + + //QwtText text = QwtPlotZoomer::trackerText(pos); + + static QwtText text; + if(hist){ + static char t[200]; + sprintf(t,"%3.2f, %3.2f, %3.2f",pos.x(),pos.y(),hist->value(pos.x(),pos.y())); + text.setText(t); + }else text = QwtPlotZoomer::trackerText(pos); + + text.setBackgroundBrush( QBrush( bg )); + return text; + } +}; + +#endif diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQtNumberEntry.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQtNumberEntry.h new file mode 100644 index 000000000..1bcd9e937 --- /dev/null +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQtNumberEntry.h @@ -0,0 +1,140 @@ + +/** + * @author Ian Johnson + * @version 1.0 + */ + +#ifndef SLSQTNUMBERENTRY_H +#define SLSQTNUMBERENTRY_H + +#include +#include + +class QGridLayout; + +class QLabel; +class QLineEdit; +class QIntValidator; +class QDoubleValidator; +class QCheckBox; +class QComboBox; +class QSpinBox; + +#include "SlsQtValidators.h" + +class SlsQtNumberEntry:public QWidget{ + Q_OBJECT + + public: + //type=0->units only, type=1->int,type=2->double, type=3->spinbox + //adding middle text will automatically add a second number field + SlsQtNumberEntry(QWidget *parent,int with_checkbox=0, char *start_string=0, int num_type=0, char *middle_string=0, int num2_type=0, int n_units=0, char** units=0, double* unit_factors=0, char* end_string=0); + //without unit box + SlsQtNumberEntry(QWidget *parent,int with_checkbox, char *start_strin, int num_type, char *middle_string, int num2_type, char* end_string); + + + ~SlsQtNumberEntry(); + + void Enable(bool en_flag=1); + void Disable(); + void EnableNumberField(int which_number_field,bool en_flag=1); //which_number_field is 0 or 1 + void DisableNumberField(int which_number_field); + + void AddCheckBox(); + void SetFrontText(char* s); + void SetMiddleText(char* s); + void SetBackText(char* s); + void SetupNumberField(int type,int which_number_field=0); + void SetUnits(int n_units,char** units,double* unit_factors); + + void SetMinimumNumberWidth(int nchar_width,int which_number_field=0); + void SetNDecimalsOfDoubleValidators(int ndecimals); + void SetNDecimalsOfDoubleValidator(int ndecimals,int which_number_field=0); + void SetMinimumUnitWidth(int nchar_width); + + bool Enabled(); + bool CheckBoxState(); + bool IsValueOk(int which_number_field=0); + + const char* GetFrontText(); + const char* GetMiddleText(); + const char* GetBackText(); + + int GetNumberInt(int which_number_field=0,bool* ok=0); + double GetNumber(int which_number_field=0,bool *ok=0); + + int GetValueInt(int which_number_field=0,bool* ok=0); + double GetValue(int which_number_field=0,bool *ok=0); + + int GetComboBoxIndex(); + double GetComboBoxValue(); + + private: + void SetupNumberEntry(int with_checkbox=0, char *start_string=0, int num_type=0, char *middle_string=0, int num2_type=0, int n_units=0, char** units=0, double* unit_factors=0, char* end_string=0); + + QGridLayout* layout; //default layout + + QCheckBox* check_box; + QLabel* front_text; + QLabel* middle_text; + QLineEdit* num_field[2]; + QSpinBox* spin_box[2]; + bool num_field_enabled[2]; + + SlsQtIntValidator* validator_int[2]; + SlsQtDoubleValidator* validator_double[2]; + QComboBox* unit_cbb; + double* factors; + QLabel* back_text; + + void SetText(char* s, QLabel** pp); + void SetLayout(); + + + public slots: + void FirstValueEntered(); + void SecondValueEntered(); + void UnitSelected(); + + void SetRange(int min, int max, int which_number_field=0); + void SetRange(double min, double max, int which_number_field=0); + void SetFirstRange(int min, int max) {SetRange(min,max,0);} + void SetSecondRange(int min, int max) {SetRange(min,max,1);} + + double SetValue(double v, int which_number_field=0); + void SetFirstValue(int v) {SetValue(v,0);} + void SetSecondValue(int v) {SetValue(v,1);} + void SetFirstValue(double v) {SetValue(v,0);} + void SetSecondValue(double v) {SetValue(v,1);} + + // double SetNumber(int v, int which_number_field=0); + double SetNumber(double v, int which_number_field=0); + void SetFirstNumber(int v) {SetNumber(v,0);} + void SetSecondNumber(int v) {SetNumber(v,1);} + void SetFirstNumber(double v) {SetNumber(v,0);} + void SetSecondNumber(double v) {SetNumber(v,1);} + + int SetComboBoxIndex(int index); + + void CheckBoxClicked(); + void PrintTheValue(); + + void RefreshFirstNumberEntry(); + void RefreshSecondNumberEntry(); + void RefreshNumberEntery(int number_field=0); + + signals: + void CheckBoxChanged(bool state); + void CheckBoxChanged(SlsQtNumberEntry* ptr); + void AValueChanged(SlsQtNumberEntry* ptr); + void FirstValueChanged(int value); + void FirstValueChanged(double value); + void FirstValueChanged(SlsQtNumberEntry* ptr); + void SecondValueChanged(int value); + void SecondValueChanged(double value); + void SecondValueChanged(SlsQtNumberEntry* ptr); + void UnitChanged(double); + void UnitChanged(SlsQtNumberEntry* ptr); +}; + +#endif diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQtValidators.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQtValidators.h new file mode 100644 index 000000000..197b162a2 --- /dev/null +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQtValidators.h @@ -0,0 +1,73 @@ + +/** + * @author Ian Johnson + * @version 1.0 + */ + +#ifndef SLSQTVALIDATORS_H +#define SLSQTVALIDATORS_H + +#include +#include + +#include +#include + +using std::cout; +using std::endl; + +class SlsQtIntValidator:public QIntValidator{ + + public: + SlsQtIntValidator(QWidget *parent):QIntValidator(parent){} + + virtual void fixup (QString& text) const { + bool ok = 1; + int v = text.toInt(&ok); + + if(!ok){ + v = text.toDouble(&ok); + if(ok) text = QString::number(v); + else text = QString::number(0); + fixup(text); + } + + if(vtop()) text = QString::number(top()); + } + +}; + +class SlsQtDoubleValidator:public QDoubleValidator{ + + public: + SlsQtDoubleValidator(QWidget *parent):QDoubleValidator(parent){} + + virtual void fixup (QString& text) const { + + bool ok = 1; + double v = text.toDouble(&ok); + + if(!ok){ + text = QString::number(0); + fixup(text); + } + + int nd = this->decimals(); //ndigest behind zero + if(vtop()){ + v = floor(top()*pow(10,nd))/pow(10,nd); + text = QString::number(v,'g'); + }else{ + v = round(v*pow(10,nd))/pow(10,nd); + text = QString::number(v,'g'); + } + } + } + +}; + +#endif diff --git a/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cxx b/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cxx new file mode 100644 index 000000000..d4c355c88 --- /dev/null +++ b/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cxx @@ -0,0 +1,440 @@ + +/** + * @author Ian Johnson + * @version 1.0 + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "SlsQt1DPlot.h" + +using namespace std; + +SlsQtH1D::SlsQtH1D(QString title,int n, double min, double max, double* data):QwtPlotCurve(title){ + Initailize(); + SetData(n,min,max,data); +} + +SlsQtH1D::SlsQtH1D(QString title,int n, double* data_x, double* data_y):QwtPlotCurve(title){ + Initailize(); + SetData(n,data_x,data_y); +} + +void SlsQtH1D::Initailize(){ + ndata=n_array=0; + x=y=0; + pen_ptr = new QPen(); + SetLineColor(); +} + +SlsQtH1D::~SlsQtH1D(){delete x;delete y;delete pen_ptr;} + +void SlsQtH1D::Attach(SlsQt1DPlot* p){ + attach((QwtPlot*) p); + p->NewHistogramAttached(this); +} + +void SlsQtH1D::Detach(SlsQt1DPlot* p){ + detach(); + p->HistogramDetached(this); +} + + +int SlsQtH1D::SetLineColor(int c){ + static int last_color = 1; + if(c<0) c=(last_color+1)%3; + + if(c==0) pen_ptr->setColor(Qt::black); + else if(c==1) pen_ptr->setColor(Qt::red); + else pen_ptr->setColor(Qt::blue); + + setPen(*pen_ptr); + + return last_color=c; +} + +int SlsQtH1D::SetLineWidth(int w){ + pen_ptr->setWidth(w); + setPen(*pen_ptr); + return w; +} + +void SlsQtH1D::SetLineStyle(int s){ + if(s==1) pen_ptr->setStyle(Qt::DashLine); + else if(s==2) pen_ptr->setStyle(Qt::DotLine); + else if(s==3) pen_ptr->setStyle(Qt::DashDotLine); + else if(s==4) pen_ptr->setStyle(Qt::DashDotDotLine); + else if(s==5) pen_ptr->setStyle(Qt::CustomDashLine); + else pen_ptr->setStyle(Qt::SolidLine); + setPen(*pen_ptr); +} + + +void SlsQtH1D::SetData(int n, double xmin, double xmax, double *data){ + n = SetUpArrays(n); + + ndata=n; + if(xmin>xmax){ + double t=xmin; + xmin=xmax; + xmax=t; + } + + dx = (xmax-xmin)/n; + ymin=ymax= data ? data[0]:0; + firstXgt0=-1; + firstYgt0=-1; + + for(int i=0;iy[i]) ymin = y[i]; + if(data&&ymax0&&(firstXgt0<0||firstXgt0>x[i])) firstXgt0=x[i]; + if(y[i]>0&&(firstYgt0<0||firstYgt0>y[i])) firstYgt0=y[i]; + } + + // cout<0&&data_x[0]>data_x[n-1]) ? 1:0; + n = SetUpArrays(n); + + ndata=n; + dx=-1; //signifies not regular intervals + + ymin=ymax= data_y ? data_y[0]:0; + + firstXgt0=-1; + firstYgt0=-1; + + for(int i=0;iy[b]) ymin = y[b]; + if(data_y&&ymax0&&(firstXgt0<0||firstXgt0>x[b])) firstXgt0=x[b]; + if(y[b]>0&&(firstYgt0<0||firstYgt0>y[b])) firstYgt0=y[b]; + } + + setRawData(x,y,ndata); +} + +int SlsQtH1D::SetUpArrays(int n){ + n = n<1 ? 1 : n; //overflow bin + + if(n+1>n_array){ + n_array = n+1; + if(x) delete x; + if(y) delete y; + x = new double [n_array]; + y = new double [n_array]; + } + + return n; +} + +double SlsQtH1D::FillBin(int bx, double v) { + bx = CheckIndex(bx); + return SetBinContent(bx,y[bx]+v); +} +double SlsQtH1D::Fill(double x, double v){return FillBin(FindBinIndex(x),v);} + +double SlsQtH1D::SetBinContent(int bx,double v){ + bx = CheckIndex(bx); + y[bx]=v; + if(bx0&&(firstYgt0<=0||y[bx]ymax) ymax = y[bx]; + } + return y[bx]; +} + +double SlsQtH1D::SetContent(double x,double v) {return SetBinContent(FindBinIndex(x),v); } + +int SlsQtH1D::FindBinIndex(double px){ + if(dx>0) CheckIndex(int((px-x[0])/dx)); + + //find closest bin + int b=0; for(;bpx) break; + + if(b==0) return 0; + else if(fabs(px-x[b-1])ndata) ? ndata : bx;}//ndata is the overflow bin + +SlsQtH1D* SlsQtH1D::Add(double v){ for(int bx=0;bxthe_hist) return hist; //already added + if(!hl->the_next) break; + hl=hl->the_next; + } + if(hl->the_hist) hl->the_next = new SlsQtH1DList(hist); + else hl->the_hist = hist; + + // Print(); + + return hist; +} + +void SlsQtH1DList::Print(){ + // cout<<"Printing List"<the_hist<<" "<the_next<the_next; + if(i>10) break; + } +} + +void SlsQtH1DList::Remove(SlsQtH1D* hist){ + // cout<<"Removing: "<the_hist!=hist) hl = hl->the_next; + else{ //match + if(!hl->the_next) hl->the_hist=0; // first the_hist is zero when there's no next + else{ + SlsQtH1DList* t = hl->the_next; + hl->the_hist = t->the_hist; + hl->the_next = t->the_next; + t->the_next = 0; + delete t; + } + } + } + // Print(); +} + + + +//1d plot stuff +SlsQt1DPlot::SlsQt1DPlot(QWidget *parent):QwtPlot(parent){ + // n_histograms_attached=0; + hline=vline=0; + hist_list = new SlsQtH1DList(); + + UnknownStuff(); + alignScales(); + SetupZoom(); + + // Assign a title + insertLegend(new QwtLegend(), QwtPlot::RightLegend); + + axisScaleEngine(QwtPlot::yLeft)->setAttribute(QwtScaleEngine::Floating); + axisScaleEngine(QwtPlot::xBottom)->setAttribute(QwtScaleEngine::Floating); +} + +SlsQt1DPlot::~SlsQt1DPlot(){ + delete hist_list; + + if(hline) delete hline; + if(vline) delete vline; +} + +void SlsQt1DPlot::CalculateNResetZoomBase(){ + if(hist_list->Hist()) zoomer->SetZoomBase(hist_list->Hist()); + SlsQtH1DList* hl = hist_list->Next(); + while(hl){ + if(hl->Hist()) zoomer->ExtendZoomBase(hl->Hist()); + hl=hl->Next(); + } +} + +void SlsQt1DPlot::NewHistogramAttached(SlsQtH1D* h){ + hist_list->Add(h); + CalculateNResetZoomBase(); + if(!hist_list->Next()) UnZoom(); + Update(); +} + +void SlsQt1DPlot::HistogramDetached(SlsQtH1D* h){ + hist_list->Remove(h); + CalculateNResetZoomBase(); + Update(); +} + +void SlsQt1DPlot::Update(){ + replot(); +} + +void SlsQt1DPlot::SetTitle(const char* title){ + setTitle(title); +} + +void SlsQt1DPlot::SetXTitle(const char* title){ + setAxisTitle(QwtPlot::xBottom,title); +} +void SlsQt1DPlot::SetYTitle(const char* title){ + setAxisTitle(QwtPlot::yLeft,title); +} + +void SlsQt1DPlot::SetLogX(bool yes){ SetLog(QwtPlot::xBottom,yes);} +void SlsQt1DPlot::SetLogY(bool yes){ SetLog(QwtPlot::yLeft,yes);} +void SlsQt1DPlot::SetLog(int axisId, bool yes){ + if(axisId==QwtPlot::xBottom) zoomer->SetLogX(yes); + if(axisId==QwtPlot::yLeft) zoomer->SetLogY(yes); + + zoomer->ResetZoomBase(); //needs to be done before setting Engine + + //the old ones are deleted by in the setAxisScaleFunction() function see: 128 of file qwt_plot_axis.cpp + if(yes) setAxisScaleEngine(axisId,new QwtLog10ScaleEngine()); + else setAxisScaleEngine(axisId,new QwtLinearScaleEngine()); + + axisScaleEngine(QwtPlot::yLeft)->setAttribute(QwtScaleEngine::Floating); + axisScaleEngine(QwtPlot::xBottom)->setAttribute(QwtScaleEngine::Floating); + + Update(); +} + +void SlsQt1DPlot::UnZoom(){ + setAxisScale(QwtPlot::xBottom,zoomer->x(),zoomer->x()+zoomer->w()); + setAxisScale(QwtPlot::yLeft,zoomer->y(),zoomer->y()+zoomer->h()); + + zoomer->setZoomBase();//Call replot for the attached plot before initializing the zoomer with its scales. + Update(); +} + +void SlsQt1DPlot::SetZoom(double xmin,double ymin,double x_width,double y_width){ + setAxisScale(QwtPlot::xBottom,xmin,xmin+x_width); + setAxisScale(QwtPlot::yLeft ,ymin,ymin+y_width); + Update(); +} + +void SlsQt1DPlot::RemoveHLine(){ + if(hline) hline->detach(); + delete hline; + hline=0; +} + +void SlsQt1DPlot::InsertHLine(double y){ + if(!hline){ + hline = new QwtPlotMarker(); + hline->setLabelAlignment(Qt::AlignRight|Qt::AlignTop); + hline->setLineStyle(QwtPlotMarker::HLine); + hline->attach(this); + } + hline->setYValue(y); +} + +void SlsQt1DPlot::RemoveVLine(){ + if(vline) vline->detach(); + delete vline; + vline=0; +} + +void SlsQt1DPlot::InsertVLine(double x){ + if(!vline){ + vline = new QwtPlotMarker(); + vline->setLabelAlignment(Qt::AlignRight|Qt::AlignTop); + vline->setLineStyle(QwtPlotMarker::VLine); + vline->attach(this); + } + vline->setXValue(x); +} + + + + +void SlsQt1DPlot::SetupZoom(){ + // LeftButton for the zooming + // MidButton for the panning + // RightButton: zoom out by 1 + // Ctrl+RighButton: zoom out to full size + + zoomer = new SlsQt1DZoomer(canvas()); + +#if QT_VERSION < 0x040000 + zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt::RightButton, Qt::ControlButton); +#else + zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt::RightButton, Qt::ControlModifier); +#endif + zoomer->setMousePattern(QwtEventPattern::MouseSelect3,Qt::RightButton); + + panner = new QwtPlotPanner(canvas()); + panner->setAxisEnabled(QwtPlot::yRight, false); + panner->setMouseButton(Qt::MidButton); + + // Avoid jumping when labels with more/less digits + // appear/disappear when scrolling vertically + + const QFontMetrics fm(axisWidget(QwtPlot::yLeft)->font()); + QwtScaleDraw *sd = axisScaleDraw(QwtPlot::yLeft); + sd->setMinimumExtent( fm.width("100.00") ); + + const QColor c(Qt::darkBlue); + zoomer->setRubberBandPen(c); + zoomer->setTrackerPen(c); +} + + +// Set a plain canvas frame and align the scales to it +void SlsQt1DPlot::alignScales(){ + // The code below shows how to align the scales to + // the canvas frame, but is also a good example demonstrating + // why the spreaded API needs polishing. + + canvas()->setFrameStyle(QFrame::Box | QFrame::Plain ); + canvas()->setLineWidth(1); + + for(int i = 0; i < QwtPlot::axisCnt; i++ ){ + QwtScaleWidget *scaleWidget = (QwtScaleWidget *)axisWidget(i); + if(scaleWidget) scaleWidget->setMargin(0); + QwtScaleDraw *scaleDraw = (QwtScaleDraw *)axisScaleDraw(i); + if(scaleDraw) scaleDraw->enableComponent(QwtAbstractScaleDraw::Backbone, false); + } +} + +void SlsQt1DPlot::UnknownStuff(){ + // Disable polygon clipping + QwtPainter::setDeviceClipping(false); + // We don't need the cache here + canvas()->setPaintAttribute(QwtPlotCanvas::PaintCached, false); + canvas()->setPaintAttribute(QwtPlotCanvas::PaintPacked, false); + +#if QT_VERSION >= 0x040000 +#ifdef Q_WS_X11 + // Qt::WA_PaintOnScreen is only supported for X11, but leads + // to substantial bugs with Qt 4.2.x/Windows + canvas()->setAttribute(Qt::WA_PaintOnScreen, true); +#endif +#endif +} + diff --git a/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DZoomer.cxx b/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DZoomer.cxx new file mode 100644 index 000000000..942bd13c4 --- /dev/null +++ b/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DZoomer.cxx @@ -0,0 +1,99 @@ + +/** + * @author Ian Johnson + * @version 1.0 + */ + + +#include + +#include +#include + +#include "SlsQt1DPlot.h" +#include "SlsQt1DZoomer.h" + +using namespace std; + +void SlsQt1DZoomer::ResetZoomBase(){ + SetZoomBase(x0,y0,x1-x0,y1-y0); //for going between log and nonlog plots +} + +void SlsQt1DZoomer::SetZoomBase(double xmin,double ymin,double x_width, double y_width){ + if(xIsLog&&xmin<=0){ + double xmax = xmin+x_width; + xmin = firstXgt0*0.98; + if(xmax<=xmin) x_width=firstXgt0; + else x_width=xmax-xmin; + } + if(yIsLog&&ymin<=0){ + double ymax = ymin+y_width; + ymin = firstYgt0*0.98; + if(ymax<=ymin) y_width=firstYgt0; + else y_width=ymax-ymin; + } + + if(plot()){ + if(xIsLog){ + #if QWT_VERSION < 0x50200 + float xmin_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->lBound(); + float xmax_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->hBound(); + #else + float xmin_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->lowerBound(); + float xmax_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->upperBound(); + #endif + if(xmin_currxmin+x_width) xmax_curr=xmin+x_width; + plot()->setAxisScale(QwtPlot::xBottom,xmin_curr,xmax_curr); + } + if(yIsLog){ + #if QWT_VERSION < 0x50200 + float ymin_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->lBound(); + float ymax_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->hBound(); + #else + float ymin_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->lowerBound(); + float ymax_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->upperBound(); + #endif + if(ymin_currymin+y_width) ymax_curr=ymin+y_width; + plot()->setAxisScale(QwtPlot::yLeft,ymin_curr,ymax_curr); + } + plot()->replot(); + } + + setZoomBase(QwtDoubleRect(xmin,ymin,x_width,y_width)); +} + +void SlsQt1DZoomer::SetZoomBase(SlsQtH1D* h){ + x0 = h->GetXMin()<0 ? h->GetXMin()*1.02 : h->GetXMin()/1.02; + x1 = h->GetXMax()<0 ? h->GetXMax()/1.02 : h->GetXMax()*1.02; + y0 = h->GetYMin()<0 ? h->GetYMin()*1.02 : h->GetYMin()/1.02; + y1 = h->GetYMax()<0 ? h->GetYMax()/1.02 : h->GetYMax()*1.02; + + firstXgt0 = h->GetFirstXgtZero(); //for log plots + firstYgt0 = h->GetFirstYgtZero(); //for log plots + + ResetZoomBase(); +} + +void SlsQt1DZoomer::ExtendZoomBase(SlsQtH1D* h){ + double h_x0 = h->GetXMin()<0 ? h->GetXMin()*1.02 : h->GetXMin()/1.02; + double h_x1 = h->GetXMax()<0 ? h->GetXMax()/1.02 : h->GetXMax()*1.02; + double h_y0 = h->GetYMin()<0 ? h->GetYMin()*1.02 : h->GetYMin()/1.02; + double h_y1 = h->GetYMax()<0 ? h->GetYMax()/1.02 : h->GetYMax()*1.02; + + if(h_x0x1) x1 = h_x1; + if(h_y0y1) y1 = h_y1; + + if(h->GetFirstXgtZero()GetFirstXgtZero(); + if(h->GetFirstYgtZero()GetFirstYgtZero(); + + // cout<<"extend "< + +#include "SlsQt2DHist.h" + +using std::cout; +using std::endl; + +SlsQt2DHist::SlsQt2DHist(int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, double* d,double zmin,double zmax):QwtRasterData(){ + interp=0; + nx_array=ny_array=0;data=0; + SetData(nbinsx,xmin,xmax,nbinsy,ymin,ymax,d,zmin,zmax); +} + + +SlsQt2DHist::~SlsQt2DHist(){if(data) delete data;} + +int SlsQt2DHist::GetBinIndex(int bx, int by){ + int b = bx*ny+by; + if(b<0 || b>=nb){ + cout<<"GetBinIndex:: Incorrect indicies bx and by returning overflow bin;"<nx_array*ny_array){ + if(data) delete data; + data = new double [nbinsx*nbinsy+1]; //one for under/overflow bin + nx_array = nbinsx; + ny_array = nbinsy; + } + nx=nbinsx; + ny=nbinsy; + nb=nx*ny; + data[nb]=0;//set over flow to zero + + if(d){ + memcpy(data,d,nb*sizeof(double)); + SetMinMax(zmin,zmax); + } +} + +void SlsQt2DHist::SetMinMax(double zmin,double zmax){ + if(zminz_max) z_max=data[i]; + z_mean+=data[i]; + } + z_mean/=nb; + if(z_min>0) z_min/=1.02; else z_min*=1.02; + if(z_max>0) z_max*=1.02; else z_max/=1.02; + } +} + +double SlsQt2DHist::GetMean(){ + if(!z_mean_has_been_calculated){ + z_mean_has_been_calculated = 1; + z_mean=0; + for(int i=0;i0&&data[i] +#include +#include + +#if QT_VERSION >= 0x040000 +#include +#endif +#include +#include +#include +#include +#include +#include +#include +#include + +#include "SlsQt2DPlot.h" + +using namespace std; + +SlsQt2DPlot::SlsQt2DPlot(QWidget *parent):QwtPlot(parent){ + + axisScaleEngine(QwtPlot::yLeft)->setAttribute(QwtScaleEngine::Floating); + axisScaleEngine(QwtPlot::xBottom)->setAttribute(QwtScaleEngine::Floating); + + d_spectrogram = new QwtPlotSpectrogram(); + + hist = new SlsQt2DHist(); + + SetupZoom(); + SetupColorMap(); + + d_spectrogram->setData(*hist); + d_spectrogram->attach(this); + + plotLayout()->setAlignCanvasToScales(true); + + FillTestPlot(); + Update(); + +} + + +void SlsQt2DPlot::SetupColorMap(){ + + colorMapLinearScale = new QwtLinearColorMap(Qt::darkCyan, Qt::red); + colorMapLinearScale->addColorStop(0.1, Qt::cyan); + colorMapLinearScale->addColorStop(0.4, Qt::blue); + colorMapLinearScale->addColorStop(0.6, Qt::green); + colorMapLinearScale->addColorStop(0.95, Qt::yellow); + d_spectrogram->setColorMap(*colorMapLinearScale); + + + colorMapLogScale = new QwtLinearColorMap(Qt::darkCyan, Qt::red); + colorMapLogScale->addColorStop((pow(10,2*0.10)-1)/99.0, Qt::cyan); //linear scale goes from 0 to 2 and log scale goes from 1 to 100 + colorMapLogScale->addColorStop((pow(10,2*0.40)-1)/99.0,Qt::blue); + colorMapLogScale->addColorStop((pow(10,2*0.60)-1)/99.0,Qt::green); + colorMapLogScale->addColorStop((pow(10,2*0.95)-1)/99.0,Qt::yellow); + + contourLevelsLinear = new QwtValueList(); + for(double level=0.5;level<10.0;level+=1.0 ) (*contourLevelsLinear) += level; + d_spectrogram->setContourLevels(*contourLevelsLinear); + contourLevelsLog = new QwtValueList(); + for(double level=0.5;level<10.0;level+=1.0 ) (*contourLevelsLog) += (pow(10,2*level/10.0)-1)/99.0 * 10; + + + // A color bar on the right axis + rightAxis = axisWidget(QwtPlot::yRight); + rightAxis->setTitle("Intensity"); + rightAxis->setColorBarEnabled(true); + enableAxis(QwtPlot::yRight); +} + +void SlsQt2DPlot::FillTestPlot(int mode){ + static int nx = 50; + static int ny = 50; + static double *the_data=0; + if(the_data==0) the_data = new double [nx*ny]; + + double dmax = sqrt(pow(nx/2.0-0.5,2) + pow(ny/2.0-0.5,2)); + for(int i=0;iSetData(nx,200,822,ny,-0.5,ny-0.5,the_data); +} + +void SlsQt2DPlot::SetupZoom(){ + // LeftButton for the zooming + // MidButton for the panning + // RightButton: zoom out by 1 + // Ctrl+RighButton: zoom out to full size + + zoomer = new SlsQt2DZoomer(canvas()); + zoomer->SetHist(hist); + +#if QT_VERSION < 0x040000 + zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt::RightButton, Qt::ControlButton); +#else + zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt::RightButton, Qt::ControlModifier); +#endif + zoomer->setMousePattern(QwtEventPattern::MouseSelect3,Qt::RightButton); + + panner = new QwtPlotPanner(canvas()); + panner->setAxisEnabled(QwtPlot::yRight, false); + panner->setMouseButton(Qt::MidButton); + + // Avoid jumping when labels with more/less digits + // appear/disappear when scrolling vertically + + const QFontMetrics fm(axisWidget(QwtPlot::yLeft)->font()); + QwtScaleDraw *sd = axisScaleDraw(QwtPlot::yLeft); + sd->setMinimumExtent( fm.width("100.00") ); + + const QColor c(Qt::darkBlue); + zoomer->setRubberBandPen(c); + zoomer->setTrackerPen(c); +} + +void SlsQt2DPlot::UnZoom(){ + + zoomer->setZoomBase(QwtDoubleRect(hist->GetXMin(),hist->GetYMin(),hist->GetXMax()-hist->GetXMin(),hist->GetYMax()-hist->GetYMin())); + + zoomer->setZoomBase();//Call replot for the attached plot before initializing the zoomer with its scales. + // zoomer->zoom(0); +} + +void SlsQt2DPlot::SetZoom(double xmin,double ymin,double x_width,double y_width){ + zoomer->setZoomBase(QwtDoubleRect(xmin,ymin,x_width,y_width)); +} + +void SlsQt2DPlot::SetZMinMax(double zmin,double zmax){ + hist->SetMinMax(zmin,zmax); +} + + +void SlsQt2DPlot::Update(){ + rightAxis->setColorMap(d_spectrogram->data().range(),d_spectrogram->colorMap()); + if(!zoomer->zoomRectIndex()) UnZoom(); + setAxisScale(QwtPlot::yRight,d_spectrogram->data().range().minValue(), + d_spectrogram->data().range().maxValue()); + replot(); +} + + + +void SlsQt2DPlot::showContour(bool on){ + d_spectrogram->setDisplayMode(QwtPlotSpectrogram::ContourMode,on); + Update(); +} + +void SlsQt2DPlot::showSpectrogram(bool on){ + // static int io=0; + // FillTestPlot(io++); + d_spectrogram->setDisplayMode(QwtPlotSpectrogram::ImageMode, on); + d_spectrogram->setDefaultContourPen(on ? QPen() : QPen(Qt::NoPen)); + Update(); +} + +void SlsQt2DPlot::InterpolatedPlot(bool on){ + hist->Interpolate(on); + Update(); +} + + +void SlsQt2DPlot::LogZ(bool on){ + if(on){ + //if(hist->GetMinimum()<=0) hist->SetMinimumToFirstGreaterThanZero(); + d_spectrogram->setColorMap(*colorMapLogScale); + setAxisScaleEngine(QwtPlot::yRight,new QwtLog10ScaleEngine); + d_spectrogram->setContourLevels(*contourLevelsLog); + }else{ + d_spectrogram->setColorMap(*colorMapLinearScale); + setAxisScaleEngine(QwtPlot::yRight,new QwtLinearScaleEngine); + d_spectrogram->setContourLevels(*contourLevelsLinear); + } + Update(); + +} + + + +/* +void SlsQt2DPlot::printPlot(){ + QPrinter printer; + printer.setOrientation(QPrinter::Landscape); +#if QT_VERSION < 0x040000 + printer.setColorMode(QPrinter::Color); + printer.setOutputFileName("spectrogram.ps"); + if (printer.setup()) +#else + printer.setOutputFileName("spectrogram.pdf"); + QPrintDialog dialog(&printer); + if ( dialog.exec() ) +#endif + { + print(printer); + } +} + +*/ diff --git a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx new file mode 100644 index 000000000..5205ae8e9 --- /dev/null +++ b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx @@ -0,0 +1,212 @@ +/** + * @author Ian Johnson + * @version 1.0 + */ +/* + + +#include + +#include +//#include +//#include + + +#include "SlsQt2DPlotLayout.h" + +using namespace std; + +SlsQt2DPlotLayout::SlsQt2DPlotLayout(QWidget *parent):QGroupBox(parent){ + //the_layout=0; + the_plot = new SlsQt2DPlot(this); + + // z_range_ne = new SlsQtNumberEntry(this,1,"Set the z axis range from",2,"to",2); + // z_range_ne->setFixedWidth(402); + + ConnectSignalsAndSlots(); +} + +SlsQt2DPlotLayout::~SlsQt2DPlotLayout(){ + + //if(the_layout) delete the_layout; + delete the_plot; + // delete z_range_ne; +} + + +void SlsQt2DPlotLayout::ConnectSignalsAndSlots(){ + connect(btnInterpolate, SIGNAL(toggled(bool)),the_plot, SLOT(InterpolatedPlot(bool))); + connect(btnContour, SIGNAL(toggled(bool)),the_plot, SLOT(showContour(bool))); + connect(btnLogz, SIGNAL(toggled(bool)),this,SLOT(SetZScaleToLog(bool))); + + connect(z_range_ne,SIGNAL(CheckBoxChanged(bool)),this,SLOT(ResetRange())); + connect(z_range_ne,SIGNAL(AValueChanged(SlsQtNumberEntry*)),this,SLOT(ResetRange())); + + btnInterpolate->setChecked(false); + btnContour->setChecked(false); + btnLogz->setChecked(false); + +} +void SlsQt2DPlotLayout::UpdateNKeepSetRangeIfSet(){ + if(z_range_ne->CheckBoxState()){ + //just reset histogram range before update + the_plot->SetZMinMax(z_range_ne->GetValue(0),z_range_ne->GetValue(1)); + } + + the_plot->Update(); +} + + +void SlsQt2DPlotLayout::ResetRange(){ + //refind z limits + the_plot->SetZMinMax(); + if(btnLogz->isChecked()) the_plot->SetZMinimumToFirstGreaterThanZero(); + + if(z_range_ne->CheckBoxState()){ + //first time check validity + bool same = (z_range_ne->GetValue(0)==z_range_ne->GetValue(1)) ? 1:0; + if(!z_range_ne->IsValueOk(0)||same) z_range_ne->SetValue(the_plot->GetZMinimum(),0); + if(!z_range_ne->IsValueOk(1)||same) z_range_ne->SetValue(the_plot->GetZMaximum(),1); + + z_range_ne->SetRange(the_plot->GetZMinimum(),z_range_ne->GetValue(1),0); + z_range_ne->SetRange(z_range_ne->GetValue(0),the_plot->GetZMaximum(),1); + + //set histogram range + the_plot->SetZMinMax(z_range_ne->GetValue(0),z_range_ne->GetValue(1)); + } + + the_plot->Update(); +} + + + +void SlsQt2DPlotLayout::SetZScaleToLog(bool yes){ + the_plot->LogZ(yes); + ResetRange(); +} + +void SlsQt2DPlotLayout::SetXTitle(QString st){ + GetPlot()->axisWidget(QwtPlot::xBottom)->setTitle(st); +} + +void SlsQt2DPlotLayout::SetYTitle(QString st){ + GetPlot()->axisWidget(QwtPlot::yLeft)->setTitle(st); +} + +void SlsQt2DPlotLayout::SetZTitle(QString st){ + GetPlot()->axisWidget(QwtPlot::yRight)->setTitle(st); +} +*/ + + + +/** + * @author Ian Johnson + * @version 1.0 + */ + + +#include + + +#include +#include +#include + +#include "SlsQt2DPlotLayout.h" + +using namespace std; + +SlsQt2DPlotLayout::SlsQt2DPlotLayout(QWidget *parent):QGroupBox(parent){ + the_layout=0; + the_plot = new SlsQt2DPlot(this); + + z_range_ne = new SlsQtNumberEntry(this,1,"Set the z axis range from",2,"to",2); + // z_range_ne->SetNDecimalsOfDoubleValidators(2); + z_range_ne->setFixedWidth(402); + z_range_ne->hide(); + + logsChecked = false; + + Layout(); + ConnectSignalsAndSlots(); +} + +SlsQt2DPlotLayout::~SlsQt2DPlotLayout(){ + + if(the_layout) delete the_layout; + + + delete the_plot; + delete z_range_ne; +} + + +void SlsQt2DPlotLayout::Layout(){ + if(the_layout) delete the_layout; + the_layout = new QGridLayout(this); + the_layout->addWidget(the_plot,2,1,3,3); + the_layout->addWidget(z_range_ne,5,1,1,3); + + the_layout->setMargin(12); +} + +void SlsQt2DPlotLayout::ConnectSignalsAndSlots(){ + connect(this, SIGNAL(InterpolateSignal(bool)), the_plot, SLOT(InterpolatedPlot(bool))); + connect(this, SIGNAL(ContourSignal(bool)), the_plot, SLOT(showContour(bool))); + connect(z_range_ne, SIGNAL(CheckBoxChanged(bool)), this, SLOT(ResetRange())); + connect(z_range_ne, SIGNAL(AValueChanged(SlsQtNumberEntry*)), this, SLOT(ResetRange())); + +} + +void SlsQt2DPlotLayout::UpdateNKeepSetRangeIfSet(){ + if(z_range_ne->CheckBoxState()){ + //just reset histogram range before update + the_plot->SetZMinMax(z_range_ne->GetValue(0),z_range_ne->GetValue(1)); + } + + the_plot->Update(); +} + +void SlsQt2DPlotLayout::ResetRange(){ + //refind z limits + the_plot->SetZMinMax(); + if(logsChecked) the_plot->SetZMinimumToFirstGreaterThanZero(); + + if(z_range_ne->CheckBoxState()){ + //first time check validity + bool same = (z_range_ne->GetValue(0)==z_range_ne->GetValue(1)) ? 1:0; + if(!z_range_ne->IsValueOk(0)||same) z_range_ne->SetValue(the_plot->GetZMinimum(),0); + if(!z_range_ne->IsValueOk(1)||same) z_range_ne->SetValue(the_plot->GetZMaximum(),1); + + z_range_ne->SetRange(the_plot->GetZMinimum(),z_range_ne->GetValue(1),0); + z_range_ne->SetRange(z_range_ne->GetValue(0),the_plot->GetZMaximum(),1); + + //set histogram range + the_plot->SetZMinMax(z_range_ne->GetValue(0),z_range_ne->GetValue(1)); + } + + the_plot->Update(); +} + + + +void SlsQt2DPlotLayout::SetZScaleToLog(bool yes){ + logsChecked=yes; + the_plot->LogZ(yes); + ResetRange(); +} + + +void SlsQt2DPlotLayout::SetXTitle(QString st){ + GetPlot()->axisWidget(QwtPlot::xBottom)->setTitle(st); +} + +void SlsQt2DPlotLayout::SetYTitle(QString st){ + GetPlot()->axisWidget(QwtPlot::yLeft)->setTitle(st); +} + +void SlsQt2DPlotLayout::SetZTitle(QString st){ + GetPlot()->axisWidget(QwtPlot::yRight)->setTitle(st); +} + diff --git a/slsDetectorGui/slsDetectorPlotting/src/SlsQtNumberEntry.cxx b/slsDetectorGui/slsDetectorPlotting/src/SlsQtNumberEntry.cxx new file mode 100644 index 000000000..1779f8461 --- /dev/null +++ b/slsDetectorGui/slsDetectorPlotting/src/SlsQtNumberEntry.cxx @@ -0,0 +1,506 @@ + +/** + * @author Ian Johnson + * @version 1.0 + */ + + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#include "SlsQtNumberEntry.h" + +using namespace std; + +SlsQtNumberEntry::SlsQtNumberEntry(QWidget *parent, int with_checkbox, char *start_string, int num_type, char* middle_string, int num2_type, int n_units, char** units, double* unit_factors,char* end_string):QWidget(parent){ + SetupNumberEntry(with_checkbox,start_string,num_type,middle_string,num2_type,n_units,units,unit_factors,end_string); +} + +//without unit drop box +SlsQtNumberEntry::SlsQtNumberEntry(QWidget *parent,int with_checkbox, char *start_string, int num_type, char* middle_string, int num2_type,char* end_string):QWidget(parent){ + SetupNumberEntry(with_checkbox,start_string,num_type,middle_string,num2_type,0,0,0,end_string); +} + +void SlsQtNumberEntry::SetupNumberEntry(int with_checkbox, char *start_string, int num_type, char* middle_string, int num2_type, int n_units, char** units, double* unit_factors,char* end_string){ + + layout = 0; + + check_box = 0; + front_text = 0; + num_field[0] = 0; + spin_box[0] = 0; + validator_int[0] = 0; + validator_double[0] = 0; + middle_text = 0; + num_field[1] = 0; + spin_box[1] = 0; + validator_int[1] = 0; + validator_double[1] = 0; + unit_cbb = 0; + factors = 0; + back_text = 0; + if(with_checkbox) AddCheckBox(); + SetFrontText(start_string); + + SetupNumberField(num_type,0); + SetMiddleText(middle_string); + SetupNumberField(num2_type,1); + SetUnits(n_units,units,unit_factors); + SetBackText(end_string); + + SetLayout(); + +} + + +SlsQtNumberEntry::~SlsQtNumberEntry(){ + + if(check_box) delete check_box; + if(front_text) delete front_text; + if(middle_text) delete middle_text; + if(validator_int[0]) delete validator_int[0]; + if(validator_double[0]) delete validator_double[0]; + if(num_field[0]) delete num_field[0]; + if(spin_box[0]) delete spin_box[0]; + if(validator_int[1]) delete validator_int[1]; + if(validator_double[1]) delete validator_double[1]; + if(num_field[1]) delete num_field[1]; + if(spin_box[1]) delete spin_box[1]; + if(unit_cbb) delete unit_cbb; + if(factors) delete factors; + if(back_text) delete back_text; + +} + +void SlsQtNumberEntry::AddCheckBox(){ + if(check_box) delete check_box; + check_box = new QCheckBox(this); + connect(check_box,SIGNAL(clicked()),this,SLOT(CheckBoxClicked())); + SetLayout(); +} + +void SlsQtNumberEntry::SetFrontText(char* s) {SetText(s,&front_text); SetLayout();} +void SlsQtNumberEntry::SetMiddleText(char* s) {SetText(s,&middle_text); SetLayout();} +void SlsQtNumberEntry::SetBackText(char* s) {SetText(s,&back_text); SetLayout();}; +void SlsQtNumberEntry::SetText(char* s, QLabel** pp){ + if(*pp){delete *pp; *pp=0;} + if(s){ + *pp = new QLabel(this); + (*pp)->setText(s); + } + SetLayout(); +} + + +void SlsQtNumberEntry::SetupNumberField(int type, int which_number_field){ + int i = (which_number_field<0||which_number_field>1) ? 0:which_number_field; + + num_field_enabled[i]=1; + if(spin_box[i]) { delete spin_box[i]; spin_box[i]=0;} + if(validator_int[i]) { delete validator_int[i]; validator_int[i]=0;} + if(validator_double[i]) { delete validator_double[i]; validator_double[i]=0;} + if(num_field[i]) { delete num_field[i]; num_field[i]=0;} + + if(type>0&&type<3){ + num_field[i] = new QLineEdit(this); + num_field[i]->setAlignment(Qt::AlignRight); + SetMinimumNumberWidth(3,i); + if(type==1){ + validator_int[i] = new SlsQtIntValidator(num_field[i]); + num_field[i]->setValidator(validator_int[i]); + SetNumber(0,i); + }else{ + validator_double[i] = new SlsQtDoubleValidator(num_field[i]); + num_field[i]->setValidator(validator_double[i]); + //default settings + SetNDecimalsOfDoubleValidator(3,i); //defalut value + SetNumber(0,i); + } + + num_field[i]->setAlignment(Qt::AlignRight); + + if(i==0){ + connect(num_field[i],SIGNAL(lostFocus()),this,SLOT(RefreshFirstNumberEntry())); + connect(num_field[i],SIGNAL(returnPressed()),this,SLOT(FirstValueEntered())); + connect(num_field[i],SIGNAL(lostFocus()),this,SLOT(FirstValueEntered())); + }else{ + connect(num_field[i],SIGNAL(lostFocus()),this,SLOT(RefreshSecondNumberEntry())); + connect(num_field[i],SIGNAL(returnPressed()),this,SLOT(SecondValueEntered())); + connect(num_field[i],SIGNAL(lostFocus()),this,SLOT(SecondValueEntered())); + } + }else if(type==3){ + spin_box[i] = new QSpinBox(); + if(i==0) connect(spin_box[i],SIGNAL(editingFinished()),this,SLOT(FirstValueEntered())); + else connect(spin_box[i],SIGNAL(editingFinished()),this,SLOT(SecondValueEntered())); + spin_box[i]->setAlignment(Qt::AlignRight); + } + + SetLayout(); +} + +void SlsQtNumberEntry::SetUnits(int n_units, char** units, double* unit_factors){ + if(unit_cbb){ delete unit_cbb; unit_cbb=0;} + if(factors) { delete factors; factors=0;} + + if(n_units>0&&units&&unit_factors){ + unit_cbb = new QComboBox(this); + factors = new double [n_units]; + + for(int i=0;iinsertItem(i,units[i]); + factors[i] = unit_factors[i]; + } + + connect(unit_cbb,SIGNAL(activated(int)),this,SLOT(UnitSelected())); + } + + SetLayout(); +} + +void SlsQtNumberEntry::SetLayout(){ + if(layout) delete layout; + layout = new QGridLayout(this); + + int i = 0; + if(check_box) layout->addWidget(check_box,1,i++); + if(front_text) layout->addWidget(front_text,1,i++); + if(num_field[0]) layout->addWidget(num_field[0],1,i++); + if(spin_box[0]) layout->addWidget(spin_box[0],1,i++); + if(middle_text) layout->addWidget(middle_text,1,i++); + if(num_field[1]) layout->addWidget(num_field[1],1,i++); + if(spin_box[1]) layout->addWidget(spin_box[1],1,i++); + if(unit_cbb) layout->addWidget(unit_cbb,1,i++); + if(back_text) layout->addWidget(back_text,1,i++); + + CheckBoxClicked(); +} + + +void SlsQtNumberEntry::SetMinimumNumberWidth(int nchar_width,int which_number_field){ + if(num_field[which_number_field]) num_field[which_number_field] + ->setMinimumWidth(nchar_width*num_field[which_number_field]->minimumSizeHint().width()); + if(spin_box[which_number_field]) spin_box[which_number_field] + ->setMinimumWidth(nchar_width*spin_box[which_number_field]->minimumSizeHint().width()); +} + +void SlsQtNumberEntry::SetNDecimalsOfDoubleValidators(int ndecimals){ + SetNDecimalsOfDoubleValidator(ndecimals,0); + SetNDecimalsOfDoubleValidator(ndecimals,1); +} + +void SlsQtNumberEntry::SetNDecimalsOfDoubleValidator(int ndecimals, int which_number_field){ + //0 -> standard, 1->scientific + int i = (which_number_field<0||which_number_field>1) ? 0:which_number_field; + if(validator_double[i]){ + validator_double[i]->setDecimals(ndecimals); + SetNumber(GetNumber(i),i); + } +} + +void SlsQtNumberEntry::SetMinimumUnitWidth(int nchar_width){ + if(unit_cbb) unit_cbb->setMinimumWidth(nchar_width*unit_cbb->minimumSizeHint().width()); +} + + +/* +double SlsQtNumberEntry::SetNumber(int v,int which_number_field){ + int i = (which_number_field<0||which_number_field>1) ? 0:which_number_field; + + if(num_field[i]){ + if(validator_int[i]){ + QString s = QString::number(v); + validator_int[i]->fixup(s); + num_field[i]->setText(s); + } + if(validator_double[i]){ + QString s = QString::number(v); + validator_double[i]->fixup(s); + num_field[i]->setText(s); + } + }else if(spin_box[i]){ + spin_box[i]->setValue(v); + }else return 0; + + return GetNumber(i); +} +*/ + +double SlsQtNumberEntry::SetNumber(double v,int which_number_field){ + int i = (which_number_field<0||which_number_field>1) ? 0:which_number_field; + + if(num_field[i]){ + if(validator_int[i]){ + QString s = QString::number(v); + validator_int[i]->fixup(s); + num_field[i]->setText(s); + } + if(validator_double[i]){ + QString s = QString::number(v); + validator_double[i]->fixup(s); + num_field[i]->setText(s); + } + }else if(spin_box[i]){ + spin_box[i]->setValue(round(v)); + }else return 0; + + return GetNumber(i); +} + + +void SlsQtNumberEntry::SetRange(int min, int max,int which_number_field){ + int i = (which_number_field<0||which_number_field>1) ? 0:which_number_field; + if(min>max){ + cout<<"Waring: SetRange(int,int) no effect min > max"<setRange(min,max); + if(validator_double[i]) validator_double[i]->setRange(min,max,validator_double[i]->decimals()); + if(spin_box[i]) spin_box[i]->setRange(min,max); + SetNumber(GetNumber(i),i); + } +} + + +void SlsQtNumberEntry::SetRange(double min, double max,int which_number_field){ + int i = (which_number_field<0||which_number_field>1) ? 0:which_number_field; + if(min>max){ + cout<<"Waring: SetRange(double,double) no effect min >= max"<setRange(min,max,validator_double[i]->decimals()); + if(spin_box[i]) spin_box[i]->setRange(min,max); + SetNumber(GetNumber(i),i); + } + +} + +bool SlsQtNumberEntry::CheckBoxState(){ + if(check_box&&check_box->checkState()) return 1; + return 0; +} + +void SlsQtNumberEntry::CheckBoxClicked(){ + if(check_box){ + if(check_box->checkState()) Enable(); + else Disable(); + + emit CheckBoxChanged(check_box->checkState()); + emit CheckBoxChanged(this); + } + +} + +void SlsQtNumberEntry::Disable(){ Enable(0); } +void SlsQtNumberEntry::Enable(bool en_flag){ + if(check_box) check_box->setChecked(en_flag); + if(front_text) front_text->setEnabled(en_flag); + if(num_field[0]) num_field[0]->setEnabled(en_flag&&num_field_enabled[0]); + if(spin_box[0]) spin_box[0]->setEnabled(en_flag&&num_field_enabled[0]); + if(middle_text) middle_text->setEnabled(en_flag); + if(num_field[1]) num_field[1]->setEnabled(en_flag&&num_field_enabled[1]); + if(spin_box[1]) spin_box[1]->setEnabled(en_flag&&num_field_enabled[1]); + if(unit_cbb) unit_cbb->setEnabled(en_flag); + if(back_text) back_text->setEnabled(en_flag); +} + +void SlsQtNumberEntry::DisableNumberField(int which_number_field){ EnableNumberField(which_number_field,0); } +void SlsQtNumberEntry::EnableNumberField(int which_number_field,bool en_flag){ + if(which_number_field>=0||which_number_field<=1){ + num_field_enabled[which_number_field]=en_flag; + if(num_field[which_number_field]) num_field[which_number_field]->setEnabled(num_field_enabled[which_number_field]); + if(spin_box[which_number_field]) spin_box[which_number_field]->setEnabled(num_field_enabled[which_number_field]); + } +} + +void SlsQtNumberEntry::UnitSelected(){ + emit UnitChanged(GetComboBoxValue()); + emit UnitChanged(this); + emit AValueChanged(this); + emit FirstValueChanged(GetValueInt(0)); + emit FirstValueChanged(GetValue(0)); + emit FirstValueChanged(this); + emit SecondValueChanged(GetValueInt(1)); + emit SecondValueChanged(GetValue(1)); + emit SecondValueChanged(this); +} + +void SlsQtNumberEntry::RefreshFirstNumberEntry() { RefreshNumberEntery(0);} +void SlsQtNumberEntry::RefreshSecondNumberEntry() { RefreshNumberEntery(1);} +void SlsQtNumberEntry::RefreshNumberEntery(int which_number_field){ + //does not apply to spin boxes + if(num_field[which_number_field]){ + SetNumber(GetNumber(which_number_field),which_number_field); + } + //refreshes the entery in a general format for ints and fixes doubles, + //for example removes leading zeros + //However, also moves curser position +} + +void SlsQtNumberEntry::FirstValueEntered(){ + emit AValueChanged(this); + emit FirstValueChanged(GetValue(0)); + emit FirstValueChanged(GetValueInt(0)); + emit FirstValueChanged(this); +} + +void SlsQtNumberEntry::SecondValueEntered(){ + emit AValueChanged(this); + emit SecondValueChanged(GetValue(1)); + emit SecondValueChanged(GetValueInt(1)); + emit SecondValueChanged(this); +} + + +bool SlsQtNumberEntry::Enabled(){ + if(check_box && !check_box->checkState()) return 0; + return 1; +} + +bool SlsQtNumberEntry::IsValueOk(int which_number_field){ + int i = (which_number_field<0||which_number_field>1) ? 0:which_number_field; + + bool ok=0; + if(validator_int[i]) num_field[i]->text().toInt(&ok); + if(validator_double[i]) num_field[i]->text().toDouble(&ok); + if(spin_box[i]) ok=true; + + return ok; +} + +const char* SlsQtNumberEntry::GetFrontText(){ + if(front_text) return front_text->text().toStdString().c_str(); + return 0; +} +const char* SlsQtNumberEntry::GetMiddleText(){ + if(middle_text) return middle_text->text().toStdString().c_str(); + return 0; +} +const char* SlsQtNumberEntry::GetBackText(){ + if(back_text) back_text->text().toStdString().c_str(); + return 0; +} + +int SlsQtNumberEntry::GetNumberInt(int which_number_field,bool* ok){ + return round(GetNumber(which_number_field,ok)); +} + +double SlsQtNumberEntry::GetNumber(int which_number_field,bool* ok){ + int i = (which_number_field<0||which_number_field>1) ? 0:which_number_field; + + if(ok) *ok = 1; + + if(num_field[i]){ + if(validator_int[i]) return num_field[i]->text().toInt(ok); + else return num_field[i]->text().toDouble(ok); + } + else if(spin_box[i]) return spin_box[i]->value(); + else {if(ok) *ok=0;} + + return 0; +} + + + +double SlsQtNumberEntry::SetValue(double v,int which_number_field){ + if(unit_cbb) SetNumber(round(v/GetComboBoxValue()),which_number_field); + else SetNumber(v,which_number_field); + + return GetValue(which_number_field); +} + + +int SlsQtNumberEntry::GetValueInt(int which_number_field,bool* ok){ + return round(GetValue(which_number_field,ok)); +} + +double SlsQtNumberEntry::GetValue(int which_number_field,bool* ok){ + int i = (which_number_field<0||which_number_field>1) ? 0:which_number_field; + + double v; + if(ok) *ok = 1; + + if(num_field[i]){ + if(validator_int[i]) v = num_field[i]->text().toInt(ok); + else v = num_field[i]->text().toDouble(ok); + } + else if(spin_box[i]) v = spin_box[i]->value(); + else v = 1; //incase there is only a unit pulldown + + + if(unit_cbb) v *= GetComboBoxValue(); + + if(!num_field[i]&&!spin_box[i]&&!unit_cbb){v=0; if(ok) *ok=0;} + + return v; +} + + +int SlsQtNumberEntry::SetComboBoxIndex(int index){ + if(unit_cbb){ + if(index<0||index>=unit_cbb->count()){ + cout<<"usage error : can not set combo box index, index out of range."<setCurrentIndex(index); + } + } + else cout<<"usage error : can not set combo box index, no combo box."<currentIndex(); + + cout<<"usage error : can not get combo box index, no combo box."<currentIndex()]; + + cout<<"usage error : can not get combo box value, no combo box."< +#include +#include + +/** C++ Include Headers */ +#include +#include +using namespace std; + + + + + +qCloneWidget::qCloneWidget(QWidget *parent,int id,QSize fSize,int numDim,SlsQt1DPlot*& plot1D,SlsQt2DPlotLayout*& plot2D):QFrame(parent,Qt::Popup|Qt::SubWindow),id(id){ + + QGroupBox *cloneBox = new QGroupBox(this); + QGridLayout *gridClone = new QGridLayout(cloneBox); + cloneBox->setLayout(gridClone); + cloneBox->setFlat(1); + cloneBox->setTitle("Startup Image"); + cloneBox->resize(fSize); + + if(numDim==1){ + cloneplot1D = plot1D; + gridClone->addWidget(cloneplot1D,0,0); + }else{ + cloneplot2D = plot2D; + gridClone->addWidget(cloneplot2D,0,0); + } + + +} + + +qCloneWidget::~qCloneWidget(){ + delete cloneplot1D; + delete cloneplot2D; +} + + +void qCloneWidget::closeEvent(QCloseEvent* event){ + emit CloneClosedSignal(id); + event->accept(); +} diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp new file mode 100644 index 000000000..ecc465456 --- /dev/null +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -0,0 +1,291 @@ +/** Qt Project Class Headers */ +#include "qDetectorMain.h" +#include "qDrawPlot.h" +#include "qTabMeasurement.h" +#include "qTabDataOutput.h" +#include "qTabPlot.h" +#include "qTabActions.h" +#include "qTabAdvanced.h" +#include "qTabSettings.h" +#include "qTabDebugging.h" +#include "qTabDeveloper.h" +/** Project Class Headers */ +#include "slsDetector.h" +#include "multiSlsDetector.h" +#include "sls_detector_defs.h" +/** Qt Include Headers */ +/** C++ Include Headers */ +#include +#include +using namespace std; + +#define Detector_Index 0 + +int main (int argc, char **argv) { + + QApplication *theApp = new QApplication(argc, argv); + qDetectorMain *det=new qDetectorMain(argc, argv, theApp,0); + det->show(); + theApp->connect( theApp, SIGNAL(lastWindowClosed()), theApp, SLOT(quit())); + return theApp->exec(); +} + + + + + +qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app, QWidget *parent) : QMainWindow(parent), theApp(app),myPlot(NULL),tabs(NULL){ + myDet = 0; + setupUi(this); + SetUpWidgetWindow(); + Initialization(); + SetDeveloperMode(); + /**need to use argc and argv to determine which slsdet or multidet to use.*/ +} + + +//Qt::ScrollBarAsNeeded + + +qDetectorMain::~qDetectorMain(){ + delete myDet; + if (menubar) delete menubar; + if (centralwidget) delete centralwidget; +} + + + + + +void qDetectorMain::SetUpWidgetWindow(){ + + +/* scrollMain = new QScrollArea; + setCentralWidget(scrollMain); + scrollMain ->setWidget(centralwidget); + scrollMain->setWidgetResizable(true);*/ + + SetUpDetector(); + +/** plot setup*/ + myPlot = new qDrawPlot(framePlot,myDet); + +/**tabs setup*/ + tabs = new QTabWidget(this); + layoutTabs->addWidget(tabs); + /** creating all the tab widgets */ + tab_measurement = new qTabMeasurement (this, myDet,myPlot); + tab_dataoutput = new qTabDataOutput (this, myDet); + tab_plot = new qTabPlot (this, myDet,myPlot); + tab_actions = new qTabActions (this, myDet); + tab_advanced = new qTabAdvanced (this, myDet); + tab_Settings = new qTabSettings (this, myDet); + tab_debugging = new qTabDebugging (this, myDet); + tab_developer = new qTabDeveloper (this, myDet); + /** creating the scroll area widgets for the tabs */ + for(int i=0;isetFrameShape(QFrame::NoFrame); + } + /** setting the tab widgets to the scrollareas*/ + scroll[Measurement] ->setWidget(tab_measurement); + scroll[DataOutput] ->setWidget(tab_dataoutput); + scroll[Plot] ->setWidget(tab_plot); + scroll[Actions] ->setWidget(tab_actions); + scroll[Advanced] ->setWidget(tab_advanced); + scroll[Settings] ->setWidget(tab_Settings); + scroll[Debugging] ->setWidget(tab_debugging); + scroll[Developer] ->setWidget(tab_developer); + /** inserting all the tabs*/ + tabs->insertTab(Measurement, scroll[Measurement], "Measurement"); + tabs->insertTab(DataOutput, scroll[DataOutput], "Data Output"); + tabs->insertTab(Plot, scroll[Plot], "Plot"); + tabs->insertTab(Actions, scroll[Actions], "Actions"); + tabs->insertTab(Advanced, scroll[Advanced], "Advanced"); + tabs->insertTab(Settings, scroll[Settings], "Settings"); + tabs->insertTab(Debugging, scroll[Debugging], "Debugging"); + tabs->insertTab(Developer, scroll[Developer], "Developer"); + +/** mode setup - to set up the tabs initially as disabled, not in form so done here */ + SetDebugMode(false); + SetBeamlineMode(false); + SetExpertMode(false); +} + + + + + +void qDetectorMain::SetUpDetector(){ + /**instantiate detector and set window title*/ + myDet = new multiSlsDetector(Detector_Index); + if(!myDet->getHostname(Detector_Index).length()){ + setWindowTitle("SLS Detector GUI : No Detector Connected"); +#ifdef VERBOSE + cout<getDetectorsType()).c_str())+" - "+QString(myDet->getHostname(Detector_Index).c_str())); +#ifdef VERBOSE + cout<getDetectorsType())<<"\t\t\tDetector : "<getHostname(Detector_Index)<setOnline(slsDetectorDefs::ONLINE_FLAG); + } +} + + + +void qDetectorMain::Initialization(){ + + +/** tabs */ + connect(tabs,SIGNAL(currentChanged(int)),this, SLOT(refresh(int)));//( QWidget*))); + /** Measurement tab*/ + /** Plot tab */ + + +/** Plotting */ + /** When the acquisition is finished, must update the meas tab */ + connect(myPlot, SIGNAL(UpdatingPlotFinished()), tab_measurement,SLOT(UpdateFinished())); + + +/** menubar */ + /** Modes Menu */ + connect(actionDebug, SIGNAL(toggled(bool)),this,SLOT(SetDebugMode(bool))); + connect(actionBeamline, SIGNAL(toggled(bool)),this,SLOT(SetBeamlineMode(bool))); + connect(actionExpert, SIGNAL(toggled(bool)),this,SLOT(SetExpertMode(bool))); + connect(actionDockable, SIGNAL(toggled(bool)),this,SLOT(SetDockableMode(bool))); + + + /** Utilities Menu */ + connect(actionOpenSetup,SIGNAL(triggered()),this,SLOT(OpenSetup())); + connect(actionSaveSetup,SIGNAL(triggered()),this,SLOT(SaveSetup())); + connect(actionMeasurementWizard,SIGNAL(triggered()),this,SLOT(MeasurementWizard())); + connect(actionOpenConfiguration,SIGNAL(triggered()),this,SLOT(OpenConfiguration())); + connect(actionSaveConfiguration,SIGNAL(triggered()),this,SLOT(SaveConfiguration())); + connect(actionEnergyCalibration,SIGNAL(triggered()),this,SLOT(EnergyCalibration())); + connect(actionAngularCalibration,SIGNAL(triggered()),this,SLOT(AngularCalibration())); + connect(actionAbout,SIGNAL(triggered()),this,SLOT(About())); + connect(actionVersion,SIGNAL(triggered()),this,SLOT(Version())); + +} + + +void qDetectorMain::SetDeveloperMode(){ +#ifdef VERBOSE + cout<<"Enabling Developer Mode "<setTabEnabled(Developer,true); +} + + +void qDetectorMain::SetDebugMode(bool b){ +#ifdef VERBOSE + cout<<"Setting Debug Mode to "<setTabEnabled(Debugging,b); +} + +void qDetectorMain::SetBeamlineMode(bool b){ +#ifdef VERBOSE + cout<<"Setting Beamline Mode to "<setTabEnabled(Advanced,b); + tabs->setTabEnabled(Settings,b); + tab_advanced->setEnabled(b); +} + + + +void qDetectorMain::refresh(int index){ + if(!tabs->isTabEnabled(index)) + tabs->setCurrentIndex((index++)<(tabs->count()-1)?index:Measurement); + else{ +; + } +} + + +void qDetectorMain::SetDockableMode(bool b){ +#ifdef VERBOSE + cout<<"Setting Dockable Plot Mode to "<setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable); + else + dockWidgetPlot->setFeatures(QDockWidget::NoDockWidgetFeatures); + +} + + +void qDetectorMain::OpenSetup(){ +#ifdef VERBOSE + cout<<"Opening Setup"< +/** C++ Include Headers */ +#include +#include +using namespace std; + + +#define Detector_Index 0 + + +qDrawPlot::qDrawPlot(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){ + if(myDet) { + setupUi(this); + Initialization(); + SetupWidgetWindow(); + StartStopDaqToggle(); //as default + } +} + + +qDrawPlot::~qDrawPlot(){ + /** Clear plot*/ + Clear1DPlot(); + for(QVector::iterator h = plot1D_hists.begin();h!=plot1D_hists.end();h++){ + delete *h; + } + plot1D_hists.clear(); + + + delete[] lastImageArray; lastImageArray=0; + StartOrStopThread(0); + + /** delete detector object pointer*/ + delete myDet; +} + + + + +void qDrawPlot::Initialization(){ +#ifdef VERBOSE + cout<<"Setting up plot variables"<SetXTitle("x axis"); + plot1D->SetYTitle("y axis"); + plot1D->hide(); + + plot2D = new SlsQt2DPlotLayout(boxPlot); + plot2D->SetXTitle("pixel"); + plot2D->SetYTitle("pixel"); + plot2D->SetZTitle("Intensity"); + boxPlot->setFlat(1); + boxPlot->setTitle("Startup Image"); + + plotLayout = new QGridLayout(boxPlot); + plotLayout->addWidget(plot1D,1,1,1,1); + plotLayout->addWidget(plot2D,1,1,1,1); + + + connect(this, SIGNAL(InterpolateSignal(bool)), plot2D, SIGNAL(InterpolateSignal(bool))); + connect(this, SIGNAL(ContourSignal(bool)), plot2D, SIGNAL(ContourSignal(bool))); + connect(this, SIGNAL(LogzSignal(bool)), plot2D, SLOT(SetZScaleToLog(bool))); + +} + + + + +void qDrawPlot::StartStopDaqToggle(bool stop_if_running){ + static bool running = 1; + if(running){ //stopping + StartDaq(0); + running=!running; + }else if(!stop_if_running){ //then start + StartDaq(1); + running=!running; + } +} + + + + +void qDrawPlot::StartDaq(bool start){ + if(start){ +#ifdef VERBOSE + cout<<"Start Daq(1) function"<setTimer(slsDetectorDefs::FRAME_NUMBER,-1); + cout<<"\tNumber of Exposures:"<setTimer(slsDetectorDefs::ACQUISITION_TIME,-1))*1E-9); + cout<<"\tAcquisition Time:"<setTimer(slsDetectorDefs::FRAME_PERIOD,-1))*1E-9); + cout<<"\tFrame Period:"<acquire(1);//acquiring + } + pthread_mutex_unlock(&gui_acquisition_start_stop_mutex); + + return gui_acquisition_thread_running; +} + + + + + + + +void* qDrawPlot::DataAcquisionThread(void *this_pointer){ + ((qDrawPlot*)this_pointer)->AcquireImages(); + return this_pointer; +} + + + + +void* qDrawPlot::AcquireImages(){ + //send data to detector + + static unsigned int nx=1280,ny=100; + static double* image_data = new double[nx*ny]; + if(!lastImageArray) lastImageArray = new double[nx*ny]; + static double* xvalues = new double [nx]; + static double* yvalues0 = new double [nx]; + static double* yvalues1 = new double [nx]; + if(!histXAxis) histXAxis = new double [nx]; + if(!histYAxis[0]) histYAxis[0] = new double [nx]; + if(!histYAxis[1]) histYAxis[1] = new double [nx]; + + + + char cIndex[200]; + + //string filePath = myDet->getFilePath()+'/'+myDet->getFileName()+'_'; + //cout<<"filePath:"<readDataFile(fileName,arg)==-1); + + + ///////// + + + //readout detector + //fill and write data here + for(unsigned int px=0;pxshow(); + plot2D->hide(); + }else{ + plot1D->hide(); + plot2D->show(); + } +} + + + + +void qDrawPlot::Clear1DPlot(){ + for(QVector::iterator h = plot1D_hists.begin(); + h!=plot1D_hists.end();h++) (*h)->Detach(plot1D); //clear plot +} + + + + +void qDrawPlot::UpdatePlot(){ + //emit UpdatingPlot(); + + plot_update_timer->stop(); + + LockLastImageArray(); + //1-d plot stuff + if(GetHistNBins()){ + plot1D->SetXTitle(GetHistXAxisTitle()); + plot1D->SetYTitle(GetHistYAxisTitle()); + for(int hist_num=0;hist_numplot1D_hists.size()){ + plot1D_hists.append(h=new SlsQtH1D("1d plot",GetHistNBins(),GetHistXAxis(),GetHistYAxis(hist_num))); + h->SetLineColor(hist_num+1); + }else{ + h=plot1D_hists.at(hist_num); + h->SetData(GetHistNBins(),GetHistXAxis(),GetHistYAxis(hist_num)); + } + h->setTitle(GetHistTitle(hist_num)); + h->Attach(plot1D); + } + plot1D->UnZoom(); + } + + //2-d plot stuff + static int last_plot_number = 0; + if(GetLastImageArray()){ + if(GetLastImageNumber()&&last_plot_number!=GetLastImageNumber() && //there is a new plot + GetNPixelsX()>0&&GetNPixelsY()>0){ + plot2D->GetPlot()->SetData(GetNPixelsX(),-0.5,GetNPixelsX()-0.5,GetNPixelsY(),-0.5,GetNPixelsY()-0.5,GetLastImageArray()); + //as it inherits a widget + boxPlot->setTitle(GetImageTitle()); + plot2D->SetXTitle(GetImageXAxisTitle()); + plot2D->SetYTitle(GetImageYAxisTitle()); + plot2D->SetZTitle(GetImageZAxisTitle()); + plot2D->UpdateNKeepSetRangeIfSet(); //this will keep a "set" z range, and call Plot()->Update(); + } + } + last_plot_number=GetLastImageNumber(); + UnlockLastImageArray(); + + if(PlotInScope()==1) SelectPlot(1); + else if(PlotInScope()==2) SelectPlot(2); + + if(number_of_exposures==last_plot_number){ + StartStopDaqToggle(1); + emit UpdatingPlotFinished(); + }else{ + plot_update_timer->start(500); + } +} + + + +void qDrawPlot::StopUpdatePlot(){ + plot_update_timer->stop(); +} + + + + +void qDrawPlot::ClonePlot(){ + int i=0; + bool found = false; + for(i=0;isize(),(int)PlotInScope(),plot1D,plot2D); + if(PlotInScope()==1) + plot1D = new SlsQt1DPlot(boxPlot); + else + plot2D = new SlsQt2DPlotLayout(boxPlot); + plotLayout->addWidget(plot1D,1,1,1,1); + plotLayout->addWidget(plot2D,1,1,1,1); + UpdatePlot(); + connect(this, SIGNAL(InterpolateSignal(bool)), plot2D, SIGNAL(InterpolateSignal(bool))); + connect(this, SIGNAL(ContourSignal(bool)), plot2D, SIGNAL(ContourSignal(bool))); + connect(this, SIGNAL(LogzSignal(bool)), plot2D, SLOT(SetZScaleToLog(bool))); + winClone[i]->show(); + connect(winClone[i], SIGNAL(CloneClosedSignal(int)),this, SLOT(CloneCloseEvent(int))); + +} + +void qDrawPlot::CloseClones(){ + for(int i=0;iclose(); + +} + + +void qDrawPlot::CloneCloseEvent(int id){ + winClone[id]=0; +#ifdef VERBOSE + cout<<"Closing Clone Window id:"< +using namespace std; + + +#define Detector_Index 0 + + + +qTabActions::qTabActions(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){ + setupUi(this); + if(myDet) + { + SetupWidgetWindow(); + Initialization(); + } +} + + + + +qTabActions::~qTabActions(){ + delete myDet; +} + + + + +void qTabActions::SetupWidgetWindow(){ +} + + + +void qTabActions::Initialization(){ +} + + + +void qTabActions::Enable(bool enable){ + //this->setEnabled(enable); + +} + + + + diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp new file mode 100644 index 000000000..0c55d2258 --- /dev/null +++ b/slsDetectorGui/src/qTabAdvanced.cpp @@ -0,0 +1,84 @@ +/* + * qTabAdvanced.cpp + * + * Created on: May 10, 2012 + * Author: l_maliakal_d + */ +#include "qTabAdvanced.h" +#include "qDefs.h" +/** Project Class Headers */ +#include "slsDetector.h" +#include "multiSlsDetector.h" +/** C++ Include Headers */ +#include +using namespace std; + + +#define Detector_Index 0 + + + +qTabAdvanced::qTabAdvanced(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){ + setupUi(this); + if(myDet) + { + myDetType = (int)myDet->getDetectorsType(); + SetupWidgetWindow(); + Initialization(); + } +} + + + + +qTabAdvanced::~qTabAdvanced(){ + delete myDet; +} + + + + +void qTabAdvanced::SetupWidgetWindow(){ + /** Temperature */ + if(myDetType==slsDetectorDefs::GOTTHARD) + getTemperature(); //check if gotthard??? + else{ + btnTemp->setEnabled(false); + dispTempAdc->setEnabled(false); + dispTempFpga->setEnabled(false); + } +} + + + +void qTabAdvanced::Initialization(){ + /** Temperature */ + connect(btnTemp,SIGNAL(clicked()),this,SLOT(getTemperature()));//check if gotthard??? +} + + + +void qTabAdvanced::Enable(bool enable){ + btnTemp->setEnabled(enable); + dispTempAdc->setEnabled(enable); + dispTempFpga->setEnabled(enable); + pushButton->setEnabled(enable); +} + + +void qTabAdvanced::getTemperature(){ + char ctemp[200]; + /** adc */ + float tempadc = myDet->getADC(slsDetectorDefs::TEMPERATURE_ADC); + sprintf(ctemp,"%f%cC",tempadc,0x00B0); + dispTempAdc->setText(QString(ctemp)); + /** fpga */ + float tempfpga = myDet->getADC(slsDetectorDefs::TEMPERATURE_FPGA); + sprintf(ctemp,"%f%cC",tempfpga,0x00B0); + dispTempFpga->setText(QString(ctemp)); +#ifdef VERBOSE + cout<<"Temperature of ADC: "< +using namespace std; + + +#define Detector_Index 0 + + + +qTabDataOutput::qTabDataOutput(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){ + setupUi(this); + if(myDet) + { + SetupWidgetWindow(); + Initialization(); + } +} + + + + +qTabDataOutput::~qTabDataOutput(){ + delete myDet; +} + + + + +void qTabDataOutput::SetupWidgetWindow(){ +} + + + +void qTabDataOutput::Initialization(){ +} + + + +void qTabDataOutput::Enable(bool enable){ + //this->setEnabled(enable); + +} + + diff --git a/slsDetectorGui/src/qTabDebugging.cpp b/slsDetectorGui/src/qTabDebugging.cpp new file mode 100644 index 000000000..4fcf040bb --- /dev/null +++ b/slsDetectorGui/src/qTabDebugging.cpp @@ -0,0 +1,55 @@ +/* + * qTabDebugging.cpp + * + * Created on: May 10, 2012 + * Author: l_maliakal_d + */ +#include "qTabDebugging.h" +#include "qDefs.h" +/** Project Class Headers */ +#include "slsDetector.h" +#include "multiSlsDetector.h" +/** C++ Include Headers */ +#include +using namespace std; + + +#define Detector_Index 0 + + + +qTabDebugging::qTabDebugging(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){ + setupUi(this); + if(myDet) + { + SetupWidgetWindow(); + Initialization(); + } +} + + + + +qTabDebugging::~qTabDebugging(){ + delete myDet; +} + + + + +void qTabDebugging::SetupWidgetWindow(){ +} + + + +void qTabDebugging::Initialization(){ +} + + + +void qTabDebugging::Enable(bool enable){ + //this->setEnabled(enable); + +} + + diff --git a/slsDetectorGui/src/qTabDeveloper.cpp b/slsDetectorGui/src/qTabDeveloper.cpp new file mode 100644 index 000000000..6914431ae --- /dev/null +++ b/slsDetectorGui/src/qTabDeveloper.cpp @@ -0,0 +1,55 @@ +/* + * qTabDeveloper.cpp + * + * Created on: May 10, 2012 + * Author: l_maliakal_d + */ +#include "qTabDeveloper.h" +#include "qDefs.h" +/** Project Class Headers */ +#include "slsDetector.h" +#include "multiSlsDetector.h" +/** C++ Include Headers */ +#include +using namespace std; + + +#define Detector_Index 0 + + + +qTabDeveloper::qTabDeveloper(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){ + setupUi(this); + if(myDet) + { + SetupWidgetWindow(); + Initialization(); + } +} + + + + +qTabDeveloper::~qTabDeveloper(){ + delete myDet; +} + + + + +void qTabDeveloper::SetupWidgetWindow(){ +} + + + +void qTabDeveloper::Initialization(){ +} + + + +void qTabDeveloper::Enable(bool enable){ + //this->setEnabled(enable); + +} + + diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp new file mode 100644 index 000000000..00e64b9d5 --- /dev/null +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -0,0 +1,195 @@ +/* + * qTabMeasurement.cpp + * + * Created on: May 2, 2012 + * Author: l_maliakal_d + */ + +/** Qt Project Class Headers */ +#include "qTabMeasurement.h" +#include "qDefs.h" +#include "qDrawPlot.h" +/** Project Class Headers */ +#include "slsDetector.h" +#include "multiSlsDetector.h" +/** C++ Include Headers */ +#include +using namespace std; + + +#define Detector_Index 0 +#define UndefinedSettings 7 + + + +qTabMeasurement::qTabMeasurement(QWidget *parent,slsDetectorUtils*& detector, qDrawPlot*& plot):QWidget(parent),myDet(detector),myPlot(plot){ + setupUi(this); + if(myDet) + { + SetupWidgetWindow(); + Initialization(); + } +} + + + + +qTabMeasurement::~qTabMeasurement(){ + delete myDet; + delete myPlot; +} + + + + +void qTabMeasurement::SetupWidgetWindow(){ + /** all set initially to reflect the detector's actual parameter values*/ + + /** Settings */ + comboSettings->setCurrentIndex(myDet->getSettings(Detector_Index)); //set it to default acc to detector??? + /** Number of Measurements/Frames*/ + setNumFrames(2000); + /** Acquisition Time */ + setAcquisitionTime(); + /** Frame Period between exposures*/ + setFramePeriod(); + /** File Name*/ + setFileName("run"); + /** File Index*/ + setRunIndex(0); +} + + + +void qTabMeasurement::Initialization(){ + /** Settings */ + connect(comboSettings,SIGNAL(currentIndexChanged(int)),this,SLOT(setSettings(int))); + /** Number of Measurements/Frames*/ + connect(spinNumMeasurements,SIGNAL(valueChanged(int)),this,SLOT(setNumFrames(int))); + /** Acquisition Time */ + connect(spinExpTime,SIGNAL(valueChanged(double)),this,SLOT(setAcquisitionTime())); + connect(comboExpUnit,SIGNAL(currentIndexChanged(int)),this,SLOT(setAcquisitionTime())); + /** Frame Period between exposures*/ + connect(spinPeriod,SIGNAL(valueChanged(double)),this,SLOT(setFramePeriod())); + connect(comboPeriodUnit,SIGNAL(currentIndexChanged(int)),this,SLOT(setFramePeriod())); + /** File Name*/ + connect(dispFileName,SIGNAL(textChanged(const QString&)),this,SLOT(setFileName(const QString&))); + /** File Index*/ + connect(spinIndex,SIGNAL(valueChanged(int)),this,SLOT(setRunIndex(int))); + /** Start/Stop Acquisition*/ + connect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); +} + + + + +//enabled other tabs as well?? +void qTabMeasurement::Enable(bool enable){ + //this->setEnabled(enable); + comboSettings->setEnabled(enable); + spinNumMeasurements->setEnabled(enable); + spinExpTime->setEnabled(enable); + comboExpUnit->setEnabled(enable); + spinPeriod->setEnabled(enable); + comboPeriodUnit->setEnabled(enable); + dispFileName->setEnabled(enable); + spinIndex->setEnabled(enable); + if(!enable) btnStartStop->setEnabled(true); +} + + + + +void qTabMeasurement::startStopAcquisition(){ + if(!btnStartStop->text().compare("Start")){ +#ifdef VERBOSE + cout<setText("Stop"); + Enable(0); + }else{ +#ifdef VERBOSE + cout<<"Stopping Acquisition"<setText("Start"); + Enable(1); + } + myPlot->StartStopDaqToggle(); +} + + +void qTabMeasurement::UpdateFinished(){ + disconnect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); + btnStartStop->setText("Start"); + Enable(1); + connect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); +} + +void qTabMeasurement::setSettings(int index){ + slsDetectorDefs::detectorSettings sett = myDet->setSettings((slsDetectorDefs::detectorSettings)index,Detector_Index); +#ifdef VERBOSE + cout<<"Settings have been set to "<slsDetectorBase::getDetectorSettings(sett)<setTimer(slsDetectorDefs::FRAME_NUMBER,val); +#ifdef VERBOSE + cout<<"Setting Frame number to " << (int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1)<currentIndex(),spinExpTime->value()); +#ifdef VERBOSE + cout<<"Setting acquisition time to " << exptime64 << " clocks" << endl; +#endif + myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,exptime64); + + //float t=exptime64; + //emit acquisitionTimeChanged(t/(100E+6)); ?????????????????????? +} + + + +void qTabMeasurement::setFramePeriod(){ + int64_t exptime64; + /** Get the 64 bit value of timer*/ + exptime64 = qDefs::get64bTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value()); +#ifdef VERBOSE + cout<<"Setting frame period between exposures to " << exptime64 << " clocks" << endl; +#endif + myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,exptime64); + + //float t=exptime64; + //emit acquisitionTimeChanged(t/(100E+6)); ?????????????????????? +} + + + +void qTabMeasurement::setFileName(const QString& fName){ + // emit fileNameChanged(fName); + // thred-->fileName=s;myDet->setFileName(fName.ascii()); +#ifdef VERBOSE + cout<<"Setting File name to " << myDet->getFileName()<setFileName(fName.toAscii().data()); +} + + + + +void qTabMeasurement::setRunIndex(int index){ + myDet->setFileIndex(index); +#ifdef VERBOSE + cout<<"Setting File Index to " << myDet->getFileIndex()< +using namespace std; + + +#define Detector_Index 0 + + + +qTabPlot::qTabPlot(QWidget *parent,slsDetectorUtils*& detector, qDrawPlot*& plot):QWidget(parent),myDet(detector),myPlot(plot){ + setupUi(this); + if(myDet) + { + SetupWidgetWindow(); + Initialization(); + } +} + + + + +qTabPlot::~qTabPlot(){ + delete myDet; + delete myPlot; +} + + + + +void qTabPlot::SetupWidgetWindow(){ + box1D->setEnabled(false); +} + + + +void qTabPlot::Initialization(){ +/** Plot box*/ + connect(btnClone, SIGNAL(clicked()),myPlot, SLOT(ClonePlot())); + connect(btnCloseClones, SIGNAL(clicked()),myPlot, SLOT(CloseClones())); +/** 2D Plot box*/ + connect(chkInterpolate, SIGNAL(toggled(bool)),myPlot, SIGNAL(InterpolateSignal(bool))); + connect(chkContour, SIGNAL(toggled(bool)),myPlot, SIGNAL(ContourSignal(bool))); + connect(chkLogz, SIGNAL(toggled(bool)),myPlot, SIGNAL(LogzSignal(bool))); +} + + + +void qTabPlot::Enable(bool enable){ + boxPlot->setEnabled(enable); + box1D->setEnabled(enable); + box2D->setEnabled(enable); + boxPlotAxis->setEnabled(enable); +} + + diff --git a/slsDetectorGui/src/qTabSettings.cpp b/slsDetectorGui/src/qTabSettings.cpp new file mode 100644 index 000000000..c43c87676 --- /dev/null +++ b/slsDetectorGui/src/qTabSettings.cpp @@ -0,0 +1,56 @@ +/* + * qTabSettings.cpp + * + * Created on: May 10, 2012 + * Author: l_maliakal_d + */ + +#include "qTabSettings.h" +#include "qDefs.h" +/** Project Class Headers */ +#include "slsDetector.h" +#include "multiSlsDetector.h" +/** C++ Include Headers */ +#include +using namespace std; + + +#define Detector_Index 0 + + + +qTabSettings::qTabSettings(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){ + setupUi(this); + if(myDet) + { + SetupWidgetWindow(); + Initialization(); + } +} + + + + +qTabSettings::~qTabSettings(){ + delete myDet; +} + + + + +void qTabSettings::SetupWidgetWindow(){ +} + + + +void qTabSettings::Initialization(){ +} + + + +void qTabSettings::Enable(bool enable){ + //this->setEnabled(enable); + +} + + From 934bbbd0c887708b796535ed032203a7ae57aa51 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 23 May 2012 16:00:35 +0000 Subject: [PATCH 002/332] resize works git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@2 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_detectormain.ui | 234 +++-- slsDetectorGui/forms/form_drawplot.ui | 20 +- slsDetectorGui/forms/form_tab_actions.ui | 18 +- slsDetectorGui/forms/form_tab_advanced.ui | 42 +- slsDetectorGui/forms/form_tab_dataoutput.ui | 12 +- slsDetectorGui/forms/form_tab_debugging.ui | 18 +- slsDetectorGui/forms/form_tab_developer.ui | 18 +- slsDetectorGui/forms/form_tab_measurement.ui | 892 +++++++++++++++---- slsDetectorGui/forms/form_tab_plot.ui | 342 ++++--- slsDetectorGui/forms/form_tab_settings.ui | 99 +- slsDetectorGui/include/qDetectorMain.h | 25 +- slsDetectorGui/include/qDrawPlot.h | 125 +-- slsDetectorGui/include/qTabMeasurement.h | 69 +- slsDetectorGui/include/qTabPlot.h | 1 - slsDetectorGui/include/qTabSettings.h | 7 + slsDetectorGui/slsDetectorGui.pro | 1 - slsDetectorGui/src/qDetectorMain.cpp | 77 +- slsDetectorGui/src/qDrawPlot.cpp | 22 +- slsDetectorGui/src/qTabMeasurement.cpp | 437 +++++++-- slsDetectorGui/src/qTabPlot.cpp | 3 +- slsDetectorGui/src/qTabSettings.cpp | 15 +- 21 files changed, 1858 insertions(+), 619 deletions(-) diff --git a/slsDetectorGui/forms/form_detectormain.ui b/slsDetectorGui/forms/form_detectormain.ui index 02fa824f5..b67a0517d 100644 --- a/slsDetectorGui/forms/form_detectormain.ui +++ b/slsDetectorGui/forms/form_detectormain.ui @@ -9,12 +9,12 @@ 0 0 - 1000 - 956 + 800 + 822 - + 0 0 @@ -44,7 +44,7 @@ - + 0 0 @@ -52,13 +52,13 @@ 0 - 470 + 0 1000 - 470 + 1000 @@ -66,8 +66,8 @@ 0 0 - 953 - 470 + 754 + 368 @@ -78,7 +78,7 @@ 0 0 - 1000 + 800 25 @@ -135,23 +135,60 @@ - + 0 0 - 40 - 54 + 38 + 369 524287 - 470 + 524287 + + + + + + + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + + + 119 + 119 + 119 + + + + + + 11 @@ -166,7 +203,7 @@ false - QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetVerticalTitleBar + QDockWidget::DockWidgetVerticalTitleBar Qt::BottomDockWidgetArea|Qt::RightDockWidgetArea @@ -178,6 +215,43 @@ 2 + + + + + + + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + + + 119 + 119 + 119 + + + + + + 9 @@ -189,15 +263,15 @@ - + 0 0 - 58 - 455 + 36 + 422 @@ -206,16 +280,53 @@ 524287 + + + + + + + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + + + 119 + 119 + 119 + + + + + + Sans Serif 11 - 75 - true + 50 + false - QDockWidget::DockWidgetMovable + QDockWidget::NoDockWidgetFeatures Qt::BottomDockWidgetArea @@ -228,7 +339,7 @@ - + 0 0 @@ -236,7 +347,7 @@ 0 - 429 + 400 @@ -245,49 +356,50 @@ 16777215 + + + + + + + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + + + 119 + 119 + 119 + + + + + + 9 - 50 - false + 75 + true - - - - 0 - 0 - 1000 - 431 - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 9 - - - - QFrame::NoFrame - - - QFrame::Raised - - - 1 - - @@ -390,7 +502,7 @@ true - &Dockable Plot + &Dockable Windows diff --git a/slsDetectorGui/forms/form_drawplot.ui b/slsDetectorGui/forms/form_drawplot.ui index 67c2cee30..7aa9c11a0 100644 --- a/slsDetectorGui/forms/form_drawplot.ui +++ b/slsDetectorGui/forms/form_drawplot.ui @@ -6,8 +6,8 @@ 0 0 - 1000 - 435 + 800 + 400 @@ -16,16 +16,22 @@ 0 + + + 0 + 0 + + Form - 3 + 0 -2 - 1000 - 435 + 795 + 400 @@ -54,8 +60,8 @@ -3 16 - 1001 - 421 + 788 + 383 diff --git a/slsDetectorGui/forms/form_tab_actions.ui b/slsDetectorGui/forms/form_tab_actions.ui index 9f96ef508..f893e09ef 100644 --- a/slsDetectorGui/forms/form_tab_actions.ui +++ b/slsDetectorGui/forms/form_tab_actions.ui @@ -6,20 +6,26 @@ 0 0 - 952 - 445 + 748 + 339 + + + 0 + 0 + + - 952 - 445 + 0 + 0 - 952 - 445 + 1000 + 1000 diff --git a/slsDetectorGui/forms/form_tab_advanced.ui b/slsDetectorGui/forms/form_tab_advanced.ui index fb03a0ed6..afdfb5593 100644 --- a/slsDetectorGui/forms/form_tab_advanced.ui +++ b/slsDetectorGui/forms/form_tab_advanced.ui @@ -6,20 +6,26 @@ 0 0 - 952 - 445 + 748 + 339 + + + 0 + 0 + + - 952 - 445 + 0 + 0 - 952 - 445 + 1000 + 1000 @@ -28,8 +34,8 @@ - 3 - 412 + 69 + 229 75 25 @@ -41,8 +47,8 @@ - 626 - 8 + 52 + 106 91 41 @@ -61,8 +67,8 @@ Temperature - 796 - 34 + 222 + 132 151 21 @@ -84,8 +90,8 @@ Temperature - 736 - 4 + 162 + 102 41 20 @@ -97,8 +103,8 @@ Temperature - 736 - 34 + 162 + 132 41 20 @@ -110,8 +116,8 @@ Temperature - 796 - 4 + 222 + 102 151 21 diff --git a/slsDetectorGui/forms/form_tab_dataoutput.ui b/slsDetectorGui/forms/form_tab_dataoutput.ui index a822cbda6..9461e31bf 100644 --- a/slsDetectorGui/forms/form_tab_dataoutput.ui +++ b/slsDetectorGui/forms/form_tab_dataoutput.ui @@ -6,10 +6,16 @@ 0 0 - 900 - 400 + 748 + 339 + + + 0 + 0 + + 0 @@ -18,7 +24,7 @@ - 952 + 1000 1000 diff --git a/slsDetectorGui/forms/form_tab_debugging.ui b/slsDetectorGui/forms/form_tab_debugging.ui index 8890e4adf..47d4c2a20 100644 --- a/slsDetectorGui/forms/form_tab_debugging.ui +++ b/slsDetectorGui/forms/form_tab_debugging.ui @@ -6,20 +6,26 @@ 0 0 - 952 - 445 + 748 + 350 + + + 0 + 0 + + - 952 - 445 + 0 + 0 - 952 - 445 + 1000 + 1000 diff --git a/slsDetectorGui/forms/form_tab_developer.ui b/slsDetectorGui/forms/form_tab_developer.ui index 074e6adf3..1bb8779c3 100644 --- a/slsDetectorGui/forms/form_tab_developer.ui +++ b/slsDetectorGui/forms/form_tab_developer.ui @@ -6,20 +6,26 @@ 0 0 - 952 - 445 + 748 + 339 + + + 0 + 0 + + - 952 - 445 + 0 + 0 - 952 - 445 + 1000 + 1000 diff --git a/slsDetectorGui/forms/form_tab_measurement.ui b/slsDetectorGui/forms/form_tab_measurement.ui index 1b05d7ad7..cab777bd6 100644 --- a/slsDetectorGui/forms/form_tab_measurement.ui +++ b/slsDetectorGui/forms/form_tab_measurement.ui @@ -6,10 +6,16 @@ 0 0 - 900 - 400 + 734 + 339 + + + 0 + 0 + + 0 @@ -18,105 +24,153 @@ - 952 - 500 + 1000 + 1000 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + + + 193 + 193 + 193 + + + + + + + 188 + 188 + 188 + + + + + + + 192 + 192 + 192 + + + + + + + 189 + 189 + 189 + + + + + + Form - + - 9 - 30 - 420 - 355 + 20 + 20 + 321 + 117 - - - - - 0 - 0 - - - - Settings of the detector. - #settings# - - - - Standard - - - - - Fast - - - - - High Gain - - - - - Dynamic Gain - - - - - Low Gain - - - - - Medium Gain - - - - - Very High Gain - - - - - Undefined - - - - - Uninitialized - - - - + + -1 + - - - Settings: - - - - - Number of measurements: + Number of Measurements: - - - - Acquisition Time: - - - - - + + 0 @@ -124,21 +178,189 @@ - Exposure time of each frame. - #exptime# + Number of measurements (not in real time) that will be acquired. + #frames# + + + + + + + + + + + + 1 + + + 2000000000 + + + 1 + + + + + + + File Name: + + + + + + + + 0 + 0 + + + + Root of the file name - please check that the output directory is correctly set and select the file name format. + #fname# + + + + + + + + + + Run Index: + + + + + + + + 0 + 0 + + + + Run index (automatically incremented) + #index# + + + + + + + + + + + + 0 + + + 2000000000 + + + 0 + + + + + + + + + 390 + 20 + 322 + 312 + + + + + + + false + + + Number of Triggers: + + + + + + + false + + + + 0 + 0 + + + + Run index (automatically incremented) + #index# + + + + + + + + + + + + 0 + + + 2000000000 + + + 0 + + + + + + + false + + + Delay After Trigger: + + + + + + + false + + + + 0 + 0 + + + + Frame period between exposures. + #period# 2000000000.000000000000000 - 1.000000000000000 + 0.000000000000000 - - + + + + false + - + 0 0 @@ -178,8 +400,27 @@ - - + + + + false + + + + 0 + 0 + + + + Number of Gates: + + + + + + + false + 0 @@ -187,19 +428,230 @@ - Frame period between exposures. - #period# + Run index (automatically incremented) + #index# + + + + + + + + + + + + 0 + + + 2000000000 + + + 0 + + + + + + + false + + + + 0 + 0 + + + + Number of Probes: + + + + + + + false + + + + 0 + 0 + + + + Run index (automatically incremented) + #index# + + + + + + + + + + + + 0 + + + 2000000000 + + + 0 + + + + + + + Timing Mode: + + + + + + + + 0 + 0 + + + + Settings of the detector. + #settings# + + + + None + + + + + Auto + + + + + Gated + + + + + Trigger Exposure + + + + + Trigger Frame + + + + + Trigger Readout + + + + + Gated with Start Trigger + + + + + External Trigger Window + + + + + + + + false + + + Number of Frames: + + + + + + + false + + + + 0 + 0 + + + + Number of measurements (not in real time) that will be acquired. + #frames# + + + + + + + + + + + + 1 + + + 2000000000 + + + 1 + + + + + + + false + + + Exposure Time: + + + + + + + false + + + + 0 + 0 + + + + Exposure time of each frame. + #exptime# 2000000000.000000000000000 - 2.000000000000000 + 0.000000000000000 - - + + + + false + + + + 0 + 0 + + 2 @@ -236,110 +688,188 @@ - - - Frame Period: - - - - - - - File Name: - - - - - - - Root of the file name - please check that the output directory is correctly set and select the file name format. - #fname# + + + false - run + Acquisition Period: - - - - Run Index: + + + + false - - - - - - Run index (automatically incremented) - #index# - - - - - - - - - - - - 0 - - - 2000000000 - - - 0 - - - - - - - Qt::NoFocus - - - Starts Acquisition - - - Start - - - - - - + 0 0 - Number of measurements (not in real time) that will be acquired. - #frames# - - - - - - - - - - - - 1 + Frame period between exposures. + #period# - 2000000000 + 2000000000.000000000000000 - 2000 + 0.000000000000000 + + + + false + + + + 0 + 0 + + + + 2 + + + + hr + + + + + min + + + + + s + + + + + ms + + + + + us + + + + + ns + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 20 + + + + + + + + 20 + 150 + 319 + 90 + + + + + 0 + 0 + + + + Progress Monitor + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + 10 + 50 + 300 + 23 + + + + 24 + + + + + + 10 + 30 + 91 + 16 + + + + Current Index: + + + + + + 100 + 31 + 101 + 16 + + + + 0 + + + + + + + 20 + 280 + 319 + 31 + + + + + 0 + 0 + + + + Qt::NoFocus + + + Starts Acquisition + + + Start + + diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index b6ce36b03..60ddea384 100644 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -6,20 +6,20 @@ 0 0 - 952 - 445 + 748 + 339 - 952 - 445 + 0 + 0 - 952 - 445 + 1000 + 1000 @@ -29,24 +29,30 @@ 10 - 250 - 571 + 180 + 731 151 Plot Axis + + false + 10 20 - 551 + 712 121 - + + + QLayout::SetNoConstraint + @@ -54,18 +60,44 @@ - - + + + + + 2 + 0 + + + + + + 0 + 0 + + X min: - + + + + 0 + 0 + + + + + 20 + 0 + + + @@ -75,7 +107,14 @@ - + + + + 0 + 0 + + + @@ -84,18 +123,44 @@ - - + + + + + 2 + 0 + + + + + + 0 + 0 + + Y min: - + + + + 0 + 0 + + + + + 20 + 0 + + + @@ -105,7 +170,14 @@ - + + + + 0 + 0 + + + @@ -114,18 +186,37 @@ - + + + + 0 + 0 + + Z min: - + + + + 0 + 0 + + + + + 20 + 0 + + + @@ -135,20 +226,20 @@ - - - - - - Qt::Horizontal + + + + 0 + 0 + - + - 60 - 20 + 0 + 0 - + @@ -157,7 +248,7 @@ - 60 + 20 20 @@ -180,7 +271,7 @@ 10 - 170 + 100 571 61 @@ -188,48 +279,19 @@ 2D Plot Options + + false + 10 20 - 551 + 585 31 - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - @@ -237,20 +299,36 @@ - + Contour - + Log Scale (Z) + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 250 + 20 + + + + @@ -258,7 +336,7 @@ 10 - 90 + 20 571 61 @@ -266,17 +344,40 @@ 1D Plot Options + + false + 10 20 - 551 - 31 + 658 + 30 + + + false + + + Log Scale (Z) + + + + + + + false + + + Superimpose + + + + Qt::Horizontal @@ -286,7 +387,7 @@ - 430 + 295 20 @@ -295,76 +396,43 @@ - + - 10 - 10 - 571 - 61 + 610 + 22 + 121 + 71 - - Plot Options - - - - - 10 - 20 - 551 - 31 - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 10 - 20 - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 300 - 20 - - - - - - - - Clone - - - - - - - Close All Clones - - - - - + + + + + + 0 + 0 + + + + Clone + + + + + + + + 0 + 0 + + + + Close All Clones + + + + diff --git a/slsDetectorGui/forms/form_tab_settings.ui b/slsDetectorGui/forms/form_tab_settings.ui index 779aaa9d2..3e6430581 100644 --- a/slsDetectorGui/forms/form_tab_settings.ui +++ b/slsDetectorGui/forms/form_tab_settings.ui @@ -6,37 +6,108 @@ 0 0 - 952 - 445 + 748 + 339 + + + 0 + 0 + + - 952 - 445 + 0 + 0 - 952 - 445 + 1000 + 1000 Form - + - 333 - 161 - 75 - 25 + 13 + 16 + 227 + 47 - - PushButton - + + + + + Settings: + + + + + + + + 0 + 0 + + + + Settings of the detector. + #settings# + + + + Standard + + + + + Fast + + + + + High Gain + + + + + Dynamic Gain + + + + + Low Gain + + + + + Medium Gain + + + + + Very High Gain + + + + + Undefined + + + + + Uninitialized + + + + + diff --git a/slsDetectorGui/include/qDetectorMain.h b/slsDetectorGui/include/qDetectorMain.h index 1568303c7..7d8f661c2 100644 --- a/slsDetectorGui/include/qDetectorMain.h +++ b/slsDetectorGui/include/qDetectorMain.h @@ -60,10 +60,14 @@ private: /**Tab Widget */ QTabWidget *tabs; - static const int NUMBER_OF_TABS = 8; + /** height of Plot Window when undocked */ + int heightPlotWindow; + + /** enumeration of the tabs */ + enum {Measurement, DataOutput, Plot, Actions, Settings, Advanced, Debugging, Developer, NumberOfTabs }; /* Scroll Area for the tabs**/ - QScrollArea *scroll[NUMBER_OF_TABS]; + QScrollArea *scroll[NumberOfTabs]; QScrollArea *scrollMain; /**Measurement tab */ qTabMeasurement *tab_measurement; @@ -73,18 +77,15 @@ private: qTabPlot *tab_plot; /**Actions tab */ qTabActions *tab_actions; + /**Settings tab */ + qTabSettings *tab_settings; /**Advanced tab */ qTabAdvanced *tab_advanced; - /**Settings tab */ - qTabSettings *tab_Settings; /**Debugging tab */ qTabDebugging *tab_debugging; /**Developer tab */ qTabDeveloper *tab_developer; - /** enumeration of the tabs */ - enum {Measurement, DataOutput, Plot, Actions, Advanced, Settings, Debugging, Developer }; - /**Sets up the layout of the widget */ @@ -153,6 +154,16 @@ void Version(); /** Executing About */ void About(); +/** Resizes the main window if the plot is docked/undocked + * @param b bool TRUE if undocked(outside main window), FALSE docked + */ +void ResizeMainWindow(bool b); + +/** Sets the Size of the undocked/docked terminal window + * @param b bool TRUE if undocked(outside main window), FALSE docked + */ +void SetTerminalWindowSize(bool b); + signals: diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index 8401e2e1f..890f285b9 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -7,8 +7,7 @@ #ifndef QDRAWPLOT_H #define QDRAWPLOT_H -/** Form Header */ -#include "ui_form_drawplot.h" + /** Project Class Headers */ class slsDetectorUtils; /** Qt Project Class Headers */ @@ -17,13 +16,17 @@ class SlsQt1DPlot; class SlsQt2DPlotLayout; class qCloneWidget; /** Qt Include Headers */ -class QTimer; -class QGridLayout; + +#include +#include +#include +#include + /** *@short Sets up the plot widget */ -class qDrawPlot:public QWidget, private Ui::DrawPlotObject{ +class qDrawPlot:public QWidget{ Q_OBJECT public: @@ -41,36 +44,12 @@ public: */ void StartStopDaqToggle(bool stop_if_running=0); -public slots: -/** To select 1D or 2D plot - * @param i is 1 for 1D, else 2D plot - */ -void SelectPlot(int i=2); - -/** To select 1D plot - */ -void Select1DPlot() {SelectPlot(1);} - -/** To select 2D plot - */ -void Select2DPlot() {SelectPlot(2);} - -/** To clear plot - */ -void Clear1DPlot(); - -/** Creates a clone of the plot - * */ -void ClonePlot(); - -/** Closes all the clone plots - * */ -void CloseClones(); - - private: /** The sls detector object */ slsDetectorUtils *myDet; + + /** Number of Measurements */ + int numberOfMeasurements; /** Number of Exposures */ int number_of_exposures; /** Duration between Exposures */ @@ -79,16 +58,22 @@ private: double acquisitionTime; /** Widgets needed to plot the clone */ + /** Max Number of Clone Windows */ static const int MAXCloneWindows = 50; - /** */ + /** Array of clone window widget pointers */ qCloneWidget *winClone[MAXCloneWindows]; - /** */ + +/** Widgets needed to set up plot*/ + QGroupBox *boxPlot; + QGridLayout *layout; + QGridLayout *plotLayout; + /** Timer to update plot */ QTimer* plot_update_timer; - /** */ + /** 1D object */ SlsQt1DPlot* plot1D; - /** */ + /** 2D object */ SlsQt2DPlotLayout* plot2D; - /** */ + /** 1D hist values */ QVector plot1D_hists; @@ -99,37 +84,37 @@ private: pthread_mutex_t last_image_complete_mutex; /**variables for histograms */ - /** */ + /** 1D or 2D */ unsigned int plot_in_scope; - /** */ + /** Current Image Number */ unsigned int lastImageNumber; - /** */ + /** Title in 2D */ std::string imageTitle; - /** */ + /** X Axis Title in 2D */ std::string imageXAxisTitle; - /** */ + /** Y Axis Title in 2D */ std::string imageYAxisTitle; - /** */ + /** Z Axis Title in 2D */ std::string imageZAxisTitle; - /** */ + /** Number of Pixels in X Axis */ unsigned int nPixelsX; - /** */ + /** Number of Pixels in Y Axis */ unsigned int nPixelsY; - /** */ + /** Current Image Values in 1D */ double* lastImageArray; - /** */ + /** Number of graphs in 1D */ unsigned int nHists; - /** */ + /** Title for all the graphs in 1D */ std::string histTitle[10]; - /** */ + /** X Axis Title in 1D */ std::string histXAxisTitle; - /** */ + /** Y Axis Title in 1D */ std::string histYAxisTitle; - /** */ + /** Total Number of X axis values/channels in 1D */ int histNBins; - /** */ + /** X Axis value in 1D */ double* histXAxis; - /** */ + /** Y Axis value in 1D */ double* histYAxis[10]; @@ -196,6 +181,40 @@ private: void* AcquireImages(); + +public slots: +/** Set number of measurements + * @param num number of measurements to be set + */ +void setNumMeasurements(int num); + +/** To select 1D or 2D plot + * @param i is 1 for 1D, else 2D plot + */ +void SelectPlot(int i=2); + +/** To select 1D plot + */ +void Select1DPlot() {SelectPlot(1);} + +/** To select 2D plot + */ +void Select2DPlot() {SelectPlot(2);} + +/** To clear plot + */ +void Clear1DPlot(); + +/** Creates a clone of the plot + * */ +void ClonePlot(); + +/** Closes all the clone plots + * */ +void CloseClones(); + + + private slots: /** To update plot */ diff --git a/slsDetectorGui/include/qTabMeasurement.h b/slsDetectorGui/include/qTabMeasurement.h index e4df24797..2cc07f134 100644 --- a/slsDetectorGui/include/qTabMeasurement.h +++ b/slsDetectorGui/include/qTabMeasurement.h @@ -44,6 +44,8 @@ private: /** The Plot widget */ qDrawPlot *myPlot; + enum{None, Auto, Gated, Trigger_Exp_Series, Trigger_Frame, Trigger_Readout, Gated_Start, Trigger_Window, NumTimingModes}; + /** methods */ /** Sets up the widget @@ -51,8 +53,16 @@ private: void SetupWidgetWindow(); /** Sets up all the slots and signals + * @param timingChange only some of the signals are disconnected when timing mode is changed + * This method is to reconnect them again. */ - void Initialization(); + void Initialization(int timingChange=0); + + /** Disconnects all the slots and signals (which depend on timing mode) + * to retrieve all the parameters from client. + * This is done only when Timing mode is changed + */ + void DeInitialization(); /** Enables/Disables all the widgets */ @@ -66,24 +76,9 @@ public slots: void UpdateFinished(); + + private slots: -/** Set settings according to selection - * @param index index of selection - */ -void setSettings(int index); -/** Set number of frames - * @param val number of frames to be set - */ -void setNumFrames(int val); - -/** Set acquisition time - */ -void setAcquisitionTime(); - -/** Set frame period between exposures - */ -void setFramePeriod(); - /** Set file name * @param fName name of file */ @@ -98,6 +93,44 @@ void setRunIndex(int index); */ void startStopAcquisition(); +/** Sets the timing mode + * @ param mode cane be None, Auto, Gated, Trigger Exposure Series, + * Trigger Frame, Trigger Readout, External Trigger Window + */ +void setTimingMode(int mode); + +/** Set number of frames + * @param val number of frames to be set + */ +void setNumFrames(int val); + +/** Set acquisition time + */ +void setExposureTime(); + +/** Set frame period between exposures + */ +void setAcquisitionPeriod(); + +/** Set number of triggers + * @param val number of triggers to be set + */ +void setNumTriggers(int val); + +/** Set delay + */ +void setDelay(); + +/** Set number of gates + * @param val number of gates to be set + */ +void setNumGates(int val); + +/** Set number of probes + * @param val number of probes to be set + */ +void setNumProbes(int val); + signals: diff --git a/slsDetectorGui/include/qTabPlot.h b/slsDetectorGui/include/qTabPlot.h index e5b2bedb9..b385f39c9 100644 --- a/slsDetectorGui/include/qTabPlot.h +++ b/slsDetectorGui/include/qTabPlot.h @@ -41,7 +41,6 @@ private: /** The Plot widget */ qDrawPlot *myPlot; - /** methods */ /** Sets up the widget */ diff --git a/slsDetectorGui/include/qTabSettings.h b/slsDetectorGui/include/qTabSettings.h index 3424d0129..c83c77b1b 100644 --- a/slsDetectorGui/include/qTabSettings.h +++ b/slsDetectorGui/include/qTabSettings.h @@ -47,6 +47,13 @@ private: */ void Enable(bool enable); + +private slots: +/** Set settings according to selection + * @param index index of selection + */ +void setSettings(int index); + }; diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index a10917037..0b858394a 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -81,7 +81,6 @@ HEADERS = \ FORMS = \ forms/form_detectormain.ui\ - forms/form_drawplot.ui\ forms/form_tab_measurement.ui\ forms/form_tab_dataoutput.ui\ forms/form_tab_plot.ui\ diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index ecc465456..a524d458b 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -14,6 +14,7 @@ #include "multiSlsDetector.h" #include "sls_detector_defs.h" /** Qt Include Headers */ +#include /** C++ Include Headers */ #include #include @@ -34,13 +35,22 @@ int main (int argc, char **argv) { -qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app, QWidget *parent) : QMainWindow(parent), theApp(app),myPlot(NULL),tabs(NULL){ +qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app, QWidget *parent) : + QMainWindow(parent), theApp(app),myPlot(NULL),tabs(NULL){ myDet = 0; setupUi(this); SetUpWidgetWindow(); Initialization(); SetDeveloperMode(); /**need to use argc and argv to determine which slsdet or multidet to use.*/ + + if(argc>1){ + if(!strcasecmp(argv[1],"-developer")) + tabs->setTabEnabled(Developer,true); + else + tabs->setTabEnabled(Developer,false); + } + } @@ -68,7 +78,8 @@ void qDetectorMain::SetUpWidgetWindow(){ SetUpDetector(); /** plot setup*/ - myPlot = new qDrawPlot(framePlot,myDet); + myPlot = new qDrawPlot(dockWidgetPlot,myDet); + dockWidgetPlot->setWidget(myPlot); /**tabs setup*/ tabs = new QTabWidget(this); @@ -78,12 +89,12 @@ void qDetectorMain::SetUpWidgetWindow(){ tab_dataoutput = new qTabDataOutput (this, myDet); tab_plot = new qTabPlot (this, myDet,myPlot); tab_actions = new qTabActions (this, myDet); + tab_settings = new qTabSettings (this, myDet); tab_advanced = new qTabAdvanced (this, myDet); - tab_Settings = new qTabSettings (this, myDet); tab_debugging = new qTabDebugging (this, myDet); tab_developer = new qTabDeveloper (this, myDet); /** creating the scroll area widgets for the tabs */ - for(int i=0;isetFrameShape(QFrame::NoFrame); } @@ -92,8 +103,8 @@ void qDetectorMain::SetUpWidgetWindow(){ scroll[DataOutput] ->setWidget(tab_dataoutput); scroll[Plot] ->setWidget(tab_plot); scroll[Actions] ->setWidget(tab_actions); + scroll[Settings] ->setWidget(tab_settings); scroll[Advanced] ->setWidget(tab_advanced); - scroll[Settings] ->setWidget(tab_Settings); scroll[Debugging] ->setWidget(tab_debugging); scroll[Developer] ->setWidget(tab_developer); /** inserting all the tabs*/ @@ -101,8 +112,8 @@ void qDetectorMain::SetUpWidgetWindow(){ tabs->insertTab(DataOutput, scroll[DataOutput], "Data Output"); tabs->insertTab(Plot, scroll[Plot], "Plot"); tabs->insertTab(Actions, scroll[Actions], "Actions"); - tabs->insertTab(Advanced, scroll[Advanced], "Advanced"); tabs->insertTab(Settings, scroll[Settings], "Settings"); + tabs->insertTab(Advanced, scroll[Advanced], "Advanced"); tabs->insertTab(Debugging, scroll[Debugging], "Debugging"); tabs->insertTab(Developer, scroll[Developer], "Developer"); @@ -117,6 +128,8 @@ void qDetectorMain::SetUpWidgetWindow(){ void qDetectorMain::SetUpDetector(){ + + /**instantiate detector and set window title*/ myDet = new multiSlsDetector(Detector_Index); if(!myDet->getHostname(Detector_Index).length()){ @@ -138,7 +151,9 @@ void qDetectorMain::SetUpDetector(){ void qDetectorMain::Initialization(){ - +/** Dockable Plot*/ + connect(dockWidgetPlot,SIGNAL(topLevelChanged(bool)),this,SLOT(ResizeMainWindow(bool))); + connect(dockWidgetTerminal,SIGNAL(topLevelChanged(bool)),this,SLOT(SetTerminalWindowSize(bool))); /** tabs */ connect(tabs,SIGNAL(currentChanged(int)),this, SLOT(refresh(int)));//( QWidget*))); @@ -170,6 +185,8 @@ void qDetectorMain::Initialization(){ connect(actionAbout,SIGNAL(triggered()),this,SLOT(About())); connect(actionVersion,SIGNAL(triggered()),this,SLOT(Version())); + heightPlotWindow = dockWidgetPlot->size().height(); + } @@ -200,7 +217,6 @@ void qDetectorMain::SetExpertMode(bool b){ #endif //threshold part in measu is enabled tabs->setTabEnabled(Advanced,b); - tabs->setTabEnabled(Settings,b); tab_advanced->setEnabled(b); } @@ -217,12 +233,16 @@ void qDetectorMain::refresh(int index){ void qDetectorMain::SetDockableMode(bool b){ #ifdef VERBOSE - cout<<"Setting Dockable Plot Mode to "<setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable); - else + if(b){ + dockWidgetPlot->setFeatures(QDockWidget::DockWidgetFloatable); + dockWidgetTerminal->setFeatures(QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetVerticalTitleBar); + + }else{ dockWidgetPlot->setFeatures(QDockWidget::NoDockWidgetFeatures); + dockWidgetTerminal->setFeatures(QDockWidget::DockWidgetVerticalTitleBar); + } } @@ -289,3 +309,36 @@ void qDetectorMain::About(){ #endif } + +void qDetectorMain::ResizeMainWindow(bool b){ +#ifdef VERBOSE + cout<<"Resizing Main Window: height:"<minimumWidth()<minimumHeight()<setMinimumWidth(width()/2); + } + //dockWidgetTerminal->setFixedSize(width()/2,dockWidgetTerminal->minimumHeight()); + + else{ + dockWidgetTerminal->setMinimumWidth(38); + QSizePolicy sizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred); + dockWidgetTerminal->setSizePolicy(sizePolicy); + //dockWidgetTerminal->setSizePolicy(new QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding)); + //dockWidgetTerminal->setFixedSize(dockWidgetTerminal->minimumWidth(),dockWidgetTerminal->minimumHeight()); + } +} diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index bf496c9d3..37ac85fd8 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -13,7 +13,7 @@ #include "slsDetector.h" #include "multiSlsDetector.h" /** Qt Include Headers */ -#include +#include /** C++ Include Headers */ #include #include @@ -23,9 +23,8 @@ using namespace std; #define Detector_Index 0 -qDrawPlot::qDrawPlot(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){ +qDrawPlot::qDrawPlot(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector),numberOfMeasurements(1){ if(myDet) { - setupUi(this); Initialization(); SetupWidgetWindow(); StartStopDaqToggle(); //as default @@ -36,15 +35,11 @@ qDrawPlot::qDrawPlot(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent qDrawPlot::~qDrawPlot(){ /** Clear plot*/ Clear1DPlot(); - for(QVector::iterator h = plot1D_hists.begin();h!=plot1D_hists.end();h++){ + for(QVector::iterator h = plot1D_hists.begin();h!=plot1D_hists.end();h++) delete *h; - } plot1D_hists.clear(); - - delete[] lastImageArray; lastImageArray=0; StartOrStopThread(0); - /** delete detector object pointer*/ delete myDet; } @@ -77,6 +72,13 @@ void qDrawPlot::Initialization(){ void qDrawPlot::SetupWidgetWindow(){ + /** Setting up window*/ + setFont(QFont("Sans Serif",9)); + layout = new QGridLayout; + boxPlot = new QGroupBox("Start Image"); + layout->addWidget(boxPlot,1,1); + this->setLayout(layout); + plot_update_timer = new QTimer(this); connect(plot_update_timer, SIGNAL(timeout()), this, SLOT(UpdatePlot())); @@ -224,6 +226,7 @@ void* qDrawPlot::AcquireImages(){ //cout<<"filePath:"< + /** C++ Include Headers */ #include using namespace std; @@ -22,7 +25,8 @@ using namespace std; -qTabMeasurement::qTabMeasurement(QWidget *parent,slsDetectorUtils*& detector, qDrawPlot*& plot):QWidget(parent),myDet(detector),myPlot(plot){ +qTabMeasurement::qTabMeasurement(QWidget *parent,slsDetectorUtils*& detector, qDrawPlot*& plot): + QWidget(parent),myDet(detector),myPlot(plot){ setupUi(this); if(myDet) { @@ -43,63 +47,169 @@ qTabMeasurement::~qTabMeasurement(){ void qTabMeasurement::SetupWidgetWindow(){ - /** all set initially to reflect the detector's actual parameter values*/ - /** Settings */ - comboSettings->setCurrentIndex(myDet->getSettings(Detector_Index)); //set it to default acc to detector??? - /** Number of Measurements/Frames*/ - setNumFrames(2000); - /** Acquisition Time */ - setAcquisitionTime(); - /** Frame Period between exposures*/ - setFramePeriod(); - /** File Name*/ - setFileName("run"); - /** File Index*/ - setRunIndex(0); + /** File Name **/ + dispFileName->setText(QString(myDet->getFileName().c_str())); + /** File Index **/ + spinIndex->setValue(myDet->getFileIndex()); + /** only initially **/ + lblProgressIndex->setText(QString::number(myDet->getFileIndex())); + + /** Enabling/Disabling depending on the detector type*/ + QStandardItemModel* model = qobject_cast(comboTimingMode->model()); + QModelIndex index[NumTimingModes]; + QStandardItem* item[NumTimingModes]; + if (model) { + for(int i=0;iindex(i, comboTimingMode->modelColumn(), comboTimingMode->rootModelIndex()); + item[i] = model->itemFromIndex(index[i]); + } + + switch(myDet->getDetectorsType()){ + case slsDetectorDefs::MYTHEN: + item[(int)Gated]->setEnabled(true); + item[(int)Trigger_Exp_Series]->setEnabled(true); + item[(int)Trigger_Frame]->setEnabled(false); + item[(int)Trigger_Readout]->setEnabled(true); + item[(int)Gated_Start]->setEnabled(true); + item[(int)Trigger_Window]->setEnabled(false); + break; + case slsDetectorDefs::EIGER: + item[(int)Gated]->setEnabled(false); + item[(int)Trigger_Exp_Series]->setEnabled(true); + item[(int)Trigger_Frame]->setEnabled(true); + item[(int)Trigger_Readout]->setEnabled(false); + item[(int)Gated_Start]->setEnabled(false); + item[(int)Trigger_Window]->setEnabled(true); + break; + case slsDetectorDefs::GOTTHARD: + item[(int)Gated]->setEnabled(false); + item[(int)Trigger_Exp_Series]->setEnabled(true); + item[(int)Trigger_Frame]->setEnabled(false); + item[(int)Trigger_Readout]->setEnabled(false); + item[(int)Gated_Start]->setEnabled(false); + item[(int)Trigger_Window]->setEnabled(false); + break; +/* case slsDetectorDefs::PICASSO: + case slsDetectorDefs::PILATUS: + case slsDetectorDefs::AGIPD:*/ + default: + cout<<"ERROR: Detector Type is Generic"<setEnabled(enable); + gridLayout->setEnabled(enable); + boxProgress->setEnabled(enable); + /** Enable this always **/ + if(!enable) btnStartStop->setEnabled(true); +} + + + + +void qTabMeasurement::UpdateFinished(){ + disconnect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); + btnStartStop->setText("Start"); + Enable(1); connect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); } - -//enabled other tabs as well?? -void qTabMeasurement::Enable(bool enable){ - //this->setEnabled(enable); - comboSettings->setEnabled(enable); - spinNumMeasurements->setEnabled(enable); - spinExpTime->setEnabled(enable); - comboExpUnit->setEnabled(enable); - spinPeriod->setEnabled(enable); - comboPeriodUnit->setEnabled(enable); - dispFileName->setEnabled(enable); - spinIndex->setEnabled(enable); - if(!enable) btnStartStop->setEnabled(true); +void qTabMeasurement::setFileName(const QString& fName){ + // emit fileNameChanged(fName); + // thred-->fileName=s;myDet->setFileName(fName.ascii()); + myDet->setFileName(fName.toAscii().data()); +#ifdef VERBOSE + cout<<"Setting File name to " << myDet->getFileName()<setFileIndex(index); +#ifdef VERBOSE + cout<<"Setting File Index to " << myDet->getFileIndex()<text().compare("Start")){ #ifdef VERBOSE @@ -118,33 +228,20 @@ void qTabMeasurement::startStopAcquisition(){ } -void qTabMeasurement::UpdateFinished(){ - disconnect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); - btnStartStop->setText("Start"); - Enable(1); - connect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); -} - -void qTabMeasurement::setSettings(int index){ - slsDetectorDefs::detectorSettings sett = myDet->setSettings((slsDetectorDefs::detectorSettings)index,Detector_Index); -#ifdef VERBOSE - cout<<"Settings have been set to "<slsDetectorBase::getDetectorSettings(sett)<setTimer(slsDetectorDefs::FRAME_NUMBER,val); #ifdef VERBOSE - cout<<"Setting Frame number to " << (int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1)<setTimer(slsDetectorDefs::FRAME_NUMBER,-1)<currentIndex(),spinExpTime->value()); #ifdef VERBOSE cout<<"Setting acquisition time to " << exptime64 << " clocks" << endl; @@ -157,9 +254,9 @@ void qTabMeasurement::setAcquisitionTime(){ -void qTabMeasurement::setFramePeriod(){ +void qTabMeasurement::setAcquisitionPeriod(){ int64_t exptime64; - /** Get the 64 bit value of timer*/ + /** Get the 64 bit value of timer**/ exptime64 = qDefs::get64bTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value()); #ifdef VERBOSE cout<<"Setting frame period between exposures to " << exptime64 << " clocks" << endl; @@ -172,24 +269,210 @@ void qTabMeasurement::setFramePeriod(){ -void qTabMeasurement::setFileName(const QString& fName){ - // emit fileNameChanged(fName); - // thred-->fileName=s;myDet->setFileName(fName.ascii()); + + +void qTabMeasurement::setNumTriggers(int val){ + myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,val); #ifdef VERBOSE - cout<<"Setting File name to " << myDet->getFileName()<setFileName(fName.toAscii().data()); -} - - - - -void qTabMeasurement::setRunIndex(int index){ - myDet->setFileIndex(index); -#ifdef VERBOSE - cout<<"Setting File Index to " << myDet->getFileIndex()<setTimer(slsDetectorDefs::CYCLES_NUMBER,-1)<currentIndex(),spinDelay->value()); +#ifdef VERBOSE + cout<<"Setting delay after trigger to " << exptime64 << " clocks" << endl; +#endif + myDet->setTimer(slsDetectorDefs::DELAY_AFTER_TRIGGER,exptime64); +} + + + + +void qTabMeasurement::setNumGates(int val){ + myDet->setTimer(slsDetectorDefs::GATES_NUMBER,val); +#ifdef VERBOSE + cout<<"Setting number of gates to " << (int)myDet->setTimer(slsDetectorDefs::GATES_NUMBER,-1)<setTimer(slsDetectorDefs::PROBES_NUMBER,val); +#ifdef VERBOSE + cout<<"Setting number of frames to " << (int)myDet->setTimer(slsDetectorDefs::PROBES_NUMBER,-1)<currentText().toAscii().data()<setEnabled(false); spinNumFrames->setEnabled(false); + lblExpTime->setEnabled(false); spinExpTime->setEnabled(false); comboExpUnit->setEnabled(false); + lblPeriod->setEnabled(false); spinPeriod->setEnabled(false); comboPeriodUnit->setEnabled(false); + lblNumTriggers->setEnabled(false); spinNumTriggers->setEnabled(false); + lblDelay->setEnabled(false); spinDelay->setEnabled(false); comboDelayUnit->setEnabled(false); + lblNumGates->setEnabled(false); spinNumGates->setEnabled(false); + lblNumProbes->setEnabled(false); spinNumProbes->setEnabled(false); + break; + case Auto: + lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); + lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true); + lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true); + lblNumTriggers->setEnabled(false); spinNumTriggers->setEnabled(false); + lblDelay->setEnabled(false); spinDelay->setEnabled(false); comboDelayUnit->setEnabled(false); + lblNumGates->setEnabled(false); spinNumGates->setEnabled(false); + break; + case Gated: + lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); + lblExpTime->setEnabled(false); spinExpTime->setEnabled(false); comboExpUnit->setEnabled(false); + lblPeriod->setEnabled(false); spinPeriod->setEnabled(false); comboPeriodUnit->setEnabled(false); + lblNumTriggers->setEnabled(false); spinNumTriggers->setEnabled(false); + lblDelay->setEnabled(false); spinDelay->setEnabled(false); comboDelayUnit->setEnabled(false); + lblNumGates->setEnabled(true); spinNumGates->setEnabled(true); + break; + case Trigger_Exp_Series: + lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); + lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true); + lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true); + lblNumTriggers->setEnabled(true); spinNumTriggers->setEnabled(true); + lblDelay->setEnabled(true); spinDelay->setEnabled(true); comboDelayUnit->setEnabled(true); + lblNumGates->setEnabled(false); spinNumGates->setEnabled(false); + break; + case Trigger_Readout: + lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); + lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true); + lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true); + lblNumTriggers->setEnabled(false); spinNumTriggers->setEnabled(false); + lblDelay->setEnabled(true); spinDelay->setEnabled(true); comboDelayUnit->setEnabled(true); + lblNumGates->setEnabled(false); spinNumGates->setEnabled(false); + break; + case Gated_Start: + lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); + lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true); + lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true); + lblNumTriggers->setEnabled(true); spinNumTriggers->setEnabled(true); + lblDelay->setEnabled(false); spinDelay->setEnabled(false); comboDelayUnit->setEnabled(false); + lblNumGates->setEnabled(true); spinNumGates->setEnabled(true); + break; + case Trigger_Frame: + lblNumFrames->setEnabled(false); spinNumFrames->setEnabled(false); + lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true); + lblPeriod->setEnabled(false); spinPeriod->setEnabled(false); comboPeriodUnit->setEnabled(false); + lblNumTriggers->setEnabled(true); spinNumTriggers->setEnabled(true); + lblDelay->setEnabled(false); spinDelay->setEnabled(false); comboDelayUnit->setEnabled(false); + lblNumGates->setEnabled(false); spinNumGates->setEnabled(false); + break; + case Trigger_Window: + lblNumFrames->setEnabled(false); spinNumFrames->setEnabled(false); + lblExpTime->setEnabled(false); spinExpTime->setEnabled(false); comboExpUnit->setEnabled(false); + lblPeriod->setEnabled(false); spinPeriod->setEnabled(false); comboPeriodUnit->setEnabled(false); + lblNumTriggers->setEnabled(true); spinNumTriggers->setEnabled(true); + lblDelay->setEnabled(false); spinDelay->setEnabled(false); comboDelayUnit->setEnabled(false); + lblNumGates->setEnabled(false); spinNumGates->setEnabled(false); + break; + default: + cout<<"ERROR: Timing mode being set to other should never happen"<getDetectorsType()==slsDetectorDefs::MYTHEN){ + lblNumProbes->setEnabled(true); spinNumProbes->setEnabled(true); + }else{ + lblNumProbes->setEnabled(false); spinNumProbes->setEnabled(false); + } + } + + /** To disconnect all the signals before changing their values*/ + DeInitialization(); + + + float time; + int val; + /**Number of Frames */ + if(lblNumFrames->isEnabled()){ + val = (int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1); + spinNumFrames->setValue(val); +#ifdef VERBOSE + cout<<"Getting number of frames : " << val <isEnabled()){ + time = (float)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-9)); +#ifdef VERBOSE + cout<<"Getting acquisition time : " << time << "s" << endl; +#endif + spinExpTime->setValue(time); + comboExpUnit->setCurrentIndex(qDefs::SECONDS); + } + + /**Frame Period between exposures */ + if(lblPeriod->isEnabled()){ + time = (float)(myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,-1)*(1E-9)); +#ifdef VERBOSE + cout<<"Getting frame period between exposures : " << time << "s" << endl; +#endif + spinPeriod->setValue(time); + comboPeriodUnit->setCurrentIndex(qDefs::SECONDS); + } + + /**Number of Triggers */ + if(lblNumTriggers->isEnabled()){ + val = (int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1); + spinNumTriggers->setValue(val); +#ifdef VERBOSE + cout<<"Getting number of triggers : " << val <isEnabled()){ + time = (float)(myDet->setTimer(slsDetectorDefs::DELAY_AFTER_TRIGGER,-1)*(1E-9)); +#ifdef VERBOSE + cout<<"Getting delay after trigger : " << time << "s" << endl; +#endif + spinDelay->setValue(time); + comboDelayUnit->setCurrentIndex(qDefs::SECONDS); + } + + /**Number of Gates */ + if(lblNumGates->isEnabled()){ + val = (int)myDet->setTimer(slsDetectorDefs::GATES_NUMBER,-1); + spinNumGates->setValue(val); +#ifdef VERBOSE + cout<<"Getting number of gates : " << val <isEnabled()){ + val = (int)myDet->setTimer(slsDetectorDefs::PROBES_NUMBER,-1); + spinNumProbes->setValue(val); +#ifdef VERBOSE + cout<<"Getting number of probes : " << val <setEnabled(enable); + btnClone->setEnabled(enable); + btnCloseClones->setEnabled(enable); box1D->setEnabled(enable); box2D->setEnabled(enable); boxPlotAxis->setEnabled(enable); diff --git a/slsDetectorGui/src/qTabSettings.cpp b/slsDetectorGui/src/qTabSettings.cpp index c43c87676..316c2c76a 100644 --- a/slsDetectorGui/src/qTabSettings.cpp +++ b/slsDetectorGui/src/qTabSettings.cpp @@ -39,18 +39,29 @@ qTabSettings::~qTabSettings(){ void qTabSettings::SetupWidgetWindow(){ + /** Settings */ + comboSettings->setCurrentIndex(myDet->getSettings(Detector_Index)); } void qTabSettings::Initialization(){ + /** Settings */ + connect(comboSettings,SIGNAL(currentIndexChanged(int)),this,SLOT(setSettings(int))); } void qTabSettings::Enable(bool enable){ - //this->setEnabled(enable); - + comboSettings->setEnabled(enable); } +void qTabSettings::setSettings(int index){ + slsDetectorDefs::detectorSettings sett = myDet->setSettings((slsDetectorDefs::detectorSettings)index,Detector_Index); +#ifdef VERBOSE + cout<<"Settings have been set to "<slsDetectorBase::getDetectorSettings(sett)< Date: Tue, 29 May 2012 08:24:03 +0000 Subject: [PATCH 003/332] made some changes to make clone and main window resize plot git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@3 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_detectormain.ui | 21 +- slsDetectorGui/forms/form_tab_measurement.ui | 12 +- slsDetectorGui/forms/form_tab_plot.ui | 418 +++++++++++++++--- slsDetectorGui/include/qCloneWidget.h | 24 +- slsDetectorGui/include/qDetectorMain.h | 13 +- slsDetectorGui/include/qDrawPlot.h | 70 ++- slsDetectorGui/include/qTabPlot.h | 25 ++ .../include/SlsQt2DPlotLayout.h | 57 +-- .../src/SlsQt2DPlotLayout.cxx | 108 +---- slsDetectorGui/src/qCloneWidget.cpp | 75 +++- slsDetectorGui/src/qDetectorMain.cpp | 57 ++- slsDetectorGui/src/qDrawPlot.cpp | 151 ++++--- slsDetectorGui/src/qTabMeasurement.cpp | 42 +- slsDetectorGui/src/qTabPlot.cpp | 134 +++++- 14 files changed, 782 insertions(+), 425 deletions(-) diff --git a/slsDetectorGui/forms/form_detectormain.ui b/slsDetectorGui/forms/form_detectormain.ui index b67a0517d..59dee1c8b 100644 --- a/slsDetectorGui/forms/form_detectormain.ui +++ b/slsDetectorGui/forms/form_detectormain.ui @@ -57,21 +57,10 @@ - 1000 - 1000 + 524287 + 450 - - - - 0 - 0 - 754 - 368 - - - - @@ -321,8 +310,8 @@ Sans Serif 11 - 50 - false + 75 + true @@ -339,7 +328,7 @@ - + 0 0 diff --git a/slsDetectorGui/forms/form_tab_measurement.ui b/slsDetectorGui/forms/form_tab_measurement.ui index cab777bd6..b98832ec9 100644 --- a/slsDetectorGui/forms/form_tab_measurement.ui +++ b/slsDetectorGui/forms/form_tab_measurement.ui @@ -6,7 +6,7 @@ 0 0 - 734 + 718 339 @@ -153,9 +153,9 @@ 20 - 20 + 10 321 - 117 + 130 @@ -270,9 +270,9 @@ 390 - 20 + 11 322 - 312 + 321 @@ -788,7 +788,7 @@ 20 - 150 + 170 319 90 diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index 60ddea384..9b3c1d0fa 100644 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -6,10 +6,16 @@ 0 0 - 748 + 734 339 + + + 0 + 0 + + 0 @@ -29,8 +35,8 @@ 10 - 180 - 731 + 130 + 711 151 @@ -45,7 +51,7 @@ 10 20 - 712 + 691 121 @@ -97,6 +103,9 @@ 0 + + Qt::ImhDigitsOnly + @@ -220,6 +229,9 @@ + + true + Z max: @@ -227,6 +239,9 @@ + + true + 0 @@ -270,10 +285,10 @@ - 10 - 100 + 11 + 70 571 - 61 + 51 @@ -282,16 +297,16 @@ false - + - 10 + 8 20 - 585 - 31 + 551 + 22 - + @@ -314,16 +329,13 @@ - + Qt::Horizontal - - QSizePolicy::Fixed - - 250 + 40 20 @@ -336,11 +348,129 @@ 10 - 20 + 10 571 - 61 + 51 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + + + 183 + 183 + 183 + + + + + + + 171 + 171 + 171 + + + + + + + 179 + 179 + 179 + + + + + + + 154 + 154 + 154 + + + + + + 1D Plot Options @@ -352,83 +482,231 @@ 10 20 - 658 - 30 + 551 + 16 - - - false - + - Log Scale (Z) + - - - - false - + + + gridLayoutWidget_3 + btnClear + gridLayoutWidget_4 + + + + + 10 + 288 + 711 + 51 + + + + Save + + + + + 10 + 13 + 698 + 31 + + + + + - Superimpose + File Name: - - - - Qt::Horizontal + + + + 0 - - QSizePolicy::Fixed + + + + + + + true + + + + .gif + + + + + .pdf + + + + + .png + + + + + .gif+ + + + + + .jpg + + + + + .ps + + + + + .eps + + + + + .xpm + + + + + .C + + + + + + + + + + + 0 + 0 + - - - 295 - 20 - + + Qt::NoFocus - + + Save + + + + + + + Automatic File Name + + + + + + + Save All + + - + - 610 - 22 + 599 + 41 121 - 71 + 80 - - - - - - 0 - 0 - + + Clone + + + + + 10 + 10 + 101 + 71 + + + + + 9 + + + 9 + + + -1 + + + + + + 0 + 0 + + + + Qt::NoFocus + + + Clone Plot + + + + + + + + 0 + 0 + + + + Qt::NoFocus + + + Close All + + + + + + + + + + 600 + 16 + 121 + 21 + + + + + + + Qt::NoFocus - Clone - - - - - - - - 0 - 0 - - - - Close All Clones + Clear diff --git a/slsDetectorGui/include/qCloneWidget.h b/slsDetectorGui/include/qCloneWidget.h index af49e1bc1..191dddf11 100644 --- a/slsDetectorGui/include/qCloneWidget.h +++ b/slsDetectorGui/include/qCloneWidget.h @@ -14,6 +14,14 @@ class SlsQt2DPlotLayout; /** Qt Include Headers */ #include #include +#include +#include +#include +#include +#include +#include +#include +#include /** *@short Sets up the clone plot widget @@ -24,13 +32,16 @@ class qCloneWidget:public QFrame{ public: /** \short The constructor */ - qCloneWidget(QWidget *parent,int id,QSize fSize,int numDim,SlsQt1DPlot*& plot1D,SlsQt2DPlotLayout*& plot2D); + qCloneWidget(QWidget *parent,int id,QSize fSize,QString title,int numDim,SlsQt1DPlot*& plot1D,SlsQt2DPlotLayout*& plot2D); /** Destructor */ ~qCloneWidget(); + /** Get the 1D plot reference + */ + SlsQt1DPlot* Get1Dplot(){ return cloneplot1D;}; public slots: @@ -44,6 +55,17 @@ private: /** clone 2D Plot */ SlsQt2DPlotLayout* cloneplot2D; + QGridLayout *mainLayout; + QGroupBox *boxSave; + QWidget *horizontalLayoutWidget; + QHBoxLayout *layoutSave; + QLabel *lblFName; + QHBoxLayout *hLayoutSave; + QLineEdit *dispFName; + QComboBox *comboFormat; + QPushButton *btnSave; + QCheckBox *chkAutoFName; + QCheckBox *chkSaveAll; protected: void closeEvent(QCloseEvent* event); diff --git a/slsDetectorGui/include/qDetectorMain.h b/slsDetectorGui/include/qDetectorMain.h index 7d8f661c2..66d63e620 100644 --- a/slsDetectorGui/include/qDetectorMain.h +++ b/slsDetectorGui/include/qDetectorMain.h @@ -24,6 +24,7 @@ class slsDetectorUtils; #include "sls_detector_defs.h" /** Qt Include Headers */ #include +#include /** *@short Main window of the GUI. @@ -50,16 +51,14 @@ public: private: /** The Qt Application */ QApplication *theApp; - /** The sls detector object */ slsDetectorUtils *myDet; - /** The Plot widget */ qDrawPlot *myPlot; - /**Tab Widget */ QTabWidget *tabs; - + /**Layout of the central Widget */ + QGridLayout *layoutTabs; /** height of Plot Window when undocked */ int heightPlotWindow; @@ -68,7 +67,6 @@ private: /* Scroll Area for the tabs**/ QScrollArea *scroll[NumberOfTabs]; - QScrollArea *scrollMain; /**Measurement tab */ qTabMeasurement *tab_measurement; /**DataOutput tab */ @@ -99,9 +97,10 @@ private: */ void Initialization(); - /** Enables the developer tab + /** Sets/unsets the developer mode (developer tab) + * @param b bool TRUE sets, FALSE unsets\ */ - void SetDeveloperMode(); + void SetDeveloperMode(bool b); private slots: /** Sets/unsets the debug mode i.e. enables/disables the debug tab diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index 890f285b9..520e7ce55 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -21,6 +21,7 @@ class qCloneWidget; #include #include #include +#include /** @@ -44,6 +45,20 @@ public: */ void StartStopDaqToggle(bool stop_if_running=0); + /** sets plot Title */ + void SetPlotTitle(QString title) {boxPlot->setTitle(title);} + /** sets 1D X Axis Title */ + void SetHistXAxisTitle(QString title) {histXAxisTitle = title;} + /** sets 1D Y Axis Title */ + void SetHistYAxisTitle(QString title) {histYAxisTitle = title;} + /** sets 2D X Axis Title */ + void SetImageXAxisTitle(QString title) {imageXAxisTitle = title;} + /** sets 2D Y Axis Title */ + void SetImageYAxisTitle(QString title) {imageYAxisTitle = title;} + /** sets 2D Z Axis Title */ + void SetImageZAxisTitle(QString title) {imageZAxisTitle = title;} + + private: /** The sls detector object */ slsDetectorUtils *myDet; @@ -61,7 +76,7 @@ private: /** Max Number of Clone Windows */ static const int MAXCloneWindows = 50; /** Array of clone window widget pointers */ - qCloneWidget *winClone[MAXCloneWindows]; + qCloneWidget *winClone[MAXCloneWindows]; /** Widgets needed to set up plot*/ QGroupBox *boxPlot; @@ -69,13 +84,16 @@ private: QGridLayout *plotLayout; /** Timer to update plot */ QTimer* plot_update_timer; + + + /** 1D object */ SlsQt1DPlot* plot1D; /** 2D object */ SlsQt2DPlotLayout* plot2D; - /** 1D hist values */ + /** vector of 1D hist values */ QVector plot1D_hists; - + QVector cloneplot1D_hists; /**variables for threads */ /** */ @@ -91,11 +109,11 @@ private: /** Title in 2D */ std::string imageTitle; /** X Axis Title in 2D */ - std::string imageXAxisTitle; + QString imageXAxisTitle; /** Y Axis Title in 2D */ - std::string imageYAxisTitle; + QString imageYAxisTitle; /** Z Axis Title in 2D */ - std::string imageZAxisTitle; + QString imageZAxisTitle; /** Number of Pixels in X Axis */ unsigned int nPixelsX; /** Number of Pixels in Y Axis */ @@ -107,9 +125,9 @@ private: /** Title for all the graphs in 1D */ std::string histTitle[10]; /** X Axis Title in 1D */ - std::string histXAxisTitle; + QString histXAxisTitle; /** Y Axis Title in 1D */ - std::string histYAxisTitle; + QString histYAxisTitle; /** Total Number of X axis values/channels in 1D */ int histNBins; /** X Axis value in 1D */ @@ -123,46 +141,19 @@ private: /** */ int UnlockLastImageArray() {return pthread_mutex_unlock(&last_image_complete_mutex);} /** */ - SlsQt1DPlot* Get1DPlotPtr() {return plot1D;} - /** */ - SlsQt2DPlotLayout* Get2DPlotPtr() {return plot2D;} - /** */ int StartDaqForGui() {return StartOrStopThread(1) ? 1:0;} /** */ int StopDaqForGui() {return StartOrStopThread(0) ? 0:1;} - /** */ - unsigned int PlotInScope() {return plot_in_scope;} - /** */ - unsigned int GetLastImageNumber() {return lastImageNumber;} + /** */ const char* GetImageTitle() {return imageTitle.c_str();} /** */ - const char* GetImageXAxisTitle() {return imageXAxisTitle.c_str();} - /** */ - const char* GetImageYAxisTitle() {return imageYAxisTitle.c_str();} - /** */ - const char* GetImageZAxisTitle() {return imageZAxisTitle.c_str();} - /** */ - unsigned int GetNPixelsX() {return nPixelsX;} - /** */ - unsigned int GetNPixelsY() {return nPixelsY;} - /** */ - double* GetLastImageArray() {return lastImageArray;} - /** */ - unsigned int GetNHists() {return nHists;} - /** */ const char* GetHistTitle(int i) {return (i>=0&&i<10) ? histTitle[i].c_str():0;} //int for hist number /** */ - const char* GetHistXAxisTitle() {return histXAxisTitle.c_str();} - /** */ - const char* GetHistYAxisTitle() {return histYAxisTitle.c_str();} - /** */ - unsigned int GetHistNBins() {return histNBins;} - /** */ - double* GetHistXAxis() {return histXAxis;} - /** */ double* GetHistYAxis(int i) {return (i>=0&&i<10) ? histYAxis[i]:0;} //int for hist number + + /** Initializes all its members and the thread */ void Initialization(); @@ -229,6 +220,9 @@ void StopUpdatePlot(); */ void StartDaq(bool start); +/** To set the reference to zero after closing a clone + * @param id is the id of the clone + */ void CloneCloseEvent(int id); signals: diff --git a/slsDetectorGui/include/qTabPlot.h b/slsDetectorGui/include/qTabPlot.h index b385f39c9..3fed11e51 100644 --- a/slsDetectorGui/include/qTabPlot.h +++ b/slsDetectorGui/include/qTabPlot.h @@ -41,6 +41,15 @@ private: /** The Plot widget */ qDrawPlot *myPlot; + /** some Default Values */ + static QString defaultPlotTitle; + static QString defaultHistXAxisTitle; + static QString defaultHistYAxisTitle; + static QString defaultImageXAxisTitle; + static QString defaultImageYAxisTitle; + static QString defaultImageZAxisTitle; + + /** methods */ /** Sets up the widget */ @@ -63,6 +72,22 @@ public slots: private slots: +/** Selects the plot to display, enables/disables widgets + * @param b true to select plot dimension 1, else false to select 2D + */ +void Select1DPlot(bool b); + +/**Sets the titles in plot axis + */ +void SetTitles(); + +/** Enables/Sets Titles to default + */ +void EnableTitles(); + + + + signals: diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlotLayout.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlotLayout.h index 2f11bd8c3..1104daf3c 100644 --- a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlotLayout.h +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlotLayout.h @@ -1,58 +1,3 @@ - -/** - * @author Ian Johnson - * @version 1.0 - */ -/* - - -#ifndef SLSQT2DPLOTLAYOUT_H -#define SLSQT2DPLOTLAYOUT_H - -#include -#include -#include - -#include "SlsQtNumberEntry.h" -#include "SlsQt2DPlot.h" - -//class QGridLayout; -//class QToolbar; - - - -class SlsQt2DPlotLayout: public QGroupBox{ - Q_OBJECT - -public: - - SlsQt2DPlotLayout(QWidget * = NULL); - ~SlsQt2DPlotLayout(); - - SlsQt2DPlot* GetPlot() {return the_plot;} - void SetXTitle(QString st); - void SetYTitle(QString st); - void SetZTitle(QString st); - - void UpdateNKeepSetRangeIfSet(); - -private: - //QGridLayout* the_layout; - SlsQt2DPlot* the_plot; - //SlsQtNumberEntry* z_range_ne; - - void ConnectSignalsAndSlots(); - - public slots: - void SetZScaleToLog(bool yes); - void ResetRange(); -}; - -#endif -*/ - - - /** * @author Ian Johnson * @version 1.0 @@ -69,6 +14,7 @@ private: #include "SlsQt2DPlot.h" class QGridLayout; +class QString; @@ -102,6 +48,7 @@ private: public slots: void SetZScaleToLog(bool yes); void ResetRange(); +void SetTitle(QString st); signals: void InterpolateSignal(bool); diff --git a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx index 5205ae8e9..032ac27bb 100644 --- a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx +++ b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx @@ -1,105 +1,3 @@ -/** - * @author Ian Johnson - * @version 1.0 - */ -/* - - -#include - -#include -//#include -//#include - - -#include "SlsQt2DPlotLayout.h" - -using namespace std; - -SlsQt2DPlotLayout::SlsQt2DPlotLayout(QWidget *parent):QGroupBox(parent){ - //the_layout=0; - the_plot = new SlsQt2DPlot(this); - - // z_range_ne = new SlsQtNumberEntry(this,1,"Set the z axis range from",2,"to",2); - // z_range_ne->setFixedWidth(402); - - ConnectSignalsAndSlots(); -} - -SlsQt2DPlotLayout::~SlsQt2DPlotLayout(){ - - //if(the_layout) delete the_layout; - delete the_plot; - // delete z_range_ne; -} - - -void SlsQt2DPlotLayout::ConnectSignalsAndSlots(){ - connect(btnInterpolate, SIGNAL(toggled(bool)),the_plot, SLOT(InterpolatedPlot(bool))); - connect(btnContour, SIGNAL(toggled(bool)),the_plot, SLOT(showContour(bool))); - connect(btnLogz, SIGNAL(toggled(bool)),this,SLOT(SetZScaleToLog(bool))); - - connect(z_range_ne,SIGNAL(CheckBoxChanged(bool)),this,SLOT(ResetRange())); - connect(z_range_ne,SIGNAL(AValueChanged(SlsQtNumberEntry*)),this,SLOT(ResetRange())); - - btnInterpolate->setChecked(false); - btnContour->setChecked(false); - btnLogz->setChecked(false); - -} -void SlsQt2DPlotLayout::UpdateNKeepSetRangeIfSet(){ - if(z_range_ne->CheckBoxState()){ - //just reset histogram range before update - the_plot->SetZMinMax(z_range_ne->GetValue(0),z_range_ne->GetValue(1)); - } - - the_plot->Update(); -} - - -void SlsQt2DPlotLayout::ResetRange(){ - //refind z limits - the_plot->SetZMinMax(); - if(btnLogz->isChecked()) the_plot->SetZMinimumToFirstGreaterThanZero(); - - if(z_range_ne->CheckBoxState()){ - //first time check validity - bool same = (z_range_ne->GetValue(0)==z_range_ne->GetValue(1)) ? 1:0; - if(!z_range_ne->IsValueOk(0)||same) z_range_ne->SetValue(the_plot->GetZMinimum(),0); - if(!z_range_ne->IsValueOk(1)||same) z_range_ne->SetValue(the_plot->GetZMaximum(),1); - - z_range_ne->SetRange(the_plot->GetZMinimum(),z_range_ne->GetValue(1),0); - z_range_ne->SetRange(z_range_ne->GetValue(0),the_plot->GetZMaximum(),1); - - //set histogram range - the_plot->SetZMinMax(z_range_ne->GetValue(0),z_range_ne->GetValue(1)); - } - - the_plot->Update(); -} - - - -void SlsQt2DPlotLayout::SetZScaleToLog(bool yes){ - the_plot->LogZ(yes); - ResetRange(); -} - -void SlsQt2DPlotLayout::SetXTitle(QString st){ - GetPlot()->axisWidget(QwtPlot::xBottom)->setTitle(st); -} - -void SlsQt2DPlotLayout::SetYTitle(QString st){ - GetPlot()->axisWidget(QwtPlot::yLeft)->setTitle(st); -} - -void SlsQt2DPlotLayout::SetZTitle(QString st){ - GetPlot()->axisWidget(QwtPlot::yRight)->setTitle(st); -} -*/ - - - /** * @author Ian Johnson * @version 1.0 @@ -112,6 +10,7 @@ void SlsQt2DPlotLayout::SetZTitle(QString st){ #include #include #include +#include #include "SlsQt2DPlotLayout.h" @@ -147,8 +46,6 @@ void SlsQt2DPlotLayout::Layout(){ the_layout = new QGridLayout(this); the_layout->addWidget(the_plot,2,1,3,3); the_layout->addWidget(z_range_ne,5,1,1,3); - - the_layout->setMargin(12); } void SlsQt2DPlotLayout::ConnectSignalsAndSlots(){ @@ -210,3 +107,6 @@ void SlsQt2DPlotLayout::SetZTitle(QString st){ GetPlot()->axisWidget(QwtPlot::yRight)->setTitle(st); } +void SlsQt2DPlotLayout::SetTitle(QString st){ + setTitle(st); +} diff --git a/slsDetectorGui/src/qCloneWidget.cpp b/slsDetectorGui/src/qCloneWidget.cpp index 9fb205948..1a0d90a64 100644 --- a/slsDetectorGui/src/qCloneWidget.cpp +++ b/slsDetectorGui/src/qCloneWidget.cpp @@ -17,30 +17,97 @@ /** C++ Include Headers */ #include #include +#include using namespace std; -qCloneWidget::qCloneWidget(QWidget *parent,int id,QSize fSize,int numDim,SlsQt1DPlot*& plot1D,SlsQt2DPlotLayout*& plot2D):QFrame(parent,Qt::Popup|Qt::SubWindow),id(id){ +qCloneWidget::qCloneWidget(QWidget *parent,int id,QSize fSize,QString title,int numDim,SlsQt1DPlot*& plot1D,SlsQt2DPlotLayout*& plot2D):QFrame(parent,Qt::Popup|Qt::SubWindow),id(id){ + + + mainLayout = new QGridLayout(this); + setLayout(mainLayout); + + + QGroupBox *cloneBox = new QGroupBox(this); QGridLayout *gridClone = new QGridLayout(cloneBox); cloneBox->setLayout(gridClone); - cloneBox->setFlat(1); - cloneBox->setTitle("Startup Image"); cloneBox->resize(fSize); - + cloneBox->setTitle(title); + cloneBox->setAlignment(Qt::AlignHCenter); + cloneBox->setFont(QFont("Sans Serif",11,QFont::Bold)); if(numDim==1){ cloneplot1D = plot1D; gridClone->addWidget(cloneplot1D,0,0); + cloneBox->setFlat(false); + }else{ cloneplot2D = plot2D; gridClone->addWidget(cloneplot2D,0,0); + cloneBox->setFlat(true); } +/* + boxSave = new QGroupBox(this); + layoutSave = new QHBoxLayout; + boxSave->setLayout(layoutSave); + + lblFName = new QLabel(layoutSave); + lblFName->setText("File Name:"); + layoutSave->addWidget(lblFName); + + + + hLayoutSave = new QHBoxLayout(); + hLayoutSave->setSpacing(0); + + dispFName = new QLineEdit(layoutSave); + hLayoutSave->addWidget(dispFName); + + comboFormat = new QComboBox(layoutSave); + comboFormat->setFrame(true); + comboFormat->insertItem(".gif"); + comboFormat->insertItem(".pdf"); + comboFormat->insertItem(".png"); + comboFormat->insertItem(".gif+"); + comboFormat->insertItem(".jpg"); + comboFormat->insertItem(".ps"); + comboFormat->insertItem(".eps"); + comboFormat->insertItem(".xpm"); + comboFormat->insertItem(".C"); + hLayoutSave->addWidget(comboFormat); + + layoutSave->addLayout(hLayoutSave); + + + btnSave = new QPushButton(layoutSave); + bnSave->setText("Save"); + QSizePolicy sizePolicy2(QSizePolicy::Fixed, QSizePolicy::Fixed); + sizePolicy2.setHeightForWidth(btnSave->sizePolicy().hasHeightForWidth()); + btnSave->setSizePolicy(sizePolicy2); + btnSave->setFocusPolicy(Qt::NoFocus); + layoutSave->addWidget(btnSave); + + chkAutoFName = new QCheckBox(layoutSave); + chkAutoFName->setText("Automatic File Name"); + layoutSave->addWidget(chkAutoFName); + + chkSaveAll = new QCheckBox(layoutSave); + chkSaveAll->setText("Save All") + layoutSave->addWidget(chkSaveAll); + + + + gridClone->addWidget(boxSave,0,0); + mainLayout->addWidget(boxSave,1,1);*/ + + mainLayout->addWidget(cloneBox,0,0); + } diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index a524d458b..b47612df3 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -41,20 +41,26 @@ qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app, QWidget * setupUi(this); SetUpWidgetWindow(); Initialization(); - SetDeveloperMode(); /**need to use argc and argv to determine which slsdet or multidet to use.*/ - if(argc>1){ - if(!strcasecmp(argv[1],"-developer")) - tabs->setTabEnabled(Developer,true); - else - tabs->setTabEnabled(Developer,false); + for(int iarg=1; iargsetFixedHeight(centralwidget->height()); } -//Qt::ScrollBarAsNeeded qDetectorMain::~qDetectorMain(){ @@ -70,13 +76,12 @@ qDetectorMain::~qDetectorMain(){ void qDetectorMain::SetUpWidgetWindow(){ -/* scrollMain = new QScrollArea; - setCentralWidget(scrollMain); - scrollMain ->setWidget(centralwidget); - scrollMain->setWidgetResizable(true);*/ - SetUpDetector(); +/** Layout */ + layoutTabs= new QGridLayout; + centralwidget->setLayout(layoutTabs); + /** plot setup*/ myPlot = new qDrawPlot(dockWidgetPlot,myDet); dockWidgetPlot->setWidget(myPlot); @@ -107,6 +112,7 @@ void qDetectorMain::SetUpWidgetWindow(){ scroll[Advanced] ->setWidget(tab_advanced); scroll[Debugging] ->setWidget(tab_debugging); scroll[Developer] ->setWidget(tab_developer); + /** inserting all the tabs*/ tabs->insertTab(Measurement, scroll[Measurement], "Measurement"); tabs->insertTab(DataOutput, scroll[DataOutput], "Data Output"); @@ -121,6 +127,8 @@ void qDetectorMain::SetUpWidgetWindow(){ SetDebugMode(false); SetBeamlineMode(false); SetExpertMode(false); + SetDeveloperMode(false); + } @@ -190,11 +198,11 @@ void qDetectorMain::Initialization(){ } -void qDetectorMain::SetDeveloperMode(){ +void qDetectorMain::SetDeveloperMode(bool b){ #ifdef VERBOSE - cout<<"Enabling Developer Mode "<setTabEnabled(Developer,true); + tabs->setTabEnabled(Developer,b); } @@ -314,31 +322,32 @@ void qDetectorMain::ResizeMainWindow(bool b){ #ifdef VERBOSE cout<<"Resizing Main Window: height:"<setMinimumHeight(0); + } + else{ setMaximumHeight(QWIDGETSIZE_MAX); + dockWidgetPlot->setMinimumHeight(heightPlotWindow); + + } + - cout<<"size hint ht:"<minimumWidth()<minimumHeight()<setMinimumWidth(width()/2); } - //dockWidgetTerminal->setFixedSize(width()/2,dockWidgetTerminal->minimumHeight()); else{ dockWidgetTerminal->setMinimumWidth(38); QSizePolicy sizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred); dockWidgetTerminal->setSizePolicy(sizePolicy); - //dockWidgetTerminal->setSizePolicy(new QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding)); - //dockWidgetTerminal->setFixedSize(dockWidgetTerminal->minimumWidth(),dockWidgetTerminal->minimumHeight()); } } diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 37ac85fd8..73e6dc70f 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -25,8 +25,8 @@ using namespace std; qDrawPlot::qDrawPlot(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector),numberOfMeasurements(1){ if(myDet) { - Initialization(); SetupWidgetWindow(); + Initialization(); StartStopDaqToggle(); //as default } } @@ -35,47 +35,44 @@ qDrawPlot::qDrawPlot(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent qDrawPlot::~qDrawPlot(){ /** Clear plot*/ Clear1DPlot(); - for(QVector::iterator h = plot1D_hists.begin();h!=plot1D_hists.end();h++) - delete *h; + for(QVector::iterator h = plot1D_hists.begin();h!=plot1D_hists.end();h++) delete *h; plot1D_hists.clear(); delete[] lastImageArray; lastImageArray=0; StartOrStopThread(0); - /** delete detector object pointer*/ delete myDet; + for(int i=0;isetAlignment(Qt::AlignHCenter); + boxPlot->setFont(QFont("Sans Serif",11,QFont::Bold)); + layout->addWidget(boxPlot,1,1); this->setLayout(layout); @@ -83,26 +80,28 @@ void qDrawPlot::SetupWidgetWindow(){ connect(plot_update_timer, SIGNAL(timeout()), this, SLOT(UpdatePlot())); plot1D = new SlsQt1DPlot(boxPlot); - plot1D->SetXTitle("x axis"); - plot1D->SetYTitle("y axis"); + plot1D->setFont(QFont("Sans Serif",9,QFont::Normal)); plot1D->hide(); plot2D = new SlsQt2DPlotLayout(boxPlot); - plot2D->SetXTitle("pixel"); - plot2D->SetYTitle("pixel"); - plot2D->SetZTitle("Intensity"); - boxPlot->setFlat(1); - boxPlot->setTitle("Startup Image"); + plot2D->setFont(QFont("Sans Serif",9,QFont::Normal)); + plot2D->setTitle("Start Image"); + plot2D->setAlignment(Qt::AlignLeft); + boxPlot->setFlat(true); + plotLayout = new QGridLayout(boxPlot); plotLayout->addWidget(plot1D,1,1,1,1); plotLayout->addWidget(plot2D,1,1,1,1); +} + + +void qDrawPlot::Initialization(){ connect(this, SIGNAL(InterpolateSignal(bool)), plot2D, SIGNAL(InterpolateSignal(bool))); connect(this, SIGNAL(ContourSignal(bool)), plot2D, SIGNAL(ContourSignal(bool))); connect(this, SIGNAL(LogzSignal(bool)), plot2D, SLOT(SetZScaleToLog(bool))); - } @@ -269,7 +268,7 @@ void* qDrawPlot::AcquireImages(){ if(!pthread_mutex_trylock(&last_image_complete_mutex)){ //plot_in_scope = 1;//i%2 + 1; - plot_in_scope = 2; + //plot_in_scope = 2; cout<<"value:"<show(); plot2D->hide(); + boxPlot->setFlat(false); + plot_in_scope=1; }else{ plot1D->hide(); plot2D->show(); + boxPlot->setFlat(true); + plot_in_scope=2; } } @@ -339,17 +337,17 @@ void qDrawPlot::UpdatePlot(){ LockLastImageArray(); //1-d plot stuff - if(GetHistNBins()){ - plot1D->SetXTitle(GetHistXAxisTitle()); - plot1D->SetYTitle(GetHistYAxisTitle()); - for(int hist_num=0;hist_numSetXTitle(histXAxisTitle.toAscii().constData()); + plot1D->SetYTitle(histYAxisTitle.toAscii().constData()); + for(int hist_num=0;hist_numplot1D_hists.size()){ - plot1D_hists.append(h=new SlsQtH1D("1d plot",GetHistNBins(),GetHistXAxis(),GetHistYAxis(hist_num))); + plot1D_hists.append(h=new SlsQtH1D("1d plot",histNBins,histXAxis,GetHistYAxis(hist_num))); h->SetLineColor(hist_num+1); }else{ h=plot1D_hists.at(hist_num); - h->SetData(GetHistNBins(),GetHistXAxis(),GetHistYAxis(hist_num)); + h->SetData(histNBins,histXAxis,GetHistYAxis(hist_num)); } h->setTitle(GetHistTitle(hist_num)); h->Attach(plot1D); @@ -359,23 +357,23 @@ void qDrawPlot::UpdatePlot(){ //2-d plot stuff static int last_plot_number = 0; - if(GetLastImageArray()){ - if(GetLastImageNumber()&&last_plot_number!=GetLastImageNumber() && //there is a new plot - GetNPixelsX()>0&&GetNPixelsY()>0){ - plot2D->GetPlot()->SetData(GetNPixelsX(),-0.5,GetNPixelsX()-0.5,GetNPixelsY(),-0.5,GetNPixelsY()-0.5,GetLastImageArray()); + if(lastImageArray){ + if(lastImageNumber&&last_plot_number!=lastImageNumber && //there is a new plot + nPixelsX>0&&nPixelsY>0){ + plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,-0.5,nPixelsY-0.5,lastImageArray); //as it inherits a widget - boxPlot->setTitle(GetImageTitle()); - plot2D->SetXTitle(GetImageXAxisTitle()); - plot2D->SetYTitle(GetImageYAxisTitle()); - plot2D->SetZTitle(GetImageZAxisTitle()); + plot2D->setTitle(GetImageTitle()); + plot2D->SetXTitle(imageXAxisTitle); + plot2D->SetYTitle(imageYAxisTitle); + plot2D->SetZTitle(imageZAxisTitle); plot2D->UpdateNKeepSetRangeIfSet(); //this will keep a "set" z range, and call Plot()->Update(); } } - last_plot_number=GetLastImageNumber(); + last_plot_number=lastImageNumber; UnlockLastImageArray(); - if(PlotInScope()==1) SelectPlot(1); - else if(PlotInScope()==2) SelectPlot(2); +/* if(plot_in_scope==1) SelectPlot(1); + else if(plot_in_scope==2) SelectPlot(2);*/ if(number_of_exposures==last_plot_number){ StartStopDaqToggle(1); @@ -407,13 +405,32 @@ void qDrawPlot::ClonePlot(){ exit(-1); } - winClone[i] = new qCloneWidget(this,i,boxPlot->size(),(int)PlotInScope(),plot1D,plot2D); - if(PlotInScope()==1) + winClone[i] = new qCloneWidget(this,i,boxPlot->size(),boxPlot->title(),(int)plot_in_scope,plot1D,plot2D); + if(plot_in_scope==1){ plot1D = new SlsQt1DPlot(boxPlot); - else + plot1D->setFont(QFont("Sans Serif",9,QFont::Normal)); + plotLayout->addWidget(plot1D,1,1,1,1); + /** Somehow the 1d plot hists are lost*/ + SlsQtH1D* h; + for(int hist_num=0;hist_numcloneplot1D_hists.size()){ + cloneplot1D_hists.append(k=new SlsQtH1D("1d plot",histNBins,histXAxis,GetHistYAxis(hist_num))); + k->SetLineColor(hist_num+1); + }else{ + k=cloneplot1D_hists.at(hist_num); + k->SetData(histNBins,histXAxis,GetHistYAxis(hist_num)); + } + k->setTitle(GetHistTitle(hist_num)); + k->Attach(winClone[i]->Get1Dplot()); + } + winClone[i]->Get1Dplot()->UnZoom(); + } + else{ plot2D = new SlsQt2DPlotLayout(boxPlot); - plotLayout->addWidget(plot1D,1,1,1,1); - plotLayout->addWidget(plot2D,1,1,1,1); + plot2D->setFont(QFont("Sans Serif",9,QFont::Normal)); + plotLayout->addWidget(plot2D,1,1,1,1); + } UpdatePlot(); connect(this, SIGNAL(InterpolateSignal(bool)), plot2D, SIGNAL(InterpolateSignal(bool))); connect(this, SIGNAL(ContourSignal(bool)), plot2D, SIGNAL(ContourSignal(bool))); diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 56fc17af4..53001766b 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -319,30 +319,27 @@ void qTabMeasurement::setTimingMode(int mode){ cout<<"Setting Timing mode to " << comboTimingMode->currentText().toAscii().data()<setEnabled(false); spinNumFrames->setEnabled(false); + lblExpTime->setEnabled(false); spinExpTime->setEnabled(false); comboExpUnit->setEnabled(false); + lblPeriod->setEnabled(false); spinPeriod->setEnabled(false); comboPeriodUnit->setEnabled(false); + lblNumTriggers->setEnabled(false); spinNumTriggers->setEnabled(false); + lblDelay->setEnabled(false); spinDelay->setEnabled(false); comboDelayUnit->setEnabled(false); + lblNumGates->setEnabled(false); spinNumGates->setEnabled(false); + lblNumProbes->setEnabled(false); spinNumProbes->setEnabled(false); + + switch(mode){ case None: - lblNumFrames->setEnabled(false); spinNumFrames->setEnabled(false); - lblExpTime->setEnabled(false); spinExpTime->setEnabled(false); comboExpUnit->setEnabled(false); - lblPeriod->setEnabled(false); spinPeriod->setEnabled(false); comboPeriodUnit->setEnabled(false); - lblNumTriggers->setEnabled(false); spinNumTriggers->setEnabled(false); - lblDelay->setEnabled(false); spinDelay->setEnabled(false); comboDelayUnit->setEnabled(false); - lblNumGates->setEnabled(false); spinNumGates->setEnabled(false); - lblNumProbes->setEnabled(false); spinNumProbes->setEnabled(false); break; case Auto: lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true); lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true); - lblNumTriggers->setEnabled(false); spinNumTriggers->setEnabled(false); - lblDelay->setEnabled(false); spinDelay->setEnabled(false); comboDelayUnit->setEnabled(false); - lblNumGates->setEnabled(false); spinNumGates->setEnabled(false); break; case Gated: lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); - lblExpTime->setEnabled(false); spinExpTime->setEnabled(false); comboExpUnit->setEnabled(false); - lblPeriod->setEnabled(false); spinPeriod->setEnabled(false); comboPeriodUnit->setEnabled(false); - lblNumTriggers->setEnabled(false); spinNumTriggers->setEnabled(false); - lblDelay->setEnabled(false); spinDelay->setEnabled(false); comboDelayUnit->setEnabled(false); lblNumGates->setEnabled(true); spinNumGates->setEnabled(true); break; case Trigger_Exp_Series: @@ -351,39 +348,26 @@ void qTabMeasurement::setTimingMode(int mode){ lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true); lblNumTriggers->setEnabled(true); spinNumTriggers->setEnabled(true); lblDelay->setEnabled(true); spinDelay->setEnabled(true); comboDelayUnit->setEnabled(true); - lblNumGates->setEnabled(false); spinNumGates->setEnabled(false); break; case Trigger_Readout: lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true); lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true); - lblNumTriggers->setEnabled(false); spinNumTriggers->setEnabled(false); lblDelay->setEnabled(true); spinDelay->setEnabled(true); comboDelayUnit->setEnabled(true); - lblNumGates->setEnabled(false); spinNumGates->setEnabled(false); break; case Gated_Start: lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true); lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true); lblNumTriggers->setEnabled(true); spinNumTriggers->setEnabled(true); - lblDelay->setEnabled(false); spinDelay->setEnabled(false); comboDelayUnit->setEnabled(false); lblNumGates->setEnabled(true); spinNumGates->setEnabled(true); break; case Trigger_Frame: - lblNumFrames->setEnabled(false); spinNumFrames->setEnabled(false); lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true); - lblPeriod->setEnabled(false); spinPeriod->setEnabled(false); comboPeriodUnit->setEnabled(false); lblNumTriggers->setEnabled(true); spinNumTriggers->setEnabled(true); - lblDelay->setEnabled(false); spinDelay->setEnabled(false); comboDelayUnit->setEnabled(false); - lblNumGates->setEnabled(false); spinNumGates->setEnabled(false); break; case Trigger_Window: - lblNumFrames->setEnabled(false); spinNumFrames->setEnabled(false); - lblExpTime->setEnabled(false); spinExpTime->setEnabled(false); comboExpUnit->setEnabled(false); - lblPeriod->setEnabled(false); spinPeriod->setEnabled(false); comboPeriodUnit->setEnabled(false); lblNumTriggers->setEnabled(true); spinNumTriggers->setEnabled(true); - lblDelay->setEnabled(false); spinDelay->setEnabled(false); comboDelayUnit->setEnabled(false); - lblNumGates->setEnabled(false); spinNumGates->setEnabled(false); break; default: cout<<"ERROR: Timing mode being set to other should never happen"<getDetectorsType()==slsDetectorDefs::MYTHEN){ - lblNumProbes->setEnabled(true); spinNumProbes->setEnabled(true); - }else{ - lblNumProbes->setEnabled(false); spinNumProbes->setEnabled(false); + lblNumProbes->setEnabled(true); spinNumProbes->setEnabled(true); } } diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index 0f7960ac2..be95ad67e 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -12,19 +12,30 @@ #include "slsDetector.h" #include "multiSlsDetector.h" /** C++ Include Headers */ -#include +#include +#include using namespace std; #define Detector_Index 0 +QString qTabPlot::defaultPlotTitle("Measurement"); +QString qTabPlot::defaultHistXAxisTitle("Channel Number"); +QString qTabPlot::defaultHistYAxisTitle("Counts"); +QString qTabPlot::defaultImageXAxisTitle("Pixel"); +QString qTabPlot::defaultImageYAxisTitle("Pixel"); +QString qTabPlot::defaultImageZAxisTitle("Intensity"); + qTabPlot::qTabPlot(QWidget *parent,slsDetectorUtils*& detector, qDrawPlot*& plot):QWidget(parent),myDet(detector),myPlot(plot){ setupUi(this); if(myDet) { - SetupWidgetWindow(); + // wherever you choose plot do all these steps + //This also selects the text if unchecked + //includes setupwidgetwindow + //SelectPlot(1); Initialization(); } } @@ -41,10 +52,51 @@ qTabPlot::~qTabPlot(){ void qTabPlot::SetupWidgetWindow(){ - box1D->setEnabled(false); +/** Plot Axis*/ + myPlot->SetPlotTitle(defaultPlotTitle); + dispTitle->setText(defaultPlotTitle); + dispTitle->setEnabled(false); + dispXAxis->setEnabled(false); + dispYAxis->setEnabled(false); + dispZAxis->setEnabled(false); + dispXMin->setEnabled(false); + dispYMin->setEnabled(false); + dispZMin->setEnabled(false); + dispXMax->setEnabled(false); + dispYMax->setEnabled(false); + dispZMax->setEnabled(false); } +void qTabPlot::Select1DPlot(bool b){ + SetupWidgetWindow(); + if(b){ + myPlot->Select1DPlot(); + box1D->setEnabled(true); + box2D->setEnabled(false); + chkZAxis->setEnabled(false); + chkZMin->setEnabled(false); + chkZMax->setEnabled(false); + myPlot->SetHistXAxisTitle(defaultHistXAxisTitle); + dispXAxis->setText(defaultHistXAxisTitle); + myPlot->SetHistYAxisTitle(defaultHistYAxisTitle); + dispYAxis->setText(defaultHistYAxisTitle); + }else{ + myPlot->Select2DPlot(); + box1D->setEnabled(false); + box2D->setEnabled(true); + chkZAxis->setEnabled(true); + chkZMin->setEnabled(true); + chkZMax->setEnabled(true); + myPlot->SetImageXAxisTitle(defaultImageXAxisTitle); + dispXAxis->setText(defaultImageXAxisTitle); + myPlot->SetImageYAxisTitle(defaultImageYAxisTitle); + dispYAxis->setText(defaultImageYAxisTitle); + myPlot->SetImageZAxisTitle(defaultImageZAxisTitle); + dispZAxis->setText(defaultImageZAxisTitle); + } +} + void qTabPlot::Initialization(){ /** Plot box*/ @@ -54,6 +106,21 @@ void qTabPlot::Initialization(){ connect(chkInterpolate, SIGNAL(toggled(bool)),myPlot, SIGNAL(InterpolateSignal(bool))); connect(chkContour, SIGNAL(toggled(bool)),myPlot, SIGNAL(ContourSignal(bool))); connect(chkLogz, SIGNAL(toggled(bool)),myPlot, SIGNAL(LogzSignal(bool))); +/** Plot Axis **/ + connect(chkTitle, SIGNAL(toggled(bool)), this, SLOT(EnableTitles())); + connect(chkXAxis, SIGNAL(toggled(bool)), this, SLOT(EnableTitles())); + connect(chkYAxis, SIGNAL(toggled(bool)), this, SLOT(EnableTitles())); + connect(chkZAxis, SIGNAL(toggled(bool)), this, SLOT(EnableTitles())); + connect(dispTitle, SIGNAL(returnPressed()), this, SLOT(SetTitles())); + connect(dispXAxis, SIGNAL(returnPressed()), this, SLOT(SetTitles())); + connect(dispYAxis, SIGNAL(returnPressed()), this, SLOT(SetTitles())); + connect(dispZAxis, SIGNAL(returnPressed()), this, SLOT(SetTitles())); + +/** Common Buttons*/ + connect(btnClear, SIGNAL(clicked()),myPlot, SLOT(Clear1DPlot())); + +/** test for 1D*/ + connect(chktest1D, SIGNAL(toggled(bool)), this, SLOT(Select1DPlot(bool))); } @@ -66,4 +133,65 @@ void qTabPlot::Enable(bool enable){ boxPlotAxis->setEnabled(enable); } +void qTabPlot::SetTitles(){ + int oneD = box1D->isEnabled(); + /** Plot Title*/ + if(dispTitle->isEnabled()) + myPlot->SetPlotTitle(dispTitle->text()); + /** X Axis */ + if(dispXAxis->isEnabled()){ + if(oneD) myPlot->SetHistXAxisTitle(dispXAxis->text()); + else myPlot->SetImageXAxisTitle(dispXAxis->text()); + } + /** Y Axis */ + if(dispYAxis->isEnabled()){ + if(oneD) myPlot->SetHistYAxisTitle(dispYAxis->text()); + else myPlot->SetImageYAxisTitle(dispYAxis->text()); + } + /** Z Axis */ + if(dispZAxis->isEnabled()) + myPlot->SetImageZAxisTitle(dispZAxis->text()); +} + + +void qTabPlot::EnableTitles(){ + int oneD = box1D->isEnabled(); + /** Plot Title*/ + dispTitle->setEnabled(chkTitle->isChecked()); + if(!chkTitle->isChecked()){ + myPlot->SetPlotTitle(defaultPlotTitle); + dispTitle->setText(defaultPlotTitle); + } + /** X Axis */ + dispXAxis->setEnabled(chkXAxis->isChecked()); + if(!chkXAxis->isChecked()){ + if(oneD){ + myPlot->SetHistXAxisTitle(defaultHistXAxisTitle); + dispXAxis->setText(defaultHistXAxisTitle); + } + else{ + myPlot->SetImageXAxisTitle(defaultImageXAxisTitle); + dispXAxis->setText(defaultImageXAxisTitle); + } + } + /** Y Axis */ + dispYAxis->setEnabled(chkYAxis->isChecked()); + if(!chkYAxis->isChecked()){ + if(oneD){ + myPlot->SetHistYAxisTitle(defaultHistYAxisTitle); + dispYAxis->setText(defaultHistYAxisTitle); + }else{ + myPlot->SetImageYAxisTitle(defaultImageYAxisTitle); + dispYAxis->setText(defaultImageYAxisTitle); + } + } + /** Z Axis */ + dispZAxis->setEnabled(chkZAxis->isChecked()); + if(!chkZAxis->isChecked()){ + myPlot->SetImageZAxisTitle(defaultImageZAxisTitle); + dispZAxis->setText(defaultImageZAxisTitle); + } +} + + From 216a9ada7c669dd4947563bda47f4f6c0bf652fb Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 29 May 2012 08:26:49 +0000 Subject: [PATCH 004/332] made some changes to make clone and main window resize plot git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@4 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qCloneWidget.h | 2 +- slsDetectorGui/src/qCloneWidget.cpp | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/slsDetectorGui/include/qCloneWidget.h b/slsDetectorGui/include/qCloneWidget.h index 191dddf11..d7dc22472 100644 --- a/slsDetectorGui/include/qCloneWidget.h +++ b/slsDetectorGui/include/qCloneWidget.h @@ -26,7 +26,7 @@ class SlsQt2DPlotLayout; /** *@short Sets up the clone plot widget */ -class qCloneWidget:public QFrame{ +class qCloneWidget:public QMainWindow{ Q_OBJECT public: diff --git a/slsDetectorGui/src/qCloneWidget.cpp b/slsDetectorGui/src/qCloneWidget.cpp index 1a0d90a64..685d37527 100644 --- a/slsDetectorGui/src/qCloneWidget.cpp +++ b/slsDetectorGui/src/qCloneWidget.cpp @@ -24,11 +24,11 @@ using namespace std; -qCloneWidget::qCloneWidget(QWidget *parent,int id,QSize fSize,QString title,int numDim,SlsQt1DPlot*& plot1D,SlsQt2DPlotLayout*& plot2D):QFrame(parent,Qt::Popup|Qt::SubWindow),id(id){ +qCloneWidget::qCloneWidget(QWidget *parent,int id,QSize fSize,QString title,int numDim,SlsQt1DPlot*& plot1D,SlsQt2DPlotLayout*& plot2D):QMainWindow(parent),id(id){ - mainLayout = new QGridLayout(this); - setLayout(mainLayout); +/* mainLayout = new QGridLayout(this); + setLayout(mainLayout);*/ @@ -51,6 +51,7 @@ qCloneWidget::qCloneWidget(QWidget *parent,int id,QSize fSize,QString title,int cloneBox->setFlat(true); } + cloneBox->setCentralWidget(); /* boxSave = new QGroupBox(this); @@ -105,8 +106,8 @@ qCloneWidget::qCloneWidget(QWidget *parent,int id,QSize fSize,QString title,int gridClone->addWidget(boxSave,0,0); mainLayout->addWidget(boxSave,1,1);*/ - - mainLayout->addWidget(cloneBox,0,0); +/* + mainLayout->addWidget(cloneBox,0,0);*/ } From 20cc6d9a909cde7e013b356f62dceb5111fb1283 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 29 May 2012 16:49:30 +0000 Subject: [PATCH 005/332] done with save plot and all resizing options git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@5 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_dataoutput.ui | 25 ++- slsDetectorGui/forms/form_tab_plot.ui | 64 +++--- slsDetectorGui/include/qCloneWidget.h | 62 ++++-- slsDetectorGui/include/qDrawPlot.h | 19 +- slsDetectorGui/include/qTabPlot.h | 5 +- slsDetectorGui/src/qCloneWidget.cpp | 218 ++++++++++++-------- slsDetectorGui/src/qDetectorMain.cpp | 1 + slsDetectorGui/src/qDrawPlot.cpp | 81 +++++--- slsDetectorGui/src/qTabPlot.cpp | 20 +- 9 files changed, 318 insertions(+), 177 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_dataoutput.ui b/slsDetectorGui/forms/form_tab_dataoutput.ui index 9461e31bf..628d20f66 100644 --- a/slsDetectorGui/forms/form_tab_dataoutput.ui +++ b/slsDetectorGui/forms/form_tab_dataoutput.ui @@ -6,7 +6,7 @@ 0 0 - 748 + 734 339 @@ -44,6 +44,29 @@ PushButton + + + + 10 + 10 + 108 + 16 + + + + Output Directory: + + + + + + 118 + 10 + 113 + 21 + + + diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index 9b3c1d0fa..5f485af19 100644 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -483,7 +483,7 @@ 10 20 551 - 16 + 27 @@ -494,11 +494,31 @@ + + + + Qt::NoFocus + + + Clear + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + - gridLayoutWidget_3 - btnClear - gridLayoutWidget_4 @@ -628,9 +648,9 @@ 599 - 41 + 10 121 - 80 + 111 @@ -639,10 +659,10 @@ - 10 - 10 - 101 - 71 + 20 + 20 + 81 + 81 @@ -653,7 +673,7 @@ 9 - -1 + 13 @@ -690,28 +710,6 @@ - - - - 600 - 16 - 121 - 21 - - - - - - - Qt::NoFocus - - - Clear - - - - - diff --git a/slsDetectorGui/include/qCloneWidget.h b/slsDetectorGui/include/qCloneWidget.h index d7dc22472..4cf22c26f 100644 --- a/slsDetectorGui/include/qCloneWidget.h +++ b/slsDetectorGui/include/qCloneWidget.h @@ -9,63 +9,93 @@ #define QCLONEWIDGET_H_ /** Qt Project Class Headers */ +class SlsQtH1D; class SlsQt1DPlot; class SlsQt2DPlotLayout; /** Qt Include Headers */ #include +#include #include #include #include #include -#include #include #include #include +#include #include +/** C++ Include Headers */ +#include +using namespace std; /** *@short Sets up the clone plot widget */ -class qCloneWidget:public QMainWindow{ +class qCloneWidget:public QFrame{ Q_OBJECT public: /** \short The constructor */ - qCloneWidget(QWidget *parent,int id,QSize fSize,QString title,int numDim,SlsQt1DPlot*& plot1D,SlsQt2DPlotLayout*& plot2D); + qCloneWidget(QWidget *parent,int id,QString title,int numDim,SlsQt1DPlot*& plot1D,SlsQt2DPlotLayout*& plot2D,string FilePath); /** Destructor */ ~qCloneWidget(); + /** Sets up the widget window + * @param title title of the image with frame number + * @param numDim 1D or 2D + * @param plot1D plot1d object reference + * @param plot2D plot2d object reference + * */ + void SetupWidgetWindow(QString title,int numDim,SlsQt1DPlot*& plot1D,SlsQt2DPlotLayout*& plot2D); - /** Get the 1D plot reference - */ - SlsQt1DPlot* Get1Dplot(){ return cloneplot1D;}; -public slots: + /** Get the 1D hist values to plot + * @param nHists Number of graphs in 1D + * @param histNBins Total Number of X axis values/channels in 1D + * @param histXAxis X Axis value in 1D + * @param histYAxis Y Axis value in 1D + * @param histTitle Title for all the graphs in 1D + * */ + void SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis[],string histTitle[]); private: /** clone window id*/ int id; - /** clone 1D Plot */ - SlsQt1DPlot* cloneplot1D; + /** Default Save file path */ + string filePath; + /** clone 2D Plot */ SlsQt2DPlotLayout* cloneplot2D; + /** clone 1D Plot */ + SlsQt1DPlot* cloneplot1D; + /** vector of 1D hist values */ + QVector cloneplot1D_hists; + QGridLayout *mainLayout; - QGroupBox *boxSave; - QWidget *horizontalLayoutWidget; + QGroupBox *cloneBox; + QGridLayout *gridClone; + QGroupBox *boxSave; QHBoxLayout *layoutSave; - QLabel *lblFName; + QLabel *lblFName; QHBoxLayout *hLayoutSave; - QLineEdit *dispFName; - QComboBox *comboFormat; + QLineEdit *dispFName; + QComboBox *comboFormat; QPushButton *btnSave; - QCheckBox *chkAutoFName; - QCheckBox *chkSaveAll; + QCheckBox *chkAutoFName; + QCheckBox *chkSaveAll; + + + +private slots: +/** Save Plot */ +void SavePlot(); + protected: void closeEvent(QCloseEvent* event); diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index 520e7ce55..910e893b4 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -23,6 +23,8 @@ class qCloneWidget; #include #include +#define MAX_1DPLOTS 10 + /** *@short Sets up the plot widget @@ -93,7 +95,7 @@ private: SlsQt2DPlotLayout* plot2D; /** vector of 1D hist values */ QVector plot1D_hists; - QVector cloneplot1D_hists; + /**variables for threads */ /** */ @@ -123,7 +125,7 @@ private: /** Number of graphs in 1D */ unsigned int nHists; /** Title for all the graphs in 1D */ - std::string histTitle[10]; + std::string histTitle[MAX_1DPLOTS]; /** X Axis Title in 1D */ QString histXAxisTitle; /** Y Axis Title in 1D */ @@ -133,7 +135,7 @@ private: /** X Axis value in 1D */ double* histXAxis; /** Y Axis value in 1D */ - double* histYAxis[10]; + double* histYAxis[MAX_1DPLOTS]; /** */ @@ -148,9 +150,9 @@ private: /** */ const char* GetImageTitle() {return imageTitle.c_str();} /** */ - const char* GetHistTitle(int i) {return (i>=0&&i<10) ? histTitle[i].c_str():0;} //int for hist number + const char* GetHistTitle(int i) {return (i>=0&&i=0&&i<10) ? histYAxis[i]:0;} //int for hist number + double* GetHistYAxis(int i) {return (i>=0&&i -#include -#include - +#include +#include /** C++ Include Headers */ #include -#include -#include using namespace std; -qCloneWidget::qCloneWidget(QWidget *parent,int id,QSize fSize,QString title,int numDim,SlsQt1DPlot*& plot1D,SlsQt2DPlotLayout*& plot2D):QMainWindow(parent),id(id){ +qCloneWidget::qCloneWidget(QWidget *parent,int id,QString title,int numDim,SlsQt1DPlot*& plot1D,SlsQt2DPlotLayout*& plot2D,string FilePath):QFrame(parent,Qt::Popup|Qt::SubWindow),id(id),filePath(FilePath){ + /** Window title*/ + char winTitle[100]; + sprintf(winTitle,"SLS Detector GUI Clone %d",id); + setWindowTitle(QString(winTitle)); - -/* mainLayout = new QGridLayout(this); - setLayout(mainLayout);*/ - - - - - QGroupBox *cloneBox = new QGroupBox(this); - QGridLayout *gridClone = new QGridLayout(cloneBox); - cloneBox->setLayout(gridClone); - cloneBox->resize(fSize); - cloneBox->setTitle(title); - cloneBox->setAlignment(Qt::AlignHCenter); - cloneBox->setFont(QFont("Sans Serif",11,QFont::Bold)); - if(numDim==1){ - cloneplot1D = plot1D; - gridClone->addWidget(cloneplot1D,0,0); - cloneBox->setFlat(false); - - }else{ - cloneplot2D = plot2D; - gridClone->addWidget(cloneplot2D,0,0); - cloneBox->setFlat(true); - } - - cloneBox->setCentralWidget(); - -/* - boxSave = new QGroupBox(this); - layoutSave = new QHBoxLayout; - boxSave->setLayout(layoutSave); - - lblFName = new QLabel(layoutSave); - lblFName->setText("File Name:"); - layoutSave->addWidget(lblFName); - - - - hLayoutSave = new QHBoxLayout(); - hLayoutSave->setSpacing(0); - - dispFName = new QLineEdit(layoutSave); - hLayoutSave->addWidget(dispFName); - - comboFormat = new QComboBox(layoutSave); - comboFormat->setFrame(true); - comboFormat->insertItem(".gif"); - comboFormat->insertItem(".pdf"); - comboFormat->insertItem(".png"); - comboFormat->insertItem(".gif+"); - comboFormat->insertItem(".jpg"); - comboFormat->insertItem(".ps"); - comboFormat->insertItem(".eps"); - comboFormat->insertItem(".xpm"); - comboFormat->insertItem(".C"); - hLayoutSave->addWidget(comboFormat); - - layoutSave->addLayout(hLayoutSave); - - - btnSave = new QPushButton(layoutSave); - bnSave->setText("Save"); - QSizePolicy sizePolicy2(QSizePolicy::Fixed, QSizePolicy::Fixed); - sizePolicy2.setHeightForWidth(btnSave->sizePolicy().hasHeightForWidth()); - btnSave->setSizePolicy(sizePolicy2); - btnSave->setFocusPolicy(Qt::NoFocus); - layoutSave->addWidget(btnSave); - - chkAutoFName = new QCheckBox(layoutSave); - chkAutoFName->setText("Automatic File Name"); - layoutSave->addWidget(chkAutoFName); - - chkSaveAll = new QCheckBox(layoutSave); - chkSaveAll->setText("Save All") - layoutSave->addWidget(chkSaveAll); - - - - gridClone->addWidget(boxSave,0,0); - mainLayout->addWidget(boxSave,1,1);*/ -/* - mainLayout->addWidget(cloneBox,0,0);*/ + /** Set up widget*/ + SetupWidgetWindow(title,numDim,plot1D,plot2D); } @@ -115,9 +35,129 @@ qCloneWidget::qCloneWidget(QWidget *parent,int id,QSize fSize,QString title,int qCloneWidget::~qCloneWidget(){ delete cloneplot1D; delete cloneplot2D; + delete cloneBox; + delete boxSave; } + +void qCloneWidget::SetupWidgetWindow(QString title,int numDim,SlsQt1DPlot*& plot1D,SlsQt2DPlotLayout*& plot2D){ + + /** Main Window Layout */ + mainLayout = new QGridLayout(this); + setLayout(mainLayout); + + /** plot group box*/ + cloneBox = new QGroupBox(this); + gridClone = new QGridLayout(cloneBox); + cloneBox->setLayout(gridClone); + cloneBox->setContentsMargins(0,0,0,0); + //cloneBox->resize(400,200); + cloneBox->setTitle(title); + cloneBox->setAlignment(Qt::AlignHCenter); + cloneBox->setFont(QFont("Sans Serif",11,QFont::Bold)); + /** According to dimensions, create appropriate 1D or 2Dplot */ + if(numDim==1){ + cloneplot1D = plot1D; + gridClone->addWidget(cloneplot1D,0,0); + cloneBox->setFlat(false); + cloneBox->setContentsMargins(0,30,0,0); + + }else{ + cloneplot2D = plot2D; + //cloneplot2D->setContentsMargins(0,0,0,0); + gridClone->addWidget(cloneplot2D,0,0); + cloneBox->setFlat(true); + cloneBox->setContentsMargins(0,5,0,0); + } + + /** Save group box */ + boxSave = new QGroupBox("Save",this); + boxSave->setFixedHeight(45); + boxSave->setContentsMargins(0,8,0,0); + layoutSave = new QHBoxLayout; + boxSave->setLayout(layoutSave); + /** Label file name*/ + lblFName = new QLabel("File Name:",this); + layoutSave->addWidget(lblFName); + /** To get 0 spacing between the next 2 widgets file name and file format */ + hLayoutSave = new QHBoxLayout(); + layoutSave->addLayout(hLayoutSave); + hLayoutSave->setSpacing(0); + /** file name */ + dispFName = new QLineEdit(this); + hLayoutSave->addWidget(dispFName); + /** file format */ + comboFormat = new QComboBox(this); + comboFormat->setFrame(true); + comboFormat->addItem(".gif"); + comboFormat->addItem(".pdf"); + comboFormat->addItem(".png"); + comboFormat->addItem(".gif+"); + comboFormat->addItem(".jpg"); + comboFormat->addItem(".ps"); + comboFormat->addItem(".eps"); + comboFormat->addItem(".xpm"); + comboFormat->addItem(".C"); + hLayoutSave->addWidget(comboFormat); + /** save button */ + btnSave = new QPushButton("Save",this); + btnSave->setFocusPolicy(Qt::NoFocus); + layoutSave->addWidget(btnSave); + /** automatic file name check box */ + chkAutoFName = new QCheckBox("Automatic File Name",this); + layoutSave->addWidget(chkAutoFName); + /** automatic save all check box */ + chkSaveAll = new QCheckBox("Save All",this); + layoutSave->addWidget(chkSaveAll); + + /** main window widgets */ + mainLayout->addWidget(boxSave,0,0); + mainLayout->addWidget(cloneBox,1,0); + + /** Save */ + connect(btnSave, SIGNAL(clicked()), this, SLOT(SavePlot())); + + +} + + + + +void qCloneWidget::SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis[],string histTitle[]){ +/** for each plot*/ +for(int hist_num=0;hist_numcloneplot1D_hists.size()){ + cloneplot1D_hists.append(k=new SlsQtH1D("1d plot",histNBins,histXAxis,histYAxis[hist_num])); + k->SetLineColor(hist_num+1); + }else{ + k=cloneplot1D_hists.at(hist_num); + k->SetData(histNBins,histXAxis,histYAxis[hist_num]); + } + k->setTitle(histTitle[hist_num].c_str()); + k->Attach(cloneplot1D); +} +cloneplot1D->UnZoom(); + + +} + + + + +void qCloneWidget::SavePlot(){ + QString fName = QString(filePath.c_str())+'/'+dispFName->text()+comboFormat->currentText(); + QImage img(cloneBox->size().width(),cloneBox->size().height(),QImage::Format_RGB32); + QPainter painter(&img); + cloneBox->render(&painter); + img.save(fName); +} + + + + void qCloneWidget::closeEvent(QCloseEvent* event){ emit CloneClosedSignal(id); event->accept(); diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index b47612df3..5b5ec9fca 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -82,6 +82,7 @@ void qDetectorMain::SetUpWidgetWindow(){ layoutTabs= new QGridLayout; centralwidget->setLayout(layoutTabs); + /** plot setup*/ myPlot = new qDrawPlot(dockWidgetPlot,myDet); dockWidgetPlot->setWidget(myPlot); diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 73e6dc70f..ba249a1c0 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -14,6 +14,8 @@ #include "multiSlsDetector.h" /** Qt Include Headers */ #include +#include +#include /** C++ Include Headers */ #include #include @@ -60,7 +62,7 @@ void qDrawPlot::SetupWidgetWindow(){ nHists = 0; histNBins = 0; histXAxis = 0; - for(int i=0;i<10;i++) histYAxis[i]=0; + for(int i=0;isetLayout(layout); + boxPlot = new QGroupBox("Measurement"); + layout->addWidget(boxPlot,1,1); boxPlot->setAlignment(Qt::AlignHCenter); boxPlot->setFont(QFont("Sans Serif",11,QFont::Bold)); - layout->addWidget(boxPlot,1,1); - this->setLayout(layout); - plot_update_timer = new QTimer(this); connect(plot_update_timer, SIGNAL(timeout()), this, SLOT(UpdatePlot())); + + /** Defaults - only for the initial picture*/ + histXAxisTitle="Channel Number"; + histYAxisTitle="Counts"; + for(int i=0;isetFont(QFont("Sans Serif",9,QFont::Normal)); + plot1D->SetXTitle(histXAxisTitle.toAscii().constData()); + plot1D->SetYTitle(histYAxisTitle.toAscii().constData()); plot1D->hide(); plot2D = new SlsQt2DPlotLayout(boxPlot); plot2D->setFont(QFont("Sans Serif",9,QFont::Normal)); - plot2D->setTitle("Start Image"); + plot2D->setTitle(GetImageTitle()); + plot2D->SetXTitle(imageXAxisTitle); + plot2D->SetYTitle(imageYAxisTitle); + plot2D->SetZTitle(imageZAxisTitle); plot2D->setAlignment(Qt::AlignLeft); boxPlot->setFlat(true); + //QSizePolicy sizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred); + //boxPlot->setSizePolicy(sizePolicy); plotLayout = new QGridLayout(boxPlot); plotLayout->addWidget(plot1D,1,1,1,1); plotLayout->addWidget(plot2D,1,1,1,1); + + boxPlot->setContentsMargins(0,15,0,0); } @@ -219,7 +243,7 @@ void* qDrawPlot::AcquireImages(){ - char cIndex[200]; +// char cIndex[200]; //string filePath = myDet->getFilePath()+'/'+myDet->getFileName()+'_'; //cout<<"filePath:"<SetXTitle(histXAxisTitle.toAscii().constData()); + plot1D->SetYTitle(histYAxisTitle.toAscii().constData()); plot1D->show(); plot2D->hide(); boxPlot->setFlat(false); plot_in_scope=1; }else{ + plot2D->SetXTitle(imageXAxisTitle); + plot2D->SetYTitle(imageYAxisTitle); + plot2D->SetZTitle(imageZAxisTitle); plot1D->hide(); plot2D->show(); boxPlot->setFlat(true); @@ -391,6 +420,8 @@ void qDrawPlot::StopUpdatePlot(){ +/**----------------------------CLONES-------------------------*/ + void qDrawPlot::ClonePlot(){ int i=0; @@ -405,30 +436,22 @@ void qDrawPlot::ClonePlot(){ exit(-1); } - winClone[i] = new qCloneWidget(this,i,boxPlot->size(),boxPlot->title(),(int)plot_in_scope,plot1D,plot2D); + winClone[i] = new qCloneWidget(this,i,boxPlot->title(),(int)plot_in_scope,plot1D,plot2D,myDet->getFilePath()); if(plot_in_scope==1){ plot1D = new SlsQt1DPlot(boxPlot); plot1D->setFont(QFont("Sans Serif",9,QFont::Normal)); + plot1D->SetXTitle(histXAxisTitle.toAscii().constData()); + plot1D->SetYTitle(histYAxisTitle.toAscii().constData()); plotLayout->addWidget(plot1D,1,1,1,1); - /** Somehow the 1d plot hists are lost*/ - SlsQtH1D* h; - for(int hist_num=0;hist_numcloneplot1D_hists.size()){ - cloneplot1D_hists.append(k=new SlsQtH1D("1d plot",histNBins,histXAxis,GetHistYAxis(hist_num))); - k->SetLineColor(hist_num+1); - }else{ - k=cloneplot1D_hists.at(hist_num); - k->SetData(histNBins,histXAxis,GetHistYAxis(hist_num)); - } - k->setTitle(GetHistTitle(hist_num)); - k->Attach(winClone[i]->Get1Dplot()); - } - winClone[i]->Get1Dplot()->UnZoom(); + winClone[i]->SetCloneHists((int)nHists,histNBins,histXAxis,histYAxis,histTitle); } else{ plot2D = new SlsQt2DPlotLayout(boxPlot); plot2D->setFont(QFont("Sans Serif",9,QFont::Normal)); + plot2D->setTitle(GetImageTitle()); + plot2D->SetXTitle(imageXAxisTitle); + plot2D->SetYTitle(imageYAxisTitle); + plot2D->SetZTitle(imageZAxisTitle); plotLayout->addWidget(plot2D,1,1,1,1); } UpdatePlot(); @@ -455,3 +478,15 @@ void qDrawPlot::CloneCloseEvent(int id){ #endif } + + + + + +/**----------------------------SAVE-------------------------*/ +void qDrawPlot::SavePlot(QString FName){ + QImage img(size().width(),size().height(),QImage::Format_RGB32); + QPainter painter(&img); + render(&painter); + img.save(FName); +} diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index be95ad67e..ed39e931a 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -36,6 +36,7 @@ qTabPlot::qTabPlot(QWidget *parent,slsDetectorUtils*& detector, qDrawPlot*& plot //This also selects the text if unchecked //includes setupwidgetwindow //SelectPlot(1); + Select1DPlot(false); Initialization(); } } @@ -65,13 +66,15 @@ void qTabPlot::SetupWidgetWindow(){ dispXMax->setEnabled(false); dispYMax->setEnabled(false); dispZMax->setEnabled(false); + + //dispFName->setText(QString(myDet->getFilePath().c_str())+'/'); + } void qTabPlot::Select1DPlot(bool b){ SetupWidgetWindow(); if(b){ - myPlot->Select1DPlot(); box1D->setEnabled(true); box2D->setEnabled(false); chkZAxis->setEnabled(false); @@ -81,8 +84,8 @@ void qTabPlot::Select1DPlot(bool b){ dispXAxis->setText(defaultHistXAxisTitle); myPlot->SetHistYAxisTitle(defaultHistYAxisTitle); dispYAxis->setText(defaultHistYAxisTitle); + myPlot->Select1DPlot(); }else{ - myPlot->Select2DPlot(); box1D->setEnabled(false); box2D->setEnabled(true); chkZAxis->setEnabled(true); @@ -94,6 +97,7 @@ void qTabPlot::Select1DPlot(bool b){ dispYAxis->setText(defaultImageYAxisTitle); myPlot->SetImageZAxisTitle(defaultImageZAxisTitle); dispZAxis->setText(defaultImageZAxisTitle); + myPlot->Select2DPlot(); } } @@ -115,12 +119,13 @@ void qTabPlot::Initialization(){ connect(dispXAxis, SIGNAL(returnPressed()), this, SLOT(SetTitles())); connect(dispYAxis, SIGNAL(returnPressed()), this, SLOT(SetTitles())); connect(dispZAxis, SIGNAL(returnPressed()), this, SLOT(SetTitles())); - /** Common Buttons*/ - connect(btnClear, SIGNAL(clicked()),myPlot, SLOT(Clear1DPlot())); + connect(btnClear, SIGNAL(clicked()), myPlot, SLOT(Clear1DPlot())); +/** Save */ + connect(btnSave, SIGNAL(clicked()), this, SLOT(SavePlot())); /** test for 1D*/ - connect(chktest1D, SIGNAL(toggled(bool)), this, SLOT(Select1DPlot(bool))); + connect(chktest1D, SIGNAL(toggled(bool)), this, SLOT(Select1DPlot(bool))); } @@ -194,4 +199,7 @@ void qTabPlot::EnableTitles(){ } - +void qTabPlot::SavePlot(){ + QString fullFileName = QString(myDet->getFilePath().c_str())+'/'+dispFName->text()+comboFormat->currentText(); + myPlot->SavePlot(fullFileName); +} From 7a218418d1a69939c75411a935c9faa723a42cdf Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 6 Jun 2012 15:23:55 +0000 Subject: [PATCH 006/332] Version 1 with the action tab working git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@6 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_detectormain.ui | 38 +- slsDetectorGui/forms/form_tab_actions.ui | 21 +- slsDetectorGui/forms/form_tab_advanced.ui | 20 +- slsDetectorGui/forms/form_tab_dataoutput.ui | 187 ++- slsDetectorGui/forms/form_tab_measurement.ui | 1310 +++++++++--------- slsDetectorGui/forms/form_tab_plot.ui | 71 +- slsDetectorGui/include/qActionsWidget.h | 84 ++ slsDetectorGui/include/qDetectorMain.h | 32 +- slsDetectorGui/include/qTabActions.h | 38 +- slsDetectorGui/include/qTabDataOutput.h | 25 +- slsDetectorGui/include/qTabMeasurement.h | 5 +- slsDetectorGui/slsDetectorGui.pro | 2 + slsDetectorGui/src/qActionsWidget.cpp | 264 ++++ slsDetectorGui/src/qCloneWidget.cpp | 4 +- slsDetectorGui/src/qDetectorMain.cpp | 89 +- slsDetectorGui/src/qDrawPlot.cpp | 14 +- slsDetectorGui/src/qTabActions.cpp | 202 ++- slsDetectorGui/src/qTabDataOutput.cpp | 33 +- slsDetectorGui/src/qTabMeasurement.cpp | 7 +- slsDetectorGui/src/qTabPlot.cpp | 10 +- 20 files changed, 1689 insertions(+), 767 deletions(-) create mode 100644 slsDetectorGui/include/qActionsWidget.h create mode 100644 slsDetectorGui/src/qActionsWidget.cpp diff --git a/slsDetectorGui/forms/form_detectormain.ui b/slsDetectorGui/forms/form_detectormain.ui index 59dee1c8b..3a1a8c03f 100644 --- a/slsDetectorGui/forms/form_detectormain.ui +++ b/slsDetectorGui/forms/form_detectormain.ui @@ -10,7 +10,7 @@ 0 0 800 - 822 + 800 @@ -39,12 +39,9 @@ false - - QMainWindow::AllowTabbedDocks|QMainWindow::AnimatedDocks - - + 0 0 @@ -52,13 +49,13 @@ 0 - 0 + 395 524287 - 450 + 395 @@ -71,6 +68,24 @@ 25 + + + 0 + 0 + + + + + 0 + 25 + + + + + 16777215 + 25 + + 9 @@ -132,13 +147,13 @@ 38 - 369 + 200 524287 - 524287 + 390 @@ -251,8 +266,11 @@ + + true + - + 0 0 diff --git a/slsDetectorGui/forms/form_tab_actions.ui b/slsDetectorGui/forms/form_tab_actions.ui index f893e09ef..69f2bbc34 100644 --- a/slsDetectorGui/forms/form_tab_actions.ui +++ b/slsDetectorGui/forms/form_tab_actions.ui @@ -6,12 +6,12 @@ 0 0 - 748 + 734 339 - + 0 0 @@ -24,26 +24,13 @@ - 1000 - 1000 + 16777215 + 16777215 Form - - - - 224 - 223 - 75 - 25 - - - - PushButton - - diff --git a/slsDetectorGui/forms/form_tab_advanced.ui b/slsDetectorGui/forms/form_tab_advanced.ui index afdfb5593..b871f7575 100644 --- a/slsDetectorGui/forms/form_tab_advanced.ui +++ b/slsDetectorGui/forms/form_tab_advanced.ui @@ -47,8 +47,8 @@ - 52 - 106 + 10 + 14 91 41 @@ -67,8 +67,8 @@ Temperature - 222 - 132 + 180 + 40 151 21 @@ -90,8 +90,8 @@ Temperature - 162 - 102 + 120 + 10 41 20 @@ -103,8 +103,8 @@ Temperature - 162 - 132 + 120 + 40 41 20 @@ -116,8 +116,8 @@ Temperature - 222 - 102 + 180 + 10 151 21 diff --git a/slsDetectorGui/forms/form_tab_dataoutput.ui b/slsDetectorGui/forms/form_tab_dataoutput.ui index 628d20f66..dc489de08 100644 --- a/slsDetectorGui/forms/form_tab_dataoutput.ui +++ b/slsDetectorGui/forms/form_tab_dataoutput.ui @@ -31,41 +31,182 @@ Form - + - 157 - 256 - 75 - 25 + 20 + 75 + 691 + 206 - - PushButton + + Correction + + + + 10 + 20 + 671 + 181 + + + + + + + Flat Field File + + + + + + + Rate Correction + + + + + + + Angular Conversion + + + + + + + + + + Acquire Flat Field Data + + + + + + + Auto + + + + + + + + + + + 0 + 0 + + + + Browse + + + + + + + Custom dead time(ns): + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + + + + + Discard Bad Channels + + + + + + + + 0 + 0 + + + + : + + + + + + + : + + + + + - + - 10 - 10 - 108 - 16 + 19 + 20 + 701 + 41 - - Output Directory: + + QFrame::NoFrame - - - - - 118 - 10 - 113 - 21 - + + QFrame::Plain + + + + 0 + 6 + 691 + 28 + + + + + -1 + + + + + Output Directory: + + + + + + + + + + Browse + + + + + diff --git a/slsDetectorGui/forms/form_tab_measurement.ui b/slsDetectorGui/forms/form_tab_measurement.ui index b98832ec9..17e938b1e 100644 --- a/slsDetectorGui/forms/form_tab_measurement.ui +++ b/slsDetectorGui/forms/form_tab_measurement.ui @@ -11,7 +11,7 @@ - + 0 0 @@ -25,7 +25,7 @@ 1000 - 1000 + 339 @@ -149,646 +149,11 @@ Form - - - - 20 - 10 - 321 - 130 - - - - - -1 - - - - - Number of Measurements: - - - - - - - - 0 - 0 - - - - Number of measurements (not in real time) that will be acquired. - #frames# - - - - - - - - - - - - 1 - - - 2000000000 - - - 1 - - - - - - - File Name: - - - - - - - - 0 - 0 - - - - Root of the file name - please check that the output directory is correctly set and select the file name format. - #fname# - - - - - - - - - - Run Index: - - - - - - - - 0 - 0 - - - - Run index (automatically incremented) - #index# - - - - - - - - - - - - 0 - - - 2000000000 - - - 0 - - - - - - - - - 390 - 11 - 322 - 321 - - - - - - - false - - - Number of Triggers: - - - - - - - false - - - - 0 - 0 - - - - Run index (automatically incremented) - #index# - - - - - - - - - - - - 0 - - - 2000000000 - - - 0 - - - - - - - false - - - Delay After Trigger: - - - - - - - false - - - - 0 - 0 - - - - Frame period between exposures. - #period# - - - 2000000000.000000000000000 - - - 0.000000000000000 - - - - - - - false - - - - 0 - 0 - - - - 2 - - - - hr - - - - - min - - - - - s - - - - - ms - - - - - us - - - - - ns - - - - - - - - false - - - - 0 - 0 - - - - Number of Gates: - - - - - - - false - - - - 0 - 0 - - - - Run index (automatically incremented) - #index# - - - - - - - - - - - - 0 - - - 2000000000 - - - 0 - - - - - - - false - - - - 0 - 0 - - - - Number of Probes: - - - - - - - false - - - - 0 - 0 - - - - Run index (automatically incremented) - #index# - - - - - - - - - - - - 0 - - - 2000000000 - - - 0 - - - - - - - Timing Mode: - - - - - - - - 0 - 0 - - - - Settings of the detector. - #settings# - - - - None - - - - - Auto - - - - - Gated - - - - - Trigger Exposure - - - - - Trigger Frame - - - - - Trigger Readout - - - - - Gated with Start Trigger - - - - - External Trigger Window - - - - - - - - false - - - Number of Frames: - - - - - - - false - - - - 0 - 0 - - - - Number of measurements (not in real time) that will be acquired. - #frames# - - - - - - - - - - - - 1 - - - 2000000000 - - - 1 - - - - - - - false - - - Exposure Time: - - - - - - - false - - - - 0 - 0 - - - - Exposure time of each frame. - #exptime# - - - 2000000000.000000000000000 - - - 0.000000000000000 - - - - - - - false - - - - 0 - 0 - - - - 2 - - - - hr - - - - - min - - - - - s - - - - - ms - - - - - us - - - - - ns - - - - - - - - false - - - Acquisition Period: - - - - - - - false - - - - 0 - 0 - - - - Frame period between exposures. - #period# - - - 2000000000.000000000000000 - - - 0.000000000000000 - - - - - - - false - - - - 0 - 0 - - - - 2 - - - - hr - - - - - min - - - - - s - - - - - ms - - - - - us - - - - - ns - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 10 - 20 - - - - - - 20 - 170 + 179 319 90 @@ -849,7 +214,7 @@ 20 - 280 + 289 319 31 @@ -870,6 +235,673 @@ Start + + + + 352 + 8 + 362 + 342 + + + + QFrame::NoFrame + + + QFrame::Plain + + + + + 35 + 10 + 322 + 321 + + + + + + + false + + + Number of Triggers: + + + + + + + false + + + + 0 + 0 + + + + Run index (automatically incremented) + #index# + + + + + + + + + + + + 0 + + + 2000000000 + + + 0 + + + + + + + false + + + Delay After Trigger: + + + + + + + false + + + + 0 + 0 + + + + Frame period between exposures. + #period# + + + 2000000000.000000000000000 + + + 0.000000000000000 + + + + + + + false + + + + 0 + 0 + + + + 2 + + + + hr + + + + + min + + + + + s + + + + + ms + + + + + us + + + + + ns + + + + + + + + false + + + + 0 + 0 + + + + Number of Gates: + + + + + + + false + + + + 0 + 0 + + + + Run index (automatically incremented) + #index# + + + + + + + + + + + + 0 + + + 2000000000 + + + 0 + + + + + + + false + + + + 0 + 0 + + + + Number of Probes: + + + + + + + false + + + + 0 + 0 + + + + Run index (automatically incremented) + #index# + + + + + + + + + + + + 0 + + + 2000000000 + + + 0 + + + + + + + Timing Mode: + + + + + + + + 0 + 0 + + + + Settings of the detector. + #settings# + + + + None + + + + + Auto + + + + + Gated + + + + + Trigger Exposure + + + + + Trigger Frame + + + + + Trigger Readout + + + + + Gated with Start Trigger + + + + + External Trigger Window + + + + + + + + false + + + Number of Frames: + + + + + + + false + + + + 0 + 0 + + + + Number of measurements (not in real time) that will be acquired. + #frames# + + + + + + + + + + + + 1 + + + 2000000000 + + + 1 + + + + + + + false + + + Exposure Time: + + + + + + + false + + + + 0 + 0 + + + + Exposure time of each frame. + #exptime# + + + 2000000000.000000000000000 + + + 0.000000000000000 + + + + + + + false + + + + 0 + 0 + + + + 2 + + + + hr + + + + + min + + + + + s + + + + + ms + + + + + us + + + + + ns + + + + + + + + false + + + Acquisition Period: + + + + + + + false + + + + 0 + 0 + + + + Frame period between exposures. + #period# + + + 2000000000.000000000000000 + + + 0.000000000000000 + + + + + + + false + + + + 0 + 0 + + + + 2 + + + + hr + + + + + min + + + + + s + + + + + ms + + + + + us + + + + + ns + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 20 + + + + + + + + + + + 10 + 5 + 336 + 159 + + + + QFrame::NoFrame + + + QFrame::Plain + + + + + 10 + 13 + 321 + 130 + + + + + -1 + + + + + Number of Measurements: + + + + + + + + 0 + 0 + + + + Number of measurements (not in real time) that will be acquired. + #frames# + + + + + + + + + + + + 1 + + + 2000000000 + + + 1 + + + + + + + File Name: + + + + + + + + 0 + 0 + + + + Root of the file name - please check that the output directory is correctly set and select the file name format. + #fname# + + + + + + + + + + Run Index: + + + + + + + + 0 + 0 + + + + Run index (automatically incremented) + #index# + + + + + + + + + + + + 0 + + + 2000000000 + + + 0 + + + + + + diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index 5f485af19..598c64587 100644 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -7,11 +7,11 @@ 0 0 734 - 339 + 345 - + 0 0 @@ -37,12 +37,15 @@ 10 130 711 - 151 + 146 Plot Axis + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + false @@ -288,12 +291,15 @@ 11 70 571 - 51 + 46 2D Plot Options + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + false @@ -350,7 +356,7 @@ 10 10 571 - 51 + 46 @@ -474,6 +480,9 @@ 1D Plot Options + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + false @@ -482,20 +491,26 @@ 10 20 - 551 - 27 + 641 + 21 - + Superimpose + + + 0 + 0 + + Qt::NoFocus @@ -509,22 +524,27 @@ Qt::Horizontal + + QSizePolicy::Fixed + - 40 - 20 + 400 + 10 + gridLayoutWidget_3 + groupBox_2 10 - 288 + 290 711 51 @@ -532,11 +552,17 @@ Save + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + false + 10 - 13 + 15 698 31 @@ -645,24 +671,33 @@ + + true + 599 10 121 - 111 + 81 Clone + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + false + - 20 - 20 - 81 - 81 + 5 + 10 + 111 + 76 @@ -673,7 +708,7 @@ 9 - 13 + -1 diff --git a/slsDetectorGui/include/qActionsWidget.h b/slsDetectorGui/include/qActionsWidget.h new file mode 100644 index 000000000..edb4fdc08 --- /dev/null +++ b/slsDetectorGui/include/qActionsWidget.h @@ -0,0 +1,84 @@ +/* + * qTabActions.h + * + * Created on: May 10, 2012 + * Author: l_maliakal_d + */ + +#ifndef QACTIONSWIDGET_H_ +#define QACTIONSWIDGET_H_ +#include +class QGridLayout; +class QComboBox; +class QLineEdit; +class QPushButton; +class QLabel; +class QSpinBox; +class QGroupBox; +class QRadioButton; + + +class ActionsWidget : public QFrame{ + Q_OBJECT + +public: + /** \short The constructor + * @param parent is the parent tab widget + * @param detector is the detector returned from the detector tab + */ + ActionsWidget(QWidget *parent, int scanType); + + ~ActionsWidget(); + +private: + QGridLayout *layout; + QComboBox *comboScript; + QLineEdit *dispScript; + QPushButton *btnBrowse; + QLabel *lblParameter; + QLineEdit *dispParameter; + QLabel *lblSteps; + QSpinBox *spinSteps; + QLabel *lblPrecision; + QSpinBox *spinPrecision; + QGroupBox *group; + QRadioButton *radioConstant; + QRadioButton *radioSpecific; + QRadioButton *radioValue; + QLabel *lblFrom; + QSpinBox *spinFrom; + QLabel *lblTo; + QSpinBox *spinTo; + QLabel *lblSize; + QSpinBox *spinSize; + QComboBox *comboSpecific; + QLineEdit *dispValues; + 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); + + /** Sets up all the slots and signals */ + void Initialization(); + + +private slots: +/** Sets the scan or script. Accordingly enables, disables other widgets + * @param index value chosen*/ +void SetScript(int index); + +/** Enables widgets depending on which size is clicked. + * Options: constant size,specific values,values from file */ +void EnableSizeWidgets(); + + + +protected: +}; + + + + +#endif /* QACTIONSWIDGET_H_ */ + diff --git a/slsDetectorGui/include/qDetectorMain.h b/slsDetectorGui/include/qDetectorMain.h index 66d63e620..bebc826d7 100644 --- a/slsDetectorGui/include/qDetectorMain.h +++ b/slsDetectorGui/include/qDetectorMain.h @@ -25,6 +25,23 @@ class slsDetectorUtils; /** Qt Include Headers */ #include #include +#include + +class MyTabWidget:public QTabWidget +{ +public: + MyTabWidget(QWidget* parent = 0) + { + setParent(parent); + } + + //Overridden method from QTabWidget + QTabBar* tabBar() + { + return QTabWidget::tabBar(); + } +}; + /** *@short Main window of the GUI. @@ -56,12 +73,13 @@ private: /** The Plot widget */ qDrawPlot *myPlot; /**Tab Widget */ - QTabWidget *tabs; + MyTabWidget *tabs; /**Layout of the central Widget */ QGridLayout *layoutTabs; - /** height of Plot Window when undocked */ + /** default height of Plot Window when docked */ int heightPlotWindow; - + /** default height of central widgetwhen plot Window when docked */ + int heightCentralWidget; /** enumeration of the tabs */ enum {Measurement, DataOutput, Plot, Actions, Settings, Advanced, Debugging, Developer, NumberOfTabs }; @@ -83,6 +101,8 @@ private: qTabDebugging *tab_debugging; /**Developer tab */ qTabDeveloper *tab_developer; + /**if the developer tab should be enabled,known from command line */ + int isDeveloper; /**Sets up the layout of the widget @@ -163,6 +183,12 @@ void ResizeMainWindow(bool b); */ void SetTerminalWindowSize(bool b); +/** Enables/disables tabs depending on if acquisition is currently in progress + */ +void EnableTabs(); + +protected: +void resizeEvent(QResizeEvent* event); signals: diff --git a/slsDetectorGui/include/qTabActions.h b/slsDetectorGui/include/qTabActions.h index 5f9408c1d..48c15114c 100644 --- a/slsDetectorGui/include/qTabActions.h +++ b/slsDetectorGui/include/qTabActions.h @@ -8,15 +8,25 @@ #ifndef QTABACTIONS_H_ #define QTABACTIONS_H_ + /** Form Header */ #include "ui_form_tab_actions.h" /** Project Class Headers */ class slsDetectorUtils; +class ActionsWidget; + + +class QPushButton; +class QLabel; +class QScrollArea; +class QGridLayout; +class QPalette; + /** *@short sets up the acions parameters */ -class qTabActions:public QWidget, private Ui::TabActionsObject{ +class qTabActions:public QWidget,private Ui::TabActionsObject{ Q_OBJECT public: @@ -35,18 +45,32 @@ private: /** The sls detector object */ slsDetectorUtils *myDet; - /** Sets up the widget - */ + static const int NUM_ACTION_WIDGETS = 9; + + QGridLayout *gridLayout; + QButtonGroup *group; + QPalette *palette; + + /** action widget objects */ + ActionsWidget *actionWidget[NUM_ACTION_WIDGETS]; + QPushButton *btnExpand[NUM_ACTION_WIDGETS]; + QLabel *lblName[NUM_ACTION_WIDGETS]; + + /** Sets up the widget */ void SetupWidgetWindow(); - /** Sets up all the slots and signals - */ + /** Sets up all the slots and signals */ void Initialization(); - /** Enables/Disables all the widgets - */ + /** Enables/Disables all the widgets */ void Enable(bool enable); + +private slots: +/** To Expand the Action Widget */ +void Expand(QAbstractButton *button); + }; #endif /* QTABACTIONS_H_ */ + diff --git a/slsDetectorGui/include/qTabDataOutput.h b/slsDetectorGui/include/qTabDataOutput.h index 9d3183a72..1a0781ae0 100644 --- a/slsDetectorGui/include/qTabDataOutput.h +++ b/slsDetectorGui/include/qTabDataOutput.h @@ -12,6 +12,9 @@ #include "ui_form_tab_dataoutput.h" /** Project Class Headers */ class slsDetectorUtils; +/** Qt Include Headers */ +#include + /** *@short sets up the DataOutput parameters @@ -35,18 +38,28 @@ private: /** The sls detector object */ slsDetectorUtils *myDet; - /** Sets up the widget - */ + /** Output Directory */ + QString outputDir; + +/** methods */ + /** Sets up the widget */ void SetupWidgetWindow(); - /** Sets up all the slots and signals - */ + /** Sets up all the slots and signals */ void Initialization(); - /** Enables/Disables all the widgets - */ + /** Enables/Disables all the widgets */ void Enable(bool enable); + +private slots: +/** Sets the output directory + * @param path output path to be set + */ +void setOutputDir(const QString& path); + +/** Open dialog to choose the output directory */ +void browseOutputDir(); }; diff --git a/slsDetectorGui/include/qTabMeasurement.h b/slsDetectorGui/include/qTabMeasurement.h index 2cc07f134..1ebbaab99 100644 --- a/slsDetectorGui/include/qTabMeasurement.h +++ b/slsDetectorGui/include/qTabMeasurement.h @@ -70,6 +70,7 @@ private: public slots: + /** update plot is finished, * changes start/stop text and enables/disables all widgets */ @@ -77,7 +78,6 @@ void UpdateFinished(); - private slots: /** Set file name * @param fName name of file @@ -133,7 +133,8 @@ void setNumProbes(int val); signals: - +void StartSignal(); +void StopSignal(); }; diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index 0b858394a..242c91771 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -50,6 +50,7 @@ SOURCES = \ src/qTabDataOutput.cpp\ src/qTabPlot.cpp\ src/qTabActions.cpp\ + src/qActionsWidget.cpp\ src/qTabAdvanced.cpp\ src/qTabSettings.cpp\ src/qTabDebugging.cpp\ @@ -72,6 +73,7 @@ HEADERS = \ include/qTabDataOutput.h\ include/qTabPlot.h\ include/qTabActions.h\ + include/qActionsWidget.h\ include/qTabAdvanced.h\ include/qTabSettings.h\ include/qTabDebugging.h\ diff --git a/slsDetectorGui/src/qActionsWidget.cpp b/slsDetectorGui/src/qActionsWidget.cpp new file mode 100644 index 000000000..b1c7ea074 --- /dev/null +++ b/slsDetectorGui/src/qActionsWidget.cpp @@ -0,0 +1,264 @@ +/* + * qTabActions.cpp + * + * Created on: May 10, 2012 + * Author: l_maliakal_d + */ + +/** Qt Project Class Headers */ +#include "qActionsWidget.h" +/** Qt Include Headers */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +/** C++ Include Headers */ +#include +using namespace std; + + +#define Detector_Index 0 + + +ActionsWidget::ActionsWidget(QWidget *parent, int scanType): QFrame(parent){ + SetupWidgetWindow(scanType); + Initialization(); +} + + + + + +ActionsWidget::~ActionsWidget(){ + delete layout; +} + + + + +void ActionsWidget::SetupWidgetWindow(int scanType){ + /** Widget Settings */ + //setFrameStyle(QFrame::Box); + //setFrameShadow(QFrame::Raised); + setFixedHeight(25); + if(scanType) setFixedHeight(125); + + + /** Main Layout Settings */ + layout = new QGridLayout(this); + setLayout(layout); + layout->setContentsMargins(0,0,0,0); + if(scanType) layout->setVerticalSpacing(5); + + + /** Main Widgets*/ + comboScript = new QComboBox(this); + if(!scanType){ + comboScript->addItem("None"); + comboScript->addItem("Custom Script"); + }else{ + comboScript->addItem("None"); + comboScript->addItem("Energy Scan"); + comboScript->addItem("Threshold Scan"); + comboScript->addItem("Trimbits Scan"); + comboScript->addItem("Custom Script"); + } + layout->addWidget(comboScript,0,0); + layout->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,1); + dispScript = new QLineEdit("None"); + dispScript->setEnabled(false); + layout->addWidget(dispScript,0,2); + btnBrowse = new QPushButton("Browse"); + btnBrowse->setEnabled(false); + layout->addWidget(btnBrowse,0,3); + layout->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,4); + lblParameter = new QLabel("Additional Parameter:"); + lblParameter->setEnabled(false); + layout->addWidget(lblParameter,0,5); + dispParameter = new QLineEdit("None"); + dispParameter->setEnabled(false); + dispParameter->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); + layout->addWidget(dispParameter,0,6); + + + + /** Scan Levels Widgets*/ + if(scanType){ + lblSteps = new QLabel("Number of Steps:"); + lblSteps->setEnabled(false); + layout->addWidget(lblSteps,1,2); + spinSteps = new QSpinBox(this); + spinSteps->setEnabled(false); + layout->addWidget(spinSteps,1,3); + lblPrecision = new QLabel("Precision:"); + lblPrecision->setEnabled(false); + layout->addWidget(lblPrecision,1,5); + spinPrecision = new QSpinBox(this); + spinPrecision->setEnabled(false); + layout->addWidget(spinPrecision,1,6); + group = new QGroupBox(this); + group->setEnabled(false); + /** 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 */ + QWidget *h1Widget = new QWidget(group); + h1Widget->setGeometry(QRect(10, 5, group->width()-20, 23)); + QHBoxLayout *h1 = new QHBoxLayout(h1Widget); + h1->setContentsMargins(0, 0, 0, 0); + radioConstant = new QRadioButton("Constant Step Size",h1Widget); + radioConstant->setChecked(true); + h1->addWidget(radioConstant); + radioSpecific = new QRadioButton("Specific Values",h1Widget); + h1->addWidget(radioSpecific); + radioValue = new QRadioButton("Values from File",h1Widget); + radioValue->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); + h1->addWidget(radioValue); + + /** Constant Size Layout */ + QWidget *h2ConstantWidget = new QWidget(group); + h2ConstantWidget->setGeometry(QRect(10, 30, group->width()-20, 31)); + QHBoxLayout *h2Constant = new QHBoxLayout(h2ConstantWidget); + h2Constant->setContentsMargins(0, 0, 0, 0); + + h2Constant->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); + lblFrom = new QLabel("from",h2ConstantWidget); + lblFrom->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); + h2Constant->addWidget(lblFrom); + spinFrom = new QSpinBox(h2ConstantWidget); + h2Constant->addWidget(spinFrom); + lblTo = new QLabel("to",h2ConstantWidget); + lblTo->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); + h2Constant->addWidget(lblTo); + spinTo = new QSpinBox(h2ConstantWidget); + h2Constant->addWidget(spinTo); + h2Constant->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); + lblSize = new QLabel("Size",h2ConstantWidget); + lblSize->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); + h2Constant->addWidget(lblSize); + spinSize = new QSpinBox(h2ConstantWidget); + h2Constant->addWidget(spinSize); + h2Constant->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); + + /** Specific Values Layout */ + QWidget *h2SpecificWidget = new QWidget(group); + h2SpecificWidget->setGeometry(QRect(10, 30, group->width()-20, 31)); + QHBoxLayout *h2Specific = new QHBoxLayout(h2SpecificWidget); + h2Specific->setContentsMargins(0, 0, 0, 0); + h2Specific->addItem(new QSpacerItem(200,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); + comboSpecific = new QComboBox(h2SpecificWidget); + h2Specific->addWidget(comboSpecific); + comboSpecific->hide(); + h2Specific->addItem(new QSpacerItem(200,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); + + /** Values From a File Layout */ + QWidget *h2ValuesWidget = new QWidget(group); + h2ValuesWidget->setGeometry(QRect(10, 30, group->width()-20, 31)); + QHBoxLayout *h2Values = new QHBoxLayout(h2ValuesWidget); + h2Values->setContentsMargins(0, 0, 0, 0); + h2Values->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); + dispValues = new QLineEdit("steps.txt",h2ValuesWidget); + dispValues->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed); + h2Values->addWidget(dispValues); + dispValues->hide(); + btnValues = new QPushButton("Browse",h2ValuesWidget); + btnValues->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); + h2Values->addWidget(btnValues); + btnValues->hide(); + h2Values->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); + + } + +} + + + +void ActionsWidget::Initialization(){ + connect(comboScript,SIGNAL(currentIndexChanged(int)),this,SLOT(SetScript(int))); + connect(radioConstant,SIGNAL(toggled(bool)),this,SLOT(EnableSizeWidgets())); + connect(radioSpecific,SIGNAL(toggled(bool)),this,SLOT(EnableSizeWidgets())); + connect(radioValue,SIGNAL(toggled(bool)),this,SLOT(EnableSizeWidgets())); +} + + + +void ActionsWidget::SetScript(int index){ + /** defaults */ + dispScript->setEnabled(false); + btnBrowse->setEnabled(false); + lblParameter->setEnabled(false); + dispParameter->setEnabled(false); + if(comboScript->count()>2){ + group->setEnabled(false); + lblSteps->setEnabled(false); + spinSteps->setEnabled(false); + lblPrecision->setEnabled(false); + spinPrecision->setEnabled(false); + } + /** If anything other than None is selected*/ + if(index){ + /** 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){ + group->setEnabled(true); + lblPrecision->setEnabled(true); + spinPrecision->setEnabled(true); + /** Steps are enabled only if constant step size is not checked*/ + lblSteps->setEnabled(!radioConstant->isChecked()); + spinSteps->setEnabled(!radioConstant->isChecked()); + } + } +} + + + + +void ActionsWidget::EnableSizeWidgets(){ + /** defaults */ + lblFrom->hide(); + spinFrom->hide(); + lblTo->hide(); + spinTo->hide(); + lblSize->hide(); + spinSize->hide(); + comboSpecific->hide(); + dispValues->hide(); + btnValues->hide(); + lblSteps->setEnabled(true); + spinSteps->setEnabled(true); + /** Constant Step Size */ + if(radioConstant->isChecked()){ + lblFrom->show(); + spinFrom->show(); + lblTo->show(); + spinTo->show(); + lblSize->show(); + spinSize->show(); + lblSteps->setEnabled(false); + spinSteps->setEnabled(false); + }/** Specific Values */ + else if(radioSpecific->isChecked()) + comboSpecific->show(); + /** Values from a File */ + else{ + dispValues->show(); + btnValues->show(); + } +} + diff --git a/slsDetectorGui/src/qCloneWidget.cpp b/slsDetectorGui/src/qCloneWidget.cpp index ad6557b9f..fd458a62a 100644 --- a/slsDetectorGui/src/qCloneWidget.cpp +++ b/slsDetectorGui/src/qCloneWidget.cpp @@ -52,7 +52,6 @@ void qCloneWidget::SetupWidgetWindow(QString title,int numDim,SlsQt1DPlot*& plot gridClone = new QGridLayout(cloneBox); cloneBox->setLayout(gridClone); cloneBox->setContentsMargins(0,0,0,0); - //cloneBox->resize(400,200); cloneBox->setTitle(title); cloneBox->setAlignment(Qt::AlignHCenter); cloneBox->setFont(QFont("Sans Serif",11,QFont::Bold)); @@ -86,6 +85,7 @@ void qCloneWidget::SetupWidgetWindow(QString title,int numDim,SlsQt1DPlot*& plot hLayoutSave->setSpacing(0); /** file name */ dispFName = new QLineEdit(this); + dispFName->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); hLayoutSave->addWidget(dispFName); /** file format */ comboFormat = new QComboBox(this); @@ -118,6 +118,8 @@ void qCloneWidget::SetupWidgetWindow(QString title,int numDim,SlsQt1DPlot*& plot /** Save */ connect(btnSave, SIGNAL(clicked()), this, SLOT(SavePlot())); + setMinimumHeight(300); + resize(500,350); } diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 5b5ec9fca..3d5090da2 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -36,7 +36,7 @@ int main (int argc, char **argv) { qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app, QWidget *parent) : - QMainWindow(parent), theApp(app),myPlot(NULL),tabs(NULL){ + QMainWindow(parent), theApp(app),myPlot(NULL),tabs(NULL),isDeveloper(0){ myDet = 0; setupUi(this); SetUpWidgetWindow(); @@ -44,7 +44,7 @@ qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app, QWidget * /**need to use argc and argv to determine which slsdet or multidet to use.*/ for(int iarg=1; iargsetFixedHeight(centralwidget->height()); } @@ -88,7 +86,7 @@ void qDetectorMain::SetUpWidgetWindow(){ dockWidgetPlot->setWidget(myPlot); /**tabs setup*/ - tabs = new QTabWidget(this); + tabs = new MyTabWidget(this); layoutTabs->addWidget(tabs); /** creating all the tab widgets */ tab_measurement = new qTabMeasurement (this, myDet,myPlot); @@ -114,6 +112,7 @@ void qDetectorMain::SetUpWidgetWindow(){ scroll[Debugging] ->setWidget(tab_debugging); scroll[Developer] ->setWidget(tab_developer); + /** inserting all the tabs*/ tabs->insertTab(Measurement, scroll[Measurement], "Measurement"); tabs->insertTab(DataOutput, scroll[DataOutput], "Data Output"); @@ -130,6 +129,9 @@ void qDetectorMain::SetUpWidgetWindow(){ SetExpertMode(false); SetDeveloperMode(false); + tabs->tabBar()->setTabTextColor(0,QColor(0,0,200,255)); + + } @@ -172,6 +174,9 @@ void qDetectorMain::Initialization(){ /** Plotting */ /** When the acquisition is finished, must update the meas tab */ + connect(tab_measurement, SIGNAL(StartSignal()), this,SLOT(EnableTabs())); + connect(tab_measurement, SIGNAL(StopSignal()), this,SLOT(EnableTabs())); + connect(myPlot, SIGNAL(UpdatingPlotFinished()), this,SLOT(EnableTabs())); connect(myPlot, SIGNAL(UpdatingPlotFinished()), tab_measurement,SLOT(UpdateFinished())); @@ -195,7 +200,7 @@ void qDetectorMain::Initialization(){ connect(actionVersion,SIGNAL(triggered()),this,SLOT(Version())); heightPlotWindow = dockWidgetPlot->size().height(); - + heightCentralWidget = centralwidget->size().height(); } @@ -224,9 +229,8 @@ void qDetectorMain::SetExpertMode(bool b){ #ifdef VERBOSE cout<<"Setting Expert Mode to "<setTabEnabled(Advanced,b); - tab_advanced->setEnabled(b); + } @@ -237,6 +241,13 @@ void qDetectorMain::refresh(int index){ else{ ; } + for(int i=0;iisTabEnabled(i)) + tabs->tabBar()->setTabTextColor(i,Qt::black); + else + tabs->tabBar()->setTabTextColor(i,Qt::gray); + } + tabs->tabBar()->setTabTextColor(index,QColor(0,0,200,255)); } @@ -324,24 +335,45 @@ void qDetectorMain::ResizeMainWindow(bool b){ cout<<"Resizing Main Window: height:"<setMinimumHeight(0); + cout<<"undocking it from main window"<setMinimumHeight(heightPlotWindow); - + /** the minimum for plot will be set when the widget gets resized automatically*/ } - - } + +void qDetectorMain::resizeEvent(QResizeEvent* event){ + if(!dockWidgetPlot->isFloating()){ + if(tabs->currentIndex()== Actions){ + dockWidgetPlot->setMinimumHeight(heightPlotWindow-100); + centralwidget->setMaximumHeight(QWIDGETSIZE_MAX); + + } + else{ + dockWidgetPlot->setMinimumHeight(height()-centralwidget->height()-50); + centralwidget->setMaximumHeight(heightCentralWidget); + } + } +#ifdef VERBOSE + cout<<"height:"<height()<setMinimumWidth(width()/2); } @@ -350,5 +382,34 @@ void qDetectorMain::SetTerminalWindowSize(bool b){ dockWidgetTerminal->setMinimumWidth(38); QSizePolicy sizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred); dockWidgetTerminal->setSizePolicy(sizePolicy); + }*/ +} + + + +void qDetectorMain::EnableTabs(){ + bool enable; + enable=(tabs->isTabEnabled(DataOutput)?false:true); + + // or use the Enable/Disable button + /** normal tabs*/ + tabs->setTabEnabled(DataOutput,enable); + tabs->setTabEnabled(Actions,enable); + tabs->setTabEnabled(Settings,enable); + + /** 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 */ + if(actionDebug->isChecked()) + tabs->setTabEnabled(Debugging,enable); + if(actionExpert->isChecked()) + tabs->setTabEnabled(Advanced,enable); + if(isDeveloper) + tabs->setTabEnabled(Developer,enable); } } diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index ba249a1c0..954f5b3c1 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -286,14 +286,14 @@ void* qDrawPlot::AcquireImages(){ /* if(framePeriodtitle(),(int)plot_in_scope,plot1D,plot2D,myDet->getFilePath()); if(plot_in_scope==1){ plot1D = new SlsQt1DPlot(boxPlot); @@ -454,11 +457,16 @@ void qDrawPlot::ClonePlot(){ plot2D->SetZTitle(imageZAxisTitle); plotLayout->addWidget(plot2D,1,1,1,1); } + setMinimumHeight(preheight); + resize(width(),preheight); + /** update the actual plot */ UpdatePlot(); connect(this, SIGNAL(InterpolateSignal(bool)), plot2D, SIGNAL(InterpolateSignal(bool))); connect(this, SIGNAL(ContourSignal(bool)), plot2D, SIGNAL(ContourSignal(bool))); connect(this, SIGNAL(LogzSignal(bool)), plot2D, SLOT(SetZScaleToLog(bool))); winClone[i]->show(); + + /** to remember which all clone widgets were closed*/ connect(winClone[i], SIGNAL(CloneClosedSignal(int)),this, SLOT(CloneCloseEvent(int))); } diff --git a/slsDetectorGui/src/qTabActions.cpp b/slsDetectorGui/src/qTabActions.cpp index d79d9a765..bc7318f65 100644 --- a/slsDetectorGui/src/qTabActions.cpp +++ b/slsDetectorGui/src/qTabActions.cpp @@ -7,9 +7,18 @@ /** Qt Project Class Headers */ #include "qTabActions.h" #include "qDefs.h" +#include "qActionsWidget.h" /** Project Class Headers */ #include "slsDetector.h" #include "multiSlsDetector.h" +/** Qt Include Headers */ + +#include +#include +#include +#include +#include +#include /** C++ Include Headers */ #include using namespace std; @@ -20,7 +29,7 @@ using namespace std; qTabActions::qTabActions(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){ - setupUi(this); + //setupUi(this); if(myDet) { SetupWidgetWindow(); @@ -39,20 +48,209 @@ qTabActions::~qTabActions(){ void qTabActions::SetupWidgetWindow(){ + setupUi(this); + /** Window Settings*/ + setFixedSize(705,350); + setContentsMargins(0,0,0,0); + + /** Scroll Area Settings*/ + QScrollArea *scroll = new QScrollArea; + scroll->setWidget(this); + scroll->setWidgetResizable(true); + + /** Layout Settings*/ + gridLayout = new QGridLayout(scroll); + setLayout(gridLayout); + gridLayout->setContentsMargins(10,5,0,0); + gridLayout->setVerticalSpacing(2); + + /** Buttongroup to know which +/- button was clicked*/ + group = new QButtonGroup(this); + palette = new QPalette(); + + /** For each level of Actions */ + for(int i=0;isetFixedSize(20,20); + lblName[i] = new QLabel(""); + group->addButton(btnExpand[i],i); + gridLayout->addWidget(btnExpand[i],(i*2),0); + gridLayout->addWidget(lblName[i],(i*2),1); + gridLayout->addWidget(actionWidget[i],(i*2)+1,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"); + + /** initially hide all the widgets*/ + for(int i=0;ihide(); + } void qTabActions::Initialization(){ + connect(group,SIGNAL(buttonClicked(QAbstractButton*)),this,SLOT(Expand(QAbstractButton*))); +} + + + + +void qTabActions::Enable(bool enable){ + + +} + + + +void qTabActions::Expand(QAbstractButton *button ){ + int index = group->id(button); + /** 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)) + setFixedHeight(height()-130); + else + setFixedHeight(height()-30); + }else{ + /** Expand */ + palette->setColor(QPalette::WindowText,QColor(0,0,200,255)); + lblName[index]->setPalette(*palette); + actionWidget[index]->show(); + button->setText("-"); + if((index==1)||(index==2)) + 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::Enable(bool enable){ - //this->setEnabled(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(),"+")){ +*/ + diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index c03b6e3ec..778f3f908 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -9,8 +9,11 @@ /** Project Class Headers */ #include "slsDetector.h" #include "multiSlsDetector.h" +/** Qt Include Headers */ +#include /** C++ Include Headers */ -#include +#include +#include using namespace std; @@ -18,7 +21,8 @@ using namespace std; -qTabDataOutput::qTabDataOutput(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){ +qTabDataOutput::qTabDataOutput(QWidget *parent,slsDetectorUtils*& detector): + QWidget(parent),myDet(detector){ setupUi(this); if(myDet) { @@ -38,18 +42,39 @@ qTabDataOutput::~qTabDataOutput(){ void qTabDataOutput::SetupWidgetWindow(){ + outputDir= QString(myDet->getFilePath().c_str()); + dispOutputDir->setText(outputDir); } void qTabDataOutput::Initialization(){ + connect(dispOutputDir, SIGNAL(textChanged(const QString&)), this, SLOT(setOutputDir(const QString&))); + connect(btnOutputBrowse, SIGNAL(clicked()), this, SLOT(browseOutputDir())); } void qTabDataOutput::Enable(bool enable){ - //this->setEnabled(enable); - + layoutOutput->setEnabled(enable); + boxCorrection->setEnabled(enable); +} + + +void qTabDataOutput::setOutputDir(const QString& path){ + outputDir = path; + myDet->setFilePath(string(outputDir.toAscii().constData())); +#ifdef VERBOSE + cout<<"Output Directory changed to :"<getFilePath()<text()); + if (!directory.isEmpty()) + dispOutputDir->setText(directory); } diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 53001766b..a83220531 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -170,9 +170,8 @@ void qTabMeasurement::DeInitialization(){ void qTabMeasurement::Enable(bool enable){ - gridTimeResolved->setEnabled(enable); - gridLayout->setEnabled(enable); - boxProgress->setEnabled(enable); + frameTimeResolved->setEnabled(enable); + frameNotTimeResolved->setEnabled(enable); /** Enable this always **/ if(!enable) btnStartStop->setEnabled(true); } @@ -217,12 +216,14 @@ void qTabMeasurement::startStopAcquisition(){ #endif btnStartStop->setText("Stop"); Enable(0); + emit StartSignal(); }else{ #ifdef VERBOSE cout<<"Stopping Acquisition"<setText("Start"); Enable(1); + emit StopSignal(); } myPlot->StartStopDaqToggle(); } diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index ed39e931a..f1393b91b 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -36,7 +36,7 @@ qTabPlot::qTabPlot(QWidget *parent,slsDetectorUtils*& detector, qDrawPlot*& plot //This also selects the text if unchecked //includes setupwidgetwindow //SelectPlot(1); - Select1DPlot(false); + Select1DPlot(true); Initialization(); } } @@ -115,10 +115,10 @@ void qTabPlot::Initialization(){ connect(chkXAxis, SIGNAL(toggled(bool)), this, SLOT(EnableTitles())); connect(chkYAxis, SIGNAL(toggled(bool)), this, SLOT(EnableTitles())); connect(chkZAxis, SIGNAL(toggled(bool)), this, SLOT(EnableTitles())); - connect(dispTitle, SIGNAL(returnPressed()), this, SLOT(SetTitles())); - connect(dispXAxis, SIGNAL(returnPressed()), this, SLOT(SetTitles())); - connect(dispYAxis, SIGNAL(returnPressed()), this, SLOT(SetTitles())); - connect(dispZAxis, SIGNAL(returnPressed()), this, SLOT(SetTitles())); + connect(dispTitle, SIGNAL(textChanged(const QString&)), this, SLOT(SetTitles())); + connect(dispXAxis, SIGNAL(textChanged(const QString&)), this, SLOT(SetTitles())); + connect(dispYAxis, SIGNAL(textChanged(const QString&)), this, SLOT(SetTitles())); + connect(dispZAxis, SIGNAL(textChanged(const QString&)), this, SLOT(SetTitles())); /** Common Buttons*/ connect(btnClear, SIGNAL(clicked()), myPlot, SLOT(Clear1DPlot())); /** Save */ From 06ec6558a1d922a15387a23fa066a7ecb9fb2b4c Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 6 Jun 2012 15:44:33 +0000 Subject: [PATCH 007/332] Got rid of tabAction form git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@7 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qTabActions.h | 17 +++++++---------- slsDetectorGui/slsDetectorGui.pro | 2 +- slsDetectorGui/src/qActionsWidget.cpp | 8 +++++--- slsDetectorGui/src/qTabActions.cpp | 10 +--------- 4 files changed, 14 insertions(+), 23 deletions(-) diff --git a/slsDetectorGui/include/qTabActions.h b/slsDetectorGui/include/qTabActions.h index 48c15114c..e14feea8d 100644 --- a/slsDetectorGui/include/qTabActions.h +++ b/slsDetectorGui/include/qTabActions.h @@ -8,25 +8,22 @@ #ifndef QTABACTIONS_H_ #define QTABACTIONS_H_ - -/** Form Header */ -#include "ui_form_tab_actions.h" /** Project Class Headers */ class slsDetectorUtils; class ActionsWidget; - -class QPushButton; -class QLabel; -class QScrollArea; -class QGridLayout; -class QPalette; +#include +#include +#include +#include +#include +#include /** *@short sets up the acions parameters */ -class qTabActions:public QWidget,private Ui::TabActionsObject{ +class qTabActions:public QWidget{ Q_OBJECT public: diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index 242c91771..fdd4d6b91 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -86,7 +86,7 @@ FORMS = \ forms/form_tab_measurement.ui\ forms/form_tab_dataoutput.ui\ forms/form_tab_plot.ui\ - forms/form_tab_actions.ui\ +# forms/form_tab_actions.ui\ forms/form_tab_advanced.ui\ forms/form_tab_settings.ui\ forms/form_tab_debugging.ui\ diff --git a/slsDetectorGui/src/qActionsWidget.cpp b/slsDetectorGui/src/qActionsWidget.cpp index b1c7ea074..7b3e0514a 100644 --- a/slsDetectorGui/src/qActionsWidget.cpp +++ b/slsDetectorGui/src/qActionsWidget.cpp @@ -185,9 +185,11 @@ void ActionsWidget::SetupWidgetWindow(int scanType){ void ActionsWidget::Initialization(){ connect(comboScript,SIGNAL(currentIndexChanged(int)),this,SLOT(SetScript(int))); - connect(radioConstant,SIGNAL(toggled(bool)),this,SLOT(EnableSizeWidgets())); - connect(radioSpecific,SIGNAL(toggled(bool)),this,SLOT(EnableSizeWidgets())); - connect(radioValue,SIGNAL(toggled(bool)),this,SLOT(EnableSizeWidgets())); + if(comboScript->count()>2){ + connect(radioConstant,SIGNAL(toggled(bool)),this,SLOT(EnableSizeWidgets())); + connect(radioSpecific,SIGNAL(toggled(bool)),this,SLOT(EnableSizeWidgets())); + connect(radioValue,SIGNAL(toggled(bool)),this,SLOT(EnableSizeWidgets())); + } } diff --git a/slsDetectorGui/src/qTabActions.cpp b/slsDetectorGui/src/qTabActions.cpp index bc7318f65..10fd7ea2f 100644 --- a/slsDetectorGui/src/qTabActions.cpp +++ b/slsDetectorGui/src/qTabActions.cpp @@ -12,13 +12,7 @@ #include "slsDetector.h" #include "multiSlsDetector.h" /** Qt Include Headers */ - -#include -#include -#include -#include -#include -#include +#include /** C++ Include Headers */ #include using namespace std; @@ -29,7 +23,6 @@ using namespace std; qTabActions::qTabActions(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){ - //setupUi(this); if(myDet) { SetupWidgetWindow(); @@ -48,7 +41,6 @@ qTabActions::~qTabActions(){ void qTabActions::SetupWidgetWindow(){ - setupUi(this); /** Window Settings*/ setFixedSize(705,350); setContentsMargins(0,0,0,0); From ef41286bf0a84165d24b36e11127f08836a21177 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 6 Jun 2012 15:45:46 +0000 Subject: [PATCH 008/332] Got rid of tabAction form git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@8 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qTabMeasurement.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index a83220531..ad3277305 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -333,6 +333,7 @@ void qTabMeasurement::setTimingMode(int mode){ switch(mode){ case None: + lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true); break; case Auto: lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); From 2b02f94fe3dae821e5629f86956d1384d40f0def Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 8 Jun 2012 10:21:30 +0000 Subject: [PATCH 009/332] small changes from the meeting git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@9 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_detectormain.ui | 130 +----------- slsDetectorGui/forms/form_tab_dataoutput.ui | 117 ++++++----- slsDetectorGui/forms/form_tab_measurement.ui | 84 +++++++- slsDetectorGui/forms/form_tab_plot.ui | 210 +++++++++++++++---- slsDetectorGui/forms/form_tab_settings.ui | 41 +++- slsDetectorGui/include/qDefs.h | 19 +- slsDetectorGui/include/qDetectorMain.h | 24 +-- slsDetectorGui/include/qTabMeasurement.h | 1 + slsDetectorGui/src/qCloneWidget.cpp | 2 +- slsDetectorGui/src/qDetectorMain.cpp | 38 +--- slsDetectorGui/src/qTabMeasurement.cpp | 81 +++++-- 11 files changed, 442 insertions(+), 305 deletions(-) diff --git a/slsDetectorGui/forms/form_detectormain.ui b/slsDetectorGui/forms/form_detectormain.ui index 3a1a8c03f..aec8c9c4a 100644 --- a/slsDetectorGui/forms/form_detectormain.ui +++ b/slsDetectorGui/forms/form_detectormain.ui @@ -10,7 +10,7 @@ 0 0 800 - 800 + 848 @@ -137,134 +137,6 @@ - - - - 0 - 0 - - - - - 38 - 200 - - - - - 524287 - 390 - - - - - - - - - 0 - 0 - 0 - - - - - - - - - 0 - 0 - 0 - - - - - - - - - 119 - 119 - 119 - - - - - - - - - 11 - 75 - true - - - - Undock, move and enlarge the window to use it - - - false - - - QDockWidget::DockWidgetVerticalTitleBar - - - Qt::BottomDockWidgetArea|Qt::RightDockWidgetArea - - - SLS Detector Terminal - - - 2 - - - - - - - - - 0 - 0 - 0 - - - - - - - - - 0 - 0 - 0 - - - - - - - - - 119 - 119 - 119 - - - - - - - - - 9 - 50 - false - - - - true diff --git a/slsDetectorGui/forms/form_tab_dataoutput.ui b/slsDetectorGui/forms/form_tab_dataoutput.ui index dc489de08..82f060c07 100644 --- a/slsDetectorGui/forms/form_tab_dataoutput.ui +++ b/slsDetectorGui/forms/form_tab_dataoutput.ui @@ -74,62 +74,9 @@ - + - - - - Acquire Flat Field Data - - - - - - - Auto - - - - - - - - - - - 0 - 0 - - - - Browse - - - - - - - Custom dead time(ns): - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 40 - 20 - - - - @@ -157,6 +104,68 @@ + + + + + 0 + 0 + + + + Browse + + + + + + + Auto + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + + + + + Custom dead time(ns): + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + diff --git a/slsDetectorGui/forms/form_tab_measurement.ui b/slsDetectorGui/forms/form_tab_measurement.ui index 17e938b1e..34f62b022 100644 --- a/slsDetectorGui/forms/form_tab_measurement.ui +++ b/slsDetectorGui/forms/form_tab_measurement.ui @@ -6,8 +6,8 @@ 0 0 - 718 - 339 + 775 + 345 @@ -25,7 +25,7 @@ 1000 - 339 + 345 @@ -152,7 +152,7 @@ - 20 + 30 179 319 90 @@ -213,7 +213,7 @@ - 20 + 30 289 319 31 @@ -238,7 +238,7 @@ - 352 + 390 8 362 342 @@ -330,6 +330,9 @@ Frame period between exposures. #period# + + 9 + 2000000000.000000000000000 @@ -595,7 +598,7 @@ - false + true Exposure Time: @@ -605,7 +608,7 @@ - false + true @@ -617,18 +620,24 @@ Exposure time of each frame. #exptime# + + 9 + + + 0.000000000000000 + 2000000000.000000000000000 - 0.000000000000000 + 1.000000000000000 - false + true @@ -696,6 +705,9 @@ Frame period between exposures. #period# + + 9 + 2000000000.000000000000000 @@ -772,7 +784,7 @@ - 10 + 20 5 336 159 @@ -902,6 +914,56 @@ + + + + 130 + 330 + 521 + 16 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 193 + 193 + 193 + + + + + + + + * Note: The Acquisition Period should be greater than or equal to the Exposure Time. + + diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index 598c64587..ae96c559c 100644 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -6,7 +6,7 @@ 0 0 - 734 + 775 345 @@ -35,9 +35,9 @@ 10 - 130 - 711 - 146 + 135 + 751 + 141 @@ -53,8 +53,8 @@ 10 - 20 - 691 + 15 + 731 121 @@ -288,9 +288,9 @@ - 11 + 150 70 - 571 + 466 46 @@ -306,15 +306,21 @@ - 8 + 10 20 - 551 + 451 22 + + + 0 + 0 + + Interpolate @@ -322,6 +328,12 @@ + + + 0 + 0 + + Contour @@ -329,6 +341,12 @@ + + + 0 + 0 + + Log Scale (Z) @@ -339,9 +357,12 @@ Qt::Horizontal + + QSizePolicy::Fixed + - 40 + 210 20 @@ -353,9 +374,9 @@ - 10 + 150 10 - 571 + 466 46 @@ -491,7 +512,7 @@ 10 20 - 641 + 371 21 @@ -503,10 +524,10 @@ - + - + 0 0 @@ -519,7 +540,7 @@ - + Qt::Horizontal @@ -529,7 +550,71 @@ - 400 + 20 + 10 + + + + + + + + false + + + + 0 + 0 + + + + 1 + + + 10 + + + 1 + + + + + + + false + + + Persistency: + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 5 + 10 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 10 @@ -537,20 +622,18 @@ - gridLayoutWidget_3 - groupBox_2 10 290 - 711 + 751 51 - Save + Save Image Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter @@ -563,7 +646,7 @@ 10 15 - 698 + 741 31 @@ -676,14 +759,14 @@ - 599 + 655 10 - 121 - 81 + 106 + 101 - Clone + Snapshot Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter @@ -695,25 +778,28 @@ 5 - 10 - 111 + 19 + 101 76 - - 9 - - - 9 + + 28 - -1 + 8 + + + 0 + + + 0 - + 0 0 @@ -722,14 +808,14 @@ Qt::NoFocus - Clone Plot + Create - + 0 0 @@ -745,6 +831,54 @@ + + + true + + + + 10 + 10 + 106 + 101 + + + + Plot Arguments + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + false + + + + + 10 + 20 + 91 + 44 + + + + + + + None + + + + + + + Data Graph + + + + + + diff --git a/slsDetectorGui/forms/form_tab_settings.ui b/slsDetectorGui/forms/form_tab_settings.ui index 3e6430581..d1b7ad2d5 100644 --- a/slsDetectorGui/forms/form_tab_settings.ui +++ b/slsDetectorGui/forms/form_tab_settings.ui @@ -36,8 +36,8 @@ 13 16 - 227 - 47 + 311 + 151 @@ -107,6 +107,43 @@ + + + + Threshold: + + + + + + + -1 + + + -1 + + + + + + + Number of Modules: + + + + + + + Dynamic Range: + + + + + + + + + diff --git a/slsDetectorGui/include/qDefs.h b/slsDetectorGui/include/qDefs.h index 3785a7e34..309bc9efe 100644 --- a/slsDetectorGui/include/qDefs.h +++ b/slsDetectorGui/include/qDefs.h @@ -8,6 +8,9 @@ #ifndef QDEFS_H #define QDEFS_H +#include +using namespace std; + class qDefs { public: @@ -32,18 +35,18 @@ public: * @param value time * returns time value in ns */ - static int64_t get64bTime(timeUnit unit, double value){ - int64_t value64=value; + static float getNSTime(timeUnit unit, float value){ + float valueNS=value; switch(unit){ - case HOURS: value64*=60; - case MINUTES: value64*=60; - case SECONDS: value64*=1000; - case MILLISECONDS: value64*=1000; - case MICROSECONDS: value64*=1000; + case HOURS: valueNS*=60; + case MINUTES: valueNS*=60; + case SECONDS: valueNS*=1000; + case MILLISECONDS: valueNS*=1000; + case MICROSECONDS: valueNS*=1000; case NANOSECONDS: default:; } - return value64; + return valueNS; }; diff --git a/slsDetectorGui/include/qDetectorMain.h b/slsDetectorGui/include/qDetectorMain.h index bebc826d7..de6fb44ce 100644 --- a/slsDetectorGui/include/qDetectorMain.h +++ b/slsDetectorGui/include/qDetectorMain.h @@ -27,19 +27,12 @@ class slsDetectorUtils; #include #include -class MyTabWidget:public QTabWidget -{ +/** To Over-ride the QTabWidget class to get the tabBar */ +class MyTabWidget:public QTabWidget{ public: - MyTabWidget(QWidget* parent = 0) - { - setParent(parent); - } - + MyTabWidget(QWidget* parent = 0) {setParent(parent);} //Overridden method from QTabWidget - QTabBar* tabBar() - { - return QTabWidget::tabBar(); - } + QTabBar* tabBar(){return QTabWidget::tabBar();} }; @@ -81,7 +74,9 @@ private: /** default height of central widgetwhen plot Window when docked */ int heightCentralWidget; /** enumeration of the tabs */ - enum {Measurement, DataOutput, Plot, Actions, Settings, Advanced, Debugging, Developer, NumberOfTabs }; + enum {Measurement, Settings, DataOutput, Plot, Actions, Advanced, Debugging, Developer, NumberOfTabs }; + + QColor defaultTabColor; /* Scroll Area for the tabs**/ QScrollArea *scroll[NumberOfTabs]; @@ -178,11 +173,6 @@ void About(); */ void ResizeMainWindow(bool b); -/** Sets the Size of the undocked/docked terminal window - * @param b bool TRUE if undocked(outside main window), FALSE docked - */ -void SetTerminalWindowSize(bool b); - /** Enables/disables tabs depending on if acquisition is currently in progress */ void EnableTabs(); diff --git a/slsDetectorGui/include/qTabMeasurement.h b/slsDetectorGui/include/qTabMeasurement.h index 1ebbaab99..a2084615c 100644 --- a/slsDetectorGui/include/qTabMeasurement.h +++ b/slsDetectorGui/include/qTabMeasurement.h @@ -47,6 +47,7 @@ private: enum{None, Auto, Gated, Trigger_Exp_Series, Trigger_Frame, Trigger_Readout, Gated_Start, Trigger_Window, NumTimingModes}; + /** methods */ /** Sets up the widget */ diff --git a/slsDetectorGui/src/qCloneWidget.cpp b/slsDetectorGui/src/qCloneWidget.cpp index fd458a62a..7903d4950 100644 --- a/slsDetectorGui/src/qCloneWidget.cpp +++ b/slsDetectorGui/src/qCloneWidget.cpp @@ -71,7 +71,7 @@ void qCloneWidget::SetupWidgetWindow(QString title,int numDim,SlsQt1DPlot*& plot } /** Save group box */ - boxSave = new QGroupBox("Save",this); + boxSave = new QGroupBox("Save Image",this); boxSave->setFixedHeight(45); boxSave->setContentsMargins(0,8,0,0); layoutSave = new QHBoxLayout; diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 3d5090da2..640456d64 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -164,7 +164,6 @@ void qDetectorMain::SetUpDetector(){ void qDetectorMain::Initialization(){ /** Dockable Plot*/ connect(dockWidgetPlot,SIGNAL(topLevelChanged(bool)),this,SLOT(ResizeMainWindow(bool))); - connect(dockWidgetTerminal,SIGNAL(topLevelChanged(bool)),this,SLOT(SetTerminalWindowSize(bool))); /** tabs */ connect(tabs,SIGNAL(currentChanged(int)),this, SLOT(refresh(int)));//( QWidget*))); @@ -201,6 +200,8 @@ void qDetectorMain::Initialization(){ heightPlotWindow = dockWidgetPlot->size().height(); heightCentralWidget = centralwidget->size().height(); + + defaultTabColor = tabs->tabBar()->tabTextColor(DataOutput); } @@ -241,12 +242,8 @@ void qDetectorMain::refresh(int index){ else{ ; } - for(int i=0;iisTabEnabled(i)) - tabs->tabBar()->setTabTextColor(i,Qt::black); - else - tabs->tabBar()->setTabTextColor(i,Qt::gray); - } + for(int i=0;itabBar()->setTabTextColor(i,defaultTabColor); tabs->tabBar()->setTabTextColor(index,QColor(0,0,200,255)); } @@ -255,15 +252,12 @@ void qDetectorMain::SetDockableMode(bool b){ #ifdef VERBOSE cout<<"Setting Dockable Mode to "<setFeatures(QDockWidget::DockWidgetFloatable); - dockWidgetTerminal->setFeatures(QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetVerticalTitleBar); - - }else{ + else{ + dockWidgetPlot->setFloating(false); dockWidgetPlot->setFeatures(QDockWidget::NoDockWidgetFeatures); - dockWidgetTerminal->setFeatures(QDockWidget::DockWidgetVerticalTitleBar); } - } @@ -368,24 +362,6 @@ void qDetectorMain::resizeEvent(QResizeEvent* event){ -//prolly not needed -void qDetectorMain::SetTerminalWindowSize(bool b){ -#ifdef VERBOSE - cout<<"Resizing Terminal Window"<setMinimumWidth(width()/2); - } - - else{ - dockWidgetTerminal->setMinimumWidth(38); - QSizePolicy sizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred); - dockWidgetTerminal->setSizePolicy(sizePolicy); - }*/ -} - - void qDetectorMain::EnableTabs(){ bool enable; diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index ad3277305..39d86fbf0 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -48,6 +48,13 @@ qTabMeasurement::~qTabMeasurement(){ void qTabMeasurement::SetupWidgetWindow(){ + /** Exp Time **/ + float time = (float)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-9)); + spinExpTime->setValue(time); + comboExpUnit->setCurrentIndex(qDefs::SECONDS); + + lblNote->hide(); + /** File Name **/ dispFileName->setText(QString(myDet->getFileName().c_str())); /** File Index **/ @@ -241,30 +248,58 @@ void qTabMeasurement::setNumFrames(int val){ void qTabMeasurement::setExposureTime(){ - int64_t exptime64; + int64_t exptimeNS; /** Get the 64 bit value of timer**/ - exptime64 = qDefs::get64bTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value()); + exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value()); #ifdef VERBOSE - cout<<"Setting acquisition time to " << exptime64 << " clocks" << endl; + cout<<"Setting acquisition time to " << exptimeNS << " clocks" << endl; #endif - myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,exptime64); + myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,exptimeNS); - //float t=exptime64; + if(lblPeriod->isEnabled()){ + int64_t acqtimeNS; + acqtimeNS = qDefs::getNSTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value()); + if(exptimeNS>acqtimeNS) { + lblNote->show(); + lblPeriod->setPalette(lblNote->palette()); + lblPeriod->setText("* Acquisition Period"); + } + else { + lblNote->hide(); + lblPeriod->setPalette(lblNumFrames->palette()); + lblPeriod->setText("Acquisition Period"); + } + } + //float t=exptimeNS; //emit acquisitionTimeChanged(t/(100E+6)); ?????????????????????? } void qTabMeasurement::setAcquisitionPeriod(){ - int64_t exptime64; + int64_t acqtimeNS; /** Get the 64 bit value of timer**/ - exptime64 = qDefs::get64bTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value()); + acqtimeNS = qDefs::getNSTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value()); #ifdef VERBOSE - cout<<"Setting frame period between exposures to " << exptime64 << " clocks" << endl; + cout<<"Setting frame period between exposures to " << acqtimeNS << " clocks" << endl; #endif - myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,exptime64); + myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,acqtimeNS); - //float t=exptime64; + int64_t exptimeNS; + exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value()); + if(exptimeNS>acqtimeNS){ + lblNote->show(); + lblPeriod->setPalette(lblNote->palette()); + lblPeriod->setText("* Acquisition Period"); + } + else { + lblNote->hide(); + lblPeriod->setPalette(lblNumFrames->palette()); + lblPeriod->setText("Acquisition Period"); + } + + + //float t=exptimeNS; //emit acquisitionTimeChanged(t/(100E+6)); ?????????????????????? } @@ -283,13 +318,13 @@ void qTabMeasurement::setNumTriggers(int val){ void qTabMeasurement::setDelay(){ - int64_t exptime64; + int64_t exptimeNS; /** Get the 64 bit value of timer**/ - exptime64 = qDefs::get64bTime((qDefs::timeUnit)comboDelayUnit->currentIndex(),spinDelay->value()); + exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboDelayUnit->currentIndex(),spinDelay->value()); #ifdef VERBOSE - cout<<"Setting delay after trigger to " << exptime64 << " clocks" << endl; + cout<<"Setting delay after trigger to " << exptimeNS << " clocks" << endl; #endif - myDet->setTimer(slsDetectorDefs::DELAY_AFTER_TRIGGER,exptime64); + myDet->setTimer(slsDetectorDefs::DELAY_AFTER_TRIGGER,exptimeNS); } @@ -415,6 +450,24 @@ void qTabMeasurement::setTimingMode(int mode){ #endif spinPeriod->setValue(time); comboPeriodUnit->setCurrentIndex(qDefs::SECONDS); + + int64_t exptimeNS,acqtimeNS; + exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value()); + acqtimeNS = qDefs::getNSTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value()); + if(exptimeNS>acqtimeNS) { + lblNote->show(); + lblPeriod->setPalette(lblNote->palette()); + lblPeriod->setText("* Acquisition Period"); + } + else { + lblNote->hide(); + lblPeriod->setPalette(lblNumFrames->palette()); + lblPeriod->setText("Acquisition Period"); + } + }else { + lblNote->hide(); + lblPeriod->setPalette(lblNumFrames->palette()); + lblPeriod->setText("Acquisition Period"); } /**Number of Triggers */ From 82461540329fac97be2e583db60a181cd89f089b Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 15 Jun 2012 12:10:54 +0000 Subject: [PATCH 010/332] Setting axes range and enabling/disabling zooming functionalities successfull git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@10 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_detectormain.ui | 24 +- slsDetectorGui/forms/form_tab_measurement.ui | 2 +- slsDetectorGui/forms/form_tab_plot.ui | 723 +++++++++--------- slsDetectorGui/include/qDetectorMain.h | 7 +- slsDetectorGui/include/qDrawPlot.h | 101 ++- slsDetectorGui/include/qTabMeasurement.h | 5 +- slsDetectorGui/include/qTabPlot.h | 23 +- .../slsDetectorPlotting/include/SlsQt1DPlot.h | 11 +- .../slsDetectorPlotting/src/SlsQt1DPlot.cxx | 62 +- slsDetectorGui/src/qCloneWidget.cpp | 2 +- slsDetectorGui/src/qDetectorMain.cpp | 17 +- slsDetectorGui/src/qDrawPlot.cpp | 382 +++++---- slsDetectorGui/src/qTabMeasurement.cpp | 32 +- slsDetectorGui/src/qTabPlot.cpp | 129 +++- 14 files changed, 907 insertions(+), 613 deletions(-) diff --git a/slsDetectorGui/forms/form_detectormain.ui b/slsDetectorGui/forms/form_detectormain.ui index aec8c9c4a..7ded9699e 100644 --- a/slsDetectorGui/forms/form_detectormain.ui +++ b/slsDetectorGui/forms/form_detectormain.ui @@ -200,10 +200,26 @@ Sans Serif 11 - 75 - true + 50 + false + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<table border="0" style="-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;"> +<tr> +<td style="border: none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#00007f;">Left Click :zoom in</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#00007f;">Righ</span><span style=" color:#00007f;">t Click </span><span style=" color:#00007f;">: zoom out by 1</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#00007f;">Middle Click : panning</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#00007f;">Ctrl+Right Click : zoom out to full size</span></p></td></tr></table></body></html> + + + + QDockWidget::NoDockWidgetFeatures @@ -275,8 +291,8 @@ 9 - 75 - true + 50 + false diff --git a/slsDetectorGui/forms/form_tab_measurement.ui b/slsDetectorGui/forms/form_tab_measurement.ui index 34f62b022..106f1831b 100644 --- a/slsDetectorGui/forms/form_tab_measurement.ui +++ b/slsDetectorGui/forms/form_tab_measurement.ui @@ -229,7 +229,7 @@ Qt::NoFocus - Starts Acquisition + Starts or Stops Acquisition Start diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index ae96c559c..1f8f3ba8d 100644 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -37,7 +37,7 @@ 10 135 751 - 141 + 136 @@ -62,44 +62,284 @@ QLayout::SetNoConstraint - - + + 0 + + + - X Axis: + Title: - - + + + + + + + true + - - 2 + + 0 0 + + + 50 + 0 + + + + + + + + + 0 + 0 + + + + Z Max: + + + + + + + + 0 + 0 + + + + + 50 + 0 + + + + + + + + + 0 + 0 + + + + Y Max: + + + + + + + + 0 + 0 + + + + X Max: + + + + + + + + 0 + 0 + + + + + 50 + 0 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + Z Min: + + + + + + + + 0 + 0 + + + + + 50 + 0 + + - + 0 0 - X min: + X Min: + + + 0 + 0 + + + + + 50 + 0 + + + + Qt::ImhDigitsOnly + + + + + 0 0 + + Y Min: + + + + + + + + 0 + 0 + + + + + 50 + 0 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + X Axis: + + + + + + + + 0 + 0 + + + + + 250 + 0 + + + + Qt::ImhDigitsOnly + + + + + + + + 0 + 0 + + + + Y Axis: + + + + + + + + 0 + 0 + + 20 @@ -111,113 +351,23 @@ - - - - X max: - - - - - - - - 0 - 0 - - - - - - - - Y Axis: - - - - - - - - 2 - 0 - - - - - - - - - 0 - 0 - - - - Y min: - - - - - + + 0 0 - - - 20 - 0 - - - - - - - - Y max: - - - - - - - - 0 - 0 - - - - - - Z Axis: - - - - - + + - - 0 - 0 - - - - Z min: - - - - - - - + 0 0 @@ -228,64 +378,18 @@ 0 - - - - - - true - - - Z max: + + Qt::ImhDigitsOnly - - - - true - - - - 0 - 0 - - - - - 0 - 0 - - - - - - - - Qt::Horizontal - - - - 20 - 20 - - - - - - - - Title: - - - - - - + + true + 150 @@ -308,7 +412,7 @@ 10 20 - 451 + 496 22 @@ -380,124 +484,6 @@ 46 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - - - 183 - 183 - 183 - - - - - - - 171 - 171 - 171 - - - - - - - 179 - 179 - 179 - - - - - - - 154 - 154 - 154 - - - - - - 1D Plot Options @@ -512,74 +498,23 @@ 10 20 - 371 - 21 + 254 + 23 - + Superimpose - - - - - - - 0 - 0 - - - - Qt::NoFocus - - - Clear - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 10 - - - - - - - + false - - - 0 - 0 - - - - 1 - - - 10 - - - 1 - - + false @@ -604,24 +539,74 @@ - - - - Qt::Horizontal + + + + false - - QSizePolicy::Fixed + + + 0 + 0 + - + - 10 - 10 + 60 + 16777215 - + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 1 + + + 10 + + + 1 + + + + + + 420 + 12 + 40 + 28 + + + + + 0 + 0 + + + + + 40 + 16777215 + + + + Qt::NoFocus + + + Clear + + + true + + + gridLayoutWidget_3 + btnClear + btnClear + btnClear @@ -671,51 +656,21 @@ true - - - .gif - - - - - .pdf - - .png - - - .gif+ - - .jpg - - - .ps - - - - - .eps - - .xpm - - - .C - - @@ -762,7 +717,7 @@ 655 10 106 - 101 + 106 @@ -779,8 +734,8 @@ 5 19 - 101 - 76 + 96 + 81 @@ -810,6 +765,9 @@ Create + + false + @@ -840,7 +798,7 @@ 10 10 106 - 101 + 106 @@ -856,14 +814,14 @@ 10 - 20 - 91 - 44 + 14 + 93 + 96 - + None @@ -876,6 +834,13 @@ + + + + Histogram + + + diff --git a/slsDetectorGui/include/qDetectorMain.h b/slsDetectorGui/include/qDetectorMain.h index de6fb44ce..f8f318896 100644 --- a/slsDetectorGui/include/qDetectorMain.h +++ b/slsDetectorGui/include/qDetectorMain.h @@ -77,6 +77,7 @@ private: enum {Measurement, Settings, DataOutput, Plot, Actions, Advanced, Debugging, Developer, NumberOfTabs }; QColor defaultTabColor; + QString zoomToolTip; /* Scroll Area for the tabs**/ QScrollArea *scroll[NumberOfTabs]; @@ -173,10 +174,12 @@ void About(); */ void ResizeMainWindow(bool b); -/** Enables/disables tabs depending on if acquisition is currently in progress - */ +/** Enables/disables tabs depending on if acquisition is currently in progress */ void EnableTabs(); +/** Set the tool tip of mouse controlled zooming depening on if its enabled/disabled*/ +void SetZoomToolTip(bool disable); + protected: void resizeEvent(QResizeEvent* event); diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index 910e893b4..c66389660 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -10,8 +10,9 @@ /** Project Class Headers */ class slsDetectorUtils; +#include "detectorData.h" /** Qt Project Class Headers */ -class SlsQtH1D; +#include "SlsQt1DPlot.h" class SlsQt1DPlot; class SlsQt2DPlotLayout; class qCloneWidget; @@ -60,19 +61,27 @@ public: /** sets 2D Z Axis Title */ void SetImageZAxisTitle(QString title) {imageZAxisTitle = title;} + void SetHistXAxisScale(double min,double max){plot1D->SetXAxisScale(min,max);}; + void SetHistYAxisScale(double min,double max){plot1D->SetYAxisScale(min,max);}; + int GetPixelsX(){return nPixelsX;}; + int GetPixelsY(){return nPixelsY;}; + void Unzoom1D(){plot1D->UnZoom();}; + double GetHistXAxisLowerBound(){return plot1D->GetXAxisLowerBound();}; + double GetHistXAxisUpperBound(){return plot1D->GetXAxisUpperBound();}; + double GetHistYAxisLowerBound(){return plot1D->GetYAxisLowerBound();}; + double GetHistYAxisUpperBound(){return plot1D->GetYAxisUpperBound();}; + + /** Disables zoom if any of the axes range are checked and fixed with a value */ + void DisableZoom(bool disable); + + + /** gets the progress of acquisition to the measurement tab*/ + int GetProgress(){return progress;}; private: /** The sls detector object */ slsDetectorUtils *myDet; - /** Number of Measurements */ - int numberOfMeasurements; - /** Number of Exposures */ - int number_of_exposures; - /** Duration between Exposures */ - double framePeriod; - /** Acquisition Time */ - double acquisitionTime; /** Widgets needed to plot the clone */ /** Max Number of Clone Windows */ @@ -97,17 +106,26 @@ private: QVector plot1D_hists; + + /** Number of Measurements */ + int numberOfMeasurements; + /** currentFrame */ + static int currentFrame; + /** Number of Exposures */ + static int number_of_exposures; + /** Duration between Exposures */ + double framePeriod; + /** Acquisition Time */ + double acquisitionTime; + + /**variables for threads */ /** */ volatile bool stop_signal; /** */ - pthread_mutex_t last_image_complete_mutex; + static pthread_mutex_t last_image_complete_mutex; /**variables for histograms */ - /** 1D or 2D */ - unsigned int plot_in_scope; - /** Current Image Number */ - unsigned int lastImageNumber; /** Title in 2D */ std::string imageTitle; /** X Axis Title in 2D */ @@ -116,26 +134,40 @@ private: QString imageYAxisTitle; /** Z Axis Title in 2D */ QString imageZAxisTitle; - /** Number of Pixels in X Axis */ - unsigned int nPixelsX; - /** Number of Pixels in Y Axis */ - unsigned int nPixelsY; - /** Current Image Values in 1D */ - double* lastImageArray; - /** Number of graphs in 1D */ - unsigned int nHists; /** Title for all the graphs in 1D */ - std::string histTitle[MAX_1DPLOTS]; + static std::string histTitle[MAX_1DPLOTS]; /** X Axis Title in 1D */ QString histXAxisTitle; /** Y Axis Title in 1D */ QString histYAxisTitle; + /** 1D or 2D */ + static unsigned int plot_in_scope; + /** Number of Pixels in X Axis */ + static unsigned int nPixelsX; + /** Number of Pixels in Y Axis */ + static unsigned int nPixelsY; + /** Current Image Number */ + static unsigned int lastImageNumber; + + /** Number of graphs in 1D */ + static unsigned int nHists; /** Total Number of X axis values/channels in 1D */ - int histNBins; + static int histNBins; /** X Axis value in 1D */ - double* histXAxis; + static double* histXAxis; /** Y Axis value in 1D */ - double* histYAxis[MAX_1DPLOTS]; + static double* histYAxis[MAX_1DPLOTS]; + /** Current Image Values in 2D */ + static double* lastImageArray; + /** temporary Y Axis value in 1D */ + static double* yvalues[MAX_1DPLOTS]; + /** temporary Image Values in 2D */ + static double* image_data; + static bool gui_acquisition_thread_running; + static int persistency; + static int currentPersistency; + static int progress; + static bool plotEnable; /** */ @@ -168,10 +200,12 @@ private: /**acquisition thread stuff */ /** */ bool StartOrStopThread(bool start); + /** */ - static void* DataAcquisionThread(void *this_pointer); + static void* DataStartAcquireThread(void *this_pointer); + /** */ - void* AcquireImages(); + static int GetDataCallBack(detectorData *data); public slots: @@ -210,6 +244,14 @@ void CloseClones(); * */ void SavePlot(QString FName); +/** Sets persistency from plot tab */ +void SetPersistency(int val); + +/** Enables plot */ +void EnablePlot(bool enable); + + + private slots: /** To update plot */ @@ -228,6 +270,8 @@ void StartDaq(bool start); * @param id is the id of the clone */ void CloneCloseEvent(int id); + + signals: void UpdatingPlotFinished(); @@ -236,6 +280,7 @@ void ContourSignal(bool); void LogzSignal(bool); + }; diff --git a/slsDetectorGui/include/qTabMeasurement.h b/slsDetectorGui/include/qTabMeasurement.h index a2084615c..082fe62e7 100644 --- a/slsDetectorGui/include/qTabMeasurement.h +++ b/slsDetectorGui/include/qTabMeasurement.h @@ -46,7 +46,7 @@ private: enum{None, Auto, Gated, Trigger_Exp_Series, Trigger_Frame, Trigger_Readout, Gated_Start, Trigger_Window, NumTimingModes}; - + QTimer *progressTimer; /** methods */ /** Sets up the widget @@ -132,6 +132,9 @@ void setNumGates(int val); */ void setNumProbes(int val); +/** Update progress*/ +void UpdateProgress(); + signals: void StartSignal(); diff --git a/slsDetectorGui/include/qTabPlot.h b/slsDetectorGui/include/qTabPlot.h index 9ba147f72..84c206201 100644 --- a/slsDetectorGui/include/qTabPlot.h +++ b/slsDetectorGui/include/qTabPlot.h @@ -49,7 +49,6 @@ private: static QString defaultImageYAxisTitle; static QString defaultImageZAxisTitle; - /** methods */ /** Sets up the widget */ @@ -65,6 +64,8 @@ private: + + public slots: @@ -77,20 +78,24 @@ private slots: */ void Select1DPlot(bool b); -/**Sets the titles in plot axis - */ +/**Enables Persistency depending on Superimpose checkbox */ +void EnablePersistency(bool enable); + +/**Sets the titles in plot axis */ void SetTitles(); - -/** Enables/Sets Titles to default - */ +/** Enables/Sets default Titles to default */ void EnableTitles(); +/** Enables range of the axes */ +void EnableRange(); +/** Sets the range of the axes */ +void SetAxesRange(); -/** Save Plot - */ +/** Save Plot */ void SavePlot(); -signals: +signals: +void DisableZoomSignal(bool); }; diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h index 43dc7781c..262322f7c 100644 --- a/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h @@ -10,7 +10,7 @@ #include #include #include - +#include #include "SlsQt1DZoomer.h" class QPen; @@ -104,6 +104,15 @@ class SlsQt1DPlot:public QwtPlot{ void InsertVLine(double v); void RemoveVLine(); + void DisableZoom(bool disableZoom); + + void SetXAxisScale(double min,double max){setAxisScale(QwtPlot::xBottom,min,max);}; + void SetYAxisScale(double min,double max){setAxisScale(QwtPlot::yLeft,min,max);}; + double GetXAxisLowerBound(){return axisScaleDiv(QwtPlot::xBottom)->lowerBound();}; + double GetXAxisUpperBound(){return axisScaleDiv(QwtPlot::xBottom)->upperBound();}; + double GetYAxisLowerBound(){return axisScaleDiv(QwtPlot::yLeft)->lowerBound();}; + double GetYAxisUpperBound(){return axisScaleDiv(QwtPlot::yLeft)->upperBound(); }; + void SetZoom(double xmin,double ymin,double x_width,double y_width); void SetZoomBase(double xmin,double ymin,double x_width, double y_width){ zoomer->SetZoomBase(xmin,ymin,x_width,y_width);} diff --git a/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cxx b/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cxx index d4c355c88..b8ece1400 100644 --- a/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cxx +++ b/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cxx @@ -52,9 +52,22 @@ int SlsQtH1D::SetLineColor(int c){ static int last_color = 1; if(c<0) c=(last_color+1)%3; - if(c==0) pen_ptr->setColor(Qt::black); + switch(c){ + case 0: pen_ptr->setColor(Qt::black); break; + case 1: pen_ptr->setColor(Qt::red); break; + case 2: pen_ptr->setColor(Qt::blue); break; + case 3: pen_ptr->setColor(Qt::green); break; + case 4: pen_ptr->setColor(Qt::magenta); break; + case 5: pen_ptr->setColor(Qt::cyan); break; + case 6: pen_ptr->setColor(Qt::darkYellow); break; + case 7: pen_ptr->setColor(Qt::gray); break; + case 8: pen_ptr->setColor(Qt::darkBlue); break; + case 9: pen_ptr->setColor(Qt::darkGreen); break; + case 10: pen_ptr->setColor(Qt::darkMagenta); break; + } +/* if(c==0) pen_ptr->setColor(Qt::black); else if(c==1) pen_ptr->setColor(Qt::red); - else pen_ptr->setColor(Qt::blue); + else pen_ptr->setColor(Qt::blue);*/ setPen(*pen_ptr); @@ -281,7 +294,8 @@ void SlsQt1DPlot::CalculateNResetZoomBase(){ void SlsQt1DPlot::NewHistogramAttached(SlsQtH1D* h){ hist_list->Add(h); CalculateNResetZoomBase(); - if(!hist_list->Next()) UnZoom(); + //commented out by dhanya to take off zooming every hist in 1d plots + //if(!hist_list->Next()) UnZoom(); Update(); } @@ -300,10 +314,14 @@ void SlsQt1DPlot::SetTitle(const char* title){ } void SlsQt1DPlot::SetXTitle(const char* title){ - setAxisTitle(QwtPlot::xBottom,title); + QwtText t(title); + t.setFont(QFont("Sans Serif",11,QFont::Normal)); + setAxisTitle(QwtPlot::xBottom,t); } void SlsQt1DPlot::SetYTitle(const char* title){ - setAxisTitle(QwtPlot::yLeft,title); + QwtText t(title); + t.setFont(QFont("Sans Serif",11,QFont::Normal)); + setAxisTitle(QwtPlot::yLeft,t); } void SlsQt1DPlot::SetLogX(bool yes){ SetLog(QwtPlot::xBottom,yes);} @@ -438,3 +456,37 @@ void SlsQt1DPlot::UnknownStuff(){ #endif } + +void SlsQt1DPlot::DisableZoom(bool disableZoom){ +#ifdef VERBOSE + if(disableZoom) cout<<"Disabling zoom"<setMousePattern(QwtEventPattern::MouseSelect1,Qt::NoButton); +#if QT_VERSION < 0x040000 + zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt::NoButton, Qt::ControlButton); +#else + zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt::NoButton, Qt::ControlModifier); +#endif + zoomer->setMousePattern(QwtEventPattern::MouseSelect3,Qt::NoButton); + } + if(panner) panner->setMouseButton(Qt::NoButton); + }else { + if(zoomer){ + zoomer->setMousePattern(QwtEventPattern::MouseSelect1,Qt::LeftButton); +#if QT_VERSION < 0x040000 + zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt::RightButton, Qt::ControlButton); +#else + zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt::RightButton, Qt::ControlModifier); +#endif + zoomer->setMousePattern(QwtEventPattern::MouseSelect3,Qt::RightButton); + } + if(panner) panner->setMouseButton(Qt::MidButton); + } +} + + + + diff --git a/slsDetectorGui/src/qCloneWidget.cpp b/slsDetectorGui/src/qCloneWidget.cpp index 7903d4950..941aa9b39 100644 --- a/slsDetectorGui/src/qCloneWidget.cpp +++ b/slsDetectorGui/src/qCloneWidget.cpp @@ -141,7 +141,7 @@ for(int hist_num=0;hist_numsetTitle(histTitle[hist_num].c_str()); k->Attach(cloneplot1D); } -cloneplot1D->UnZoom(); +//cloneplot1D->UnZoom(); } diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 640456d64..e1347fd16 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -169,7 +169,7 @@ void qDetectorMain::Initialization(){ connect(tabs,SIGNAL(currentChanged(int)),this, SLOT(refresh(int)));//( QWidget*))); /** Measurement tab*/ /** Plot tab */ - + connect(tab_plot,SIGNAL(DisableZoomSignal(bool)),this, SLOT(SetZoomToolTip(bool))); /** Plotting */ /** When the acquisition is finished, must update the meas tab */ @@ -202,6 +202,7 @@ void qDetectorMain::Initialization(){ heightCentralWidget = centralwidget->size().height(); defaultTabColor = tabs->tabBar()->tabTextColor(DataOutput); + zoomToolTip = dockWidgetPlot->toolTip(); } @@ -364,8 +365,11 @@ void qDetectorMain::resizeEvent(QResizeEvent* event){ void qDetectorMain::EnableTabs(){ +#ifdef VERBOSE + cout<<"Entering EnableTabs function"<isTabEnabled(DataOutput)?false:true); + enable=!(tabs->isTabEnabled(DataOutput)); // or use the Enable/Disable button /** normal tabs*/ @@ -389,3 +393,12 @@ void qDetectorMain::EnableTabs(){ tabs->setTabEnabled(Developer,enable); } } + + + +void qDetectorMain::SetZoomToolTip(bool disable){ + if(disable) + dockWidgetPlot->setToolTip("To Enable mouse-controlled zooming capabilities,\ndisable min and max for all axes. "); + else + dockWidgetPlot->setToolTip(zoomToolTip); +} diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 954f5b3c1..18d70f5b2 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -7,11 +7,11 @@ /** Qt Project Class Headers */ #include "qDrawPlot.h" #include "qCloneWidget.h" -#include "SlsQt1DPlot.h" #include "SlsQt2DPlotLayout.h" /** Project Class Headers */ #include "slsDetector.h" #include "multiSlsDetector.h" +#include "postProcessing.h" /** Qt Include Headers */ #include #include @@ -19,12 +19,41 @@ /** C++ Include Headers */ #include #include +#include using namespace std; #define Detector_Index 0 + + +//int numberOfMeasurements; +int qDrawPlot::currentFrame; +int qDrawPlot::number_of_exposures; +//double framePeriod; +//double acquisitionTime; +pthread_mutex_t qDrawPlot::last_image_complete_mutex; +//std::string imageTitle; +std::string qDrawPlot::histTitle[MAX_1DPLOTS]; +unsigned int qDrawPlot::plot_in_scope; +unsigned int qDrawPlot::nPixelsX; +unsigned int qDrawPlot::nPixelsY; +unsigned int qDrawPlot::lastImageNumber; +unsigned int qDrawPlot::nHists; +int qDrawPlot::histNBins; +double* qDrawPlot::histXAxis; +double* qDrawPlot::histYAxis[MAX_1DPLOTS]; +double* qDrawPlot::lastImageArray; +double* qDrawPlot::yvalues[MAX_1DPLOTS]; +double* qDrawPlot::image_data; +bool qDrawPlot::gui_acquisition_thread_running; +int qDrawPlot::persistency; +int qDrawPlot::currentPersistency; +int qDrawPlot::progress; +bool qDrawPlot::plotEnable; + + qDrawPlot::qDrawPlot(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector),numberOfMeasurements(1){ if(myDet) { SetupWidgetWindow(); @@ -52,40 +81,52 @@ void qDrawPlot::SetupWidgetWindow(){ #endif stop_signal = 0; pthread_mutex_init(&last_image_complete_mutex,NULL); - + gui_acquisition_thread_running = 0; + /** Default Plotting*/ plot_in_scope = 0; + /**2d*/ lastImageNumber = 0; - nPixelsX = 0; - nPixelsY = 0; - lastImageArray = 0; + + nPixelsX = 1280; nPixelsY = 100; + + lastImageArray = 0; + image_data = 0; + /**1d*/ nHists = 0; histNBins = 0; histXAxis = 0; - for(int i=0;isetLayout(layout); - + this->setLayout(layout); boxPlot = new QGroupBox("Measurement"); - layout->addWidget(boxPlot,1,1); - boxPlot->setAlignment(Qt::AlignHCenter); - boxPlot->setFont(QFont("Sans Serif",11,QFont::Bold)); - + layout->addWidget(boxPlot,1,1); + boxPlot->setAlignment(Qt::AlignHCenter); + boxPlot->setFont(QFont("Sans Serif",11,QFont::Normal)); plot_update_timer = new QTimer(this); connect(plot_update_timer, SIGNAL(timeout()), this, SLOT(UpdatePlot())); - /** Defaults - only for the initial picture*/ + /** Default titles- only for the initial picture*/ histXAxisTitle="Channel Number"; histYAxisTitle="Counts"; - for(int i=0;isetFont(QFont("Sans Serif",9,QFont::Normal)); - plot1D->SetXTitle(histXAxisTitle.toAscii().constData()); - plot1D->SetYTitle(histYAxisTitle.toAscii().constData()); - plot1D->hide(); + plot1D->setFont(QFont("Sans Serif",9,QFont::Normal)); + plot1D->SetXTitle(histXAxisTitle.toAscii().constData()); + plot1D->SetYTitle(histYAxisTitle.toAscii().constData()); + plot1D->hide(); plot2D = new SlsQt2DPlotLayout(boxPlot); - plot2D->setFont(QFont("Sans Serif",9,QFont::Normal)); - plot2D->setTitle(GetImageTitle()); - plot2D->SetXTitle(imageXAxisTitle); - plot2D->SetYTitle(imageYAxisTitle); - plot2D->SetZTitle(imageZAxisTitle); - plot2D->setAlignment(Qt::AlignLeft); + plot2D->setFont(QFont("Sans Serif",9,QFont::Normal)); + plot2D->setTitle(GetImageTitle()); + plot2D->SetXTitle(imageXAxisTitle); + plot2D->SetYTitle(imageYAxisTitle); + plot2D->SetZTitle(imageZAxisTitle); + plot2D->setAlignment(Qt::AlignLeft); boxPlot->setFlat(true); - - //QSizePolicy sizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred); - //boxPlot->setSizePolicy(sizePolicy); + boxPlot->setContentsMargins(0,15,0,0); plotLayout = new QGridLayout(boxPlot); - plotLayout->addWidget(plot1D,1,1,1,1); - plotLayout->addWidget(plot2D,1,1,1,1); - - boxPlot->setContentsMargins(0,15,0,0); + plotLayout->addWidget(plot1D,1,1,1,1); + plotLayout->addWidget(plot2D,1,1,1,1); } @@ -188,8 +225,8 @@ int qDrawPlot::ResetDaqForGui(){ bool qDrawPlot::StartOrStopThread(bool start){ - static bool gui_acquisition_thread_running = 0; static pthread_t gui_acquisition_thread; + static pthread_t gui_start_acquire_thread; static pthread_mutex_t gui_acquisition_start_stop_mutex = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_lock(&gui_acquisition_start_stop_mutex); @@ -197,129 +234,112 @@ bool qDrawPlot::StartOrStopThread(bool start){ if(gui_acquisition_thread_running){ cout<<"Stopping current acquisition thread ...."<stopAcquisition(); + //pthread_join(gui_acquisition_thread,NULL); //wait until he's finished, ie. exits gui_acquisition_thread_running = 0; } //start part if(start){ + /** Defaults */ + currentFrame = 0; stop_signal = 0; + histNBins = nPixelsX; + if(!image_data) image_data = new double[nPixelsX*nPixelsY]; + if(!lastImageArray) lastImageArray = new double[nPixelsX*nPixelsY]; + if(!histXAxis) histXAxis = new double [nPixelsX]; + for(unsigned int px=0;pxacquire(1);//acquiring + /** Setting the callback function to get data from software client*/ + myDet->registerDataCallback(&(GetDataCallBack)); + /** Start acquiring data from server */ + pthread_create(&gui_start_acquire_thread, NULL,DataStartAcquireThread, (void*) this); + gui_acquisition_thread_running=1; + cout<<"Started acquiring"<AcquireImages(); +void* qDrawPlot::DataStartAcquireThread(void *this_pointer){ + ((qDrawPlot*)this_pointer)->myDet->acquire(1); return this_pointer; } +int qDrawPlot::GetDataCallBack(detectorData *data){ +#ifdef VERYVERBOSE + cout<<"Entering GetDataCallBack function"<progressIndex; -void* qDrawPlot::AcquireImages(){ - //send data to detector - - static unsigned int nx=1280,ny=100; - static double* image_data = new double[nx*ny]; - if(!lastImageArray) lastImageArray = new double[nx*ny]; - static double* xvalues = new double [nx]; - static double* yvalues0 = new double [nx]; - static double* yvalues1 = new double [nx]; - if(!histXAxis) histXAxis = new double [nx]; - if(!histYAxis[0]) histYAxis[0] = new double [nx]; - if(!histYAxis[1]) histYAxis[1] = new double [nx]; - - - -// char cIndex[200]; - - //string filePath = myDet->getFilePath()+'/'+myDet->getFileName()+'_'; - //cout<<"filePath:"<readDataFile(fileName,arg)==-1); - - - ///////// - - - //readout detector - //fill and write data here - for(unsigned int px=0;px0;i--) + memcpy(yvalues[i],yvalues[i-1],nPixelsX*sizeof(double)); + nHists = currentPersistency+1; + /** Get data from client */ + memcpy(yvalues[0],data->values,nPixelsX*sizeof(double)); + + /**1d*/ + // if(plot_in_scope==1){ + if((currentFrame)<(number_of_exposures)){ +#ifdef VERYVERBOSE + cout<<"Reading in image: "<0;i--) + memcpy(histYAxis[i],histYAxis[i-1],nPixelsX*sizeof(double)); + memcpy(histYAxis[0],yvalues[0],nPixelsX*sizeof(double)); + pthread_mutex_unlock(&(last_image_complete_mutex)); + } + + currentFrame++; + } + //} + ///**2d*/ + //else{ + // ; + //} + +#ifdef VERYVERBOSE + cout<<"Exiting GetDataCallBack function"<stop(); + if(plotEnable){ + LockLastImageArray(); + //1-d plot stuff + if(lastImageNumber){ + if(histNBins){ +#ifdef VERYVERBOSE + cout<<"Last Image Number: "<SetXTitle(histXAxisTitle.toAscii().constData()); + plot1D->SetYTitle(histYAxisTitle.toAscii().constData()); + for(int hist_num=0;hist_numplot1D_hists.size()){ + plot1D_hists.append(h=new SlsQtH1D("1d plot",histNBins,histXAxis,GetHistYAxis(hist_num))); + h->SetLineColor(hist_num+1); + }else{ + h=plot1D_hists.at(hist_num); + h->SetData(histNBins,histXAxis,GetHistYAxis(hist_num)); + } + h->setTitle(GetHistTitle(hist_num)); + h->Attach(plot1D); + + } + //plot1D->UnZoom(); + //if(first){plot1D->UnZoom();first = !first;} + //plot1D->SetZoom(double xmin,double ymin,double x_width,double y_width); - LockLastImageArray(); - //1-d plot stuff - if(histNBins){ - plot1D->SetXTitle(histXAxisTitle.toAscii().constData()); - plot1D->SetYTitle(histYAxisTitle.toAscii().constData()); - for(int hist_num=0;hist_numplot1D_hists.size()){ - plot1D_hists.append(h=new SlsQtH1D("1d plot",histNBins,histXAxis,GetHistYAxis(hist_num))); - h->SetLineColor(hist_num+1); - }else{ - h=plot1D_hists.at(hist_num); - h->SetData(histNBins,histXAxis,GetHistYAxis(hist_num)); } - h->setTitle(GetHistTitle(hist_num)); - h->Attach(plot1D); } - plot1D->UnZoom(); - } - //2-d plot stuff - static int last_plot_number = 0; - if(lastImageArray){ - if(lastImageNumber&&last_plot_number!=lastImageNumber && //there is a new plot - nPixelsX>0&&nPixelsY>0){ - plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,-0.5,nPixelsY-0.5,lastImageArray); - //as it inherits a widget - plot2D->setTitle(GetImageTitle()); - plot2D->SetXTitle(imageXAxisTitle); - plot2D->SetYTitle(imageYAxisTitle); - plot2D->SetZTitle(imageZAxisTitle); - plot2D->UpdateNKeepSetRangeIfSet(); //this will keep a "set" z range, and call Plot()->Update(); + //2-d plot stuff + if(lastImageArray){ + if(lastImageNumber&&last_plot_number!=lastImageNumber && //there is a new plot + nPixelsX>0&&nPixelsY>0){ + plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,-0.5,nPixelsY-0.5,lastImageArray); + //as it inherits a widget + plot2D->setTitle(GetImageTitle()); + plot2D->SetXTitle(imageXAxisTitle); + plot2D->SetYTitle(imageYAxisTitle); + plot2D->SetZTitle(imageZAxisTitle); + plot2D->UpdateNKeepSetRangeIfSet(); //this will keep a "set" z range, and call Plot()->Update(); + } } } last_plot_number=lastImageNumber; - UnlockLastImageArray(); - -/* if(plot_in_scope==1) SelectPlot(1); + if(plotEnable) UnlockLastImageArray(); + /* if(plot_in_scope==1) SelectPlot(1); else if(plot_in_scope==2) SelectPlot(2);*/ if(number_of_exposures==last_plot_number){ + gui_acquisition_thread_running=0; StartStopDaqToggle(1); emit UpdatingPlotFinished(); }else{ @@ -498,3 +529,24 @@ void qDrawPlot::SavePlot(QString FName){ render(&painter); img.save(FName); } + + + +void qDrawPlot::EnablePlot(bool enable){ +#ifdef VERBOSE + cout<<"Plotting set to:"<DisableZoom(disable); +///disable zoom + +} diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 39d86fbf0..170a8127d 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -48,6 +48,8 @@ qTabMeasurement::~qTabMeasurement(){ void qTabMeasurement::SetupWidgetWindow(){ + progressTimer = new QTimer(this); + //btnStartStop->setStyleSheet("color:green"); /** Exp Time **/ float time = (float)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-9)); spinExpTime->setValue(time); @@ -106,7 +108,7 @@ void qTabMeasurement::SetupWidgetWindow(){ } } - + progressBar->setValue(0); //get timing mode from client @@ -127,6 +129,8 @@ void qTabMeasurement::Initialization(int timingChange){ connect(btnStartStop,SIGNAL(clicked()), this, SLOT(startStopAcquisition())); /** Timing Mode **/ connect(comboTimingMode,SIGNAL(currentIndexChanged(int)), this, SLOT(setTimingMode(int)));// + + connect(progressTimer, SIGNAL(timeout()), this, SLOT(UpdateProgress())); } /** Number of Frames**/ connect(spinNumFrames,SIGNAL(valueChanged(int)), this, SLOT(setNumFrames(int))); @@ -189,15 +193,17 @@ void qTabMeasurement::Enable(bool enable){ void qTabMeasurement::UpdateFinished(){ disconnect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); btnStartStop->setText("Start"); + //btnStartStop->setStyleSheet("color:green"); + //btnStartStop->setStyleSheet("background:rgb(239,239,239)"); Enable(1); connect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); + UpdateProgress(); + progressTimer->stop(); } void qTabMeasurement::setFileName(const QString& fName){ - // emit fileNameChanged(fName); - // thred-->fileName=s;myDet->setFileName(fName.ascii()); myDet->setFileName(fName.toAscii().data()); #ifdef VERBOSE cout<<"Setting File name to " << myDet->getFileName()<setFileIndex(index); + lblProgressIndex->setText(QString::number(index)); #ifdef VERBOSE cout<<"Setting File Index to " << myDet->getFileIndex()<setStyleSheet("color:red"); btnStartStop->setText("Stop"); Enable(0); + progressBar->setValue(0); + progressTimer->start(200); + emit StartSignal(); }else{ #ifdef VERBOSE cout<<"Stopping Acquisition"<setStyleSheet("color:green"); + //btnStartStop->setStyleSheet("background:rgb(239,239,239)"); + progressTimer->stop(); btnStartStop->setText("Start"); Enable(1); emit StopSignal(); @@ -270,8 +284,6 @@ void qTabMeasurement::setExposureTime(){ lblPeriod->setText("Acquisition Period"); } } - //float t=exptimeNS; - //emit acquisitionTimeChanged(t/(100E+6)); ?????????????????????? } @@ -297,10 +309,6 @@ void qTabMeasurement::setAcquisitionPeriod(){ lblPeriod->setPalette(lblNumFrames->palette()); lblPeriod->setText("Acquisition Period"); } - - - //float t=exptimeNS; - //emit acquisitionTimeChanged(t/(100E+6)); ?????????????????????? } @@ -348,6 +356,12 @@ void qTabMeasurement::setNumProbes(int val){ } +void qTabMeasurement::UpdateProgress(){ + progressBar->setValue(myPlot->GetProgress()); + lblProgressIndex->setText(QString::number(myDet->getFileIndex())); +} + + void qTabMeasurement::setTimingMode(int mode){ diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index f1393b91b..e8d9c2081 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -36,6 +36,7 @@ qTabPlot::qTabPlot(QWidget *parent,slsDetectorUtils*& detector, qDrawPlot*& plot //This also selects the text if unchecked //includes setupwidgetwindow //SelectPlot(1); + //switch(myDet->detectorytype) Select1DPlot(true); Initialization(); } @@ -66,9 +67,12 @@ void qTabPlot::SetupWidgetWindow(){ dispXMax->setEnabled(false); dispYMax->setEnabled(false); dispZMax->setEnabled(false); - - //dispFName->setText(QString(myDet->getFilePath().c_str())+'/'); - +/* dispXMin->setValidator(new QDoubleValidator(dispXMin)); + dispYMin->setValidator(new QDoubleValidator(dispYMin)); + dispZMin->setValidator(new QDoubleValidator(dispZMin)); + dispXMax->setValidator(new QDoubleValidator(dispXMax)); + dispYMax->setValidator(new QDoubleValidator(dispYMax)); + dispZMax->setValidator(new QDoubleValidator(dispZMax));*/ } @@ -103,9 +107,14 @@ void qTabPlot::Select1DPlot(bool b){ void qTabPlot::Initialization(){ -/** Plot box*/ +/** Plot arguments box*/ + connect(chkNoPlot, SIGNAL(toggled(bool)),myPlot, SLOT(EnablePlot(bool))); +/** Snapshot box*/ connect(btnClone, SIGNAL(clicked()),myPlot, SLOT(ClonePlot())); connect(btnCloseClones, SIGNAL(clicked()),myPlot, SLOT(CloseClones())); +/** 1D Plot box*/ + connect(chkSuperimpose, SIGNAL(toggled(bool)),this, SLOT(EnablePersistency(bool))); + connect(spinPersistency,SIGNAL(valueChanged(int)),myPlot,SLOT(SetPersistency(int))); /** 2D Plot box*/ connect(chkInterpolate, SIGNAL(toggled(bool)),myPlot, SIGNAL(InterpolateSignal(bool))); connect(chkContour, SIGNAL(toggled(bool)),myPlot, SIGNAL(ContourSignal(bool))); @@ -119,13 +128,26 @@ void qTabPlot::Initialization(){ connect(dispXAxis, SIGNAL(textChanged(const QString&)), this, SLOT(SetTitles())); connect(dispYAxis, SIGNAL(textChanged(const QString&)), this, SLOT(SetTitles())); connect(dispZAxis, SIGNAL(textChanged(const QString&)), this, SLOT(SetTitles())); + + connect(chkXMin, SIGNAL(toggled(bool)), this, SLOT(EnableRange())); + connect(chkXMax, SIGNAL(toggled(bool)), this, SLOT(EnableRange())); + connect(chkYMin, SIGNAL(toggled(bool)), this, SLOT(EnableRange())); + connect(chkYMax, SIGNAL(toggled(bool)), this, SLOT(EnableRange())); + connect(chkZMin, SIGNAL(toggled(bool)), this, SLOT(EnableRange())); + connect(chkZMax, SIGNAL(toggled(bool)), this, SLOT(EnableRange())); + + connect(dispXMin, SIGNAL(returnPressed()), this, SLOT(SetAxesRange())); + connect(dispXMax, SIGNAL(returnPressed()), this, SLOT(SetAxesRange())); + connect(dispYMin, SIGNAL(returnPressed()), this, SLOT(SetAxesRange())); + connect(dispYMax, SIGNAL(returnPressed()), this, SLOT(SetAxesRange())); + connect(dispZMin, SIGNAL(returnPressed()), this, SLOT(SetAxesRange())); + connect(dispZMax, SIGNAL(returnPressed()), this, SLOT(SetAxesRange())); + /** Common Buttons*/ connect(btnClear, SIGNAL(clicked()), myPlot, SLOT(Clear1DPlot())); /** Save */ connect(btnSave, SIGNAL(clicked()), this, SLOT(SavePlot())); -/** test for 1D*/ - connect(chktest1D, SIGNAL(toggled(bool)), this, SLOT(Select1DPlot(bool))); } @@ -138,6 +160,16 @@ void qTabPlot::Enable(bool enable){ boxPlotAxis->setEnabled(enable); } +void qTabPlot::EnablePersistency(bool enable){ + lblPersistency->setEnabled(enable); + spinPersistency->setEnabled(enable); + if(enable) myPlot->SetPersistency(spinPersistency->value()); + else myPlot->SetPersistency(0); + +} + + + void qTabPlot::SetTitles(){ int oneD = box1D->isEnabled(); /** Plot Title*/ @@ -159,6 +191,7 @@ void qTabPlot::SetTitles(){ } + void qTabPlot::EnableTitles(){ int oneD = box1D->isEnabled(); /** Plot Title*/ @@ -199,7 +232,91 @@ void qTabPlot::EnableTitles(){ } + + +void qTabPlot::EnableRange(){ + bool disableZoom = false; + if(!chkXMin->isChecked()) {dispXMin->setText(""); dispXMin->setEnabled(false);} + else {disableZoom = true; dispXMin->setEnabled(true); } + if(!chkXMax->isChecked()) {dispXMax->setText(""); dispXMax->setEnabled(false);} + else {disableZoom = true; dispXMax->setEnabled(true); } + if(!chkYMin->isChecked()) {dispYMin->setText(""); dispYMin->setEnabled(false);} + else {disableZoom = true; dispYMin->setEnabled(true); } + if(!chkYMax->isChecked()) {dispYMax->setText(""); dispYMax->setEnabled(false);} + else {disableZoom = true; dispYMax->setEnabled(true); } + if(!chkZMin->isChecked()) {dispZMin->setText(""); dispZMin->setEnabled(false);} + else {disableZoom = true; dispZMin->setEnabled(true); } + if(!chkZMax->isChecked()) {dispZMax->setText(""); dispZMax->setEnabled(false);} + else {disableZoom = true; dispZMax->setEnabled(true); } + myPlot->DisableZoom(disableZoom); + emit DisableZoomSignal(disableZoom); +} + + + +void qTabPlot::SetAxesRange(){ + double xmin,xmax,ymin,ymax,zmin,zmax; + int oneD = box1D->isEnabled(); + //should be filled for 2d as well + if(!dispXMin->text().isEmpty()) xmin = dispXMin->text().toDouble(); + else { if(oneD) xmin = myPlot->GetHistXAxisLowerBound();} + if(!dispXMax->text().isEmpty()) xmax = dispXMax->text().toDouble(); + else { if(oneD) xmax = myPlot->GetHistXAxisUpperBound();} + if(!dispYMin->text().isEmpty()) ymin = dispYMin->text().toDouble(); + else { if(oneD) ymin = myPlot->GetHistYAxisLowerBound();} + if(!dispYMax->text().isEmpty()) ymax = dispYMax->text().toDouble(); + else { if(oneD) ymax = myPlot->GetHistYAxisUpperBound();} + if(!dispZMin->text().isEmpty()) zmin = dispZMin->text().toDouble(); + if(!dispZMax->text().isEmpty()) zmax = dispZMax->text().toDouble(); + //should be filled for 2d as well + if(oneD){ + myPlot->SetHistXAxisScale(xmin,xmax); + myPlot->SetHistYAxisScale(ymin,ymax); + } +} + + void qTabPlot::SavePlot(){ QString fullFileName = QString(myDet->getFilePath().c_str())+'/'+dispFName->text()+comboFormat->currentText(); myPlot->SavePlot(fullFileName); } + + + + + + +//dispzmin... when unchecked, unzoom and get lower and upper bound... when checked just set lower and upper bound + +/* + +#include "SlsQtValidators.h" + +class QDoubleValidator; +SlsQtDoubleValidator* validator_double[2]; + + + + +validator_double = new SlsQtDoubleValidator(num_field); +num_field->setValidator(validator_double); +//default settings +validator_double->setDecimals(3); +double v= num_field->text().toDouble(ok);); +is ok 1? for correct conversion + +QString s = QString::number(v); +validator_double->fixup(s); +num_field->setText(s); + + +num_field[i]->setAlignment(Qt::AlignRight); + + + +connect(num_field[i],SIGNAL(lostFocus()),this,SLOT(FirstValueEntered())); + +*/ + + + From 69e65005224529104d51c7e7df577f33bec8fb2a Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 19 Jun 2012 15:01:40 +0000 Subject: [PATCH 011/332] All the ranges of the axes work properly without zooming in and out each time git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@11 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_measurement.ui | 12 +- slsDetectorGui/forms/form_tab_plot.ui | 6 +- slsDetectorGui/include/qDrawPlot.h | 186 +++++++---------- slsDetectorGui/include/qTabActions.h | 3 - slsDetectorGui/include/qTabDeveloper.h | 3 - slsDetectorGui/include/qTabMeasurement.h | 2 +- slsDetectorGui/include/qTabPlot.h | 10 +- slsDetectorGui/slsDetectorGui.pro | 1 + .../slsDetectorPlotting/include/SlsQt1DPlot.h | 28 ++- .../slsDetectorPlotting/include/SlsQt2DPlot.h | 20 +- .../include/SlsQt2DPlotLayout.h | 33 ++- .../slsDetectorPlotting/src/SlsQt1DPlot.cxx | 2 + .../slsDetectorPlotting/src/SlsQt2DHist.cxx | 1 - .../slsDetectorPlotting/src/SlsQt2DPlot.cxx | 40 +++- .../src/SlsQt2DPlotLayout.cxx | 190 +++++++++++++----- .../src/SlsQtNumberEntry.cxx | 6 +- slsDetectorGui/src/qDetectorMain.cpp | 3 +- slsDetectorGui/src/qDrawPlot.cpp | 124 +++++++----- slsDetectorGui/src/qTabActions.cpp | 8 - slsDetectorGui/src/qTabDeveloper.cpp | 6 - slsDetectorGui/src/qTabMeasurement.cpp | 102 +++++----- slsDetectorGui/src/qTabPlot.cpp | 147 ++++++-------- 22 files changed, 521 insertions(+), 412 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_measurement.ui b/slsDetectorGui/forms/form_tab_measurement.ui index 106f1831b..dfc25baf8 100644 --- a/slsDetectorGui/forms/form_tab_measurement.ui +++ b/slsDetectorGui/forms/form_tab_measurement.ui @@ -520,12 +520,7 @@ - Gated - - - - - Trigger Exposure + Trigger Exposure Series @@ -538,6 +533,11 @@ Trigger Readout + + + Gated with Fixed Number + + Gated with Start Trigger diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index 1f8f3ba8d..f8b21cde4 100644 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -37,7 +37,7 @@ 10 135 751 - 136 + 141 @@ -603,10 +603,6 @@ true - gridLayoutWidget_3 - btnClear - btnClear - btnClear diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index c66389660..10544e51e 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -13,6 +13,7 @@ class slsDetectorUtils; #include "detectorData.h" /** Qt Project Class Headers */ #include "SlsQt1DPlot.h" +#include "SlsQt2DPlotLayout.h" class SlsQt1DPlot; class SlsQt2DPlotLayout; class qCloneWidget; @@ -34,50 +35,51 @@ class qDrawPlot:public QWidget{ Q_OBJECT public: - /** \short The constructor - */ + /** \short The constructor */ qDrawPlot(QWidget *parent,slsDetectorUtils*& detector); - - /** Destructor - */ + /** Destructor */ ~qDrawPlot(); + /** Number of x axis pixels */ + int GetPixelsX(){return nPixelsX;}; + /** Number of y axis pixels */ + int GetPixelsY(){return nPixelsY;}; + /** sets plot Title */ + void SetPlotTitle(QString title) {boxPlot->setTitle(title);} + /** sets 1D X Axis Title */ + void SetHistXAxisTitle(QString title) {histXAxisTitle = title;} + /** sets 1D Y Axis Title */ + void SetHistYAxisTitle(QString title) {histYAxisTitle = title;} + /** sets 2D X Axis Title */ + void SetImageXAxisTitle(QString title) {imageXAxisTitle = title;} + /** sets 2D Y Axis Title */ + void SetImageYAxisTitle(QString title) {imageYAxisTitle = title;} + /** sets 2D Z Axis Title */ + void SetImageZAxisTitle(QString title) {imageZAxisTitle = title;} + /** Sets X min and max */ + void SetXMinMax(double min,double max) {if(plot_in_scope==1)plot1D->SetXMinMax(min,max); else plot2D->GetPlot()->SetXMinMax(min,max);}; + /** Sets Y min and max */ + void SetYMinMax(double min,double max) {if(plot_in_scope==1)plot1D->SetYMinMax(min,max); else plot2D->GetPlot()->SetYMinMax(min,max);}; + /** Gets X min */ + double GetXMinimum(){if(plot_in_scope==1)return plot1D->GetXMinimum(); else return plot2D->GetPlot()->GetXMinimum();}; + /** Gets X max */ + double GetXMaximum(){if(plot_in_scope==1)return plot1D->GetXMaximum(); else return plot2D->GetPlot()->GetXMaximum();}; + /** Gets Y min */ + double GetYMinimum(){if(plot_in_scope==1)return plot1D->GetYMinimum(); else return plot2D->GetPlot()->GetYMinimum();}; + /** Gets Y max */ + double GetYMaximum(){if(plot_in_scope==1)return plot1D->GetYMaximum(); else return plot2D->GetPlot()->GetYMaximum();}; + /** Disables zoom if any of the axes range are checked and fixed with a value */ + void DisableZoom(bool disable); + /** gets the progress of acquisition to the measurement tab*/ + int GetProgress(){return progress;}; + + /** Starts or stop acquisition * Calls startDaq() function * @param stop_if_running is 0 to stop acquisition and 1 to start acquisition */ void StartStopDaqToggle(bool stop_if_running=0); - /** sets plot Title */ - void SetPlotTitle(QString title) {boxPlot->setTitle(title);} - /** sets 1D X Axis Title */ - void SetHistXAxisTitle(QString title) {histXAxisTitle = title;} - /** sets 1D Y Axis Title */ - void SetHistYAxisTitle(QString title) {histYAxisTitle = title;} - /** sets 2D X Axis Title */ - void SetImageXAxisTitle(QString title) {imageXAxisTitle = title;} - /** sets 2D Y Axis Title */ - void SetImageYAxisTitle(QString title) {imageYAxisTitle = title;} - /** sets 2D Z Axis Title */ - void SetImageZAxisTitle(QString title) {imageZAxisTitle = title;} - - void SetHistXAxisScale(double min,double max){plot1D->SetXAxisScale(min,max);}; - void SetHistYAxisScale(double min,double max){plot1D->SetYAxisScale(min,max);}; - int GetPixelsX(){return nPixelsX;}; - int GetPixelsY(){return nPixelsY;}; - void Unzoom1D(){plot1D->UnZoom();}; - double GetHistXAxisLowerBound(){return plot1D->GetXAxisLowerBound();}; - double GetHistXAxisUpperBound(){return plot1D->GetXAxisUpperBound();}; - double GetHistYAxisLowerBound(){return plot1D->GetYAxisLowerBound();}; - double GetHistYAxisUpperBound(){return plot1D->GetYAxisUpperBound();}; - - /** Disables zoom if any of the axes range are checked and fixed with a value */ - void DisableZoom(bool disable); - - - /** gets the progress of acquisition to the measurement tab*/ - int GetProgress(){return progress;}; - private: /** The sls detector object */ slsDetectorUtils *myDet; @@ -97,7 +99,6 @@ private: QTimer* plot_update_timer; - /** 1D object */ SlsQt1DPlot* plot1D; /** 2D object */ @@ -106,7 +107,6 @@ private: QVector plot1D_hists; - /** Number of Measurements */ int numberOfMeasurements; /** currentFrame */ @@ -126,20 +126,20 @@ private: static pthread_mutex_t last_image_complete_mutex; /**variables for histograms */ - /** Title in 2D */ - std::string imageTitle; /** X Axis Title in 2D */ QString imageXAxisTitle; /** Y Axis Title in 2D */ QString imageYAxisTitle; /** Z Axis Title in 2D */ QString imageZAxisTitle; - /** Title for all the graphs in 1D */ - static std::string histTitle[MAX_1DPLOTS]; /** X Axis Title in 1D */ QString histXAxisTitle; /** Y Axis Title in 1D */ QString histYAxisTitle; + /** Title for all the graphs in 1D */ + static std::string histTitle[MAX_1DPLOTS]; + /** Title in 2D */ + static std::string imageTitle; /** 1D or 2D */ static unsigned int plot_in_scope; /** Number of Pixels in X Axis */ @@ -169,117 +169,85 @@ private: static int progress; static bool plotEnable; - - /** */ - int LockLastImageArray() {return pthread_mutex_lock(&last_image_complete_mutex); } - /** */ - int UnlockLastImageArray() {return pthread_mutex_unlock(&last_image_complete_mutex);} - /** */ - int StartDaqForGui() {return StartOrStopThread(1) ? 1:0;} - /** */ - int StopDaqForGui() {return StartOrStopThread(0) ? 0:1;} - - /** */ - const char* GetImageTitle() {return imageTitle.c_str();} - /** */ - const char* GetHistTitle(int i) {return (i>=0&&i=0&&i=0&&i=0&&i #include #include "SlsQt1DZoomer.h" +#include +using namespace std; class QPen; class SlsQt1DPlot; @@ -104,14 +112,18 @@ class SlsQt1DPlot:public QwtPlot{ void InsertVLine(double v); void RemoveVLine(); - void DisableZoom(bool disableZoom); - void SetXAxisScale(double min,double max){setAxisScale(QwtPlot::xBottom,min,max);}; - void SetYAxisScale(double min,double max){setAxisScale(QwtPlot::yLeft,min,max);}; - double GetXAxisLowerBound(){return axisScaleDiv(QwtPlot::xBottom)->lowerBound();}; - double GetXAxisUpperBound(){return axisScaleDiv(QwtPlot::xBottom)->upperBound();}; - double GetYAxisLowerBound(){return axisScaleDiv(QwtPlot::yLeft)->lowerBound();}; - double GetYAxisUpperBound(){return axisScaleDiv(QwtPlot::yLeft)->upperBound(); }; + /** This group of functions have been added by Dhanya on 19.06.2012 to be able to + use zooming functionality without mouse control*/ + void DisableZoom(bool disableZoom); + void SetXMinMax(double min,double max){setAxisScale(QwtPlot::xBottom,min,max);}; + void SetYMinMax(double min,double max){setAxisScale(QwtPlot::yLeft,min,max);}; + double GetXMinimum(){return hist_list->Hist()->GetXMin();}; + double GetXMaximum(){return hist_list->Hist()->GetXMax();}; + double GetYMinimum(){return hist_list->Hist()->GetYMin();}; + double GetYMaximum(){return hist_list->Hist()->GetYMax();}; + /**---*/ + void SetZoom(double xmin,double ymin,double x_width,double y_width); void SetZoomBase(double xmin,double ymin,double x_width, double y_width){ zoomer->SetZoomBase(xmin,ymin,x_width,y_width);} diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h index cc6db7ea3..f2a1eaf77 100644 --- a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h @@ -2,6 +2,12 @@ /** * @author Ian Johnson * @version 1.0 + * Modifications: + * 19.06.2012: {Some functions have been added by Dhanya to enable zooming in and out + * without using mouse control: + * DisableZoom, + * SetXMinMax,SetYMinMax, + * GetXMinimum,GetXMaximum,GetYMinimum,GetYMaximum} */ @@ -43,10 +49,22 @@ public: SlsQt2DPlot(QWidget * = NULL); // SlsQt2DHist *GetHistogram(){ return hist; } - void UnZoom(); void SetZoom(double xmin,double ymin,double x_width,double y_width); + + /** This group of functions have been added by Dhanya on 19.06.2012 to be able to + use zooming functionality without mouse control*/ + void DisableZoom(bool disableZoom); + void SetXMinMax(double min,double max){setAxisScale(QwtPlot::xBottom,min,max);}; + void SetYMinMax(double min,double max){setAxisScale(QwtPlot::yLeft,min,max);}; + double GetXMinimum(){return hist->GetXMin();}; + double GetXMaximum(){return hist->GetXMax();}; + double GetYMinimum(){return hist->GetYMin();}; + double GetYMaximum(){return hist->GetYMax();}; + /**---*/ + + double GetZMinimum(){ return hist->GetMinimum();} double GetZMaximum(){ return hist->GetMaximum();} void SetZMinMax(double zmin=0,double zmax=-1); diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlotLayout.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlotLayout.h index 1104daf3c..47c82bdae 100644 --- a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlotLayout.h +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlotLayout.h @@ -1,6 +1,10 @@ /** * @author Ian Johnson * @version 1.0 + * @comments + * 19.06.2012 All modifications with the Ian flag has been made since + * z_range_ne and the buttons are defined in another class. + * Logz button and z_range_ne have wrappers to connect them */ @@ -15,7 +19,7 @@ class QGridLayout; class QString; - +class QToolButton; class SlsQt2DPlotLayout: public QGroupBox{ @@ -26,33 +30,42 @@ public: SlsQt2DPlotLayout(QWidget * = NULL); ~SlsQt2DPlotLayout(); - SlsQt2DPlot* GetPlot() {return the_plot;} + SlsQt2DPlot* GetPlot(){return the_plot;} void SetXTitle(QString st); void SetYTitle(QString st); void SetZTitle(QString st); + void UpdateNKeepSetRangeIfSet(); - void UpdateNKeepSetRangeIfSet(); private: - QGridLayout* the_layout; - SlsQt2DPlot* the_plot; + QGridLayout* the_layout; + QToolButton* btnInterpolate; + QToolButton* btnContour; + QToolButton* btnLogz; + SlsQt2DPlot* the_plot; + SlsQtNumberEntry* z_range_ne; - SlsQtNumberEntry* z_range_ne; - - bool logsChecked; +#ifndef IAN + bool zRangeChecked; +#endif + void CreateTheButtons(); void ConnectSignalsAndSlots(); - void Layout(); public slots: void SetZScaleToLog(bool yes); void ResetRange(); -void SetTitle(QString st); + +#ifndef IAN +void SetZRange(double,double); +void EnableZRange(bool enable); +#endif signals: void InterpolateSignal(bool); void ContourSignal(bool); + }; #endif diff --git a/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cxx b/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cxx index b8ece1400..0fd8af9c7 100644 --- a/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cxx +++ b/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cxx @@ -457,6 +457,8 @@ void SlsQt1DPlot::UnknownStuff(){ } + +//Added by Dhanya on 19.06.2012 to disable zooming when any of the axes range has been set void SlsQt1DPlot::DisableZoom(bool disableZoom){ #ifdef VERBOSE if(disableZoom) cout<<"Disabling zoom"<setTrackerPen(c); } +/*void SlsQt2DPlot::CompletelyUnZoom(){ + setAxisScale(QwtPlot::xBottom,hist->GetXMin(),hist->GetXMin()+(hist->GetXMax()-hist->GetXMin())); + setAxisScale(QwtPlot::yLeft,hist->GetYMin(),hist->GetYMin()+(hist->GetYMax()-hist->GetYMin())); + zoomer->setZoomBase(); + //replot(); +}*/ + void SlsQt2DPlot::UnZoom(){ - zoomer->setZoomBase(QwtDoubleRect(hist->GetXMin(),hist->GetYMin(),hist->GetXMax()-hist->GetXMin(),hist->GetYMax()-hist->GetYMin())); zoomer->setZoomBase();//Call replot for the attached plot before initializing the zoomer with its scales. @@ -147,7 +153,7 @@ void SlsQt2DPlot::SetZMinMax(double zmin,double zmax){ void SlsQt2DPlot::Update(){ - rightAxis->setColorMap(d_spectrogram->data().range(),d_spectrogram->colorMap()); + rightAxis->setColorMap(d_spectrogram->data().range(),d_spectrogram->colorMap()); if(!zoomer->zoomRectIndex()) UnZoom(); setAxisScale(QwtPlot::yRight,d_spectrogram->data().range().minValue(), d_spectrogram->data().range().maxValue()); @@ -190,6 +196,36 @@ void SlsQt2DPlot::LogZ(bool on){ } +//Added by Dhanya on 19.06.2012 to disable zooming when any of the axes range has been set +void SlsQt2DPlot::DisableZoom(bool disableZoom){ +#ifdef VERBOSE + if(disableZoom) cout<<"Disabling zoom"<setMousePattern(QwtEventPattern::MouseSelect1,Qt::NoButton); +#if QT_VERSION < 0x040000 + zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt::NoButton, Qt::ControlButton); +#else + zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt::NoButton, Qt::ControlModifier); +#endif + zoomer->setMousePattern(QwtEventPattern::MouseSelect3,Qt::NoButton); + } + if(panner) panner->setMouseButton(Qt::NoButton); + }else { + if(zoomer){ + zoomer->setMousePattern(QwtEventPattern::MouseSelect1,Qt::LeftButton); +#if QT_VERSION < 0x040000 + zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt::RightButton, Qt::ControlButton); +#else + zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt::RightButton, Qt::ControlModifier); +#endif + zoomer->setMousePattern(QwtEventPattern::MouseSelect3,Qt::RightButton); + } + if(panner) panner->setMouseButton(Qt::MidButton); + } +} /* diff --git a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx index 032ac27bb..65c6e6725 100644 --- a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx +++ b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx @@ -6,7 +6,7 @@ #include - +#include #include #include #include @@ -17,96 +17,180 @@ using namespace std; SlsQt2DPlotLayout::SlsQt2DPlotLayout(QWidget *parent):QGroupBox(parent){ - the_layout=0; - the_plot = new SlsQt2DPlot(this); + the_layout=0; + the_plot = new SlsQt2DPlot(this); - z_range_ne = new SlsQtNumberEntry(this,1,"Set the z axis range from",2,"to",2); - // z_range_ne->SetNDecimalsOfDoubleValidators(2); - z_range_ne->setFixedWidth(402); - z_range_ne->hide(); + z_range_ne = new SlsQtNumberEntry(this,1,"Set the z axis range from",2,"to",2); + z_range_ne->setFixedWidth(402); +#ifndef IAN + zRangeChecked = false; + z_range_ne->hide(); +#endif - logsChecked = false; - - Layout(); - ConnectSignalsAndSlots(); + CreateTheButtons(); + Layout(); + ConnectSignalsAndSlots(); } SlsQt2DPlotLayout::~SlsQt2DPlotLayout(){ - if(the_layout) delete the_layout; + if(the_layout) delete the_layout; - delete the_plot; - delete z_range_ne; + delete the_plot; + delete z_range_ne; +} + + +void SlsQt2DPlotLayout::CreateTheButtons(){ + /** Dhanya: All these buttons are already in another class, logz is used and a wrapper around it*/ +#ifdef IAN + btnInterpolate = new QToolButton(this); + btnInterpolate->setText("Interpolate"); + btnInterpolate->setCheckable(true); + btnInterpolate->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); + + btnContour = new QToolButton(this); + btnContour->setText("Contour"); + btnContour->setCheckable(true); + btnContour->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); +#endif + btnLogz = new QToolButton(this); + btnLogz->setText("Log Scale (Z)"); + btnLogz->setCheckable(true); + btnLogz->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); +#ifndef IAN + btnLogz->hide(); +#endif } void SlsQt2DPlotLayout::Layout(){ - if(the_layout) delete the_layout; - the_layout = new QGridLayout(this); - the_layout->addWidget(the_plot,2,1,3,3); - the_layout->addWidget(z_range_ne,5,1,1,3); + if(the_layout) delete the_layout; + the_layout = new QGridLayout(this); +#ifdef IAN + the_layout->addWidget(btnInterpolate,1,1); + the_layout->addWidget(btnContour,1,2); + the_layout->addWidget(btnLogz,1,3); +#endif + the_layout->addWidget(the_plot,2,1,3,3); + the_layout->addWidget(z_range_ne,5,1,1,3); +#ifdef IAN + the_layout->setMargin(12); +#endif } void SlsQt2DPlotLayout::ConnectSignalsAndSlots(){ +#ifndef IAN connect(this, SIGNAL(InterpolateSignal(bool)), the_plot, SLOT(InterpolatedPlot(bool))); connect(this, SIGNAL(ContourSignal(bool)), the_plot, SLOT(showContour(bool))); - connect(z_range_ne, SIGNAL(CheckBoxChanged(bool)), this, SLOT(ResetRange())); - connect(z_range_ne, SIGNAL(AValueChanged(SlsQtNumberEntry*)), this, SLOT(ResetRange())); - +#else + connect(btnInterpolate, SIGNAL(toggled(bool)),the_plot, SLOT(InterpolatedPlot(bool))); + connect(btnContour, SIGNAL(toggled(bool)),the_plot, SLOT(showContour(bool))); + connect(btnLogz, SIGNAL(toggled(bool)),this,SLOT(SetZScaleToLog(bool))); + btnInterpolate->setChecked(false); + btnContour->setChecked(false); +#endif + connect(z_range_ne, SIGNAL(CheckBoxChanged(bool)), this, SLOT(ResetRange())); + connect(z_range_ne, SIGNAL(AValueChanged(SlsQtNumberEntry*)), this, SLOT(ResetRange())); + btnLogz->setChecked(false); } void SlsQt2DPlotLayout::UpdateNKeepSetRangeIfSet(){ - if(z_range_ne->CheckBoxState()){ - //just reset histogram range before update - the_plot->SetZMinMax(z_range_ne->GetValue(0),z_range_ne->GetValue(1)); - } - - the_plot->Update(); +#ifdef IAN + if(z_range_ne->CheckBoxState()){ +#else + if(zRangeChecked){ +#endif + //just reset histogram range before update + the_plot->SetZMinMax(z_range_ne->GetValue(0),z_range_ne->GetValue(1)); + } + the_plot->Update(); } void SlsQt2DPlotLayout::ResetRange(){ - //refind z limits - the_plot->SetZMinMax(); - if(logsChecked) the_plot->SetZMinimumToFirstGreaterThanZero(); + //refind z limits + the_plot->SetZMinMax(); + if(btnLogz->isChecked()) the_plot->SetZMinimumToFirstGreaterThanZero(); +#ifdef IAN + if(z_range_ne->CheckBoxState()){ +#else + if(zRangeChecked){cout<<"entering:"<GetValue(0)<<"\t"<GetValue(1)<GetValue(0)==z_range_ne->GetValue(1)) ? 1:0; + if(!z_range_ne->IsValueOk(0)||same) z_range_ne->SetValue(the_plot->GetZMinimum(),0);cout<<"isok 0:"<GetValue(0)<<"\t"<GetValue(1)<IsValueOk(1)||same) z_range_ne->SetValue(the_plot->GetZMaximum(),1);cout<<"isok1:"<GetValue(0)<<"\t"<GetValue(1)<SetRange(the_plot->GetZMinimum(),z_range_ne->GetValue(1),0); cout<<"setrange:"<GetValue(0)<<"\t"<GetValue(1)<SetRange(z_range_ne->GetValue(0),the_plot->GetZMaximum(),1); cout<<"setrange:"<GetValue(0)<<"\t"<GetValue(1)<CheckBoxState()){ - //first time check validity - bool same = (z_range_ne->GetValue(0)==z_range_ne->GetValue(1)) ? 1:0; - if(!z_range_ne->IsValueOk(0)||same) z_range_ne->SetValue(the_plot->GetZMinimum(),0); - if(!z_range_ne->IsValueOk(1)||same) z_range_ne->SetValue(the_plot->GetZMaximum(),1); - - z_range_ne->SetRange(the_plot->GetZMinimum(),z_range_ne->GetValue(1),0); - z_range_ne->SetRange(z_range_ne->GetValue(0),the_plot->GetZMaximum(),1); - - //set histogram range - the_plot->SetZMinMax(z_range_ne->GetValue(0),z_range_ne->GetValue(1)); - } - - the_plot->Update(); + //set histogram range + the_plot->SetZMinMax(z_range_ne->GetValue(0),z_range_ne->GetValue(1)); cout<<"setminmax:"<GetValue(0)<<"\t"<GetValue(1)<Update(); } - void SlsQt2DPlotLayout::SetZScaleToLog(bool yes){ - logsChecked=yes; - the_plot->LogZ(yes); - ResetRange(); +#ifndef IAN +#ifdef VERBOSE + cout<<"Setting ZScale to log:"<setChecked(yes); +#endif + the_plot->LogZ(yes); + ResetRange(); } void SlsQt2DPlotLayout::SetXTitle(QString st){ - GetPlot()->axisWidget(QwtPlot::xBottom)->setTitle(st); +#ifndef IAN + QwtText title(st); + title.setFont(QFont("Sans Serif",11,QFont::Normal)); + GetPlot()->axisWidget(QwtPlot::xBottom)->setTitle(title); +#else + GetPlot()->axisWidget(QwtPlot::xBottom)->setTitle(st); +#endif } void SlsQt2DPlotLayout::SetYTitle(QString st){ - GetPlot()->axisWidget(QwtPlot::yLeft)->setTitle(st); +#ifndef IAN + QwtText title(st); + title.setFont(QFont("Sans Serif",11,QFont::Normal)); + GetPlot()->axisWidget(QwtPlot::yLeft)->setTitle(title); +#else + GetPlot()->axisWidget(QwtPlot::yLeft)->setTitle(st); +#endif } void SlsQt2DPlotLayout::SetZTitle(QString st){ - GetPlot()->axisWidget(QwtPlot::yRight)->setTitle(st); +#ifndef IAN + QwtText title(st); + title.setFont(QFont("Sans Serif",11,QFont::Normal)); + GetPlot()->axisWidget(QwtPlot::yRight)->setTitle(title); +#else + GetPlot()->axisWidget(QwtPlot::yRight)->setTitle(st); +#endif } -void SlsQt2DPlotLayout::SetTitle(QString st){ - setTitle(st); + +#ifndef IAN +void SlsQt2DPlotLayout::SetZRange(double zmin, double zmax){ +#ifdef VERBOSE + cout<<"zmin:"<SetNumber(zmin,0); + z_range_ne->SetNumber(zmax,1); + cout<<"\n\nthe valuessssssssssssssss:"<GetValue(0)<<"\t"<GetValue(1)<GetValue(0)<<"\t"<GetValue(1)<fixup(s); + validator_double[i]->fixup(s); num_field[i]->setText(s); } }else if(spin_box[i]){ @@ -267,7 +267,7 @@ double SlsQtNumberEntry::SetNumber(double v,int which_number_field){ void SlsQtNumberEntry::SetRange(int min, int max,int which_number_field){ int i = (which_number_field<0||which_number_field>1) ? 0:which_number_field; if(min>max){ - cout<<"Waring: SetRange(int,int) no effect min > max"< max"<setRange(min,max); if(validator_double[i]) validator_double[i]->setRange(min,max,validator_double[i]->decimals()); @@ -280,7 +280,7 @@ void SlsQtNumberEntry::SetRange(int min, int max,int which_number_field){ void SlsQtNumberEntry::SetRange(double min, double max,int which_number_field){ int i = (which_number_field<0||which_number_field>1) ? 0:which_number_field; if(min>max){ - cout<<"Waring: SetRange(double,double) no effect min >= max"<= max"<setRange(min,max,validator_double[i]->decimals()); diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index e1347fd16..84f79921f 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -27,7 +27,7 @@ int main (int argc, char **argv) { QApplication *theApp = new QApplication(argc, argv); qDetectorMain *det=new qDetectorMain(argc, argv, theApp,0); det->show(); - theApp->connect( theApp, SIGNAL(lastWindowClosed()), theApp, SLOT(quit())); + //theApp->connect( theApp, SIGNAL(lastWindowClosed()), theApp, SLOT(quit())); return theApp->exec(); } @@ -355,6 +355,7 @@ void qDetectorMain::resizeEvent(QResizeEvent* event){ centralwidget->setMaximumHeight(heightCentralWidget); } } + event->accept(); #ifdef VERBOSE cout<<"height:"<height()<stopAcquisition(); - //pthread_join(gui_acquisition_thread,NULL); //wait until he's finished, ie. exits + pthread_join(gui_acquisition_thread,NULL); //wait until he's finished, ie. exits gui_acquisition_thread_running = 0; } @@ -253,12 +260,13 @@ bool qDrawPlot::StartOrStopThread(bool start){ if(!histYAxis[0]) histYAxis[0] = new double [nPixelsX]; - Clear1DPlot(); + if(plot_in_scope==1) Clear1DPlot(); cout<<"Starting new acquisition thread ...."<registerDataCallback(&(GetDataCallBack)); /** Start acquiring data from server */ - pthread_create(&gui_start_acquire_thread, NULL,DataStartAcquireThread, (void*) this); + pthread_create(&gui_acquisition_thread, NULL,DataStartAcquireThread, (void*) this); + /** This is later reset to zero when all the plotting is done */ gui_acquisition_thread_running=1; cout<<"Started acquiring"<myDet->acquire(1); return this_pointer; @@ -274,6 +283,7 @@ void* qDrawPlot::DataStartAcquireThread(void *this_pointer){ + int qDrawPlot::GetDataCallBack(detectorData *data){ #ifdef VERYVERBOSE cout<<"Entering GetDataCallBack function"<0;i--) - memcpy(yvalues[i],yvalues[i-1],nPixelsX*sizeof(double)); - nHists = currentPersistency+1; - /** Get data from client */ - memcpy(yvalues[0],data->values,nPixelsX*sizeof(double)); - + /** Get data from client */ /**1d*/ - // if(plot_in_scope==1){ + if(plot_in_scope==1){ + /** Persistency */ + if(currentPersistency < persistency)currentPersistency++; + else currentPersistency=persistency; + for(int i=currentPersistency;i>0;i--) + memcpy(yvalues[i],yvalues[i-1],nPixelsX*sizeof(double)); + nHists = currentPersistency+1; + memcpy(yvalues[0],data->values,nPixelsX*sizeof(double)); + } + /**2d*/ + else{ + for(unsigned int px=0;px0;i--) - memcpy(histYAxis[i],histYAxis[i-1],nPixelsX*sizeof(double)); - memcpy(histYAxis[0],yvalues[0],nPixelsX*sizeof(double)); + /**1d*/ + if(plot_in_scope==1){ + /** Titles*/ + sprintf(temp_title,"Frame %d",currentFrame); histTitle[0] = temp_title; + /** copy data*/ + //memcpy(histXAxis, xvalues,nPixelsX*sizeof(double)); + for(int i=currentPersistency;i>0;i--) + memcpy(histYAxis[i],histYAxis[i-1],nPixelsX*sizeof(double)); + memcpy(histYAxis[0],yvalues[0],nPixelsX*sizeof(double)); + } + /**2d*/ + else{ + sprintf(temp_title,"Image Number %d",currentFrame); imageTitle = temp_title; + memcpy(lastImageArray,image_data,nPixelsX*nPixelsY*sizeof(double)); + } pthread_mutex_unlock(&(last_image_complete_mutex)); } currentFrame++; } - //} - ///**2d*/ - //else{ - // ; - //} - #ifdef VERYVERBOSE cout<<"Exiting GetDataCallBack function"<stop(); @@ -395,7 +404,7 @@ void qDrawPlot::UpdatePlot(){ Clear1DPlot(); plot1D->SetXTitle(histXAxisTitle.toAscii().constData()); plot1D->SetYTitle(histYAxisTitle.toAscii().constData()); - for(int hist_num=0;hist_numplot1D_hists.size()){ plot1D_hists.append(h=new SlsQtH1D("1d plot",histNBins,histXAxis,GetHistYAxis(hist_num))); @@ -408,16 +417,12 @@ void qDrawPlot::UpdatePlot(){ h->Attach(plot1D); } - //plot1D->UnZoom(); - //if(first){plot1D->UnZoom();first = !first;} - //plot1D->SetZoom(double xmin,double ymin,double x_width,double y_width); - } } //2-d plot stuff if(lastImageArray){ - if(lastImageNumber&&last_plot_number!=lastImageNumber && //there is a new plot + if(lastImageNumber&&last_plot_number!=(int)lastImageNumber && //there is a new plot nPixelsX>0&&nPixelsY>0){ plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,-0.5,nPixelsY-0.5,lastImageArray); //as it inherits a widget @@ -532,6 +537,17 @@ void qDrawPlot::SavePlot(QString FName){ +void qDrawPlot::SetPersistency(int val){ + for(int i=0;i<=val;i++){ + if(!yvalues[i]) yvalues[i] = new double [nPixelsX]; + if(!histYAxis[i]) histYAxis[i] = new double [nPixelsX]; + } + persistency = val; +} + + + + void qDrawPlot::EnablePlot(bool enable){ #ifdef VERBOSE cout<<"Plotting set to:"<DisableZoom(disable); -///disable zoom - + else + plot2D->GetPlot()->DisableZoom(disable); } diff --git a/slsDetectorGui/src/qTabActions.cpp b/slsDetectorGui/src/qTabActions.cpp index 10fd7ea2f..90fddab74 100644 --- a/slsDetectorGui/src/qTabActions.cpp +++ b/slsDetectorGui/src/qTabActions.cpp @@ -102,14 +102,6 @@ void qTabActions::Initialization(){ - -void qTabActions::Enable(bool enable){ - - -} - - - void qTabActions::Expand(QAbstractButton *button ){ int index = group->id(button); /** Collapse */ diff --git a/slsDetectorGui/src/qTabDeveloper.cpp b/slsDetectorGui/src/qTabDeveloper.cpp index 6914431ae..777a76c7f 100644 --- a/slsDetectorGui/src/qTabDeveloper.cpp +++ b/slsDetectorGui/src/qTabDeveloper.cpp @@ -47,9 +47,3 @@ void qTabDeveloper::Initialization(){ -void qTabDeveloper::Enable(bool enable){ - //this->setEnabled(enable); - -} - - diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 170a8127d..04cbaf7c8 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -76,32 +76,29 @@ void qTabMeasurement::SetupWidgetWindow(){ switch(myDet->getDetectorsType()){ case slsDetectorDefs::MYTHEN: - item[(int)Gated]->setEnabled(true); item[(int)Trigger_Exp_Series]->setEnabled(true); item[(int)Trigger_Frame]->setEnabled(false); item[(int)Trigger_Readout]->setEnabled(true); + item[(int)Gated]->setEnabled(true); item[(int)Gated_Start]->setEnabled(true); item[(int)Trigger_Window]->setEnabled(false); break; case slsDetectorDefs::EIGER: - item[(int)Gated]->setEnabled(false); item[(int)Trigger_Exp_Series]->setEnabled(true); item[(int)Trigger_Frame]->setEnabled(true); item[(int)Trigger_Readout]->setEnabled(false); + item[(int)Gated]->setEnabled(false); item[(int)Gated_Start]->setEnabled(false); item[(int)Trigger_Window]->setEnabled(true); break; case slsDetectorDefs::GOTTHARD: - item[(int)Gated]->setEnabled(false); item[(int)Trigger_Exp_Series]->setEnabled(true); item[(int)Trigger_Frame]->setEnabled(false); item[(int)Trigger_Readout]->setEnabled(false); + item[(int)Gated]->setEnabled(false); item[(int)Gated_Start]->setEnabled(false); item[(int)Trigger_Window]->setEnabled(false); break; -/* case slsDetectorDefs::PICASSO: - case slsDetectorDefs::PILATUS: - case slsDetectorDefs::AGIPD:*/ default: cout<<"ERROR: Detector Type is Generic"<setText("Start"); - //btnStartStop->setStyleSheet("color:green"); - //btnStartStop->setStyleSheet("background:rgb(239,239,239)"); - Enable(1); - connect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); - UpdateProgress(); - progressTimer->stop(); -} - - - void qTabMeasurement::setFileName(const QString& fName){ myDet->setFileName(fName.toAscii().data()); #ifdef VERBOSE @@ -252,6 +236,29 @@ void qTabMeasurement::startStopAcquisition(){ +void qTabMeasurement::UpdateFinished(){ + disconnect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); + btnStartStop->setText("Start"); + //btnStartStop->setStyleSheet("color:green"); + //btnStartStop->setStyleSheet("background:rgb(239,239,239)"); + Enable(1); + connect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); + UpdateProgress(); + progressTimer->stop(); +} + + + +void qTabMeasurement::UpdateProgress(){ + progressBar->setValue(myPlot->GetProgress()); + lblProgressIndex->setText(QString::number(myDet->getFileIndex())); +} + + + + + + void qTabMeasurement::setNumFrames(int val){ myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,val); #ifdef VERBOSE @@ -263,8 +270,8 @@ void qTabMeasurement::setNumFrames(int val){ void qTabMeasurement::setExposureTime(){ int64_t exptimeNS; - /** Get the 64 bit value of timer**/ - exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value()); + /** Get the value of timer in ns **/ + exptimeNS = (int64_t)qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value()); #ifdef VERBOSE cout<<"Setting acquisition time to " << exptimeNS << " clocks" << endl; #endif @@ -272,7 +279,7 @@ void qTabMeasurement::setExposureTime(){ if(lblPeriod->isEnabled()){ int64_t acqtimeNS; - acqtimeNS = qDefs::getNSTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value()); + acqtimeNS = (int64_t)qDefs::getNSTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value()); if(exptimeNS>acqtimeNS) { lblNote->show(); lblPeriod->setPalette(lblNote->palette()); @@ -290,15 +297,15 @@ void qTabMeasurement::setExposureTime(){ void qTabMeasurement::setAcquisitionPeriod(){ int64_t acqtimeNS; - /** Get the 64 bit value of timer**/ - acqtimeNS = qDefs::getNSTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value()); + /** Get the value of timer in ns **/ + acqtimeNS = (int64_t)qDefs::getNSTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value()); #ifdef VERBOSE cout<<"Setting frame period between exposures to " << acqtimeNS << " clocks" << endl; #endif myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,acqtimeNS); int64_t exptimeNS; - exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value()); + exptimeNS = (int64_t)qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value()); if(exptimeNS>acqtimeNS){ lblNote->show(); lblPeriod->setPalette(lblNote->palette()); @@ -327,8 +334,8 @@ void qTabMeasurement::setNumTriggers(int val){ void qTabMeasurement::setDelay(){ int64_t exptimeNS; - /** Get the 64 bit value of timer**/ - exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboDelayUnit->currentIndex(),spinDelay->value()); + /** Get the value of timer in ns **/ + exptimeNS = (int64_t)qDefs::getNSTime((qDefs::timeUnit)comboDelayUnit->currentIndex(),spinDelay->value()); #ifdef VERBOSE cout<<"Setting delay after trigger to " << exptimeNS << " clocks" << endl; #endif @@ -356,13 +363,6 @@ void qTabMeasurement::setNumProbes(int val){ } -void qTabMeasurement::UpdateProgress(){ - progressBar->setValue(myPlot->GetProgress()); - lblProgressIndex->setText(QString::number(myDet->getFileIndex())); -} - - - void qTabMeasurement::setTimingMode(int mode){ #ifdef VERBOSE @@ -381,43 +381,43 @@ void qTabMeasurement::setTimingMode(int mode){ switch(mode){ - case None: + case None:/** Exposure Time */ lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true); break; - case Auto: + case Auto:/** Number of Frames, Exposure Time, Acquisition Period */ lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true); lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true); break; - case Gated: - lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); - lblNumGates->setEnabled(true); spinNumGates->setEnabled(true); - break; - case Trigger_Exp_Series: + case Trigger_Exp_Series:/** Number of Frames, Exposure Time, Acquisition Period, Number of Triggers, Delay */ lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true); lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true); lblNumTriggers->setEnabled(true); spinNumTriggers->setEnabled(true); lblDelay->setEnabled(true); spinDelay->setEnabled(true); comboDelayUnit->setEnabled(true); break; - case Trigger_Readout: + case Trigger_Frame:/** Exposure Time, Number of Triggers */ + lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true); + lblNumTriggers->setEnabled(true); spinNumTriggers->setEnabled(true); + break; + case Trigger_Readout:/** Number of Frames, Exposure Time, Acquisition Period, Delay */ lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true); lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true); lblDelay->setEnabled(true); spinDelay->setEnabled(true); comboDelayUnit->setEnabled(true); break; - case Gated_Start: + case Gated:/** Number of Frames, Number of Gates */ + lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); + lblNumGates->setEnabled(true); spinNumGates->setEnabled(true); + break; + case Gated_Start:/** Number of Frames, Exposure Time, Acquisition Period, Number of Triggers, Number of Gates */ lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true); lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true); lblNumTriggers->setEnabled(true); spinNumTriggers->setEnabled(true); lblNumGates->setEnabled(true); spinNumGates->setEnabled(true); break; - case Trigger_Frame: - lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true); - lblNumTriggers->setEnabled(true); spinNumTriggers->setEnabled(true); - break; - case Trigger_Window: + case Trigger_Window:/** Number of Triggers */ lblNumTriggers->setEnabled(true); spinNumTriggers->setEnabled(true); break; default: @@ -425,7 +425,7 @@ void qTabMeasurement::setTimingMode(int mode){ exit(-1); } - if(mode!=None){ + if(mode!=None){/** Number of Probes */ if(myDet->getDetectorsType()==slsDetectorDefs::MYTHEN){ lblNumProbes->setEnabled(true); spinNumProbes->setEnabled(true); } @@ -466,8 +466,8 @@ void qTabMeasurement::setTimingMode(int mode){ comboPeriodUnit->setCurrentIndex(qDefs::SECONDS); int64_t exptimeNS,acqtimeNS; - exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value()); - acqtimeNS = qDefs::getNSTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value()); + exptimeNS = (int64_t)qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value()); + acqtimeNS = (int64_t)qDefs::getNSTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value()); if(exptimeNS>acqtimeNS) { lblNote->show(); lblPeriod->setPalette(lblNote->palette()); diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index e8d9c2081..9ab78a281 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -30,14 +30,17 @@ QString qTabPlot::defaultImageZAxisTitle("Intensity"); qTabPlot::qTabPlot(QWidget *parent,slsDetectorUtils*& detector, qDrawPlot*& plot):QWidget(parent),myDet(detector),myPlot(plot){ setupUi(this); - if(myDet) - { - // wherever you choose plot do all these steps - //This also selects the text if unchecked - //includes setupwidgetwindow - //SelectPlot(1); - //switch(myDet->detectorytype) - Select1DPlot(true); + if(myDet){ + 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"<setEnabled(false); dispYMax->setEnabled(false); dispZMax->setEnabled(false); -/* dispXMin->setValidator(new QDoubleValidator(dispXMin)); + dispXMin->setValidator(new QDoubleValidator(dispXMin)); dispYMin->setValidator(new QDoubleValidator(dispYMin)); dispZMin->setValidator(new QDoubleValidator(dispZMin)); dispXMax->setValidator(new QDoubleValidator(dispXMax)); dispYMax->setValidator(new QDoubleValidator(dispYMax)); - dispZMax->setValidator(new QDoubleValidator(dispZMax));*/ + dispZMax->setValidator(new QDoubleValidator(dispZMax)); } @@ -119,6 +122,8 @@ void qTabPlot::Initialization(){ connect(chkInterpolate, SIGNAL(toggled(bool)),myPlot, SIGNAL(InterpolateSignal(bool))); connect(chkContour, SIGNAL(toggled(bool)),myPlot, SIGNAL(ContourSignal(bool))); connect(chkLogz, SIGNAL(toggled(bool)),myPlot, SIGNAL(LogzSignal(bool))); + + /** Plot Axis **/ connect(chkTitle, SIGNAL(toggled(bool)), this, SLOT(EnableTitles())); connect(chkXAxis, SIGNAL(toggled(bool)), this, SLOT(EnableTitles())); @@ -133,15 +138,17 @@ void qTabPlot::Initialization(){ connect(chkXMax, SIGNAL(toggled(bool)), this, SLOT(EnableRange())); connect(chkYMin, SIGNAL(toggled(bool)), this, SLOT(EnableRange())); connect(chkYMax, SIGNAL(toggled(bool)), this, SLOT(EnableRange())); - connect(chkZMin, SIGNAL(toggled(bool)), this, SLOT(EnableRange())); - connect(chkZMax, SIGNAL(toggled(bool)), this, SLOT(EnableRange())); + connect(chkZMin, SIGNAL(toggled(bool)), this, SLOT(EnableZRange())); + connect(chkZMax, SIGNAL(toggled(bool)), this, SLOT(EnableZRange())); + connect(this, SIGNAL(EnableZRangeSignal(bool)), myPlot, SIGNAL(EnableZRangeSignal(bool))); connect(dispXMin, SIGNAL(returnPressed()), this, SLOT(SetAxesRange())); connect(dispXMax, SIGNAL(returnPressed()), this, SLOT(SetAxesRange())); connect(dispYMin, SIGNAL(returnPressed()), this, SLOT(SetAxesRange())); connect(dispYMax, SIGNAL(returnPressed()), this, SLOT(SetAxesRange())); - connect(dispZMin, SIGNAL(returnPressed()), this, SLOT(SetAxesRange())); - connect(dispZMax, SIGNAL(returnPressed()), this, SLOT(SetAxesRange())); + connect(dispZMin, SIGNAL(returnPressed()), this, SLOT(SetZRange())); + connect(dispZMax, SIGNAL(returnPressed()), this, SLOT(SetZRange())); + connect(this, SIGNAL(SetZRangeSignal(double,double)),myPlot, SIGNAL(SetZRangeSignal(double,double))); /** Common Buttons*/ connect(btnClear, SIGNAL(clicked()), myPlot, SLOT(Clear1DPlot())); @@ -169,7 +176,6 @@ void qTabPlot::EnablePersistency(bool enable){ } - void qTabPlot::SetTitles(){ int oneD = box1D->isEnabled(); /** Plot Title*/ @@ -236,87 +242,60 @@ void qTabPlot::EnableTitles(){ void qTabPlot::EnableRange(){ bool disableZoom = false; - if(!chkXMin->isChecked()) {dispXMin->setText(""); dispXMin->setEnabled(false);} - else {disableZoom = true; dispXMin->setEnabled(true); } - if(!chkXMax->isChecked()) {dispXMax->setText(""); dispXMax->setEnabled(false);} - else {disableZoom = true; dispXMax->setEnabled(true); } - if(!chkYMin->isChecked()) {dispYMin->setText(""); dispYMin->setEnabled(false);} - else {disableZoom = true; dispYMin->setEnabled(true); } - if(!chkYMax->isChecked()) {dispYMax->setText(""); dispYMax->setEnabled(false);} - else {disableZoom = true; dispYMax->setEnabled(true); } - if(!chkZMin->isChecked()) {dispZMin->setText(""); dispZMin->setEnabled(false);} - else {disableZoom = true; dispZMin->setEnabled(true); } - if(!chkZMax->isChecked()) {dispZMax->setText(""); dispZMax->setEnabled(false);} - else {disableZoom = true; dispZMax->setEnabled(true); } + if(!chkXMin->isChecked()) dispXMin->setEnabled(false); + else{disableZoom = true; dispXMin->setEnabled(true); } + if(!chkXMax->isChecked()) dispXMax->setEnabled(false); + else{disableZoom = true; dispXMax->setEnabled(true); } + if(!chkYMin->isChecked()) dispYMin->setEnabled(false); + else{disableZoom = true; dispYMin->setEnabled(true); } + if(!chkYMax->isChecked()) dispYMax->setEnabled(false); + else{disableZoom = true; dispYMax->setEnabled(true); } + myPlot->DisableZoom(disableZoom); emit DisableZoomSignal(disableZoom); + SetAxesRange(); } void qTabPlot::SetAxesRange(){ - double xmin,xmax,ymin,ymax,zmin,zmax; - int oneD = box1D->isEnabled(); - //should be filled for 2d as well - if(!dispXMin->text().isEmpty()) xmin = dispXMin->text().toDouble(); - else { if(oneD) xmin = myPlot->GetHistXAxisLowerBound();} - if(!dispXMax->text().isEmpty()) xmax = dispXMax->text().toDouble(); - else { if(oneD) xmax = myPlot->GetHistXAxisUpperBound();} - if(!dispYMin->text().isEmpty()) ymin = dispYMin->text().toDouble(); - else { if(oneD) ymin = myPlot->GetHistYAxisLowerBound();} - if(!dispYMax->text().isEmpty()) ymax = dispYMax->text().toDouble(); - else { if(oneD) ymax = myPlot->GetHistYAxisUpperBound();} - if(!dispZMin->text().isEmpty()) zmin = dispZMin->text().toDouble(); - if(!dispZMax->text().isEmpty()) zmax = dispZMax->text().toDouble(); - //should be filled for 2d as well - if(oneD){ - myPlot->SetHistXAxisScale(xmin,xmax); - myPlot->SetHistYAxisScale(ymin,ymax); - } + double xmin=0,xmax=0,ymin=0,ymax=0; + + /** If disabled, get the min or max range of the plot as default */ + if((dispXMin->isEnabled())&&(!dispXMin->text().isEmpty())) + xmin = dispXMin->text().toDouble(); + else xmin = myPlot->GetXMinimum(); + if((dispXMax->isEnabled())&&(!dispXMax->text().isEmpty())) + xmax = dispXMax->text().toDouble(); + else xmax = myPlot->GetXMaximum(); + if((dispYMin->isEnabled())&&(!dispYMin->text().isEmpty())) + ymin = dispYMin->text().toDouble(); + else ymin = myPlot->GetYMinimum(); + if((dispYMax->isEnabled())&&(!dispYMax->text().isEmpty())) + ymax = dispYMax->text().toDouble(); + else ymax = myPlot->GetYMaximum(); + + /** Setting the range*/ + myPlot->SetXMinMax(xmin,xmax); + myPlot->SetYMinMax(ymin,ymax); } + +void qTabPlot::SetZRange(){ + emit SetZRangeSignal(dispZMin->text().toDouble(),dispZMax->text().toDouble()); +} + +void qTabPlot::EnableZRange(){ + dispZMin->setEnabled(chkZMin->isChecked()); + dispZMax->setEnabled(chkZMax->isChecked()); + emit EnableZRangeSignal((chkZMin->isChecked())||(chkZMax->isChecked())); +} + + + void qTabPlot::SavePlot(){ QString fullFileName = QString(myDet->getFilePath().c_str())+'/'+dispFName->text()+comboFormat->currentText(); myPlot->SavePlot(fullFileName); } - - - - - -//dispzmin... when unchecked, unzoom and get lower and upper bound... when checked just set lower and upper bound - -/* - -#include "SlsQtValidators.h" - -class QDoubleValidator; -SlsQtDoubleValidator* validator_double[2]; - - - - -validator_double = new SlsQtDoubleValidator(num_field); -num_field->setValidator(validator_double); -//default settings -validator_double->setDecimals(3); -double v= num_field->text().toDouble(ok);); -is ok 1? for correct conversion - -QString s = QString::number(v); -validator_double->fixup(s); -num_field->setText(s); - - -num_field[i]->setAlignment(Qt::AlignRight); - - - -connect(num_field[i],SIGNAL(lostFocus()),this,SLOT(FirstValueEntered())); - -*/ - - - From 31b65642cb954fc71903c7e0bec77b6570bc2e96 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 20 Jun 2012 15:02:35 +0000 Subject: [PATCH 012/332] The timing mode works now git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@12 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qDefs.h | 22 +++- slsDetectorGui/include/qDetectorMain.h | 17 ++- slsDetectorGui/src/qDetectorMain.cpp | 65 +++++++---- slsDetectorGui/src/qTabMeasurement.cpp | 145 ++++++++++++++++--------- 4 files changed, 163 insertions(+), 86 deletions(-) diff --git a/slsDetectorGui/include/qDefs.h b/slsDetectorGui/include/qDefs.h index 309bc9efe..955cb344d 100644 --- a/slsDetectorGui/include/qDefs.h +++ b/slsDetectorGui/include/qDefs.h @@ -9,15 +9,19 @@ #define QDEFS_H #include +#include using namespace std; -class qDefs -{ +class qDefs:public QWidget{ public: +//------------------------------------------------------------------------------------------------------------------------------------------------- + /** Empty Constructor */ qDefs(){}; +//------------------------------------------------------------------------------------------------------------------------------------------------- + /** unit of time */ enum timeUnit{ @@ -29,6 +33,7 @@ public: NANOSECONDS /** ns */ }; +//------------------------------------------------------------------------------------------------------------------------------------------------- /** returns the value in ns to send to server. * @param unit unit of time @@ -49,7 +54,20 @@ public: return valueNS; }; +//------------------------------------------------------------------------------------------------------------------------------------------------- + /**displays an error message + * @param errorMessage the message to be displayed + * @param source is the tab or the source of the error + * */ + static void ErrorMessage(string errorMessage,char source[]) + { + static QMessageBox* msgBox; + msgBox= new QMessageBox(QMessageBox::Warning,source,tr(errorMessage.c_str()),QMessageBox::Ok, msgBox); + msgBox->exec(); + } + +//------------------------------------------------------------------------------------------------------------------------------------------------- }; diff --git a/slsDetectorGui/include/qDetectorMain.h b/slsDetectorGui/include/qDetectorMain.h index f8f318896..a09558036 100644 --- a/slsDetectorGui/include/qDetectorMain.h +++ b/slsDetectorGui/include/qDetectorMain.h @@ -27,11 +27,12 @@ class slsDetectorUtils; #include #include + /** To Over-ride the QTabWidget class to get the tabBar */ class MyTabWidget:public QTabWidget{ public: MyTabWidget(QWidget* parent = 0) {setParent(parent);} - //Overridden method from QTabWidget + /** Overridden method from QTabWidget */ QTabBar* tabBar(){return QTabWidget::tabBar();} }; @@ -53,11 +54,9 @@ public: */ qDetectorMain(int argc, char **argv, QApplication *app, QWidget *parent = 0); - /**Destructor - */ + /**Destructor */ ~qDetectorMain(); - private: /** The Qt Application */ QApplication *theApp; @@ -73,12 +72,12 @@ private: int heightPlotWindow; /** default height of central widgetwhen plot Window when docked */ int heightCentralWidget; + /** The default zooming tool tip */ + QString zoomToolTip; + /** The default tab heading color */ + QColor defaultTabColor; /** enumeration of the tabs */ enum {Measurement, Settings, DataOutput, Plot, Actions, Advanced, Debugging, Developer, NumberOfTabs }; - - QColor defaultTabColor; - QString zoomToolTip; - /* Scroll Area for the tabs**/ QScrollArea *scroll[NumberOfTabs]; /**Measurement tab */ @@ -99,8 +98,6 @@ private: qTabDeveloper *tab_developer; /**if the developer tab should be enabled,known from command line */ int isDeveloper; - - /**Sets up the layout of the widget */ void SetUpWidgetWindow(); diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 84f79921f..59947cf64 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -1,5 +1,6 @@ /** Qt Project Class Headers */ #include "qDetectorMain.h" +#include "qDefs.h" #include "qDrawPlot.h" #include "qTabMeasurement.h" #include "qTabDataOutput.h" @@ -22,6 +23,8 @@ using namespace std; #define Detector_Index 0 +//------------------------------------------------------------------------------------------------------------------------------------------------- + int main (int argc, char **argv) { QApplication *theApp = new QApplication(argc, argv); @@ -31,9 +34,7 @@ int main (int argc, char **argv) { return theApp->exec(); } - - - +//------------------------------------------------------------------------------------------------------------------------------------------------- qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app, QWidget *parent) : QMainWindow(parent), theApp(app),myPlot(NULL),tabs(NULL),isDeveloper(0){ @@ -52,14 +53,11 @@ qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app, QWidget * cout<<"-developer \t : \t Enables the developer tab"<getDetectorsType()){ + case slsDetectorDefs::MYTHEN: break; + case slsDetectorDefs::EIGER: break; + case slsDetectorDefs::GOTTHARD: break; + default: + string detName = myDet->slsDetectorBase::getDetectorType(myDet->getDetectorsType()); + string hostname = myDet->getHostname(Detector_Index); + string errorMess = string("ERROR: ")+hostname+string(" has unknown detector type \"")+detName+string("\". Exiting GUI."); + qDefs::ErrorMessage(errorMess,"Main: ERROR"); + exit(-1); + } setWindowTitle("SLS Detector GUI : "+QString(slsDetectorBase::getDetectorType(myDet->getDetectorsType()).c_str())+" - "+QString(myDet->getHostname(Detector_Index).c_str())); #ifdef VERBOSE cout<getDetectorsType())<<"\t\t\tDetector : "<getHostname(Detector_Index)<toolTip(); } +//------------------------------------------------------------------------------------------------------------------------------------------------- void qDetectorMain::SetDeveloperMode(bool b){ #ifdef VERBOSE @@ -213,6 +220,7 @@ void qDetectorMain::SetDeveloperMode(bool b){ tabs->setTabEnabled(Developer,b); } +//------------------------------------------------------------------------------------------------------------------------------------------------- void qDetectorMain::SetDebugMode(bool b){ #ifdef VERBOSE @@ -221,21 +229,24 @@ void qDetectorMain::SetDebugMode(bool b){ tabs->setTabEnabled(Debugging,b); } +//------------------------------------------------------------------------------------------------------------------------------------------------- + void qDetectorMain::SetBeamlineMode(bool b){ #ifdef VERBOSE cout<<"Setting Beamline Mode to "<setTabEnabled(Advanced,b); - } - +//------------------------------------------------------------------------------------------------------------------------------------------------- void qDetectorMain::refresh(int index){ if(!tabs->isTabEnabled(index)) @@ -248,6 +259,7 @@ void qDetectorMain::refresh(int index){ tabs->tabBar()->setTabTextColor(index,QColor(0,0,200,255)); } +//------------------------------------------------------------------------------------------------------------------------------------------------- void qDetectorMain::SetDockableMode(bool b){ #ifdef VERBOSE @@ -261,6 +273,7 @@ void qDetectorMain::SetDockableMode(bool b){ } } +//------------------------------------------------------------------------------------------------------------------------------------------------- void qDetectorMain::OpenSetup(){ #ifdef VERBOSE @@ -268,6 +281,7 @@ void qDetectorMain::OpenSetup(){ #endif } +//------------------------------------------------------------------------------------------------------------------------------------------------- void qDetectorMain::SaveSetup(){ #ifdef VERBOSE @@ -275,6 +289,7 @@ void qDetectorMain::SaveSetup(){ #endif } +//------------------------------------------------------------------------------------------------------------------------------------------------- void qDetectorMain::MeasurementWizard(){ #ifdef VERBOSE @@ -282,6 +297,8 @@ void qDetectorMain::MeasurementWizard(){ #endif } +//------------------------------------------------------------------------------------------------------------------------------------------------- + void qDetectorMain::OpenConfiguration(){ #ifdef VERBOSE @@ -289,6 +306,7 @@ void qDetectorMain::OpenConfiguration(){ #endif } +//------------------------------------------------------------------------------------------------------------------------------------------------- void qDetectorMain::SaveConfiguration(){ #ifdef VERBOSE @@ -296,6 +314,7 @@ void qDetectorMain::SaveConfiguration(){ #endif } +//------------------------------------------------------------------------------------------------------------------------------------------------- void qDetectorMain::EnergyCalibration(){ #ifdef VERBOSE @@ -303,6 +322,7 @@ void qDetectorMain::EnergyCalibration(){ #endif } +//------------------------------------------------------------------------------------------------------------------------------------------------- void qDetectorMain::AngularCalibration(){ #ifdef VERBOSE @@ -310,6 +330,7 @@ void qDetectorMain::AngularCalibration(){ #endif } +//------------------------------------------------------------------------------------------------------------------------------------------------- void qDetectorMain::Version(){ #ifdef VERBOSE @@ -317,6 +338,7 @@ void qDetectorMain::Version(){ #endif } +//------------------------------------------------------------------------------------------------------------------------------------------------- void qDetectorMain::About(){ #ifdef VERBOSE @@ -324,6 +346,7 @@ void qDetectorMain::About(){ #endif } +//------------------------------------------------------------------------------------------------------------------------------------------------- void qDetectorMain::ResizeMainWindow(bool b){ #ifdef VERBOSE @@ -356,14 +379,9 @@ void qDetectorMain::resizeEvent(QResizeEvent* event){ } } event->accept(); -#ifdef VERBOSE - cout<<"height:"<height()<setToolTip(zoomToolTip); } + +//------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 04cbaf7c8..91266a84d 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -23,7 +23,7 @@ using namespace std; #define Detector_Index 0 #define UndefinedSettings 7 - +//------------------------------------------------------------------------------------------------------------------------------------------------- qTabMeasurement::qTabMeasurement(QWidget *parent,slsDetectorUtils*& detector, qDrawPlot*& plot): QWidget(parent),myDet(detector),myPlot(plot){ @@ -35,36 +35,38 @@ qTabMeasurement::qTabMeasurement(QWidget *parent,slsDetectorUtils*& detector, qD } } - - +//------------------------------------------------------------------------------------------------------------------------------------------------- qTabMeasurement::~qTabMeasurement(){ delete myDet; delete myPlot; } - - +//------------------------------------------------------------------------------------------------------------------------------------------------- void qTabMeasurement::SetupWidgetWindow(){ - + /** Timer to update the progress bar **/ progressTimer = new QTimer(this); //btnStartStop->setStyleSheet("color:green"); /** Exp Time **/ float time = (float)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-9)); spinExpTime->setValue(time); comboExpUnit->setCurrentIndex(qDefs::SECONDS); - + /** Hide the error message **/ lblNote->hide(); - /** File Name **/ dispFileName->setText(QString(myDet->getFileName().c_str())); /** File Index **/ spinIndex->setValue(myDet->getFileIndex()); /** only initially **/ lblProgressIndex->setText(QString::number(myDet->getFileIndex())); + /** only initially **/ + progressBar->setValue(0); - /** Enabling/Disabling depending on the detector type*/ + /** timing mode*/ + /** Get timing mode from detector*/ + slsDetectorDefs::externalCommunicationMode mode = myDet->setExternalCommunicationMode(); + /** To be able to index items on a combo box */ QStandardItemModel* model = qobject_cast(comboTimingMode->model()); QModelIndex index[NumTimingModes]; QStandardItem* item[NumTimingModes]; @@ -73,7 +75,7 @@ void qTabMeasurement::SetupWidgetWindow(){ index[i] = model->index(i, comboTimingMode->modelColumn(), comboTimingMode->rootModelIndex()); item[i] = model->itemFromIndex(index[i]); } - + /** Enabling/Disabling depending on the detector type */ switch(myDet->getDetectorsType()){ case slsDetectorDefs::MYTHEN: item[(int)Trigger_Exp_Series]->setEnabled(true); @@ -83,7 +85,7 @@ void qTabMeasurement::SetupWidgetWindow(){ item[(int)Gated_Start]->setEnabled(true); item[(int)Trigger_Window]->setEnabled(false); break; - case slsDetectorDefs::EIGER: + case slsDetectorDefs::GOTTHARD: item[(int)Trigger_Exp_Series]->setEnabled(true); item[(int)Trigger_Frame]->setEnabled(true); item[(int)Trigger_Readout]->setEnabled(false); @@ -91,7 +93,7 @@ void qTabMeasurement::SetupWidgetWindow(){ item[(int)Gated_Start]->setEnabled(false); item[(int)Trigger_Window]->setEnabled(true); break; - case slsDetectorDefs::GOTTHARD: + case slsDetectorDefs::EIGER: item[(int)Trigger_Exp_Series]->setEnabled(true); item[(int)Trigger_Frame]->setEnabled(false); item[(int)Trigger_Readout]->setEnabled(false); @@ -100,18 +102,48 @@ void qTabMeasurement::SetupWidgetWindow(){ item[(int)Trigger_Window]->setEnabled(false); break; default: - cout<<"ERROR: Detector Type is Generic"<isEnabled()){ + /**if the timing mode is Auto and + * number of Frames and number of triggers is 1, + * then the timing mode is 'None'. + * This is for the inexperienced user */ + if(mode==slsDetectorDefs::AUTO_TIMING){ + int frames = (int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1); + int triggers = (int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1); + if((frames==1)&&(triggers==1)){ + comboTimingMode->setCurrentIndex((int)None); + setTimingMode((int)None); + }else{ + comboTimingMode->setCurrentIndex((int)Auto); + setTimingMode((int)Auto); + } + }else{ + /** mode +1 since the detector class has no timingmode as "None" */ + comboTimingMode->setCurrentIndex((int)mode+1); + setTimingMode((int)mode+1); + } + } + /** Mode NOT ENABLED. + * This should not happen only if the server and gui has a mismatch + * on which all modes are allowed in detectors */ + else{ + qDefs::ErrorMessage("ERROR: Unknown Timing Mode detected from detector." + "\n\nSetting the following defaults:\nTiming Mode \t: None\n" + "Number of Frames \t: 1\nNumber of Triggers \t: 1","Measurement: WARNING"); + setNumFrames(1); + setNumTriggers(1); + comboTimingMode->setCurrentIndex((int)None); + setTimingMode((int)None); } } - - progressBar->setValue(0); - //get timing mode from client - - } - +//------------------------------------------------------------------------------------------------------------------------------------------------- void qTabMeasurement::Initialization(int timingChange){ /** These signals are connected only at start up*/ @@ -149,9 +181,7 @@ void qTabMeasurement::Initialization(int timingChange){ } - - - +//------------------------------------------------------------------------------------------------------------------------------------------------- void qTabMeasurement::DeInitialization(){ /** Number of Frames**/ @@ -173,9 +203,7 @@ void qTabMeasurement::DeInitialization(){ disconnect(spinNumProbes,SIGNAL(valueChanged(int)), this, SLOT(setNumProbes(int))); } - - - +//------------------------------------------------------------------------------------------------------------------------------------------------- void qTabMeasurement::Enable(bool enable){ frameTimeResolved->setEnabled(enable); @@ -184,8 +212,7 @@ void qTabMeasurement::Enable(bool enable){ if(!enable) btnStartStop->setEnabled(true); } - - +//------------------------------------------------------------------------------------------------------------------------------------------------- void qTabMeasurement::setFileName(const QString& fName){ myDet->setFileName(fName.toAscii().data()); @@ -194,8 +221,7 @@ void qTabMeasurement::setFileName(const QString& fName){ #endif } - - +//------------------------------------------------------------------------------------------------------------------------------------------------- void qTabMeasurement::setRunIndex(int index){ myDet->setFileIndex(index); @@ -205,7 +231,7 @@ void qTabMeasurement::setRunIndex(int index){ #endif } - +//------------------------------------------------------------------------------------------------------------------------------------------------- void qTabMeasurement::startStopAcquisition(){ if(!btnStartStop->text().compare("Start")){ @@ -233,8 +259,7 @@ void qTabMeasurement::startStopAcquisition(){ myPlot->StartStopDaqToggle(); } - - +//------------------------------------------------------------------------------------------------------------------------------------------------- void qTabMeasurement::UpdateFinished(){ disconnect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); @@ -247,17 +272,14 @@ void qTabMeasurement::UpdateFinished(){ progressTimer->stop(); } - +//------------------------------------------------------------------------------------------------------------------------------------------------- void qTabMeasurement::UpdateProgress(){ progressBar->setValue(myPlot->GetProgress()); lblProgressIndex->setText(QString::number(myDet->getFileIndex())); } - - - - +//------------------------------------------------------------------------------------------------------------------------------------------------- void qTabMeasurement::setNumFrames(int val){ myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,val); @@ -267,6 +289,7 @@ void qTabMeasurement::setNumFrames(int val){ } +//------------------------------------------------------------------------------------------------------------------------------------------------- void qTabMeasurement::setExposureTime(){ int64_t exptimeNS; @@ -293,7 +316,7 @@ void qTabMeasurement::setExposureTime(){ } } - +//------------------------------------------------------------------------------------------------------------------------------------------------- void qTabMeasurement::setAcquisitionPeriod(){ int64_t acqtimeNS; @@ -318,9 +341,7 @@ void qTabMeasurement::setAcquisitionPeriod(){ } } - - - +//------------------------------------------------------------------------------------------------------------------------------------------------- void qTabMeasurement::setNumTriggers(int val){ myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,val); @@ -329,8 +350,7 @@ void qTabMeasurement::setNumTriggers(int val){ #endif } - - +//------------------------------------------------------------------------------------------------------------------------------------------------- void qTabMeasurement::setDelay(){ int64_t exptimeNS; @@ -342,8 +362,7 @@ void qTabMeasurement::setDelay(){ myDet->setTimer(slsDetectorDefs::DELAY_AFTER_TRIGGER,exptimeNS); } - - +//------------------------------------------------------------------------------------------------------------------------------------------------- void qTabMeasurement::setNumGates(int val){ myDet->setTimer(slsDetectorDefs::GATES_NUMBER,val); @@ -352,8 +371,7 @@ void qTabMeasurement::setNumGates(int val){ #endif } - - +//------------------------------------------------------------------------------------------------------------------------------------------------- void qTabMeasurement::setNumProbes(int val){ myDet->setTimer(slsDetectorDefs::PROBES_NUMBER,val); @@ -362,14 +380,12 @@ void qTabMeasurement::setNumProbes(int val){ #endif } - +//------------------------------------------------------------------------------------------------------------------------------------------------- void qTabMeasurement::setTimingMode(int mode){ #ifdef VERBOSE cout<<"Setting Timing mode to " << comboTimingMode->currentText().toAscii().data()<setEnabled(false); spinNumFrames->setEnabled(false); lblExpTime->setEnabled(false); spinExpTime->setEnabled(false); comboExpUnit->setEnabled(false); @@ -379,15 +395,21 @@ void qTabMeasurement::setTimingMode(int mode){ lblNumGates->setEnabled(false); spinNumGates->setEnabled(false); lblNumProbes->setEnabled(false); spinNumProbes->setEnabled(false); - + bool success = false; switch(mode){ case None:/** Exposure Time */ lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true); + setNumFrames(1); + setNumTriggers(1); + if(myDet->setExternalCommunicationMode(slsDetectorDefs::AUTO_TIMING)==slsDetectorDefs::AUTO_TIMING) + success = true; break; case Auto:/** Number of Frames, Exposure Time, Acquisition Period */ lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true); lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true); + if(myDet->setExternalCommunicationMode(slsDetectorDefs::AUTO_TIMING)==slsDetectorDefs::AUTO_TIMING) + success = true; break; case Trigger_Exp_Series:/** Number of Frames, Exposure Time, Acquisition Period, Number of Triggers, Delay */ lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); @@ -395,20 +417,28 @@ void qTabMeasurement::setTimingMode(int mode){ lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true); lblNumTriggers->setEnabled(true); spinNumTriggers->setEnabled(true); lblDelay->setEnabled(true); spinDelay->setEnabled(true); comboDelayUnit->setEnabled(true); + if(myDet->setExternalCommunicationMode(slsDetectorDefs::TRIGGER_EXPOSURE)==slsDetectorDefs::TRIGGER_EXPOSURE) + success = true; break; case Trigger_Frame:/** Exposure Time, Number of Triggers */ lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true); lblNumTriggers->setEnabled(true); spinNumTriggers->setEnabled(true); + if(myDet->setExternalCommunicationMode(slsDetectorDefs::TRIGGER_FRAME)==slsDetectorDefs::TRIGGER_FRAME) + success = true; break; case Trigger_Readout:/** Number of Frames, Exposure Time, Acquisition Period, Delay */ lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true); lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true); lblDelay->setEnabled(true); spinDelay->setEnabled(true); comboDelayUnit->setEnabled(true); + if(myDet->setExternalCommunicationMode(slsDetectorDefs::TRIGGER_READOUT)==slsDetectorDefs::TRIGGER_READOUT) + success = true; break; case Gated:/** Number of Frames, Number of Gates */ lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); lblNumGates->setEnabled(true); spinNumGates->setEnabled(true); + if(myDet->setExternalCommunicationMode(slsDetectorDefs::GATE_FIX_NUMBER)==slsDetectorDefs::GATE_FIX_NUMBER) + success = true; break; case Gated_Start:/** Number of Frames, Exposure Time, Acquisition Period, Number of Triggers, Number of Gates */ lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); @@ -416,12 +446,21 @@ void qTabMeasurement::setTimingMode(int mode){ lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true); lblNumTriggers->setEnabled(true); spinNumTriggers->setEnabled(true); lblNumGates->setEnabled(true); spinNumGates->setEnabled(true); + if(myDet->setExternalCommunicationMode(slsDetectorDefs::GATE_WITH_START_TRIGGER)==slsDetectorDefs::GATE_WITH_START_TRIGGER) + success = true; break; case Trigger_Window:/** Number of Triggers */ lblNumTriggers->setEnabled(true); spinNumTriggers->setEnabled(true); + if(myDet->setExternalCommunicationMode(slsDetectorDefs::TRIGGER_WINDOW)==slsDetectorDefs::TRIGGER_WINDOW) + success = true; break; default: - cout<<"ERROR: Timing mode being set to other should never happen"< Date: Wed, 20 Jun 2012 15:26:31 +0000 Subject: [PATCH 013/332] made number of measurements static git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@13 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qDrawPlot.h | 2 +- slsDetectorGui/src/qDrawPlot.cpp | 75 ++++++++++++------------------ 2 files changed, 31 insertions(+), 46 deletions(-) diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index 10544e51e..5bdaa7c78 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -108,7 +108,7 @@ private: /** Number of Measurements */ - int numberOfMeasurements; + static int numberOfMeasurements; /** currentFrame */ static int currentFrame; /** Number of Exposures */ diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 355e94855..516029096 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -26,14 +26,13 @@ using namespace std; +//------------------------------------------------------------------------------------------------------------------------------------------------- -//int numberOfMeasurements; +/** Static Members */ +int qDrawPlot::numberOfMeasurements; int qDrawPlot::currentFrame; int qDrawPlot::number_of_exposures; -//double framePeriod; -//double acquisitionTime; pthread_mutex_t qDrawPlot::last_image_complete_mutex; -//std::string imageTitle; unsigned int qDrawPlot::plot_in_scope; unsigned int qDrawPlot::nPixelsX; @@ -57,8 +56,9 @@ int qDrawPlot::currentPersistency; int qDrawPlot::progress; bool qDrawPlot::plotEnable; +//------------------------------------------------------------------------------------------------------------------------------------------------- -qDrawPlot::qDrawPlot(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector),numberOfMeasurements(1){ +qDrawPlot::qDrawPlot(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){ if(myDet) { SetupWidgetWindow(); Initialization(); @@ -66,6 +66,7 @@ qDrawPlot::qDrawPlot(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent } } +//------------------------------------------------------------------------------------------------------------------------------------------------- qDrawPlot::~qDrawPlot(){ /** Clear plot*/ @@ -78,11 +79,13 @@ qDrawPlot::~qDrawPlot(){ for(int i=0;iaddWidget(plot2D,1,1,1,1); } - - +//------------------------------------------------------------------------------------------------------------------------------------------------- void qDrawPlot::Initialization(){ connect(this, SIGNAL(InterpolateSignal(bool)),plot2D, SIGNAL(InterpolateSignal(bool))); @@ -173,8 +175,7 @@ void qDrawPlot::Initialization(){ } - - +//------------------------------------------------------------------------------------------------------------------------------------------------- void qDrawPlot::StartStopDaqToggle(bool stop_if_running){ static bool running = 1; @@ -187,8 +188,7 @@ void qDrawPlot::StartStopDaqToggle(bool stop_if_running){ } } - - +//------------------------------------------------------------------------------------------------------------------------------------------------- void qDrawPlot::StartDaq(bool start){ if(start){ @@ -216,9 +216,7 @@ void qDrawPlot::StartDaq(bool start){ } } - - - +//------------------------------------------------------------------------------------------------------------------------------------------------- int qDrawPlot::ResetDaqForGui(){ if(!StopDaqForGui()) return 0; @@ -226,11 +224,7 @@ int qDrawPlot::ResetDaqForGui(){ return 1; } - - - - - +//------------------------------------------------------------------------------------------------------------------------------------------------- bool qDrawPlot::StartOrStopThread(bool start){ static pthread_t gui_acquisition_thread; @@ -274,15 +268,14 @@ bool qDrawPlot::StartOrStopThread(bool start){ return gui_acquisition_thread_running; } - +//------------------------------------------------------------------------------------------------------------------------------------------------- void* qDrawPlot::DataStartAcquireThread(void *this_pointer){ ((qDrawPlot*)this_pointer)->myDet->acquire(1); return this_pointer; } - - +//------------------------------------------------------------------------------------------------------------------------------------------------- int qDrawPlot::GetDataCallBack(detectorData *data){ #ifdef VERYVERBOSE @@ -350,14 +343,13 @@ int qDrawPlot::GetDataCallBack(detectorData *data){ return 0; } - +//------------------------------------------------------------------------------------------------------------------------------------------------- void qDrawPlot::setNumMeasurements(int num){ numberOfMeasurements = num; } - - +//------------------------------------------------------------------------------------------------------------------------------------------------- void qDrawPlot::SelectPlot(int i){ //1 for 1D otherwise 2D if(i==1){ @@ -378,16 +370,14 @@ void qDrawPlot::SelectPlot(int i){ //1 for 1D otherwise 2D } } - - +//------------------------------------------------------------------------------------------------------------------------------------------------- void qDrawPlot::Clear1DPlot(){ for(QVector::iterator h = plot1D_hists.begin(); h!=plot1D_hists.end();h++) (*h)->Detach(plot1D); //clear plot } - - +//------------------------------------------------------------------------------------------------------------------------------------------------- void qDrawPlot::UpdatePlot(){ static int last_plot_number = 0; @@ -448,16 +438,13 @@ void qDrawPlot::UpdatePlot(){ } } - +//------------------------------------------------------------------------------------------------------------------------------------------------- void qDrawPlot::StopUpdatePlot(){ plot_update_timer->stop(); } - - -/**----------------------------CLONES-------------------------*/ - +//------------------------------------------------------------------------------------------------------------------------------------------------- void qDrawPlot::ClonePlot(){ int i=0; @@ -504,9 +491,10 @@ void qDrawPlot::ClonePlot(){ /** to remember which all clone widgets were closed*/ connect(winClone[i], SIGNAL(CloneClosedSignal(int)),this, SLOT(CloneCloseEvent(int))); - } +//------------------------------------------------------------------------------------------------------------------------------------------------- + void qDrawPlot::CloseClones(){ for(int i=0;iGetPlot()->DisableZoom(disable); } + +//------------------------------------------------------------------------------------------------------------------------------------------------- From 824da9d4c423e7063ab81080b011fc02a548299b Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 26 Jun 2012 15:06:55 +0000 Subject: [PATCH 014/332] snapshot works,id works, conversion from seconds to ms,us etc works, number of measurements works git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@14 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/images/mountain.png | Bin 0 -> 757 bytes slsDetectorGui/include/icons.qrc | 5 + slsDetectorGui/include/qCloneWidget.h | 13 ++- slsDetectorGui/include/qDefs.h | 34 ++++++ slsDetectorGui/include/qDetectorMain.h | 4 + slsDetectorGui/include/qDrawPlot.h | 57 +++++----- slsDetectorGui/include/qTabSettings.h | 10 +- slsDetectorGui/slsDetectorGui.pro | 3 + slsDetectorGui/src/qActionsWidget.cpp | 1 - slsDetectorGui/src/qCloneWidget.cpp | 114 +++++++++++++------- slsDetectorGui/src/qDetectorMain.cpp | 57 +++++----- slsDetectorGui/src/qDrawPlot.cpp | 144 ++++++++++++------------- slsDetectorGui/src/qTabActions.cpp | 9 +- slsDetectorGui/src/qTabAdvanced.cpp | 11 +- slsDetectorGui/src/qTabDataOutput.cpp | 9 +- slsDetectorGui/src/qTabDebugging.cpp | 9 +- slsDetectorGui/src/qTabDeveloper.cpp | 10 +- slsDetectorGui/src/qTabMeasurement.cpp | 39 +++---- slsDetectorGui/src/qTabPlot.cpp | 24 ++--- slsDetectorGui/src/qTabSettings.cpp | 23 ++-- 20 files changed, 320 insertions(+), 256 deletions(-) create mode 100644 slsDetectorGui/images/mountain.png create mode 100644 slsDetectorGui/include/icons.qrc diff --git a/slsDetectorGui/images/mountain.png b/slsDetectorGui/images/mountain.png new file mode 100644 index 0000000000000000000000000000000000000000..3962d0fbccd47b7ac947723ffb06d1b01cc3663a GIT binary patch literal 757 zcmV*ZEUoxo_8cC-wnI#Me z^&``OtQvk~au_V!hfIm2fkJ)A%n;Yn6=z&<+E= z1$XKow~(eSvD^?}KL>wU0hjuKlO{{1=!$M(2`lkg?mX1wMxA3%qiCqms!XoPEo3{y zPUjtwdxTQ^$!r|n*ESeJQ8E(@sqme7$xb`jc!kzAsOr0&Ezsu&OoB(5J!VzSHukFt zYGt9wahPX_>vA1FsnF7}`h16+jHtHIq#93hMU!L+@}8MHcWRU<>Wj4KQd^yX2<6H| zb&ex+#CveGOmYIU_>vzDdNRt&M2oDQZ{&qTwry{x-3krqyvXdG5(~Ez)Nnt@w9qln zbQ$KVk#4N(y1!bYbslXc2B0|RNh5Rrq@&^ zTGH7ynch+<6{;fBdn#M$mP~J{Oi0oRm-)n0a)owDrq@(Tfy#VhDifSQs3-GDsjT${ zCiBUuJvof+fqphRZHd*Q(5D-%(ta7kqe7TGT)NQb3bp%d}}Hx;K_VT nDsxnSxHaK3f6)PC$^`Nc%GUml6sPYI00000NkvXXu0mjf{EuiD literal 0 HcmV?d00001 diff --git a/slsDetectorGui/include/icons.qrc b/slsDetectorGui/include/icons.qrc new file mode 100644 index 000000000..7ae9757eb --- /dev/null +++ b/slsDetectorGui/include/icons.qrc @@ -0,0 +1,5 @@ + + + ../images/mountain.png + + diff --git a/slsDetectorGui/include/qCloneWidget.h b/slsDetectorGui/include/qCloneWidget.h index 4cf22c26f..0fe0def05 100644 --- a/slsDetectorGui/include/qCloneWidget.h +++ b/slsDetectorGui/include/qCloneWidget.h @@ -13,7 +13,10 @@ class SlsQtH1D; class SlsQt1DPlot; class SlsQt2DPlotLayout; /** Qt Include Headers */ -#include +#include +#include +#include +#include #include #include #include @@ -31,7 +34,7 @@ using namespace std; /** *@short Sets up the clone plot widget */ -class qCloneWidget:public QFrame{ +class qCloneWidget:public QMainWindow{ Q_OBJECT public: @@ -77,6 +80,10 @@ private: QVector cloneplot1D_hists; + QMenuBar *menubar; + // QMenu *menuFile; + QAction *actionSave; + QGridLayout *mainLayout; QGroupBox *cloneBox; QGridLayout *gridClone; @@ -90,6 +97,8 @@ private: QCheckBox *chkAutoFName; QCheckBox *chkSaveAll; + /** Gets the current time stamp for the window title*/ + char* GetCurrentTimeStamp(); private slots: diff --git a/slsDetectorGui/include/qDefs.h b/slsDetectorGui/include/qDefs.h index 955cb344d..f75af62a2 100644 --- a/slsDetectorGui/include/qDefs.h +++ b/slsDetectorGui/include/qDefs.h @@ -54,6 +54,40 @@ public: return valueNS; }; +//------------------------------------------------------------------------------------------------------------------------------------------------- + + /** returns the time in the appropriate time unit + * @param unit unit of time + * @param value time in seconds + * returns the corresponding time value + */ + static float getCorrectTime(timeUnit& unit, float value){ + int intUnit = (int)SECONDS; + + /** hr, min, sec */ + if(value>=1){ + float newVal = value; + while((newVal>=1)&&(intUnit>=(int)HOURS)){ + /** value retains the old value */ + value = newVal; + newVal = value/60; + intUnit--; + } + /** returning the previous value*/ + unit = (timeUnit)(intUnit+1); + return value; + } + /** ms, us, ns */ + else{ + while((value<1)&&(intUnit<(int)NANOSECONDS)){ + value = value*1000; + intUnit++; + } + unit = (timeUnit)(intUnit); + return value; + } + }; + //------------------------------------------------------------------------------------------------------------------------------------------------- /**displays an error message diff --git a/slsDetectorGui/include/qDetectorMain.h b/slsDetectorGui/include/qDetectorMain.h index a09558036..c7ac27275 100644 --- a/slsDetectorGui/include/qDetectorMain.h +++ b/slsDetectorGui/include/qDetectorMain.h @@ -62,6 +62,8 @@ private: QApplication *theApp; /** The sls detector object */ slsDetectorUtils *myDet; + /** sls detector id */ + int detID; /** The Plot widget */ qDrawPlot *myPlot; /**Tab Widget */ @@ -74,6 +76,7 @@ private: int heightCentralWidget; /** The default zooming tool tip */ QString zoomToolTip; + /** The default tab heading color */ QColor defaultTabColor; /** enumeration of the tabs */ @@ -97,6 +100,7 @@ private: /**Developer tab */ qTabDeveloper *tab_developer; /**if the developer tab should be enabled,known from command line */ + int isDeveloper; /**Sets up the layout of the widget */ diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index 5bdaa7c78..57bfe31b6 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -108,22 +108,24 @@ private: /** Number of Measurements */ - static int numberOfMeasurements; + int number_of_measurements; + /** Current Measurement */ + int currentMeasurement; /** currentFrame */ - static int currentFrame; + int currentFrame; /** Number of Exposures */ - static int number_of_exposures; + int number_of_exposures; /** Duration between Exposures */ - double framePeriod; + double acquisitionPeriod; /** Acquisition Time */ - double acquisitionTime; + double exposureTime; /**variables for threads */ /** */ volatile bool stop_signal; /** */ - static pthread_mutex_t last_image_complete_mutex; + pthread_mutex_t last_image_complete_mutex; /**variables for histograms */ /** X Axis Title in 2D */ @@ -137,37 +139,38 @@ private: /** Y Axis Title in 1D */ QString histYAxisTitle; /** Title for all the graphs in 1D */ - static std::string histTitle[MAX_1DPLOTS]; + std::string histTitle[MAX_1DPLOTS]; /** Title in 2D */ - static std::string imageTitle; + std::string imageTitle; /** 1D or 2D */ - static unsigned int plot_in_scope; + unsigned int plot_in_scope; /** Number of Pixels in X Axis */ - static unsigned int nPixelsX; + unsigned int nPixelsX; /** Number of Pixels in Y Axis */ - static unsigned int nPixelsY; + unsigned int nPixelsY; /** Current Image Number */ - static unsigned int lastImageNumber; + unsigned int lastImageNumber; + int last_plot_number; /** Number of graphs in 1D */ - static unsigned int nHists; + unsigned int nHists; /** Total Number of X axis values/channels in 1D */ - static int histNBins; + int histNBins; /** X Axis value in 1D */ - static double* histXAxis; + double* histXAxis; /** Y Axis value in 1D */ - static double* histYAxis[MAX_1DPLOTS]; + double* histYAxis[MAX_1DPLOTS]; /** Current Image Values in 2D */ - static double* lastImageArray; + double* lastImageArray; /** temporary Y Axis value in 1D */ - static double* yvalues[MAX_1DPLOTS]; + double* yvalues[MAX_1DPLOTS]; /** temporary Image Values in 2D */ - static double* image_data; - static bool gui_acquisition_thread_running; - static int persistency; - static int currentPersistency; - static int progress; - static bool plotEnable; + double* image_data; + //bool gui_acquisition_thread_running; + int persistency; + int currentPersistency; + int progress; + bool plotEnable; /** Initializes all its members and the thread */ void Initialization(); @@ -197,8 +200,10 @@ private: int ResetDaqForGui(); /** The function which is called when start acquisition thread is created */ static void* DataStartAcquireThread(void *this_pointer); - /** This is called by the detector class to copt the data it jus acquired */ - static int GetDataCallBack(detectorData *data); + /** This is called by the detector class to copy the data it jus acquired */ + static int GetDataCallBack(detectorData *data, void *this_pointer); + /** This is called by the GetDataCallBack function to copy the data */ + int GetData(detectorData *data); public slots: diff --git a/slsDetectorGui/include/qTabSettings.h b/slsDetectorGui/include/qTabSettings.h index c83c77b1b..23c5ecd6b 100644 --- a/slsDetectorGui/include/qTabSettings.h +++ b/slsDetectorGui/include/qTabSettings.h @@ -23,8 +23,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 */ - qTabSettings(QWidget *parent,slsDetectorUtils*& detector); + qTabSettings(QWidget *parent,slsDetectorUtils*& detector,int detID); /** Destructor */ @@ -35,6 +36,10 @@ private: /** The sls detector object */ slsDetectorUtils *myDet; + /** sls detector id */ + int detID; + + /** Sets up the widget */ void SetupWidgetWindow(); @@ -43,9 +48,6 @@ private: */ void Initialization(); - /** Enables/Disables all the widgets - */ - void Enable(bool enable); private slots: diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index 9ec0c8f12..6046b23e6 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -3,6 +3,9 @@ MOC_DIR = mocs OBJECTS_DIR = objs UI_HEADERS_DIR = forms/include +RESOURCES += icons.qrc + + DEFINES += VERBOSE diff --git a/slsDetectorGui/src/qActionsWidget.cpp b/slsDetectorGui/src/qActionsWidget.cpp index 7b3e0514a..1004150c8 100644 --- a/slsDetectorGui/src/qActionsWidget.cpp +++ b/slsDetectorGui/src/qActionsWidget.cpp @@ -24,7 +24,6 @@ using namespace std; -#define Detector_Index 0 ActionsWidget::ActionsWidget(QWidget *parent, int scanType): QFrame(parent){ diff --git a/slsDetectorGui/src/qCloneWidget.cpp b/slsDetectorGui/src/qCloneWidget.cpp index 941aa9b39..ae8d385a8 100644 --- a/slsDetectorGui/src/qCloneWidget.cpp +++ b/slsDetectorGui/src/qCloneWidget.cpp @@ -7,30 +7,33 @@ /** Qt Project Class Headers */ #include "qCloneWidget.h" +#include "qDefs.h" #include "SlsQt1DPlot.h" #include "SlsQt2DPlotLayout.h" /** Qt Include Headers */ #include #include +#include /** C++ Include Headers */ #include using namespace std; +//------------------------------------------------------------------------------------------------------------------------------------------------- - - -qCloneWidget::qCloneWidget(QWidget *parent,int id,QString title,int numDim,SlsQt1DPlot*& plot1D,SlsQt2DPlotLayout*& plot2D,string FilePath):QFrame(parent,Qt::Popup|Qt::SubWindow),id(id),filePath(FilePath){ +qCloneWidget::qCloneWidget(QWidget *parent,int id,QString title,int numDim,SlsQt1DPlot*& plot1D,SlsQt2DPlotLayout*& plot2D,string FilePath): + QMainWindow(parent),id(id),filePath(FilePath){ /** Window title*/ - char winTitle[100]; - sprintf(winTitle,"SLS Detector GUI Clone %d",id); + char winTitle[300],currTime[50]; + strcpy(currTime,GetCurrentTimeStamp()); + sprintf(winTitle,"Snapshot:%d - %s",id,currTime); setWindowTitle(QString(winTitle)); /** Set up widget*/ SetupWidgetWindow(title,numDim,plot1D,plot2D); - } +//------------------------------------------------------------------------------------------------------------------------------------------------- qCloneWidget::~qCloneWidget(){ delete cloneplot1D; @@ -39,13 +42,22 @@ qCloneWidget::~qCloneWidget(){ delete boxSave; } - +//------------------------------------------------------------------------------------------------------------------------------------------------- void qCloneWidget::SetupWidgetWindow(QString title,int numDim,SlsQt1DPlot*& plot1D,SlsQt2DPlotLayout*& plot2D){ + menubar = new QMenuBar(this); + //menuFile = new QMenu("&File",menubar); + actionSave = new QAction("&Save",this); + // menubar->addAction(menuFile->menuAction()); + menubar->addAction(actionSave); + setMenuBar(menubar); + + /** Main Window Layout */ - mainLayout = new QGridLayout(this); - setLayout(mainLayout); + QWidget *centralWidget = new QWidget(this); + mainLayout = new QGridLayout(centralWidget); + centralWidget->setLayout(mainLayout); /** plot group box*/ cloneBox = new QGroupBox(this); @@ -71,23 +83,24 @@ void qCloneWidget::SetupWidgetWindow(QString title,int numDim,SlsQt1DPlot*& plot } /** Save group box */ +/* boxSave = new QGroupBox("Save Image",this); boxSave->setFixedHeight(45); boxSave->setContentsMargins(0,8,0,0); layoutSave = new QHBoxLayout; boxSave->setLayout(layoutSave); - /** Label file name*/ + * Label file name lblFName = new QLabel("File Name:",this); layoutSave->addWidget(lblFName); - /** To get 0 spacing between the next 2 widgets file name and file format */ + * To get 0 spacing between the next 2 widgets file name and file format hLayoutSave = new QHBoxLayout(); layoutSave->addLayout(hLayoutSave); hLayoutSave->setSpacing(0); - /** file name */ + * file name dispFName = new QLineEdit(this); dispFName->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); hLayoutSave->addWidget(dispFName); - /** file format */ + * file format comboFormat = new QComboBox(this); comboFormat->setFrame(true); comboFormat->addItem(".gif"); @@ -100,67 +113,88 @@ void qCloneWidget::SetupWidgetWindow(QString title,int numDim,SlsQt1DPlot*& plot comboFormat->addItem(".xpm"); comboFormat->addItem(".C"); hLayoutSave->addWidget(comboFormat); - /** save button */ + * save button btnSave = new QPushButton("Save",this); btnSave->setFocusPolicy(Qt::NoFocus); layoutSave->addWidget(btnSave); - /** automatic file name check box */ + * automatic file name check box chkAutoFName = new QCheckBox("Automatic File Name",this); layoutSave->addWidget(chkAutoFName); - /** automatic save all check box */ + * automatic save all check box chkSaveAll = new QCheckBox("Save All",this); layoutSave->addWidget(chkSaveAll); +*/ /** main window widgets */ - mainLayout->addWidget(boxSave,0,0); + //mainLayout->addWidget(boxSave,0,0); mainLayout->addWidget(cloneBox,1,0); + setCentralWidget(centralWidget); /** Save */ - connect(btnSave, SIGNAL(clicked()), this, SLOT(SavePlot())); + connect(actionSave,SIGNAL(triggered()),this,SLOT(SavePlot())); + //connect(btnSave, SIGNAL(clicked()), this, SLOT(SavePlot())); setMinimumHeight(300); resize(500,350); - } - - +//------------------------------------------------------------------------------------------------------------------------------------------------- void qCloneWidget::SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis[],string histTitle[]){ -/** for each plot*/ -for(int hist_num=0;hist_numcloneplot1D_hists.size()){ - cloneplot1D_hists.append(k=new SlsQtH1D("1d plot",histNBins,histXAxis,histYAxis[hist_num])); - k->SetLineColor(hist_num+1); - }else{ - k=cloneplot1D_hists.at(hist_num); - k->SetData(histNBins,histXAxis,histYAxis[hist_num]); + /** for each plot*/ + for(int hist_num=0;hist_numcloneplot1D_hists.size()){ + cloneplot1D_hists.append(k=new SlsQtH1D("1d plot",histNBins,histXAxis,histYAxis[hist_num])); + k->SetLineColor(hist_num+1); + }else{ + k=cloneplot1D_hists.at(hist_num); + k->SetData(histNBins,histXAxis,histYAxis[hist_num]); + } + k->setTitle(histTitle[hist_num].c_str()); + k->Attach(cloneplot1D); } - k->setTitle(histTitle[hist_num].c_str()); - k->Attach(cloneplot1D); + //cloneplot1D->UnZoom(); } -//cloneplot1D->UnZoom(); +//------------------------------------------------------------------------------------------------------------------------------------------------- +char* qCloneWidget::GetCurrentTimeStamp(){ + char output[30]; + char *result; + //using sys cmds to get output or str + FILE* sysFile = popen("date", "r"); + fgets(output, sizeof(output), sysFile); + pclose(sysFile); + + result = output + 0; + return result; } - - +//------------------------------------------------------------------------------------------------------------------------------------------------- void qCloneWidget::SavePlot(){ - QString fName = QString(filePath.c_str())+'/'+dispFName->text()+comboFormat->currentText(); + //QString fName = QString(filePath.c_str())+'/'+dispFName->text()+comboFormat->currentText(); + char cID[10]; + sprintf(cID,"%d",id); + QString fName = QString(filePath.c_str())+"/Snapshot_"+QString(cID)+".png"; QImage img(cloneBox->size().width(),cloneBox->size().height(),QImage::Format_RGB32); QPainter painter(&img); cloneBox->render(&painter); - img.save(fName); + + fName = QFileDialog::getSaveFileName(this,tr("Save Snapshot "), + fName,tr("Images (*.png *.xpm *.jpg)")); + if (!fName.isEmpty()) + if(!(img.save(fName))) + qDefs::ErrorMessage("ERROR: Attempt to save snapshot failed","Snapshot: WARNING"); } - - +//------------------------------------------------------------------------------------------------------------------------------------------------- void qCloneWidget::closeEvent(QCloseEvent* event){ emit CloneClosedSignal(id); event->accept(); } + +//------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 59947cf64..718281802 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -21,13 +21,13 @@ #include using namespace std; -#define Detector_Index 0 //------------------------------------------------------------------------------------------------------------------------------------------------- int main (int argc, char **argv) { QApplication *theApp = new QApplication(argc, argv); + theApp->setWindowIcon(QIcon( ":/icons/images/mountain.png" )); qDetectorMain *det=new qDetectorMain(argc, argv, theApp,0); det->show(); //theApp->connect( theApp, SIGNAL(lastWindowClosed()), theApp, SLOT(quit())); @@ -37,24 +37,27 @@ int main (int argc, char **argv) { //------------------------------------------------------------------------------------------------------------------------------------------------- qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app, QWidget *parent) : - QMainWindow(parent), theApp(app),myPlot(NULL),tabs(NULL),isDeveloper(0){ - myDet = 0; - setupUi(this); - SetUpWidgetWindow(); - Initialization(); - /**need to use argc and argv to determine which slsdet or multidet to use.*/ + QMainWindow(parent), theApp(app),myDet(0),detID(0),myPlot(NULL),tabs(NULL),isDeveloper(0){ + /** Getting all the command line arguments */ for(int iarg=1; iargsetLayout(layoutTabs); @@ -89,7 +89,7 @@ void qDetectorMain::SetUpWidgetWindow(){ tab_dataoutput = new qTabDataOutput (this, myDet); tab_plot = new qTabPlot (this, myDet,myPlot); tab_actions = new qTabActions (this, myDet); - tab_settings = new qTabSettings (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); @@ -124,6 +124,7 @@ void qDetectorMain::SetUpWidgetWindow(){ SetBeamlineMode(false); SetExpertMode(false); SetDeveloperMode(false); + SetDeveloperMode(isDeveloper); tabs->tabBar()->setTabTextColor(0,QColor(0,0,200,255)); @@ -136,13 +137,17 @@ void qDetectorMain::SetUpDetector(){ /**instantiate detector and set window title*/ - myDet = new multiSlsDetector(Detector_Index); - if(!myDet->getHostname(Detector_Index).length()){ - setWindowTitle("SLS Detector GUI : No Detector Connected"); + myDet = new multiSlsDetector(detID); + if(!myDet->getHostname(detID).length()){ #ifdef VERBOSE - cout<getHostname(detID)<slsDetectorBase::getDetectorType(myDet->getDetectorsType()); - string hostname = myDet->getHostname(Detector_Index); - string errorMess = string("ERROR: ")+hostname+string(" has unknown detector type \"")+detName+string("\". Exiting GUI."); + string hostname = myDet->getHostname(detID); + string errorMess = string("ERROR: ")+hostname+string(" has " + "unknown detector type \"")+detName+string("\". Exiting GUI."); qDefs::ErrorMessage(errorMess,"Main: ERROR"); exit(-1); } - setWindowTitle("SLS Detector GUI : "+QString(slsDetectorBase::getDetectorType(myDet->getDetectorsType()).c_str())+" - "+QString(myDet->getHostname(Detector_Index).c_str())); + setWindowTitle("SLS Detector GUI : "+ + QString(slsDetectorBase::getDetectorType(myDet->getDetectorsType()).c_str())+ + " - "+QString(myDet->getHostname(detID).c_str())); #ifdef VERBOSE - cout<getDetectorsType())<<"\t\t\tDetector : "<getHostname(Detector_Index)<getDetectorsType())<<"\t\t\tDetector : " + ""<getHostname(detID)<setOnline(slsDetectorDefs::ONLINE_FLAG); } diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 516029096..537c8b986 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -22,48 +22,13 @@ using namespace std; -#define Detector_Index 0 - - - -//------------------------------------------------------------------------------------------------------------------------------------------------- - -/** Static Members */ -int qDrawPlot::numberOfMeasurements; -int qDrawPlot::currentFrame; -int qDrawPlot::number_of_exposures; -pthread_mutex_t qDrawPlot::last_image_complete_mutex; - -unsigned int qDrawPlot::plot_in_scope; -unsigned int qDrawPlot::nPixelsX; -unsigned int qDrawPlot::nPixelsY; -unsigned int qDrawPlot::lastImageNumber; - -string qDrawPlot::histTitle[MAX_1DPLOTS]; -unsigned int qDrawPlot::nHists; -int qDrawPlot::histNBins; -double* qDrawPlot::histXAxis; -double* qDrawPlot::yvalues[MAX_1DPLOTS]; -double* qDrawPlot::histYAxis[MAX_1DPLOTS]; - -string qDrawPlot::imageTitle; -double* qDrawPlot::lastImageArray; -double* qDrawPlot::image_data; - -bool qDrawPlot::gui_acquisition_thread_running; -int qDrawPlot::persistency; -int qDrawPlot::currentPersistency; -int qDrawPlot::progress; -bool qDrawPlot::plotEnable; //------------------------------------------------------------------------------------------------------------------------------------------------- qDrawPlot::qDrawPlot(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){ - if(myDet) { - SetupWidgetWindow(); - Initialization(); - StartStopDaqToggle(); //as default - } + SetupWidgetWindow(); + Initialization(); + StartStopDaqToggle(); //as default } //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -85,15 +50,16 @@ void qDrawPlot::SetupWidgetWindow(){ #ifdef VERBOSE cout<<"Setting up plot variables"<setTimer(slsDetectorDefs::FRAME_NUMBER,-1); + cout<<"\tNumber of Exposures:"<setTimer(slsDetectorDefs::ACQUISITION_TIME,-1))*1E-9); + cout<<"\tExposure Time:"<setTimer(slsDetectorDefs::FRAME_PERIOD,-1))*1E-9); + cout<<"\tAcquisition Period:"<setTimer(slsDetectorDefs::FRAME_NUMBER,-1); - cout<<"\tNumber of Exposures:"<setTimer(slsDetectorDefs::ACQUISITION_TIME,-1))*1E-9); - cout<<"\tAcquisition Time:"<setTimer(slsDetectorDefs::FRAME_PERIOD,-1))*1E-9); - cout<<"\tFrame Period:"<stopAcquisition(); + stop_signal = 1;//sort of useless pthread_join(gui_acquisition_thread,NULL); //wait until he's finished, ie. exits gui_acquisition_thread_running = 0; } @@ -243,6 +215,7 @@ bool qDrawPlot::StartOrStopThread(bool start){ //start part if(start){ /** Defaults */ + progress = 0; currentFrame = 0; stop_signal = 0; histNBins = nPixelsX; @@ -255,14 +228,16 @@ bool qDrawPlot::StartOrStopThread(bool start){ if(plot_in_scope==1) Clear1DPlot(); - cout<<"Starting new acquisition thread ...."<registerDataCallback(&(GetDataCallBack)); + myDet->registerDataCallback(&(GetDataCallBack),this); /** Start acquiring data from server */ pthread_create(&gui_acquisition_thread, NULL,DataStartAcquireThread, (void*) this); - /** This is later reset to zero when all the plotting is done */ + /** This is set here and later reset to zero when all the plotting is done + * This is manually done instead of keeping track of thread because + * this thread returns immediately after executing the acquire command*/ gui_acquisition_thread_running=1; - cout<<"Started acquiring"<myDet->acquire(1); + cout<<"after acquire ...."<GetData(data); + return 0; +} + +//------------------------------------------------------------------------------------------------------------------------------------------------- + +int qDrawPlot::GetData(detectorData *data){ +//#ifdef VERYVERBOSE + cout<<"Entering GetDatafunction"<progressIndex; if(!plotEnable) { @@ -338,7 +323,7 @@ int qDrawPlot::GetDataCallBack(detectorData *data){ currentFrame++; } #ifdef VERYVERBOSE - cout<<"Exiting GetDataCallBack function"<stop(); if(plotEnable){ @@ -425,17 +410,28 @@ void qDrawPlot::UpdatePlot(){ } } last_plot_number=lastImageNumber; - if(plotEnable) UnlockLastImageArray(); - /* if(plot_in_scope==1) SelectPlot(1); - else if(plot_in_scope==2) SelectPlot(2);*/ - if(number_of_exposures==last_plot_number){ - gui_acquisition_thread_running=0; - StartStopDaqToggle(1); - emit UpdatingPlotFinished(); - }else{ + if(plotEnable) UnlockLastImageArray(); + + /** Measurement not over, continue*/ + if(number_of_exposures!=last_plot_number){ plot_update_timer->start(500); } + /** if a measurement is over */ + else{ + currentMeasurement++; + cout<<"currentMeausremet:"<getDetectorsType(); - SetupWidgetWindow(); - Initialization(); - } + myDetType = (int)myDet->getDetectorsType(); + SetupWidgetWindow(); + Initialization(); } diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index 778f3f908..b51904a23 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -17,18 +17,13 @@ using namespace std; -#define Detector_Index 0 - qTabDataOutput::qTabDataOutput(QWidget *parent,slsDetectorUtils*& detector): QWidget(parent),myDet(detector){ setupUi(this); - if(myDet) - { - SetupWidgetWindow(); - Initialization(); - } + SetupWidgetWindow(); + Initialization(); } diff --git a/slsDetectorGui/src/qTabDebugging.cpp b/slsDetectorGui/src/qTabDebugging.cpp index 4fcf040bb..8c797b30b 100644 --- a/slsDetectorGui/src/qTabDebugging.cpp +++ b/slsDetectorGui/src/qTabDebugging.cpp @@ -14,17 +14,12 @@ using namespace std; -#define Detector_Index 0 - qTabDebugging::qTabDebugging(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){ setupUi(this); - if(myDet) - { - SetupWidgetWindow(); - Initialization(); - } + SetupWidgetWindow(); + Initialization(); } diff --git a/slsDetectorGui/src/qTabDeveloper.cpp b/slsDetectorGui/src/qTabDeveloper.cpp index 777a76c7f..b987fff82 100644 --- a/slsDetectorGui/src/qTabDeveloper.cpp +++ b/slsDetectorGui/src/qTabDeveloper.cpp @@ -14,17 +14,13 @@ using namespace std; -#define Detector_Index 0 - qTabDeveloper::qTabDeveloper(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){ setupUi(this); - if(myDet) - { - SetupWidgetWindow(); - Initialization(); - } + SetupWidgetWindow(); + Initialization(); + } diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 91266a84d..23e597325 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -20,19 +20,17 @@ using namespace std; -#define Detector_Index 0 -#define UndefinedSettings 7 + + //------------------------------------------------------------------------------------------------------------------------------------------------- qTabMeasurement::qTabMeasurement(QWidget *parent,slsDetectorUtils*& detector, qDrawPlot*& plot): QWidget(parent),myDet(detector),myPlot(plot){ setupUi(this); - if(myDet) - { - SetupWidgetWindow(); - Initialization(); - } + SetupWidgetWindow(); + Initialization(); + } //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -49,9 +47,10 @@ void qTabMeasurement::SetupWidgetWindow(){ progressTimer = new QTimer(this); //btnStartStop->setStyleSheet("color:green"); /** Exp Time **/ - float time = (float)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-9)); + qDefs::timeUnit unit; + float time = qDefs::getCorrectTime(unit,((float)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-9)))); spinExpTime->setValue(time); - comboExpUnit->setCurrentIndex(qDefs::SECONDS); + comboExpUnit->setCurrentIndex((int)unit); /** Hide the error message **/ lblNote->hide(); /** File Name **/ @@ -85,7 +84,7 @@ void qTabMeasurement::SetupWidgetWindow(){ item[(int)Gated_Start]->setEnabled(true); item[(int)Trigger_Window]->setEnabled(false); break; - case slsDetectorDefs::GOTTHARD: + case slsDetectorDefs::EIGER: item[(int)Trigger_Exp_Series]->setEnabled(true); item[(int)Trigger_Frame]->setEnabled(true); item[(int)Trigger_Readout]->setEnabled(false); @@ -93,7 +92,7 @@ void qTabMeasurement::SetupWidgetWindow(){ item[(int)Gated_Start]->setEnabled(false); item[(int)Trigger_Window]->setEnabled(true); break; - case slsDetectorDefs::EIGER: + case slsDetectorDefs::GOTTHARD: item[(int)Trigger_Exp_Series]->setEnabled(true); item[(int)Trigger_Frame]->setEnabled(false); item[(int)Trigger_Readout]->setEnabled(false); @@ -146,7 +145,7 @@ void qTabMeasurement::SetupWidgetWindow(){ //------------------------------------------------------------------------------------------------------------------------------------------------- void qTabMeasurement::Initialization(int timingChange){ - /** These signals are connected only at start up*/ + /** These signals are connected only at start up. The others are reinitialized when changing timing mode*/ if(!timingChange){ /** Number of Measurements**/ connect(spinNumMeasurements,SIGNAL(valueChanged(int)), myPlot, SLOT(setNumMeasurements(int))); @@ -242,13 +241,14 @@ void qTabMeasurement::startStopAcquisition(){ btnStartStop->setText("Stop"); Enable(0); progressBar->setValue(0); - progressTimer->start(200); + progressTimer->start(100); emit StartSignal(); }else{ #ifdef VERBOSE cout<<"Stopping Acquisition"<stopAcquisition(); //btnStartStop->setStyleSheet("color:green"); //btnStartStop->setStyleSheet("background:rgb(239,239,239)"); progressTimer->stop(); @@ -476,6 +476,7 @@ void qTabMeasurement::setTimingMode(int mode){ float time; int val; + qDefs::timeUnit unit; /**Number of Frames */ if(lblNumFrames->isEnabled()){ val = (int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1); @@ -487,22 +488,22 @@ void qTabMeasurement::setTimingMode(int mode){ /**Exposure Time */ if(lblExpTime->isEnabled()){ - time = (float)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-9)); + time = qDefs::getCorrectTime(unit,((float)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-9)))); #ifdef VERBOSE cout<<"Getting acquisition time : " << time << "s" << endl; #endif spinExpTime->setValue(time); - comboExpUnit->setCurrentIndex(qDefs::SECONDS); + comboExpUnit->setCurrentIndex((int)unit); } /**Frame Period between exposures */ if(lblPeriod->isEnabled()){ - time = (float)(myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,-1)*(1E-9)); + time = qDefs::getCorrectTime(unit,((float)(myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,-1)*(1E-9)))); #ifdef VERBOSE cout<<"Getting frame period between exposures : " << time << "s" << endl; #endif spinPeriod->setValue(time); - comboPeriodUnit->setCurrentIndex(qDefs::SECONDS); + comboPeriodUnit->setCurrentIndex((int)unit); int64_t exptimeNS,acqtimeNS; exptimeNS = (int64_t)qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value()); @@ -534,12 +535,12 @@ void qTabMeasurement::setTimingMode(int mode){ /**Delay After Trigger */ if(lblDelay->isEnabled()){ - time = (float)(myDet->setTimer(slsDetectorDefs::DELAY_AFTER_TRIGGER,-1)*(1E-9)); + time = qDefs::getCorrectTime(unit,((float)(myDet->setTimer(slsDetectorDefs::DELAY_AFTER_TRIGGER,-1)*(1E-9)))); #ifdef VERBOSE cout<<"Getting delay after trigger : " << time << "s" << endl; #endif spinDelay->setValue(time); - comboDelayUnit->setCurrentIndex(qDefs::SECONDS); + comboDelayUnit->setCurrentIndex((int)unit); } /**Number of Gates */ diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index 9ab78a281..2f3be9d58 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -17,8 +17,6 @@ using namespace std; -#define Detector_Index 0 - QString qTabPlot::defaultPlotTitle("Measurement"); QString qTabPlot::defaultHistXAxisTitle("Channel Number"); @@ -30,19 +28,17 @@ QString qTabPlot::defaultImageZAxisTitle("Intensity"); qTabPlot::qTabPlot(QWidget *parent,slsDetectorUtils*& detector, qDrawPlot*& plot):QWidget(parent),myDet(detector),myPlot(plot){ setupUi(this); - if(myDet){ - 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"<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"<setCurrentIndex(myDet->getSettings(Detector_Index)); + comboSettings->setCurrentIndex(myDet->getSettings(detID)); } @@ -52,13 +48,8 @@ void qTabSettings::Initialization(){ -void qTabSettings::Enable(bool enable){ - comboSettings->setEnabled(enable); -} - - void qTabSettings::setSettings(int index){ - slsDetectorDefs::detectorSettings sett = myDet->setSettings((slsDetectorDefs::detectorSettings)index,Detector_Index); + slsDetectorDefs::detectorSettings sett = myDet->setSettings((slsDetectorDefs::detectorSettings)index,detID); #ifdef VERBOSE cout<<"Settings have been set to "<slsDetectorBase::getDetectorSettings(sett)< Date: Thu, 28 Jun 2012 08:35:21 +0000 Subject: [PATCH 015/332] created messages tab-not working completely yet git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@15 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_messages.ui | 82 ++++++++++++ slsDetectorGui/forms/form_tab_plot.ui | 156 +++++++++++++++------- slsDetectorGui/forms/form_tab_settings.ui | 6 +- slsDetectorGui/include/qDetectorMain.h | 21 +-- slsDetectorGui/include/qTabMeasurement.h | 4 + slsDetectorGui/include/qTabMessages.h | 68 ++++++++++ slsDetectorGui/include/qTabSettings.h | 18 ++- slsDetectorGui/slsDetectorGui.pro | 5 +- slsDetectorGui/src/qDetectorMain.cpp | 5 + slsDetectorGui/src/qTabMeasurement.cpp | 30 +++-- slsDetectorGui/src/qTabMessages.cpp | 129 ++++++++++++++++++ slsDetectorGui/src/qTabSettings.cpp | 104 ++++++++++++++- 12 files changed, 549 insertions(+), 79 deletions(-) create mode 100644 slsDetectorGui/forms/form_tab_messages.ui create mode 100644 slsDetectorGui/include/qTabMessages.h create mode 100644 slsDetectorGui/src/qTabMessages.cpp diff --git a/slsDetectorGui/forms/form_tab_messages.ui b/slsDetectorGui/forms/form_tab_messages.ui new file mode 100644 index 000000000..1f75475e5 --- /dev/null +++ b/slsDetectorGui/forms/form_tab_messages.ui @@ -0,0 +1,82 @@ + + + TabMessagesObject + + + + 0 + 0 + 775 + 345 + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Form + + + + + + + + TextLabel + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + + + + TextLabel + + + + + + + + + + + + + + + + diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index f8b21cde4..9fc9064d3 100644 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -35,7 +35,7 @@ 10 - 135 + 200 751 141 @@ -73,7 +73,26 @@ - + + + + 0 + 0 + + + + + 250 + 0 + + + + QLineEdit::Normal + + + false + + @@ -392,10 +411,10 @@ - 150 + 315 70 - 466 - 46 + 446 + 51 @@ -466,7 +485,7 @@ - 210 + 180 20 @@ -478,10 +497,10 @@ - 150 + 315 10 - 466 - 46 + 446 + 51 @@ -499,7 +518,7 @@ 10 20 254 - 23 + 21 @@ -575,8 +594,8 @@ - 420 - 12 + 395 + 15 40 28 @@ -608,7 +627,7 @@ 10 - 290 + 135 751 51 @@ -634,6 +653,12 @@ + + + 0 + 0 + + File Name: @@ -645,7 +670,20 @@ 0 - + + + + 0 + 0 + + + + + 250 + 0 + + + @@ -687,6 +725,22 @@ + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + @@ -710,10 +764,10 @@ - 655 - 10 - 106 - 106 + 10 + 70 + 261 + 51 @@ -725,28 +779,16 @@ false - + 5 - 19 - 96 - 81 + 21 + 251 + 21 - - - 28 - - - 8 - - - 0 - - - 0 - + @@ -762,11 +804,11 @@ Create - false + true - + @@ -780,6 +822,28 @@ Close All + + true + + + + + + + + 0 + 0 + + + + Qt::NoFocus + + + Save All + + + true + @@ -793,8 +857,8 @@ 10 10 - 106 - 106 + 261 + 51 @@ -806,16 +870,16 @@ false - + 10 - 14 - 93 - 96 + 20 + 246 + 21 - + @@ -823,14 +887,14 @@ - + Data Graph - + Histogram diff --git a/slsDetectorGui/forms/form_tab_settings.ui b/slsDetectorGui/forms/form_tab_settings.ui index d1b7ad2d5..89d6214fe 100644 --- a/slsDetectorGui/forms/form_tab_settings.ui +++ b/slsDetectorGui/forms/form_tab_settings.ui @@ -115,7 +115,7 @@ - + -1 @@ -139,10 +139,10 @@ - + - + diff --git a/slsDetectorGui/include/qDetectorMain.h b/slsDetectorGui/include/qDetectorMain.h index c7ac27275..ed1307d7a 100644 --- a/slsDetectorGui/include/qDetectorMain.h +++ b/slsDetectorGui/include/qDetectorMain.h @@ -19,6 +19,7 @@ class qTabAdvanced; class qTabSettings; class qTabDebugging; class qTabDeveloper; +class qTabMessages; /** Project Class Headers */ class slsDetectorUtils; #include "sls_detector_defs.h" @@ -80,25 +81,27 @@ private: /** The default tab heading color */ QColor defaultTabColor; /** enumeration of the tabs */ - enum {Measurement, Settings, DataOutput, Plot, Actions, Advanced, Debugging, Developer, NumberOfTabs }; + enum {Measurement, Settings, DataOutput, Plot, Actions, Advanced, Debugging, Developer, Messages, NumberOfTabs }; /* Scroll Area for the tabs**/ QScrollArea *scroll[NumberOfTabs]; /**Measurement tab */ - qTabMeasurement *tab_measurement; + qTabMeasurement *tab_measurement; /**DataOutput tab */ - qTabDataOutput *tab_dataoutput; + qTabDataOutput *tab_dataoutput; /**Plot tab */ - qTabPlot *tab_plot; + qTabPlot *tab_plot; /**Actions tab */ - qTabActions *tab_actions; + qTabActions *tab_actions; /**Settings tab */ - qTabSettings *tab_settings; + qTabSettings *tab_settings; /**Advanced tab */ - qTabAdvanced *tab_advanced; + qTabAdvanced *tab_advanced; /**Debugging tab */ - qTabDebugging *tab_debugging; + qTabDebugging *tab_debugging; /**Developer tab */ - qTabDeveloper *tab_developer; + qTabDeveloper *tab_developer; + /**Messages tab */ + qTabMessages *tab_messages; /**if the developer tab should be enabled,known from command line */ int isDeveloper; diff --git a/slsDetectorGui/include/qTabMeasurement.h b/slsDetectorGui/include/qTabMeasurement.h index e926ad9dd..c43b808d7 100644 --- a/slsDetectorGui/include/qTabMeasurement.h +++ b/slsDetectorGui/include/qTabMeasurement.h @@ -53,6 +53,10 @@ private: */ void SetupWidgetWindow(); + /** Sets up the timing mode + */ + void SetupTimingMode(); + /** Sets up all the slots and signals * @param timingChange only some of the signals are disconnected when timing mode is changed * This method is to reconnect them again. diff --git a/slsDetectorGui/include/qTabMessages.h b/slsDetectorGui/include/qTabMessages.h new file mode 100644 index 000000000..e61eecb9d --- /dev/null +++ b/slsDetectorGui/include/qTabMessages.h @@ -0,0 +1,68 @@ +/* + * qTabMessages.h + * + * Created on: Jun 26, 2012 + * Author: l_maliakal_d + */ + +#ifndef QTABMESSAGES_H_ +#define QTABMESSAGES_H_ + + + +/** Project Class Headers */ +class slsDetectorUtils; +/** Qt Include Headers */ +#include +#include +#include + +/** + *@short sets up the Messages parameters + */ +class qTabMessages:public QWidget{ + Q_OBJECT + +public: + /** \short The constructor + * @param parent is the parent tab widget + * @param detector is the detector returned from the detector tab + */ + qTabMessages(QWidget *parent,slsDetectorUtils*& detector); + + /** Destructor + */ + ~qTabMessages(); + + +private: + /** The sls detector object */ + slsDetectorUtils *myDet; + + /** Log of executed commands */ + QTextEdit *dispLog; + + /** Command display */ + QLineEdit *dispCommand; + + /** Path display */ + QLineEdit *dispPath; + +/** methods */ + /** Sets up the widget */ + void SetupWidgetWindow(); + + /** Sets up all the slots and signals */ + void Initialization(); + + +private slots: + void executeCommand(); + +}; + + + + + +#endif /* QTABMESSAGES_H_ */ diff --git a/slsDetectorGui/include/qTabSettings.h b/slsDetectorGui/include/qTabSettings.h index 23c5ecd6b..0a587022b 100644 --- a/slsDetectorGui/include/qTabSettings.h +++ b/slsDetectorGui/include/qTabSettings.h @@ -12,6 +12,9 @@ #include "ui_form_tab_settings.h" /** Project Class Headers */ class slsDetectorUtils; +#include "sls_detector_defs.h" +/** Qt Include Headers */ +#include /** *@short sets up the Settings parameters @@ -35,15 +38,26 @@ public: private: /** The sls detector object */ slsDetectorUtils *myDet; - - /** sls detector id */ + /**etector id */ int detID; + /** detector type */ + slsDetectorDefs::detectorType detType; + enum{Standard,Fast,HighGain,DynamicGain,LowGain,MediumGain,VeryHighGain,Undefined,Uninitialized,NumSettings}; + + /** To be able to index items on a combo box */ + QStandardItemModel* model; + QModelIndex index[NumSettings]; + QStandardItem* item[NumSettings]; /** Sets up the widget */ void SetupWidgetWindow(); + /** Sets up the detector settings + */ + void SetupDetectorSettings(); + /** Sets up all the slots and signals */ void Initialization(); diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index 6046b23e6..10f51bafc 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -58,7 +58,8 @@ SOURCES = \ src/qTabAdvanced.cpp\ src/qTabSettings.cpp\ src/qTabDebugging.cpp\ - src/qTabDeveloper.cpp + src/qTabDeveloper.cpp\ + src/qTabMessages.cpp HEADERS = \ slsDetectorPlotting/include/SlsQt1DPlot.h\ @@ -82,6 +83,7 @@ HEADERS = \ include/qTabSettings.h\ include/qTabDebugging.h\ include/qTabDeveloper.h\ + include/qTabMessages.h\ ../slsDetectorSoftware/commonFiles/sls_detector_defs.h @@ -95,3 +97,4 @@ FORMS = \ forms/form_tab_settings.ui\ forms/form_tab_debugging.ui\ forms/form_tab_developer.ui +# forms/form_tab_messages.ui diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 718281802..aaebe0f3b 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -10,6 +10,7 @@ #include "qTabSettings.h" #include "qTabDebugging.h" #include "qTabDeveloper.h" +#include "qTabMessages.h" /** Project Class Headers */ #include "slsDetector.h" #include "multiSlsDetector.h" @@ -93,6 +94,7 @@ void qDetectorMain::SetUpWidgetWindow(){ tab_advanced = new qTabAdvanced (this, myDet); tab_debugging = new qTabDebugging (this, myDet); tab_developer = new qTabDeveloper (this, myDet); + tab_messages = new qTabMessages (this, myDet); /** creating the scroll area widgets for the tabs */ for(int i=0;iinsertTab(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*/ + tabs->insertTab(Messages, tab_messages, "Messages"); /** mode setup - to set up the tabs initially as disabled, not in form so done here */ SetDebugMode(false); @@ -404,6 +408,7 @@ void qDetectorMain::EnableTabs(){ tabs->setTabEnabled(DataOutput,enable); tabs->setTabEnabled(Actions,enable); tabs->setTabEnabled(Settings,enable); + tabs->setTabEnabled(Messages,enable); /** special tabs */ if(enable==false){ diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 23e597325..b0da22efe 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -12,9 +12,8 @@ /** Project Class Headers */ #include "slsDetector.h" #include "multiSlsDetector.h" - +/** Qt Include Headers */ #include - /** C++ Include Headers */ #include using namespace std; @@ -63,8 +62,15 @@ void qTabMeasurement::SetupWidgetWindow(){ progressBar->setValue(0); /** timing mode*/ + SetupTimingMode(); +} + +//------------------------------------------------------------------------------------------------------------------------------------------------- + +void qTabMeasurement::SetupTimingMode(){ /** Get timing mode from detector*/ slsDetectorDefs::externalCommunicationMode mode = myDet->setExternalCommunicationMode(); + /** To be able to index items on a combo box */ QStandardItemModel* model = qobject_cast(comboTimingMode->model()); QModelIndex index[NumTimingModes]; @@ -112,15 +118,15 @@ void qTabMeasurement::SetupWidgetWindow(){ * then the timing mode is 'None'. * This is for the inexperienced user */ if(mode==slsDetectorDefs::AUTO_TIMING){ - int frames = (int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1); - int triggers = (int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1); - if((frames==1)&&(triggers==1)){ - comboTimingMode->setCurrentIndex((int)None); - setTimingMode((int)None); - }else{ - comboTimingMode->setCurrentIndex((int)Auto); - setTimingMode((int)Auto); - } + int frames = (int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1); + int triggers = (int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1); + if((frames==1)&&(triggers==1)){ + comboTimingMode->setCurrentIndex((int)None); + setTimingMode((int)None); + }else{ + comboTimingMode->setCurrentIndex((int)Auto); + setTimingMode((int)Auto); + } }else{ /** mode +1 since the detector class has no timingmode as "None" */ comboTimingMode->setCurrentIndex((int)mode+1); @@ -128,7 +134,7 @@ void qTabMeasurement::SetupWidgetWindow(){ } } /** Mode NOT ENABLED. - * This should not happen only if the server and gui has a mismatch + * This should not happen -only if the server and gui has a mismatch * on which all modes are allowed in detectors */ else{ qDefs::ErrorMessage("ERROR: Unknown Timing Mode detected from detector." diff --git a/slsDetectorGui/src/qTabMessages.cpp b/slsDetectorGui/src/qTabMessages.cpp new file mode 100644 index 000000000..25894f492 --- /dev/null +++ b/slsDetectorGui/src/qTabMessages.cpp @@ -0,0 +1,129 @@ +/* + * qTabMessages.cpp + * + * Created on: Jun 26, 2012 + * Author: l_maliakal_d + */ + +#include "qTabMessages.h" +/** Project Class Headers */ +#include "slsDetector.h" +#include "multiSlsDetector.h" +/** Qt Include Headers */ +#include +#include +#include +#include +#include +#include +/** C++ Include Headers */ +#include +using namespace std; + +//------------------------------------------------------------------------------------------------------------------------------------------------- + +qTabMessages::qTabMessages(QWidget *parent,slsDetectorUtils*& detector): + QWidget(parent),myDet(detector){ + SetupWidgetWindow(); + Initialization(); +} + +//------------------------------------------------------------------------------------------------------------------------------------------------- + +qTabMessages::~qTabMessages(){ + delete myDet; + delete dispLog; + delete dispCommand; + delete dispPath; +} + +//------------------------------------------------------------------------------------------------------------------------------------------------- + +void qTabMessages::SetupWidgetWindow(){ + /** Layout */ + QGridLayout *gridLayout = new QGridLayout(this); + QLabel *lblCommand = new QLabel("System Command:",this); + QLabel *lblPath = new QLabel("Working Directory:",this); + QSpacerItem *hSpacer= new QSpacerItem(20, 20, QSizePolicy::Fixed, QSizePolicy::Minimum); + dispLog = new QTextEdit(this); + dispCommand = new QLineEdit(this); + dispPath = new QLineEdit(this); + dispLog->setReadOnly(true); + dispPath->setReadOnly(true); + dispLog->setFocusPolicy(Qt::NoFocus); + dispPath->setFocusPolicy(Qt::NoFocus); + gridLayout->addWidget(dispLog, 0, 0, 1, 3); + gridLayout->addWidget(lblCommand, 1, 0, 1, 1); + gridLayout->addItem(hSpacer, 1, 1, 1, 1); + gridLayout->addWidget(dispCommand, 1, 2, 1, 1); + gridLayout->addWidget(lblPath, 2, 0, 1, 1); + gridLayout->addWidget(dispPath, 2, 2, 1, 1); + + /** Command & Path*/ + dispCommand->setText("Insert your command here"); + dispPath->setText(QDir("./").absolutePath()); +} + +//------------------------------------------------------------------------------------------------------------------------------------------------- + +void qTabMessages::Initialization(){ + connect(dispCommand,SIGNAL(returnPressed()),this,SLOT(executeCommand())); +} + +//------------------------------------------------------------------------------------------------------------------------------------------------- + +void qTabMessages::executeCommand(){ +#ifdef VERBOSE + cout<<"Calling: "<< dispCommand->text().toAscii().constData()<text()).absolutePath()); +#ifdef VERBOSE + //std::cout <<"working directory is " << proc.workingDirectory().absPath() << std::endl; + cout<<"Current Working Directory: "<text())); +#ifdef VERBOSE +/* QStringList list = proc.arguments(); + QStringList::Iterator it = list.begin(); + while( it != list.end() ) { + cout<<*it< using namespace std; - +//------------------------------------------------------------------------------------------------------------------------------------------------- qTabSettings::qTabSettings(QWidget *parent,slsDetectorUtils*& detector,int detID): QWidget(parent),myDet(detector),detID(detID){ + setupUi(this); SetupWidgetWindow(); Initialization(); } - - +//------------------------------------------------------------------------------------------------------------------------------------------------- qTabSettings::~qTabSettings(){ delete myDet; } - - +//------------------------------------------------------------------------------------------------------------------------------------------------- void qTabSettings::SetupWidgetWindow(){ + /** Detector Type*/ + detType=myDet->getDetectorsType(); + /** Settings */ + SetupDetectorSettings(); comboSettings->setCurrentIndex(myDet->getSettings(detID)); + + } +//------------------------------------------------------------------------------------------------------------------------------------------------- +void qTabSettings::SetupDetectorSettings(){ + /** Get detector settings from detector*/ + slsDetectorDefs::detectorSettings sett = myDet->getSettings(detID); + + /** To be able to index items on a combo box */ + model = qobject_cast(comboSettings->model()); + if (model) { + for(int i=0;iindex(i, comboSettings->modelColumn(), comboSettings->rootModelIndex()); + item[i] = model->itemFromIndex(index[i]); + } + /** Enabling/Disabling depending on the detector type + Undefined and uninitialized are enabled for all detectors*/ + if(sett==slsDetectorDefs::UNDEFINED) + item[(int)Uninitialized]->setEnabled(false); + else if(sett==slsDetectorDefs::UNINITIALIZED) + item[(int)Undefined]->setEnabled(false); + else{ + item[(int)Uninitialized]->setEnabled(false); + item[(int)Undefined]->setEnabled(false); + } + switch(detType){ + case slsDetectorDefs::MYTHEN: + item[(int)Standard]->setEnabled(true); + item[(int)Fast]->setEnabled(true); + item[(int)HighGain]->setEnabled(true); + item[(int)DynamicGain]->setEnabled(false); + item[(int)LowGain]->setEnabled(false); + item[(int)MediumGain]->setEnabled(false); + item[(int)VeryHighGain]->setEnabled(false); + break; + case slsDetectorDefs::EIGER: + item[(int)Standard]->setEnabled(false); + item[(int)Fast]->setEnabled(false); + item[(int)HighGain]->setEnabled(false); + item[(int)DynamicGain]->setEnabled(false); + item[(int)LowGain]->setEnabled(false); + item[(int)MediumGain]->setEnabled(false); + item[(int)VeryHighGain]->setEnabled(false); + break; + case slsDetectorDefs::GOTTHARD: + item[(int)Standard]->setEnabled(false); + item[(int)Fast]->setEnabled(false); + item[(int)HighGain]->setEnabled(true); + item[(int)DynamicGain]->setEnabled(true); + item[(int)LowGain]->setEnabled(true); + item[(int)MediumGain]->setEnabled(true); + item[(int)VeryHighGain]->setEnabled(true); + break; + default: + qDefs::ErrorMessage("ERROR: Unknown detector type.","Settings: ERROR"); + exit(-1); + break; + } + /** detector settings selected NOT ENABLED. + * This should not happen -only if the server and gui has a mismatch + * on which all modes are allowed in detectors */ + if(!(item[(int)sett]->isEnabled())){ + qDefs::ErrorMessage("ERROR: Unknown Detector Settings retrieved from detector. " + "Exiting GUI.","Settings: ERROR"); +#ifdef VERBOSE + cout<<"ERROR: Unknown Detector Settings retrieved from detector."<setCurrentIndex((int)sett); + + } + } +} + +//------------------------------------------------------------------------------------------------------------------------------------------------- void qTabSettings::Initialization(){ /** Settings */ connect(comboSettings,SIGNAL(currentIndexChanged(int)),this,SLOT(setSettings(int))); } - +//------------------------------------------------------------------------------------------------------------------------------------------------- void qTabSettings::setSettings(int index){ + /** The first time settings is changed from undefined or uninitialized to a proper setting, + * then undefined/uninitialized should be disabled */ + if(item[(int)Undefined]->isEnabled()){ + /**Do not disable it if this wasnt selected again by mistake*/ + if(index!=(int)Undefined) + item[(int)Undefined]->setEnabled(false); + }else if(item[(int)Uninitialized]->isEnabled()){ + /**Do not disable it if this wasnt selected again by mistake*/ + if(index!=(int)Uninitialized) + item[(int)Uninitialized]->setEnabled(false); + } slsDetectorDefs::detectorSettings sett = myDet->setSettings((slsDetectorDefs::detectorSettings)index,detID); #ifdef VERBOSE cout<<"Settings have been set to "<slsDetectorBase::getDetectorSettings(sett)< Date: Wed, 4 Jul 2012 13:39:30 +0000 Subject: [PATCH 016/332] no plot histogram, messages work git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@16 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_detectormain.ui | 40 +- slsDetectorGui/forms/form_tab_plot.ui | 540 +++++++++++++++------- slsDetectorGui/forms/form_tab_settings.ui | 13 +- slsDetectorGui/include/qActionsWidget.h | 3 - slsDetectorGui/include/qDebugStream.h | 113 +++++ slsDetectorGui/include/qDefs.h | 34 +- slsDetectorGui/include/qDetectorMain.h | 86 ++-- slsDetectorGui/include/qDrawPlot.h | 16 +- slsDetectorGui/include/qTabActions.h | 4 + slsDetectorGui/include/qTabAdvanced.h | 4 + slsDetectorGui/include/qTabDataOutput.h | 11 +- slsDetectorGui/include/qTabDebugging.h | 3 + slsDetectorGui/include/qTabDeveloper.h | 3 + slsDetectorGui/include/qTabMeasurement.h | 4 + slsDetectorGui/include/qTabMessages.h | 25 +- slsDetectorGui/include/qTabPlot.h | 16 +- slsDetectorGui/include/qTabSettings.h | 4 + slsDetectorGui/slsDetectorGui.pro | 1 + slsDetectorGui/src/qCloneWidget.cpp | 11 +- slsDetectorGui/src/qDetectorMain.cpp | 334 +++++++------ slsDetectorGui/src/qDrawPlot.cpp | 65 ++- slsDetectorGui/src/qTabActions.cpp | 7 + slsDetectorGui/src/qTabAdvanced.cpp | 9 + slsDetectorGui/src/qTabDataOutput.cpp | 30 +- slsDetectorGui/src/qTabDebugging.cpp | 10 + slsDetectorGui/src/qTabDeveloper.cpp | 9 + slsDetectorGui/src/qTabMeasurement.cpp | 44 +- slsDetectorGui/src/qTabMessages.cpp | 144 +++--- slsDetectorGui/src/qTabPlot.cpp | 120 +++-- slsDetectorGui/src/qTabSettings.cpp | 10 + 30 files changed, 1133 insertions(+), 580 deletions(-) create mode 100644 slsDetectorGui/include/qDebugStream.h diff --git a/slsDetectorGui/forms/form_detectormain.ui b/slsDetectorGui/forms/form_detectormain.ui index 7ded9699e..0f2049a6b 100644 --- a/slsDetectorGui/forms/form_detectormain.ui +++ b/slsDetectorGui/forms/form_detectormain.ui @@ -159,43 +159,6 @@ 524287 - - - - - - - 0 - 0 - 0 - - - - - - - - - 0 - 0 - 0 - - - - - - - - - 119 - 119 - 119 - - - - - - Sans Serif @@ -220,6 +183,9 @@ p, li { white-space: pre-wrap; } + + Qt::LeftToRight + QDockWidget::NoDockWidgetFeatures diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index 9fc9064d3..fdd0b5018 100644 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -411,9 +411,9 @@ - 315 + 430 70 - 446 + 331 51 @@ -431,7 +431,7 @@ 10 20 - 496 + 321 22 @@ -449,7 +449,7 @@ - + @@ -462,7 +462,7 @@ - + @@ -475,8 +475,8 @@ - - + + Qt::Horizontal @@ -485,7 +485,23 @@ - 180 + 10 + 20 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 20 @@ -497,9 +513,9 @@ - 315 - 10 - 446 + 10 + 70 + 391 51 @@ -517,13 +533,19 @@ 10 20 - 254 + 376 21 + + + 0 + 0 + + Superimpose @@ -532,16 +554,6 @@ - - - - false - - - Persistency: - - - @@ -558,77 +570,111 @@ - - - - false - + + - + 0 0 - - - 60 - 16777215 - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - 1 - - - 10 - - - 1 + + Line + + + + + 0 + 0 + + + + Points + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 10 + + + + + + + + 1 + + + + + false + + + + 0 + 0 + + + + Persistency: + + + + + + + false + + + + 0 + 0 + + + + + 40 + 16777215 + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + 1 + + + 10 + + + 1 + + + + + - - - - 395 - 15 - 40 - 28 - - - - - 0 - 0 - - - - - 40 - 16777215 - - - - Qt::NoFocus - - - Clear - - - true - - 10 135 - 751 + 391 51 @@ -646,69 +692,11 @@ 10 15 - 741 + 382 31 - - - - - 0 - 0 - - - - File Name: - - - - - - - 0 - - - - - - 0 - 0 - - - - - 250 - 0 - - - - - - - - true - - - - .png - - - - - .jpg - - - - - .xpm - - - - - - @@ -748,6 +736,22 @@ + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + @@ -758,15 +762,15 @@ - + true - 10 - 70 - 261 + 430 + 135 + 331 51 @@ -782,10 +786,10 @@ - 5 - 21 - 251 - 21 + 10 + 15 + 311 + 31 @@ -804,11 +808,11 @@ Create - true + false - + @@ -823,11 +827,11 @@ Close All - true + false - + @@ -842,10 +846,42 @@ Save All - true + false + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 30 + 20 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 30 + 20 + + + + @@ -857,7 +893,7 @@ 10 10 - 261 + 391 51 @@ -875,32 +911,222 @@ 10 20 - 246 - 21 + 381 + 23 - + + + + 0 + 0 + + - None + No Plot - - + + + + + 0 + 0 + + Data Graph + + true + - + + + + 0 + 0 + + Histogram + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 50 + 10 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 50 + 10 + + + + + + + + + + + 430 + 10 + 331 + 51 + + + + Scan - Y Axis Values + + + true + + + false + + + + + 11 + 20 + 316 + 23 + + + + + 0 + + + + + + 0 + 0 + + + + Level 0 + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 5 + 10 + + + + + + + + + 0 + 0 + + + + Level 1 + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 5 + 10 + + + + + + + + + 0 + 0 + + + + File Index + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 5 + 10 + + + + + + + + + 0 + 0 + + + + All Frames + + + true + + + diff --git a/slsDetectorGui/forms/form_tab_settings.ui b/slsDetectorGui/forms/form_tab_settings.ui index 89d6214fe..f7184ebdd 100644 --- a/slsDetectorGui/forms/form_tab_settings.ui +++ b/slsDetectorGui/forms/form_tab_settings.ui @@ -139,7 +139,18 @@ - + + + + 16 + + + + + 32 + + + diff --git a/slsDetectorGui/include/qActionsWidget.h b/slsDetectorGui/include/qActionsWidget.h index edb4fdc08..501a1a5ff 100644 --- a/slsDetectorGui/include/qActionsWidget.h +++ b/slsDetectorGui/include/qActionsWidget.h @@ -72,9 +72,6 @@ void SetScript(int index); * Options: constant size,specific values,values from file */ void EnableSizeWidgets(); - - -protected: }; diff --git a/slsDetectorGui/include/qDebugStream.h b/slsDetectorGui/include/qDebugStream.h new file mode 100644 index 000000000..bb4607691 --- /dev/null +++ b/slsDetectorGui/include/qDebugStream.h @@ -0,0 +1,113 @@ +/* + * qDebugStream.h + * + * Created on: Jun 28, 2012 + * Author: Anna Bergamaschi + */ + +#ifndef QDEBUGSTREAM_H_ +#define QDEBUGSTREAM_H_ + + +#include +#include +#include +#include +#include + +#include +#include +#include +using namespace std; + +#define STREAMEVENT 60001 + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + +class qStreamEvent:public QEvent{ +public: + qStreamEvent(QString s):QEvent(static_cast(STREAMEVENT)) {str=s;}; + /** \returns the progress index */ + QString getString() {return str;}; +private: + QString str; + +}; + +//------------------------------------------------------------------------------------------------------------------------------------------------- + +class qDebugStream : public basic_streambuf { + +public: + qDebugStream(ostream &stream, QWidget* w) : m_stream(stream), log_window(w) { + m_old_buf = stream.rdbuf(); + stream.rdbuf(this); + }; + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + ~qDebugStream(){ + // output anything that is left + if (!m_string.empty()) { + qStreamEvent *ce=new qStreamEvent(m_string.c_str()); + QApplication::postEvent(log_window, ce); +#ifdef VERBOSE + cerr << m_string << endl; +#endif + } + m_stream.rdbuf(m_old_buf); + } + +//------------------------------------------------------------------------------------------------------------------------------------------------- + +protected: + virtual int_type overflow(int_type v){ + if (v == '\n'){ + qStreamEvent *ce=new qStreamEvent(m_string.c_str()); + QApplication::postEvent(log_window, ce); +#ifdef VERBOSE + cerr << m_string << endl; +#endif + m_string.erase(m_string.begin(), m_string.end()); + } + else + m_string += v; + return v; + } + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + virtual streamsize xsputn(const char *p, streamsize n) { + m_string.append(p, p + n); + uint pos = 0; + + while (pos != string::npos) + { + pos = m_string.find('\n'); + if (pos != string::npos) + { + string tmp(m_string.begin(), m_string.begin() + pos); + qStreamEvent *ce=new qStreamEvent(tmp.c_str()); + QApplication::postEvent(log_window, ce); +#ifdef VERBOSE + cerr << tmp << endl; +#endif + m_string.erase(m_string.begin(), m_string.begin() + pos + 1); + } + } + return n; + } + +//------------------------------------------------------------------------------------------------------------------------------------------------- + +private: + ostream &m_stream; + streambuf *m_old_buf; + string m_string; + QWidget* log_window; +}; + +//------------------------------------------------------------------------------------------------------------------------------------------------- + +#endif /* QDEBUGSTREAM_H_ */ diff --git a/slsDetectorGui/include/qDefs.h b/slsDetectorGui/include/qDefs.h index f75af62a2..5167465a4 100644 --- a/slsDetectorGui/include/qDefs.h +++ b/slsDetectorGui/include/qDefs.h @@ -35,7 +35,24 @@ public: //------------------------------------------------------------------------------------------------------------------------------------------------- - /** returns the value in ns to send to server. + /** returns the unit in words + * @param unit is the time unit + */ + static string getUnitString(timeUnit unit){ + switch(unit){ + case HOURS: return string("hrs"); + case MINUTES: return string("min"); + case SECONDS: return string("sec"); + case MILLISECONDS: return string("msec"); + case MICROSECONDS: return string("usec"); + case NANOSECONDS: return string("nsec"); + default: return string("error"); + } + }; +//------------------------------------------------------------------------------------------------------------------------------------------------- + + /** returns the value in ns to send to server as the + * server class slsdetector accepts in ns. * @param unit unit of time * @param value time * returns time value in ns @@ -95,9 +112,22 @@ public: * @param source is the tab or the source of the error * */ static void ErrorMessage(string errorMessage,char source[]) + { + static QMessageBox* errorBox; + errorBox= new QMessageBox(QMessageBox::Warning,source,tr(errorMessage.c_str()),QMessageBox::Ok, errorBox); + errorBox->exec(); + } + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + /**displays an information message + * @param infoMessage the message to be displayed + * @param source is the tab or the source of the information + * */ + static void InfoMessage(string infoMessage,char source[]) { static QMessageBox* msgBox; - msgBox= new QMessageBox(QMessageBox::Warning,source,tr(errorMessage.c_str()),QMessageBox::Ok, msgBox); + msgBox= new QMessageBox(QMessageBox::Information,source,tr(infoMessage.c_str()),QMessageBox::Ok, msgBox); msgBox->exec(); } diff --git a/slsDetectorGui/include/qDetectorMain.h b/slsDetectorGui/include/qDetectorMain.h index ed1307d7a..b1807f2b4 100644 --- a/slsDetectorGui/include/qDetectorMain.h +++ b/slsDetectorGui/include/qDetectorMain.h @@ -52,10 +52,11 @@ public: * @param argv server options * @param app the qapplication * @param parent makes the parent window 0 by default - */ + * */ qDetectorMain(int argc, char **argv, QApplication *app, QWidget *parent = 0); - /**Destructor */ + /**Destructor + * */ ~qDetectorMain(); private: @@ -103,88 +104,55 @@ private: /**Messages tab */ qTabMessages *tab_messages; /**if the developer tab should be enabled,known from command line */ - int isDeveloper; + + /**Sets up the layout of the widget - */ + * */ void SetUpWidgetWindow(); /**Sets up detector - */ + * */ void SetUpDetector(); /**Sets up the signals and the slots - */ + * */ void Initialization(); - /** Sets/unsets the developer mode (developer tab) - * @param b bool TRUE sets, FALSE unsets\ - */ - void SetDeveloperMode(bool b); private slots: -/** Sets/unsets the debug mode i.e. enables/disables the debug tab - * @param b bool TRUE sets, FALSE unsets - */ -void SetDebugMode(bool b); +/** Enables modes as selected -Debug, Beamline, Expert, Dockable(calls setdockablemode()) + * */ +void EnableModes(QAction *action); -/** Sets/unsets the beamline mode (at the moment it doesn't do anything) - * @param b bool TRUE sets, FALSE unsets - */ -void SetBeamlineMode(bool b); +/** Executes actions in the utilities menu as selected + * */ +void ExecuteUtilities(QAction *action); -/** Sets/unsets the expert mode i.e. enables/disables the advanced and Settings tabs - * @param b bool TRUE sets, FALSE unsets - */ -void SetExpertMode(bool b); +/** Executes actions in the utilities menu as selected + * */ +void ExecuteHelp(QAction *action); -/** Sets/unsets the dockable plot mode - * @param b bool TRUE sets, FALSE unsets - */ -void SetDockableMode(bool b); - -/** Refreshes the tab each time the tab is changed. Also displays the next enabled tab */ -void refresh(int index); - -/** Opens Setup */ -void OpenSetup(); - -/** Saves Setup */ -void SaveSetup(); - -/** Measurement Wizard */ -void MeasurementWizard(); - -/** Open Configuration*/ -void OpenConfiguration(); - -/** Save Configuration */ -void SaveConfiguration(); - -/** Executing Energy Calibration */ -void EnergyCalibration(); - -/** Executing Angular Calibration */ -void AngularCalibration(); - -/** Executing Version */ -void Version(); - -/** Executing About */ -void About(); +/** Refreshes the tab each time the tab is changed. Also displays the next enabled tab + * */ +void Refresh(int index); /** Resizes the main window if the plot is docked/undocked * @param b bool TRUE if undocked(outside main window), FALSE docked - */ + * */ void ResizeMainWindow(bool b); -/** Enables/disables tabs depending on if acquisition is currently in progress */ +/** Enables/disables tabs depending on if acquisition is currently in progress + * */ void EnableTabs(); -/** Set the tool tip of mouse controlled zooming depening on if its enabled/disabled*/ +/** Set the tool tip of mouse controlled zooming depening on if its enabled/disabled + * */ void SetZoomToolTip(bool disable); protected: +/** Adjust the resizing to resize plot, except for actions tab + * */ void resizeEvent(QResizeEvent* event); signals: diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index 57bfe31b6..7dccad63c 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -40,6 +40,8 @@ public: /** Destructor */ ~qDrawPlot(); + bool isRunning(){return running;}; + /** Number of x axis pixels */ int GetPixelsX(){return nPixelsX;}; /** Number of y axis pixels */ @@ -72,7 +74,10 @@ public: void DisableZoom(bool disable); /** gets the progress of acquisition to the measurement tab*/ int GetProgress(){return progress;}; - + /** Enables plot from the plot tab*/ + void EnablePlot(bool enable); + /** To know whether 1d started*/ + bool DoesPlotExist(){return plotExists;}; /** Starts or stop acquisition * Calls startDaq() function @@ -171,6 +176,8 @@ private: int currentPersistency; int progress; bool plotEnable; + bool plotExists; + bool running; /** Initializes all its members and the thread */ void Initialization(); @@ -223,13 +230,10 @@ void Clear1DPlot(); void ClonePlot(); /** Closes all the clone plots */ void CloseClones(); -/** To Save plot - @param FName full name of file */ -void SavePlot(QString FName); +/** To Save plot */ +void SavePlot(); /** Sets persistency from plot tab */ void SetPersistency(int val); -/** Enables plot */ -void EnablePlot(bool enable); diff --git a/slsDetectorGui/include/qTabActions.h b/slsDetectorGui/include/qTabActions.h index 7f4c13e67..6c8b14c7e 100644 --- a/slsDetectorGui/include/qTabActions.h +++ b/slsDetectorGui/include/qTabActions.h @@ -37,6 +37,10 @@ public: */ ~qTabActions(); + /** To refresh and update widgets + */ + void Refresh(); + private: /** The sls detector object */ diff --git a/slsDetectorGui/include/qTabAdvanced.h b/slsDetectorGui/include/qTabAdvanced.h index 86cf27e8c..101d6cfd3 100644 --- a/slsDetectorGui/include/qTabAdvanced.h +++ b/slsDetectorGui/include/qTabAdvanced.h @@ -30,6 +30,10 @@ public: */ ~qTabAdvanced(); + /** To refresh and update widgets + */ + void Refresh(); + private: /** The sls detector object */ diff --git a/slsDetectorGui/include/qTabDataOutput.h b/slsDetectorGui/include/qTabDataOutput.h index 1a0781ae0..37dd81317 100644 --- a/slsDetectorGui/include/qTabDataOutput.h +++ b/slsDetectorGui/include/qTabDataOutput.h @@ -33,14 +33,16 @@ public: */ ~qTabDataOutput(); + /** To refresh and update widgets + */ + void Refresh(); + + private: /** The sls detector object */ slsDetectorUtils *myDet; - /** Output Directory */ - QString outputDir; - /** methods */ /** Sets up the widget */ void SetupWidgetWindow(); @@ -48,9 +50,6 @@ private: /** Sets up all the slots and signals */ void Initialization(); - /** Enables/Disables all the widgets */ - void Enable(bool enable); - private slots: /** Sets the output directory diff --git a/slsDetectorGui/include/qTabDebugging.h b/slsDetectorGui/include/qTabDebugging.h index a51e84c7d..8d399a6d0 100644 --- a/slsDetectorGui/include/qTabDebugging.h +++ b/slsDetectorGui/include/qTabDebugging.h @@ -30,6 +30,9 @@ public: */ ~qTabDebugging(); + /** To refresh and update widgets + */ + void Refresh(); private: /** The sls detector object */ diff --git a/slsDetectorGui/include/qTabDeveloper.h b/slsDetectorGui/include/qTabDeveloper.h index 94c4e5b2b..d5baf5e99 100644 --- a/slsDetectorGui/include/qTabDeveloper.h +++ b/slsDetectorGui/include/qTabDeveloper.h @@ -30,6 +30,9 @@ public: */ ~qTabDeveloper(); + /** To refresh and update widgets + */ + void Refresh(); private: /** The sls detector object */ diff --git a/slsDetectorGui/include/qTabMeasurement.h b/slsDetectorGui/include/qTabMeasurement.h index c43b808d7..ee133c581 100644 --- a/slsDetectorGui/include/qTabMeasurement.h +++ b/slsDetectorGui/include/qTabMeasurement.h @@ -36,6 +36,10 @@ public: */ ~qTabMeasurement(); + /** To refresh and update widgets + */ + void Refresh(); + private: /** The sls detector object */ diff --git a/slsDetectorGui/include/qTabMessages.h b/slsDetectorGui/include/qTabMessages.h index e61eecb9d..972160300 100644 --- a/slsDetectorGui/include/qTabMessages.h +++ b/slsDetectorGui/include/qTabMessages.h @@ -15,7 +15,9 @@ class slsDetectorUtils; /** Qt Include Headers */ #include #include -#include +#include +#include +#include "qDebugStream.h" /** *@short sets up the Messages parameters @@ -42,11 +44,14 @@ private: /** Log of executed commands */ QTextEdit *dispLog; - /** Command display */ - QLineEdit *dispCommand; + /** To save the log to file */ + QPushButton *btnSave; - /** Path display */ - QLineEdit *dispPath; + /** To clear the log to file */ + QPushButton *btnClear; + + /** This class creates the log */ + qDebugStream *qout; /** methods */ /** Sets up the widget */ @@ -55,9 +60,15 @@ private: /** Sets up all the slots and signals */ void Initialization(); - private slots: - void executeCommand(); +/** Stream log to textedit in GUI */ +void customEvent(QEvent *e); + +/** Save Log to File*/ +void SaveLog(); + +/** Clear Log to File*/ +void ClearLog(); }; diff --git a/slsDetectorGui/include/qTabPlot.h b/slsDetectorGui/include/qTabPlot.h index cb789c116..957347e30 100644 --- a/slsDetectorGui/include/qTabPlot.h +++ b/slsDetectorGui/include/qTabPlot.h @@ -34,6 +34,7 @@ public: ~qTabPlot(); + private: /** The sls detector object */ slsDetectorUtils *myDet; @@ -41,6 +42,9 @@ private: /** The Plot widget */ qDrawPlot *myPlot; + /** 1d/2d plot */ + bool isOneD; + /** some Default Values */ static QString defaultPlotTitle; static QString defaultHistXAxisTitle; @@ -58,11 +62,6 @@ private: */ void Initialization(); - /** Enables/Disables all the widgets - */ - void Enable(bool enable); - - @@ -93,9 +92,10 @@ void SetAxesRange(); void SetZRange(); /** Enables the range of the z axis */ void EnableZRange(); -/** Save Plot */ -void SavePlot(); - +/** Set Plot to none, data graph, histogram*/ +void SetPlot(); +/** Enable Histogram */ +void EnableHistogram(bool enable); signals: void DisableZoomSignal(bool); diff --git a/slsDetectorGui/include/qTabSettings.h b/slsDetectorGui/include/qTabSettings.h index 0a587022b..5729e5c41 100644 --- a/slsDetectorGui/include/qTabSettings.h +++ b/slsDetectorGui/include/qTabSettings.h @@ -34,6 +34,10 @@ public: */ ~qTabSettings(); + /** To refresh and update widgets + */ + void Refresh(); + private: /** The sls detector object */ diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index 10f51bafc..6c1474409 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -71,6 +71,7 @@ HEADERS = \ slsDetectorPlotting/include/SlsQtValidators.h\ slsDetectorPlotting/include/SlsQtNumberEntry.h\ include/qDefs.h\ + include/qDebugStream.h\ include/qDetectorMain.h\ include/qDrawPlot.h\ include/qCloneWidget.h\ diff --git a/slsDetectorGui/src/qCloneWidget.cpp b/slsDetectorGui/src/qCloneWidget.cpp index ae8d385a8..52bb930f2 100644 --- a/slsDetectorGui/src/qCloneWidget.cpp +++ b/slsDetectorGui/src/qCloneWidget.cpp @@ -141,7 +141,7 @@ void qCloneWidget::SetupWidgetWindow(QString title,int numDim,SlsQt1DPlot*& plot //------------------------------------------------------------------------------------------------------------------------------------------------- void qCloneWidget::SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis[],string histTitle[]){ - /** for each plot*/ + /** for each plot*/cout<<"qclone nhists:"<render(&painter); - fName = QFileDialog::getSaveFileName(this,tr("Save Snapshot "), - fName,tr("Images (*.png *.xpm *.jpg)")); + fName = QFileDialog::getSaveFileName(this,tr("Save Snapshot "),fName,tr("Images (*.png *.xpm *.jpg)"),0,QFileDialog::ShowDirsOnly); if (!fName.isEmpty()) - if(!(img.save(fName))) - qDefs::ErrorMessage("ERROR: Attempt to save snapshot failed","Snapshot: WARNING"); + if((img.save(fName))) + qDefs::InfoMessage("The SnapShot has been successfully saved","Snapshot: Information"); + else + qDefs::ErrorMessage("ERROR: Attempt to save snapshot failed. Wrong Format","Snapshot: WARNING"); } //------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index aaebe0f3b..5da201b2a 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -17,6 +17,7 @@ #include "sls_detector_defs.h" /** Qt Include Headers */ #include +#include /** C++ Include Headers */ #include #include @@ -25,6 +26,7 @@ using namespace std; //------------------------------------------------------------------------------------------------------------------------------------------------- + int main (int argc, char **argv) { QApplication *theApp = new QApplication(argc, argv); @@ -35,8 +37,10 @@ int main (int argc, char **argv) { return theApp->exec(); } + //------------------------------------------------------------------------------------------------------------------------------------------------- + qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app, QWidget *parent) : QMainWindow(parent), theApp(app),myDet(0),detID(0),myPlot(NULL),tabs(NULL),isDeveloper(0){ @@ -61,23 +65,26 @@ qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app, QWidget * } + //------------------------------------------------------------------------------------------------------------------------------------------------- + qDetectorMain::~qDetectorMain(){ delete myDet; if (menubar) delete menubar; if (centralwidget) delete centralwidget; } + //------------------------------------------------------------------------------------------------------------------------------------------------- + void qDetectorMain::SetUpWidgetWindow(){ /** Layout */ layoutTabs= new QGridLayout; centralwidget->setLayout(layoutTabs); - /** plot setup*/ myPlot = new qDrawPlot(dockWidgetPlot,myDet); dockWidgetPlot->setWidget(myPlot); @@ -86,6 +93,7 @@ void qDetectorMain::SetUpWidgetWindow(){ tabs = new MyTabWidget(this); layoutTabs->addWidget(tabs); /** 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_plot = new qTabPlot (this, myDet,myPlot); @@ -94,7 +102,6 @@ void qDetectorMain::SetUpWidgetWindow(){ tab_advanced = new qTabAdvanced (this, myDet); tab_debugging = new qTabDebugging (this, myDet); tab_developer = new qTabDeveloper (this, myDet); - tab_messages = new qTabMessages (this, myDet); /** creating the scroll area widgets for the tabs */ for(int i=0;isetWidget(tab_advanced); scroll[Debugging] ->setWidget(tab_debugging); scroll[Developer] ->setWidget(tab_developer); - - /** inserting all the tabs*/ tabs->insertTab(Measurement, scroll[Measurement], "Measurement"); tabs->insertTab(DataOutput, scroll[DataOutput], "Data Output"); @@ -122,21 +127,38 @@ void qDetectorMain::SetUpWidgetWindow(){ tabs->insertTab(Developer, scroll[Developer], "Developer"); /** Prefer this to expand and not have scroll buttons*/ tabs->insertTab(Messages, tab_messages, "Messages"); + /** Default tab color*/ + defaultTabColor = tabs->tabBar()->tabTextColor(DataOutput); + /**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*/ + tabs->tabBar()->setFixedWidth(width()+61); /** mode setup - to set up the tabs initially as disabled, not in form so done here */ - SetDebugMode(false); - SetBeamlineMode(false); - SetExpertMode(false); - SetDeveloperMode(false); - SetDeveloperMode(isDeveloper); - - tabs->tabBar()->setTabTextColor(0,QColor(0,0,200,255)); - +#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" + "Setting Developer Mode to "<setTabEnabled(Debugging,false); + //beamline mode to false + tabs->setTabEnabled(Advanced,false); + dockWidgetPlot->setFloating(false); + dockWidgetPlot->setFeatures(QDockWidget::NoDockWidgetFeatures); + tabs->setTabEnabled(Developer,isDeveloper); +/** Other setup*/ + /**Height of plot and central widget*/ + heightPlotWindow = dockWidgetPlot->size().height(); + heightCentralWidget = centralwidget->size().height(); + /** Default zoom Tool Tip */ + zoomToolTip = dockWidgetPlot->toolTip(); } + //------------------------------------------------------------------------------------------------------------------------------------------------- + void qDetectorMain::SetUpDetector(){ @@ -178,14 +200,16 @@ void qDetectorMain::SetUpDetector(){ } } + //------------------------------------------------------------------------------------------------------------------------------------------------- + void qDetectorMain::Initialization(){ /** Dockable Plot*/ connect(dockWidgetPlot,SIGNAL(topLevelChanged(bool)),this,SLOT(ResizeMainWindow(bool))); /** tabs */ - connect(tabs,SIGNAL(currentChanged(int)),this, SLOT(refresh(int)));//( QWidget*))); + connect(tabs,SIGNAL(currentChanged(int)),this, SLOT(Refresh(int)));//( QWidget*))); /** Measurement tab*/ /** Plot tab */ connect(tab_plot,SIGNAL(DisableZoomSignal(bool)),this, SLOT(SetZoomToolTip(bool))); @@ -200,166 +224,187 @@ void qDetectorMain::Initialization(){ /** menubar */ /** Modes Menu */ - connect(actionDebug, SIGNAL(toggled(bool)),this,SLOT(SetDebugMode(bool))); - connect(actionBeamline, SIGNAL(toggled(bool)),this,SLOT(SetBeamlineMode(bool))); - connect(actionExpert, SIGNAL(toggled(bool)),this,SLOT(SetExpertMode(bool))); - connect(actionDockable, SIGNAL(toggled(bool)),this,SLOT(SetDockableMode(bool))); - - + connect(menuModes,SIGNAL(triggered(QAction*)),SLOT(EnableModes(QAction*))); /** Utilities Menu */ - connect(actionOpenSetup,SIGNAL(triggered()),this,SLOT(OpenSetup())); - connect(actionSaveSetup,SIGNAL(triggered()),this,SLOT(SaveSetup())); - connect(actionMeasurementWizard,SIGNAL(triggered()),this,SLOT(MeasurementWizard())); - connect(actionOpenConfiguration,SIGNAL(triggered()),this,SLOT(OpenConfiguration())); - connect(actionSaveConfiguration,SIGNAL(triggered()),this,SLOT(SaveConfiguration())); - connect(actionEnergyCalibration,SIGNAL(triggered()),this,SLOT(EnergyCalibration())); - connect(actionAngularCalibration,SIGNAL(triggered()),this,SLOT(AngularCalibration())); - connect(actionAbout,SIGNAL(triggered()),this,SLOT(About())); - connect(actionVersion,SIGNAL(triggered()),this,SLOT(Version())); - - heightPlotWindow = dockWidgetPlot->size().height(); - heightCentralWidget = centralwidget->size().height(); - - defaultTabColor = tabs->tabBar()->tabTextColor(DataOutput); - zoomToolTip = dockWidgetPlot->toolTip(); + connect(menuUtilities,SIGNAL(triggered(QAction*)),SLOT(ExecuteUtilities(QAction*))); + /** Help Menu */ + connect(menuHelp,SIGNAL(triggered(QAction*)),SLOT(ExecuteHelp(QAction*))); } + //------------------------------------------------------------------------------------------------------------------------------------------------- -void qDetectorMain::SetDeveloperMode(bool b){ + +void qDetectorMain::EnableModes(QAction *action){ + bool enable; + + /**Set DebugMode */ + if(action==actionDebug){ + enable = actionDebug->isChecked(); + tabs->setTabEnabled(Debugging,enable); #ifdef VERBOSE - cout<<"Setting Developer Mode to "<setTabEnabled(Developer,b); -} + } -//------------------------------------------------------------------------------------------------------------------------------------------------- - -void qDetectorMain::SetDebugMode(bool b){ + /**Set BeamlineMode */ + else if(action==actionBeamline){ + enable = actionBeamline->isChecked(); #ifdef VERBOSE - cout<<"Setting Debug Mode to "<setTabEnabled(Debugging,b); -} + } -//------------------------------------------------------------------------------------------------------------------------------------------------- - -void qDetectorMain::SetBeamlineMode(bool b){ + /**Set ExpertMode */ + else if(action==actionExpert){ + enable = actionExpert->isChecked(); + tabs->setTabEnabled(Advanced,enable); #ifdef VERBOSE - cout<<"Setting Beamline Mode to "<isChecked(); + if(enable) + dockWidgetPlot->setFeatures(QDockWidget::DockWidgetFloatable); + else{ + dockWidgetPlot->setFloating(false); + dockWidgetPlot->setFeatures(QDockWidget::NoDockWidgetFeatures); + } #ifdef VERBOSE - cout<<"Setting Expert Mode to "<setTabEnabled(Advanced,b); + } } + //------------------------------------------------------------------------------------------------------------------------------------------------- -void qDetectorMain::refresh(int index){ + +void qDetectorMain::ExecuteUtilities(QAction *action){ + + if(action==actionOpenSetup){ +#ifdef VERBOSE + cout<<"Opening Setup"<getFilePath().c_str()); + fName = QFileDialog::getOpenFileName(this, + tr("Load Detector Setup"),fName, + tr("Detector Setup files (*.det)")); + /** Gets called when cancelled as well*/ + if (!fName.isEmpty()){ + myDet->retrieveDetectorSetup(string(fName.toAscii().constData())); + qDefs::InfoMessage("The parameters have been successfully setup.","Main: Information"); + } + } + else if(action==actionSaveSetup){ +#ifdef VERBOSE + cout<<"Saving Setup"<getFilePath().c_str()); + fName = QFileDialog::getSaveFileName(this, + tr("Save Current Detector Setup"),fName, + tr("Detector Setup files (*.det) ")); + /** 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: Information"); + } + } + else if(action==actionMeasurementWizard){ +#ifdef VERBOSE + cout<<"Measurement Wizard"<getFilePath().c_str()); + fName = QFileDialog::getOpenFileName(this, + tr("Load Detector Configuration"),fName, + tr("Configuration files (*.config)")); + /** Gets called when cancelled as well*/ + if (!fName.isEmpty()){ + myDet->readConfigurationFile(string(fName.toAscii().constData())); + qDefs::InfoMessage("The parameters have been successfully configured.","Main: Information"); + } + } + else if(action==actionSaveConfiguration){ +#ifdef VERBOSE + cout<<"Saving Configuration"<getFilePath().c_str()); + fName = QFileDialog::getSaveFileName(this, + tr("Save Current Detector Configuration"),fName, + tr("Configuration files (*.config) ")); + /** 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: Information"); + } + } + else if(action==actionEnergyCalibration){ +#ifdef VERBOSE + cout<<"Executing Energy Calibration"<currentIndex()); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qDetectorMain::ExecuteHelp(QAction *action){ + if(action==actionVersion){ +#ifdef VERBOSE + cout<<"Version"<isTabEnabled(index)) tabs->setCurrentIndex((index++)<(tabs->count()-1)?index:Measurement); else{ -; + switch(tabs->currentIndex()){ + case Measurement: if(!myPlot->isRunning()) tab_measurement->Refresh(); break; + case Settings: tab_settings->Refresh(); break; + case DataOutput: tab_dataoutput->Refresh(); break; + case Plot: break; + case Actions: tab_actions->Refresh(); break; + case Advanced: tab_advanced->Refresh(); break; + case Debugging: tab_debugging->Refresh(); break; + case Developer: tab_developer->Refresh(); break; + case Messages: break; + } } for(int i=0;itabBar()->setTabTextColor(i,defaultTabColor); tabs->tabBar()->setTabTextColor(index,QColor(0,0,200,255)); } -//------------------------------------------------------------------------------------------------------------------------------------------------- - -void qDetectorMain::SetDockableMode(bool b){ -#ifdef VERBOSE - cout<<"Setting Dockable Mode to "<setFeatures(QDockWidget::DockWidgetFloatable); - else{ - dockWidgetPlot->setFloating(false); - dockWidgetPlot->setFeatures(QDockWidget::NoDockWidgetFeatures); - } -} //------------------------------------------------------------------------------------------------------------------------------------------------- -void qDetectorMain::OpenSetup(){ -#ifdef VERBOSE - cout<<"Opening Setup"<isFloating()){ if(tabs->currentIndex()== Actions){ @@ -394,8 +442,10 @@ void qDetectorMain::resizeEvent(QResizeEvent* event){ event->accept(); } + //------------------------------------------------------------------------------------------------------------------------------------------------- + void qDetectorMain::EnableTabs(){ #ifdef VERBOSE cout<<"Entering EnableTabs function"<setToolTip(zoomToolTip); } + //------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 537c8b986..568829b24 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -7,6 +7,8 @@ /** Qt Project Class Headers */ #include "qDrawPlot.h" #include "qCloneWidget.h" +#include "qDefs.h" +#include "slsDetector.h" /** Project Class Headers */ #include "slsDetector.h" #include "multiSlsDetector.h" @@ -15,6 +17,7 @@ #include #include #include +#include /** C++ Include Headers */ #include #include @@ -22,7 +25,6 @@ using namespace std; - //------------------------------------------------------------------------------------------------------------------------------------------------- qDrawPlot::qDrawPlot(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){ @@ -73,6 +75,9 @@ void qDrawPlot::SetupWidgetWindow(){ currentPersistency = 0; progress = 0; plotEnable=true; + plotExists=false; + /** This is so that it initially stop and plots */ + running = 1; for(int i=0;iregisterDataCallback(&(GetDataCallBack),this); /** Start acquiring data from server */ + if(!firstTime) pthread_join(gui_acquisition_thread,NULL);//wait until he's finished, ie. exits pthread_create(&gui_acquisition_thread, NULL,DataStartAcquireThread, (void*) this); + firstTime = false; /** This is set here and later reset to zero when all the plotting is done * This is manually done instead of keeping track of thread because * this thread returns immediately after executing the acquire command*/ gui_acquisition_thread_running=1; - cout<<"Started acquiring threaddd"<progressIndex; @@ -332,6 +340,9 @@ int qDrawPlot::GetData(detectorData *data){ void qDrawPlot::setNumMeasurements(int num){ number_of_measurements = num; +#ifdef VERBOSE + cout<<"Setting Number of Measurements to " <stop(); if(plotEnable){ LockLastImageArray(); @@ -392,6 +402,8 @@ void qDrawPlot::UpdatePlot(){ h->Attach(plot1D); } + /**plot exists is false in the beginning, right after cloning and when no plot is checked*/ + plotExists=true; } } @@ -407,14 +419,15 @@ void qDrawPlot::UpdatePlot(){ plot2D->SetZTitle(imageZAxisTitle); plot2D->UpdateNKeepSetRangeIfSet(); //this will keep a "set" z range, and call Plot()->Update(); } + /**plot exists is false in the beginning, right after cloning and when no plot is checked*/ + plotExists=true; } } last_plot_number=lastImageNumber; if(plotEnable) UnlockLastImageArray(); - /** Measurement not over, continue*/ - if(number_of_exposures!=last_plot_number){ + if(number_of_exposures!=currentFrame){//las plot number? plot_update_timer->start(500); } /** if a measurement is over */ @@ -428,7 +441,6 @@ void qDrawPlot::UpdatePlot(){ }/** To start the next measurement*/ else{ StopDaqForGui(); - //StartDaq(false); StartDaq(true); } } @@ -457,7 +469,10 @@ void qDrawPlot::ClonePlot(){ } /** save height to keep maintain same height of plot */ int preheight = height(); + /** create clone */ + /** plotexists is true after calling updateplot*/ + plotExists=false; winClone[i] = new qCloneWidget(this,i,boxPlot->title(),(int)plot_in_scope,plot1D,plot2D,myDet->getFilePath()); if(plot_in_scope==1){ plot1D = new SlsQt1DPlot(boxPlot); @@ -465,7 +480,7 @@ void qDrawPlot::ClonePlot(){ plot1D->SetXTitle(histXAxisTitle.toAscii().constData()); plot1D->SetYTitle(histYAxisTitle.toAscii().constData()); plotLayout->addWidget(plot1D,1,1,1,1); - winClone[i]->SetCloneHists((int)nHists,histNBins,histXAxis,histYAxis,histTitle); + if(running) winClone[i]->SetCloneHists((int)nHists,histNBins,histXAxis,histYAxis,histTitle); } else{ plot2D = new SlsQt2DPlotLayout(boxPlot); @@ -478,8 +493,9 @@ void qDrawPlot::ClonePlot(){ } setMinimumHeight(preheight); resize(width(),preheight); - /** update the actual plot */ - UpdatePlot(); + + /** update the actual plot only if running, else it doesnt know when its over*/ + if(running) UpdatePlot(); connect(this, SIGNAL(InterpolateSignal(bool)), plot2D, SIGNAL(InterpolateSignal(bool))); connect(this, SIGNAL(ContourSignal(bool)), plot2D, SIGNAL(ContourSignal(bool))); connect(this, SIGNAL(LogzSignal(bool)), plot2D, SLOT(SetZScaleToLog(bool))); @@ -509,11 +525,21 @@ void qDrawPlot::CloneCloseEvent(int id){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void qDrawPlot::SavePlot(QString FName){ +void qDrawPlot::SavePlot(){ + /** render image */ QImage img(size().width(),size().height(),QImage::Format_RGB32); QPainter painter(&img); render(&painter); - img.save(FName); + + /** save image*/ + QString fName = QString(myDet->getFilePath().c_str())+"/Image.png"; + fName = QFileDialog::getSaveFileName(this,tr("Save Image"),fName,tr("Images (*.png *.xpm *.jpg)")); + if (!fName.isEmpty()) + if(img.save(fName)) + qDefs::InfoMessage("The Image has been successfully saved","Dock: Information"); + else + qDefs::ErrorMessage("ERROR: Attempt to save image failed. Wrong Format","Dock: WARNING"); + } //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -532,7 +558,10 @@ void qDrawPlot::EnablePlot(bool enable){ #ifdef VERBOSE cout<<"Plotting set to:"<text(),"+")){ */ +//------------------------------------------------------------------------------------------------------------------------------------------------- + +void qTabActions::Refresh(){ + +} + +//------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp index 34e30f2d6..f01985140 100644 --- a/slsDetectorGui/src/qTabAdvanced.cpp +++ b/slsDetectorGui/src/qTabAdvanced.cpp @@ -76,4 +76,13 @@ void qTabAdvanced::getTemperature(){ #endif } +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabAdvanced::Refresh(){ + +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index b51904a23..f860b8541 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -17,6 +17,7 @@ using namespace std; +//------------------------------------------------------------------------------------------------------------------------------------------------- qTabDataOutput::qTabDataOutput(QWidget *parent,slsDetectorUtils*& detector): @@ -27,6 +28,7 @@ qTabDataOutput::qTabDataOutput(QWidget *parent,slsDetectorUtils*& detector): } +//------------------------------------------------------------------------------------------------------------------------------------------------- qTabDataOutput::~qTabDataOutput(){ @@ -34,14 +36,16 @@ qTabDataOutput::~qTabDataOutput(){ } +//------------------------------------------------------------------------------------------------------------------------------------------------- void qTabDataOutput::SetupWidgetWindow(){ - outputDir= QString(myDet->getFilePath().c_str()); - dispOutputDir->setText(outputDir); + dispOutputDir->setText(QString(myDet->getFilePath().c_str())); } +//------------------------------------------------------------------------------------------------------------------------------------------------- + void qTabDataOutput::Initialization(){ connect(dispOutputDir, SIGNAL(textChanged(const QString&)), this, SLOT(setOutputDir(const QString&))); @@ -49,22 +53,29 @@ void qTabDataOutput::Initialization(){ } - -void qTabDataOutput::Enable(bool enable){ - layoutOutput->setEnabled(enable); - boxCorrection->setEnabled(enable); -} +//------------------------------------------------------------------------------------------------------------------------------------------------- void qTabDataOutput::setOutputDir(const QString& path){ - outputDir = path; - myDet->setFilePath(string(outputDir.toAscii().constData())); + myDet->setFilePath(string(path.toAscii().constData())); #ifdef VERBOSE cout<<"Output Directory changed to :"<getFilePath()<setText(QString(myDet->getFilePath().c_str())); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + void qTabDataOutput::browseOutputDir() { QString directory = QFileDialog::getExistingDirectory(this,tr("Choose Output Directory "),dispOutputDir->text()); @@ -73,3 +84,4 @@ void qTabDataOutput::browseOutputDir() } +//------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/slsDetectorGui/src/qTabDebugging.cpp b/slsDetectorGui/src/qTabDebugging.cpp index 8c797b30b..2fa080cc2 100644 --- a/slsDetectorGui/src/qTabDebugging.cpp +++ b/slsDetectorGui/src/qTabDebugging.cpp @@ -48,3 +48,13 @@ void qTabDebugging::Enable(bool enable){ } +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabDebugging::Refresh(){ + +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + diff --git a/slsDetectorGui/src/qTabDeveloper.cpp b/slsDetectorGui/src/qTabDeveloper.cpp index b987fff82..b0fcd68a9 100644 --- a/slsDetectorGui/src/qTabDeveloper.cpp +++ b/slsDetectorGui/src/qTabDeveloper.cpp @@ -41,5 +41,14 @@ void qTabDeveloper::SetupWidgetWindow(){ void qTabDeveloper::Initialization(){ } +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabDeveloper::Refresh(){ + +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index b0da22efe..f434ad6b3 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -302,7 +302,7 @@ void qTabMeasurement::setExposureTime(){ /** Get the value of timer in ns **/ exptimeNS = (int64_t)qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value()); #ifdef VERBOSE - cout<<"Setting acquisition time to " << exptimeNS << " clocks" << endl; + cout<<"Setting acquisition time to " << exptimeNS << " clocks" << "/"<value()<currentIndex())<setTimer(slsDetectorDefs::ACQUISITION_TIME,exptimeNS); @@ -312,12 +312,12 @@ void qTabMeasurement::setExposureTime(){ if(exptimeNS>acqtimeNS) { lblNote->show(); lblPeriod->setPalette(lblNote->palette()); - lblPeriod->setText("* Acquisition Period"); + lblPeriod->setText("Acquisition Period:*"); } else { lblNote->hide(); lblPeriod->setPalette(lblNumFrames->palette()); - lblPeriod->setText("Acquisition Period"); + lblPeriod->setText("Acquisition Period:"); } } } @@ -329,7 +329,7 @@ void qTabMeasurement::setAcquisitionPeriod(){ /** Get the value of timer in ns **/ acqtimeNS = (int64_t)qDefs::getNSTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value()); #ifdef VERBOSE - cout<<"Setting frame period between exposures to " << acqtimeNS << " clocks" << endl; + cout<<"Setting frame period between exposures to " << acqtimeNS << " clocks"<< "/"<value()<currentIndex())<setTimer(slsDetectorDefs::FRAME_PERIOD,acqtimeNS); @@ -338,12 +338,12 @@ void qTabMeasurement::setAcquisitionPeriod(){ if(exptimeNS>acqtimeNS){ lblNote->show(); lblPeriod->setPalette(lblNote->palette()); - lblPeriod->setText("* Acquisition Period"); + lblPeriod->setText("Acquisition Period:*"); } else { lblNote->hide(); lblPeriod->setPalette(lblNumFrames->palette()); - lblPeriod->setText("Acquisition Period"); + lblPeriod->setText("Acquisition Period:"); } } @@ -363,7 +363,7 @@ void qTabMeasurement::setDelay(){ /** Get the value of timer in ns **/ exptimeNS = (int64_t)qDefs::getNSTime((qDefs::timeUnit)comboDelayUnit->currentIndex(),spinDelay->value()); #ifdef VERBOSE - cout<<"Setting delay after trigger to " << exptimeNS << " clocks" << endl; + cout<<"Setting delay after trigger to " << exptimeNS << " clocks"<< "/"<value()<currentIndex())<setTimer(slsDetectorDefs::DELAY_AFTER_TRIGGER,exptimeNS); } @@ -496,7 +496,7 @@ void qTabMeasurement::setTimingMode(int mode){ if(lblExpTime->isEnabled()){ time = qDefs::getCorrectTime(unit,((float)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-9)))); #ifdef VERBOSE - cout<<"Getting acquisition time : " << time << "s" << endl; + cout<<"Getting acquisition time : " << time << qDefs::getUnitString(unit) << endl; #endif spinExpTime->setValue(time); comboExpUnit->setCurrentIndex((int)unit); @@ -506,7 +506,7 @@ void qTabMeasurement::setTimingMode(int mode){ if(lblPeriod->isEnabled()){ time = qDefs::getCorrectTime(unit,((float)(myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,-1)*(1E-9)))); #ifdef VERBOSE - cout<<"Getting frame period between exposures : " << time << "s" << endl; + cout<<"Getting frame period between exposures : " << time << qDefs::getUnitString(unit) << endl; #endif spinPeriod->setValue(time); comboPeriodUnit->setCurrentIndex((int)unit); @@ -517,17 +517,17 @@ void qTabMeasurement::setTimingMode(int mode){ if(exptimeNS>acqtimeNS) { lblNote->show(); lblPeriod->setPalette(lblNote->palette()); - lblPeriod->setText("* Acquisition Period"); + lblPeriod->setText("Acquisition Period:*"); } else { lblNote->hide(); lblPeriod->setPalette(lblNumFrames->palette()); - lblPeriod->setText("Acquisition Period"); + lblPeriod->setText("Acquisition Period:"); } }else { lblNote->hide(); lblPeriod->setPalette(lblNumFrames->palette()); - lblPeriod->setText("Acquisition Period"); + lblPeriod->setText("Acquisition Period:"); } /**Number of Triggers */ @@ -543,7 +543,7 @@ void qTabMeasurement::setTimingMode(int mode){ if(lblDelay->isEnabled()){ time = qDefs::getCorrectTime(unit,((float)(myDet->setTimer(slsDetectorDefs::DELAY_AFTER_TRIGGER,-1)*(1E-9)))); #ifdef VERBOSE - cout<<"Getting delay after trigger : " << time << "s" << endl; + cout<<"Getting delay after trigger : " << time << qDefs::getUnitString(unit) << endl; #endif spinDelay->setValue(time); comboDelayUnit->setCurrentIndex((int)unit); @@ -574,4 +574,22 @@ void qTabMeasurement::setTimingMode(int mode){ } + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabMeasurement::Refresh(){ + /** File Name **/ + dispFileName->setText(QString(myDet->getFileName().c_str())); + /** File Index **/ + spinIndex->setValue(myDet->getFileIndex()); + /** progress label index **/ + lblProgressIndex->setText(QString::number(myDet->getFileIndex())); + /** Progress bar **/ + progressBar->setValue(myDet->getCurrentProgress()); + /** Timing mode**/ + SetupTimingMode();//comboTimingMode->setCurrentIndex((int)myDet->setExternalCommunicationMode()); +} + + //------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/slsDetectorGui/src/qTabMessages.cpp b/slsDetectorGui/src/qTabMessages.cpp index 25894f492..7b1022922 100644 --- a/slsDetectorGui/src/qTabMessages.cpp +++ b/slsDetectorGui/src/qTabMessages.cpp @@ -5,25 +5,26 @@ * Author: l_maliakal_d */ +/** Qt Project Class Headers */ #include "qTabMessages.h" +#include "qDefs.h" /** Project Class Headers */ #include "slsDetector.h" #include "multiSlsDetector.h" /** Qt Include Headers */ #include -#include -#include -#include -#include -#include +#include +#include +#include +#include /** C++ Include Headers */ #include +#include using namespace std; //------------------------------------------------------------------------------------------------------------------------------------------------- -qTabMessages::qTabMessages(QWidget *parent,slsDetectorUtils*& detector): - QWidget(parent),myDet(detector){ +qTabMessages::qTabMessages(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){ SetupWidgetWindow(); Initialization(); } @@ -33,8 +34,6 @@ qTabMessages::qTabMessages(QWidget *parent,slsDetectorUtils*& detector): qTabMessages::~qTabMessages(){ delete myDet; delete dispLog; - delete dispCommand; - delete dispPath; } //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -42,88 +41,71 @@ qTabMessages::~qTabMessages(){ void qTabMessages::SetupWidgetWindow(){ /** Layout */ QGridLayout *gridLayout = new QGridLayout(this); - QLabel *lblCommand = new QLabel("System Command:",this); - QLabel *lblPath = new QLabel("Working Directory:",this); - QSpacerItem *hSpacer= new QSpacerItem(20, 20, QSizePolicy::Fixed, QSizePolicy::Minimum); - dispLog = new QTextEdit(this); - dispCommand = new QLineEdit(this); - dispPath = new QLineEdit(this); - dispLog->setReadOnly(true); - dispPath->setReadOnly(true); - dispLog->setFocusPolicy(Qt::NoFocus); - dispPath->setFocusPolicy(Qt::NoFocus); - gridLayout->addWidget(dispLog, 0, 0, 1, 3); - gridLayout->addWidget(lblCommand, 1, 0, 1, 1); - gridLayout->addItem(hSpacer, 1, 1, 1, 1); - gridLayout->addWidget(dispCommand, 1, 2, 1, 1); - gridLayout->addWidget(lblPath, 2, 0, 1, 1); - gridLayout->addWidget(dispPath, 2, 2, 1, 1); - /** Command & Path*/ - dispCommand->setText("Insert your command here"); - dispPath->setText(QDir("./").absolutePath()); + dispLog = new QTextEdit(this); + dispLog->setReadOnly(true); + dispLog->setFocusPolicy(Qt::NoFocus); + + QSizePolicy sizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); + + btnSave = new QPushButton("Save Log",this); + btnSave->setFocusPolicy(Qt::NoFocus); + btnSave->setSizePolicy(sizePolicy); + + btnClear = new QPushButton("Clear",this); + btnClear->setFocusPolicy(Qt::NoFocus); + btnClear->setSizePolicy(sizePolicy); + + gridLayout->addWidget(btnSave,0,0,1,1); + gridLayout->addWidget(btnClear,0,4,1,1); + gridLayout->addWidget(dispLog,1,0,1,5); + + qout=new qDebugStream(std::cout,this); } //------------------------------------------------------------------------------------------------------------------------------------------------- void qTabMessages::Initialization(){ - connect(dispCommand,SIGNAL(returnPressed()),this,SLOT(executeCommand())); + connect(btnSave,SIGNAL(clicked()),this,SLOT(SaveLog())); + connect(btnClear,SIGNAL(clicked()),this,SLOT(ClearLog())); } //------------------------------------------------------------------------------------------------------------------------------------------------- -void qTabMessages::executeCommand(){ -#ifdef VERBOSE - cout<<"Calling: "<< dispCommand->text().toAscii().constData()<text()).absolutePath()); -#ifdef VERBOSE - //std::cout <<"working directory is " << proc.workingDirectory().absPath() << std::endl; - cout<<"Current Working Directory: "<text())); -#ifdef VERBOSE -/* QStringList list = proc.arguments(); - QStringList::Iterator it = list.begin(); - while( it != list.end() ) { - cout<<*it<type() == STREAMEVENT) + dispLog->append(((qStreamEvent*)e)->getString()); } +//------------------------------------------------------------------------------------------------------------------------------------------------- + +void qTabMessages::SaveLog() { + QString fName = QString(myDet->getFilePath().c_str()); + fName = fName+"/LogFile.txt"; + fName = QFileDialog::getSaveFileName(this,tr("Save Snapshot "), + fName,tr("Text files (*.txt)")); + if (!fName.isEmpty()){ + QFile outfile; + outfile.setFileName(fName); + if(outfile.open(QIODevice::WriteOnly | QIODevice::Text)){//Append + QTextStream out(&outfile); + out<toPlainText() << endl; + qDefs::InfoMessage(string("The Log has been successfully saved to " + "")+fName.toAscii().constData(),"Messages: Information"); + } + else qDefs::ErrorMessage("ERROR: Attempt to save log file failed.","Messages: WARNING"); + } +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + +void qTabMessages::ClearLog() { + dispLog->clear(); +#ifdef VERBOSE + cout<<"Log Cleared"< #include using namespace std; +//------------------------------------------------------------------------------------------------------------------------------------------------- QString qTabPlot::defaultPlotTitle("Measurement"); @@ -26,6 +28,9 @@ QString qTabPlot::defaultImageYAxisTitle("Pixel"); QString qTabPlot::defaultImageZAxisTitle("Intensity"); +//------------------------------------------------------------------------------------------------------------------------------------------------- + + qTabPlot::qTabPlot(QWidget *parent,slsDetectorUtils*& detector, qDrawPlot*& plot):QWidget(parent),myDet(detector),myPlot(plot){ setupUi(this); SetupWidgetWindow(); @@ -42,6 +47,7 @@ qTabPlot::qTabPlot(QWidget *parent,slsDetectorUtils*& detector, qDrawPlot*& plot } +//------------------------------------------------------------------------------------------------------------------------------------------------- qTabPlot::~qTabPlot(){ @@ -50,6 +56,7 @@ qTabPlot::~qTabPlot(){ } +//------------------------------------------------------------------------------------------------------------------------------------------------- void qTabPlot::SetupWidgetWindow(){ @@ -75,8 +82,11 @@ void qTabPlot::SetupWidgetWindow(){ } +//------------------------------------------------------------------------------------------------------------------------------------------------- + + void qTabPlot::Select1DPlot(bool b){ - SetupWidgetWindow(); + isOneD = b; if(b){ box1D->setEnabled(true); box2D->setEnabled(false); @@ -105,9 +115,16 @@ void qTabPlot::Select1DPlot(bool b){ } +//------------------------------------------------------------------------------------------------------------------------------------------------- + + void qTabPlot::Initialization(){ /** Plot arguments box*/ - connect(chkNoPlot, SIGNAL(toggled(bool)),myPlot, SLOT(EnablePlot(bool))); + connect(radioNoPlot, SIGNAL(clicked()),this, SLOT(SetPlot())); + connect(radioHistogram, SIGNAL(clicked()),this, SLOT(SetPlot())); + connect(radioDataGraph, SIGNAL(clicked()),this, SLOT(SetPlot())); +/** Scan box*/ + //connect(radioNoPlot, SIGNAL(toggled(bool)),this, SLOT(EnablePlot(bool))); /** Snapshot box*/ connect(btnClone, SIGNAL(clicked()),myPlot, SLOT(ClonePlot())); connect(btnCloseClones, SIGNAL(clicked()),myPlot, SLOT(CloseClones())); @@ -147,21 +164,13 @@ void qTabPlot::Initialization(){ connect(this, SIGNAL(SetZRangeSignal(double,double)),myPlot, SIGNAL(SetZRangeSignal(double,double))); /** Common Buttons*/ - connect(btnClear, SIGNAL(clicked()), myPlot, SLOT(Clear1DPlot())); /** Save */ - connect(btnSave, SIGNAL(clicked()), this, SLOT(SavePlot())); - + connect(btnSave, SIGNAL(clicked()), myPlot, SLOT(SavePlot())); } +//------------------------------------------------------------------------------------------------------------------------------------------------- -void qTabPlot::Enable(bool enable){ - btnClone->setEnabled(enable); - btnCloseClones->setEnabled(enable); - box1D->setEnabled(enable); - box2D->setEnabled(enable); - boxPlotAxis->setEnabled(enable); -} void qTabPlot::EnablePersistency(bool enable){ lblPersistency->setEnabled(enable); @@ -172,19 +181,21 @@ void qTabPlot::EnablePersistency(bool enable){ } +//------------------------------------------------------------------------------------------------------------------------------------------------- + + void qTabPlot::SetTitles(){ - int oneD = box1D->isEnabled(); /** Plot Title*/ if(dispTitle->isEnabled()) myPlot->SetPlotTitle(dispTitle->text()); /** X Axis */ if(dispXAxis->isEnabled()){ - if(oneD) myPlot->SetHistXAxisTitle(dispXAxis->text()); + if(isOneD) myPlot->SetHistXAxisTitle(dispXAxis->text()); else myPlot->SetImageXAxisTitle(dispXAxis->text()); } /** Y Axis */ if(dispYAxis->isEnabled()){ - if(oneD) myPlot->SetHistYAxisTitle(dispYAxis->text()); + if(isOneD) myPlot->SetHistYAxisTitle(dispYAxis->text()); else myPlot->SetImageYAxisTitle(dispYAxis->text()); } /** Z Axis */ @@ -193,9 +204,10 @@ void qTabPlot::SetTitles(){ } +//------------------------------------------------------------------------------------------------------------------------------------------------- + void qTabPlot::EnableTitles(){ - int oneD = box1D->isEnabled(); /** Plot Title*/ dispTitle->setEnabled(chkTitle->isChecked()); if(!chkTitle->isChecked()){ @@ -205,7 +217,7 @@ void qTabPlot::EnableTitles(){ /** X Axis */ dispXAxis->setEnabled(chkXAxis->isChecked()); if(!chkXAxis->isChecked()){ - if(oneD){ + if(isOneD){ myPlot->SetHistXAxisTitle(defaultHistXAxisTitle); dispXAxis->setText(defaultHistXAxisTitle); } @@ -217,7 +229,7 @@ void qTabPlot::EnableTitles(){ /** Y Axis */ dispYAxis->setEnabled(chkYAxis->isChecked()); if(!chkYAxis->isChecked()){ - if(oneD){ + if(isOneD){ myPlot->SetHistYAxisTitle(defaultHistYAxisTitle); dispYAxis->setText(defaultHistYAxisTitle); }else{ @@ -234,6 +246,7 @@ void qTabPlot::EnableTitles(){ } +//------------------------------------------------------------------------------------------------------------------------------------------------- void qTabPlot::EnableRange(){ @@ -253,6 +266,8 @@ void qTabPlot::EnableRange(){ } +//------------------------------------------------------------------------------------------------------------------------------------------------- + void qTabPlot::SetAxesRange(){ double xmin=0,xmax=0,ymin=0,ymax=0; @@ -260,28 +275,40 @@ void qTabPlot::SetAxesRange(){ /** If disabled, get the min or max range of the plot as default */ if((dispXMin->isEnabled())&&(!dispXMin->text().isEmpty())) xmin = dispXMin->text().toDouble(); - else xmin = myPlot->GetXMinimum(); + else if(myPlot->DoesPlotExist()) + xmin = myPlot->GetXMinimum(); if((dispXMax->isEnabled())&&(!dispXMax->text().isEmpty())) xmax = dispXMax->text().toDouble(); - else xmax = myPlot->GetXMaximum(); + else if(myPlot->DoesPlotExist()) + xmax = myPlot->GetXMaximum(); if((dispYMin->isEnabled())&&(!dispYMin->text().isEmpty())) ymin = dispYMin->text().toDouble(); - else ymin = myPlot->GetYMinimum(); + else if(myPlot->DoesPlotExist()) + ymin = myPlot->GetYMinimum(); if((dispYMax->isEnabled())&&(!dispYMax->text().isEmpty())) ymax = dispYMax->text().toDouble(); - else ymax = myPlot->GetYMaximum(); + else if(myPlot->DoesPlotExist()) + ymax = myPlot->GetYMaximum(); /** Setting the range*/ - myPlot->SetXMinMax(xmin,xmax); - myPlot->SetYMinMax(ymin,ymax); + if(myPlot->DoesPlotExist()){ + myPlot->SetXMinMax(xmin,xmax); + myPlot->SetYMinMax(ymin,ymax); + } } +//------------------------------------------------------------------------------------------------------------------------------------------------- + void qTabPlot::SetZRange(){ emit SetZRangeSignal(dispZMin->text().toDouble(),dispZMax->text().toDouble()); } + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + void qTabPlot::EnableZRange(){ dispZMin->setEnabled(chkZMin->isChecked()); dispZMax->setEnabled(chkZMax->isChecked()); @@ -289,9 +316,48 @@ void qTabPlot::EnableZRange(){ } +//------------------------------------------------------------------------------------------------------------------------------------------------- -void qTabPlot::SavePlot(){ - QString fullFileName = QString(myDet->getFilePath().c_str())+'/'+dispFName->text()+comboFormat->currentText(); - myPlot->SavePlot(fullFileName); + +void qTabPlot::SetPlot(){ + if(radioNoPlot->isChecked()){ + myPlot->EnablePlot(false); + /**if enable is true, disable everything */ + box1D->setEnabled(false); + box2D->setEnabled(false); + boxSnapshot->setEnabled(false); + boxSave->setEnabled(false); + boxPlotAxis->setEnabled(false); + boxScan->setEnabled(false); + }else if(radioHistogram->isChecked()){ + myPlot->EnablePlot(true); + /**if enable is true, disable everything */ + box1D->setEnabled(true); + box2D->setEnabled(true); + boxSnapshot->setEnabled(true); + boxSave->setEnabled(true); + boxPlotAxis->setEnabled(true); + boxScan->setEnabled(false); + }else{ + myPlot->EnablePlot(true); + /**if enable is true, disable everything */ + box1D->setEnabled(true); + box2D->setEnabled(true); + boxSnapshot->setEnabled(true); + boxSave->setEnabled(true); + boxPlotAxis->setEnabled(true); + boxScan->setEnabled(true); + } } + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabPlot::EnableHistogram(bool enable){ + //boxScan->setEnabled(false); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + diff --git a/slsDetectorGui/src/qTabSettings.cpp b/slsDetectorGui/src/qTabSettings.cpp index 19f0be9ed..8624b70b5 100644 --- a/slsDetectorGui/src/qTabSettings.cpp +++ b/slsDetectorGui/src/qTabSettings.cpp @@ -148,3 +148,13 @@ void qTabSettings::setSettings(int index){ } //------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabSettings::Refresh(){ + /** Settings */ + SetupDetectorSettings(); + comboSettings->setCurrentIndex(myDet->getSettings(detID)); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- From 6fb45c6c4be569fddc0fa3b6a4ecade82aeb792c Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 4 Jul 2012 15:09:29 +0000 Subject: [PATCH 017/332] set current measurement dont work git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@17 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_measurement.ui | 68 +++++++++++++++++++- slsDetectorGui/include/qDrawPlot.h | 3 +- slsDetectorGui/include/qTabMeasurement.h | 5 +- slsDetectorGui/src/qDetectorMain.cpp | 33 +++++----- slsDetectorGui/src/qDrawPlot.cpp | 3 +- slsDetectorGui/src/qTabMeasurement.cpp | 51 +++++++++++++-- slsDetectorGui/src/qTabPlot.cpp | 8 +-- 7 files changed, 139 insertions(+), 32 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_measurement.ui b/slsDetectorGui/forms/form_tab_measurement.ui index dfc25baf8..b3a67bf20 100644 --- a/slsDetectorGui/forms/form_tab_measurement.ui +++ b/slsDetectorGui/forms/form_tab_measurement.ui @@ -255,7 +255,7 @@ 35 10 - 322 + 326 321 @@ -834,6 +834,9 @@ + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + @@ -855,7 +858,7 @@ - + @@ -879,7 +882,7 @@ - + @@ -911,6 +914,65 @@ + + + + + 0 + 0 + + + + + 60 + 0 + + + + + + + + + 0 + 0 + 127 + + + + + + + + + 0 + 0 + 127 + + + + + + + + + 193 + 193 + 193 + + + + + + + + 0 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index 7dccad63c..5138cf023 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -40,8 +40,8 @@ public: /** Destructor */ ~qDrawPlot(); + /**is an acquisition running */ bool isRunning(){return running;}; - /** Number of x axis pixels */ int GetPixelsX(){return nPixelsX;}; /** Number of y axis pixels */ @@ -257,6 +257,7 @@ void ContourSignal(bool); void LogzSignal(bool); void SetZRangeSignal(double,double); void EnableZRangeSignal(bool); +void SetCurrentMeasurementSignal(int); }; diff --git a/slsDetectorGui/include/qTabMeasurement.h b/slsDetectorGui/include/qTabMeasurement.h index ee133c581..447c4ff02 100644 --- a/slsDetectorGui/include/qTabMeasurement.h +++ b/slsDetectorGui/include/qTabMeasurement.h @@ -85,7 +85,10 @@ public slots: */ void UpdateFinished(); - +/** updates the current measurement + * @param val the value to be updated + */ +void SetCurrentMeasurement(int val); private slots: /** Set file name diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 5da201b2a..aa8a1bffb 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -206,29 +206,26 @@ void qDetectorMain::SetUpDetector(){ void qDetectorMain::Initialization(){ /** Dockable Plot*/ - connect(dockWidgetPlot,SIGNAL(topLevelChanged(bool)),this,SLOT(ResizeMainWindow(bool))); - + connect(dockWidgetPlot, SIGNAL(topLevelChanged(bool)), this,SLOT(ResizeMainWindow(bool))); /** tabs */ - connect(tabs,SIGNAL(currentChanged(int)),this, SLOT(Refresh(int)));//( QWidget*))); + connect(tabs, SIGNAL(currentChanged(int)), this, SLOT(Refresh(int)));//( QWidget*))); /** Measurement tab*/ + connect(tab_measurement, SIGNAL(StartSignal()), this,SLOT(EnableTabs())); + connect(tab_measurement, SIGNAL(StopSignal()), this,SLOT(EnableTabs())); /** Plot tab */ - connect(tab_plot,SIGNAL(DisableZoomSignal(bool)),this, SLOT(SetZoomToolTip(bool))); - + connect(tab_plot, SIGNAL(DisableZoomSignal(bool)), this,SLOT(SetZoomToolTip(bool))); /** Plotting */ - /** When the acquisition is finished, must update the meas tab */ - connect(tab_measurement, SIGNAL(StartSignal()), this,SLOT(EnableTabs())); - connect(tab_measurement, SIGNAL(StopSignal()), this,SLOT(EnableTabs())); - connect(myPlot, SIGNAL(UpdatingPlotFinished()), this,SLOT(EnableTabs())); - connect(myPlot, SIGNAL(UpdatingPlotFinished()), tab_measurement,SLOT(UpdateFinished())); - - + /** 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 */ - connect(menuModes,SIGNAL(triggered(QAction*)),SLOT(EnableModes(QAction*))); - /** Utilities Menu */ - connect(menuUtilities,SIGNAL(triggered(QAction*)),SLOT(ExecuteUtilities(QAction*))); - /** Help Menu */ - connect(menuHelp,SIGNAL(triggered(QAction*)),SLOT(ExecuteHelp(QAction*))); + /** Modes Menu */ + connect(menuModes, SIGNAL(triggered(QAction*)), this,SLOT(EnableModes(QAction*))); + /** Utilities Menu */ + connect(menuUtilities, SIGNAL(triggered(QAction*)), this,SLOT(ExecuteUtilities(QAction*))); + /** Help Menu */ + connect(menuHelp, SIGNAL(triggered(QAction*)), this,SLOT(ExecuteHelp(QAction*))); } diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 568829b24..71808c29a 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -158,6 +158,7 @@ void qDrawPlot::StartStopDaqToggle(bool stop_if_running){ /**Do the following only once before each n measurements */ /** Reset Current Measurement */ currentMeasurement = 0; + emit SetCurrentMeasurementSignal(currentMeasurement); /** Number of Exposures */ number_of_exposures= (int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1); cout<<"\tNumber of Exposures:"<setExternalCommunicationMode(); @@ -148,8 +155,10 @@ void qTabMeasurement::SetupTimingMode(){ } } + //------------------------------------------------------------------------------------------------------------------------------------------------- + void qTabMeasurement::Initialization(int timingChange){ /** These signals are connected only at start up. The others are reinitialized when changing timing mode*/ if(!timingChange){ @@ -183,11 +192,12 @@ void qTabMeasurement::Initialization(int timingChange){ connect(spinNumGates,SIGNAL(valueChanged(int)), this, SLOT(setNumGates(int)));// /** Number of Probes**/ connect(spinNumProbes,SIGNAL(valueChanged(int)), this, SLOT(setNumProbes(int)));// - } + //------------------------------------------------------------------------------------------------------------------------------------------------- + void qTabMeasurement::DeInitialization(){ /** Number of Frames**/ disconnect(spinNumFrames,SIGNAL(valueChanged(int)), this, SLOT(setNumFrames(int))); @@ -208,8 +218,10 @@ void qTabMeasurement::DeInitialization(){ disconnect(spinNumProbes,SIGNAL(valueChanged(int)), this, SLOT(setNumProbes(int))); } + //------------------------------------------------------------------------------------------------------------------------------------------------- + void qTabMeasurement::Enable(bool enable){ frameTimeResolved->setEnabled(enable); frameNotTimeResolved->setEnabled(enable); @@ -217,8 +229,10 @@ void qTabMeasurement::Enable(bool enable){ if(!enable) btnStartStop->setEnabled(true); } + //------------------------------------------------------------------------------------------------------------------------------------------------- + void qTabMeasurement::setFileName(const QString& fName){ myDet->setFileName(fName.toAscii().data()); #ifdef VERBOSE @@ -226,6 +240,7 @@ void qTabMeasurement::setFileName(const QString& fName){ #endif } + //------------------------------------------------------------------------------------------------------------------------------------------------- void qTabMeasurement::setRunIndex(int index){ @@ -238,6 +253,7 @@ void qTabMeasurement::setRunIndex(int index){ //------------------------------------------------------------------------------------------------------------------------------------------------- + void qTabMeasurement::startStopAcquisition(){ if(!btnStartStop->text().compare("Start")){ #ifdef VERBOSE @@ -265,8 +281,10 @@ void qTabMeasurement::startStopAcquisition(){ myPlot->StartStopDaqToggle(); } + //------------------------------------------------------------------------------------------------------------------------------------------------- + void qTabMeasurement::UpdateFinished(){ disconnect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); btnStartStop->setText("Start"); @@ -278,15 +296,28 @@ void qTabMeasurement::UpdateFinished(){ progressTimer->stop(); } + //------------------------------------------------------------------------------------------------------------------------------------------------- + +void SetCurrentMeasurement(int val){ + lblCurrentMeasurement->setText("0u");//lblCurrentMeasurement->setText(QString::number(val)); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + void qTabMeasurement::UpdateProgress(){ + progressBar->setValue(myPlot->GetProgress()); lblProgressIndex->setText(QString::number(myDet->getFileIndex())); } + //------------------------------------------------------------------------------------------------------------------------------------------------- + void qTabMeasurement::setNumFrames(int val){ myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,val); #ifdef VERBOSE @@ -295,8 +326,10 @@ void qTabMeasurement::setNumFrames(int val){ } + //------------------------------------------------------------------------------------------------------------------------------------------------- + void qTabMeasurement::setExposureTime(){ int64_t exptimeNS; /** Get the value of timer in ns **/ @@ -322,8 +355,10 @@ void qTabMeasurement::setExposureTime(){ } } + //------------------------------------------------------------------------------------------------------------------------------------------------- + void qTabMeasurement::setAcquisitionPeriod(){ int64_t acqtimeNS; /** Get the value of timer in ns **/ @@ -347,8 +382,10 @@ void qTabMeasurement::setAcquisitionPeriod(){ } } + //------------------------------------------------------------------------------------------------------------------------------------------------- + void qTabMeasurement::setNumTriggers(int val){ myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,val); #ifdef VERBOSE @@ -356,8 +393,10 @@ void qTabMeasurement::setNumTriggers(int val){ #endif } + //------------------------------------------------------------------------------------------------------------------------------------------------- + void qTabMeasurement::setDelay(){ int64_t exptimeNS; /** Get the value of timer in ns **/ @@ -368,8 +407,10 @@ void qTabMeasurement::setDelay(){ myDet->setTimer(slsDetectorDefs::DELAY_AFTER_TRIGGER,exptimeNS); } + //------------------------------------------------------------------------------------------------------------------------------------------------- + void qTabMeasurement::setNumGates(int val){ myDet->setTimer(slsDetectorDefs::GATES_NUMBER,val); #ifdef VERBOSE @@ -377,8 +418,10 @@ void qTabMeasurement::setNumGates(int val){ #endif } + //------------------------------------------------------------------------------------------------------------------------------------------------- + void qTabMeasurement::setNumProbes(int val){ myDet->setTimer(slsDetectorDefs::PROBES_NUMBER,val); #ifdef VERBOSE @@ -386,8 +429,10 @@ void qTabMeasurement::setNumProbes(int val){ #endif } + //------------------------------------------------------------------------------------------------------------------------------------------------- + void qTabMeasurement::setTimingMode(int mode){ #ifdef VERBOSE cout<<"Setting Timing mode to " << comboTimingMode->currentText().toAscii().data()<setText(QString::number(myDet->getFileIndex())); /** Progress bar **/ - progressBar->setValue(myDet->getCurrentProgress()); + progressBar->setValue((int)myDet->getCurrentProgress()); /** Timing mode**/ SetupTimingMode();//comboTimingMode->setCurrentIndex((int)myDet->setExternalCommunicationMode()); } diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index f1e1d3799..1ff770e16 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -332,8 +332,8 @@ void qTabPlot::SetPlot(){ }else if(radioHistogram->isChecked()){ myPlot->EnablePlot(true); /**if enable is true, disable everything */ - box1D->setEnabled(true); - box2D->setEnabled(true); + box1D->setEnabled(isOneD); + box2D->setEnabled(!isOneD); boxSnapshot->setEnabled(true); boxSave->setEnabled(true); boxPlotAxis->setEnabled(true); @@ -341,8 +341,8 @@ void qTabPlot::SetPlot(){ }else{ myPlot->EnablePlot(true); /**if enable is true, disable everything */ - box1D->setEnabled(true); - box2D->setEnabled(true); + box1D->setEnabled(isOneD); + box2D->setEnabled(!isOneD); boxSnapshot->setEnabled(true); boxSave->setEnabled(true); boxPlotAxis->setEnabled(true); From d2b9b6ae1dd9cc05028d892b4aadd7daabe3de56 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 11 Jul 2012 17:06:12 +0000 Subject: [PATCH 018/332] interval between plots work git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@18 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_dataoutput.ui | 10 +- slsDetectorGui/forms/form_tab_measurement.ui | 159 +- slsDetectorGui/forms/form_tab_plot.ui | 1493 +++++++++++------- slsDetectorGui/include/qDefs.h | 43 +- slsDetectorGui/include/qDrawPlot.h | 112 +- slsDetectorGui/include/qTabMeasurement.h | 9 + slsDetectorGui/include/qTabMessages.h | 2 + slsDetectorGui/include/qTabPlot.h | 18 +- slsDetectorGui/src/qCloneWidget.cpp | 7 +- slsDetectorGui/src/qDetectorMain.cpp | 20 +- slsDetectorGui/src/qDrawPlot.cpp | 167 +- slsDetectorGui/src/qTabMeasurement.cpp | 98 +- slsDetectorGui/src/qTabMessages.cpp | 5 +- slsDetectorGui/src/qTabPlot.cpp | 179 ++- slsDetectorGui/src/qTabSettings.cpp | 6 +- 15 files changed, 1487 insertions(+), 841 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_dataoutput.ui b/slsDetectorGui/forms/form_tab_dataoutput.ui index 82f060c07..f36c57116 100644 --- a/slsDetectorGui/forms/form_tab_dataoutput.ui +++ b/slsDetectorGui/forms/form_tab_dataoutput.ui @@ -6,7 +6,7 @@ 0 0 - 734 + 775 339 @@ -36,7 +36,7 @@ 20 75 - 691 + 731 206 @@ -48,7 +48,7 @@ 10 20 - 671 + 711 181 @@ -174,7 +174,7 @@ 19 20 - 701 + 746 41 @@ -189,7 +189,7 @@ 0 6 - 691 + 731 28 diff --git a/slsDetectorGui/forms/form_tab_measurement.ui b/slsDetectorGui/forms/form_tab_measurement.ui index b3a67bf20..c1e0dc1da 100644 --- a/slsDetectorGui/forms/form_tab_measurement.ui +++ b/slsDetectorGui/forms/form_tab_measurement.ui @@ -137,9 +137,9 @@ - 189 - 189 - 189 + 0 + 0 + 0 @@ -153,9 +153,9 @@ 30 - 179 + 153 319 - 90 + 116 @@ -174,7 +174,7 @@ 10 - 50 + 75 300 23 @@ -187,7 +187,7 @@ 10 - 30 + 25 91 16 @@ -200,7 +200,7 @@ 100 - 31 + 25 101 16 @@ -209,6 +209,47 @@ 0 + + + + 150 + 45 + 76 + 16 + + + + + 0 + 0 + + + + + 60 + 0 + + + + 0 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + 10 + 45 + 136 + 16 + + + + Current Measurement: + + @@ -291,6 +332,9 @@ + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + @@ -330,6 +374,9 @@ Frame period between exposures. #period# + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + 9 @@ -352,6 +399,9 @@ 0 + + Qt::LeftToRight + 2 @@ -424,6 +474,9 @@ + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + @@ -475,6 +528,9 @@ + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + @@ -581,6 +637,9 @@ + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + @@ -620,8 +679,11 @@ Exposure time of each frame. #exptime# + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + - 9 + 5 0.000000000000000 @@ -645,6 +707,9 @@ 0 + + Qt::LeftToRight + 2 @@ -705,8 +770,11 @@ Frame period between exposures. #period# + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + - 9 + 5 2000000000.000000000000000 @@ -727,6 +795,9 @@ 0 + + Qt::LeftToRight + 2 @@ -816,7 +887,7 @@ - + @@ -835,7 +906,7 @@ - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter @@ -878,7 +949,7 @@ - Run Index: + Start Run Index: @@ -900,6 +971,9 @@ + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + @@ -914,65 +988,6 @@ - - - - - 0 - 0 - - - - - 60 - 0 - - - - - - - - - 0 - 0 - 127 - - - - - - - - - 0 - 0 - 127 - - - - - - - - - 193 - 193 - 193 - - - - - - - - 0 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index fdd0b5018..5d3607950 100644 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -28,15 +28,602 @@ 1000 + + + + + + + 0 + 0 + 30 + + + + + + + + + 0 + 0 + 30 + + + + + + + + + 0 + 0 + 30 + + + + + + Form + + + true + + + + 15 + 70 + 371 + 51 + + + + 2D Plot Options + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + false + + + + + 10 + 20 + 361 + 26 + + + + + + + + 0 + 0 + + + + Interpolate + + + + + + + + 0 + 0 + + + + Contour + + + + + + + + 0 + 0 + + + + Log Scale (Z) + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 33 + 20 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 33 + 20 + + + + + + + + + + + 15 + 70 + 371 + 51 + + + + 1D Plot Options + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + false + + + + + 10 + 20 + 356 + 26 + + + + + + + + 0 + 0 + + + + Superimpose + + + false + + + + + + + + 0 + 0 + + + + Line + + + + + + + + 0 + 0 + + + + Points + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 150 + 10 + + + + + + + + + + 118 + 20 + 126 + 23 + + + + + 1 + + + + + false + + + + 0 + 0 + + + + Persistency: + + + + + + + false + + + + 0 + 0 + + + + + 40 + 16777215 + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + 1 + + + 10 + + + 1 + + + + + + + + + + 410 + 70 + 351 + 51 + + + + Save Image + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + false + + + + + 80 + 20 + 271 + 26 + + + + + 0 + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 30 + 20 + + + + + + + + + 0 + 0 + + + + Automatic File Name + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 18 + 20 + + + + + + + + + 0 + 0 + + + + Save All + + + + + + + + + 11 + 19 + 70 + 25 + + + + + 0 + 0 + + + + + 70 + 16777215 + + + + + + + + + 20 + 20 + 20 + + + + + + + + + 20 + 20 + 20 + + + + + + + + + 20 + 20 + 20 + + + + + + + + Qt::NoFocus + + + Save + + + + + + + 410 + 5 + 351 + 51 + + + + Scan - Y Axis Values + + + true + + + false + + + + + 10 + 20 + 337 + 26 + + + + + 0 + + + + + + 0 + 0 + + + + Level 0 + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 11 + 10 + + + + + + + + + 0 + 0 + + + + Level 1 + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 11 + 10 + + + + + + + + + 0 + 0 + + + + File Index + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 11 + 10 + + + + + + + + + 0 + 0 + + + + All Frames + + + true + + + + + + - 10 + 15 200 - 751 + 746 141 @@ -54,7 +641,7 @@ 10 15 - 731 + 726 121 @@ -405,495 +992,15 @@ - - - true - - - - 430 - 70 - 331 - 51 - - - - 2D Plot Options - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - false - - - - - 10 - 20 - 321 - 22 - - - - - - - - 0 - 0 - - - - Interpolate - - - - - - - - 0 - 0 - - - - Contour - - - - - - - - 0 - 0 - - - - Log Scale (Z) - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 10 - 20 - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 10 - 20 - - - - - - - - - - - 10 - 70 - 391 - 51 - - - - 1D Plot Options - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - false - - - - - 10 - 20 - 376 - 21 - - - - - - - - 0 - 0 - - - - Superimpose - - - false - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 5 - 10 - - - - - - - - - 0 - 0 - - - - Line - - - - - - - - 0 - 0 - - - - Points - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 10 - 10 - - - - - - - - 1 - - - - - false - - - - 0 - 0 - - - - Persistency: - - - - - - - false - - - - 0 - 0 - - - - - 40 - 16777215 - - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - 1 - - - 10 - - - 1 - - - - - - - - - - - - 10 - 135 - 391 - 51 - - - - Save Image - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - false - - - - - 10 - 15 - 382 - 31 - - - - - - - - 0 - 0 - - - - Qt::NoFocus - - - Save - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 40 - 20 - - - - - - - - Automatic File Name - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - Save All - - - - - - - - - true - - - - 430 - 135 - 331 - 51 - - - - Snapshot - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - false - - - - - 10 - 15 - 311 - 31 - - - - - - - - 0 - 0 - - - - Qt::NoFocus - - - Create - - - false - - - - - - - - 0 - 0 - - - - Qt::NoFocus - - - Close All - - - false - - - - - - - - 0 - 0 - - - - Qt::NoFocus - - - Save All - - - false - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 30 - 20 - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 30 - 20 - - - - - - - true - 10 - 10 - 391 + 15 + 5 + 371 51 @@ -911,8 +1018,8 @@ 10 20 - 381 - 23 + 361 + 26 @@ -968,7 +1075,7 @@ - 50 + 45 10 @@ -984,7 +1091,7 @@ - 50 + 45 10 @@ -993,52 +1100,316 @@ - + - 430 - 10 - 331 - 51 + 15 + 137 + 371 + 49 - Scan - Y Axis Values + Interval between Plots - - true + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - + false - + - 11 - 20 - 316 - 23 + 10 + 16 + 351 + 26 - + 0 - + - + 0 0 - - Level 0 + + + 150 + 0 + + + + 16777215 + 16777215 + + + + + + + + + 11 + 11 + 11 + + + + + + + 20 + 20 + 20 + + + + + + + + + 11 + 11 + 11 + + + + + + + 20 + 20 + 20 + + + + + + + + + 119 + 119 + 119 + + + + + + + 20 + 20 + 20 + + + + + + + + 0 + + + + Time Interval + + + + + Every nth Image + + - + + + Qt::Horizontal + + + QSizePolicy::Preferred + + + + 80 + 20 + + + + + + + + + 0 + 0 + + + + + 140 + 21 + + + + + + + + + + true + + + + 410 + 135 + 351 + 51 + + + + Snapshot + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + false + + + + + 10 + 15 + 336 + 31 + + + + + + + + 0 + 0 + + + + + + + + + 20 + 20 + 20 + + + + + + + + + 20 + 20 + 20 + + + + + + + + + 20 + 20 + 20 + + + + + + + + Qt::NoFocus + + + Create + + + false + + + + + + + + 0 + 0 + + + + + + + + + 20 + 20 + 20 + + + + + + + + + 20 + 20 + 20 + + + + + + + + + 20 + 20 + 20 + + + + + + + + Qt::NoFocus + + + Close All + + + false + + + + + Qt::Horizontal @@ -1047,27 +1418,14 @@ - 5 - 10 + 40 + 20 - - - - - 0 - 0 - - - - Level 1 - - - - - + + Qt::Horizontal @@ -1076,54 +1434,65 @@ - 5 - 10 + 40 + 20 - - + + - + 0 0 - - File Index + + + + + + + 20 + 20 + 20 + + + + + + + + + 20 + 20 + 20 + + + + + + + + + 20 + 20 + 20 + + + + + - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 5 - 10 - - - - - - - - - 0 - 0 - + + Qt::NoFocus - All Frames + Save All - - true + + false diff --git a/slsDetectorGui/include/qDefs.h b/slsDetectorGui/include/qDefs.h index 5167465a4..e094b4edc 100644 --- a/slsDetectorGui/include/qDefs.h +++ b/slsDetectorGui/include/qDefs.h @@ -57,8 +57,8 @@ public: * @param value time * returns time value in ns */ - static float getNSTime(timeUnit unit, float value){ - float valueNS=value; + static double getNSTime(timeUnit unit, double value){ + double valueNS=value; switch(unit){ case HOURS: valueNS*=60; case MINUTES: valueNS*=60; @@ -78,12 +78,12 @@ public: * @param value time in seconds * returns the corresponding time value */ - static float getCorrectTime(timeUnit& unit, float value){ + static double getCorrectTime(timeUnit& unit, double value){ int intUnit = (int)SECONDS; /** hr, min, sec */ if(value>=1){ - float newVal = value; + double newVal = value; while((newVal>=1)&&(intUnit>=(int)HOURS)){ /** value retains the old value */ value = newVal; @@ -105,16 +105,31 @@ public: } }; +//------------------------------------------------------------------------------------------------------------------------------------------------- + + /**displays an warning message + * @param warningMessage the message to be displayed + * @param source is the tab or the source of the warning + * */ + static void WarningMessage(string warningMessage,string source) + { + static QMessageBox* warningBox; + source.append(": WARNING"); + warningBox= new QMessageBox(QMessageBox::Warning,source.c_str(),tr(warningMessage.c_str()),QMessageBox::Ok, warningBox); + warningBox->exec(); + } + //------------------------------------------------------------------------------------------------------------------------------------------------- /**displays an error message * @param errorMessage the message to be displayed * @param source is the tab or the source of the error * */ - static void ErrorMessage(string errorMessage,char source[]) + static void ErrorMessage(string errorMessage,string source) { static QMessageBox* errorBox; - errorBox= new QMessageBox(QMessageBox::Warning,source,tr(errorMessage.c_str()),QMessageBox::Ok, errorBox); + source.append(": ERROR"); + errorBox= new QMessageBox(QMessageBox::Critical,source.c_str(),tr(errorMessage.c_str()),QMessageBox::Ok, errorBox); errorBox->exec(); } @@ -124,13 +139,25 @@ public: * @param infoMessage the message to be displayed * @param source is the tab or the source of the information * */ - static void InfoMessage(string infoMessage,char source[]) + static void InfoMessage(string infoMessage,string source) { static QMessageBox* msgBox; - msgBox= new QMessageBox(QMessageBox::Information,source,tr(infoMessage.c_str()),QMessageBox::Ok, msgBox); + source.append(": INFORMATION"); + msgBox= new QMessageBox(QMessageBox::Information,source.c_str(),tr(infoMessage.c_str()),QMessageBox::Ok, msgBox); msgBox->exec(); } +//------------------------------------------------------------------------------------------------------------------------------------------------- + + /** range of x and y axes + */ + enum range{ + XMINIMUM, + XMAXIMUM, + YMINIMUM, + YMAXIMUM + }; + //------------------------------------------------------------------------------------------------------------------------------------------------- }; diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index 5138cf023..4504b6d17 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -14,17 +14,19 @@ class slsDetectorUtils; /** Qt Project Class Headers */ #include "SlsQt1DPlot.h" #include "SlsQt2DPlotLayout.h" +#include "qDefs.h" class SlsQt1DPlot; class SlsQt2DPlotLayout; class qCloneWidget; /** Qt Include Headers */ - #include #include #include #include #include +/** C++ Include Headers */ + #define MAX_1DPLOTS 10 @@ -40,50 +42,57 @@ public: /** Destructor */ ~qDrawPlot(); - /**is an acquisition running */ + /**is an acquisition running , need it to prevent measurement tab + * from being refreshed when switching tabs during acquisition */ bool isRunning(){return running;}; - /** Number of x axis pixels */ - int GetPixelsX(){return nPixelsX;}; - /** Number of y axis pixels */ - int GetPixelsY(){return nPixelsY;}; - /** sets plot Title */ - void SetPlotTitle(QString title) {boxPlot->setTitle(title);} - /** sets 1D X Axis Title */ - void SetHistXAxisTitle(QString title) {histXAxisTitle = title;} - /** sets 1D Y Axis Title */ - void SetHistYAxisTitle(QString title) {histYAxisTitle = title;} - /** sets 2D X Axis Title */ - void SetImageXAxisTitle(QString title) {imageXAxisTitle = title;} - /** sets 2D Y Axis Title */ - void SetImageYAxisTitle(QString title) {imageYAxisTitle = title;} - /** sets 2D Z Axis Title */ - void SetImageZAxisTitle(QString title) {imageZAxisTitle = title;} - /** Sets X min and max */ - void SetXMinMax(double min,double max) {if(plot_in_scope==1)plot1D->SetXMinMax(min,max); else plot2D->GetPlot()->SetXMinMax(min,max);}; - /** Sets Y min and max */ - void SetYMinMax(double min,double max) {if(plot_in_scope==1)plot1D->SetYMinMax(min,max); else plot2D->GetPlot()->SetYMinMax(min,max);}; - /** Gets X min */ - double GetXMinimum(){if(plot_in_scope==1)return plot1D->GetXMinimum(); else return plot2D->GetPlot()->GetXMinimum();}; - /** Gets X max */ - double GetXMaximum(){if(plot_in_scope==1)return plot1D->GetXMaximum(); else return plot2D->GetPlot()->GetXMaximum();}; - /** Gets Y min */ - double GetYMinimum(){if(plot_in_scope==1)return plot1D->GetYMinimum(); else return plot2D->GetPlot()->GetYMinimum();}; - /** Gets Y max */ - double GetYMaximum(){if(plot_in_scope==1)return plot1D->GetYMaximum(); else return plot2D->GetPlot()->GetYMaximum();}; - /** Disables zoom if any of the axes range are checked and fixed with a value */ - void DisableZoom(bool disable); /** gets the progress of acquisition to the measurement tab*/ int GetProgress(){return progress;}; + + /** sets plot Title */ + void SetPlotTitle(QString title) {boxPlot->setTitle(title);} + /** sets 1D X Axis Title */ + void SetHistXAxisTitle(QString title) {histXAxisTitle = title;} + /** sets 1D Y Axis Title */ + void SetHistYAxisTitle(QString title) {histYAxisTitle = title;} + /** sets 2D X Axis Title */ + void SetImageXAxisTitle(QString title) {imageXAxisTitle = title;} + /** sets 2D Y Axis Title */ + void SetImageYAxisTitle(QString title) {imageYAxisTitle = title;} + /** sets 2D Z Axis Title */ + void SetImageZAxisTitle(QString title) {imageZAxisTitle = title;} + /** Disables zoom if any of the axes range are checked and fixed with a value */ + void DisableZoom(bool disable); /** Enables plot from the plot tab*/ void EnablePlot(bool enable); - /** To know whether 1d started*/ - bool DoesPlotExist(){return plotExists;}; + + /** Its a reminder to update plot to set the xy range + * This is done only when there is a plot to update */ + void SetXYRange(bool changed){XYRangeChanged = changed;}; + /**Sets the min/max for x/y + * @param val is the value to be set + * @param xy is xmin,xmax,ymin or ymax */ + void SetXYRangeValues(double val,qDefs::range xy){XYRangeValues[xy]=val;}; + /**Sets if min/max for x/y is enabled + * @param changed is if this has been changed + * @param xy is xmin,xmax,ymin or ymax */ + void IsXYRangeValues(bool changed,qDefs::range xy){IsXYRange[xy]=changed;}; + + /** Get minimum Plot timer - between plots */ + double GetMinimumPlotTimer(){return PLOT_TIMER_MS;}; + /** Set Plot timer - between plots in ms*/ + void SetPlotTimer(double time){timerValue = time;}; + /** Set Plot frame factor - between plots */ + void SetFrameFactor(int frame){frameFactor = frame;}; /** Starts or stop acquisition * Calls startDaq() function * @param stop_if_running is 0 to stop acquisition and 1 to start acquisition */ void StartStopDaqToggle(bool stop_if_running=0); + /** Set number of measurements + * @param num number of measurements to be set */ + void setNumMeasurements(int num); + private: /** The sls detector object */ @@ -171,14 +180,40 @@ private: double* yvalues[MAX_1DPLOTS]; /** temporary Image Values in 2D */ double* image_data; - //bool gui_acquisition_thread_running; + + /**persistency to be reached*/ int persistency; + /** persistency takes time to reach as it increases per frame + * this is the current one */ int currentPersistency; + /** to update the progress for each getData() so that + * measurement tab can request on a timer basis*/ int progress; + /**If plot is enabled from plot tab*/ bool plotEnable; - bool plotExists; + + + /**if an acquisition is running, so as not to refresh tab + * and also to update plot only if running (while creating clones)*/ bool running; + /** if the min/max of x and y has been changed, + * to notify while plotting */ + bool XYRangeChanged; + /**the specific min/max of x/y*/ + double XYRangeValues[4]; + /**if the specific min/max of x/y is enabled */ + bool IsXYRange[4]; + + /** Default timer between plots*/ + static const double PLOT_TIMER_MS = 500; + /** Specific timer value between plots */ + double timerValue; + /** every nth frame when to plot */ + int frameFactor; + bool plotLock; + + /** Initializes all its members and the thread */ void Initialization(); /** Sets up the widget */ @@ -214,9 +249,6 @@ private: public slots: -/** Set number of measurements - * @param num number of measurements to be set */ -void setNumMeasurements(int num); /** To select 1D or 2D plot @param i is 1 for 1D, else 2D plot */ void SelectPlot(int i=2); @@ -250,6 +282,7 @@ void StartDaq(bool start); void CloneCloseEvent(int id); + signals: void UpdatingPlotFinished(); void InterpolateSignal(bool); @@ -258,7 +291,6 @@ void LogzSignal(bool); void SetZRangeSignal(double,double); void EnableZRangeSignal(bool); void SetCurrentMeasurementSignal(int); - }; diff --git a/slsDetectorGui/include/qTabMeasurement.h b/slsDetectorGui/include/qTabMeasurement.h index 447c4ff02..c65820f2e 100644 --- a/slsDetectorGui/include/qTabMeasurement.h +++ b/slsDetectorGui/include/qTabMeasurement.h @@ -52,6 +52,10 @@ private: QTimer *progressTimer; + int numMeasurement; + + int currentMeasurement; + /** methods */ /** Sets up the widget */ @@ -91,6 +95,10 @@ void UpdateFinished(); void SetCurrentMeasurement(int val); private slots: +/** Set number of measurements + * @param num number of measurements to be set */ +void setNumMeasurements(int num); + /** Set file name * @param fName name of file */ @@ -150,6 +158,7 @@ signals: void StartSignal(); void StopSignal(); +void CheckPlotIntervalSignal(); }; diff --git a/slsDetectorGui/include/qTabMessages.h b/slsDetectorGui/include/qTabMessages.h index 972160300..bd8be85b6 100644 --- a/slsDetectorGui/include/qTabMessages.h +++ b/slsDetectorGui/include/qTabMessages.h @@ -70,6 +70,8 @@ void SaveLog(); /** Clear Log to File*/ void ClearLog(); + + }; diff --git a/slsDetectorGui/include/qTabPlot.h b/slsDetectorGui/include/qTabPlot.h index 957347e30..94d5f1344 100644 --- a/slsDetectorGui/include/qTabPlot.h +++ b/slsDetectorGui/include/qTabPlot.h @@ -14,6 +14,8 @@ class slsDetectorUtils; /** Qt Project Class Headers */ class qDrawPlot; +/** Qt Include Headers */ +#include /** *@short sets up the Plot parameters @@ -33,6 +35,9 @@ public: */ ~qTabPlot(); + /** To refresh and update widgets + */ + void Refresh(); private: @@ -45,6 +50,11 @@ private: /** 1d/2d plot */ bool isOneD; + QStackedLayout* stackedLayout; + QSpinBox *spinNthFrame; + QDoubleSpinBox *spinTimeGap; + QComboBox *comboTimeGapUnit; + /** some Default Values */ static QString defaultPlotTitle; static QString defaultHistXAxisTitle; @@ -66,7 +76,10 @@ private: public slots: - +/** Set frequency between plots + * returns 0 if there were no errors(important + * while editing acquisition period in measurement tab) */ +int SetFrequency(); @@ -94,8 +107,7 @@ void SetZRange(); void EnableZRange(); /** Set Plot to none, data graph, histogram*/ void SetPlot(); -/** Enable Histogram */ -void EnableHistogram(bool enable); + signals: void DisableZoomSignal(bool); diff --git a/slsDetectorGui/src/qCloneWidget.cpp b/slsDetectorGui/src/qCloneWidget.cpp index 52bb930f2..c0345813b 100644 --- a/slsDetectorGui/src/qCloneWidget.cpp +++ b/slsDetectorGui/src/qCloneWidget.cpp @@ -183,12 +183,13 @@ void qCloneWidget::SavePlot(){ QPainter painter(&img); cloneBox->render(&painter); - fName = QFileDialog::getSaveFileName(this,tr("Save Snapshot "),fName,tr("Images (*.png *.xpm *.jpg)"),0,QFileDialog::ShowDirsOnly); + fName = QFileDialog::getSaveFileName(this,tr("Save Snapshot "),fName,tr("PNG Files (*.png);;XPM Files(*.xpm);;JPEG Files(*.jpg)"),0,QFileDialog::ShowDirsOnly); if (!fName.isEmpty()) if((img.save(fName))) - qDefs::InfoMessage("The SnapShot has been successfully saved","Snapshot: Information"); + qDefs::InfoMessage("The SnapShot has been successfully saved","Snapshot"); else - qDefs::ErrorMessage("ERROR: Attempt to save snapshot failed. Wrong Format","Snapshot: WARNING"); + qDefs::WarningMessage("Attempt to save snapshot failed.\n" + "Formats: .png, .jpg, .xpm.","Snapshot"); } //------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index aa8a1bffb..0730216d4 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -171,8 +171,7 @@ void qDetectorMain::SetUpDetector(){ #endif char cIndex[10]; sprintf(cIndex,"%d",detID); - qDefs::ErrorMessage(string("ERROR: No Detector Connected at " - "id : ")+string(cIndex),"Main: ERROR"); + qDefs::ErrorMessage(string("No Detector Connected at id : ")+string(cIndex),"Main"); exit(-1); } else{ @@ -184,9 +183,9 @@ void qDetectorMain::SetUpDetector(){ default: string detName = myDet->slsDetectorBase::getDetectorType(myDet->getDetectorsType()); string hostname = myDet->getHostname(detID); - string errorMess = string("ERROR: ")+hostname+string(" has " - "unknown detector type \"")+detName+string("\". Exiting GUI."); - qDefs::ErrorMessage(errorMess,"Main: ERROR"); + string errorMess = hostname+string(" has unknown detector type \"")+ + detName+string("\". Exiting GUI."); + qDefs::ErrorMessage(errorMess,"Main"); exit(-1); } setWindowTitle("SLS Detector GUI : "+ @@ -212,6 +211,7 @@ void qDetectorMain::Initialization(){ /** 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 */ connect(tab_plot, SIGNAL(DisableZoomSignal(bool)), this,SLOT(SetZoomToolTip(bool))); /** Plotting */ @@ -293,7 +293,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ /** Gets called when cancelled as well*/ if (!fName.isEmpty()){ myDet->retrieveDetectorSetup(string(fName.toAscii().constData())); - qDefs::InfoMessage("The parameters have been successfully setup.","Main: Information"); + qDefs::InfoMessage("The parameters have been successfully setup.","Main"); } } else if(action==actionSaveSetup){ @@ -307,7 +307,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ /** 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: Information"); + qDefs::InfoMessage("The setup parameters have been successfully saved.","Main"); } } else if(action==actionMeasurementWizard){ @@ -326,7 +326,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ /** Gets called when cancelled as well*/ if (!fName.isEmpty()){ myDet->readConfigurationFile(string(fName.toAscii().constData())); - qDefs::InfoMessage("The parameters have been successfully configured.","Main: Information"); + qDefs::InfoMessage("The parameters have been successfully configured.","Main"); } } else if(action==actionSaveConfiguration){ @@ -340,7 +340,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ /** 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: Information"); + qDefs::InfoMessage("The configuration parameters have been successfully saved.","Main"); } } else if(action==actionEnergyCalibration){ @@ -386,7 +386,7 @@ void qDetectorMain::Refresh(int index){ case Measurement: if(!myPlot->isRunning()) tab_measurement->Refresh(); break; case Settings: tab_settings->Refresh(); break; case DataOutput: tab_dataoutput->Refresh(); break; - case Plot: break; + case Plot: tab_plot->Refresh(); break; case Actions: tab_actions->Refresh(); break; case Advanced: tab_advanced->Refresh(); break; case Debugging: tab_debugging->Refresh(); break; diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 71808c29a..5efbad5d5 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -7,7 +7,6 @@ /** Qt Project Class Headers */ #include "qDrawPlot.h" #include "qCloneWidget.h" -#include "qDefs.h" #include "slsDetector.h" /** Project Class Headers */ #include "slsDetector.h" @@ -25,6 +24,7 @@ using namespace std; + //------------------------------------------------------------------------------------------------------------------------------------------------- qDrawPlot::qDrawPlot(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector){ @@ -75,7 +75,10 @@ void qDrawPlot::SetupWidgetWindow(){ currentPersistency = 0; progress = 0; plotEnable=true; - plotExists=false; + XYRangeChanged = false; + timerValue = PLOT_TIMER_MS; + frameFactor=0; + plotLock = false; /** This is so that it initially stop and plots */ running = 1; for(int i=0;i0;i--) memcpy(yvalues[i],yvalues[i-1],nPixelsX*sizeof(double)); nHists = currentPersistency+1; - memcpy(yvalues[0],data->values,nPixelsX*sizeof(double)); + //memcpy(yvalues[0],data->values,nPixelsX*sizeof(double)); + for(int i=0;i<(int)nPixelsX;i++) *(yvalues[0]+i) = (double)*(data->values+i); } /**2d*/ else{ @@ -306,6 +312,7 @@ int qDrawPlot::GetData(detectorData *data){ #ifdef VERYVERBOSE cout<<"Reading in image: "<stop(); - if(plotEnable){ - LockLastImageArray(); - //1-d plot stuff - if(lastImageNumber){ - if(histNBins){ #ifdef VERYVERBOSE - cout<<"Last Image Number: "<SetXTitle(histXAxisTitle.toAscii().constData()); - plot1D->SetYTitle(histYAxisTitle.toAscii().constData()); - for(int hist_num=0;hist_num<(int)nHists;hist_num++){ - SlsQtH1D* h; - if(hist_num+1>plot1D_hists.size()){ - plot1D_hists.append(h=new SlsQtH1D("1d plot",histNBins,histXAxis,GetHistYAxis(hist_num))); - h->SetLineColor(hist_num+1); - }else{ - h=plot1D_hists.at(hist_num); - h->SetData(histNBins,histXAxis,GetHistYAxis(hist_num)); + bool canPlot = true; + if(frameFactor) canPlot = plotLock; + + plot_update_timer->stop(); + + /** only if no plot isnt enabled */ + if(plotEnable){ + /** It doesnt go in here only if nth frame plotting in on and its not the nth frame*/ + if(canPlot){ + LockLastImageArray(); + /**1-d plot stuff */ + if(lastImageNumber){ + if(histNBins){ +#ifdef VERYVERBOSE + cout<<"Last Image Number: "<SetXTitle(histXAxisTitle.toAscii().constData()); + plot1D->SetYTitle(histYAxisTitle.toAscii().constData()); + for(int hist_num=0;hist_num<(int)nHists;hist_num++){ + SlsQtH1D* h; + if(hist_num+1>plot1D_hists.size()){ + plot1D_hists.append(h=new SlsQtH1D("1d plot",histNBins,histXAxis,GetHistYAxis(hist_num))); + h->SetLineColor(hist_num+1); + }else{ + h=plot1D_hists.at(hist_num); + h->SetData(histNBins,histXAxis,GetHistYAxis(hist_num)); + } + h->setTitle(GetHistTitle(hist_num)); + h->Attach(plot1D); + } - h->setTitle(GetHistTitle(hist_num)); - h->Attach(plot1D); + /** update range if required */ + if(XYRangeChanged){ + if(!IsXYRange[qDefs::XMINIMUM]) + XYRangeValues[qDefs::XMINIMUM]= plot1D->GetXMinimum(); + if(!IsXYRange[qDefs::XMAXIMUM]) + XYRangeValues[qDefs::XMAXIMUM]= plot1D->GetXMaximum(); + if(!IsXYRange[qDefs::YMINIMUM]) + XYRangeValues[qDefs::YMINIMUM]= plot1D->GetYMinimum(); + if(!IsXYRange[qDefs::YMAXIMUM]) + XYRangeValues[qDefs::YMAXIMUM]= plot1D->GetYMaximum(); + plot1D->SetXMinMax(XYRangeValues[qDefs::XMINIMUM],XYRangeValues[qDefs::XMAXIMUM]); + plot1D->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]); + + XYRangeChanged = false; + } + plotLock = false; } - /**plot exists is false in the beginning, right after cloning and when no plot is checked*/ - plotExists=true; } - } + /**2-d plot stuff */ + if(lastImageArray){ + if(lastImageNumber&&last_plot_number!=(int)lastImageNumber && //there is a new plot + nPixelsX>0&&nPixelsY>0){ + plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,-0.5,nPixelsY-0.5,lastImageArray); + plot2D->setTitle(GetImageTitle()); + plot2D->SetXTitle(imageXAxisTitle); + plot2D->SetYTitle(imageYAxisTitle); + plot2D->SetZTitle(imageZAxisTitle); + plot2D->UpdateNKeepSetRangeIfSet(); //this will keep a "set" z range, and call Plot()->Update(); + } + /** update range if required */ + if(XYRangeChanged){ + if(!IsXYRange[qDefs::XMINIMUM]) + XYRangeValues[qDefs::XMINIMUM]= plot2D->GetPlot()->GetXMinimum(); + if(!IsXYRange[qDefs::XMAXIMUM]) + XYRangeValues[qDefs::XMAXIMUM]= plot2D->GetPlot()->GetXMaximum(); + if(!IsXYRange[qDefs::YMINIMUM]) + XYRangeValues[qDefs::YMINIMUM]= plot2D->GetPlot()->GetYMinimum(); + if(!IsXYRange[qDefs::YMAXIMUM]) + XYRangeValues[qDefs::YMAXIMUM]= plot2D->GetPlot()->GetYMaximum(); - //2-d plot stuff - if(lastImageArray){ - if(lastImageNumber&&last_plot_number!=(int)lastImageNumber && //there is a new plot - nPixelsX>0&&nPixelsY>0){ - plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,-0.5,nPixelsY-0.5,lastImageArray); - //as it inherits a widget - plot2D->setTitle(GetImageTitle()); - plot2D->SetXTitle(imageXAxisTitle); - plot2D->SetYTitle(imageYAxisTitle); - plot2D->SetZTitle(imageZAxisTitle); - plot2D->UpdateNKeepSetRangeIfSet(); //this will keep a "set" z range, and call Plot()->Update(); + plot2D->GetPlot()->SetXMinMax(XYRangeValues[qDefs::XMINIMUM],XYRangeValues[qDefs::XMAXIMUM]); + plot2D->GetPlot()->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]); + + XYRangeChanged = false; + } + plotLock = false; } - /**plot exists is false in the beginning, right after cloning and when no plot is checked*/ - plotExists=true; } } last_plot_number=lastImageNumber; @@ -429,18 +477,24 @@ void qDrawPlot::UpdatePlot(){ if(plotEnable) UnlockLastImageArray(); /** Measurement not over, continue*/ if(number_of_exposures!=currentFrame){//las plot number? - plot_update_timer->start(500); + /**if the interval is a timer and not nth frame **/ + if(!frameFactor) + plot_update_timer->start((int)timerValue); + else + plot_update_timer->start((int)PLOT_TIMER_MS); } /** if a measurement is over */ else{ - emit SetCurrentMeasurementSignal(currentMeasurement); currentMeasurement++; /** if all the measurements are over */ if(currentMeasurement==number_of_measurements){ + plotLock = false; StartStopDaqToggle(true); emit UpdatingPlotFinished(); }/** To start the next measurement*/ else{ + plotLock = false; + emit SetCurrentMeasurementSignal(currentMeasurement); StopDaqForGui(); StartDaq(true); } @@ -472,8 +526,6 @@ void qDrawPlot::ClonePlot(){ int preheight = height(); /** create clone */ - /** plotexists is true after calling updateplot*/ - plotExists=false; winClone[i] = new qCloneWidget(this,i,boxPlot->title(),(int)plot_in_scope,plot1D,plot2D,myDet->getFilePath()); if(plot_in_scope==1){ plot1D = new SlsQt1DPlot(boxPlot); @@ -528,23 +580,25 @@ void qDrawPlot::CloneCloseEvent(int id){ void qDrawPlot::SavePlot(){ /** render image */ - QImage img(size().width(),size().height(),QImage::Format_RGB32); - QPainter painter(&img); + QImage savedImage(size().width(),size().height(),QImage::Format_RGB32); + QPainter painter(&savedImage); render(&painter); /** save image*/ QString fName = QString(myDet->getFilePath().c_str())+"/Image.png"; - fName = QFileDialog::getSaveFileName(this,tr("Save Image"),fName,tr("Images (*.png *.xpm *.jpg)")); - if (!fName.isEmpty()) - if(img.save(fName)) - qDefs::InfoMessage("The Image has been successfully saved","Dock: Information"); - else - qDefs::ErrorMessage("ERROR: Attempt to save image failed. Wrong Format","Dock: WARNING"); + fName = QFileDialog::getSaveFileName(0,tr("Save Image"),fName,tr("PNG Files (*.png);;XPM Files(*.xpm);;JPEG Files(*.jpg)"),0,QFileDialog::ShowDirsOnly); + if (!fName.isEmpty()) + if(savedImage.save(fName)) + qDefs::InfoMessage("The Image has been successfully saved","Dock"); + else + qDefs::WarningMessage("Attempt to save image failed.\n" + "Formats: .png, .jpg, .xpm.","Dock"); } //------------------------------------------------------------------------------------------------------------------------------------------------- + void qDrawPlot::SetPersistency(int val){ for(int i=0;i<=val;i++){ if(!yvalues[i]) yvalues[i] = new double [nPixelsX]; @@ -562,7 +616,6 @@ void qDrawPlot::EnablePlot(bool enable){ plotEnable = enable; /**if no plot, cant do setting range. * not true vice versa where plot was false and now set it to true*/ - if(!enable) plotExists=false; Clear1DPlot(); } diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 857597bc9..bd4a78e6d 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -47,12 +47,15 @@ qTabMeasurement::~qTabMeasurement(){ void qTabMeasurement::SetupWidgetWindow(){ + /** Number of measurements */ + numMeasurement=1; + /** Timer to update the progress bar **/ progressTimer = new QTimer(this); //btnStartStop->setStyleSheet("color:green"); /** Exp Time **/ qDefs::timeUnit unit; - float time = qDefs::getCorrectTime(unit,((float)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-9)))); + double time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-9)))); spinExpTime->setValue(time); comboExpUnit->setCurrentIndex((int)unit); /** Hide the error message **/ @@ -65,6 +68,7 @@ void qTabMeasurement::SetupWidgetWindow(){ lblProgressIndex->setText(QString::number(myDet->getFileIndex())); /** only initially **/ progressBar->setValue(0); + currentMeasurement = 0; /** timing mode*/ SetupTimingMode(); @@ -114,7 +118,7 @@ void qTabMeasurement::SetupTimingMode(){ item[(int)Trigger_Window]->setEnabled(false); break; default: - qDefs::ErrorMessage("ERROR: Unknown detector type.","Measurement: ERROR"); + qDefs::ErrorMessage("Unknown detector type.","Measurement"); exit(-1); break; } @@ -144,11 +148,9 @@ void qTabMeasurement::SetupTimingMode(){ * This should not happen -only if the server and gui has a mismatch * on which all modes are allowed in detectors */ else{ - qDefs::ErrorMessage("ERROR: Unknown Timing Mode detected from detector." + qDefs::WarningMessage("Unknown Timing Mode detected from detector." "\n\nSetting the following defaults:\nTiming Mode \t: None\n" - "Number of Frames \t: 1\nNumber of Triggers \t: 1","Measurement: WARNING"); - setNumFrames(1); - setNumTriggers(1); + "Number of Frames \t: 1\nNumber of Triggers \t: 1","Measurement"); comboTimingMode->setCurrentIndex((int)None); setTimingMode((int)None); } @@ -163,7 +165,7 @@ void qTabMeasurement::Initialization(int timingChange){ /** These signals are connected only at start up. The others are reinitialized when changing timing mode*/ if(!timingChange){ /** Number of Measurements**/ - connect(spinNumMeasurements,SIGNAL(valueChanged(int)), myPlot, SLOT(setNumMeasurements(int))); + connect(spinNumMeasurements,SIGNAL(valueChanged(int)), this, SLOT(setNumMeasurements(int))); /** File Name**/ connect(dispFileName,SIGNAL(textChanged(const QString&)), this, SLOT(setFileName(const QString&))); /** File Index**/ @@ -233,6 +235,16 @@ void qTabMeasurement::Enable(bool enable){ //------------------------------------------------------------------------------------------------------------------------------------------------- +void qTabMeasurement::setNumMeasurements(int val){ +#ifdef VERBOSE + cout<<"Setting Number of Measurements to " <setNumMeasurements(val); +} +//------------------------------------------------------------------------------------------------------------------------------------------------- + + void qTabMeasurement::setFileName(const QString& fName){ myDet->setFileName(fName.toAscii().data()); #ifdef VERBOSE @@ -263,6 +275,8 @@ void qTabMeasurement::startStopAcquisition(){ btnStartStop->setText("Stop"); Enable(0); progressBar->setValue(0); + /** the progress which keeps adding up for all the measurements*/ + currentMeasurement = 0; progressTimer->start(100); emit StartSignal(); @@ -300,8 +314,10 @@ void qTabMeasurement::UpdateFinished(){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void SetCurrentMeasurement(int val){ - lblCurrentMeasurement->setText("0u");//lblCurrentMeasurement->setText(QString::number(val)); +void qTabMeasurement::SetCurrentMeasurement(int val){ + currentMeasurement = val; + lblCurrentMeasurement->setText(QString::number(val+1)); + } @@ -309,8 +325,7 @@ void SetCurrentMeasurement(int val){ void qTabMeasurement::UpdateProgress(){ - - progressBar->setValue(myPlot->GetProgress()); + progressBar->setValue((int)(((currentMeasurement*100)+(myPlot->GetProgress()))/numMeasurement)); lblProgressIndex->setText(QString::number(myDet->getFileIndex())); } @@ -331,17 +346,17 @@ void qTabMeasurement::setNumFrames(int val){ void qTabMeasurement::setExposureTime(){ - int64_t exptimeNS; + double exptimeNS; /** Get the value of timer in ns **/ - exptimeNS = (int64_t)qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value()); + exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value()); #ifdef VERBOSE cout<<"Setting acquisition time to " << exptimeNS << " clocks" << "/"<value()<currentIndex())<setTimer(slsDetectorDefs::ACQUISITION_TIME,exptimeNS); + myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,(int64_t)exptimeNS); if(lblPeriod->isEnabled()){ - int64_t acqtimeNS; - acqtimeNS = (int64_t)qDefs::getNSTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value()); + double acqtimeNS; + acqtimeNS = qDefs::getNSTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value()); if(exptimeNS>acqtimeNS) { lblNote->show(); lblPeriod->setPalette(lblNote->palette()); @@ -360,16 +375,16 @@ void qTabMeasurement::setExposureTime(){ void qTabMeasurement::setAcquisitionPeriod(){ - int64_t acqtimeNS; + double acqtimeNS; /** Get the value of timer in ns **/ - acqtimeNS = (int64_t)qDefs::getNSTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value()); + acqtimeNS = qDefs::getNSTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value()); #ifdef VERBOSE cout<<"Setting frame period between exposures to " << acqtimeNS << " clocks"<< "/"<value()<currentIndex())<setTimer(slsDetectorDefs::FRAME_PERIOD,acqtimeNS); + myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,(int64_t)acqtimeNS); - int64_t exptimeNS; - exptimeNS = (int64_t)qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value()); + double exptimeNS; + exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value()); if(exptimeNS>acqtimeNS){ lblNote->show(); lblPeriod->setPalette(lblNote->palette()); @@ -380,6 +395,9 @@ void qTabMeasurement::setAcquisitionPeriod(){ lblPeriod->setPalette(lblNumFrames->palette()); lblPeriod->setText("Acquisition Period:"); } + + /** Check if the interval between plots is ok */ + emit CheckPlotIntervalSignal(); } @@ -398,13 +416,13 @@ void qTabMeasurement::setNumTriggers(int val){ void qTabMeasurement::setDelay(){ - int64_t exptimeNS; + double exptimeNS; /** Get the value of timer in ns **/ - exptimeNS = (int64_t)qDefs::getNSTime((qDefs::timeUnit)comboDelayUnit->currentIndex(),spinDelay->value()); + exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboDelayUnit->currentIndex(),spinDelay->value()); #ifdef VERBOSE cout<<"Setting delay after trigger to " << exptimeNS << " clocks"<< "/"<value()<currentIndex())<setTimer(slsDetectorDefs::DELAY_AFTER_TRIGGER,exptimeNS); + myDet->setTimer(slsDetectorDefs::DELAY_AFTER_TRIGGER,(int64_t)exptimeNS); } @@ -506,13 +524,17 @@ void qTabMeasurement::setTimingMode(int mode){ success = true; break; default: - qDefs::ErrorMessage("ERROR: Timing mode unknown to GUI","Measurement: ERROR"); + /** This should never happen */ + qDefs::ErrorMessage("Timing mode unknown to GUI","Measurement"); exit(-1); } if(!success){ - qDefs::ErrorMessage("ERROR: The detector timing mode could not be set.\n" - "Please check the external flags","Measurement: ERROR"); - exit(-1); + qDefs::WarningMessage("The detector timing mode could not be set.\n" + "Please check the external flags." + "\n\nSetting the following defaults:\nTiming Mode \t: None\n" + "Number of Frames \t: 1\nNumber of Triggers \t: 1","Measurement"); + comboTimingMode->setCurrentIndex((int)None); + return; } if(mode!=None){/** Number of Probes */ @@ -525,7 +547,7 @@ void qTabMeasurement::setTimingMode(int mode){ DeInitialization(); - float time; + double time; int val; qDefs::timeUnit unit; /**Number of Frames */ @@ -539,7 +561,7 @@ void qTabMeasurement::setTimingMode(int mode){ /**Exposure Time */ if(lblExpTime->isEnabled()){ - time = qDefs::getCorrectTime(unit,((float)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-9)))); + time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-9)))); #ifdef VERBOSE cout<<"Getting acquisition time : " << time << qDefs::getUnitString(unit) << endl; #endif @@ -549,16 +571,16 @@ void qTabMeasurement::setTimingMode(int mode){ /**Frame Period between exposures */ if(lblPeriod->isEnabled()){ - time = qDefs::getCorrectTime(unit,((float)(myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,-1)*(1E-9)))); + time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,-1)*(1E-9)))); #ifdef VERBOSE cout<<"Getting frame period between exposures : " << time << qDefs::getUnitString(unit) << endl; #endif spinPeriod->setValue(time); comboPeriodUnit->setCurrentIndex((int)unit); - int64_t exptimeNS,acqtimeNS; - exptimeNS = (int64_t)qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value()); - acqtimeNS = (int64_t)qDefs::getNSTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value()); + double exptimeNS,acqtimeNS; + exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value()); + acqtimeNS = qDefs::getNSTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value()); if(exptimeNS>acqtimeNS) { lblNote->show(); lblPeriod->setPalette(lblNote->palette()); @@ -586,7 +608,7 @@ void qTabMeasurement::setTimingMode(int mode){ /**Delay After Trigger */ if(lblDelay->isEnabled()){ - time = qDefs::getCorrectTime(unit,((float)(myDet->setTimer(slsDetectorDefs::DELAY_AFTER_TRIGGER,-1)*(1E-9)))); + time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::DELAY_AFTER_TRIGGER,-1)*(1E-9)))); #ifdef VERBOSE cout<<"Getting delay after trigger : " << time << qDefs::getUnitString(unit) << endl; #endif @@ -615,6 +637,8 @@ void qTabMeasurement::setTimingMode(int mode){ /** To reconnect all the signals after changing their values*/ Initialization(1); + + return; } @@ -628,10 +652,8 @@ void qTabMeasurement::Refresh(){ spinIndex->setValue(myDet->getFileIndex()); /** progress label index **/ lblProgressIndex->setText(QString::number(myDet->getFileIndex())); - /** Progress bar **/ - progressBar->setValue((int)myDet->getCurrentProgress()); /** Timing mode**/ - SetupTimingMode();//comboTimingMode->setCurrentIndex((int)myDet->setExternalCommunicationMode()); + SetupTimingMode(); } diff --git a/slsDetectorGui/src/qTabMessages.cpp b/slsDetectorGui/src/qTabMessages.cpp index 7b1022922..fc7945fc4 100644 --- a/slsDetectorGui/src/qTabMessages.cpp +++ b/slsDetectorGui/src/qTabMessages.cpp @@ -45,6 +45,7 @@ void qTabMessages::SetupWidgetWindow(){ dispLog = new QTextEdit(this); dispLog->setReadOnly(true); dispLog->setFocusPolicy(Qt::NoFocus); + dispLog->setTextColor(Qt::darkBlue); QSizePolicy sizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); @@ -91,9 +92,9 @@ void qTabMessages::SaveLog() { QTextStream out(&outfile); out<toPlainText() << endl; qDefs::InfoMessage(string("The Log has been successfully saved to " - "")+fName.toAscii().constData(),"Messages: Information"); + "")+fName.toAscii().constData(),"Messages"); } - else qDefs::ErrorMessage("ERROR: Attempt to save log file failed.","Messages: WARNING"); + else qDefs::WarningMessage("Attempt to save log file failed.","Messages"); } } diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index 1ff770e16..ef49b62df 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -15,6 +15,7 @@ /** C++ Include Headers */ #include #include +#include using namespace std; //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -79,6 +80,42 @@ void qTabPlot::SetupWidgetWindow(){ dispXMax->setValidator(new QDoubleValidator(dispXMax)); dispYMax->setValidator(new QDoubleValidator(dispYMax)); dispZMax->setValidator(new QDoubleValidator(dispZMax)); + + /** Plotting Frequency */ + + stackedLayout = new QStackedLayout; + stackedLayout->setSpacing(0); + spinNthFrame = new QSpinBox; + spinNthFrame->setMinimum(1); + spinNthFrame->setMaximum(2000000000); + spinTimeGap = new QDoubleSpinBox; + spinTimeGap->setMinimum(0); + spinTimeGap->setDecimals(3); + spinTimeGap->setMaximum(999999); + spinTimeGap->setValue(500.00); + comboTimeGapUnit = new QComboBox; + comboTimeGapUnit->addItem("hr"); + comboTimeGapUnit->addItem("min"); + comboTimeGapUnit->addItem("s"); + comboTimeGapUnit->addItem("ms"); + comboTimeGapUnit->setCurrentIndex(3); + QWidget *w = new QWidget; + QHBoxLayout *h1 = new QHBoxLayout; + w->setLayout(h1); + h1->setContentsMargins(0,0,0,0); + h1->setSpacing(3); + h1->addWidget(spinTimeGap); + h1->addWidget(comboTimeGapUnit); + + stackedLayout->addWidget(w); + stackedLayout->addWidget(spinNthFrame); + + + + + stackWidget->setLayout(stackedLayout); + + } @@ -88,8 +125,8 @@ void qTabPlot::SetupWidgetWindow(){ void qTabPlot::Select1DPlot(bool b){ isOneD = b; if(b){ - box1D->setEnabled(true); - box2D->setEnabled(false); + box1D->show(); + box2D->hide(); chkZAxis->setEnabled(false); chkZMin->setEnabled(false); chkZMax->setEnabled(false); @@ -99,8 +136,8 @@ void qTabPlot::Select1DPlot(bool b){ dispYAxis->setText(defaultHistYAxisTitle); myPlot->Select1DPlot(); }else{ - box1D->setEnabled(false); - box2D->setEnabled(true); + box1D->hide(); + box2D->show(); chkZAxis->setEnabled(true); chkZMin->setEnabled(true); chkZMax->setEnabled(true); @@ -124,7 +161,7 @@ void qTabPlot::Initialization(){ connect(radioHistogram, SIGNAL(clicked()),this, SLOT(SetPlot())); connect(radioDataGraph, SIGNAL(clicked()),this, SLOT(SetPlot())); /** Scan box*/ - //connect(radioNoPlot, SIGNAL(toggled(bool)),this, SLOT(EnablePlot(bool))); + //connect(scna, SIGNAL(toggled(bool)),this, SLOT(scanstuff(bool))); /** Snapshot box*/ connect(btnClone, SIGNAL(clicked()),myPlot, SLOT(ClonePlot())); connect(btnCloseClones, SIGNAL(clicked()),myPlot, SLOT(CloseClones())); @@ -135,8 +172,11 @@ void qTabPlot::Initialization(){ connect(chkInterpolate, SIGNAL(toggled(bool)),myPlot, SIGNAL(InterpolateSignal(bool))); connect(chkContour, SIGNAL(toggled(bool)),myPlot, SIGNAL(ContourSignal(bool))); connect(chkLogz, SIGNAL(toggled(bool)),myPlot, SIGNAL(LogzSignal(bool))); - - +/** Plotting frequency box */ + connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency())); + connect(comboTimeGapUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency())); + connect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetFrequency())); + connect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency())); /** Plot Axis **/ connect(chkTitle, SIGNAL(toggled(bool)), this, SLOT(EnableTitles())); connect(chkXAxis, SIGNAL(toggled(bool)), this, SLOT(EnableTitles())); @@ -270,31 +310,29 @@ void qTabPlot::EnableRange(){ void qTabPlot::SetAxesRange(){ - double xmin=0,xmax=0,ymin=0,ymax=0; + bool changed = false; + /** x min */ + changed = (dispXMin->isEnabled())&&(!dispXMin->text().isEmpty()); + if(changed) myPlot->SetXYRangeValues(dispXMin->text().toDouble(),qDefs::XMINIMUM); + myPlot->IsXYRangeValues(changed,qDefs::XMINIMUM); - /** If disabled, get the min or max range of the plot as default */ - if((dispXMin->isEnabled())&&(!dispXMin->text().isEmpty())) - xmin = dispXMin->text().toDouble(); - else if(myPlot->DoesPlotExist()) - xmin = myPlot->GetXMinimum(); - if((dispXMax->isEnabled())&&(!dispXMax->text().isEmpty())) - xmax = dispXMax->text().toDouble(); - else if(myPlot->DoesPlotExist()) - xmax = myPlot->GetXMaximum(); - if((dispYMin->isEnabled())&&(!dispYMin->text().isEmpty())) - ymin = dispYMin->text().toDouble(); - else if(myPlot->DoesPlotExist()) - ymin = myPlot->GetYMinimum(); - if((dispYMax->isEnabled())&&(!dispYMax->text().isEmpty())) - ymax = dispYMax->text().toDouble(); - else if(myPlot->DoesPlotExist()) - ymax = myPlot->GetYMaximum(); + /** x max */ + changed = (dispXMax->isEnabled())&&(!dispXMax->text().isEmpty()); + if(changed) myPlot->SetXYRangeValues(dispXMax->text().toDouble(),qDefs::XMAXIMUM); + myPlot->IsXYRangeValues(changed,qDefs::XMAXIMUM); - /** Setting the range*/ - if(myPlot->DoesPlotExist()){ - myPlot->SetXMinMax(xmin,xmax); - myPlot->SetYMinMax(ymin,ymax); - } + /** y min */ + changed = (dispYMin->isEnabled())&&(!dispYMin->text().isEmpty()); + if(changed) myPlot->SetXYRangeValues(dispYMin->text().toDouble(),qDefs::YMINIMUM); + myPlot->IsXYRangeValues(changed,qDefs::YMINIMUM); + + /** y max */ + changed = (dispYMax->isEnabled())&&(!dispYMax->text().isEmpty()); + if(changed) myPlot->SetXYRangeValues(dispYMax->text().toDouble(),qDefs::YMAXIMUM); + myPlot->IsXYRangeValues(changed,qDefs::YMAXIMUM); + + /** To remind the updateplot in qdrawplot to set range after updating plot*/ + myPlot->SetXYRange(true); } @@ -323,28 +361,31 @@ void qTabPlot::SetPlot(){ if(radioNoPlot->isChecked()){ myPlot->EnablePlot(false); /**if enable is true, disable everything */ - box1D->setEnabled(false); - box2D->setEnabled(false); + box1D->hide(); + box2D->hide(); boxSnapshot->setEnabled(false); boxSave->setEnabled(false); + boxFrequency->setEnabled(false); boxPlotAxis->setEnabled(false); boxScan->setEnabled(false); }else if(radioHistogram->isChecked()){ myPlot->EnablePlot(true); /**if enable is true, disable everything */ - box1D->setEnabled(isOneD); - box2D->setEnabled(!isOneD); + 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 */ - box1D->setEnabled(isOneD); - box2D->setEnabled(!isOneD); + 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); } @@ -353,11 +394,73 @@ void qTabPlot::SetPlot(){ //------------------------------------------------------------------------------------------------------------------------------------------------- +int qTabPlot::SetFrequency(){ + int ret=0; + disconnect(comboTimeGapUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency())); + disconnect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetFrequency())); + disconnect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency())); -void qTabPlot::EnableHistogram(bool enable){ - //boxScan->setEnabled(false); + double timeMS,acqPeriodMS; + double minPlotTimer = myPlot->GetMinimumPlotTimer(); + char cplotms[200]; + sprintf(cplotms,"%f ms",minPlotTimer); + + stackedLayout->setCurrentIndex(comboFrequency->currentIndex()); + switch(comboFrequency->currentIndex()){ + case 0: + /* Get the time interval from gui in ms*/ + timeMS = (qDefs::getNSTime((qDefs::timeUnit)comboTimeGapUnit->currentIndex(),spinTimeGap->value()))/(1e6); + if(timeMSsetValue(minPlotTimer); + comboTimeGapUnit->setCurrentIndex(qDefs::MILLISECONDS); + } + /**This is done so that its known which one was selected */ + myPlot->SetFrameFactor(0); + /** Setting the timer value(ms) between plots */ + myPlot->SetPlotTimer(timeMS); +#ifdef VERBOSE + cout<<"Plotting Frequency: Time Gap - "<value()<currentIndex())<setTimer(slsDetectorDefs::FRAME_PERIOD,-1)*(1E-6)); + /** gets the acq period * number of frames*/ + timeMS = (spinNthFrame->value())*acqPeriodMS; + /** To make sure the period between plotting is not less than minimum plot timer in ms*/ + if(timeMSPlot Tab: Interval between Plots - The nth Image must be larger.

" + "Condition to be satisfied:\n(Acquisition Period)*(nth Image) >= 500ms." + "

Nth image adjusted to minimum, " + "for the chosen Acquisition Period.","Plot"); + spinNthFrame->setValue(minFrame); + } + /** Setting the timer value (nth frames) between plots */ + myPlot->SetFrameFactor(spinNthFrame->value()); +#ifdef VERBOSE + cout<<"Plotting Frequency: Nth Frame - "<value()<setEnabled(true); break; default: - qDefs::ErrorMessage("ERROR: Unknown detector type.","Settings: ERROR"); + qDefs::ErrorMessage("Unknown detector type.","Settings"); exit(-1); break; } @@ -104,8 +104,8 @@ void qTabSettings::SetupDetectorSettings(){ * This should not happen -only if the server and gui has a mismatch * on which all modes are allowed in detectors */ if(!(item[(int)sett]->isEnabled())){ - qDefs::ErrorMessage("ERROR: Unknown Detector Settings retrieved from detector. " - "Exiting GUI.","Settings: ERROR"); + qDefs::ErrorMessage("Unknown Detector Settings retrieved from detector. " + "Exiting GUI.","Settings"); #ifdef VERBOSE cout<<"ERROR: Unknown Detector Settings retrieved from detector."< Date: Thu, 19 Jul 2012 14:20:51 +0000 Subject: [PATCH 019/332] going to start actions git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@19 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_detectormain.ui | 119 ++++++- slsDetectorGui/forms/form_tab_dataoutput.ui | 334 +++++++++++++------ slsDetectorGui/forms/form_tab_debugging.ui | 158 ++++++++- slsDetectorGui/forms/form_tab_measurement.ui | 118 ------- slsDetectorGui/forms/form_tab_plot.ui | 2 +- slsDetectorGui/forms/form_tab_settings.ui | 81 +++-- slsDetectorGui/include/qActionsWidget.h | 22 +- slsDetectorGui/include/qDetectorMain.h | 4 +- slsDetectorGui/include/qDrawPlot.h | 6 +- slsDetectorGui/include/qTabActions.h | 17 +- slsDetectorGui/include/qTabAdvanced.h | 6 +- slsDetectorGui/include/qTabDataOutput.h | 35 +- slsDetectorGui/include/qTabDebugging.h | 13 +- slsDetectorGui/include/qTabDeveloper.h | 6 +- slsDetectorGui/include/qTabMeasurement.h | 6 +- slsDetectorGui/include/qTabMessages.h | 6 +- slsDetectorGui/include/qTabPlot.h | 19 +- slsDetectorGui/include/qTabSettings.h | 33 +- slsDetectorGui/src/qActionsWidget.cpp | 87 +++-- slsDetectorGui/src/qDetectorMain.cpp | 188 ++++++----- slsDetectorGui/src/qDrawPlot.cpp | 2 +- slsDetectorGui/src/qTabActions.cpp | 183 +++------- slsDetectorGui/src/qTabAdvanced.cpp | 2 +- slsDetectorGui/src/qTabDataOutput.cpp | 333 ++++++++++++++++-- slsDetectorGui/src/qTabDebugging.cpp | 20 +- slsDetectorGui/src/qTabDeveloper.cpp | 2 +- slsDetectorGui/src/qTabMeasurement.cpp | 2 +- slsDetectorGui/src/qTabMessages.cpp | 2 +- slsDetectorGui/src/qTabPlot.cpp | 93 ++++-- slsDetectorGui/src/qTabSettings.cpp | 144 +++++++- 30 files changed, 1433 insertions(+), 610 deletions(-) diff --git a/slsDetectorGui/forms/form_detectormain.ui b/slsDetectorGui/forms/form_detectormain.ui index 0f2049a6b..ea4ae989a 100644 --- a/slsDetectorGui/forms/form_detectormain.ui +++ b/slsDetectorGui/forms/form_detectormain.ui @@ -19,6 +19,124 @@ 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + + + 185 + 185 + 185 + + + + + + + 185 + 185 + 185 + + + + + + + 185 + 185 + 185 + + + + + + + 89 + 89 + 89 + + + + + + 9 @@ -130,7 +248,6 @@ &Help -
diff --git a/slsDetectorGui/forms/form_tab_dataoutput.ui b/slsDetectorGui/forms/form_tab_dataoutput.ui index f36c57116..5afac7644 100644 --- a/slsDetectorGui/forms/form_tab_dataoutput.ui +++ b/slsDetectorGui/forms/form_tab_dataoutput.ui @@ -7,7 +7,7 @@ 0 0 775 - 339 + 345 @@ -35,7 +35,7 @@ 20 - 75 + 110 731 206 @@ -43,114 +43,24 @@ Correction - + - 10 + 15 20 - 711 - 181 + 701 + 176 - + - + - Flat Field File - - - - - - - Rate Correction - - - - - - - Angular Conversion - - - - - - - - - - Discard Bad Channels + Flat Field File: - - - - 0 - 0 - - - - : - - - - - - - : - - - - - - - - 0 - 0 - - - - Browse - - - - - - - Auto - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 40 - 20 - - - - - - - - Custom dead time(ns): - - - - - - - Qt::Horizontal @@ -166,6 +76,178 @@ + + + + false + + + + + + + false + + + Rate Correction: + + + + + + + false + + + Auto + + + + + + + false + + + + 0 + 0 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + ns + + + 6 + + + 2000000000.000000000000000 + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + + + + + false + + + + 0 + 0 + + + + Browse + + + + + + + false + + + Custom dead time: + + + + + + + Angular Conversion + + + + + + + Discard Bad Channels + + + @@ -187,9 +269,9 @@ - 0 + 10 6 - 731 + 706 28 @@ -217,6 +299,56 @@ + + + + 245 + 327 + 256 + 16 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 193 + 193 + 193 + + + + + + + + * Note: Enter valid file to enable Flat Field. + + diff --git a/slsDetectorGui/forms/form_tab_debugging.ui b/slsDetectorGui/forms/form_tab_debugging.ui index 47d4c2a20..aeca75ca8 100644 --- a/slsDetectorGui/forms/form_tab_debugging.ui +++ b/slsDetectorGui/forms/form_tab_debugging.ui @@ -6,8 +6,8 @@ 0 0 - 748 - 350 + 775 + 345 @@ -31,19 +31,163 @@ Form - + - 232 - 141 - 75 + 265 + 30 + 251 + 36 + + + + + + + Module Number: + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + + All Modules + + + + + + + + + + 30 + 165 + 321 + 156 + + + + Digital Tests + + + + + 15 + 20 + 141 + 51 + + + + + + + Detector Module + + + + + + + Test xxx + + + + + + + + + 15 + 115 + 291 + 25 + + + + Run + + + + + + + 265 + 95 + 251 25 - PushButton + Get Detector Information + + + + 425 + 165 + 321 + 156 + + + + Analog Tests + + + + + 15 + 20 + 141 + 51 + + + + + + + Detector Module + + + + + + + Test xxx + + + + + + + + + 15 + 115 + 291 + 25 + + + + Run + + + diff --git a/slsDetectorGui/forms/form_tab_measurement.ui b/slsDetectorGui/forms/form_tab_measurement.ui index c1e0dc1da..1452b0986 100644 --- a/slsDetectorGui/forms/form_tab_measurement.ui +++ b/slsDetectorGui/forms/form_tab_measurement.ui @@ -28,124 +28,6 @@ 345 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - - - 193 - 193 - 193 - - - - - - - 188 - 188 - 188 - - - - - - - 192 - 192 - 192 - - - - - - - 0 - 0 - 0 - - - - - - Form diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index 5d3607950..cf76e55b6 100644 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -494,7 +494,7 @@ Scan - Y Axis Values - true + false false diff --git a/slsDetectorGui/forms/form_tab_settings.ui b/slsDetectorGui/forms/form_tab_settings.ui index f7184ebdd..415b80f3a 100644 --- a/slsDetectorGui/forms/form_tab_settings.ui +++ b/slsDetectorGui/forms/form_tab_settings.ui @@ -6,8 +6,8 @@ 0 0 - 748 - 339 + 775 + 345 @@ -34,10 +34,10 @@ - 13 - 16 - 311 - 151 + 30 + 20 + 316 + 171 @@ -48,7 +48,7 @@
- + @@ -107,17 +107,19 @@ - - - - Threshold: - - - - + + + eV + - -1 + -100000 + + + 100000 + + + 100 -1 @@ -138,22 +140,59 @@ - + - 16 + 1.67772e+07 - 32 + 65535 + + + + + 255 + + + + + 7 - - + + + + 1 + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + Threshold: + + diff --git a/slsDetectorGui/include/qActionsWidget.h b/slsDetectorGui/include/qActionsWidget.h index 501a1a5ff..8dd0ad07a 100644 --- a/slsDetectorGui/include/qActionsWidget.h +++ b/slsDetectorGui/include/qActionsWidget.h @@ -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); + }; diff --git a/slsDetectorGui/include/qDetectorMain.h b/slsDetectorGui/include/qDetectorMain.h index b1807f2b4..476c33022 100644 --- a/slsDetectorGui/include/qDetectorMain.h +++ b/slsDetectorGui/include/qDetectorMain.h @@ -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 @@ -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 */ diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index 4504b6d17..e4c86eac6 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -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 */ diff --git a/slsDetectorGui/include/qTabActions.h b/slsDetectorGui/include/qTabActions.h index 6c8b14c7e..8fc824fca 100644 --- a/slsDetectorGui/include/qTabActions.h +++ b/slsDetectorGui/include/qTabActions.h @@ -9,7 +9,7 @@ #define QTABACTIONS_H_ /** Project Class Headers */ -class slsDetectorUtils; +class multiSlsDetector; class ActionsWidget; #include @@ -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_ */ diff --git a/slsDetectorGui/include/qTabAdvanced.h b/slsDetectorGui/include/qTabAdvanced.h index 101d6cfd3..a0573418f 100644 --- a/slsDetectorGui/include/qTabAdvanced.h +++ b/slsDetectorGui/include/qTabAdvanced.h @@ -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; diff --git a/slsDetectorGui/include/qTabDataOutput.h b/slsDetectorGui/include/qTabDataOutput.h index 37dd81317..5372964cb 100644 --- a/slsDetectorGui/include/qTabDataOutput.h +++ b/slsDetectorGui/include/qTabDataOutput.h @@ -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 @@ -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(); }; diff --git a/slsDetectorGui/include/qTabDebugging.h b/slsDetectorGui/include/qTabDebugging.h index 8d399a6d0..f604d2161 100644 --- a/slsDetectorGui/include/qTabDebugging.h +++ b/slsDetectorGui/include/qTabDebugging.h @@ -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 */ diff --git a/slsDetectorGui/include/qTabDeveloper.h b/slsDetectorGui/include/qTabDeveloper.h index d5baf5e99..7b83e523e 100644 --- a/slsDetectorGui/include/qTabDeveloper.h +++ b/slsDetectorGui/include/qTabDeveloper.h @@ -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 */ diff --git a/slsDetectorGui/include/qTabMeasurement.h b/slsDetectorGui/include/qTabMeasurement.h index c65820f2e..4fa630602 100644 --- a/slsDetectorGui/include/qTabMeasurement.h +++ b/slsDetectorGui/include/qTabMeasurement.h @@ -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; diff --git a/slsDetectorGui/include/qTabMessages.h b/slsDetectorGui/include/qTabMessages.h index bd8be85b6..6821a55f1 100644 --- a/slsDetectorGui/include/qTabMessages.h +++ b/slsDetectorGui/include/qTabMessages.h @@ -11,7 +11,7 @@ /** Project Class Headers */ -class slsDetectorUtils; +class multiSlsDetector; /** Qt Include Headers */ #include #include @@ -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; diff --git a/slsDetectorGui/include/qTabPlot.h b/slsDetectorGui/include/qTabPlot.h index 94d5f1344..4e1701606 100644 --- a/slsDetectorGui/include/qTabPlot.h +++ b/slsDetectorGui/include/qTabPlot.h @@ -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); diff --git a/slsDetectorGui/include/qTabSettings.h b/slsDetectorGui/include/qTabSettings.h index 5729e5c41..4404368a0 100644 --- a/slsDetectorGui/include/qTabSettings.h +++ b/slsDetectorGui/include/qTabSettings.h @@ -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 @@ -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(); }; diff --git a/slsDetectorGui/src/qActionsWidget.cpp b/slsDetectorGui/src/qActionsWidget.cpp index 1004150c8..7eaceaba4 100644 --- a/slsDetectorGui/src/qActionsWidget.cpp +++ b/slsDetectorGui/src/qActionsWidget.cpp @@ -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 #include #include @@ -19,20 +19,23 @@ #include #include #include -/** C++ Include Headers */ +#include +// C++ Include Headers #include 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); + } +} diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 0730216d4..4b5cda8de 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -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 #include -/** C++ Include Headers */ +// C++ Include Headers #include #include 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; iargsetLayout(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;isetFrameShape(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 "<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<getHostname(detID)<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<getDetectorsType())<<"\t\t\tDetector : " - ""<getHostname(detID)<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 "<isChecked(); #ifdef VERBOSE - cout<<"Setting Beamline Mode to "<isChecked(); tabs->setTabEnabled(Advanced,enable); + tab_settings->EnableExpertMode(enable); #ifdef VERBOSE - cout<<"Setting Expert Mode to "<isChecked(); if(enable) @@ -271,7 +284,7 @@ void qDetectorMain::EnableModes(QAction *action){ dockWidgetPlot->setFeatures(QDockWidget::NoDockWidgetFeatures); } #ifdef VERBOSE - cout<<"Setting Dockable Mode to "<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"<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"<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"<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"<A heading + qDefs::InfoMessage("

SLS Detector GUI version: 1.0

" + "Common GUI to control the SLS Detectors: " + "Mythen, Eiger, Gotthard and Agipd.

" + "It can be operated in parallel with the command line interface:
" + "sls_detector_put,
sls_detector_get,
sls_detector_acquire and
sls_detector_help.

" + "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:"<setMinimumHeight(0); - cout<<"undocking it from main window"<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()) diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 5efbad5d5..a2f6d5e81 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -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 diff --git a/slsDetectorGui/src/qTabActions.cpp b/slsDetectorGui/src/qTabActions.cpp index 65422ee0f..ec6818dff 100644 --- a/slsDetectorGui/src/qTabActions.cpp +++ b/slsDetectorGui/src/qTabActions.cpp @@ -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 -/** C++ Include Headers */ +// C++ Include Headers #include 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;isetFixedSize(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;ihide(); + // initially hide all the widgets + for(int i=0;ihide(); } 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;iid(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(){ diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp index f01985140..0dd12a472 100644 --- a/slsDetectorGui/src/qTabAdvanced.cpp +++ b/slsDetectorGui/src/qTabAdvanced.cpp @@ -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(); diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index f860b8541..05faa7c85 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -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 -/** C++ Include Headers */ +// C++ Include Headers #include #include 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 :"<getFilePath()<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); } diff --git a/slsDetectorGui/src/qTabDebugging.cpp b/slsDetectorGui/src/qTabDebugging.cpp index 2fa080cc2..451201ca0 100644 --- a/slsDetectorGui/src/qTabDebugging.cpp +++ b/slsDetectorGui/src/qTabDebugging.cpp @@ -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 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;igetSlsDetector(i); + if(s->setTCPSocket()!=slsDetectorDefs::FAIL){ + comboModule->addItem(QString::number(i)); + } + } } diff --git a/slsDetectorGui/src/qTabDeveloper.cpp b/slsDetectorGui/src/qTabDeveloper.cpp index b0fcd68a9..c11f9c537 100644 --- a/slsDetectorGui/src/qTabDeveloper.cpp +++ b/slsDetectorGui/src/qTabDeveloper.cpp @@ -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(); diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index bd4a78e6d..6120ef36f 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -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(); diff --git a/slsDetectorGui/src/qTabMessages.cpp b/slsDetectorGui/src/qTabMessages.cpp index fc7945fc4..94a7c5889 100644 --- a/slsDetectorGui/src/qTabMessages.cpp +++ b/slsDetectorGui/src/qTabMessages.cpp @@ -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(); } diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index ef49b62df..43312db8a 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -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"<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"<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(timeMSsetValue(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(timeMSPlot Tab: Interval between Plots - The nth Image must be larger.

" "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:"<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(); } diff --git a/slsDetectorGui/src/qTabSettings.cpp b/slsDetectorGui/src/qTabSettings.cpp index deba6aea2..1f61f8ce5 100644 --- a/slsDetectorGui/src/qTabSettings.cpp +++ b/slsDetectorGui/src/qTabSettings.cpp @@ -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."<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 "<slsDetectorBase::getDetectorSettings(sett)<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(); + } + } + + } From 111608bdc8ff1d55ed7c2938779e3e3fe6f1b75e Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 24 Jul 2012 15:39:36 +0000 Subject: [PATCH 020/332] included number of triggers for number of measurements, script and parameters work for non scan types git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@20 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qActionsWidget.h | 64 +++- slsDetectorGui/include/qDrawPlot.h | 12 +- slsDetectorGui/include/qTabActions.h | 10 +- slsDetectorGui/include/qTabDebugging.h | 3 - slsDetectorGui/src/qActionsWidget.cpp | 473 ++++++++++++++++++------ slsDetectorGui/src/qDrawPlot.cpp | 20 +- slsDetectorGui/src/qTabActions.cpp | 77 ++-- slsDetectorGui/src/qTabDebugging.cpp | 11 +- slsDetectorGui/src/qTabMeasurement.cpp | 11 +- slsDetectorGui/src/qTabSettings.cpp | 2 +- 10 files changed, 501 insertions(+), 182 deletions(-) diff --git a/slsDetectorGui/include/qActionsWidget.h b/slsDetectorGui/include/qActionsWidget.h index 8dd0ad07a..fcf4c6c85 100644 --- a/slsDetectorGui/include/qActionsWidget.h +++ b/slsDetectorGui/include/qActionsWidget.h @@ -7,6 +7,11 @@ #ifndef QACTIONSWIDGET_H_ #define QACTIONSWIDGET_H_ + + +/** Project Class Headers */ +class multiSlsDetector; +/** Qt Include Headers */ #include class QGridLayout; class QComboBox; @@ -16,6 +21,11 @@ class QLabel; class QSpinBox; class QGroupBox; class QRadioButton; +class QCheckBox; +/** C++ Include Headers */ +#include +using namespace std; + class ActionsWidget : public QFrame{ @@ -24,18 +34,38 @@ 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, int id); + ActionsWidget(QWidget *parent, multiSlsDetector*& detector, int scanType, int id); ~ActionsWidget(); + /**set variable expand + */ + void SetExpand(bool expanded){expand = expanded;}; + + /**get variable expand + */ + bool isExpanded(){return expand;}; + + /**to update the widgets*/ + void Refresh(); + + + enum actions{Start,Scan0,Scan1,ActionBefore,NumPositions, + HeaderBefore,HeaderAfter,ActionAfter,Stop}; + private: + /** The sls detector object */ + multiSlsDetector *myDet; /**if its a scan type*/ int scanType; /**id of the action widget*/ int id; + /**if this widget has been expanded*/ + bool expand; QGridLayout *layout; QComboBox *comboScript; @@ -60,6 +90,12 @@ private: QComboBox *comboSpecific; QLineEdit *dispValues; QPushButton *btnValues; + QSpinBox *spinNumPos; + QComboBox *comboPos; + QPushButton *btnDelete; + QCheckBox *chkInvert; + QCheckBox *chkSeparate; + QCheckBox *chkReturn; /** Sets up the widget */ @@ -68,6 +104,12 @@ private: /** Sets up all the slots and signals */ void Initialization(); + /**Gets the sls class action index using the gui index + * @param index gui index + */ + int GetActionIndex(int gIndex); + + private slots: /** Sets the scan or script. Accordingly enables, disables other widgets @@ -82,10 +124,26 @@ void EnableSizeWidgets(); * */ void BrowsePath(); +/** Sets the script file + * */ +void SetScriptFile(); + +/** Set Parameter + * @param parameter is the parameter to be set to + * */ +void SetParameter(const QString& parameter); + +/** Sets the number of positions + * */ +void SetNumPositions(int index); + +/** Deletes current position + * */ +void DeletePosition(); + + signals: void EnableScanBox(bool,int); -void SetScriptSignal(QString&,int); - }; diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index e4c86eac6..4e6004122 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -91,7 +91,13 @@ public: void StartStopDaqToggle(bool stop_if_running=0); /** Set number of measurements * @param num number of measurements to be set */ - void setNumMeasurements(int num); + void setNumMeasurements(int num){number_of_measurements = num;}; + /** Set frame enabled + * @param enable enable*/ + void setFrameEnabled(bool enable){isFrameEnabled = enable;}; + /** Set trigger enabled + * @param enable enable */ + void setTriggerEnabled(bool enable){isTriggerEnabled = enable;}; private: @@ -212,6 +218,10 @@ private: /** every nth frame when to plot */ int frameFactor; bool plotLock; + /**if frame is enabled in measurement tab */ + bool isFrameEnabled; + /**if trigger is enabled in measurement tab */ + bool isTriggerEnabled; /** Initializes all its members and the thread */ diff --git a/slsDetectorGui/include/qTabActions.h b/slsDetectorGui/include/qTabActions.h index 8fc824fca..85ca2b57c 100644 --- a/slsDetectorGui/include/qTabActions.h +++ b/slsDetectorGui/include/qTabActions.h @@ -11,7 +11,7 @@ /** Project Class Headers */ class multiSlsDetector; class ActionsWidget; - +/** Qt Include Headers */ #include #include #include @@ -57,9 +57,6 @@ 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(); @@ -67,14 +64,11 @@ private: void Initialization(); + 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); diff --git a/slsDetectorGui/include/qTabDebugging.h b/slsDetectorGui/include/qTabDebugging.h index f604d2161..8b9ad1820 100644 --- a/slsDetectorGui/include/qTabDebugging.h +++ b/slsDetectorGui/include/qTabDebugging.h @@ -53,9 +53,6 @@ private: */ void Initialization(); - /** Enables/Disables all the widgets - */ - void Enable(bool enable); }; diff --git a/slsDetectorGui/src/qActionsWidget.cpp b/slsDetectorGui/src/qActionsWidget.cpp index 7eaceaba4..230626210 100644 --- a/slsDetectorGui/src/qActionsWidget.cpp +++ b/slsDetectorGui/src/qActionsWidget.cpp @@ -4,9 +4,12 @@ * Created on: May 10, 2012 * Author: l_maliakal_d */ - +// Project Class Headers +#include "slsDetector.h" +#include "multiSlsDetector.h" // Qt Project Class Headers #include "qActionsWidget.h" +#include "qDefs.h" // Qt Include Headers #include #include @@ -20,6 +23,7 @@ #include #include #include +#include // C++ Include Headers #include using namespace std; @@ -28,8 +32,8 @@ using namespace std; //------------------------------------------------------------------------------------------------------------------------------------------------- -ActionsWidget::ActionsWidget(QWidget *parent, int scanType, int id): - QFrame(parent),scanType(scanType),id(id){ +ActionsWidget::ActionsWidget(QWidget *parent,multiSlsDetector*& detector, int scanType, int id): + QFrame(parent),myDet(detector),scanType(scanType),id(id),expand(false){ SetupWidgetWindow(); Initialization(); } @@ -39,6 +43,7 @@ ActionsWidget::ActionsWidget(QWidget *parent, int scanType, int id): ActionsWidget::~ActionsWidget(){ + delete myDet; delete layout; } @@ -50,136 +55,169 @@ void ActionsWidget::SetupWidgetWindow(){ // Widget Settings //setFrameStyle(QFrame::Box); //setFrameShadow(QFrame::Raised); + // Main Layout Settings setFixedHeight(25); if(scanType) setFixedHeight(125); - - - // Main Layout Settings layout = new QGridLayout(this); setLayout(layout); layout->setContentsMargins(0,0,0,0); if(scanType) layout->setVerticalSpacing(5); + if(id==NumPositions){ + setFixedHeight(75); + QLabel *lblNumPos = new QLabel("Number of Positions:"); + lblNumPos->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); + layout->addWidget(lblNumPos,0,0); + spinNumPos = new QSpinBox(this); + layout->addWidget(spinNumPos,0,1); + layout->addItem(new QSpacerItem(80,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,2); + QLabel *lblPosList = new QLabel("List of Positions:"); + lblPosList->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); + layout->addWidget(lblPosList,0,3); + comboPos = new QComboBox(this); + comboPos->setEditable(true); + comboPos->setCompleter(0); + layout->addWidget(comboPos,0,4); + btnDelete = new QPushButton("Delete"); + btnDelete->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); + layout->addWidget(btnDelete,0,5); + + QGroupBox *w = new QGroupBox; + layout->addWidget(w,1,0,1,6); + QHBoxLayout *l1 = new QHBoxLayout(w); + l1->setContentsMargins(0,0,0,0); + l1->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); + chkInvert = new QCheckBox("Invert Angles"); + l1->addWidget(chkInvert); + chkSeparate = new QCheckBox("Separate Two Halves"); + l1->addWidget(chkSeparate); + chkReturn = new QCheckBox("Return to Start Position"); + chkReturn->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); + l1->addWidget(chkReturn); + l1->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); + - // Main Widgets - comboScript = new QComboBox(this); - if(!scanType){ - comboScript->addItem("None"); - comboScript->addItem("Custom Script"); }else{ - comboScript->addItem("None"); - comboScript->addItem("Energy Scan"); - comboScript->addItem("Threshold Scan"); - comboScript->addItem("Trimbits Scan"); - comboScript->addItem("Custom Script"); - } + // Main Widgets + comboScript = new QComboBox(this); + if(!scanType){ + comboScript->addItem("None"); + comboScript->addItem("Custom Script"); + }else{ + comboScript->addItem("None"); + comboScript->addItem("Energy Scan"); + comboScript->addItem("Threshold Scan"); + comboScript->addItem("Trimbits Scan"); + comboScript->addItem("Custom Script"); + } layout->addWidget(comboScript,0,0); - layout->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,1); - dispScript = new QLineEdit("None"); + layout->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,1); + dispScript = new QLineEdit(""); dispScript->setEnabled(false); layout->addWidget(dispScript,0,2); - btnBrowse = new QPushButton("Browse"); + btnBrowse = new QPushButton("Browse"); btnBrowse->setEnabled(false); layout->addWidget(btnBrowse,0,3); - layout->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,4); - lblParameter = new QLabel("Additional Parameter:"); + layout->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,4); + lblParameter = new QLabel("Additional Parameter:"); lblParameter->setEnabled(false); layout->addWidget(lblParameter,0,5); - dispParameter = new QLineEdit("None"); + dispParameter = new QLineEdit(""); dispParameter->setEnabled(false); dispParameter->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); layout->addWidget(dispParameter,0,6); - // Scan Levels Widgets - if(scanType){ - lblSteps = new QLabel("Number of Steps:"); + // Scan Levels Widgets + if(scanType){ + lblSteps = new QLabel("Number of Steps:"); lblSteps->setEnabled(false); layout->addWidget(lblSteps,1,2); - spinSteps = new QSpinBox(this); + spinSteps = new QSpinBox(this); spinSteps->setEnabled(false); layout->addWidget(spinSteps,1,3); - lblPrecision = new QLabel("Precision:"); + lblPrecision = new QLabel("Precision:"); lblPrecision->setEnabled(false); layout->addWidget(lblPrecision,1,5); - spinPrecision = new QSpinBox(this); + spinPrecision = new QSpinBox(this); spinPrecision->setEnabled(false); layout->addWidget(spinPrecision,1,6); - group = new QGroupBox(this); + group = new QGroupBox(this); group->setEnabled(false); // Fix the size of the groupbox group->setFixedSize(513,66); - layout->addWidget(group,2,2,1,5); + layout->addWidget(group,2,2,1,6); - // 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); - h1->setContentsMargins(0, 0, 0, 0); - radioConstant = new QRadioButton("Constant Step Size",h1Widget); + // 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); + h1->setContentsMargins(0, 0, 0, 0); + radioConstant = new QRadioButton("Constant Step Size",h1Widget); radioConstant->setChecked(true); h1->addWidget(radioConstant); - radioSpecific = new QRadioButton("Specific Values",h1Widget); + radioSpecific = new QRadioButton("Specific Values",h1Widget); h1->addWidget(radioSpecific); - radioValue = new QRadioButton("Values from File",h1Widget); + radioValue = new QRadioButton("Values from File",h1Widget); radioValue->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); h1->addWidget(radioValue); - // Constant Size Layout - QWidget *h2ConstantWidget = new QWidget(group); - h2ConstantWidget->setGeometry(QRect(10, 30, group->width()-20, 31)); - QHBoxLayout *h2Constant = new QHBoxLayout(h2ConstantWidget); - h2Constant->setContentsMargins(0, 0, 0, 0); + // Constant Size Layout + QWidget *h2ConstantWidget = new QWidget(group); + h2ConstantWidget->setGeometry(QRect(10, 30, group->width()-20, 31)); + QHBoxLayout *h2Constant = new QHBoxLayout(h2ConstantWidget); + h2Constant->setContentsMargins(0, 0, 0, 0); - h2Constant->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); - lblFrom = new QLabel("from",h2ConstantWidget); + h2Constant->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); + lblFrom = new QLabel("from",h2ConstantWidget); lblFrom->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); h2Constant->addWidget(lblFrom); - spinFrom = new QSpinBox(h2ConstantWidget); + spinFrom = new QSpinBox(h2ConstantWidget); h2Constant->addWidget(spinFrom); - lblTo = new QLabel("to",h2ConstantWidget); + lblTo = new QLabel("to",h2ConstantWidget); lblTo->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); h2Constant->addWidget(lblTo); - spinTo = new QSpinBox(h2ConstantWidget); + spinTo = new QSpinBox(h2ConstantWidget); h2Constant->addWidget(spinTo); - h2Constant->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); - lblSize = new QLabel("Size",h2ConstantWidget); + h2Constant->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); + lblSize = new QLabel("Size",h2ConstantWidget); lblSize->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); h2Constant->addWidget(lblSize); - spinSize = new QSpinBox(h2ConstantWidget); + spinSize = new QSpinBox(h2ConstantWidget); h2Constant->addWidget(spinSize); - h2Constant->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); + h2Constant->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); - // Specific Values Layout - QWidget *h2SpecificWidget = new QWidget(group); - h2SpecificWidget->setGeometry(QRect(10, 30, group->width()-20, 31)); - QHBoxLayout *h2Specific = new QHBoxLayout(h2SpecificWidget); - h2Specific->setContentsMargins(0, 0, 0, 0); - h2Specific->addItem(new QSpacerItem(200,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); - comboSpecific = new QComboBox(h2SpecificWidget); + // Specific Values Layout + QWidget *h2SpecificWidget = new QWidget(group); + h2SpecificWidget->setGeometry(QRect(10, 30, group->width()-20, 31)); + QHBoxLayout *h2Specific = new QHBoxLayout(h2SpecificWidget); + h2Specific->setContentsMargins(0, 0, 0, 0); + h2Specific->addItem(new QSpacerItem(200,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); + comboSpecific = new QComboBox(h2SpecificWidget); h2Specific->addWidget(comboSpecific); comboSpecific->hide(); - h2Specific->addItem(new QSpacerItem(200,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); + h2Specific->addItem(new QSpacerItem(200,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); - // Values From a File Layout - QWidget *h2ValuesWidget = new QWidget(group); - h2ValuesWidget->setGeometry(QRect(10, 30, group->width()-20, 31)); - QHBoxLayout *h2Values = new QHBoxLayout(h2ValuesWidget); - h2Values->setContentsMargins(0, 0, 0, 0); - h2Values->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); - dispValues = new QLineEdit("steps.txt",h2ValuesWidget); + // Values From a File Layout + QWidget *h2ValuesWidget = new QWidget(group); + h2ValuesWidget->setGeometry(QRect(10, 30, group->width()-20, 31)); + QHBoxLayout *h2Values = new QHBoxLayout(h2ValuesWidget); + h2Values->setContentsMargins(0, 0, 0, 0); + h2Values->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); + dispValues = new QLineEdit("steps.txt",h2ValuesWidget); dispValues->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed); h2Values->addWidget(dispValues); dispValues->hide(); - btnValues = new QPushButton("Browse",h2ValuesWidget); + btnValues = new QPushButton("Browse",h2ValuesWidget); btnValues->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); h2Values->addWidget(btnValues); btnValues->hide(); - h2Values->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); + h2Values->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); + } } } @@ -189,55 +227,20 @@ void ActionsWidget::SetupWidgetWindow(){ void ActionsWidget::Initialization(){ - connect(comboScript,SIGNAL(currentIndexChanged(int)),this,SLOT(SetScript(int))); - 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 - dispScript->setEnabled(false); - btnBrowse->setEnabled(false); - lblParameter->setEnabled(false); - dispParameter->setEnabled(false); - 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(index){ - // 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(id==NumPositions){ + connect(spinNumPos, SIGNAL(valueChanged(int)), this, SLOT(SetNumPositions(int))); + connect(btnDelete, SIGNAL(clicked()), this, SLOT(DeletePosition())); + }else{ + connect(comboScript, SIGNAL(currentIndexChanged(int)), this,SLOT(SetScript(int))); + connect(dispScript, SIGNAL(editingFinished()), this, SLOT(SetScriptFile())); + connect(btnBrowse, SIGNAL(clicked()), this, SLOT(BrowsePath())); + connect(dispParameter, SIGNAL(textChanged(const QString&)), this, SLOT(SetParameter(const QString&))); if(scanType){ - group->setEnabled(true); - lblPrecision->setEnabled(true); - spinPrecision->setEnabled(true); - // Steps are enabled only if constant step size is not checked - lblSteps->setEnabled(!radioConstant->isChecked()); - spinSteps->setEnabled(!radioConstant->isChecked()); + connect(radioConstant, SIGNAL(toggled(bool)),this,SLOT(EnableSizeWidgets())); + connect(radioSpecific, SIGNAL(toggled(bool)),this,SLOT(EnableSizeWidgets())); + connect(radioValue, SIGNAL(toggled(bool)),this,SLOT(EnableSizeWidgets())); } } - //emit signal to enable scanbox and the radiobuttons - if(scanType) emit EnableScanBox(index,((id==2)?1:0)); } @@ -278,17 +281,249 @@ void ActionsWidget::EnableSizeWidgets(){ } +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void ActionsWidget::SetScript(int index){ + // defaults + dispScript->setEnabled(false); + btnBrowse->setEnabled(false); + lblParameter->setEnabled(false); + dispParameter->setEnabled(false); + 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(index){ + // 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(scanType){ + group->setEnabled(true); + lblPrecision->setEnabled(true); + spinPrecision->setEnabled(true); + // Steps are enabled only if constant step size is not checked + lblSteps->setEnabled(!radioConstant->isChecked()); + spinSteps->setEnabled(!radioConstant->isChecked()); + } + } + //emit signal to enable scanbox and the radiobuttons + if(scanType) emit EnableScanBox(index,((id==2)?1:0)); + +#ifdef VERBOSE + cout << "Setting mode of action widget:" << id << " to " << index << endl; +#endif + QString fName = dispScript->text(); + //script + if((id!=Scan0)&&(id!=Scan1)) + //scan and positions wouldnt get here + if(index) myDet->setActionScript(GetActionIndex(id),fName.toAscii().constData()); + else myDet->setActionScript(GetActionIndex(id),""); + //scan + else{ + + } + + cout<<"mode:"<getActionMode(GetActionIndex(id))<<" " + "script:"<getActionScript(GetActionIndex(id))<<" " + "parameter:"<getActionParameter(GetActionIndex(id))<text(); QString dir = fName.section('/',0,-2,QString::SectionIncludeLeadingSep); if(dir.isEmpty()) dir = "/home"; + //dialog fName = QFileDialog::getOpenFileName(this, tr("Load Script File"),dir, tr("Script Files(*.awk);;All Files(*)"));//,0,QFileDialog::ShowDirsOnly); - if (!fName.isEmpty()){ + //if empty, set the file name and it calls setscriptfile, else ignore + if (!fName.isEmpty()) dispScript->setText(fName); - emit SetScriptSignal(fName,id); +} + +//------------------------------------------------------------------------------------------------------------------------------------------------- + +void ActionsWidget::SetScriptFile(){ + QString fName = dispScript->text();bool set = false; +#ifdef VERBOSE + cout << "Setting script file of action widget:" << id << " to " << fName.toAscii().constData() << endl; +#endif + disconnect(dispScript, SIGNAL(editingFinished()), this, SLOT(SetScriptFile())); + + //blank + if(fName.isEmpty()) + set = true; + //not blank + else{ + QString file = dispScript->text().section('/',-1); + //is a file + if(file.contains('.')){ + //check if it exists and set the script file + if(QFile::exists(fName)) + set = true; + //if the file doesnt exist, set it to what it was before + else{ + qDefs::WarningMessage("The script file entered does not exist","ActionsWidget"); + dispScript->setText(QString(myDet->getActionScript(GetActionIndex(id)).c_str())); + } + }//not a file, set it to what it was before + else { + qDefs::WarningMessage("The script file path entered is not a file","ActionsWidget"); + dispScript->setText(QString(myDet->getActionScript(GetActionIndex(id)).c_str())); + } + } + + //if blank or valid file + if(set){ + //script + if((id!=Scan0)&&(id!=Scan1)){ + //scan and positions wouldnt get here + if(!myDet->setActionScript(GetActionIndex(id),fName.toAscii().constData())){ + //did not get set, write what is was before + if(!fName.isEmpty()) + qDefs::WarningMessage("The script file could not be set. Reverting to previous file.","ActionsWidget"); + dispScript->setText(QString(myDet->getActionScript(GetActionIndex(id)).c_str())); + } + } + //scan + else{ + + } + } + + //dont display if theres a none + if(!dispScript->text().compare("none")) dispScript->setText(""); + + connect(dispScript, SIGNAL(editingFinished()), this, SLOT(SetScriptFile())); + +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void ActionsWidget::SetParameter(const QString& parameter){ +#ifdef VERBOSE + cout << "Setting parameter of action widget:" << id << " to " << parameter.toAscii().constData() << endl; +#endif + //script + if((id!=ActionsWidget::Scan0)&&(id!=ActionsWidget::Scan1)) + //scan and positions wouldnt get here + myDet->setActionParameter(GetActionIndex(id),parameter.toAscii().constData()); + //scan + else{ + } } + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + +void ActionsWidget::SetNumPositions(int index){ + //comboPos->setEnabled(index); + //if there arent enough positions + if((index) && (comboPos->count()setValue(comboPos->count()); + }else{ + //emit SetPositionsSignal(); + } +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void ActionsWidget::DeletePosition(){ + QString pos = comboPos->currentText(); + bool found = false; + //loops through to find the index and to make sure its in the list + for(int i=0;icount();i++){ + if(!comboPos->itemText(i).compare(pos)){ + found = true; + comboPos->removeItem(i); + break; + } + } + //give the warning only when you try to delete stuff that arent there + if((!found)&&(comboPos->count())) qDefs::WarningMessage("This position cannot be deleted as it doesn't exist in the list anyway","ActionsWidget"); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void ActionsWidget::Refresh(){ + //disabling signals and slots + if(id==NumPositions){ + + }else{ + disconnect(dispScript, SIGNAL(editingFinished()), this, SLOT(SetScriptFile())); + disconnect(dispParameter, SIGNAL(textChanged(const QString&)),this, SLOT(SetParameter(const QString&))); + } + + + int mode;string script,parameter; + if((id == Scan0)||(id == Scan1)){ + + }else if(id == NumPositions){ + + }else{ + mode = (myDet->getActionMode(GetActionIndex(id))>0?1:0); + script = myDet->getActionScript(GetActionIndex(id)); + parameter = myDet->getActionParameter(GetActionIndex(id)); + //defaults + if(script == "none") script=""; + if(parameter == "none") parameter=""; + //settings values + dispScript->setText(QString(script.c_str())); + dispParameter->setText(QString(parameter.c_str())); + //set mode which also checks everything + comboScript->setCurrentIndex(mode); + } + + + //enabling signals and slots + if(id==NumPositions){ + + }else{ + connect(dispScript, SIGNAL(editingFinished()), this, SLOT(SetScriptFile())); + connect(dispParameter, SIGNAL(textChanged(const QString&)),this, SLOT(SetParameter(const QString&))); + } +#ifdef VERBOSE + cout << "Updated action widget " << id << "\tscript:" << script << "\tparameter:" << parameter << endl; +#endif +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +int ActionsWidget::GetActionIndex(int gIndex){ + switch(gIndex){ + case Start: return slsDetectorDefs::startScript; + case ActionBefore: return slsDetectorDefs::scriptBefore; + case HeaderBefore: return slsDetectorDefs::headerBefore; + case HeaderAfter: return slsDetectorDefs::headerAfter; + case ActionAfter: return slsDetectorDefs::scriptAfter; + case Stop: return slsDetectorDefs::stopScript; + default: return -1; + } +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index a2f6d5e81..1995add10 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -27,7 +27,8 @@ using namespace std; //------------------------------------------------------------------------------------------------------------------------------------------------- -qDrawPlot::qDrawPlot(QWidget *parent,multiSlsDetector*& detector):QWidget(parent),myDet(detector){ +qDrawPlot::qDrawPlot(QWidget *parent,multiSlsDetector*& detector): + QWidget(parent),myDet(detector){ SetupWidgetWindow(); Initialization(); StartStopDaqToggle(); //as default @@ -79,6 +80,8 @@ void qDrawPlot::SetupWidgetWindow(){ timerValue = PLOT_TIMER_MS; frameFactor=0; plotLock = false; + isFrameEnabled = false; + isTriggerEnabled = false; /** This is so that it initially stop and plots */ running = 1; for(int i=0;isetTimer(slsDetectorDefs::FRAME_NUMBER,-1); + int numFrames = (isFrameEnabled)*((int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1)); + int numTriggers = (isTriggerEnabled)*((int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1)); + + numFrames = ((numFrames==0)?1:numFrames); + numTriggers = ((numTriggers==0)?1:numTriggers); + + + number_of_exposures= numFrames * numTriggers; cout<<"\tNumber of Exposures:"<setTimer(slsDetectorDefs::ACQUISITION_TIME,-1))*1E-9); @@ -351,12 +361,6 @@ int qDrawPlot::GetData(detectorData *data){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void qDrawPlot::setNumMeasurements(int num){ - number_of_measurements = num; -} - -//------------------------------------------------------------------------------------------------------------------------------------------------- - void qDrawPlot::SelectPlot(int i){ //1 for 1D otherwise 2D if(i==1){ plot1D->SetXTitle(histXAxisTitle.toAscii().constData()); diff --git a/slsDetectorGui/src/qTabActions.cpp b/slsDetectorGui/src/qTabActions.cpp index ec6818dff..691f16ccc 100644 --- a/slsDetectorGui/src/qTabActions.cpp +++ b/slsDetectorGui/src/qTabActions.cpp @@ -18,6 +18,7 @@ using namespace std; +//------------------------------------------------------------------------------------------------------------------------------------------------- qTabActions::qTabActions(QWidget *parent,multiSlsDetector*& detector): @@ -27,6 +28,7 @@ qTabActions::qTabActions(QWidget *parent,multiSlsDetector*& detector): } +//------------------------------------------------------------------------------------------------------------------------------------------------- qTabActions::~qTabActions(){ @@ -34,11 +36,12 @@ qTabActions::~qTabActions(){ } +//------------------------------------------------------------------------------------------------------------------------------------------------- void qTabActions::SetupWidgetWindow(){ // Window Settings - setFixedSize(705,350); + setFixedSize(710,350); setContentsMargins(0,0,0,0); // Scroll Area Settings @@ -56,13 +59,14 @@ void qTabActions::SetupWidgetWindow(){ group = new QButtonGroup(this); palette = new QPalette(); + // For each level of Actions for(int i=0;isetFixedSize(20,20); @@ -78,36 +82,43 @@ void qTabActions::SetupWidgetWindow(){ } // 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"); + lblName[ActionsWidget::Start]->setText("Action at Start"); + lblName[ActionsWidget::Scan0]->setText("Scan Level 0"); + lblName[ActionsWidget::Scan1]->setText("Scan Level 1"); + lblName[ActionsWidget::ActionBefore]->setText("Action before each Frame"); + lblName[ActionsWidget::NumPositions]->setText("Positions"); + lblName[ActionsWidget::HeaderBefore]->setText("Header before Frame"); + lblName[ActionsWidget::HeaderAfter]->setText("Header after Frame"); + lblName[ActionsWidget::ActionAfter]->setText("Action after each Frame"); + lblName[ActionsWidget::Stop]->setText("Action at Stop"); // initially hide all the widgets for(int i=0;ihide(); + //Number of positions is only for mythen or gotthard + slsDetectorDefs::detectorType detType = myDet->getDetectorsType(); + if((detType == slsDetectorDefs::EIGER) || (detType == slsDetectorDefs::AGIPD)) { + lblName[ActionsWidget::NumPositions]->setEnabled(false); + btnExpand[ActionsWidget::NumPositions]->setEnabled(false); + } + } +//------------------------------------------------------------------------------------------------------------------------------------------------- + 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))); + connect(actionWidget[ActionsWidget::Scan0],SIGNAL(EnableScanBox(bool,int)), this,SIGNAL(EnableScanBox(bool,int))); + connect(actionWidget[ActionsWidget::Scan1],SIGNAL(EnableScanBox(bool,int)), this,SIGNAL(EnableScanBox(bool,int))); - for(int i=0;iid(button); @@ -117,8 +128,11 @@ void qTabActions::Expand(QAbstractButton *button ){ lblName[index]->setPalette(*palette); actionWidget[index]->hide(); button->setText("+"); - if((index==Scan0)||(index==Scan1)) + if((index==ActionsWidget::Scan0)||(index==ActionsWidget::Scan1)){ setFixedHeight(height()-130); + } + else if(index==ActionsWidget::NumPositions) + setFixedHeight(height()-80); else setFixedHeight(height()-30); }else{ @@ -127,29 +141,28 @@ void qTabActions::Expand(QAbstractButton *button ){ lblName[index]->setPalette(*palette); actionWidget[index]->show(); button->setText("-"); - if((index==Scan0)||(index==Scan1)) + if((index==ActionsWidget::Scan0)||(index==ActionsWidget::Scan1)){ setFixedHeight(height()+130); + } + else if(index==ActionsWidget::NumPositions) + setFixedHeight(height()+80); else setFixedHeight(height()+30); } } -//------------------------------------------------------------------------------------------------------------------------------------------------- - - -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::Refresh(){ - +#ifdef VERBOSE + cout << "Updating action widgets " << endl; +#endif + for(int i=0;iRefresh(); } + //------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/slsDetectorGui/src/qTabDebugging.cpp b/slsDetectorGui/src/qTabDebugging.cpp index 451201ca0..7e77113ec 100644 --- a/slsDetectorGui/src/qTabDebugging.cpp +++ b/slsDetectorGui/src/qTabDebugging.cpp @@ -15,6 +15,8 @@ using namespace std; +//------------------------------------------------------------------------------------------------------------------------------------------------- + qTabDebugging::qTabDebugging(QWidget *parent,multiSlsDetector*& detector):QWidget(parent),myDet(detector){ setupUi(this); @@ -23,6 +25,7 @@ qTabDebugging::qTabDebugging(QWidget *parent,multiSlsDetector*& detector):QWidge } +//------------------------------------------------------------------------------------------------------------------------------------------------- qTabDebugging::~qTabDebugging(){ @@ -30,6 +33,7 @@ qTabDebugging::~qTabDebugging(){ } +//------------------------------------------------------------------------------------------------------------------------------------------------- void qTabDebugging::SetupWidgetWindow(){ @@ -49,6 +53,7 @@ void qTabDebugging::SetupWidgetWindow(){ } } +//------------------------------------------------------------------------------------------------------------------------------------------------- void qTabDebugging::Initialization(){ @@ -56,12 +61,6 @@ void qTabDebugging::Initialization(){ -void qTabDebugging::Enable(bool enable){ - //this->setEnabled(enable); - -} - - //------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 6120ef36f..5b6b6a172 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -634,10 +634,14 @@ void qTabMeasurement::setTimingMode(int mode){ #endif } - /** To reconnect all the signals after changing their values*/ Initialization(1); + + // to let qdrawplot know that triggers or frames are used + myPlot->setFrameEnabled(lblNumTriggers->isEnabled()); + myPlot->setTriggerEnabled(lblNumFrames->isEnabled()); + return; } @@ -654,6 +658,11 @@ void qTabMeasurement::Refresh(){ lblProgressIndex->setText(QString::number(myDet->getFileIndex())); /** Timing mode**/ SetupTimingMode(); + + // to let qdrawplot know that triggers or frames are used + myPlot->setFrameEnabled(lblNumTriggers->isEnabled()); + myPlot->setTriggerEnabled(lblNumFrames->isEnabled()); + } diff --git a/slsDetectorGui/src/qTabSettings.cpp b/slsDetectorGui/src/qTabSettings.cpp index 1f61f8ce5..572667919 100644 --- a/slsDetectorGui/src/qTabSettings.cpp +++ b/slsDetectorGui/src/qTabSettings.cpp @@ -211,7 +211,7 @@ void qTabSettings::SetDynamicRange(int index){ #endif ret=myDet->setDynamicRange(dr); if(ret!=dr){ - qDefs::WarningMessage("Dynamic Range cannot be set for this value.","Settings"); + qDefs::WarningMessage("Dynamic Range cannot be set to this value.","Settings"); #ifdef VERBOSE cout << "ERROR: Setting dynamic range to "<< ret << endl; #endif From 63f9d04981f269fb4bf70224edf41b6ae4149df1 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 27 Jul 2012 10:01:35 +0000 Subject: [PATCH 021/332] actions without scan, positions, min plotimer=250,acquisition problem,error showing in actions tab git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@21 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/doxy.config | 4 + slsDetectorGui/forms/form_action.ui | 163 +++++++ slsDetectorGui/forms/form_scan.ui | 403 +++++++++++++++ slsDetectorGui/forms/form_tab_measurement.ui | 12 +- slsDetectorGui/forms/form_tab_plot.ui | 20 +- slsDetectorGui/include/qActionsWidget.h | 97 +--- slsDetectorGui/include/qDrawPlot.h | 2 +- slsDetectorGui/include/qScanWidget.h | 99 ++++ slsDetectorGui/include/qTabActions.h | 54 +- slsDetectorGui/slsDetectorGui.pro | 6 +- slsDetectorGui/src/qActionsWidget.cpp | 489 ++++--------------- slsDetectorGui/src/qDrawPlot.cpp | 118 ++--- slsDetectorGui/src/qScanWidget.cpp | 321 ++++++++++++ slsDetectorGui/src/qTabActions.cpp | 301 ++++++++++-- slsDetectorGui/src/qTabMeasurement.cpp | 8 +- slsDetectorGui/src/qTabPlot.cpp | 12 +- 16 files changed, 1483 insertions(+), 626 deletions(-) create mode 100644 slsDetectorGui/forms/form_action.ui create mode 100644 slsDetectorGui/forms/form_scan.ui create mode 100644 slsDetectorGui/include/qScanWidget.h create mode 100644 slsDetectorGui/src/qScanWidget.cpp diff --git a/slsDetectorGui/doxy.config b/slsDetectorGui/doxy.config index 2fabbef2b..877d4c456 100644 --- a/slsDetectorGui/doxy.config +++ b/slsDetectorGui/doxy.config @@ -87,6 +87,10 @@ INPUT = \ src/qTabPlot.cpp\ include/qTabActions.h\ src/qTabActions.cpp\ + include/qActionsWidget.h\ + src/qActionsWidget.cpp\ + include/qScanWidget.h\ + src/qScanWidget.cpp\ include/qTabAdvanced.h\ src/qTabAdvanced.cpp\ include/qTabSettings.h\ diff --git a/slsDetectorGui/forms/form_action.ui b/slsDetectorGui/forms/form_action.ui new file mode 100644 index 000000000..65973ed65 --- /dev/null +++ b/slsDetectorGui/forms/form_action.ui @@ -0,0 +1,163 @@ + + + ActionsObject + + + + 0 + 0 + 680 + 25 + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 1000 + 1000 + + + + Form + + + + 0 + + + 0 + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + + + + + + None + + + + + Custom Script + + + + + + + + false + + + + + + + false + + + Additional Parameter: + + + + + + + false + + + Browse + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 5 + 20 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 5 + 20 + + + + + + + + false + + + + 0 + 0 + + + + + + + + + diff --git a/slsDetectorGui/forms/form_scan.ui b/slsDetectorGui/forms/form_scan.ui new file mode 100644 index 000000000..2cbd35cd8 --- /dev/null +++ b/slsDetectorGui/forms/form_scan.ui @@ -0,0 +1,403 @@ + + + ScanObject + + + + 0 + 0 + 724 + 125 + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 1000 + 1000 + + + + Form + + + + 0 + + + 5 + + + 0 + + + + + false + + + + 0 + 0 + + + + + 180 + 0 + + + + + + + + 0 + + + 5 + + + 0 + + + + + + + Constant Step Size + + + true + + + + + + + Specific Values + + + false + + + + + + + + 0 + 0 + + + + Values from File + + + false + + + + + + + + + + + + + + + + + + + 0 + + + + + false + + + + 0 + 0 + + + + Precision: + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 5 + 20 + + + + + + + + false + + + + 0 + 0 + + + + 0 + + + 10 + + + 0 + + + + + + + + + 0 + + + + + false + + + + 0 + 0 + + + + Additional Parameter: + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 5 + 20 + + + + + + + + false + + + + 0 + 0 + + + + + + + + + + 0 + + + + + false + + + + 0 + 0 + + + + Number of Steps: + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 5 + 20 + + + + + + + + false + + + + 0 + 0 + + + + 1 + + + 1000000 + + + 2 + + + + + + + + + + None + + + + + Energy Scan + + + + + Threshold Scan + + + + + Trimbits Scan + + + + + Custom Script + + + + + + + + 0 + + + + + false + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 5 + 20 + + + + + + + + false + + + Browse + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 30 + 20 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + + + + + + diff --git a/slsDetectorGui/forms/form_tab_measurement.ui b/slsDetectorGui/forms/form_tab_measurement.ui index 1452b0986..3abf18353 100644 --- a/slsDetectorGui/forms/form_tab_measurement.ui +++ b/slsDetectorGui/forms/form_tab_measurement.ui @@ -221,13 +221,13 @@ - 0 + 1 2000000000 - 0 + 1 @@ -363,13 +363,13 @@ - 0 + 1 2000000000 - 0 + 1 @@ -417,13 +417,13 @@ - 0 + 1 2000000000 - 0 + 1 diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index cf76e55b6..395a73f0e 100644 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -196,7 +196,7 @@ 10 20 - 356 + 358 26 @@ -219,6 +219,9 @@ + + false + 0 @@ -232,6 +235,9 @@ + + false + 0 @@ -373,6 +379,9 @@ + + false + 0 @@ -402,6 +411,9 @@ + + false + 0 @@ -1054,6 +1066,9 @@ + + false + 0 @@ -1442,6 +1457,9 @@ + + false + 0 diff --git a/slsDetectorGui/include/qActionsWidget.h b/slsDetectorGui/include/qActionsWidget.h index fcf4c6c85..32f35c51a 100644 --- a/slsDetectorGui/include/qActionsWidget.h +++ b/slsDetectorGui/include/qActionsWidget.h @@ -1,5 +1,5 @@ /* - * qTabActions.h + * qActionsWidget.h * * Created on: May 10, 2012 * Author: l_maliakal_d @@ -8,118 +8,60 @@ #ifndef QACTIONSWIDGET_H_ #define QACTIONSWIDGET_H_ - +/** Form Header */ +#include "ui_form_action.h" /** Project Class Headers */ class multiSlsDetector; /** Qt Include Headers */ -#include -class QGridLayout; -class QComboBox; -class QLineEdit; -class QPushButton; -class QLabel; -class QSpinBox; -class QGroupBox; -class QRadioButton; -class QCheckBox; + /** C++ Include Headers */ #include using namespace std; -class ActionsWidget : public QFrame{ +class qActionsWidget : public QWidget,private Ui::ActionsObject{ Q_OBJECT 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, multiSlsDetector*& detector, int scanType, int id); + qActionsWidget(QWidget *parent, multiSlsDetector*& detector); - ~ActionsWidget(); - - /**set variable expand - */ - void SetExpand(bool expanded){expand = expanded;}; - - /**get variable expand - */ - bool isExpanded(){return expand;}; + ~qActionsWidget(); /**to update the widgets*/ void Refresh(); + /**number of action widgets*/ + static int NUM_ACTION_WIDGETS; + - enum actions{Start,Scan0,Scan1,ActionBefore,NumPositions, - HeaderBefore,HeaderAfter,ActionAfter,Stop}; private: /** The sls detector object */ multiSlsDetector *myDet; - /**if its a scan type*/ - int scanType; /**id of the action widget*/ int id; - /**if this widget has been expanded*/ - bool expand; - QGridLayout *layout; - QComboBox *comboScript; - QLineEdit *dispScript; - QPushButton *btnBrowse; - QLabel *lblParameter; - QLineEdit *dispParameter; - QLabel *lblSteps; - QSpinBox *spinSteps; - QLabel *lblPrecision; - QSpinBox *spinPrecision; - QGroupBox *group; - QRadioButton *radioConstant; - QRadioButton *radioSpecific; - QRadioButton *radioValue; - QLabel *lblFrom; - QSpinBox *spinFrom; - QLabel *lblTo; - QSpinBox *spinTo; - QLabel *lblSize; - QSpinBox *spinSize; - QComboBox *comboSpecific; - QLineEdit *dispValues; - QPushButton *btnValues; - QSpinBox *spinNumPos; - QComboBox *comboPos; - QPushButton *btnDelete; - QCheckBox *chkInvert; - QCheckBox *chkSeparate; - QCheckBox *chkReturn; /** Sets up the widget */ void SetupWidgetWindow(); - /** Sets up all the slots and signals */ + /** Sets up all the slots and signals + * */ void Initialization(); - /**Gets the sls class action index using the gui index - * @param index gui index - */ - int GetActionIndex(int gIndex); - - private slots: /** Sets the scan or script. Accordingly enables, disables other widgets - * @param index value chosen*/ + * @param index value chosen + * */ void SetScript(int index); -/** Enables widgets depending on which size is clicked. - * Options: constant size,specific values,values from file */ -void EnableSizeWidgets(); - /** Browse for the script * */ void BrowsePath(); @@ -133,17 +75,6 @@ void SetScriptFile(); * */ void SetParameter(const QString& parameter); -/** Sets the number of positions - * */ -void SetNumPositions(int index); - -/** Deletes current position - * */ -void DeletePosition(); - - -signals: -void EnableScanBox(bool,int); }; diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index 4e6004122..35068feb6 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -212,7 +212,7 @@ private: bool IsXYRange[4]; /** Default timer between plots*/ - static const double PLOT_TIMER_MS = 500; + static const double PLOT_TIMER_MS = 250; /** Specific timer value between plots */ double timerValue; /** every nth frame when to plot */ diff --git a/slsDetectorGui/include/qScanWidget.h b/slsDetectorGui/include/qScanWidget.h new file mode 100644 index 000000000..affa2d31f --- /dev/null +++ b/slsDetectorGui/include/qScanWidget.h @@ -0,0 +1,99 @@ +/* + * qScanWidget.h + * + * Created on: May 10, 2012 + * Author: l_maliakal_d + */ + +#ifndef QSCANWIDGET_H_ +#define QSCANWIDGET_H_ + +/** Form Header */ +#include "ui_form_scan.h" +/** Project Class Headers */ +class multiSlsDetector; +/** Qt Include Headers */ +#include +/** C++ Include Headers */ +#include +using namespace std; + + +class qScanWidget : public QWidget,private Ui::ScanObject{ + Q_OBJECT + +public: + /** \short The constructor + * @param parent is the parent tab widget + * @param detector is the detector returned from the detector tab + */ + qScanWidget(QWidget *parent, multiSlsDetector*& detector); + + ~qScanWidget(); + + /**to update the widgets*/ + void Refresh(); + + /**number of scan widgets*/ + static int NUM_SCAN_WIDGETS; + +private: + /** The sls detector object */ + multiSlsDetector *myDet; + /**id of the scan widget*/ + int id; + + QStackedLayout *stackedLayout; + QLabel *lblFrom; + QSpinBox *spinFrom; + QLabel *lblTo; + QSpinBox *spinTo; + QLabel *lblSize; + QSpinBox *spinSize; + QComboBox *comboSpecific; + QLineEdit *dispValues; + QPushButton *btnValues; + + + /** Sets up the widget + */ + void SetupWidgetWindow(); + + /** Sets up all the slots and signals */ + void Initialization(); + + + +private slots: +/** Sets the scan or script. Accordingly enables, disables other widgets + * @param index value chosen*/ +void SetScript(int index); + +/** Enables widgets depending on which size is clicked. + * Options: constant size,specific values,values from file */ +void EnableSizeWidgets(); + +/** Browse for the script + * */ +void BrowsePath(); + +/** Sets the script file + * */ +void SetScriptFile(); + +/** Set Parameter + * @param parameter is the parameter to be set to + * */ +void SetParameter(const QString& parameter); + + + +signals: +void EnableScanBox(bool,int); +}; + + + + +#endif /* QSCANWIDGET_H_ */ + diff --git a/slsDetectorGui/include/qTabActions.h b/slsDetectorGui/include/qTabActions.h index 85ca2b57c..194990416 100644 --- a/slsDetectorGui/include/qTabActions.h +++ b/slsDetectorGui/include/qTabActions.h @@ -8,12 +8,19 @@ #ifndef QTABACTIONS_H_ #define QTABACTIONS_H_ + +/* Qt Project Class Headers */ +#include "qActionsWidget.h" +#include "qScanWidget.h" /** Project Class Headers */ class multiSlsDetector; -class ActionsWidget; +class qActionsWidget; /** Qt Include Headers */ #include #include +#include +#include +#include #include #include #include @@ -46,16 +53,33 @@ private: /** The sls detector object */ multiSlsDetector *myDet; - static const int NUM_ACTION_WIDGETS = 9; + enum actionIndex{Scan0=1, Scan1, NumPositions=4, NumTotalActions=9}; QGridLayout *gridLayout; QButtonGroup *group; QPalette *palette; - /** action widget objects */ - ActionsWidget *actionWidget[NUM_ACTION_WIDGETS]; - QPushButton *btnExpand[NUM_ACTION_WIDGETS]; - QLabel *lblName[NUM_ACTION_WIDGETS]; + /** all action widget objects */ + qActionsWidget *actionWidget[6]; + qScanWidget *scanWidget[2]; + QWidget *positionWidget; + QPushButton *btnExpand[NumTotalActions]; + QLabel *lblName[NumTotalActions]; + + + /** NumPositions widget */ + QLabel *lblNumPos; + QLabel *lblPosList; + QSpinBox *spinNumPos; + QComboBox *comboPos; + QPushButton *btnDelete; + QCheckBox *chkInvert; + QCheckBox *chkSeparate; + QCheckBox *chkReturn; + + float *positions; + QPalette normal; + /** Sets up the widget */ void SetupWidgetWindow(); @@ -63,12 +87,28 @@ private: /** Sets up all the slots and signals */ void Initialization(); + /** creates the Num Positions object */ + void CreatePositionsWidget(); + /** Returns the index in each of the classes + * of actionwidget and scanwidget + * @param index the index in the list of all widgets + * returns actual index of the class + */ + int GetActualIndex(int index); private slots: -/** To Expand the Action Widget */ +/** To Expand the Action Widget + * */ void Expand(QAbstractButton *button); +/** Sets the positions list and the number of positions + * */ +void SetPosition(); + +/** Deletes current position + * */ +void DeletePosition(); signals: void EnableScanBox(bool,int); diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index 6c1474409..13a7327ed 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -55,6 +55,7 @@ SOURCES = \ src/qTabPlot.cpp\ src/qTabActions.cpp\ src/qActionsWidget.cpp\ + src/qScanWidget.cpp\ src/qTabAdvanced.cpp\ src/qTabSettings.cpp\ src/qTabDebugging.cpp\ @@ -80,6 +81,7 @@ HEADERS = \ include/qTabPlot.h\ include/qTabActions.h\ include/qActionsWidget.h\ + include/qScanWidget.h\ include/qTabAdvanced.h\ include/qTabSettings.h\ include/qTabDebugging.h\ @@ -97,5 +99,7 @@ FORMS = \ forms/form_tab_advanced.ui\ forms/form_tab_settings.ui\ forms/form_tab_debugging.ui\ - forms/form_tab_developer.ui + forms/form_tab_developer.ui\ # forms/form_tab_messages.ui + forms/form_action.ui\ + forms/form_scan.ui diff --git a/slsDetectorGui/src/qActionsWidget.cpp b/slsDetectorGui/src/qActionsWidget.cpp index 230626210..2c6ba039d 100644 --- a/slsDetectorGui/src/qActionsWidget.cpp +++ b/slsDetectorGui/src/qActionsWidget.cpp @@ -1,5 +1,5 @@ /* - * qTabActions.cpp + * qActionsWidget.cpp * * Created on: May 10, 2012 * Author: l_maliakal_d @@ -11,29 +11,19 @@ #include "qActionsWidget.h" #include "qDefs.h" // Qt Include Headers -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include -#include // C++ Include Headers #include using namespace std; - +//------------------------------------------------------------------------------------------------------------------------------------------------- +int qActionsWidget::NUM_ACTION_WIDGETS(0); //------------------------------------------------------------------------------------------------------------------------------------------------- -ActionsWidget::ActionsWidget(QWidget *parent,multiSlsDetector*& detector, int scanType, int id): - QFrame(parent),myDet(detector),scanType(scanType),id(id),expand(false){ +qActionsWidget::qActionsWidget(QWidget *parent,multiSlsDetector*& detector): + QWidget(parent),myDet(detector){ + setupUi(this); SetupWidgetWindow(); Initialization(); } @@ -42,365 +32,134 @@ ActionsWidget::ActionsWidget(QWidget *parent,multiSlsDetector*& detector, int sc //------------------------------------------------------------------------------------------------------------------------------------------------- -ActionsWidget::~ActionsWidget(){ +qActionsWidget::~qActionsWidget(){ delete myDet; - delete layout; } //------------------------------------------------------------------------------------------------------------------------------------------------- -void ActionsWidget::SetupWidgetWindow(){ - // Widget Settings - //setFrameStyle(QFrame::Box); - //setFrameShadow(QFrame::Raised); - // Main Layout Settings +void qActionsWidget::SetupWidgetWindow(){ + id = NUM_ACTION_WIDGETS; + NUM_ACTION_WIDGETS++; + setFixedHeight(25); - if(scanType) setFixedHeight(125); - layout = new QGridLayout(this); - setLayout(layout); - layout->setContentsMargins(0,0,0,0); - if(scanType) layout->setVerticalSpacing(5); - - if(id==NumPositions){ - setFixedHeight(75); - QLabel *lblNumPos = new QLabel("Number of Positions:"); - lblNumPos->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); - layout->addWidget(lblNumPos,0,0); - spinNumPos = new QSpinBox(this); - layout->addWidget(spinNumPos,0,1); - layout->addItem(new QSpacerItem(80,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,2); - QLabel *lblPosList = new QLabel("List of Positions:"); - lblPosList->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); - layout->addWidget(lblPosList,0,3); - comboPos = new QComboBox(this); - comboPos->setEditable(true); - comboPos->setCompleter(0); - layout->addWidget(comboPos,0,4); - btnDelete = new QPushButton("Delete"); - btnDelete->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); - layout->addWidget(btnDelete,0,5); - - QGroupBox *w = new QGroupBox; - layout->addWidget(w,1,0,1,6); - QHBoxLayout *l1 = new QHBoxLayout(w); - l1->setContentsMargins(0,0,0,0); - l1->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); - chkInvert = new QCheckBox("Invert Angles"); - l1->addWidget(chkInvert); - chkSeparate = new QCheckBox("Separate Two Halves"); - l1->addWidget(chkSeparate); - chkReturn = new QCheckBox("Return to Start Position"); - chkReturn->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); - l1->addWidget(chkReturn); - l1->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); - - - }else{ - // Main Widgets - comboScript = new QComboBox(this); - if(!scanType){ - comboScript->addItem("None"); - comboScript->addItem("Custom Script"); - }else{ - comboScript->addItem("None"); - comboScript->addItem("Energy Scan"); - comboScript->addItem("Threshold Scan"); - comboScript->addItem("Trimbits Scan"); - comboScript->addItem("Custom Script"); - } - layout->addWidget(comboScript,0,0); - layout->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,1); - dispScript = new QLineEdit(""); - dispScript->setEnabled(false); - layout->addWidget(dispScript,0,2); - btnBrowse = new QPushButton("Browse"); - btnBrowse->setEnabled(false); - layout->addWidget(btnBrowse,0,3); - layout->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,4); - lblParameter = new QLabel("Additional Parameter:"); - lblParameter->setEnabled(false); - layout->addWidget(lblParameter,0,5); - dispParameter = new QLineEdit(""); - dispParameter->setEnabled(false); - dispParameter->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); - layout->addWidget(dispParameter,0,6); - - - - // Scan Levels Widgets - if(scanType){ - lblSteps = new QLabel("Number of Steps:"); - lblSteps->setEnabled(false); - layout->addWidget(lblSteps,1,2); - spinSteps = new QSpinBox(this); - spinSteps->setEnabled(false); - layout->addWidget(spinSteps,1,3); - lblPrecision = new QLabel("Precision:"); - lblPrecision->setEnabled(false); - layout->addWidget(lblPrecision,1,5); - spinPrecision = new QSpinBox(this); - spinPrecision->setEnabled(false); - layout->addWidget(spinPrecision,1,6); - group = new QGroupBox(this); - group->setEnabled(false); - // Fix the size of the groupbox - group->setFixedSize(513,66); - layout->addWidget(group,2,2,1,6); - - - // 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); - h1->setContentsMargins(0, 0, 0, 0); - radioConstant = new QRadioButton("Constant Step Size",h1Widget); - radioConstant->setChecked(true); - h1->addWidget(radioConstant); - radioSpecific = new QRadioButton("Specific Values",h1Widget); - h1->addWidget(radioSpecific); - radioValue = new QRadioButton("Values from File",h1Widget); - radioValue->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); - h1->addWidget(radioValue); - - // Constant Size Layout - QWidget *h2ConstantWidget = new QWidget(group); - h2ConstantWidget->setGeometry(QRect(10, 30, group->width()-20, 31)); - QHBoxLayout *h2Constant = new QHBoxLayout(h2ConstantWidget); - h2Constant->setContentsMargins(0, 0, 0, 0); - - h2Constant->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); - lblFrom = new QLabel("from",h2ConstantWidget); - lblFrom->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); - h2Constant->addWidget(lblFrom); - spinFrom = new QSpinBox(h2ConstantWidget); - h2Constant->addWidget(spinFrom); - lblTo = new QLabel("to",h2ConstantWidget); - lblTo->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); - h2Constant->addWidget(lblTo); - spinTo = new QSpinBox(h2ConstantWidget); - h2Constant->addWidget(spinTo); - h2Constant->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); - lblSize = new QLabel("Size",h2ConstantWidget); - lblSize->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); - h2Constant->addWidget(lblSize); - spinSize = new QSpinBox(h2ConstantWidget); - h2Constant->addWidget(spinSize); - h2Constant->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); - - // Specific Values Layout - QWidget *h2SpecificWidget = new QWidget(group); - h2SpecificWidget->setGeometry(QRect(10, 30, group->width()-20, 31)); - QHBoxLayout *h2Specific = new QHBoxLayout(h2SpecificWidget); - h2Specific->setContentsMargins(0, 0, 0, 0); - h2Specific->addItem(new QSpacerItem(200,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); - comboSpecific = new QComboBox(h2SpecificWidget); - h2Specific->addWidget(comboSpecific); - comboSpecific->hide(); - h2Specific->addItem(new QSpacerItem(200,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); - - // Values From a File Layout - QWidget *h2ValuesWidget = new QWidget(group); - h2ValuesWidget->setGeometry(QRect(10, 30, group->width()-20, 31)); - QHBoxLayout *h2Values = new QHBoxLayout(h2ValuesWidget); - h2Values->setContentsMargins(0, 0, 0, 0); - h2Values->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); - dispValues = new QLineEdit("steps.txt",h2ValuesWidget); - dispValues->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed); - h2Values->addWidget(dispValues); - dispValues->hide(); - btnValues = new QPushButton("Browse",h2ValuesWidget); - btnValues->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); - h2Values->addWidget(btnValues); - btnValues->hide(); - h2Values->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); - - } - } - } //------------------------------------------------------------------------------------------------------------------------------------------------- -void ActionsWidget::Initialization(){ - if(id==NumPositions){ - connect(spinNumPos, SIGNAL(valueChanged(int)), this, SLOT(SetNumPositions(int))); - connect(btnDelete, SIGNAL(clicked()), this, SLOT(DeletePosition())); - }else{ - connect(comboScript, SIGNAL(currentIndexChanged(int)), this,SLOT(SetScript(int))); - connect(dispScript, SIGNAL(editingFinished()), this, SLOT(SetScriptFile())); - connect(btnBrowse, SIGNAL(clicked()), this, SLOT(BrowsePath())); - connect(dispParameter, SIGNAL(textChanged(const QString&)), this, SLOT(SetParameter(const QString&))); - 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())); - } - } +void qActionsWidget::Initialization(){ + //mode + connect(comboScript, SIGNAL(currentIndexChanged(int)), this,SLOT(SetScript(int))); + //file + connect(dispScript, SIGNAL(editingFinished()), this, SLOT(SetScriptFile())); + connect(btnBrowse, SIGNAL(clicked()), this, SLOT(BrowsePath())); + //parameter + connect(dispParameter, SIGNAL(textChanged(const QString&)), this, SLOT(SetParameter(const QString&))); } //------------------------------------------------------------------------------------------------------------------------------------------------- -void ActionsWidget::EnableSizeWidgets(){ - // defaults - lblFrom->hide(); - spinFrom->hide(); - lblTo->hide(); - spinTo->hide(); - lblSize->hide(); - spinSize->hide(); - comboSpecific->hide(); - dispValues->hide(); - btnValues->hide(); - lblSteps->setEnabled(true); - spinSteps->setEnabled(true); - // Constant Step Size - if(radioConstant->isChecked()){ - lblFrom->show(); - spinFrom->show(); - lblTo->show(); - spinTo->show(); - lblSize->show(); - spinSize->show(); - lblSteps->setEnabled(false); - spinSteps->setEnabled(false); - }// Specific Values - else if(radioSpecific->isChecked()) - comboSpecific->show(); - // Values from a File - else{ - dispValues->show(); - btnValues->show(); - } -} - - -//------------------------------------------------------------------------------------------------------------------------------------------------- - - -void ActionsWidget::SetScript(int index){ - // defaults - dispScript->setEnabled(false); - btnBrowse->setEnabled(false); - lblParameter->setEnabled(false); - dispParameter->setEnabled(false); - 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(index){ - // 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(scanType){ - group->setEnabled(true); - lblPrecision->setEnabled(true); - spinPrecision->setEnabled(true); - // Steps are enabled only if constant step size is not checked - lblSteps->setEnabled(!radioConstant->isChecked()); - spinSteps->setEnabled(!radioConstant->isChecked()); - } - } - //emit signal to enable scanbox and the radiobuttons - if(scanType) emit EnableScanBox(index,((id==2)?1:0)); - +void qActionsWidget::SetScript(int index){ #ifdef VERBOSE cout << "Setting mode of action widget:" << id << " to " << index << endl; #endif + //enabling/disabling + dispScript->setEnabled(index); + btnBrowse->setEnabled(index); + lblParameter->setEnabled(index); + dispParameter->setEnabled(index); + QString fName = dispScript->text(); - //script - if((id!=Scan0)&&(id!=Scan1)) - //scan and positions wouldnt get here - if(index) myDet->setActionScript(GetActionIndex(id),fName.toAscii().constData()); - else myDet->setActionScript(GetActionIndex(id),""); - //scan - else{ - + //set the mode + if(index) myDet->setActionScript(id,fName.toAscii().constData()); + else myDet->setActionScript(id,""); + //mode is not set when fname is blank + if(!fName.isEmpty()){ + //check if mode didnt get set + if(index!=myDet->getActionMode(id)){ + qDefs::WarningMessage("The mode could not be changed.","ActionsWidget"); + comboScript->setCurrentIndex(myDet->getActionMode(id)); + }//if mode got set and its custom script + else if(index){ + //when the file name did not get set correctly + if(fName.compare(QString(myDet->getActionScript(id).c_str()))){ + qDefs::WarningMessage("The file path could not be set.","ActionsWidget"); + dispScript->setText(QString(myDet->getActionScript(id).c_str())); + SetScriptFile(); + } + } } - - cout<<"mode:"<getActionMode(GetActionIndex(id))<<" " - "script:"<getActionScript(GetActionIndex(id))<<" " - "parameter:"<getActionParameter(GetActionIndex(id))<text(); QString dir = fName.section('/',0,-2,QString::SectionIncludeLeadingSep); if(dir.isEmpty()) dir = "/home"; //dialog fName = QFileDialog::getOpenFileName(this, tr("Load Script File"),dir, - tr("Script Files(*.awk);;All Files(*)"));//,0,QFileDialog::ShowDirsOnly); + tr("Script Files(*.awk);;All Files(*)")); //if empty, set the file name and it calls setscriptfile, else ignore - if (!fName.isEmpty()) + if (!fName.isEmpty()){ dispScript->setText(fName); + SetScriptFile(); + } } //------------------------------------------------------------------------------------------------------------------------------------------------- -void ActionsWidget::SetScriptFile(){ - QString fName = dispScript->text();bool set = false; +void qActionsWidget::SetScriptFile(){ + QString fName = dispScript->text(); #ifdef VERBOSE cout << "Setting script file of action widget:" << id << " to " << fName.toAscii().constData() << endl; #endif disconnect(dispScript, SIGNAL(editingFinished()), this, SLOT(SetScriptFile())); + bool set = false; + //blank - if(fName.isEmpty()) - set = true; + if(fName.isEmpty()) set = true; + else if(!fName.compare("none")) set = true; //not blank else{ QString file = dispScript->text().section('/',-1); //is a file if(file.contains('.')){ //check if it exists and set the script file - if(QFile::exists(fName)) - set = true; + if(QFile::exists(fName)) set = true; //if the file doesnt exist, set it to what it was before else{ qDefs::WarningMessage("The script file entered does not exist","ActionsWidget"); - dispScript->setText(QString(myDet->getActionScript(GetActionIndex(id)).c_str())); + dispScript->setText(QString(myDet->getActionScript(id).c_str())); } }//not a file, set it to what it was before else { qDefs::WarningMessage("The script file path entered is not a file","ActionsWidget"); - dispScript->setText(QString(myDet->getActionScript(GetActionIndex(id)).c_str())); + dispScript->setText(QString(myDet->getActionScript(id).c_str())); } } //if blank or valid file if(set){ - //script - if((id!=Scan0)&&(id!=Scan1)){ - //scan and positions wouldnt get here - if(!myDet->setActionScript(GetActionIndex(id),fName.toAscii().constData())){ - //did not get set, write what is was before - if(!fName.isEmpty()) - qDefs::WarningMessage("The script file could not be set. Reverting to previous file.","ActionsWidget"); - dispScript->setText(QString(myDet->getActionScript(GetActionIndex(id)).c_str())); - } - } - //scan - else{ - + //scan and positions wouldnt get here + myDet->setActionScript(id,fName.toAscii().constData()); + if(fName.compare(QString(myDet->getActionScript(id).c_str()))){ + //did not get set, write what is was before + if(!fName.isEmpty()) + qDefs::WarningMessage("The script file could not be set. Reverting to previous file.","ActionsWidget"); + dispScript->setText(QString(myDet->getActionScript(id).c_str())); } } @@ -415,115 +174,33 @@ void ActionsWidget::SetScriptFile(){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void ActionsWidget::SetParameter(const QString& parameter){ +void qActionsWidget::SetParameter(const QString& parameter){ #ifdef VERBOSE cout << "Setting parameter of action widget:" << id << " to " << parameter.toAscii().constData() << endl; #endif - //script - if((id!=ActionsWidget::Scan0)&&(id!=ActionsWidget::Scan1)) - //scan and positions wouldnt get here - myDet->setActionParameter(GetActionIndex(id),parameter.toAscii().constData()); - //scan - else{ - - } -} - - -//------------------------------------------------------------------------------------------------------------------------------------------------- - -void ActionsWidget::SetNumPositions(int index){ - //comboPos->setEnabled(index); - //if there arent enough positions - if((index) && (comboPos->count()setValue(comboPos->count()); - }else{ - //emit SetPositionsSignal(); - } + myDet->setActionParameter(id,parameter.toAscii().constData()); } //------------------------------------------------------------------------------------------------------------------------------------------------- -void ActionsWidget::DeletePosition(){ - QString pos = comboPos->currentText(); - bool found = false; - //loops through to find the index and to make sure its in the list - for(int i=0;icount();i++){ - if(!comboPos->itemText(i).compare(pos)){ - found = true; - comboPos->removeItem(i); - break; - } - } - //give the warning only when you try to delete stuff that arent there - if((!found)&&(comboPos->count())) qDefs::WarningMessage("This position cannot be deleted as it doesn't exist in the list anyway","ActionsWidget"); -} - - -//------------------------------------------------------------------------------------------------------------------------------------------------- - - -void ActionsWidget::Refresh(){ - //disabling signals and slots - if(id==NumPositions){ - - }else{ - disconnect(dispScript, SIGNAL(editingFinished()), this, SLOT(SetScriptFile())); - disconnect(dispParameter, SIGNAL(textChanged(const QString&)),this, SLOT(SetParameter(const QString&))); - } - - - int mode;string script,parameter; - if((id == Scan0)||(id == Scan1)){ - - }else if(id == NumPositions){ - - }else{ - mode = (myDet->getActionMode(GetActionIndex(id))>0?1:0); - script = myDet->getActionScript(GetActionIndex(id)); - parameter = myDet->getActionParameter(GetActionIndex(id)); - //defaults - if(script == "none") script=""; - if(parameter == "none") parameter=""; - //settings values - dispScript->setText(QString(script.c_str())); - dispParameter->setText(QString(parameter.c_str())); - //set mode which also checks everything - comboScript->setCurrentIndex(mode); - } - - - //enabling signals and slots - if(id==NumPositions){ - - }else{ - connect(dispScript, SIGNAL(editingFinished()), this, SLOT(SetScriptFile())); - connect(dispParameter, SIGNAL(textChanged(const QString&)),this, SLOT(SetParameter(const QString&))); - } +void qActionsWidget::Refresh(){ + int mode = (myDet->getActionMode(id)>0?1:0); + string script = myDet->getActionScript(id); + string parameter = myDet->getActionParameter(id); + //defaults + if(script == "none") script=""; + if(parameter == "none") parameter=""; + //settings values + dispScript->setText(QString(script.c_str())); + dispParameter->setText(QString(parameter.c_str())); + //set mode which also checks everything + comboScript->setCurrentIndex(mode); #ifdef VERBOSE - cout << "Updated action widget " << id << "\tscript:" << script << "\tparameter:" << parameter << endl; + cout << "Updated action widget " << id << "\tmode:"<progressIndex; - progress=(int)data->progressIndex; - - if(!plotEnable) { - lastImageNumber= currentFrame+1; - currentFrame++; - return 0; - } - - /** Get data from client */ - /**1d*/ - if(plot_in_scope==1){ - /** Persistency */ - if(currentPersistency < persistency)currentPersistency++; - else currentPersistency=persistency; - for(int i=currentPersistency;i>0;i--) - memcpy(yvalues[i],yvalues[i-1],nPixelsX*sizeof(double)); - nHists = currentPersistency+1; - //memcpy(yvalues[0],data->values,nPixelsX*sizeof(double)); - for(int i=0;i<(int)nPixelsX;i++) *(yvalues[0]+i) = (double)*(data->values+i); - } - /**2d*/ - else{ - for(unsigned int px=0;px0;i--) - memcpy(histYAxis[i],histYAxis[i-1],nPixelsX*sizeof(double)); - memcpy(histYAxis[0],yvalues[0],nPixelsX*sizeof(double)); - } - /**2d*/ - else{ - sprintf(temp_title,"Image Number %d",currentFrame); imageTitle = temp_title; - memcpy(lastImageArray,image_data,nPixelsX*nPixelsY*sizeof(double)); - } - pthread_mutex_unlock(&(last_image_complete_mutex)); + /** Get data from client */ + /**1d*/ + if(plot_in_scope==1){ + /** Persistency */ + if(currentPersistency < persistency)currentPersistency++; + else currentPersistency=persistency; + for(int i=currentPersistency;i>0;i--) + memcpy(yvalues[i],yvalues[i-1],nPixelsX*sizeof(double)); + nHists = currentPersistency+1; + //memcpy(yvalues[0],data->values,nPixelsX*sizeof(double)); + for(int i=0;i<(int)nPixelsX;i++) *(yvalues[0]+i) = (double)*(data->values+i); } + /**2d*/ + else{ + for(unsigned int px=0;px0;i--) + memcpy(histYAxis[i],histYAxis[i-1],nPixelsX*sizeof(double)); + memcpy(histYAxis[0],yvalues[0],nPixelsX*sizeof(double)); + } + /**2d*/ + else{ + sprintf(temp_title,"Image Number %d",currentFrame); imageTitle = temp_title; + memcpy(lastImageArray,image_data,nPixelsX*nPixelsY*sizeof(double)); + } + pthread_mutex_unlock(&(last_image_complete_mutex)); + } + } + currentFrame++; + } + /** To make sure plotting locks parameters until it has plotted */ + if(frameFactor){ + if(currentFrame==number_of_exposures) plotLock = true; + else if(!((currentFrame-1)%frameFactor)) plotLock = true; } - currentFrame++; - } - /** To make sure plotting locks parameters until it has plotted */ - if(frameFactor){ - if(currentFrame==number_of_exposures) plotLock = true; - else if(!((currentFrame-1)%frameFactor)) plotLock = true; } #ifdef VERYVERBOSE cout<<"Exiting GetData function"< +#include + +// C++ Include Headers +#include +using namespace std; + + +//------------------------------------------------------------------------------------------------------------------------------------------------- +int qScanWidget::NUM_SCAN_WIDGETS(0); +//------------------------------------------------------------------------------------------------------------------------------------------------- + +qScanWidget::qScanWidget(QWidget *parent,multiSlsDetector*& detector): + QWidget(parent),myDet(detector){ + setupUi(this); + SetupWidgetWindow(); + Initialization(); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +qScanWidget::~qScanWidget(){ + delete myDet; + delete stackedLayout; +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qScanWidget::SetupWidgetWindow(){ + id = NUM_SCAN_WIDGETS; + NUM_SCAN_WIDGETS++; + + setFixedHeight(125); + + //layout for the size widgets + stackedLayout = new QStackedLayout; + stackedLayout->setSpacing(0); + + // Constant Size Layout + QWidget *constantWidget = new QWidget; + QHBoxLayout *layoutConstant = new QHBoxLayout(constantWidget); + layoutConstant->setContentsMargins(0, 0, 0, 0); + layoutConstant->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); + lblFrom = new QLabel("from",constantWidget); + lblFrom->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); + layoutConstant->addWidget(lblFrom); + spinFrom = new QSpinBox(constantWidget); + layoutConstant->addWidget(spinFrom); + lblTo = new QLabel("to",constantWidget); + lblTo->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); + layoutConstant->addWidget(lblTo); + spinTo = new QSpinBox(constantWidget); + layoutConstant->addWidget(spinTo); + layoutConstant->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); + lblSize = new QLabel("Size",constantWidget); + lblSize->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); + layoutConstant->addWidget(lblSize); + spinSize = new QSpinBox(constantWidget); + layoutConstant->addWidget(spinSize); + layoutConstant->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); + + // Specific Values Layout + QWidget *specificWidget = new QWidget; + QHBoxLayout *layoutSpecific = new QHBoxLayout(specificWidget); + layoutSpecific->setContentsMargins(0, 0, 0, 0); + layoutSpecific->addItem(new QSpacerItem(200,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); + comboSpecific = new QComboBox(specificWidget); + comboSpecific->setEditable(true); + comboSpecific->setCompleter(false); + layoutSpecific->addWidget(comboSpecific); + layoutSpecific->addItem(new QSpacerItem(200,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); + + // Values From a File Layout + QWidget *valuesWidget = new QWidget; + QHBoxLayout *layoutValues = new QHBoxLayout(valuesWidget); + layoutValues->setContentsMargins(0, 0, 0, 0); + layoutValues->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); + dispValues = new QLineEdit("steps.txt",valuesWidget); + dispValues->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed); + layoutValues->addWidget(dispValues); + btnValues = new QPushButton("Browse",valuesWidget); + btnValues->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); + layoutValues->addWidget(btnValues); + layoutValues->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); + + + stackedLayout->addWidget(constantWidget); + stackedLayout->addWidget(specificWidget); + stackedLayout->addWidget(valuesWidget); + stackedWidget->setLayout(stackedLayout); + +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qScanWidget::Initialization(){ + //mode + connect(comboScript, SIGNAL(currentIndexChanged(int)), this,SLOT(SetScript(int))); + //file + connect(dispScript, SIGNAL(editingFinished()), this, SLOT(SetScriptFile())); + connect(btnBrowse, SIGNAL(clicked()), this, SLOT(BrowsePath())); + //parameter + connect(dispParameter, SIGNAL(textChanged(const QString&)), this, SLOT(SetParameter(const QString&))); + //sizewidgets + connect(radioConstant, SIGNAL(toggled(bool)),this,SLOT(EnableSizeWidgets())); + connect(radioSpecific, SIGNAL(toggled(bool)),this,SLOT(EnableSizeWidgets())); + connect(radioValue, SIGNAL(toggled(bool)),this,SLOT(EnableSizeWidgets())); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qScanWidget::EnableSizeWidgets(){ + if(radioConstant->isChecked()) + stackedLayout->setCurrentIndex(0); + else if(radioSpecific->isChecked()) + stackedLayout->setCurrentIndex(1); + else + stackedLayout->setCurrentIndex(2); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qScanWidget::SetScript(int index){ +#ifdef VERBOSE + cout << "Setting mode of scan widget:" << id << " to " << index << endl; +#endif + // defaults + dispScript->setEnabled(false); + btnBrowse->setEnabled(false); + lblParameter->setEnabled(false); + dispParameter->setEnabled(false); + group->setEnabled(false); + lblSteps->setEnabled(false); + spinSteps->setEnabled(false); + lblPrecision->setEnabled(false); + spinPrecision->setEnabled(false); + + // If anything other than None is selected + if(index){ + // Custom Script only enables the first layout with addnl parameters etc + if(index==4){ + dispScript->setEnabled(true); + btnBrowse->setEnabled(true); + lblParameter->setEnabled(true); + dispParameter->setEnabled(true); + } + group->setEnabled(true); + lblPrecision->setEnabled(true); + spinPrecision->setEnabled(true); + // Steps are enabled only if constant step size is not checked + lblSteps->setEnabled(!radioConstant->isChecked()); + spinSteps->setEnabled(!radioConstant->isChecked()); + + } + //emit signal to enable scanbox in plot tab + emit EnableScanBox(index,id); + + + QString fName = dispScript->text(); + //set the mode + if(index) myDet->setActionScript(id,fName.toAscii().constData()); + else myDet->setActionScript(id,""); + //mode is not set when fname is blank + if(!fName.isEmpty()){ + //check if mode didnt get set + if(index!=myDet->getActionMode(id)){ + qDefs::WarningMessage("The mode could not be changed.","ScanWidget"); + comboScript->setCurrentIndex(myDet->getActionMode(id)); + }//if mode got set and its custom script + else if(index){ + //when the file name did not get set correctly + if(fName.compare(QString(myDet->getActionScript(id).c_str()))){ + qDefs::WarningMessage("The file path could not be set.","ScanWidget"); + dispScript->setText(QString(myDet->getActionScript(id).c_str())); + SetScriptFile(); + } + } + } + +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + +void qScanWidget::BrowsePath(){ +#ifdef VERBOSE + cout << "Browsing Script File Path" << endl; +#endif + QString fName = dispScript->text(); + QString dir = fName.section('/',0,-2,QString::SectionIncludeLeadingSep); + if(dir.isEmpty()) dir = "/home"; + //dialog + fName = QFileDialog::getOpenFileName(this, + tr("Load Script File"),dir, + tr("Script Files(*.awk);;All Files(*)")); + //if empty, set the file name and it calls setscriptfile, else ignore + if (!fName.isEmpty()){ + dispScript->setText(fName); + SetScriptFile(); + } +} + +//------------------------------------------------------------------------------------------------------------------------------------------------- + +void qScanWidget::SetScriptFile(){ + QString fName = dispScript->text();bool set = false; +#ifdef VERBOSE + cout << "Setting script file of scan widget:" << id << " to " << fName.toAscii().constData() << endl; +#endif + disconnect(dispScript, SIGNAL(editingFinished()), this, SLOT(SetScriptFile())); + + //blank + if(fName.isEmpty()) set = true; + else if(!fName.compare("none")) set = true; + //not blank + else{ + QString file = dispScript->text().section('/',-1); + //is a file + if(file.contains('.')){ + //check if it exists and set the script file + if(QFile::exists(fName)) + set = true; + //if the file doesnt exist, set it to what it was before + else{ + qDefs::WarningMessage("The script file entered does not exist","ScanWidget"); + dispScript->setText(QString(myDet->getActionScript(id).c_str())); + } + }//not a file, set it to what it was before + else { + qDefs::WarningMessage("The script file path entered is not a file","ScanWidget"); + dispScript->setText(QString(myDet->getActionScript(id).c_str())); + } + } + + //if blank or valid file + if(set){ + myDet->setActionScript(id,fName.toAscii().constData()); + if(fName.compare(QString(myDet->getActionScript(id).c_str()))){ + //did not get set, write what is was before + if(!fName.isEmpty()) + qDefs::WarningMessage("The script file could not be set. Reverting to previous file.","ScanWidget"); + dispScript->setText(QString(myDet->getActionScript(id).c_str())); + } + + } + + //dont display if theres a none + if(!dispScript->text().compare("none")) dispScript->setText(""); + + connect(dispScript, SIGNAL(editingFinished()), this, SLOT(SetScriptFile())); + +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qScanWidget::SetParameter(const QString& parameter){ +#ifdef VERBOSE + cout << "Setting parameter of scan widget:" << id << " to " << parameter.toAscii().constData() << endl; +#endif + + myDet->setActionParameter(id,parameter.toAscii().constData()); + +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qScanWidget::Refresh(){ + int mode = (myDet->getScanMode(id)>0?1:0); + string script = myDet->getScanScript(id); + string parameter = myDet->getScanParameter(id); + double precision = myDet->getScanPrecision(id); + + //defaults + if(script == "none") script=""; + if(parameter == "none") parameter=""; + //settings values + dispScript->setText(QString(script.c_str())); + dispParameter->setText(QString(parameter.c_str())); + spinPrecision->setValue(precision); + //set mode which also checks everything + comboScript->setCurrentIndex(mode); + + +#ifdef VERBOSE + cout << "Updated scan widget " << id << "\t" + "mode:"<setFixedSize(20,20); - lblName[i] = new QLabel(""); + btnExpand[i]->setFixedSize(20,20); group->addButton(btnExpand[i],i); + + //Number of positions is only for mythen or gotthard + slsDetectorDefs::detectorType detType = myDet->getDetectorsType(); + if((detType == slsDetectorDefs::EIGER) || (detType == slsDetectorDefs::AGIPD)) { + lblName[NumPositions]->setEnabled(false); + btnExpand[NumPositions]->setEnabled(false); + } + + //add the widgets to the layout , depending on the type create the widgets 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);*/ - } + if(i==NumPositions){ + CreatePositionsWidget(); + gridLayout->addWidget(positionWidget,(i*2)+1,1,1,2); + positionWidget->hide(); + }else if((i==Scan0)||(i==Scan1)){ + scanWidget[qScanWidget::NUM_SCAN_WIDGETS] = new qScanWidget(this,myDet); + gridLayout->addWidget(scanWidget[qScanWidget::NUM_SCAN_WIDGETS-1],(i*2)+1,1,1,2); + scanWidget[qScanWidget::NUM_SCAN_WIDGETS-1]->hide(); + }else{ + actionWidget[qActionsWidget::NUM_ACTION_WIDGETS] = new qActionsWidget(this,myDet); + gridLayout->addWidget(actionWidget[qActionsWidget::NUM_ACTION_WIDGETS-1],(i*2)+1,1,1,2); + actionWidget[qActionsWidget::NUM_ACTION_WIDGETS-1]->hide(); + } + //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[ActionsWidget::Start]->setText("Action at Start"); - lblName[ActionsWidget::Scan0]->setText("Scan Level 0"); - lblName[ActionsWidget::Scan1]->setText("Scan Level 1"); - lblName[ActionsWidget::ActionBefore]->setText("Action before each Frame"); - lblName[ActionsWidget::NumPositions]->setText("Positions"); - lblName[ActionsWidget::HeaderBefore]->setText("Header before Frame"); - lblName[ActionsWidget::HeaderAfter]->setText("Header after Frame"); - lblName[ActionsWidget::ActionAfter]->setText("Action after each Frame"); - lblName[ActionsWidget::Stop]->setText("Action at Stop"); - - // initially hide all the widgets - for(int i=0;ihide(); - - //Number of positions is only for mythen or gotthard - slsDetectorDefs::detectorType detType = myDet->getDetectorsType(); - if((detType == slsDetectorDefs::EIGER) || (detType == slsDetectorDefs::AGIPD)) { - lblName[ActionsWidget::NumPositions]->setEnabled(false); - btnExpand[ActionsWidget::NumPositions]->setEnabled(false); } } @@ -109,11 +114,75 @@ void qTabActions::SetupWidgetWindow(){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void qTabActions::Initialization(){ - connect(group, SIGNAL(buttonClicked(QAbstractButton*)), this,SLOT(Expand(QAbstractButton*))); - connect(actionWidget[ActionsWidget::Scan0],SIGNAL(EnableScanBox(bool,int)), this,SIGNAL(EnableScanBox(bool,int))); - connect(actionWidget[ActionsWidget::Scan1],SIGNAL(EnableScanBox(bool,int)), this,SIGNAL(EnableScanBox(bool,int))); +void qTabActions::CreatePositionsWidget(){ + positionWidget = new QWidget; + positionWidget->setFixedHeight(25); + QGridLayout *layout = new QGridLayout(positionWidget); + layout->setContentsMargins(0,0,0,0); + layout->setHorizontalSpacing(0); + layout->setVerticalSpacing(5); + + lblNumPos = new QLabel("Number of Positions:"); + lblNumPos->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); + layout->addWidget(lblNumPos,0,0); + layout->addItem(new QSpacerItem(5,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,1); + spinNumPos = new QSpinBox(this); + layout->addWidget(spinNumPos,0,2); + layout->addItem(new QSpacerItem(80,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,3); + lblPosList = new QLabel("List of Positions:"); + lblPosList->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); + lblPosList->setEnabled(false); + lblPosList->setToolTip("Enter the positions at which the detector should be moved.
" + "Number of entries is restricted to Number of Positions field."); + layout->addWidget(lblPosList,0,4); + layout->addItem(new QSpacerItem(5,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,5); + comboPos = new QComboBox(this); + comboPos->setEditable(true); + comboPos->setCompleter(false); + normal = comboPos->palette(); + comboPos->setEnabled(false); + QDoubleValidator *validate = new QDoubleValidator(comboPos); + comboPos->setValidator(validate); + layout->addWidget(comboPos,0,6); + layout->addItem(new QSpacerItem(5,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,7); + btnDelete = new QPushButton("Delete"); + btnDelete->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); + layout->addWidget(btnDelete,0,8); + + //might be included at some point +/* QGroupBox *w = new QGroupBox; + layout->addWidget(w,1,0,1,9); + QHBoxLayout *l1 = new QHBoxLayout(w); + l1->setContentsMargins(0,0,0,0); + l1->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); + chkInvert = new QCheckBox("Invert Angles"); + l1->addWidget(chkInvert); + chkSeparate = new QCheckBox("Separate Two Halves"); + l1->addWidget(chkSeparate); + chkReturn = new QCheckBox("Return to Start Position"); + chkReturn->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); + l1->addWidget(chkReturn); + l1->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); + w->setLayout(l1);*/ + + positionWidget->setLayout(layout); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabActions::Initialization(){ + //expand + connect(group, SIGNAL(buttonClicked(QAbstractButton*)), this,SLOT(Expand(QAbstractButton*))); + //enable scan box in plot tab + for(int i=0;itext(), "-")){ palette->setColor(QPalette::WindowText,Qt::black); lblName[index]->setPalette(*palette); - actionWidget[index]->hide(); button->setText("+"); - if((index==ActionsWidget::Scan0)||(index==ActionsWidget::Scan1)){ + + if(index==NumPositions) { + positionWidget->hide(); + setFixedHeight(height()-30);//-80 if the checkboxes are included + } + else if((index==Scan0)||(index==Scan1)) { + scanWidget[GetActualIndex(index)]->hide(); setFixedHeight(height()-130); } - else if(index==ActionsWidget::NumPositions) - setFixedHeight(height()-80); - else + else { + actionWidget[GetActualIndex(index)]->hide(); setFixedHeight(height()-30); + } }else{ // Expand palette->setColor(QPalette::WindowText,QColor(0,0,200,255)); lblName[index]->setPalette(*palette); - actionWidget[index]->show(); button->setText("-"); - if((index==ActionsWidget::Scan0)||(index==ActionsWidget::Scan1)){ + if(index==NumPositions){ + positionWidget->show(); + setFixedHeight(height()+30);//+80 if the checkboxes are included + } + else if((index==Scan0)||(index==Scan1)){ + scanWidget[GetActualIndex(index)]->show(); setFixedHeight(height()+130); } - else if(index==ActionsWidget::NumPositions) - setFixedHeight(height()+80); - else + else{ + actionWidget[GetActualIndex(index)]->show(); setFixedHeight(height()+30); + } + } +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabActions::SetPosition(){ +#ifdef VERBOSE + cout << "Entering SetPosition\tnum Pos:" << spinNumPos->value() << "\tlist count:" << comboPos->count() << endl; +#endif + //get number of positions + int numPos = spinNumPos->value(); + comboPos->setMaxCount(numPos); + comboPos->setEnabled(numPos); + lblPosList->setEnabled(numPos); + + //deleting too many or not entering enough + if(numPos>comboPos->count()){ + + QPalette red = QPalette(); + red.setColor(QPalette::Active,QPalette::WindowText,Qt::red); + lblPosList->setPalette(red); + QString tip = QString("Enter the positions at which the detector should be moved.
" + "Number of entries is restricted to Number of Positions field.

")+ + QString("Add ")+ + (QString("%1").arg(((numPos)-(comboPos->count()))))+ + QString(" more positions to the list to match Number of Positions."); + lblPosList->setToolTip(tip); + lblPosList->setText("List of Positions:*"); + }else{ + lblPosList->setText("List of Positions:"); + lblPosList->setPalette(normal); + lblPosList->setToolTip("Enter the positions at which the detector should be moved.
" + "Number of entries is restricted to Number of Positions field."); + //delete existing positions + if (positions) delete [] positions; + positions=new float[numPos]; + //copying the list + for(int i=0;iitemText(i).toDouble(); + //setting the list and catching error + if(myDet->setPositions(numPos,positions)!=numPos) + qDefs::WarningMessage("The positions list was not set for some reason.","Actions"); + } + +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabActions::DeletePosition(){ + QString pos = comboPos->currentText(); + bool found = false; + //loops through to find the index and to make sure its in the list + for(int i=0;icount();i++){ + if(!comboPos->itemText(i).compare(pos)){ + found = true; + comboPos->removeItem(i); + break; + } + } + if(found){ +#ifdef VERBOSE + cout << "Deleting Position " << endl; +#endif } } @@ -157,12 +302,64 @@ void qTabActions::Expand(QAbstractButton *button ){ void qTabActions::Refresh(){ #ifdef VERBOSE - cout << "Updating action widgets " << endl; + cout << "Updating all action widgets " << endl; #endif - for(int i=0;iisEnabled()){ + //delete existing positions + if (positions) delete [] positions; + //get number of positions + int numPos=myDet->getPositions(); + comboPos->setMaxCount(numPos); + + //set the number of positions in the gui + disconnect(spinNumPos, SIGNAL(valueChanged(int)), this, SLOT(SetPosition())); + spinNumPos->setValue(numPos); + connect(spinNumPos, SIGNAL(valueChanged(int)), this, SLOT(SetPosition())); + + positions=new float[numPos]; + //load the positions + myDet->getPositions(positions); + + //delete the combolist and reload it + disconnect(comboPos,SIGNAL(currentIndexChanged(int)), this, SLOT(SetPosition())); + comboPos->setEnabled(numPos); + lblPosList->setEnabled(numPos); + lblPosList->setText("List of Positions:"); + lblPosList->setPalette(normal); + for(int i=0;icount();i++) + comboPos->removeItem(i); + for(int i=0;iinsertItem(i,QString("%1").arg(positions[i])); + connect(comboPos, SIGNAL(currentIndexChanged(int)), this, SLOT(SetPosition())); + + +#ifdef VERBOSE + cout << "Updated position widget\tnum:" << numPos << endl; +#endif + } + for(int i=0;iRefresh(); + for(int i=0;iRefresh(); } //------------------------------------------------------------------------------------------------------------------------------------------------- + +int qTabActions::GetActualIndex(int index){ + switch(index){ + case 0: return slsDetectorDefs::startScript; + case Scan0: return 0; + case Scan1: return 1; + case 3: return slsDetectorDefs::scriptBefore; + case 5: return slsDetectorDefs::headerBefore; + case 6: return slsDetectorDefs::headerAfter; + case 7: return slsDetectorDefs::scriptAfter; + case 8: return slsDetectorDefs::stopScript; + default: return -1; + } +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 5b6b6a172..ae835b4fb 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -639,8 +639,8 @@ void qTabMeasurement::setTimingMode(int mode){ // to let qdrawplot know that triggers or frames are used - myPlot->setFrameEnabled(lblNumTriggers->isEnabled()); - myPlot->setTriggerEnabled(lblNumFrames->isEnabled()); + myPlot->setFrameEnabled(lblNumFrames->isEnabled()); + myPlot->setTriggerEnabled(lblNumTriggers->isEnabled()); return; } @@ -660,8 +660,8 @@ void qTabMeasurement::Refresh(){ SetupTimingMode(); // to let qdrawplot know that triggers or frames are used - myPlot->setFrameEnabled(lblNumTriggers->isEnabled()); - myPlot->setTriggerEnabled(lblNumFrames->isEnabled()); + myPlot->setFrameEnabled(lblNumFrames->isEnabled()); + myPlot->setTriggerEnabled(lblNumTriggers->isEnabled()); } diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index 43312db8a..cf6f800c5 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -86,7 +86,7 @@ void qTabPlot::SetupWidgetWindow(){ spinTimeGap->setMinimum(0); spinTimeGap->setDecimals(3); spinTimeGap->setMaximum(999999); - spinTimeGap->setValue(500.00); + spinTimeGap->setValue(myPlot->GetMinimumPlotTimer()); comboTimeGapUnit = new QComboBox; comboTimeGapUnit->addItem("hr"); comboTimeGapUnit->addItem("min"); @@ -362,8 +362,8 @@ void qTabPlot::SetPlot(){ if(radioNoPlot->isChecked()){ myPlot->EnablePlot(false); /**if enable is true, disable everything */ - box1D->hide(); - box2D->hide(); + if(isOneD) {box1D->show(); box1D->setEnabled(false); box2D->hide();} + if(!isOneD){box2D->show(); box2D->setEnabled(false); box1D->hide();} boxSnapshot->setEnabled(false); boxSave->setEnabled(false); boxFrequency->setEnabled(false); @@ -372,8 +372,8 @@ void qTabPlot::SetPlot(){ }else { myPlot->EnablePlot(true); /**if enable is true, disable everything */ - if(isOneD) box1D->show(); else box1D->hide(); - if(!isOneD) box2D->show(); else box2D->hide(); + if(isOneD) {box1D->show();box1D->setEnabled(true);} else box1D->hide(); + if(!isOneD){box2D->show();box2D->setEnabled(true);} else box2D->hide(); boxSnapshot->setEnabled(true); boxSave->setEnabled(true); boxFrequency->setEnabled(true); @@ -428,7 +428,7 @@ void qTabPlot::SetFrequency(){ if(timeMSPlot Tab: Interval between Plots - The nth Image must be larger.

" - "Condition to be satisfied:\n(Acquisition Period)*(nth Image) >= 500ms." + "Condition to be satisfied:\n(Acquisition Period)*(nth Image) >= 250ms." "

Nth image adjusted to minimum, " "for the chosen Acquisition Period.","Plot"); spinNthFrame->setValue(minFrame); From 2dbdf8ff17b4d02f31541821c115d2eaf243330e Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 3 Aug 2012 16:52:21 +0000 Subject: [PATCH 022/332] fixed bugs to do with stacked trace and fixed file input range for scan git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@22 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_scan.ui | 68 +- slsDetectorGui/forms/form_tab_dataoutput.ui | 65 +- slsDetectorGui/forms/form_tab_measurement.ui | 68 +- slsDetectorGui/forms/form_tab_plot.ui | 12 +- slsDetectorGui/include/qActionsWidget.h | 7 +- slsDetectorGui/include/qDefs.h | 5 + slsDetectorGui/include/qScanWidget.h | 84 ++- slsDetectorGui/include/qTabActions.h | 2 +- slsDetectorGui/include/qTabDataOutput.h | 4 + slsDetectorGui/include/qTabMeasurement.h | 4 + slsDetectorGui/src/qActionsWidget.cpp | 48 +- slsDetectorGui/src/qDetectorMain.cpp | 1 + slsDetectorGui/src/qDrawPlot.cpp | 4 +- slsDetectorGui/src/qScanWidget.cpp | 706 ++++++++++++++++--- slsDetectorGui/src/qTabActions.cpp | 31 +- slsDetectorGui/src/qTabAdvanced.cpp | 4 +- slsDetectorGui/src/qTabDataOutput.cpp | 52 +- slsDetectorGui/src/qTabMeasurement.cpp | 45 +- slsDetectorGui/src/qTabPlot.cpp | 1 - 19 files changed, 885 insertions(+), 326 deletions(-) diff --git a/slsDetectorGui/forms/form_scan.ui b/slsDetectorGui/forms/form_scan.ui index 2cbd35cd8..67e8faf06 100644 --- a/slsDetectorGui/forms/form_scan.ui +++ b/slsDetectorGui/forms/form_scan.ui @@ -62,19 +62,47 @@
+ + 0 + + + 5 + + + 0 + + + 2 + 0 5 - - 0 - - + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 20 + + + + + + + + + Constant Step Size @@ -84,7 +112,11 @@ - + + + <nobr>Measures only at specific values listed by the user.</nobr><br> +<nobr>Number of entries is restricted to <b>Number of Steps</b> field.</nobr> + Specific Values @@ -94,13 +126,17 @@ - + 0 0 + + <nobr>Measures only at the specific values listed in a file.</nobr><br> +<nobr>Select the file, where these values are listed.</nobr> + Values from File @@ -109,6 +145,22 @@ + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 20 + + + + @@ -283,13 +335,13 @@ - 1 + 0 1000000 - 2 + 0
diff --git a/slsDetectorGui/forms/form_tab_dataoutput.ui b/slsDetectorGui/forms/form_tab_dataoutput.ui index 5afac7644..e2da366fb 100644 --- a/slsDetectorGui/forms/form_tab_dataoutput.ui +++ b/slsDetectorGui/forms/form_tab_dataoutput.ui @@ -55,6 +55,10 @@ + + Flat field corrections. + #flatfield# filename + Flat Field File: @@ -81,6 +85,10 @@ false + + Flat field corrections. + #flatfield# filename + @@ -219,6 +227,10 @@ 0 + + Flat field corrections. + #flatfield# filename + Browse @@ -236,6 +248,9 @@ + + false + Angular Conversion @@ -299,56 +314,6 @@ - - - - 245 - 327 - 256 - 16 - - - - - - - - - 255 - 0 - 0 - - - - - - - - - 255 - 0 - 0 - - - - - - - - - 193 - 193 - 193 - - - - - - - - * Note: Enter valid file to enable Flat Field. - - diff --git a/slsDetectorGui/forms/form_tab_measurement.ui b/slsDetectorGui/forms/form_tab_measurement.ui index 3abf18353..eb248c158 100644 --- a/slsDetectorGui/forms/form_tab_measurement.ui +++ b/slsDetectorGui/forms/form_tab_measurement.ui @@ -427,13 +427,6 @@ - - - - Timing Mode: - - - @@ -632,6 +625,10 @@ false + + Frame period between exposures. + #period# + Acquisition Period: @@ -731,6 +728,13 @@ + + + + Timing Mode: + + + @@ -873,56 +877,6 @@ - - - - 130 - 330 - 521 - 16 - - - - - - - - - 255 - 0 - 0 - - - - - - - - - 255 - 0 - 0 - - - - - - - - - 193 - 193 - 193 - - - - - - - - * Note: The Acquisition Period should be greater than or equal to the Exposure Time. - - diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index 395a73f0e..8925ef5f2 100644 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -196,7 +196,7 @@ 10 20 - 358 + 356 26 @@ -220,7 +220,7 @@ - false + true @@ -236,7 +236,7 @@ - false + true @@ -380,7 +380,7 @@ - false + true @@ -412,7 +412,7 @@ - false + true @@ -1458,7 +1458,7 @@ - false + true diff --git a/slsDetectorGui/include/qActionsWidget.h b/slsDetectorGui/include/qActionsWidget.h index 32f35c51a..23ff9f3df 100644 --- a/slsDetectorGui/include/qActionsWidget.h +++ b/slsDetectorGui/include/qActionsWidget.h @@ -58,9 +58,9 @@ private: private slots: /** Sets the scan or script. Accordingly enables, disables other widgets - * @param index value chosen + * @param mode value chosen * */ -void SetScript(int index); +void SetMode(int mode); /** Browse for the script * */ @@ -71,9 +71,8 @@ void BrowsePath(); void SetScriptFile(); /** Set Parameter - * @param parameter is the parameter to be set to * */ -void SetParameter(const QString& parameter); +void SetParameter(); }; diff --git a/slsDetectorGui/include/qDefs.h b/slsDetectorGui/include/qDefs.h index e094b4edc..8390a562e 100644 --- a/slsDetectorGui/include/qDefs.h +++ b/slsDetectorGui/include/qDefs.h @@ -22,6 +22,11 @@ public: //------------------------------------------------------------------------------------------------------------------------------------------------- + enum{ + OK, + FAIL + }; +//------------------------------------------------------------------------------------------------------------------------------------------------- /** unit of time */ enum timeUnit{ diff --git a/slsDetectorGui/include/qScanWidget.h b/slsDetectorGui/include/qScanWidget.h index affa2d31f..192b95e5e 100644 --- a/slsDetectorGui/include/qScanWidget.h +++ b/slsDetectorGui/include/qScanWidget.h @@ -16,6 +16,7 @@ class multiSlsDetector; #include /** C++ Include Headers */ #include +#include using namespace std; @@ -42,17 +43,34 @@ private: multiSlsDetector *myDet; /**id of the scan widget*/ int id; + /**type of steps*/ + enum sizeIndex{RangeValues, CustomValues, FileValues}; + enum modes{None,EnergyScan,ThresholdScan,TrimbitsScan,CustomScript,NumModes}; + static const string modeNames[NumModes]; - QStackedLayout *stackedLayout; - QLabel *lblFrom; - QSpinBox *spinFrom; - QLabel *lblTo; - QSpinBox *spinTo; - QLabel *lblSize; - QSpinBox *spinSize; - QComboBox *comboSpecific; - QLineEdit *dispValues; - QPushButton *btnValues; + /**values*/ + int actualNumSteps; + vector positions; + + /**non error font*/ + QPalette normal; + QPalette red; + QString customTip; + QString fileTip; + + /**widgets needed for diff size types*/ + QButtonGroup *btnGroup; + QStackedLayout *stackedLayout; + QLabel *lblFrom; + QDoubleSpinBox *spinFrom; + QLabel *lblTo; + QDoubleSpinBox *spinTo; + QLabel *lblSize; + QDoubleSpinBox *spinSize; + QComboBox *comboCustom; + QPushButton *btnCustom; + QLineEdit *dispFile; + QPushButton *btnFile; /** Sets up the widget @@ -62,17 +80,24 @@ private: /** Sets up all the slots and signals */ void Initialization(); + /** Sets up all the parameters from server/client */ + void LoadPositions(); + /** Sets up the scan parameters + * returns if it was set + */ + int SetScan(int mode); private slots: -/** Sets the scan or script. Accordingly enables, disables other widgets - * @param index value chosen*/ -void SetScript(int index); - /** Enables widgets depending on which size is clicked. - * Options: constant size,specific values,values from file */ + * Options: constant size,specific values,values from file + * */ void EnableSizeWidgets(); +/** Sets the scan or script. Accordingly enables, disables other widgets + * @param mode value chosen*/ +void SetMode(int mode); + /** Browse for the script * */ void BrowsePath(); @@ -82,9 +107,34 @@ void BrowsePath(); void SetScriptFile(); /** Set Parameter - * @param parameter is the parameter to be set to * */ -void SetParameter(const QString& parameter); +void SetParameter(); + +/** Set precision + * @param value value of precision to be set + * */ +void SetPrecision(int value); + +/** Set number of steps + * */ +void SetNSteps(); + +/** Set custom steps + * returns OK if set properly + * */ +int SetCustomSteps(); + +/** Delete custom steps + * */ +void DeleteCustomSteps(); + +/** Reads the file to get the steps + * */ +void SetFileSteps(); + +/** Browses for the file path for steps + * */ +void BrowseFileStepsPath(); diff --git a/slsDetectorGui/include/qTabActions.h b/slsDetectorGui/include/qTabActions.h index 194990416..2eed3113a 100644 --- a/slsDetectorGui/include/qTabActions.h +++ b/slsDetectorGui/include/qTabActions.h @@ -77,7 +77,7 @@ private: QCheckBox *chkSeparate; QCheckBox *chkReturn; - float *positions; + double *positions; QPalette normal; diff --git a/slsDetectorGui/include/qTabDataOutput.h b/slsDetectorGui/include/qTabDataOutput.h index 5372964cb..f2c9b7edb 100644 --- a/slsDetectorGui/include/qTabDataOutput.h +++ b/slsDetectorGui/include/qTabDataOutput.h @@ -51,6 +51,10 @@ private: /** detector type */ slsDetectorDefs::detectorType detType; + QString flatFieldTip; + QString errFlatFieldTip; + QPalette red; + /** methods */ /** Sets up the widget */ void SetupWidgetWindow(); diff --git a/slsDetectorGui/include/qTabMeasurement.h b/slsDetectorGui/include/qTabMeasurement.h index 4fa630602..7cd823947 100644 --- a/slsDetectorGui/include/qTabMeasurement.h +++ b/slsDetectorGui/include/qTabMeasurement.h @@ -56,6 +56,10 @@ private: int currentMeasurement; + QString acqPeriodTip; + QString errPeriodTip; + QPalette red; + /** methods */ /** Sets up the widget */ diff --git a/slsDetectorGui/src/qActionsWidget.cpp b/slsDetectorGui/src/qActionsWidget.cpp index 2c6ba039d..e92850ad5 100644 --- a/slsDetectorGui/src/qActionsWidget.cpp +++ b/slsDetectorGui/src/qActionsWidget.cpp @@ -53,40 +53,40 @@ void qActionsWidget::SetupWidgetWindow(){ void qActionsWidget::Initialization(){ //mode - connect(comboScript, SIGNAL(currentIndexChanged(int)), this,SLOT(SetScript(int))); + connect(comboScript, SIGNAL(currentIndexChanged(int)), this,SLOT(SetMode(int))); //file connect(dispScript, SIGNAL(editingFinished()), this, SLOT(SetScriptFile())); connect(btnBrowse, SIGNAL(clicked()), this, SLOT(BrowsePath())); //parameter - connect(dispParameter, SIGNAL(textChanged(const QString&)), this, SLOT(SetParameter(const QString&))); + connect(dispParameter, SIGNAL(editingFinished()), this, SLOT(SetParameter())); } //------------------------------------------------------------------------------------------------------------------------------------------------- -void qActionsWidget::SetScript(int index){ +void qActionsWidget::SetMode(int mode){ #ifdef VERBOSE - cout << "Setting mode of action widget:" << id << " to " << index << endl; + cout << "Setting\taction:" << id << "\tmode:" << mode << endl; #endif //enabling/disabling - dispScript->setEnabled(index); - btnBrowse->setEnabled(index); - lblParameter->setEnabled(index); - dispParameter->setEnabled(index); + dispScript->setEnabled(mode); + btnBrowse->setEnabled(mode); + lblParameter->setEnabled(mode); + dispParameter->setEnabled(mode); QString fName = dispScript->text(); //set the mode - if(index) myDet->setActionScript(id,fName.toAscii().constData()); + if(mode) myDet->setActionScript(id,fName.toAscii().constData()); else myDet->setActionScript(id,""); //mode is not set when fname is blank if(!fName.isEmpty()){ //check if mode didnt get set - if(index!=myDet->getActionMode(id)){ + if(mode!=myDet->getActionMode(id)){ qDefs::WarningMessage("The mode could not be changed.","ActionsWidget"); comboScript->setCurrentIndex(myDet->getActionMode(id)); }//if mode got set and its custom script - else if(index){ + else if(mode){ //when the file name did not get set correctly if(fName.compare(QString(myDet->getActionScript(id).c_str()))){ qDefs::WarningMessage("The file path could not be set.","ActionsWidget"); @@ -123,10 +123,8 @@ void qActionsWidget::BrowsePath(){ void qActionsWidget::SetScriptFile(){ QString fName = dispScript->text(); #ifdef VERBOSE - cout << "Setting script file of action widget:" << id << " to " << fName.toAscii().constData() << endl; + cout << "Setting\taction:" << id << "\tscript:" << fName.toAscii().constData() << endl; #endif - disconnect(dispScript, SIGNAL(editingFinished()), this, SLOT(SetScriptFile())); - bool set = false; //blank @@ -166,19 +164,20 @@ void qActionsWidget::SetScriptFile(){ //dont display if theres a none if(!dispScript->text().compare("none")) dispScript->setText(""); - connect(dispScript, SIGNAL(editingFinished()), this, SLOT(SetScriptFile())); - } //------------------------------------------------------------------------------------------------------------------------------------------------- -void qActionsWidget::SetParameter(const QString& parameter){ +void qActionsWidget::SetParameter(){ + QString parameter = dispParameter->text(); #ifdef VERBOSE - cout << "Setting parameter of action widget:" << id << " to " << parameter.toAscii().constData() << endl; + cout << "Setting\taction:" << id << "\tparameter:" << parameter.toAscii().constData() << endl; #endif myDet->setActionParameter(id,parameter.toAscii().constData()); + //dont display if theres a none + if(!dispParameter->text().compare("none")) dispParameter->setText(""); } @@ -189,16 +188,19 @@ void qActionsWidget::Refresh(){ int mode = (myDet->getActionMode(id)>0?1:0); string script = myDet->getActionScript(id); string parameter = myDet->getActionParameter(id); - //defaults - if(script == "none") script=""; - if(parameter == "none") parameter=""; - //settings values + + //settings values and checking for none dispScript->setText(QString(script.c_str())); + SetScriptFile(); dispParameter->setText(QString(parameter.c_str())); + SetParameter(); //set mode which also checks everything comboScript->setCurrentIndex(mode); #ifdef VERBOSE - cout << "Updated action widget " << id << "\tmode:"<size().height(); // Default zoom Tool Tip zoomToolTip = dockWidgetPlot->toolTip(); + } diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 0fcd1f83b..66ec00d22 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -306,8 +306,8 @@ int qDrawPlot::GetData(detectorData *data){ for(int i=currentPersistency;i>0;i--) memcpy(yvalues[i],yvalues[i-1],nPixelsX*sizeof(double)); nHists = currentPersistency+1; - //memcpy(yvalues[0],data->values,nPixelsX*sizeof(double)); - for(int i=0;i<(int)nPixelsX;i++) *(yvalues[0]+i) = (double)*(data->values+i); + memcpy(yvalues[0],data->values,nPixelsX*sizeof(double)); + //for(int i=0;i<(int)nPixelsX;i++) *(yvalues[0]+i) = (double)*(data->values+i); } /**2d*/ else{ diff --git a/slsDetectorGui/src/qScanWidget.cpp b/slsDetectorGui/src/qScanWidget.cpp index 8892b5b59..93bac7d02 100644 --- a/slsDetectorGui/src/qScanWidget.cpp +++ b/slsDetectorGui/src/qScanWidget.cpp @@ -16,18 +16,24 @@ // C++ Include Headers #include +#include +#include using namespace std; //------------------------------------------------------------------------------------------------------------------------------------------------- + + int qScanWidget::NUM_SCAN_WIDGETS(0); +const string qScanWidget::modeNames[NumModes]={"","energy","threshold","trimbits","custom script"}; //------------------------------------------------------------------------------------------------------------------------------------------------- qScanWidget::qScanWidget(QWidget *parent,multiSlsDetector*& detector): - QWidget(parent),myDet(detector){ + QWidget(parent),myDet(detector),actualNumSteps(0){ setupUi(this); SetupWidgetWindow(); Initialization(); + LoadPositions(); } @@ -49,63 +55,92 @@ void qScanWidget::SetupWidgetWindow(){ setFixedHeight(125); + btnGroup = new QButtonGroup(this); + btnGroup->addButton(radioRange,0); + btnGroup->addButton(radioCustom,1); + btnGroup->addButton(radioFile,2); + + + normal = radioCustom->palette(); + red = QPalette(); + red.setColor(QPalette::Active,QPalette::WindowText,Qt::red); + fileTip = radioFile->toolTip(); + customTip = radioCustom->toolTip(); + //layout for the size widgets stackedLayout = new QStackedLayout; stackedLayout->setSpacing(0); - // Constant Size Layout - QWidget *constantWidget = new QWidget; - QHBoxLayout *layoutConstant = new QHBoxLayout(constantWidget); - layoutConstant->setContentsMargins(0, 0, 0, 0); - layoutConstant->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); - lblFrom = new QLabel("from",constantWidget); + // Range Size Layout + QWidget *widgetRange = new QWidget; + QHBoxLayout *layoutRange = new QHBoxLayout(widgetRange); + layoutRange->setContentsMargins(0, 0, 0, 0); + lblFrom = new QLabel("from",widgetRange); + spinFrom = new QDoubleSpinBox(widgetRange); + lblTo = new QLabel("to",widgetRange); + spinTo = new QDoubleSpinBox(widgetRange); + lblSize = new QLabel("Size",widgetRange); + spinSize = new QDoubleSpinBox(widgetRange); lblFrom->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); - layoutConstant->addWidget(lblFrom); - spinFrom = new QSpinBox(constantWidget); - layoutConstant->addWidget(spinFrom); - lblTo = new QLabel("to",constantWidget); + spinFrom->setValue(0); lblTo->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); - layoutConstant->addWidget(lblTo); - spinTo = new QSpinBox(constantWidget); - layoutConstant->addWidget(spinTo); - layoutConstant->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); - lblSize = new QLabel("Size",constantWidget); + spinTo->setValue(1); lblSize->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); - layoutConstant->addWidget(lblSize); - spinSize = new QSpinBox(constantWidget); - layoutConstant->addWidget(spinSize); - layoutConstant->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); - - // Specific Values Layout - QWidget *specificWidget = new QWidget; - QHBoxLayout *layoutSpecific = new QHBoxLayout(specificWidget); - layoutSpecific->setContentsMargins(0, 0, 0, 0); - layoutSpecific->addItem(new QSpacerItem(200,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); - comboSpecific = new QComboBox(specificWidget); - comboSpecific->setEditable(true); - comboSpecific->setCompleter(false); - layoutSpecific->addWidget(comboSpecific); - layoutSpecific->addItem(new QSpacerItem(200,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); - - // Values From a File Layout - QWidget *valuesWidget = new QWidget; - QHBoxLayout *layoutValues = new QHBoxLayout(valuesWidget); - layoutValues->setContentsMargins(0, 0, 0, 0); - layoutValues->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); - dispValues = new QLineEdit("steps.txt",valuesWidget); - dispValues->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed); - layoutValues->addWidget(dispValues); - btnValues = new QPushButton("Browse",valuesWidget); - btnValues->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); - layoutValues->addWidget(btnValues); - layoutValues->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); + spinSize->setValue(1); + layoutRange->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); + layoutRange->addWidget(lblFrom); + layoutRange->addWidget(spinFrom); + layoutRange->addWidget(lblTo); + layoutRange->addWidget(spinTo); + layoutRange->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); + layoutRange->addWidget(lblSize); + layoutRange->addWidget(spinSize); + layoutRange->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); - stackedLayout->addWidget(constantWidget); - stackedLayout->addWidget(specificWidget); - stackedLayout->addWidget(valuesWidget); + // Custom Values Layout + QWidget *widgetCustom = new QWidget; + QHBoxLayout *layoutCustom = new QHBoxLayout(widgetCustom); + layoutCustom->setContentsMargins(0, 0, 0, 0); + comboCustom = new QComboBox(widgetCustom); + btnCustom = new QPushButton("Delete",widgetCustom); + comboCustom->setEditable(true); + comboCustom->setCompleter(false); + QDoubleValidator *validate = new QDoubleValidator(comboCustom); + comboCustom->setValidator(validate); + radioCustom->setToolTip("Measures only at specific values listed by the user.
" + "Number of entries is restricted to Number of Steps field."); + comboCustom->setToolTip("Measures only at specific values listed by the user.
" + "Number of entries is restricted to Number of Steps field."); + btnCustom->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); + layoutCustom->addItem(new QSpacerItem(160,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); + layoutCustom->addWidget(comboCustom); + layoutCustom->addItem(new QSpacerItem(5,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); + layoutCustom->addWidget(btnCustom); + layoutCustom->addItem(new QSpacerItem(160,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); + + // File values From a File Layout + QWidget *widgetFile = new QWidget; + QHBoxLayout *layoutFile = new QHBoxLayout(widgetFile); + layoutFile->setContentsMargins(0, 0, 0, 0); + layoutFile->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); + dispFile = new QLineEdit(widgetFile); + dispFile->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed); + layoutFile->addWidget(dispFile); + btnFile = new QPushButton("Browse",widgetFile); + btnFile->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); + layoutFile->addWidget(btnFile); + layoutFile->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); + + + stackedLayout->addWidget(widgetRange); + stackedLayout->addWidget(widgetCustom); + stackedLayout->addWidget(widgetFile); stackedWidget->setLayout(stackedLayout); + radioCustom->setChecked(true); + stackedLayout->setCurrentIndex(CustomValues); + } @@ -114,16 +149,26 @@ void qScanWidget::SetupWidgetWindow(){ void qScanWidget::Initialization(){ //mode - connect(comboScript, SIGNAL(currentIndexChanged(int)), this,SLOT(SetScript(int))); + connect(comboScript, SIGNAL(currentIndexChanged(int)), this,SLOT(SetMode(int))); //file connect(dispScript, SIGNAL(editingFinished()), this, SLOT(SetScriptFile())); connect(btnBrowse, SIGNAL(clicked()), this, SLOT(BrowsePath())); //parameter - connect(dispParameter, SIGNAL(textChanged(const QString&)), this, SLOT(SetParameter(const QString&))); + connect(dispParameter, SIGNAL(editingFinished()), this, SLOT(SetParameter())); //sizewidgets - connect(radioConstant, SIGNAL(toggled(bool)),this,SLOT(EnableSizeWidgets())); - connect(radioSpecific, SIGNAL(toggled(bool)),this,SLOT(EnableSizeWidgets())); - connect(radioValue, SIGNAL(toggled(bool)),this,SLOT(EnableSizeWidgets())); + connect(btnGroup, SIGNAL(buttonClicked(QAbstractButton*)),this,SLOT(EnableSizeWidgets())); +// connect(radioRange, SIGNAL(toggled(bool)),this,SLOT(EnableSizeWidgets())); + //numsteps + connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps())); + //precision + connect(spinPrecision, SIGNAL(valueChanged(int)), this, SLOT(SetPrecision(int))); + //range values + //custom values + connect(comboCustom, SIGNAL(currentIndexChanged(int)), this, SLOT(SetCustomSteps())); + connect(btnCustom, SIGNAL(clicked()), this, SLOT(DeleteCustomSteps())); + //file values + connect(dispFile, SIGNAL(editingFinished()), this, SLOT(SetFileSteps())); + connect(btnFile, SIGNAL(clicked()), this, SLOT(BrowseFileStepsPath())); } @@ -131,21 +176,86 @@ void qScanWidget::Initialization(){ void qScanWidget::EnableSizeWidgets(){ - if(radioConstant->isChecked()) - stackedLayout->setCurrentIndex(0); - else if(radioSpecific->isChecked()) - stackedLayout->setCurrentIndex(1); - else - stackedLayout->setCurrentIndex(2); +#ifdef VERBOSE + cout << "Entering enable size widgets" << endl; +#endif + //scan is none + if(!comboScript->currentIndex()){ + radioCustom->setText("Specific Values"); + radioCustom->setPalette(normal); + radioCustom->setToolTip(customTip); + comboCustom->setToolTip(customTip); + + radioFile->setPalette(normal); + radioFile->setText("Values from File:"); + radioFile->setToolTip(fileTip); + dispFile->setToolTip(fileTip); + btnFile->setToolTip(fileTip); + } + else{ + // Steps are enabled for all except Range step size + lblSteps->setEnabled(!radioRange->isChecked()); + spinSteps->setEnabled(!radioRange->isChecked()); + //range values + if(radioRange->isChecked()){ +#ifdef VERBOSE + cout << "Constant Range Values" << endl; +#endif + stackedLayout->setCurrentIndex(RangeValues); + /**refresh this part*/ + } + //custom values + else if(radioCustom->isChecked()){ +#ifdef VERBOSE + cout << "Custom Values" << endl; +#endif + //defaults for other mode + radioFile->setPalette(normal); + radioFile->setText("Values from File:"); + radioFile->setToolTip(fileTip); + dispFile->setToolTip(fileTip); + btnFile->setToolTip(fileTip); + + //change it back as this list is what will be loaded. + //also numstpes could have been changed in other modes too + disconnect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps())); + spinSteps ->setValue(comboCustom->count()); + connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps())); + + stackedLayout->setCurrentIndex(CustomValues); + //only for custom steps out here because many signals go through + //custom steps and we want to give the info msg only when changig range types + if(SetCustomSteps()==qDefs::OK){ + char cNum[200];sprintf(cNum,"%d",actualNumSteps); + char cId[5];sprintf(cId,"%d",id); + qDefs::InfoMessage(string("Scan Level ")+string(cId)+(" - ")+string(" Number of positions added from list : ")+string(cNum),"ScanWidget"); + } + } + //file values + else{ +#ifdef VERBOSE + cout << "File Values" << endl; +#endif + //defaults for other mode + radioCustom->setText("Specific Values"); + radioCustom->setPalette(normal); + radioCustom->setToolTip(customTip); + comboCustom->setToolTip(customTip); + + stackedLayout->setCurrentIndex(FileValues); + SetFileSteps(); + } + } + } //------------------------------------------------------------------------------------------------------------------------------------------------- -void qScanWidget::SetScript(int index){ +void qScanWidget::SetMode(int mode){ #ifdef VERBOSE - cout << "Setting mode of scan widget:" << id << " to " << index << endl; + cout << "Setting\tscan:" << id << "\tmode:" << mode << endl; #endif // defaults dispScript->setEnabled(false); @@ -159,9 +269,12 @@ void qScanWidget::SetScript(int index){ spinPrecision->setEnabled(false); // If anything other than None is selected - if(index){ + if(mode){ + // Steps are enabled for all except Range step size + lblSteps->setEnabled(!radioRange->isChecked()); + spinSteps->setEnabled(!radioRange->isChecked()); // Custom Script only enables the first layout with addnl parameters etc - if(index==4){ + if(mode==CustomScript){ dispScript->setEnabled(true); btnBrowse->setEnabled(true); lblParameter->setEnabled(true); @@ -170,36 +283,63 @@ void qScanWidget::SetScript(int index){ group->setEnabled(true); lblPrecision->setEnabled(true); spinPrecision->setEnabled(true); - // Steps are enabled only if constant step size is not checked - lblSteps->setEnabled(!radioConstant->isChecked()); - spinSteps->setEnabled(!radioConstant->isChecked()); - } + + //set the group box widgets + EnableSizeWidgets(); + //emit signal to enable scanbox in plot tab - emit EnableScanBox(index,id); + emit EnableScanBox(mode,id); - - QString fName = dispScript->text(); //set the mode - if(index) myDet->setActionScript(id,fName.toAscii().constData()); - else myDet->setActionScript(id,""); - //mode is not set when fname is blank - if(!fName.isEmpty()){ - //check if mode didnt get set - if(index!=myDet->getActionMode(id)){ - qDefs::WarningMessage("The mode could not be changed.","ScanWidget"); - comboScript->setCurrentIndex(myDet->getActionMode(id)); - }//if mode got set and its custom script - else if(index){ - //when the file name did not get set correctly - if(fName.compare(QString(myDet->getActionScript(id).c_str()))){ - qDefs::WarningMessage("The file path could not be set.","ScanWidget"); - dispScript->setText(QString(myDet->getActionScript(id).c_str())); - SetScriptFile(); - } + SetScan(mode); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +int qScanWidget::SetScan(int mode){ + string parameter = string(dispParameter->text().toAscii().constData()); + string script = string(dispScript->text().toAscii().constData()); +#ifdef VERBOSE + cout << "SETTING scan:" << id << "\tmode:" << comboScript->currentIndex() << + "\tnumSteps:" << actualNumSteps << + "\tscript:" << script << "\tparameter:" << parameter << endl; +#endif + double *values; + if(actualNumSteps) values = new double[actualNumSteps]; + else values = NULL; + for(int i=0;isetScan(id,modeNames[mode],actualNumSteps,values,parameter); + break; + case EnergyScan: + myDet->setScan(id,modeNames[mode],actualNumSteps,values,parameter); + break; + case ThresholdScan: + myDet->setScan(id,modeNames[mode],actualNumSteps,values,parameter); + break; + case TrimbitsScan: + myDet->setScan(id,modeNames[mode],actualNumSteps,values,parameter); + break; + case CustomScript: + myDet->setScan(id,script,actualNumSteps,values,parameter); + break; + } + + if(mode!=CustomScript){ + if((mode!=myDet->getScanMode(id))&&(actualNumSteps)){ + qDefs::WarningMessage("The mode could not be changed for an unknown reason.","ScanWidget"); + comboScript->setCurrentIndex(myDet->getScanMode(id)); + return qDefs::FAIL; } } + return qDefs::OK; } @@ -207,11 +347,11 @@ void qScanWidget::SetScript(int index){ void qScanWidget::BrowsePath(){ #ifdef VERBOSE - cout << "Browsing Script File Path" << endl; + cout << "Browsing Script File Path\tscan:" << id << endl; #endif QString fName = dispScript->text(); QString dir = fName.section('/',0,-2,QString::SectionIncludeLeadingSep); - if(dir.isEmpty()) dir = "/home"; + if(dir.isEmpty()) dir = "/home/"; //dialog fName = QFileDialog::getOpenFileName(this, tr("Load Script File"),dir, @@ -228,13 +368,18 @@ void qScanWidget::BrowsePath(){ void qScanWidget::SetScriptFile(){ QString fName = dispScript->text();bool set = false; #ifdef VERBOSE - cout << "Setting script file of scan widget:" << id << " to " << fName.toAscii().constData() << endl; + cout << "Setting\tscan:" << id << "\tscript:" << fName.toAscii().constData() << endl; #endif - disconnect(dispScript, SIGNAL(editingFinished()), this, SLOT(SetScriptFile())); + //blank - if(fName.isEmpty()) set = true; - else if(!fName.compare("none")) set = true; + if(fName.isEmpty()) + set = true; + else if( (!fName.compare("none"))|| + (!fName.compare("energy"))|| + (!fName.compare("threshold"))|| + (!fName.compare("trimbits")) ) + set = true; //not blank else{ QString file = dispScript->text().section('/',-1); @@ -246,31 +391,34 @@ void qScanWidget::SetScriptFile(){ //if the file doesnt exist, set it to what it was before else{ qDefs::WarningMessage("The script file entered does not exist","ScanWidget"); - dispScript->setText(QString(myDet->getActionScript(id).c_str())); + dispScript->setText(QString(myDet->getScanScript(id).c_str())); } }//not a file, set it to what it was before else { qDefs::WarningMessage("The script file path entered is not a file","ScanWidget"); - dispScript->setText(QString(myDet->getActionScript(id).c_str())); + dispScript->setText(QString(myDet->getScanScript(id).c_str())); } } //if blank or valid file if(set){ - myDet->setActionScript(id,fName.toAscii().constData()); - if(fName.compare(QString(myDet->getActionScript(id).c_str()))){ + myDet->setScanScript(id,fName.toAscii().constData()); + if(fName.compare(QString(myDet->getScanScript(id).c_str()))){ //did not get set, write what is was before if(!fName.isEmpty()) qDefs::WarningMessage("The script file could not be set. Reverting to previous file.","ScanWidget"); - dispScript->setText(QString(myDet->getActionScript(id).c_str())); + dispScript->setText(QString(myDet->getScanScript(id).c_str())); } } //dont display if theres a none - if(!dispScript->text().compare("none")) dispScript->setText(""); - - connect(dispScript, SIGNAL(editingFinished()), this, SLOT(SetScriptFile())); + fName = dispScript->text(); + if( (!fName.compare("none"))|| + (!fName.compare("energy"))|| + (!fName.compare("threshold"))|| + (!fName.compare("trimbits")) ) + dispScript->setText(""); } @@ -278,13 +426,345 @@ void qScanWidget::SetScriptFile(){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void qScanWidget::SetParameter(const QString& parameter){ +void qScanWidget::SetParameter(){ + QString parameter = dispParameter->text(); #ifdef VERBOSE - cout << "Setting parameter of scan widget:" << id << " to " << parameter.toAscii().constData() << endl; + cout << "Setting\tscan:" << id << "\tparameter:" << parameter.toAscii().constData() << endl; #endif - myDet->setActionParameter(id,parameter.toAscii().constData()); + myDet->setScanParameter(id,parameter.toAscii().constData()); + //dont display if theres a none + parameter = dispParameter->text(); + if( (!parameter.compare("none"))|| + (!parameter.compare("energy"))|| + (!parameter.compare("threshold"))|| + (!parameter.compare("trimbits")) ) + dispParameter->setText(""); +} + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qScanWidget::SetPrecision(int value){ +#ifdef VERBOSE + cout << "Setting\tscan:" << id << "\tprecision:" << value << endl; +#endif + myDet->setScanPrecision(id,value); + if(myDet->getScanPrecision(id)!=value) + qDefs::WarningMessage("The precision was not set for an unknown reason.","ScanWidget");; +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qScanWidget::SetNSteps(){ + +#ifdef VERBOSE + cout << "Setting number of steps" << endl; +#endif + + int numSteps = spinSteps->value(); + comboCustom->setMaxCount(numSteps); + + //check if its ok + if(radioCustom->isChecked()){ + SetCustomSteps(); + } + +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +int qScanWidget::SetCustomSteps(){ + +#ifdef VERBOSE + cout << "Setting\tscan:" << id << "\tcustom\tnum pos:" << comboCustom->count() << endl; +#endif + disconnect(comboCustom, SIGNAL(currentIndexChanged(int)), this, SLOT(SetCustomSteps())); + + //get number of positions + int numSteps = spinSteps->value(); + comboCustom->setMaxCount(numSteps); + comboCustom->setEnabled(numSteps); + btnCustom->setEnabled(numSteps); + + //deleting too many or not entering enough + if(numSteps>comboCustom->count()){ +#ifdef VERBOSE + cout << "Too few entries" << endl; +#endif + int diff = numSteps - (comboCustom->count()); + radioCustom->setPalette(red); + radioCustom->setText("Specific Values*"); + QString tip = customTip + QString("

Add ")+ + (QString("%1").arg(diff))+ + QString(" more positions to the list to match Number of Steps.
" + "
Or reduce Number of Steps.
"); + radioCustom->setToolTip(tip); + comboCustom->setToolTip(tip); + }else{ + radioCustom->setText("Specific Values"); + radioCustom->setPalette(normal); + radioCustom->setToolTip(customTip); + comboCustom->setToolTip(customTip); + } + + actualNumSteps = comboCustom->count(); + //delete existing positions + positions.resize(actualNumSteps); + //copying the list + for(int i=0;iitemText(i).toDouble(); + cout<<"positions["<setScanSteps(id,actualNumSteps,positions)<currentIndex())==qDefs::OK){ + if(myDet->getScanSteps(id)!=actualNumSteps){ + qDefs::WarningMessage("The positions list was not set for an unknown reason.","ScanWidget"); + LoadPositions(); + comboScript->setCurrentIndex(myDet->getScanMode(id)); + return qDefs::FAIL; + } + } + + //if num of steps = 0 + if(!spinSteps->value()){ + comboCustom->setEnabled(false); + btnCustom->setEnabled(false); + radioCustom->setPalette(red); + radioCustom->setText("Specific Values*"); + QString tip = customTip + QString("

First, increase Number of Steps. " + "Then, enter values here."); + radioCustom->setToolTip(tip); + comboCustom->setToolTip(tip); + } + connect(comboCustom, SIGNAL(currentIndexChanged(int)), this, SLOT(SetCustomSteps())); + + return qDefs::OK; +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qScanWidget::DeleteCustomSteps(){ + QString pos = comboCustom->currentText(); + bool found = false; + //loops through to find the index and to make sure its in the list + for(int i=0;icount();i++){ + if(!comboCustom->itemText(i).compare(pos)){ + found = true; + comboCustom->removeItem(i); + break; + } + } + if(found){ +#ifdef VERBOSE + cout << "Deleting Position " << endl; +#endif + } +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qScanWidget::SetFileSteps(){ + QString fName = dispFile->text(); +#ifdef VERBOSE + cout << "Setting\tscan:" << id << "\tfile\t:" << fName.toAscii().constData() << endl; +#endif + bool set = false; + + if(fName.isEmpty()){ //blank +#ifdef VERBOSE + cout << "Empty file" << endl; +#endif + radioFile->setPalette(red); + radioFile->setText("Values from File:*"); + QString errTip = fileTip + QString("

The file path is empty.");; + radioFile->setToolTip(errTip);dispFile->setToolTip(errTip);btnFile->setToolTip(errTip); + }else{ + QString file = dispFile->text().section('/',-1); + if(file.contains('.')){ //is a file + //check if it exists and set the script file + if(QFile::exists(fName)) set = true; + else{//if the file doesnt exist, set it to what it was before +#ifdef VERBOSE + cout << "The file entered does not exist." << endl; +#endif + radioFile->setPalette(red); + radioFile->setText("Values from File:*"); + QString errTip = fileTip + QString("

The file entered does not exist."); + radioFile->setToolTip(errTip);dispFile->setToolTip(errTip);btnFile->setToolTip(errTip); + } + } else {//not a file, set it to what it was before +#ifdef VERBOSE + cout << "The file path entered is not a file." << endl; +#endif + radioFile->setPalette(red); + radioFile->setText("Values from File:*"); + QString errTip = fileTip + QString("

The file path entered is not a file."); + radioFile->setToolTip(errTip); dispFile->setToolTip(errTip);btnFile->setToolTip(errTip); + } + } + + //if valid file + if(set){ + ifstream inFile;string sLine;char sArg[200]=""; + //open file + inFile.open(fName.toAscii().constData(), ifstream::in); + if(inFile.is_open()){ + //delete existing positions + positions.resize(0); + actualNumSteps = 0; +#ifdef VERBOSE + cout<< "Opening file "<< fName.toAscii().constData() << endl; +#endif + while(inFile.good()) { + getline(inFile,sLine); + if(sLine.find('#')!=string::npos) continue;//commented out + else if(sLine.length()<2) continue;// empty line + else { + istringstream sstr(sLine); + if(sstr.good()){ + actualNumSteps++; + positions.resize(actualNumSteps); + sstr>>sArg; + if(!sscanf(sArg,"%lf",&positions[actualNumSteps-1])){ + actualNumSteps--; + positions.resize(actualNumSteps); + } + else cout<<"value["<setValue(actualNumSteps); + connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps())); + inFile.close(); + }else {//could not open file +#ifdef VERBOSE + cout << "Could not open file" << endl; +#endif + set = false; + radioFile->setPalette(red); + radioFile->setText("Values from File:*"); + QString errTip = fileTip + QString("

Could not read file."); + radioFile->setToolTip(errTip);dispFile->setToolTip(errTip); btnFile->setToolTip(errTip); + } + } + if(set){//no error while reading file + //sets the scan and positions + if(SetScan(comboScript->currentIndex())==qDefs::OK){ + radioFile->setPalette(normal); + radioFile->setText("Values from File:"); + radioFile->setToolTip(fileTip);dispFile->setToolTip(fileTip);btnFile->setToolTip(fileTip); + //error loading positions + if(myDet->getScanSteps(id)!=actualNumSteps){ + qDefs::WarningMessage("The positions list was not set for an unknown reason.","ScanWidget"); + }else{//SUCCESS + char cNum[200];sprintf(cNum,"%d",actualNumSteps); + char cId[5];sprintf(cId,"%d",id); + qDefs::InfoMessage(string("Scan Level ")+string(cId)+(" - ")+string(" Number of positions added from file : ")+string(cNum),"ScanWidget"); + } + } + } +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qScanWidget::BrowseFileStepsPath(){ +#ifdef VERBOSE + cout << "Browsing Steps File Path\tscan:" << id << endl; +#endif + QString fName = dispFile->text(); + QString dir = fName.section('/',0,-2,QString::SectionIncludeLeadingSep); + if(dir.isEmpty()) dir = "/home/"; + //dialog + fName = QFileDialog::getOpenFileName(this, + tr("Load Scan Steps Script File"),dir, + tr("Scan Steps Script Files(*.awk);;All Files(*)")); + //if empty, set the file name and it calls SetFileSteps, else ignore + if (!fName.isEmpty()){ + dispFile->setText(fName); + SetFileSteps(); + } + +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qScanWidget::LoadPositions(){ +#ifdef VERBOSE + cout << "Loading positions" << endl; +#endif + disconnect(comboCustom, SIGNAL(currentIndexChanged(int)), this, SLOT(SetCustomSteps())); + disconnect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps())); + disconnect(btnGroup, SIGNAL(buttonClicked(QAbstractButton*)),this,SLOT(EnableSizeWidgets())); + + + int mode = myDet->getScanMode(id); + radioCustom->setChecked(true); + + int numSteps = myDet->getScanSteps(id); + actualNumSteps = numSteps; + comboCustom->setMaxCount(numSteps); + positions.resize(actualNumSteps); + + //set the number of steps in the gui + spinSteps->setValue(numSteps); + + //load the positions + double *values = NULL; + if(actualNumSteps){ + values = new double[actualNumSteps]; + myDet->getScanSteps(id,values); + } + for(int i=0;isetText("Specific Values"); + radioCustom->setPalette(normal); + radioCustom->setToolTip(customTip); + comboCustom->setToolTip(customTip); + }else{ + radioCustom->setPalette(red); + radioCustom->setText("Specific Values*"); + QString tip = customTip + QString("

First, increase Number of Steps. " + "Then, enter values here."); + radioCustom->setToolTip(tip); + comboCustom->setToolTip(tip); + } + for(int i=0;icount();i++) + comboCustom->removeItem(i); + for(int i=0;iinsertItem(i,QString("%1").arg(positions[i])); + + //delete the combolist and reload it + comboCustom->setEnabled(numSteps&&mode); + btnCustom->setEnabled(numSteps&&mode); + + + + connect(comboCustom, SIGNAL(currentIndexChanged(int)), this, SLOT(SetCustomSteps())); + connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps())); + connect(btnGroup, SIGNAL(buttonClicked(QAbstractButton*)),this,SLOT(EnableSizeWidgets())); } @@ -292,28 +772,32 @@ void qScanWidget::SetParameter(const QString& parameter){ void qScanWidget::Refresh(){ - int mode = (myDet->getScanMode(id)>0?1:0); + int mode = (myDet->getScanMode(id)); string script = myDet->getScanScript(id); string parameter = myDet->getScanParameter(id); - double precision = myDet->getScanPrecision(id); + int precision = myDet->getScanPrecision(id); - //defaults - if(script == "none") script=""; - if(parameter == "none") parameter=""; - //settings values + + //settings values and checking for none dispScript->setText(QString(script.c_str())); + SetScriptFile(); dispParameter->setText(QString(parameter.c_str())); + SetParameter(); spinPrecision->setValue(precision); - //set mode which also checks everything + + //set mode which also checks number of steps + //and enable size widgets and set the positions from combolist to server comboScript->setCurrentIndex(mode); #ifdef VERBOSE - cout << "Updated scan widget " << id << "\t" + cout << "Updated\tscan:" << id << "\t" "mode:"<setHorizontalSpacing(0); layout->setVerticalSpacing(5); - lblNumPos = new QLabel("Number of Positions:"); + lblNumPos = new QLabel("Number of Positions: "); lblNumPos->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); layout->addWidget(lblNumPos,0,0); layout->addItem(new QSpacerItem(5,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,1); spinNumPos = new QSpinBox(this); layout->addWidget(spinNumPos,0,2); layout->addItem(new QSpacerItem(80,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,3); - lblPosList = new QLabel("List of Positions:"); + lblPosList = new QLabel("List of Positions: "); lblPosList->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); + lblPosList->setFixedWidth(108); lblPosList->setEnabled(false); lblPosList->setToolTip("Enter the positions at which the detector should be moved.
" "Number of entries is restricted to Number of Positions field."); layout->addWidget(lblPosList,0,4); - layout->addItem(new QSpacerItem(5,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,5); comboPos = new QComboBox(this); comboPos->setEditable(true); comboPos->setCompleter(false); @@ -144,11 +144,11 @@ void qTabActions::CreatePositionsWidget(){ comboPos->setEnabled(false); QDoubleValidator *validate = new QDoubleValidator(comboPos); comboPos->setValidator(validate); - layout->addWidget(comboPos,0,6); - layout->addItem(new QSpacerItem(5,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,7); + layout->addWidget(comboPos,0,5); + layout->addItem(new QSpacerItem(5,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,6); btnDelete = new QPushButton("Delete"); btnDelete->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); - layout->addWidget(btnDelete,0,8); + layout->addWidget(btnDelete,0,7); //might be included at some point /* QGroupBox *w = new QGroupBox; @@ -251,19 +251,20 @@ void qTabActions::SetPosition(){ lblPosList->setPalette(red); QString tip = QString("Enter the positions at which the detector should be moved.
" "Number of entries is restricted to Number of Positions field.

")+ - QString("Add ")+ + QString("Add ")+ (QString("%1").arg(((numPos)-(comboPos->count()))))+ - QString(" more positions to the list to match Number of Positions."); + QString(" more positions to the list to match Number of Positions.
" + "Or reduce Number of Positions.
"); lblPosList->setToolTip(tip); lblPosList->setText("List of Positions:*"); }else{ - lblPosList->setText("List of Positions:"); + lblPosList->setText("List of Positions: "); lblPosList->setPalette(normal); lblPosList->setToolTip("Enter the positions at which the detector should be moved.
" - "Number of entries is restricted to Number of Positions field."); + "Number of entries is restricted to Number of Positions field."); //delete existing positions if (positions) delete [] positions; - positions=new float[numPos]; + positions=new double[numPos]; //copying the list for(int i=0;iitemText(i).toDouble(); @@ -302,7 +303,7 @@ void qTabActions::DeletePosition(){ void qTabActions::Refresh(){ #ifdef VERBOSE - cout << "Updating all action widgets " << endl; + cout << "\nUpdating all action widgets " << endl; #endif if(lblName[NumPositions]->isEnabled()){ //delete existing positions @@ -316,7 +317,7 @@ void qTabActions::Refresh(){ spinNumPos->setValue(numPos); connect(spinNumPos, SIGNAL(valueChanged(int)), this, SLOT(SetPosition())); - positions=new float[numPos]; + positions=new double[numPos]; //load the positions myDet->getPositions(positions); @@ -324,7 +325,7 @@ void qTabActions::Refresh(){ disconnect(comboPos,SIGNAL(currentIndexChanged(int)), this, SLOT(SetPosition())); comboPos->setEnabled(numPos); lblPosList->setEnabled(numPos); - lblPosList->setText("List of Positions:"); + lblPosList->setText("List of Positions: "); lblPosList->setPalette(normal); for(int i=0;icount();i++) comboPos->removeItem(i); @@ -334,7 +335,7 @@ void qTabActions::Refresh(){ #ifdef VERBOSE - cout << "Updated position widget\tnum:" << numPos << endl; + cout << "Updated position widget\tnum:" << numPos << endl << endl; #endif } for(int i=0;igetADC(slsDetectorDefs::TEMPERATURE_ADC); + double tempadc = myDet->getADC(slsDetectorDefs::TEMPERATURE_ADC); sprintf(ctemp,"%f%cC",tempadc,0x00B0); dispTempAdc->setText(QString(ctemp)); /** fpga */ - float tempfpga = myDet->getADC(slsDetectorDefs::TEMPERATURE_FPGA); + double tempfpga = myDet->getADC(slsDetectorDefs::TEMPERATURE_FPGA); sprintf(ctemp,"%f%cC",tempfpga,0x00B0); dispTempFpga->setText(QString(ctemp)); #ifdef VERBOSE diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index 05faa7c85..3aeb9512f 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -52,6 +52,19 @@ void qTabDataOutput::SetupWidgetWindow(){ //rate correction - not for charge integrating detectors if((detType == slsDetectorDefs::MYTHEN)||(detType == slsDetectorDefs::EIGER)) chkRate->setEnabled(true); + + if((detType == slsDetectorDefs::MYTHEN)||(detType == slsDetectorDefs::GOTTHARD)) + chkAngular->setEnabled(true); + + /** error message **/ + red = QPalette(); + red.setColor(QPalette::Active,QPalette::WindowText,Qt::red); + flatFieldTip = dispFlatField->toolTip(); + errFlatFieldTip = QString("Flat field corrections.
" + " #flatfield# filename

")+ + QString("" + "Enter a valid file to enable Flat Field."); + } @@ -114,8 +127,9 @@ void qTabDataOutput::SetFlatField(){ if(chkFlatField->isChecked()){ if(dispFlatField->text().isEmpty()){ - lblNote->show(); - chkFlatField->setPalette(lblNote->palette()); + chkFlatField->setToolTip(errFlatFieldTip); + dispFlatField->setToolTip(errFlatFieldTip); + chkFlatField->setPalette(red); chkFlatField->setText("Flat Field File:*"); #ifdef VERBOSE cout << "Flat Field File is not set." << endl; @@ -125,7 +139,8 @@ void qTabDataOutput::SetFlatField(){ QString file = fName.section('/',-1); QString dir = fName.section('/',0,-2,QString::SectionIncludeLeadingSep); - lblNote->hide(); + chkFlatField->setToolTip(flatFieldTip); + dispFlatField->setToolTip(flatFieldTip); chkFlatField->setPalette(chkRate->palette()); chkFlatField->setText("Flat Field File:"); //set ff dir @@ -133,15 +148,16 @@ void qTabDataOutput::SetFlatField(){ //set ff file and catch error if -1 if(myDet->setFlatFieldCorrectionFile(file.toAscii().constData())<0){ string sDir = dir.toAscii().constData(),sFile = file.toAscii().constData(); - if(sDir.length()<1) sDir = "/home"; - qDefs::WarningMessage("Invalid Flat Field file - "+sDir+sFile+ + if(sDir.length()<1) {sDir = string(QDir::current().absolutePath().toAscii().constData()); /*"/home/";*/} + qDefs::WarningMessage("Invalid Flat Field file: "+sDir+"/"+sFile+ ".\nUnsetting Flat Field.","Data Output"); //Unsetting flat field myDet->setFlatFieldCorrectionFile(""); dispFlatField->setText(""); - lblNote->show(); - chkFlatField->setPalette(lblNote->palette()); + chkFlatField->setToolTip(errFlatFieldTip); + dispFlatField->setToolTip(errFlatFieldTip); + chkFlatField->setPalette(red); chkFlatField->setText("Flat Field File:*"); #ifdef VERBOSE cout << "Invalid Flat Field File - "<< sDir << sFile << ". Unsetting Flat Field." << endl; @@ -154,7 +170,8 @@ void qTabDataOutput::SetFlatField(){ } } }else{ - lblNote->hide(); + chkFlatField->setToolTip(flatFieldTip); + dispFlatField->setToolTip(flatFieldTip); chkFlatField->setPalette(chkRate->palette()); chkFlatField->setText("Flat Field File:"); //Unsetting flat field @@ -188,7 +205,11 @@ void qTabDataOutput::UpdateFlatFieldFromServer(){ else chkFlatField->setChecked(true); - lblNote->hide(); + chkFlatField->setToolTip(flatFieldTip); + dispFlatField->setToolTip(flatFieldTip); + chkFlatField->setPalette(chkRate->palette()); + chkFlatField->setText("Flat Field File:"); + connect(dispFlatField, SIGNAL(editingFinished()), this, SLOT(SetFlatField())); } @@ -198,10 +219,10 @@ void qTabDataOutput::BrowseFlatFieldPath() { QString fName = dispFlatField->text(); QString dir = fName.section('/',0,-2,QString::SectionIncludeLeadingSep); - if(dir.isEmpty()) dir = "/home"; + if(dir.isEmpty()) dir = QString(myDet->getFlatFieldCorrectionDir().c_str());/*"/home/";*/ fName = QFileDialog::getOpenFileName(this, tr("Load Flat Field Correction File"),dir, - tr("Flat Field Correction Files(*.dat)"));//,0,QFileDialog::ShowDirsOnly); + tr("Flat Field Correction Files(*.dat)"),0,QFileDialog::ShowDirsOnly); if (!fName.isEmpty()){ dispFlatField->setText(fName); SetFlatField(); @@ -237,7 +258,7 @@ void qTabDataOutput::SetRateCorrection(){ }//custom dead time else{ spinDeadTime->setEnabled(true); - s->setRateCorrection((float)spinDeadTime->value()); + s->setRateCorrection((double)spinDeadTime->value()); #ifdef VERBOSE cout << "Setting rate corrections with dead time "<< spinDeadTime->value() << endl; #endif @@ -368,8 +389,11 @@ void qTabDataOutput::Refresh(){ if((detType == slsDetectorDefs::MYTHEN)||(detType == slsDetectorDefs::EIGER)) UpdateRateCorrectionFromServer(); //update angular conversion from server - int ang; - if(myDet->getAngularConversion(ang)) chkAngular->setChecked(true); + if((detType == slsDetectorDefs::MYTHEN)||(detType == slsDetectorDefs::GOTTHARD)){ + int ang; + if(myDet->getAngularConversion(ang)) + chkAngular->setChecked(true); + } //discard bad channels from server if(myDet->getBadChannelCorrection()) chkDiscardBad->setChecked(true); } diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index ae835b4fb..f32d2ab42 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -59,7 +59,13 @@ void qTabMeasurement::SetupWidgetWindow(){ spinExpTime->setValue(time); comboExpUnit->setCurrentIndex((int)unit); /** Hide the error message **/ - lblNote->hide(); + red = QPalette(); + red.setColor(QPalette::Active,QPalette::WindowText,Qt::red); + acqPeriodTip = spinPeriod->toolTip(); + errPeriodTip = QString("Frame period between exposures.
" + " #period#

")+ + QString("Acquisition Period should be" + " greater than or equal to Exposure Time."); /** File Name **/ dispFileName->setText(QString(myDet->getFileName().c_str())); /** File Index **/ @@ -358,13 +364,15 @@ void qTabMeasurement::setExposureTime(){ double acqtimeNS; acqtimeNS = qDefs::getNSTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value()); if(exptimeNS>acqtimeNS) { - lblNote->show(); - lblPeriod->setPalette(lblNote->palette()); + spinPeriod->setToolTip(errPeriodTip); + lblPeriod->setToolTip(errPeriodTip); + lblPeriod->setPalette(red); lblPeriod->setText("Acquisition Period:*"); } else { - lblNote->hide(); - lblPeriod->setPalette(lblNumFrames->palette()); + spinPeriod->setToolTip(acqPeriodTip); + lblPeriod->setToolTip(acqPeriodTip); + lblPeriod->setPalette(lblTimingMode->palette()); lblPeriod->setText("Acquisition Period:"); } } @@ -386,13 +394,15 @@ void qTabMeasurement::setAcquisitionPeriod(){ double exptimeNS; exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value()); if(exptimeNS>acqtimeNS){ - lblNote->show(); - lblPeriod->setPalette(lblNote->palette()); + spinPeriod->setToolTip(errPeriodTip); + lblPeriod->setToolTip(errPeriodTip); + lblPeriod->setPalette(red); lblPeriod->setText("Acquisition Period:*"); } else { - lblNote->hide(); - lblPeriod->setPalette(lblNumFrames->palette()); + spinPeriod->setToolTip(acqPeriodTip); + lblPeriod->setToolTip(acqPeriodTip); + lblPeriod->setPalette(lblTimingMode->palette()); lblPeriod->setText("Acquisition Period:"); } @@ -582,18 +592,23 @@ void qTabMeasurement::setTimingMode(int mode){ exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value()); acqtimeNS = qDefs::getNSTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value()); if(exptimeNS>acqtimeNS) { - lblNote->show(); - lblPeriod->setPalette(lblNote->palette()); + + spinPeriod->setToolTip(errPeriodTip); + lblPeriod->setToolTip(errPeriodTip); + lblPeriod->setPalette(red); lblPeriod->setText("Acquisition Period:*"); } else { - lblNote->hide(); - lblPeriod->setPalette(lblNumFrames->palette()); + + spinPeriod->setToolTip(acqPeriodTip); + lblPeriod->setToolTip(acqPeriodTip); + lblPeriod->setPalette(lblTimingMode->palette()); lblPeriod->setText("Acquisition Period:"); } }else { - lblNote->hide(); - lblPeriod->setPalette(lblNumFrames->palette()); + spinPeriod->setToolTip(acqPeriodTip); + lblPeriod->setToolTip(acqPeriodTip); + lblPeriod->setPalette(lblTimingMode->palette()); lblPeriod->setText("Acquisition Period:"); } diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index cf6f800c5..6b98ef944 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -451,7 +451,6 @@ void qTabPlot::SetFrequency(){ void qTabPlot::EnableScanBox(bool enable,int id){ - cout<<"enable:"< Date: Mon, 6 Aug 2012 16:15:33 +0000 Subject: [PATCH 023/332] scans work as of now git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@23 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_scan.ui | 2 +- slsDetectorGui/include/qScanWidget.h | 8 +- slsDetectorGui/src/qScanWidget.cpp | 258 ++++++++++++++++++++++----- slsDetectorGui/src/qTabActions.cpp | 3 + 4 files changed, 222 insertions(+), 49 deletions(-) diff --git a/slsDetectorGui/forms/form_scan.ui b/slsDetectorGui/forms/form_scan.ui index 67e8faf06..68321732c 100644 --- a/slsDetectorGui/forms/form_scan.ui +++ b/slsDetectorGui/forms/form_scan.ui @@ -101,7 +101,7 @@ - + <nobr>Defines scan range for a constant step size.</nobr> Constant Step Size diff --git a/slsDetectorGui/include/qScanWidget.h b/slsDetectorGui/include/qScanWidget.h index 192b95e5e..2da18a6ab 100644 --- a/slsDetectorGui/include/qScanWidget.h +++ b/slsDetectorGui/include/qScanWidget.h @@ -57,6 +57,7 @@ private: QPalette red; QString customTip; QString fileTip; + QString rangeTip; /**widgets needed for diff size types*/ QButtonGroup *btnGroup; @@ -116,8 +117,13 @@ void SetParameter(); void SetPrecision(int value); /** Set number of steps + * @param int num is the number of steps * */ -void SetNSteps(); +void SetNSteps(int num); + +/** Set range for scan + * */ +void SetRangeSteps(); /** Set custom steps * returns OK if set properly diff --git a/slsDetectorGui/src/qScanWidget.cpp b/slsDetectorGui/src/qScanWidget.cpp index 93bac7d02..208eda836 100644 --- a/slsDetectorGui/src/qScanWidget.cpp +++ b/slsDetectorGui/src/qScanWidget.cpp @@ -66,6 +66,7 @@ void qScanWidget::SetupWidgetWindow(){ red.setColor(QPalette::Active,QPalette::WindowText,Qt::red); fileTip = radioFile->toolTip(); customTip = radioCustom->toolTip(); + rangeTip = radioRange->toolTip(); //layout for the size widgets stackedLayout = new QStackedLayout; @@ -79,23 +80,36 @@ void qScanWidget::SetupWidgetWindow(){ spinFrom = new QDoubleSpinBox(widgetRange); lblTo = new QLabel("to",widgetRange); spinTo = new QDoubleSpinBox(widgetRange); - lblSize = new QLabel("Size",widgetRange); + lblSize = new QLabel("step size:",widgetRange); spinSize = new QDoubleSpinBox(widgetRange); lblFrom->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); + lblFrom->setToolTip(rangeTip); spinFrom->setValue(0); + spinFrom->setToolTip(rangeTip); + spinFrom->setMaximum(1000000); lblTo->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); + lblTo->setToolTip(rangeTip); spinTo->setValue(1); + spinTo->setToolTip(rangeTip); + spinTo->setMaximum(1000000); lblSize->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); + lblSize->setToolTip(rangeTip); + lblSize->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); + lblSize->setFixedWidth(67); spinSize->setValue(1); - layoutRange->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); + spinSize->setToolTip(rangeTip); + layoutRange->addItem(new QSpacerItem(40,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); layoutRange->addWidget(lblFrom); + layoutRange->addItem(new QSpacerItem(5,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); layoutRange->addWidget(spinFrom); + layoutRange->addItem(new QSpacerItem(5,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); layoutRange->addWidget(lblTo); + layoutRange->addItem(new QSpacerItem(5,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); layoutRange->addWidget(spinTo); - layoutRange->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); + layoutRange->addItem(new QSpacerItem(30,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); layoutRange->addWidget(lblSize); layoutRange->addWidget(spinSize); - layoutRange->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); + layoutRange->addItem(new QSpacerItem(40,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); // Custom Values Layout @@ -106,13 +120,10 @@ void qScanWidget::SetupWidgetWindow(){ btnCustom = new QPushButton("Delete",widgetCustom); comboCustom->setEditable(true); comboCustom->setCompleter(false); - QDoubleValidator *validate = new QDoubleValidator(comboCustom); - comboCustom->setValidator(validate); - radioCustom->setToolTip("Measures only at specific values listed by the user.
" - "Number of entries is restricted to Number of Steps field."); - comboCustom->setToolTip("Measures only at specific values listed by the user.
" - "Number of entries is restricted to Number of Steps field."); + comboCustom->setValidator(new QDoubleValidator(comboCustom)); + comboCustom->setToolTip(customTip); btnCustom->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); + btnCustom->setToolTip("Deletes current position from list and reduces Number of Positions by 1."); layoutCustom->addItem(new QSpacerItem(160,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); layoutCustom->addWidget(comboCustom); layoutCustom->addItem(new QSpacerItem(5,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); @@ -126,9 +137,11 @@ void qScanWidget::SetupWidgetWindow(){ layoutFile->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); dispFile = new QLineEdit(widgetFile); dispFile->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed); + dispFile->setToolTip(fileTip); layoutFile->addWidget(dispFile); btnFile = new QPushButton("Browse",widgetFile); btnFile->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); + btnFile->setToolTip(fileTip); layoutFile->addWidget(btnFile); layoutFile->addItem(new QSpacerItem(50,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); @@ -157,12 +170,14 @@ void qScanWidget::Initialization(){ connect(dispParameter, SIGNAL(editingFinished()), this, SLOT(SetParameter())); //sizewidgets connect(btnGroup, SIGNAL(buttonClicked(QAbstractButton*)),this,SLOT(EnableSizeWidgets())); -// connect(radioRange, SIGNAL(toggled(bool)),this,SLOT(EnableSizeWidgets())); //numsteps - connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps())); + connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps(int))); //precision connect(spinPrecision, SIGNAL(valueChanged(int)), this, SLOT(SetPrecision(int))); //range values + connect(spinFrom, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); + connect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); + connect(spinSize, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); //custom values connect(comboCustom, SIGNAL(currentIndexChanged(int)), this, SLOT(SetCustomSteps())); connect(btnCustom, SIGNAL(clicked()), this, SLOT(DeleteCustomSteps())); @@ -179,6 +194,9 @@ void qScanWidget::EnableSizeWidgets(){ #ifdef VERBOSE cout << "Entering enable size widgets" << endl; #endif + //setting to defaults is not done here as this is called even if mode changes + //so only if its to change the size widget type, its set to default for the others + //scan is none if(!comboScript->currentIndex()){ radioCustom->setText("Specific Values"); @@ -194,15 +212,26 @@ void qScanWidget::EnableSizeWidgets(){ } else{ // Steps are enabled for all except Range step size - lblSteps->setEnabled(!radioRange->isChecked()); - spinSteps->setEnabled(!radioRange->isChecked()); + /**lblSteps->setEnabled(!radioRange->isChecked()); + spinSteps->setEnabled(!radioRange->isChecked());*/ //range values if(radioRange->isChecked()){ #ifdef VERBOSE cout << "Constant Range Values" << endl; #endif - stackedLayout->setCurrentIndex(RangeValues); - /**refresh this part*/ + radioCustom->setText("Specific Values"); + radioCustom->setPalette(normal); + radioCustom->setToolTip(customTip); + comboCustom->setToolTip(customTip); + + radioFile->setPalette(normal); + radioFile->setText("Values from File:"); + radioFile->setToolTip(fileTip); + dispFile->setToolTip(fileTip); + btnFile->setToolTip(fileTip); + + stackedLayout->setCurrentIndex(RangeValues); + SetRangeSteps(); } //custom values else if(radioCustom->isChecked()){ @@ -218,9 +247,9 @@ void qScanWidget::EnableSizeWidgets(){ //change it back as this list is what will be loaded. //also numstpes could have been changed in other modes too - disconnect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps())); + disconnect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps(int))); spinSteps ->setValue(comboCustom->count()); - connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps())); + connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps(int))); stackedLayout->setCurrentIndex(CustomValues); //only for custom steps out here because many signals go through @@ -228,9 +257,12 @@ void qScanWidget::EnableSizeWidgets(){ if(SetCustomSteps()==qDefs::OK){ char cNum[200];sprintf(cNum,"%d",actualNumSteps); char cId[5];sprintf(cId,"%d",id); - qDefs::InfoMessage(string("Scan Level ")+string(cId)+(" - ")+string(" Number of positions added from list : ")+string(cNum),"ScanWidget"); + qDefs::InfoMessage(string("Scan Level ")+string(cId)+ + string(": Specific Values

Number of positions added: ")+ + string(cNum)+string(""),"ScanWidget"); } } + //file values else{ #ifdef VERBOSE @@ -271,8 +303,10 @@ void qScanWidget::SetMode(int mode){ // If anything other than None is selected if(mode){ // Steps are enabled for all except Range step size - lblSteps->setEnabled(!radioRange->isChecked()); - spinSteps->setEnabled(!radioRange->isChecked()); + /**lblSteps->setEnabled(!radioRange->isChecked()); + spinSteps->setEnabled(!radioRange->isChecked());*/ + lblSteps->setEnabled(true); + spinSteps->setEnabled(true); // Custom Script only enables the first layout with addnl parameters etc if(mode==CustomScript){ dispScript->setEnabled(true); @@ -283,6 +317,7 @@ void qScanWidget::SetMode(int mode){ group->setEnabled(true); lblPrecision->setEnabled(true); spinPrecision->setEnabled(true); + } //set the group box widgets @@ -331,7 +366,9 @@ int qScanWidget::SetScan(int mode){ break; } - if(mode!=CustomScript){ + if((mode==CustomScript)&&((script=="")||(script=="none"))){ + return qDefs::OK; + }else{ if((mode!=myDet->getScanMode(id))&&(actualNumSteps)){ qDefs::WarningMessage("The mode could not be changed for an unknown reason.","ScanWidget"); comboScript->setCurrentIndex(myDet->getScanMode(id)); @@ -459,7 +496,7 @@ void qScanWidget::SetPrecision(int value){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void qScanWidget::SetNSteps(){ +void qScanWidget::SetNSteps(int num){ #ifdef VERBOSE cout << "Setting number of steps" << endl; @@ -469,8 +506,24 @@ void qScanWidget::SetNSteps(){ comboCustom->setMaxCount(numSteps); //check if its ok - if(radioCustom->isChecked()){ + if(radioRange->isChecked()){ + //calculate the step size and display it + if(num==1){ + disconnect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); + spinTo->setValue(spinFrom->value()); + connect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); + }else if(num>1) + num--; + double stepSize = (spinTo->value()-spinFrom->value())/num; + disconnect(spinSize,SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); + spinSize->setValue(stepSize); + connect(spinSize, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); + //set these positions + SetRangeSteps(); + }else if(radioCustom->isChecked()){ SetCustomSteps(); + }else if(radioFile->isChecked()){ + SetFileSteps(); } } @@ -479,6 +532,93 @@ void qScanWidget::SetNSteps(){ //------------------------------------------------------------------------------------------------------------------------------------------------- +void qScanWidget::SetRangeSteps(){ +#ifdef VERBOSE + cout << "Setting\tscan:" << id << "\trange\t"; +#endif + double fromVal = spinFrom->value(); + double sizeVal = spinSize->value(); + //if step size is 0, min and max should be same + if(!sizeVal){ + disconnect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); + spinTo->setValue(fromVal); + connect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); + QString tip = rangeTip + QString("

" + "Note: Increase the step size from zero to be able to change the range."); + lblSize->setToolTip(tip); + spinSize->setToolTip(tip); + lblSize->setText("step size:*"); + lblSize->setPalette(red); + }else{ + lblSize->setToolTip(rangeTip); + spinSize->setToolTip(rangeTip); + lblSize->setText("step size:"); + lblSize->setPalette(normal); + } + //if min and max is the same + if(fromVal==spinTo->value()) actualNumSteps = 0; + else actualNumSteps = (int)((spinTo->value()-fromVal)/sizeVal); + + //actualNumSteps will be negative if fromsetValue(-1*sizeVal); + connect(spinSize, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); + sizeVal = spinSize->value(); + } + //increment is required like vice versa in setNSteps + actualNumSteps++; +#ifdef VERBOSE + cout << "num pos:" << actualNumSteps << endl; +#endif + + //set the vector positions + positions.resize(actualNumSteps); + for(int i=0;isetValue(actualNumSteps); + connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps(int))); + + + //sets the scan + if(SetScan(comboScript->currentIndex())==qDefs::OK){ + char cId[5];sprintf(cId,"%d",id); + QString script = dispScript->text(); + //positions wont be loaded if its custom script + if((comboScript->currentIndex()==CustomScript)&&((script=="")||(script=="none"))){ + qDefs::InfoMessage(string("Scan Level ")+string(cId)+ + string(": Constant Step Size

" + "Positions could not be loaded as the script file path is empty."),"ScanWidget"); + }else{ + //error loading positions + if(myDet->getScanSteps(id)!=actualNumSteps){ + qDefs::WarningMessage(string("Scan Level ")+string(cId)+ + string(": Values From File

" + "The positions list was not set for an unknown reason."),"ScanWidget"); + /*LoadPositions(); + comboScript->setCurrentIndex(myDet->getScanMode(id))*/ + }else{//SUCCESS + char cNum[200];sprintf(cNum,"%d",actualNumSteps); + qDefs::InfoMessage(string("Scan Level ")+string(cId)+ + string(": Constant Step Size

Number of positions added: ")+ + string(cNum)+string(""),"ScanWidget"); + } + } + } + +} + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + int qScanWidget::SetCustomSteps(){ #ifdef VERBOSE @@ -519,18 +659,29 @@ int qScanWidget::SetCustomSteps(){ //copying the list for(int i=0;iitemText(i).toDouble(); +#ifdef VERBOSE cout<<"positions["<setScanSteps(id,actualNumSteps,positions)<currentIndex())==qDefs::OK){ - if(myDet->getScanSteps(id)!=actualNumSteps){ - qDefs::WarningMessage("The positions list was not set for an unknown reason.","ScanWidget"); - LoadPositions(); - comboScript->setCurrentIndex(myDet->getScanMode(id)); + char cId[5];sprintf(cId,"%d",id); + QString script = dispScript->text(); + //positions wont be loaded if its custom script + if((comboScript->currentIndex()==CustomScript)&&((script=="")||(script=="none"))){ + qDefs::InfoMessage(string("Scan Level ")+string(cId)+ + string(": Values From File

" + "Positions could not be loaded as the script file path is empty."),"ScanWidget"); return qDefs::FAIL; + }else{ + if(myDet->getScanSteps(id)!=actualNumSteps){ + qDefs::WarningMessage("The positions list was not set for an unknown reason.","ScanWidget"); + LoadPositions(); + comboScript->setCurrentIndex(myDet->getScanMode(id)); + return qDefs::FAIL; + } + //else success is checked in enabledsizewidgets , else it does this for every add, delete etc } } @@ -646,9 +797,9 @@ void qScanWidget::SetFileSteps(){ } } } - disconnect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps())); + disconnect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps(int))); spinSteps->setValue(actualNumSteps); - connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps())); + connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps(int))); inFile.close(); }else {//could not open file #ifdef VERBOSE @@ -664,16 +815,28 @@ void qScanWidget::SetFileSteps(){ if(set){//no error while reading file //sets the scan and positions if(SetScan(comboScript->currentIndex())==qDefs::OK){ + char cId[5];sprintf(cId,"%d",id); + QString script = dispScript->text(); radioFile->setPalette(normal); radioFile->setText("Values from File:"); radioFile->setToolTip(fileTip);dispFile->setToolTip(fileTip);btnFile->setToolTip(fileTip); - //error loading positions - if(myDet->getScanSteps(id)!=actualNumSteps){ - qDefs::WarningMessage("The positions list was not set for an unknown reason.","ScanWidget"); - }else{//SUCCESS - char cNum[200];sprintf(cNum,"%d",actualNumSteps); - char cId[5];sprintf(cId,"%d",id); - qDefs::InfoMessage(string("Scan Level ")+string(cId)+(" - ")+string(" Number of positions added from file : ")+string(cNum),"ScanWidget"); + //positions wont be loaded if its custom script + if((comboScript->currentIndex()==CustomScript)&&((script=="")||(script=="none"))){ + qDefs::InfoMessage(string("Scan Level ")+string(cId)+ + string(": Values From File

" + "Positions could not be loaded as the script file path is empty."),"ScanWidget"); + }else{ + //error loading positions + if(myDet->getScanSteps(id)!=actualNumSteps){ + qDefs::WarningMessage(string("Scan Level ")+string(cId)+ + string(": Values From File

" + "The positions list was not set for an unknown reason."),"ScanWidget"); + }else{//SUCCESS + char cNum[200];sprintf(cNum,"%d",actualNumSteps); + qDefs::InfoMessage(string("Scan Level ")+string(cId)+ + string(": Values From File

Number of positions added: ")+ + string(cNum)+string(""),"ScanWidget"); + } } } } @@ -711,7 +874,7 @@ void qScanWidget::LoadPositions(){ cout << "Loading positions" << endl; #endif disconnect(comboCustom, SIGNAL(currentIndexChanged(int)), this, SLOT(SetCustomSteps())); - disconnect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps())); + disconnect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps(int))); disconnect(btnGroup, SIGNAL(buttonClicked(QAbstractButton*)),this,SLOT(EnableSizeWidgets())); @@ -735,15 +898,14 @@ void qScanWidget::LoadPositions(){ for(int i=0;isetText("Specific Values"); radioCustom->setPalette(normal); radioCustom->setToolTip(customTip); comboCustom->setToolTip(customTip); - }else{ + }//no positions and has a mode + else if(mode){ radioCustom->setPalette(red); radioCustom->setText("Specific Values*"); QString tip = customTip + QString("

First, increase Number of Steps. " @@ -760,11 +922,13 @@ void qScanWidget::LoadPositions(){ comboCustom->setEnabled(numSteps&&mode); btnCustom->setEnabled(numSteps&&mode); - - connect(comboCustom, SIGNAL(currentIndexChanged(int)), this, SLOT(SetCustomSteps())); - connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps())); + connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps(int))); connect(btnGroup, SIGNAL(buttonClicked(QAbstractButton*)),this,SLOT(EnableSizeWidgets())); + + + //do not set the range variables because if the stepsize is by any chance 0.. + //then the number of steps should change to 1. so only set custom steps } diff --git a/slsDetectorGui/src/qTabActions.cpp b/slsDetectorGui/src/qTabActions.cpp index 7379a3b8d..59c531a4d 100644 --- a/slsDetectorGui/src/qTabActions.cpp +++ b/slsDetectorGui/src/qTabActions.cpp @@ -76,6 +76,9 @@ void qTabActions::SetupWidgetWindow(){ lblName[i] = new QLabel(QString(names[i])); btnExpand[i] = new QPushButton("+"); btnExpand[i]->setFixedSize(20,20); + QString tip = "Click on the \"+\" to Expand or \"-\" to Collapse."; + lblName[i]->setToolTip(tip); + btnExpand[i]->setToolTip(tip); group->addButton(btnExpand[i],i); //Number of positions is only for mythen or gotthard From bcb471047782877695e94e492815bfb5fb47b9a7 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 7 Aug 2012 10:19:15 +0000 Subject: [PATCH 024/332] changed such that getdata returns if not really necessary to copy git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@24 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qDrawPlot.h | 10 +- slsDetectorGui/src/qDrawPlot.cpp | 365 ++++++++++++++----------- slsDetectorGui/src/qTabMeasurement.cpp | 2 +- slsDetectorGui/src/qTabPlot.cpp | 2 +- 4 files changed, 221 insertions(+), 158 deletions(-) diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index 35068feb6..4d975071f 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -118,6 +118,10 @@ private: /** Timer to update plot */ QTimer* plot_update_timer; + /** Timer to pause getting data from client */ + QTimer* data_pause_timer; + bool data_pause_over; + /** 1D object */ SlsQt1DPlot* plot1D; @@ -217,7 +221,9 @@ private: double timerValue; /** every nth frame when to plot */ int frameFactor; - bool plotLock; + /** old data that did not get lock(for frame factor)**/ + bool oldCopy; + int oldFrameNumber; /**if frame is enabled in measurement tab */ bool isFrameEnabled; /**if trigger is enabled in measurement tab */ @@ -291,7 +297,7 @@ void StartDaq(bool start); * @param id is the id of the clone */ void CloneCloseEvent(int id); - +void UpdatePause(){data_pause_over=true;}; signals: void UpdatingPlotFinished(); diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 66ec00d22..55acabb09 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -4,20 +4,20 @@ * Created on: May 7, 2012 * Author: Ian Johnson */ -/** Qt Project Class Headers */ +// Qt Project Class Headers #include "qDrawPlot.h" #include "qCloneWidget.h" #include "slsDetector.h" -/** Project Class Headers */ +// Project Class Headers #include "slsDetector.h" #include "multiSlsDetector.h" #include "postProcessing.h" -/** Qt Include Headers */ +// Qt Include Headers #include #include #include #include -/** C++ Include Headers */ +// C++ Include Headers #include #include #include @@ -37,7 +37,7 @@ qDrawPlot::qDrawPlot(QWidget *parent,multiSlsDetector*& detector): //------------------------------------------------------------------------------------------------------------------------------------------------- qDrawPlot::~qDrawPlot(){ - /** Clear plot*/ + // Clear plot Clear1DPlot(); for(QVector::iterator h = plot1D_hists.begin();h!=plot1D_hists.end();h++) delete *h; plot1D_hists.clear(); @@ -58,9 +58,9 @@ void qDrawPlot::SetupWidgetWindow(){ stop_signal = 0; pthread_mutex_init(&last_image_complete_mutex,NULL); //gui_acquisition_thread_running = 0; - /** Default Plotting*/ + // Default Plotting plot_in_scope = 0; - /**2d*/ + //2d lastImageNumber = 0; last_plot_number = 0; @@ -68,7 +68,7 @@ void qDrawPlot::SetupWidgetWindow(){ lastImageArray = 0; image_data = 0; - /**1d*/ + //1d nHists = 0; histNBins = 0; histXAxis = 0; @@ -79,18 +79,20 @@ void qDrawPlot::SetupWidgetWindow(){ XYRangeChanged = false; timerValue = PLOT_TIMER_MS; frameFactor=0; - plotLock = false; + oldCopy = false; + oldFrameNumber = 0; + data_pause_over = true;//to get the first image isFrameEnabled = false; isTriggerEnabled = false; - /** This is so that it initially stop and plots */ + // This is so that it initially stop and plots running = 1; for(int i=0;isetLayout(layout); @@ -100,9 +102,10 @@ void qDrawPlot::SetupWidgetWindow(){ boxPlot->setFont(QFont("Sans Serif",11,QFont::Normal)); plot_update_timer = new QTimer(this); connect(plot_update_timer, SIGNAL(timeout()), this, SLOT(UpdatePlot())); + data_pause_timer = new QTimer(this); + connect(data_pause_timer, SIGNAL(timeout()), this, SLOT(UpdatePause())); - - /** Default titles- only for the initial picture*/ + // Default titles- only for the initial picture histXAxisTitle="Channel Number"; histYAxisTitle="Counts"; @@ -118,7 +121,7 @@ void qDrawPlot::SetupWidgetWindow(){ - /** setting default plot titles and settings*/ + // setting default plot titles and settings plot1D = new SlsQt1DPlot(boxPlot); plot1D->setFont(QFont("Sans Serif",9,QFont::Normal)); plot1D->SetXTitle(histXAxisTitle.toAscii().constData()); @@ -163,11 +166,15 @@ void qDrawPlot::StartStopDaqToggle(bool stop_if_running){ running=!running; }else if(!stop_if_running){ //then start - /**Do the following only once before each n measurements */ - /** Reset Current Measurement */ + //Do the following only once before each n measurements + // Reset Current Measurement currentMeasurement = 0; emit SetCurrentMeasurementSignal(currentMeasurement); - /** Number of Exposures */ + + //to get the first image + data_pause_over = true; + + // Number of Exposures int numFrames = (isFrameEnabled)*((int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1)); int numTriggers = (isTriggerEnabled)*((int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1)); @@ -176,10 +183,10 @@ void qDrawPlot::StartStopDaqToggle(bool stop_if_running){ number_of_exposures= numFrames * numTriggers; cout<<"\tNumber of Exposures:"<setTimer(slsDetectorDefs::ACQUISITION_TIME,-1))*1E-9); cout<<"\tExposure Time:"<setTimer(slsDetectorDefs::FRAME_PERIOD,-1))*1E-9); cout<<"\tAcquisition Period:"<registerDataCallback(&(GetDataCallBack),this); - /** Start acquiring data from server */ + // Start acquiring data from server if(!firstTime) pthread_join(gui_acquisition_thread,NULL);//wait until he's finished, ie. exits pthread_create(&gui_acquisition_thread, NULL,DataStartAcquireThread, (void*) this); firstTime = false; - /** This is set here and later reset to zero when all the plotting is done - * This is manually done instead of keeping track of thread because - * this thread returns immediately after executing the acquire command*/ + // This is set here and later reset to zero when all the plotting is done + // This is manually done instead of keeping track of thread because + // this thread returns immediately after executing the acquire command gui_acquisition_thread_running=1; cout<<"Started acquiring threaddd:"<progressIndex; - + //not frame factor + if(!frameFactor){ + //if the time is not over, RETURN + if(!data_pause_over){ + //lastImageNumber= currentFrame+1; + currentFrame++; + return 0; + } + data_pause_over=false; + data_pause_timer->start((int)(PLOT_TIMER_MS/2)); + }//if frame factor or last frame of last measurement... for all other factors, RETURN + else{ + if(((currentFrame+1==number_of_exposures)&&(currentMeasurement+1==number_of_measurements)) + ||(!((currentFrame)%frameFactor))) + oldCopy = false;//if this works, then we forget old data + else{ + //lastImageNumber= currentFrame+1; + currentFrame++; + progress=(int)data->progressIndex; + //if theres an old copy, try to get lock again + if(oldCopy){ +#ifdef VERBOSE + cout<<"Copying old data: "<0;i--) + memcpy(histYAxis[i],yvalues[i-1],nPixelsX*sizeof(double)); + memcpy(histYAxis[0],yvalues[0],nPixelsX*sizeof(double)); + }//2d + else{ + // Titles + sprintf(temp_title,"Image Number %d",oldFrameNumber); + imageTitle = temp_title; + // copy data + //memcpy(lastImageArray,image_data,nPixelsX*nPixelsY*sizeof(double)); + } + pthread_mutex_unlock(&(last_image_complete_mutex)); + } + } + return 0; + } + } + //if plot disabled, RETURN if(!plotEnable) { - lastImageNumber= currentFrame+1; + progress=(int)data->progressIndex; + //lastImageNumber= currentFrame+1; currentFrame++; return 0; } - - /** Get data from client */ - /**1d*/ - if(plot_in_scope==1){ - /** Persistency */ - if(currentPersistency < persistency)currentPersistency++; - else currentPersistency=persistency; - for(int i=currentPersistency;i>0;i--) - memcpy(yvalues[i],yvalues[i-1],nPixelsX*sizeof(double)); - nHists = currentPersistency+1; - memcpy(yvalues[0],data->values,nPixelsX*sizeof(double)); - //for(int i=0;i<(int)nPixelsX;i++) *(yvalues[0]+i) = (double)*(data->values+i); - } - /**2d*/ - else{ - for(unsigned int px=0;pxprogressIndex; if((currentFrame)<(number_of_exposures)){ #ifdef VERYVERBOSE - cout<<"Reading in image: "<0;i--) - memcpy(histYAxis[i],histYAxis[i-1],nPixelsX*sizeof(double)); - memcpy(histYAxis[0],yvalues[0],nPixelsX*sizeof(double)); - } - /**2d*/ - else{ - sprintf(temp_title,"Image Number %d",currentFrame); imageTitle = temp_title; - memcpy(lastImageArray,image_data,nPixelsX*nPixelsY*sizeof(double)); - } - pthread_mutex_unlock(&(last_image_complete_mutex)); + //1d + if(plot_in_scope==1){ + // Titles + sprintf(temp_title,"Frame %d",currentFrame); histTitle[0] = temp_title; + // Persistency + if(currentPersistency < persistency)currentPersistency++; + else currentPersistency=persistency; + nHists = currentPersistency+1; + // copy data + //memcpy(histXAxis, xvalues,nPixelsX*sizeof(double)); + for(int i=currentPersistency;i>0;i--) + memcpy(histYAxis[i],histYAxis[i-1],nPixelsX*sizeof(double)); + memcpy(histYAxis[0],data->values,nPixelsX*sizeof(double)); + //for(int i=0;i<(int)nPixelsX;i++) *(yvalues[0]+i) = (double)*(data->values+i); + } + //2d + else{ + // Titles + sprintf(temp_title,"Image Number %d",currentFrame); + imageTitle = temp_title; + // manufacture data for now + for(unsigned int px=0;pxvalues,nPixelsX*nPixelsY*sizeof(double)); + } + pthread_mutex_unlock(&(last_image_complete_mutex)); + }//copies old data only if its frame factor + else if(frameFactor){ + oldCopy = true; + oldFrameNumber = currentFrame; + //1D + if(plot_in_scope==1){ + // Persistency + if(currentPersistency < persistency)currentPersistency++; + else currentPersistency=persistency; + nHists = currentPersistency+1; + // copy old data + for(int i=currentPersistency;i>0;i--) + memcpy(yvalues[i],yvalues[i-1],nPixelsX*sizeof(double)); + nHists = currentPersistency+1; + memcpy(yvalues[0],data->values,nPixelsX*sizeof(double)); + }//2D + else{ + // copy old data + //memcpy(image_data,data->values,nPixelsX*nPixelsY*sizeof(double)); } } currentFrame++; } - /** To make sure plotting locks parameters until it has plotted */ - if(frameFactor){ - if(currentFrame==number_of_exposures) plotLock = true; - else if(!((currentFrame-1)%frameFactor)) plotLock = true; - } } #ifdef VERYVERBOSE cout<<"Exiting GetData function"<stop(); - /** only if no plot isnt enabled */ + // only if no plot isnt enabled if(plotEnable){ - /** It doesnt go in here only if nth frame plotting in on and its not the nth frame*/ - if(canPlot){ - LockLastImageArray(); - /**1-d plot stuff */ - if(lastImageNumber){ - if(histNBins){ + LockLastImageArray(); + //1-d plot stuff + if(lastImageNumber){ + if(histNBins){ #ifdef VERYVERBOSE - cout<<"Last Image Number: "<SetXTitle(histXAxisTitle.toAscii().constData()); - plot1D->SetYTitle(histYAxisTitle.toAscii().constData()); - for(int hist_num=0;hist_num<(int)nHists;hist_num++){ - SlsQtH1D* h; - if(hist_num+1>plot1D_hists.size()){ - plot1D_hists.append(h=new SlsQtH1D("1d plot",histNBins,histXAxis,GetHistYAxis(hist_num))); - h->SetLineColor(hist_num+1); - }else{ - h=plot1D_hists.at(hist_num); - h->SetData(histNBins,histXAxis,GetHistYAxis(hist_num)); - } - h->setTitle(GetHistTitle(hist_num)); - h->Attach(plot1D); - + Clear1DPlot(); + plot1D->SetXTitle(histXAxisTitle.toAscii().constData()); + plot1D->SetYTitle(histYAxisTitle.toAscii().constData()); + for(int hist_num=0;hist_num<(int)nHists;hist_num++){ + SlsQtH1D* h; + if(hist_num+1>plot1D_hists.size()){ + plot1D_hists.append(h=new SlsQtH1D("1d plot",histNBins,histXAxis,GetHistYAxis(hist_num))); + h->SetLineColor(hist_num+1); + }else{ + h=plot1D_hists.at(hist_num); + h->SetData(histNBins,histXAxis,GetHistYAxis(hist_num)); } - /** update range if required */ - if(XYRangeChanged){ - if(!IsXYRange[qDefs::XMINIMUM]) - XYRangeValues[qDefs::XMINIMUM]= plot1D->GetXMinimum(); - if(!IsXYRange[qDefs::XMAXIMUM]) - XYRangeValues[qDefs::XMAXIMUM]= plot1D->GetXMaximum(); - if(!IsXYRange[qDefs::YMINIMUM]) - XYRangeValues[qDefs::YMINIMUM]= plot1D->GetYMinimum(); - if(!IsXYRange[qDefs::YMAXIMUM]) - XYRangeValues[qDefs::YMAXIMUM]= plot1D->GetYMaximum(); + h->setTitle(GetHistTitle(hist_num)); + h->Attach(plot1D); - plot1D->SetXMinMax(XYRangeValues[qDefs::XMINIMUM],XYRangeValues[qDefs::XMAXIMUM]); - plot1D->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]); - - XYRangeChanged = false; - } - plotLock = false; } - } - /**2-d plot stuff */ - if(lastImageArray){ - if(lastImageNumber&&last_plot_number!=(int)lastImageNumber && //there is a new plot - nPixelsX>0&&nPixelsY>0){ - plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,-0.5,nPixelsY-0.5,lastImageArray); - plot2D->setTitle(GetImageTitle()); - plot2D->SetXTitle(imageXAxisTitle); - plot2D->SetYTitle(imageYAxisTitle); - plot2D->SetZTitle(imageZAxisTitle); - plot2D->UpdateNKeepSetRangeIfSet(); //this will keep a "set" z range, and call Plot()->Update(); - } - /** update range if required */ + // update range if required if(XYRangeChanged){ if(!IsXYRange[qDefs::XMINIMUM]) - XYRangeValues[qDefs::XMINIMUM]= plot2D->GetPlot()->GetXMinimum(); + XYRangeValues[qDefs::XMINIMUM]= plot1D->GetXMinimum(); if(!IsXYRange[qDefs::XMAXIMUM]) - XYRangeValues[qDefs::XMAXIMUM]= plot2D->GetPlot()->GetXMaximum(); + XYRangeValues[qDefs::XMAXIMUM]= plot1D->GetXMaximum(); if(!IsXYRange[qDefs::YMINIMUM]) - XYRangeValues[qDefs::YMINIMUM]= plot2D->GetPlot()->GetYMinimum(); + XYRangeValues[qDefs::YMINIMUM]= plot1D->GetYMinimum(); if(!IsXYRange[qDefs::YMAXIMUM]) - XYRangeValues[qDefs::YMAXIMUM]= plot2D->GetPlot()->GetYMaximum(); + XYRangeValues[qDefs::YMAXIMUM]= plot1D->GetYMaximum(); - plot2D->GetPlot()->SetXMinMax(XYRangeValues[qDefs::XMINIMUM],XYRangeValues[qDefs::XMAXIMUM]); - plot2D->GetPlot()->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]); + plot1D->SetXMinMax(XYRangeValues[qDefs::XMINIMUM],XYRangeValues[qDefs::XMAXIMUM]); + plot1D->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]); XYRangeChanged = false; } - plotLock = false; + } + } + //2-d plot stuff + if(lastImageArray){ + if(lastImageNumber&&last_plot_number!=(int)lastImageNumber && //there is a new plot + nPixelsX>0&&nPixelsY>0){ + plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,-0.5,nPixelsY-0.5,lastImageArray); + plot2D->setTitle(GetImageTitle()); + plot2D->SetXTitle(imageXAxisTitle); + plot2D->SetYTitle(imageYAxisTitle); + plot2D->SetZTitle(imageZAxisTitle); + plot2D->UpdateNKeepSetRangeIfSet(); //this will keep a "set" z range, and call Plot()->Update(); + } + // update range if required + if(XYRangeChanged){ + if(!IsXYRange[qDefs::XMINIMUM]) + XYRangeValues[qDefs::XMINIMUM]= plot2D->GetPlot()->GetXMinimum(); + if(!IsXYRange[qDefs::XMAXIMUM]) + XYRangeValues[qDefs::XMAXIMUM]= plot2D->GetPlot()->GetXMaximum(); + if(!IsXYRange[qDefs::YMINIMUM]) + XYRangeValues[qDefs::YMINIMUM]= plot2D->GetPlot()->GetYMinimum(); + if(!IsXYRange[qDefs::YMAXIMUM]) + XYRangeValues[qDefs::YMAXIMUM]= plot2D->GetPlot()->GetYMaximum(); + + plot2D->GetPlot()->SetXMinMax(XYRangeValues[qDefs::XMINIMUM],XYRangeValues[qDefs::XMAXIMUM]); + plot2D->GetPlot()->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]); + + XYRangeChanged = false; } } } last_plot_number=lastImageNumber; if(plotEnable) UnlockLastImageArray(); - /** Measurement not over, continue*/ + // Measurement not over, continue if(number_of_exposures!=currentFrame){//las plot number? - /**if the interval is a timer and not nth frame **/ + //if the interval is a timer and not nth frame * if(!frameFactor) plot_update_timer->start((int)timerValue); else plot_update_timer->start((int)PLOT_TIMER_MS); } - /** if a measurement is over */ + // if a measurement is over else{ currentMeasurement++; - /** if all the measurements are over */ + // if all the measurements are over if(currentMeasurement==number_of_measurements){ - plotLock = false; StartStopDaqToggle(true); emit UpdatingPlotFinished(); - }/** To start the next measurement*/ + }// To start the next measurement else{ - plotLock = false; emit SetCurrentMeasurementSignal(currentMeasurement); StopDaqForGui(); StartDaq(true); @@ -521,15 +578,15 @@ void qDrawPlot::ClonePlot(){ found=true; break; } - /** no space for more clone widget references*/ + // no space for more clone widget references if(!found){ cout<<"Too many clones"<title(),(int)plot_in_scope,plot1D,plot2D,myDet->getFilePath()); if(plot_in_scope==1){ plot1D = new SlsQt1DPlot(boxPlot); @@ -551,14 +608,14 @@ void qDrawPlot::ClonePlot(){ setMinimumHeight(preheight); resize(width(),preheight); - /** update the actual plot only if running, else it doesnt know when its over*/ + // update the actual plot only if running, else it doesnt know when its over if(running) UpdatePlot(); connect(this, SIGNAL(InterpolateSignal(bool)), plot2D, SIGNAL(InterpolateSignal(bool))); connect(this, SIGNAL(ContourSignal(bool)), plot2D, SIGNAL(ContourSignal(bool))); connect(this, SIGNAL(LogzSignal(bool)), plot2D, SLOT(SetZScaleToLog(bool))); winClone[i]->show(); - /** to remember which all clone widgets were closed*/ + // to remember which all clone widgets were closed connect(winClone[i], SIGNAL(CloneClosedSignal(int)),this, SLOT(CloneCloseEvent(int))); } @@ -583,12 +640,12 @@ void qDrawPlot::CloneCloseEvent(int id){ //------------------------------------------------------------------------------------------------------------------------------------------------- void qDrawPlot::SavePlot(){ - /** render image */ + // render image QImage savedImage(size().width(),size().height(),QImage::Format_RGB32); QPainter painter(&savedImage); render(&painter); - /** save image*/ + // save image QString fName = QString(myDet->getFilePath().c_str())+"/Image.png"; fName = QFileDialog::getSaveFileName(0,tr("Save Image"),fName,tr("PNG Files (*.png);;XPM Files(*.xpm);;JPEG Files(*.jpg)"),0,QFileDialog::ShowDirsOnly); @@ -618,8 +675,8 @@ void qDrawPlot::EnablePlot(bool enable){ cout<<"Plotting set to:"<stopAcquisition(); //btnStartStop->setStyleSheet("color:green"); diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index 6b98ef944..97f138418 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -422,7 +422,7 @@ void qTabPlot::SetFrequency(){ break; case 1: acqPeriodMS = (myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,-1)*(1E-6)); - /** gets the acq period * number of frames*/ + /** gets the acq period * number of nth frames*/ timeMS = (spinNthFrame->value())*acqPeriodMS; /** To make sure the period between plotting is not less than minimum plot timer in ms*/ if(timeMS Date: Tue, 7 Aug 2012 12:20:50 +0000 Subject: [PATCH 025/332] included checkbox for enable file write git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@25 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_measurement.ui | 21 +++++++++----- slsDetectorGui/forms/form_tab_plot.ui | 24 +++------------- slsDetectorGui/include/qDrawPlot.h | 5 +++- slsDetectorGui/include/qTabMeasurement.h | 4 +++ .../slsDetectorPlotting/include/SlsQt1DPlot.h | 5 ++++ slsDetectorGui/src/qDrawPlot.cpp | 2 ++ slsDetectorGui/src/qTabMeasurement.cpp | 28 ++++++++++++++----- slsDetectorGui/src/qTabPlot.cpp | 5 ++-- 8 files changed, 57 insertions(+), 37 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_measurement.ui b/slsDetectorGui/forms/form_tab_measurement.ui index eb248c158..ea826ebb5 100644 --- a/slsDetectorGui/forms/form_tab_measurement.ui +++ b/slsDetectorGui/forms/form_tab_measurement.ui @@ -808,13 +808,6 @@
- - - - File Name: - - - @@ -874,6 +867,20 @@ + + + + <nobr>Sets output file name prefix</nobr><br> +<nobr>Check the box to enable write to file. </nobr> + + + File Name: + + + true + + + diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index 8925ef5f2..e26d249ef 100644 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -196,7 +196,7 @@ 10 20 - 356 + 350 26 @@ -218,23 +218,7 @@ - - - true - - - - 0 - 0 - - - - Line - - - - - + true @@ -259,7 +243,7 @@ - 150 + 170 10 @@ -270,7 +254,7 @@ - 118 + 145 20 126 23 diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index 4d975071f..59d7ea7b3 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -201,6 +201,8 @@ private: int progress; /**If plot is enabled from plot tab*/ bool plotEnable; + /**If plot is dotted */ + bool plotDotted; /**if an acquisition is running, so as not to refresh tab @@ -282,7 +284,8 @@ void CloseClones(); void SavePlot(); /** Sets persistency from plot tab */ void SetPersistency(int val); - +/** sets style of plot to dotted */ +void SetDottedPlot(bool enable){plotDotted = enable;}; private slots: diff --git a/slsDetectorGui/include/qTabMeasurement.h b/slsDetectorGui/include/qTabMeasurement.h index 7cd823947..e2322c31a 100644 --- a/slsDetectorGui/include/qTabMeasurement.h +++ b/slsDetectorGui/include/qTabMeasurement.h @@ -158,6 +158,10 @@ void setNumProbes(int val); /** Update progress*/ void UpdateProgress(); +/** Enable write to file */ +void EnableFileWrite(bool enable); + + signals: void StartSignal(); diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h index ffd7b65c5..c1af10d47 100644 --- a/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h @@ -8,6 +8,8 @@ * DisableZoom, * SetXMinMax,SetYMinMax, * GetXMinimum,GetXMaximum,GetYMinimum,GetYMaximum} + * 07.08.2012:{function to change lines, points etc } + * SetDotStyle * */ #ifndef SLSQT1DPLOT_H @@ -60,6 +62,9 @@ class SlsQtH1D:public QwtPlotCurve{ SlsQtH1D* Add(double v); + /** Added by Dhanya to change style of graph*/ + void SetDotStyle(bool enable){if(enable) setStyle(QwtPlotCurve::Dots); else setStyle(QwtPlotCurve::Lines);}; + /**---*/ private: int ndata; diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 55acabb09..ea7ee7f14 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -76,6 +76,7 @@ void qDrawPlot::SetupWidgetWindow(){ currentPersistency = 0; progress = 0; plotEnable=true; + plotDotted = false; XYRangeChanged = false; timerValue = PLOT_TIMER_MS; frameFactor=0; @@ -483,6 +484,7 @@ void qDrawPlot::UpdatePlot(){ }else{ h=plot1D_hists.at(hist_num); h->SetData(histNBins,histXAxis,GetHistYAxis(hist_num)); + h->SetDotStyle(plotDotted); } h->setTitle(GetHistTitle(hist_num)); h->Attach(plot1D); diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 1e2f73dcb..151d2c4f5 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -78,6 +78,10 @@ void qTabMeasurement::SetupWidgetWindow(){ /** timing mode*/ SetupTimingMode(); + + /**file write enabled/disabled*/ + myDet->enableWriteToFile(true); + //check if file enabled } @@ -171,17 +175,19 @@ void qTabMeasurement::Initialization(int timingChange){ /** These signals are connected only at start up. The others are reinitialized when changing timing mode*/ if(!timingChange){ /** Number of Measurements**/ - connect(spinNumMeasurements,SIGNAL(valueChanged(int)), this, SLOT(setNumMeasurements(int))); + connect(spinNumMeasurements,SIGNAL(valueChanged(int)), this, SLOT(setNumMeasurements(int))); /** File Name**/ - connect(dispFileName,SIGNAL(textChanged(const QString&)), this, SLOT(setFileName(const QString&))); + connect(dispFileName, SIGNAL(textChanged(const QString&)),this, SLOT(setFileName(const QString&))); /** File Index**/ - connect(spinIndex,SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int))); + connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int))); /** Start/Stop Acquisition**/ - connect(btnStartStop,SIGNAL(clicked()), this, SLOT(startStopAcquisition())); + connect(btnStartStop, SIGNAL(clicked()), this, SLOT(startStopAcquisition())); /** Timing Mode **/ - connect(comboTimingMode,SIGNAL(currentIndexChanged(int)), this, SLOT(setTimingMode(int)));// - - connect(progressTimer, SIGNAL(timeout()), this, SLOT(UpdateProgress())); + connect(comboTimingMode, SIGNAL(currentIndexChanged(int)), this, SLOT(setTimingMode(int)));// + /** progress bar */ + connect(progressTimer, SIGNAL(timeout()), this, SLOT(UpdateProgress())); + /** enable write to file */ + connect(chkFile, SIGNAL(toggled(bool)), this, SLOT(EnableFileWrite(bool))); } /** Number of Frames**/ connect(spinNumFrames,SIGNAL(valueChanged(int)), this, SLOT(setNumFrames(int))); @@ -660,6 +666,14 @@ void qTabMeasurement::setTimingMode(int mode){ return; } +void qTabMeasurement::EnableFileWrite(bool enable){ +#ifdef VERBOSE + cout << "Enable File Write:" << enable << endl; +#endif + myDet->enableWriteToFile(enable); + dispFileName->setEnabled(enable); + if(enable) setFileName(dispFileName->text()); +}; //------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index 97f138418..0719ef2c6 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -167,8 +167,9 @@ void qTabPlot::Initialization(){ connect(btnClone, SIGNAL(clicked()),myPlot, SLOT(ClonePlot())); connect(btnCloseClones, SIGNAL(clicked()),myPlot, SLOT(CloseClones())); /** 1D Plot box*/ - connect(chkSuperimpose, SIGNAL(toggled(bool)),this, SLOT(EnablePersistency(bool))); - connect(spinPersistency,SIGNAL(valueChanged(int)),myPlot,SLOT(SetPersistency(int))); + connect(chkSuperimpose, SIGNAL(toggled(bool)), this, SLOT(EnablePersistency(bool))); + connect(spinPersistency,SIGNAL(valueChanged(int)), myPlot,SLOT(SetPersistency(int))); + connect(chkPoints, SIGNAL(toggled(bool)), myPlot, SLOT(SetDottedPlot(bool))); /** 2D Plot box*/ connect(chkInterpolate, SIGNAL(toggled(bool)),myPlot, SIGNAL(InterpolateSignal(bool))); connect(chkContour, SIGNAL(toggled(bool)),myPlot, SIGNAL(ContourSignal(bool))); From a47d0a57f61a74535b89e20916539c806150708b Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 7 Aug 2012 19:11:54 +0000 Subject: [PATCH 026/332] finished getting dacs and adcs..need to set it git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@26 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qTabDeveloper.h | 61 ++++++- slsDetectorGui/slsDetectorGui.pro | 2 +- slsDetectorGui/src/qDrawPlot.cpp | 31 ++-- slsDetectorGui/src/qTabDeveloper.cpp | 212 ++++++++++++++++++++++++- slsDetectorGui/src/qTabMeasurement.cpp | 194 +++++++++++----------- slsDetectorGui/src/qTabPlot.cpp | 3 + slsDetectorGui/src/qTabSettings.cpp | 54 +++---- 7 files changed, 404 insertions(+), 153 deletions(-) diff --git a/slsDetectorGui/include/qTabDeveloper.h b/slsDetectorGui/include/qTabDeveloper.h index 7b83e523e..ff340dd72 100644 --- a/slsDetectorGui/include/qTabDeveloper.h +++ b/slsDetectorGui/include/qTabDeveloper.h @@ -8,15 +8,27 @@ #ifndef QTABDEVELOPER_H_ #define QTABDEVELOPER_H_ -/** Form Header */ -#include "ui_form_tab_developer.h" /** Project Class Headers */ class multiSlsDetector; +#include "sls_detector_defs.h" +/** Qt Include Headers */ +#include +#include +#include +#include +#include +#include +#include +/** C++ Include Headers */ +#include +#include +using namespace std; + /** *@short sets up the Developer parameters */ -class qTabDeveloper:public QWidget, private Ui::TabDeveloperObject{ +class qTabDeveloper:public QWidget{ Q_OBJECT public: @@ -37,6 +49,29 @@ public: private: /** The sls detector object */ multiSlsDetector *myDet; + /** detector type */ + slsDetectorDefs::detectorType detType; + /**number of dac widgets*/ + static int NUM_DAC_WIDGETS; + /**number of adc widgets*/ + static int NUM_ADC_WIDGETS; + + static const int ADC_TIMEOUT = 5000; + + vectordacNames; + vectoradcNames; + + + /**widgets needed*/ + QGridLayout *layout; + QScrollArea *scroll; + QGroupBox *boxDacs; + QGroupBox *boxAdcs; + QLabel *lblDacs[20]; + QLabel *lblAdcs[20]; + QDoubleSpinBox *spinDacs[20]; + QDoubleSpinBox *spinAdcs[20]; + QTimer *adcTimer; /** Sets up the widget */ @@ -46,6 +81,26 @@ private: */ void Initialization(); + /** Sets up the DAC Widgets + */ + void CreateDACWidgets(); + + /** Sets up the ADC Widgets + */ + void CreateADCWidgets(); + + /** Gets the sls index to set/get dac/adc + * @param index is the gui dac/adc index + * returns the sls index + */ + slsDetectorDefs::dacIndex getSLSIndex(int index); + + + +private slots: +/** Refreshes the adcs + */ +void RefreshAdcs(); }; diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index 13a7327ed..e0fa1207d 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -99,7 +99,7 @@ FORMS = \ forms/form_tab_advanced.ui\ forms/form_tab_settings.ui\ forms/form_tab_debugging.ui\ - forms/form_tab_developer.ui\ +# forms/form_tab_developer.ui\ # forms/form_tab_messages.ui forms/form_action.ui\ forms/form_scan.ui diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index ea7ee7f14..d5e07632b 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -484,26 +484,19 @@ void qDrawPlot::UpdatePlot(){ }else{ h=plot1D_hists.at(hist_num); h->SetData(histNBins,histXAxis,GetHistYAxis(hist_num)); - h->SetDotStyle(plotDotted); } + h->SetDotStyle(plotDotted); h->setTitle(GetHistTitle(hist_num)); h->Attach(plot1D); - } // update range if required if(XYRangeChanged){ - if(!IsXYRange[qDefs::XMINIMUM]) - XYRangeValues[qDefs::XMINIMUM]= plot1D->GetXMinimum(); - if(!IsXYRange[qDefs::XMAXIMUM]) - XYRangeValues[qDefs::XMAXIMUM]= plot1D->GetXMaximum(); - if(!IsXYRange[qDefs::YMINIMUM]) - XYRangeValues[qDefs::YMINIMUM]= plot1D->GetYMinimum(); - if(!IsXYRange[qDefs::YMAXIMUM]) - XYRangeValues[qDefs::YMAXIMUM]= plot1D->GetYMaximum(); - + if(!IsXYRange[qDefs::XMINIMUM]) XYRangeValues[qDefs::XMINIMUM]= plot1D->GetXMinimum(); + if(!IsXYRange[qDefs::XMAXIMUM]) XYRangeValues[qDefs::XMAXIMUM]= plot1D->GetXMaximum(); + if(!IsXYRange[qDefs::YMINIMUM]) XYRangeValues[qDefs::YMINIMUM]= plot1D->GetYMinimum(); + if(!IsXYRange[qDefs::YMAXIMUM]) XYRangeValues[qDefs::YMAXIMUM]= plot1D->GetYMaximum(); plot1D->SetXMinMax(XYRangeValues[qDefs::XMINIMUM],XYRangeValues[qDefs::XMAXIMUM]); plot1D->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]); - XYRangeChanged = false; } } @@ -521,18 +514,12 @@ void qDrawPlot::UpdatePlot(){ } // update range if required if(XYRangeChanged){ - if(!IsXYRange[qDefs::XMINIMUM]) - XYRangeValues[qDefs::XMINIMUM]= plot2D->GetPlot()->GetXMinimum(); - if(!IsXYRange[qDefs::XMAXIMUM]) - XYRangeValues[qDefs::XMAXIMUM]= plot2D->GetPlot()->GetXMaximum(); - if(!IsXYRange[qDefs::YMINIMUM]) - XYRangeValues[qDefs::YMINIMUM]= plot2D->GetPlot()->GetYMinimum(); - if(!IsXYRange[qDefs::YMAXIMUM]) - XYRangeValues[qDefs::YMAXIMUM]= plot2D->GetPlot()->GetYMaximum(); - + if(!IsXYRange[qDefs::XMINIMUM]) XYRangeValues[qDefs::XMINIMUM]= plot2D->GetPlot()->GetXMinimum(); + if(!IsXYRange[qDefs::XMAXIMUM]) XYRangeValues[qDefs::XMAXIMUM]= plot2D->GetPlot()->GetXMaximum(); + if(!IsXYRange[qDefs::YMINIMUM]) XYRangeValues[qDefs::YMINIMUM]= plot2D->GetPlot()->GetYMinimum(); + if(!IsXYRange[qDefs::YMAXIMUM]) XYRangeValues[qDefs::YMAXIMUM]= plot2D->GetPlot()->GetYMaximum(); plot2D->GetPlot()->SetXMinMax(XYRangeValues[qDefs::XMINIMUM],XYRangeValues[qDefs::XMAXIMUM]); plot2D->GetPlot()->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]); - XYRangeChanged = false; } } diff --git a/slsDetectorGui/src/qTabDeveloper.cpp b/slsDetectorGui/src/qTabDeveloper.cpp index c11f9c537..28963993f 100644 --- a/slsDetectorGui/src/qTabDeveloper.cpp +++ b/slsDetectorGui/src/qTabDeveloper.cpp @@ -6,24 +6,33 @@ */ #include "qTabDeveloper.h" #include "qDefs.h" -/** Project Class Headers */ +//Project Class Headers #include "slsDetector.h" #include "multiSlsDetector.h" -/** C++ Include Headers */ +//Qt Include Headers +#include +#include +#include +//C++ Include Headers #include using namespace std; +//------------------------------------------------------------------------------------------------------------------------------------------------- +int qTabDeveloper::NUM_DAC_WIDGETS(0); +int qTabDeveloper::NUM_ADC_WIDGETS(0); + +//------------------------------------------------------------------------------------------------------------------------------------------------- qTabDeveloper::qTabDeveloper(QWidget *parent,multiSlsDetector*& detector):QWidget(parent),myDet(detector){ - setupUi(this); SetupWidgetWindow(); Initialization(); } +//------------------------------------------------------------------------------------------------------------------------------------------------- qTabDeveloper::~qTabDeveloper(){ @@ -31,21 +40,218 @@ qTabDeveloper::~qTabDeveloper(){ } +//------------------------------------------------------------------------------------------------------------------------------------------------- void qTabDeveloper::SetupWidgetWindow(){ + //Detector Type + detType=myDet->getDetectorsType(); + + //the nu + switch(detType){ + case slsDetectorDefs::MYTHEN: + NUM_DAC_WIDGETS = 6; + NUM_ADC_WIDGETS = 0; + dacNames.push_back("v Trimbit:"); + dacNames.push_back("v Threshold:"); + dacNames.push_back("v Shaper1:"); + dacNames.push_back("v Shaper2:"); + dacNames.push_back("v Calibration:"); + dacNames.push_back("v Preamp:"); + break; + case slsDetectorDefs::EIGER: + NUM_DAC_WIDGETS = 16; + NUM_ADC_WIDGETS = 0; + break; + case slsDetectorDefs::GOTTHARD: + NUM_DAC_WIDGETS = 8; + NUM_ADC_WIDGETS = 2; + dacNames.push_back("Reference Voltage:"); + dacNames.push_back("Cascade n Voltage:"); + dacNames.push_back("Cascade p Voltage:"); + dacNames.push_back("Comp. Output Voltage:"); + dacNames.push_back("Cascade out Voltage:"); + dacNames.push_back("Comp. Input Voltage:"); + dacNames.push_back("Comp. Ref Voltage:"); + dacNames.push_back("Base Test Current:"); + + adcNames.push_back("Temperature ADC:"); + adcNames.push_back("Temperature FPGA:"); + + break; + default: + qDefs::ErrorMessage(string("Unknown detector type:")+myDet->slsDetectorBase::getDetectorType(detType),"Developer"); + exit(-1); + break; + } + + + //layout + setFixedWidth(765); + setFixedHeight(50+(NUM_DAC_WIDGETS/2)*35); + //setHeight(340); + scroll = new QScrollArea; + scroll->setFrameShape(QFrame::NoFrame); + scroll->setWidget(this); + scroll->setWidgetResizable(true); + + layout = new QGridLayout(scroll); + layout->setContentsMargins(20,10,10,5); + setLayout(layout); + + //dacs + boxDacs = new QGroupBox("Dacs",this); + boxDacs->setFixedHeight(25+(NUM_DAC_WIDGETS/2)*35); + layout->addWidget(boxDacs,0,0); + CreateDACWidgets(); + //adcs + if((detType==slsDetectorDefs::GOTTHARD)||(detType==slsDetectorDefs::AGIPD)){ + setFixedHeight((50+(NUM_DAC_WIDGETS/2)*35)+(50+(NUM_ADC_WIDGETS/2)*35)); + boxAdcs = new QGroupBox("ADCs",this); + boxAdcs->setFixedHeight(25+(NUM_ADC_WIDGETS/2)*35); + layout->addWidget(boxAdcs,1,0); + CreateADCWidgets(); + //to make the adcs at the bottom most + int diff = 340-height(); + setFixedHeight(340); + layout->setVerticalSpacing(diff); + //timer to check adcs + adcTimer = new QTimer(this); + } + + } +//------------------------------------------------------------------------------------------------------------------------------------------------- void qTabDeveloper::Initialization(){ + connect(adcTimer, SIGNAL(timeout()), this, SLOT(RefreshAdcs())); + + //for(int i=0;isetMaximum(10000); + + dacLayout->addWidget(lblDacs[i],(int)(i/2),((i%2)==0)?1:4); + dacLayout->addWidget(spinDacs[i],(int)(i/2),((i%2)==0)?2:5); + if(!(i%2)){ + dacLayout->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed),(int)(i/2),0); + dacLayout->addItem(new QSpacerItem(60,20,QSizePolicy::Fixed,QSizePolicy::Fixed),(int)(i/2),3); + dacLayout->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed),(int)(i/2),6); + } + } +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabDeveloper::CreateADCWidgets(){ + QGridLayout *adcLayout = new QGridLayout(boxAdcs); + + for(int i=0;isetMaximum(10000); + + adcLayout->addWidget(lblAdcs[i],(int)(i/2),((i%2)==0)?1:4); + adcLayout->addWidget(spinAdcs[i],(int)(i/2),((i%2)==0)?2:5); + if(!(i%2)){ + adcLayout->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed),(int)(i/2),0); + adcLayout->addItem(new QSpacerItem(60,20,QSizePolicy::Fixed,QSizePolicy::Fixed),(int)(i/2),3); + adcLayout->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed),(int)(i/2),6); + } + } +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(int index){ + switch(detType){ + case slsDetectorDefs::MYTHEN: + switch(index){ + case 0: return slsDetectorDefs::TRIMBIT_SIZE; + case 1: return slsDetectorDefs::THRESHOLD; + case 2: return slsDetectorDefs::SHAPER1; + case 3: return slsDetectorDefs::SHAPER2; + case 4: return slsDetectorDefs::CALIBRATION_PULSE; + case 5: return slsDetectorDefs::PREAMP; + default: + qDefs::ErrorMessage("Unknown DAC/ADC Index. Weird Error","Developer"); + Refresh(); + break; + } + case slsDetectorDefs::EIGER: + return slsDetectorDefs::HUMIDITY; + /**fill in here*/ + break; + case slsDetectorDefs::GOTTHARD: + switch(index){ + case 0: return slsDetectorDefs::G_VREF_DS; + case 1: return slsDetectorDefs::G_VCASCN_PB; + case 2: return slsDetectorDefs::G_VCASCP_PB; + case 3: return slsDetectorDefs::G_VOUT_CM; + case 4: return slsDetectorDefs::G_VCASC_OUT; + case 5: return slsDetectorDefs::G_VIN_CM; + case 6: return slsDetectorDefs::G_VREF_COMP; + case 7: return slsDetectorDefs::G_IB_TESTC; + case 8: return slsDetectorDefs::TEMPERATURE_ADC; + case 9: return slsDetectorDefs::TEMPERATURE_FPGA; + default: + qDefs::ErrorMessage("Unknown DAC/ADC Index. Weird Error","Developer"); + Refresh(); + break; + } + default: + qDefs::ErrorMessage(string("Unknown detector type:")+myDet->slsDetectorBase::getDetectorType(detType),"Developer"); + exit(-1); + break; + } +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabDeveloper::RefreshAdcs(){ +#ifdef VERYVERBOSE + cout << "Updating ADCs" <stop(); + for(int i=0;isetValue(myDet->getADC(getSLSIndex(i+NUM_DAC_WIDGETS))); + adcTimer->start(ADC_TIMEOUT); +} + + //------------------------------------------------------------------------------------------------------------------------------------------------- void qTabDeveloper::Refresh(){ +#ifdef VERBOSE + cout << "Updating Dacs and Adcs" <setValue(myDet->setDAC(-1,getSLSIndex(i))); + //adcs + RefreshAdcs(); } diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 151d2c4f5..e34e3c39a 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -5,16 +5,16 @@ * Author: l_maliakal_d */ -/** Qt Project Class Headers */ +//Qt Project Class Headers #include "qTabMeasurement.h" #include "qDefs.h" #include "qDrawPlot.h" -/** Project Class Headers */ +//Project Class Headers #include "slsDetector.h" #include "multiSlsDetector.h" -/** Qt Include Headers */ +//Qt Include Headers #include -/** C++ Include Headers */ +//C++ Include Headers #include using namespace std; @@ -47,18 +47,18 @@ qTabMeasurement::~qTabMeasurement(){ void qTabMeasurement::SetupWidgetWindow(){ - /** Number of measurements */ + //Number of measurements numMeasurement=1; - /** Timer to update the progress bar **/ + //Timer to update the progress bar progressTimer = new QTimer(this); //btnStartStop->setStyleSheet("color:green"); - /** Exp Time **/ + //Exp Time qDefs::timeUnit unit; double time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-9)))); spinExpTime->setValue(time); comboExpUnit->setCurrentIndex((int)unit); - /** Hide the error message **/ + //Hide the error message red = QPalette(); red.setColor(QPalette::Active,QPalette::WindowText,Qt::red); acqPeriodTip = spinPeriod->toolTip(); @@ -66,20 +66,20 @@ void qTabMeasurement::SetupWidgetWindow(){ " #period#

")+ QString("Acquisition Period should be" " greater than or equal to Exposure Time."); - /** File Name **/ + //File Name dispFileName->setText(QString(myDet->getFileName().c_str())); - /** File Index **/ + //File Index spinIndex->setValue(myDet->getFileIndex()); - /** only initially **/ + //only initially lblProgressIndex->setText(QString::number(myDet->getFileIndex())); - /** only initially **/ + //ly initially progressBar->setValue(0); currentMeasurement = 0; - /** timing mode*/ + //timing mode SetupTimingMode(); - /**file write enabled/disabled*/ + //file write enabled/disabled myDet->enableWriteToFile(true); //check if file enabled } @@ -89,10 +89,10 @@ void qTabMeasurement::SetupWidgetWindow(){ void qTabMeasurement::SetupTimingMode(){ - /** Get timing mode from detector*/ + //Get timing mode from detector slsDetectorDefs::externalCommunicationMode mode = myDet->setExternalCommunicationMode(); - /** To be able to index items on a combo box */ + //To be able to index items on a combo box QStandardItemModel* model = qobject_cast(comboTimingMode->model()); QModelIndex index[NumTimingModes]; QStandardItem* item[NumTimingModes]; @@ -101,7 +101,7 @@ void qTabMeasurement::SetupTimingMode(){ index[i] = model->index(i, comboTimingMode->modelColumn(), comboTimingMode->rootModelIndex()); item[i] = model->itemFromIndex(index[i]); } - /** Enabling/Disabling depending on the detector type */ + //Enabling/Disabling depending on the detector type switch(myDet->getDetectorsType()){ case slsDetectorDefs::MYTHEN: item[(int)Trigger_Exp_Series]->setEnabled(true); @@ -132,12 +132,12 @@ void qTabMeasurement::SetupTimingMode(){ exit(-1); break; } - /** Setting the timing mode */ + //Setting the timing mode if(item[mode]->isEnabled()){ - /**if the timing mode is Auto and - * number of Frames and number of triggers is 1, - * then the timing mode is 'None'. - * This is for the inexperienced user */ + //if the timing mode is Auto and + // number of Frames and number of triggers is 1, + // then the timing mode is 'None'. + // This is for the inexperienced user if(mode==slsDetectorDefs::AUTO_TIMING){ int frames = (int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1); int triggers = (int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1); @@ -149,14 +149,14 @@ void qTabMeasurement::SetupTimingMode(){ setTimingMode((int)Auto); } }else{ - /** mode +1 since the detector class has no timingmode as "None" */ + //mode +1 since the detector class has no timingmode as "None" comboTimingMode->setCurrentIndex((int)mode+1); setTimingMode((int)mode+1); } } - /** Mode NOT ENABLED. - * This should not happen -only if the server and gui has a mismatch - * on which all modes are allowed in detectors */ + // Mode NOT ENABLED. + // This should not happen -only if the server and gui has a mismatch + // on which all modes are allowed in detectors else{ qDefs::WarningMessage("Unknown Timing Mode detected from detector." "\n\nSetting the following defaults:\nTiming Mode \t: None\n" @@ -172,39 +172,39 @@ void qTabMeasurement::SetupTimingMode(){ void qTabMeasurement::Initialization(int timingChange){ - /** These signals are connected only at start up. The others are reinitialized when changing timing mode*/ + //These signals are connected only at start up. The others are reinitialized when changing timing mode if(!timingChange){ - /** Number of Measurements**/ + //Number of Measurements connect(spinNumMeasurements,SIGNAL(valueChanged(int)), this, SLOT(setNumMeasurements(int))); - /** File Name**/ + //File Name connect(dispFileName, SIGNAL(textChanged(const QString&)),this, SLOT(setFileName(const QString&))); - /** File Index**/ + //File Index connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int))); - /** Start/Stop Acquisition**/ + //Start/Stop Acquisition connect(btnStartStop, SIGNAL(clicked()), this, SLOT(startStopAcquisition())); - /** Timing Mode **/ + //Timing Mode connect(comboTimingMode, SIGNAL(currentIndexChanged(int)), this, SLOT(setTimingMode(int)));// - /** progress bar */ + //progress bar connect(progressTimer, SIGNAL(timeout()), this, SLOT(UpdateProgress())); - /** enable write to file */ + //enable write to file connect(chkFile, SIGNAL(toggled(bool)), this, SLOT(EnableFileWrite(bool))); } - /** Number of Frames**/ + //Number of Frames connect(spinNumFrames,SIGNAL(valueChanged(int)), this, SLOT(setNumFrames(int))); - /** Exposure Time **/ + //Exposure Time connect(spinExpTime,SIGNAL(valueChanged(double)), this, SLOT(setExposureTime()));//..myplot connect(comboExpUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setExposureTime())); - /** Frame Period between exposures**/ + //Frame Period between exposures connect(spinPeriod,SIGNAL(valueChanged(double)), this, SLOT(setAcquisitionPeriod()));//..myplot connect(comboPeriodUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setAcquisitionPeriod())); - /** Number of Triggers**/ + //Number of Triggers connect(spinNumTriggers,SIGNAL(valueChanged(int)), this, SLOT(setNumTriggers(int)));// - /** Delay After Trigger **/ + //Delay After Trigger connect(spinDelay,SIGNAL(valueChanged(double)), this, SLOT(setDelay()));// connect(comboDelayUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setDelay())); - /** Number of Gates**/ + //Number of Gates connect(spinNumGates,SIGNAL(valueChanged(int)), this, SLOT(setNumGates(int)));// - /** Number of Probes**/ + //Number of Probes connect(spinNumProbes,SIGNAL(valueChanged(int)), this, SLOT(setNumProbes(int)));// } @@ -213,22 +213,22 @@ void qTabMeasurement::Initialization(int timingChange){ void qTabMeasurement::DeInitialization(){ - /** Number of Frames**/ + //Number of Frames disconnect(spinNumFrames,SIGNAL(valueChanged(int)), this, SLOT(setNumFrames(int))); - /** Exposure Time **/ + //Exposure Time disconnect(spinExpTime,SIGNAL(valueChanged(double)), this, SLOT(setExposureTime()));//..myplot disconnect(comboExpUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setExposureTime())); - /** Frame Period between exposures**/ + //Frame Period between exposures disconnect(spinPeriod,SIGNAL(valueChanged(double)), this, SLOT(setAcquisitionPeriod()));//..myplot disconnect(comboPeriodUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setAcquisitionPeriod())); - /** Number of Triggers**/ + //Number of Triggers disconnect(spinNumTriggers,SIGNAL(valueChanged(int)), this, SLOT(setNumTriggers(int))); - /** Delay After Trigger **/ + //Delay After Trigger disconnect(spinDelay,SIGNAL(valueChanged(double)), this, SLOT(setDelay())); disconnect(comboDelayUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setDelay())); - /** Number of Gates**/ + //Number of Gates disconnect(spinNumGates,SIGNAL(valueChanged(int)), this, SLOT(setNumGates(int))); - /** Number of Probes**/ + //Number of Probes disconnect(spinNumProbes,SIGNAL(valueChanged(int)), this, SLOT(setNumProbes(int))); } @@ -239,7 +239,7 @@ void qTabMeasurement::DeInitialization(){ void qTabMeasurement::Enable(bool enable){ frameTimeResolved->setEnabled(enable); frameNotTimeResolved->setEnabled(enable); - /** Enable this always **/ + //Enable this always if(!enable) btnStartStop->setEnabled(true); } @@ -249,7 +249,7 @@ void qTabMeasurement::Enable(bool enable){ void qTabMeasurement::setNumMeasurements(int val){ #ifdef VERBOSE - cout<<"Setting Number of Measurements to " <setNumMeasurements(val); @@ -260,7 +260,7 @@ void qTabMeasurement::setNumMeasurements(int val){ void qTabMeasurement::setFileName(const QString& fName){ myDet->setFileName(fName.toAscii().data()); #ifdef VERBOSE - cout<<"Setting File name to " << myDet->getFileName()<getFileName() << endl; #endif } @@ -271,7 +271,7 @@ void qTabMeasurement::setRunIndex(int index){ myDet->setFileIndex(index); lblProgressIndex->setText(QString::number(index)); #ifdef VERBOSE - cout<<"Setting File Index to " << myDet->getFileIndex()<getFileIndex() << endl; #endif } @@ -281,13 +281,13 @@ void qTabMeasurement::setRunIndex(int index){ void qTabMeasurement::startStopAcquisition(){ if(!btnStartStop->text().compare("Start")){ #ifdef VERBOSE - cout<setStyleSheet("color:red"); btnStartStop->setText("Stop"); Enable(0); progressBar->setValue(0); - /** the progress which keeps adding up for all the measurements*/ + //the progress which keeps adding up for all the measurements currentMeasurement = 0; progressTimer->start(100); @@ -348,7 +348,7 @@ void qTabMeasurement::UpdateProgress(){ void qTabMeasurement::setNumFrames(int val){ myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,val); #ifdef VERBOSE - cout<<"Setting number of frames to " << (int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1)<setTimer(slsDetectorDefs::FRAME_NUMBER,-1) << endl; #endif } @@ -359,10 +359,10 @@ void qTabMeasurement::setNumFrames(int val){ void qTabMeasurement::setExposureTime(){ double exptimeNS; - /** Get the value of timer in ns **/ + //Get the value of timer in ns exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value()); #ifdef VERBOSE - cout<<"Setting acquisition time to " << exptimeNS << " clocks" << "/"<value()<currentIndex())<value() << qDefs::getUnitString((qDefs::timeUnit)comboExpUnit->currentIndex()) << endl; #endif myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,(int64_t)exptimeNS); @@ -390,10 +390,10 @@ void qTabMeasurement::setExposureTime(){ void qTabMeasurement::setAcquisitionPeriod(){ double acqtimeNS; - /** Get the value of timer in ns **/ + //Get the value of timer in ns acqtimeNS = qDefs::getNSTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value()); #ifdef VERBOSE - cout<<"Setting frame period between exposures to " << acqtimeNS << " clocks"<< "/"<value()<currentIndex())<value() << qDefs::getUnitString((qDefs::timeUnit)comboPeriodUnit->currentIndex()) << endl; #endif myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,(int64_t)acqtimeNS); @@ -412,7 +412,7 @@ void qTabMeasurement::setAcquisitionPeriod(){ lblPeriod->setText("Acquisition Period:"); } - /** Check if the interval between plots is ok */ + //Check if the interval between plots is ok emit CheckPlotIntervalSignal(); } @@ -423,7 +423,7 @@ void qTabMeasurement::setAcquisitionPeriod(){ void qTabMeasurement::setNumTriggers(int val){ myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,val); #ifdef VERBOSE - cout<<"Setting number of triggers to " << (int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1)<setTimer(slsDetectorDefs::CYCLES_NUMBER,-1) << endl; #endif } @@ -433,10 +433,10 @@ void qTabMeasurement::setNumTriggers(int val){ void qTabMeasurement::setDelay(){ double exptimeNS; - /** Get the value of timer in ns **/ + //Get the value of timer in ns exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboDelayUnit->currentIndex(),spinDelay->value()); #ifdef VERBOSE - cout<<"Setting delay after trigger to " << exptimeNS << " clocks"<< "/"<value()<currentIndex())<value() << qDefs::getUnitString((qDefs::timeUnit)comboDelayUnit->currentIndex()) << endl; #endif myDet->setTimer(slsDetectorDefs::DELAY_AFTER_TRIGGER,(int64_t)exptimeNS); } @@ -448,7 +448,7 @@ void qTabMeasurement::setDelay(){ void qTabMeasurement::setNumGates(int val){ myDet->setTimer(slsDetectorDefs::GATES_NUMBER,val); #ifdef VERBOSE - cout<<"Setting number of gates to " << (int)myDet->setTimer(slsDetectorDefs::GATES_NUMBER,-1)<setTimer(slsDetectorDefs::GATES_NUMBER,-1) << endl; #endif } @@ -459,7 +459,7 @@ void qTabMeasurement::setNumGates(int val){ void qTabMeasurement::setNumProbes(int val){ myDet->setTimer(slsDetectorDefs::PROBES_NUMBER,val); #ifdef VERBOSE - cout<<"Setting number of frames to " << (int)myDet->setTimer(slsDetectorDefs::PROBES_NUMBER,-1)<setTimer(slsDetectorDefs::PROBES_NUMBER,-1) << endl; #endif } @@ -469,9 +469,9 @@ void qTabMeasurement::setNumProbes(int val){ void qTabMeasurement::setTimingMode(int mode){ #ifdef VERBOSE - cout<<"Setting Timing mode to " << comboTimingMode->currentText().toAscii().data()<currentText().toAscii().data() << endl; #endif - /** Default settings */ + //Default settings lblNumFrames->setEnabled(false); spinNumFrames->setEnabled(false); lblExpTime->setEnabled(false); spinExpTime->setEnabled(false); comboExpUnit->setEnabled(false); lblPeriod->setEnabled(false); spinPeriod->setEnabled(false); comboPeriodUnit->setEnabled(false); @@ -482,21 +482,21 @@ void qTabMeasurement::setTimingMode(int mode){ bool success = false; switch(mode){ - case None:/** Exposure Time */ + case None://Exposure Time lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true); setNumFrames(1); setNumTriggers(1); if(myDet->setExternalCommunicationMode(slsDetectorDefs::AUTO_TIMING)==slsDetectorDefs::AUTO_TIMING) success = true; break; - case Auto:/** Number of Frames, Exposure Time, Acquisition Period */ + case Auto://Number of Frames, Exposure Time, Acquisition Period lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true); lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true); if(myDet->setExternalCommunicationMode(slsDetectorDefs::AUTO_TIMING)==slsDetectorDefs::AUTO_TIMING) success = true; break; - case Trigger_Exp_Series:/** Number of Frames, Exposure Time, Acquisition Period, Number of Triggers, Delay */ + case Trigger_Exp_Series://Number of Frames, Exposure Time, Acquisition Period, Number of Triggers, Delay lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true); lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true); @@ -505,13 +505,13 @@ void qTabMeasurement::setTimingMode(int mode){ if(myDet->setExternalCommunicationMode(slsDetectorDefs::TRIGGER_EXPOSURE)==slsDetectorDefs::TRIGGER_EXPOSURE) success = true; break; - case Trigger_Frame:/** Exposure Time, Number of Triggers */ + case Trigger_Frame://Exposure Time, Number of Triggers lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true); lblNumTriggers->setEnabled(true); spinNumTriggers->setEnabled(true); if(myDet->setExternalCommunicationMode(slsDetectorDefs::TRIGGER_FRAME)==slsDetectorDefs::TRIGGER_FRAME) success = true; break; - case Trigger_Readout:/** Number of Frames, Exposure Time, Acquisition Period, Delay */ + case Trigger_Readout://Number of Frames, Exposure Time, Acquisition Period, Delay lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true); lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true); @@ -519,13 +519,13 @@ void qTabMeasurement::setTimingMode(int mode){ if(myDet->setExternalCommunicationMode(slsDetectorDefs::TRIGGER_READOUT)==slsDetectorDefs::TRIGGER_READOUT) success = true; break; - case Gated:/** Number of Frames, Number of Gates */ + case Gated://Number of Frames, Number of Gates lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); lblNumGates->setEnabled(true); spinNumGates->setEnabled(true); if(myDet->setExternalCommunicationMode(slsDetectorDefs::GATE_FIX_NUMBER)==slsDetectorDefs::GATE_FIX_NUMBER) success = true; break; - case Gated_Start:/** Number of Frames, Exposure Time, Acquisition Period, Number of Triggers, Number of Gates */ + case Gated_Start://Number of Frames, Exposure Time, Acquisition Period, Number of Triggers, Number of Gates lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true); lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true); @@ -534,13 +534,13 @@ void qTabMeasurement::setTimingMode(int mode){ if(myDet->setExternalCommunicationMode(slsDetectorDefs::GATE_WITH_START_TRIGGER)==slsDetectorDefs::GATE_WITH_START_TRIGGER) success = true; break; - case Trigger_Window:/** Number of Triggers */ + case Trigger_Window://Number of Triggers lblNumTriggers->setEnabled(true); spinNumTriggers->setEnabled(true); if(myDet->setExternalCommunicationMode(slsDetectorDefs::TRIGGER_WINDOW)==slsDetectorDefs::TRIGGER_WINDOW) success = true; break; default: - /** This should never happen */ + //This should never happen qDefs::ErrorMessage("Timing mode unknown to GUI","Measurement"); exit(-1); } @@ -553,43 +553,43 @@ void qTabMeasurement::setTimingMode(int mode){ return; } - if(mode!=None){/** Number of Probes */ + if(mode!=None){//Number of Probes if(myDet->getDetectorsType()==slsDetectorDefs::MYTHEN){ lblNumProbes->setEnabled(true); spinNumProbes->setEnabled(true); } } - /** To disconnect all the signals before changing their values*/ + //To disconnect all the signals before changing their values DeInitialization(); double time; int val; qDefs::timeUnit unit; - /**Number of Frames */ + //Number of Frames if(lblNumFrames->isEnabled()){ val = (int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1); spinNumFrames->setValue(val); #ifdef VERBOSE - cout<<"Getting number of frames : " << val <isEnabled()){ time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-9)))); #ifdef VERBOSE - cout<<"Getting acquisition time : " << time << qDefs::getUnitString(unit) << endl; + cout << "Getting acquisition time : " << time << qDefs::getUnitString(unit) << endl; #endif spinExpTime->setValue(time); comboExpUnit->setCurrentIndex((int)unit); } - /**Frame Period between exposures */ + //Frame Period between exposures if(lblPeriod->isEnabled()){ time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,-1)*(1E-9)))); #ifdef VERBOSE - cout<<"Getting frame period between exposures : " << time << qDefs::getUnitString(unit) << endl; + cout << "Getting frame period between exposures : " << time << qDefs::getUnitString(unit) << endl; #endif spinPeriod->setValue(time); comboPeriodUnit->setCurrentIndex((int)unit); @@ -618,44 +618,44 @@ void qTabMeasurement::setTimingMode(int mode){ lblPeriod->setText("Acquisition Period:"); } - /**Number of Triggers */ + //Number of Triggers if(lblNumTriggers->isEnabled()){ val = (int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1); spinNumTriggers->setValue(val); #ifdef VERBOSE - cout<<"Getting number of triggers : " << val <isEnabled()){ time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::DELAY_AFTER_TRIGGER,-1)*(1E-9)))); #ifdef VERBOSE - cout<<"Getting delay after trigger : " << time << qDefs::getUnitString(unit) << endl; + cout << "Getting delay after trigger : " << time << qDefs::getUnitString(unit) << endl; #endif spinDelay->setValue(time); comboDelayUnit->setCurrentIndex((int)unit); } - /**Number of Gates */ + //Number of Gates if(lblNumGates->isEnabled()){ val = (int)myDet->setTimer(slsDetectorDefs::GATES_NUMBER,-1); spinNumGates->setValue(val); #ifdef VERBOSE - cout<<"Getting number of gates : " << val <isEnabled()){ val = (int)myDet->setTimer(slsDetectorDefs::PROBES_NUMBER,-1); spinNumProbes->setValue(val); #ifdef VERBOSE - cout<<"Getting number of probes : " << val <setText(QString(myDet->getFileName().c_str())); - /** File Index **/ + //File Index spinIndex->setValue(myDet->getFileIndex()); - /** progress label index **/ + //progress label index lblProgressIndex->setText(QString::number(myDet->getFileIndex())); - /** Timing mode**/ + //Timing mode* SetupTimingMode(); // to let qdrawplot know that triggers or frames are used diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index 0719ef2c6..765929759 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -482,6 +482,9 @@ void qTabPlot::EnableScanBox(bool enable,int id){ radioLevel1->setChecked(!enable); } } + /**if(boxScan->isEnabled()){ + myDet->setPlotType(i); + }*/ } diff --git a/slsDetectorGui/src/qTabSettings.cpp b/slsDetectorGui/src/qTabSettings.cpp index 572667919..43939e73e 100644 --- a/slsDetectorGui/src/qTabSettings.cpp +++ b/slsDetectorGui/src/qTabSettings.cpp @@ -7,10 +7,10 @@ #include "qTabSettings.h" #include "qDefs.h" -/** Project Class Headers */ +// Project Class Headers #include "slsDetector.h" #include "multiSlsDetector.h" -/** C++ Include Headers */ +// C++ Include Headers #include using namespace std; @@ -34,22 +34,22 @@ qTabSettings::~qTabSettings(){ //------------------------------------------------------------------------------------------------------------------------------------------------- void qTabSettings::SetupWidgetWindow(){ - /** Detector Type*/ + // Detector Type detType=myDet->getDetectorsType(); - /** Settings */ + // Settings SetupDetectorSettings(); comboSettings->setCurrentIndex(myDet->getSettings(detID)); - /**expert mode is not enabled initially*/ + //expert mode is not enabled initially lblThreshold->setEnabled(false); spinThreshold->setEnabled(false); - /** Number of Modules */ + // Number of Modules spinNumModules->setMaximum(myDet->getMaxNumberOfModules()); spinNumModules->setValue(myDet->setNumberOfModules()); - /** Dynamic Range */ + // Dynamic Range switch(myDet->setDynamicRange(-1)){ case 32: comboDynamicRange->setCurrentIndex(0); break; case 16: comboDynamicRange->setCurrentIndex(1); break; @@ -63,18 +63,18 @@ void qTabSettings::SetupWidgetWindow(){ //------------------------------------------------------------------------------------------------------------------------------------------------- void qTabSettings::SetupDetectorSettings(){ - /** Get detector settings from detector*/ + // Get detector settings from detector slsDetectorDefs::detectorSettings sett = myDet->getSettings(detID); - /** To be able to index items on a combo box */ + // To be able to index items on a combo box model = qobject_cast(comboSettings->model()); if (model) { for(int i=0;iindex(i, comboSettings->modelColumn(), comboSettings->rootModelIndex()); item[i] = model->itemFromIndex(index[i]); } - /** Enabling/Disabling depending on the detector type - Undefined and uninitialized are enabled for all detectors*/ + // Enabling/Disabling depending on the detector type + // Undefined and uninitialized are enabled for all detectors if(sett==slsDetectorDefs::UNDEFINED) item[(int)Uninitialized]->setEnabled(false); else if(sett==slsDetectorDefs::UNINITIALIZED) @@ -116,9 +116,9 @@ void qTabSettings::SetupDetectorSettings(){ exit(-1); break; } - /** detector settings selected NOT ENABLED. - * This should not happen -only if the server and gui has a mismatch - * on which all modes are allowed in detectors */ + // detector settings selected NOT ENABLED. + // This should not happen -only if the server and gui has a mismatch + // on which all modes are allowed in detectors if(!(item[(int)sett]->isEnabled())){ qDefs::ErrorMessage("Unknown Detector Settings retrieved from detector. " "Exiting GUI.","Settings"); @@ -127,7 +127,7 @@ void qTabSettings::SetupDetectorSettings(){ #endif exit(-1); } - /** Setting the detector settings */ + // Setting the detector settings else comboSettings->setCurrentIndex((int)sett); } } @@ -135,33 +135,33 @@ void qTabSettings::SetupDetectorSettings(){ //------------------------------------------------------------------------------------------------------------------------------------------------- void qTabSettings::Initialization(){ - /** Settings */ + // Settings connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int))); - /** Number of Modules */ + // Number of Modules connect(spinNumModules, SIGNAL(valueChanged(int)), this, SLOT(SetNumberOfModules(int))); - /** Dynamic Range */ + // Dynamic Range connect(comboDynamicRange, SIGNAL(activated(int)), this, SLOT(SetDynamicRange(int))); - /** Threshold */ + // Threshold connect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy())); } //------------------------------------------------------------------------------------------------------------------------------------------------- void qTabSettings::setSettings(int index){ - /** The first time settings is changed from undefined or uninitialized to a proper setting, - * then undefined/uninitialized should be disabled */ + // The first time settings is changed from undefined or uninitialized to a proper setting, + // then undefined/uninitialized should be disabled if(item[(int)Undefined]->isEnabled()){ - /**Do not disable it if this wasnt selected again by mistake*/ + //Do not disable it if this wasnt selected again by mistake if(index!=(int)Undefined) item[(int)Undefined]->setEnabled(false); }else if(item[(int)Uninitialized]->isEnabled()){ - /**Do not disable it if this wasnt selected again by mistake*/ + //Do not disable it if this wasnt selected again by mistake if(index!=(int)Uninitialized) item[(int)Uninitialized]->setEnabled(false); } slsDetectorDefs::detectorSettings sett = myDet->setSettings((slsDetectorDefs::detectorSettings)index,detID); #ifdef VERBOSE - cout << "Settings have been set to "<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); @@ -250,13 +250,13 @@ void qTabSettings::SetEnergy(){ void qTabSettings::Refresh(){ - /** Settings */ + // Settings SetupDetectorSettings(); comboSettings->setCurrentIndex(myDet->getSettings(detID)); - /** Number of Modules */ + // Number of Modules spinNumModules->setValue(myDet->setNumberOfModules()); - /** Dynamic Range */ + // Dynamic Range switch(myDet->setDynamicRange(-1)){ case 32: comboDynamicRange->setCurrentIndex(0); break; case 16: comboDynamicRange->setCurrentIndex(1); break; From 63bfdb9cb907384f4aaf17c5227ef89a776fbee6 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 8 Aug 2012 17:10:44 +0000 Subject: [PATCH 027/332] dacs and adcs work git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@27 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qTabDeveloper.h | 28 +++++++++++++++++++++++++- slsDetectorGui/src/qTabDeveloper.cpp | 18 ++++++++++++++--- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/slsDetectorGui/include/qTabDeveloper.h b/slsDetectorGui/include/qTabDeveloper.h index ff340dd72..ab1ca4c1b 100644 --- a/slsDetectorGui/include/qTabDeveloper.h +++ b/slsDetectorGui/include/qTabDeveloper.h @@ -25,6 +25,27 @@ class multiSlsDetector; using namespace std; +/**To override the spin box class to have an id and emit it*/ +class MyDoubleSpinBox:public QDoubleSpinBox{ +Q_OBJECT +private: + int myId; + private slots: + void valueChangedWithID() {emit editingFinished(myId);}; + public: + /** Overridden constructor from QDoubleSpinBox */ + MyDoubleSpinBox(int id,QWidget* parent = 0) + :QDoubleSpinBox(parent),myId(id){ + //setParent(parent); + connect(this,SIGNAL(editingFinished()), + this,SLOT(valueChangedWithID())); + } + signals: + void editingFinished(int myId); +}; + + + /** *@short sets up the Developer parameters */ @@ -69,7 +90,7 @@ private: QGroupBox *boxAdcs; QLabel *lblDacs[20]; QLabel *lblAdcs[20]; - QDoubleSpinBox *spinDacs[20]; + MyDoubleSpinBox *spinDacs[20]; QDoubleSpinBox *spinAdcs[20]; QTimer *adcTimer; @@ -102,6 +123,11 @@ private slots: */ void RefreshAdcs(); +/** Set Dac values + * @param id id of dac + */ +void SetDacValues(int id); + }; diff --git a/slsDetectorGui/src/qTabDeveloper.cpp b/slsDetectorGui/src/qTabDeveloper.cpp index 28963993f..4f188077b 100644 --- a/slsDetectorGui/src/qTabDeveloper.cpp +++ b/slsDetectorGui/src/qTabDeveloper.cpp @@ -128,8 +128,8 @@ void qTabDeveloper::SetupWidgetWindow(){ void qTabDeveloper::Initialization(){ connect(adcTimer, SIGNAL(timeout()), this, SLOT(RefreshAdcs())); - //for(int i=0;isetMaximum(10000); dacLayout->addWidget(lblDacs[i],(int)(i/2),((i%2)==0)?1:4); @@ -181,6 +181,18 @@ void qTabDeveloper::CreateADCWidgets(){ //------------------------------------------------------------------------------------------------------------------------------------------------- +void qTabDeveloper::SetDacValues(int id){ +#ifdef VERYVERBOSE + cout << "Setting dac:" <value() << endl; +#endif + + spinDacs[id]->setValue(myDet->setDAC(spinDacs[id]->value(),getSLSIndex(id))); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(int index){ switch(detType){ case slsDetectorDefs::MYTHEN: From 30c11d75899789e372d8c6c63ae63dd82b901e63 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 15 Aug 2012 17:21:05 +0000 Subject: [PATCH 028/332] fixed the dac problem git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@28 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_plot.ui | 2 +- slsDetectorGui/include/qDrawPlot.h | 5 +- slsDetectorGui/include/qScanWidget.h | 2 +- slsDetectorGui/include/qTabActions.h | 2 +- slsDetectorGui/include/qTabMeasurement.h | 12 +- slsDetectorGui/include/qTabPlot.h | 6 +- slsDetectorGui/slsDetectorGui.pro | 2 +- slsDetectorGui/src/qDetectorMain.cpp | 14 +- slsDetectorGui/src/qDrawPlot.cpp | 59 +++++++- slsDetectorGui/src/qScanWidget.cpp | 13 +- slsDetectorGui/src/qTabActions.cpp | 2 +- slsDetectorGui/src/qTabDeveloper.cpp | 9 +- slsDetectorGui/src/qTabMeasurement.cpp | 12 +- slsDetectorGui/src/qTabPlot.cpp | 182 ++++++++++++++--------- 14 files changed, 214 insertions(+), 108 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index e26d249ef..5bbd6f55a 100644 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -1051,7 +1051,7 @@ - false + true diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index 59d7ea7b3..404a7fa81 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -264,7 +264,10 @@ private: static int GetDataCallBack(detectorData *data, void *this_pointer); /** This is called by the GetDataCallBack function to copy the data */ int GetData(detectorData *data); - + /** This is called by the detector class to copy the scan data it jus acquired */ + static int GetScanDataCallBack(detectorData *data, void *this_pointer); + /** This is called by the GetDataCallBack function to copy the scan data */ + int GetScanData(detectorData *data); public slots: /** To select 1D or 2D plot diff --git a/slsDetectorGui/include/qScanWidget.h b/slsDetectorGui/include/qScanWidget.h index 2da18a6ab..0b7598ec6 100644 --- a/slsDetectorGui/include/qScanWidget.h +++ b/slsDetectorGui/include/qScanWidget.h @@ -145,7 +145,7 @@ void BrowseFileStepsPath(); signals: -void EnableScanBox(bool,int); +void EnableScanBox(int,int); }; diff --git a/slsDetectorGui/include/qTabActions.h b/slsDetectorGui/include/qTabActions.h index 2eed3113a..a10b033ad 100644 --- a/slsDetectorGui/include/qTabActions.h +++ b/slsDetectorGui/include/qTabActions.h @@ -111,7 +111,7 @@ void SetPosition(); void DeletePosition(); signals: -void EnableScanBox(bool,int); +void EnableScanBox(int,int); }; diff --git a/slsDetectorGui/include/qTabMeasurement.h b/slsDetectorGui/include/qTabMeasurement.h index e2322c31a..ddb24149d 100644 --- a/slsDetectorGui/include/qTabMeasurement.h +++ b/slsDetectorGui/include/qTabMeasurement.h @@ -98,6 +98,12 @@ void UpdateFinished(); */ void SetCurrentMeasurement(int val); +/** Sets the timing mode + * @ param mode cane be None, Auto, Gated, Trigger Exposure Series, + * Trigger Frame, Trigger Readout, External Trigger Window + */ +void SetTimingMode(int mode); + private slots: /** Set number of measurements * @param num number of measurements to be set */ @@ -117,12 +123,6 @@ void setRunIndex(int index); */ void startStopAcquisition(); -/** Sets the timing mode - * @ param mode cane be None, Auto, Gated, Trigger Exposure Series, - * Trigger Frame, Trigger Readout, External Trigger Window - */ -void setTimingMode(int mode); - /** Set number of frames * @param val number of frames to be set */ diff --git a/slsDetectorGui/include/qTabPlot.h b/slsDetectorGui/include/qTabPlot.h index 4e1701606..46b746f9f 100644 --- a/slsDetectorGui/include/qTabPlot.h +++ b/slsDetectorGui/include/qTabPlot.h @@ -49,8 +49,9 @@ private: /** 1d/2d plot */ bool isOneD; + bool isOrginallyOneD; - bool scanLevel[2]; + int scanLevel[2]; QStackedLayout* stackedLayout; QSpinBox *spinNthFrame; @@ -84,7 +85,7 @@ void SetFrequency(); * @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); +void EnableScanBox(int mode,int id); @@ -118,6 +119,7 @@ signals: void DisableZoomSignal(bool); void SetZRangeSignal(double,double); void EnableZRangeSignal(bool); +void ThresholdScanSignal(int); }; diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index e0fa1207d..60f610edb 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -6,7 +6,7 @@ UI_HEADERS_DIR = forms/include RESOURCES += icons.qrc -DEFINES += VERBOSE +DEFINES += VERBOSE DACS_INT target.path += $(DESTDIR) diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 90f77742e..72e4aea25 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -138,7 +138,7 @@ void qDetectorMain::SetUpWidgetWindow(){ // 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" @@ -224,9 +224,9 @@ void qDetectorMain::Initialization(){ connect(tab_measurement, SIGNAL(CheckPlotIntervalSignal()), tab_plot,SLOT(SetFrequency())); // Plot tab connect(tab_plot, SIGNAL(DisableZoomSignal(bool)), this,SLOT(SetZoomToolTip(bool))); + connect(tab_plot, SIGNAL(ThresholdScanSignal(int)), tab_measurement,SLOT(SetTimingMode(int))); // Actions tab - connect(tab_actions, SIGNAL(EnableScanBox(bool,int)), tab_plot,SLOT(EnableScanBox(bool,int))); - + connect(tab_actions, SIGNAL(EnableScanBox(int,int)), tab_plot,SLOT(EnableScanBox(int,int))); // Plotting // When the acquisition is finished, must update the meas tab connect(myPlot, SIGNAL(UpdatingPlotFinished()), this, SLOT(EnableTabs())); @@ -453,6 +453,14 @@ void qDetectorMain::resizeEvent(QResizeEvent* event){ centralwidget->setMaximumHeight(heightCentralWidget); } } + + //adjusting tab width + if(width()>=800){ tabs->tabBar()->setFixedWidth(width()+61);} + else { tabs->tabBar()->setMinimumWidth(0); + tabs->tabBar()->setExpanding(true); + tabs->tabBar()->setUsesScrollButtons(true); + } + event->accept(); } diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index d5e07632b..8fba07e9b 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -64,7 +64,8 @@ void qDrawPlot::SetupWidgetWindow(){ lastImageNumber = 0; last_plot_number = 0; - nPixelsX = 1280; nPixelsY = 100; + nPixelsX = myDet->getTotalNumberOfChannels(); + nPixelsY = 100; lastImageArray = 0; image_data = 0; @@ -426,8 +427,64 @@ int qDrawPlot::GetData(detectorData *data){ return 0; } + //------------------------------------------------------------------------------------------------------------------------------------------------- + +int qDrawPlot::GetScanDataCallBack(detectorData *data, void *this_pointer){ + ((qDrawPlot*)this_pointer)->GetScanData(data); + return 0; +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +int qDrawPlot::GetScanData(detectorData *data){/* +#ifdef VERYVERBOSE + cout<<"Entering GetScanDatafunction"<progressIndex; + //lastImageNumber= currentFrame+1; + currentThrehold++; + return 0; + } + //what comes here has plot enabled AND (frame factor OR data pause over ) + progress=(int)data->progressIndex; + +#ifdef VERYVERBOSE + cout<<"Reading in image: "<values,nPixelsX*sizeof(double)); + + pthread_mutex_unlock(&(last_image_complete_mutex)); + } + currentThrehold++; + + } +#ifdef VERYVERBOSE + cout<<"Exiting GetScanData function"<SetXTitle(histXAxisTitle.toAscii().constData()); diff --git a/slsDetectorGui/src/qScanWidget.cpp b/slsDetectorGui/src/qScanWidget.cpp index 208eda836..89d919b33 100644 --- a/slsDetectorGui/src/qScanWidget.cpp +++ b/slsDetectorGui/src/qScanWidget.cpp @@ -323,9 +323,6 @@ void qScanWidget::SetMode(int mode){ //set the group box widgets EnableSizeWidgets(); - //emit signal to enable scanbox in plot tab - emit EnableScanBox(mode,id); - //set the mode SetScan(mode); } @@ -366,16 +363,20 @@ int qScanWidget::SetScan(int mode){ break; } + //custom script + int actualMode = myDet->getScanMode(id); if((mode==CustomScript)&&((script=="")||(script=="none"))){ return qDefs::OK; - }else{ - if((mode!=myDet->getScanMode(id))&&(actualNumSteps)){ + }else{//mode NOT set + if((mode!=actualMode)&&(actualNumSteps)){ qDefs::WarningMessage("The mode could not be changed for an unknown reason.","ScanWidget"); - comboScript->setCurrentIndex(myDet->getScanMode(id)); + comboScript->setCurrentIndex(actualMode); return qDefs::FAIL; } } + emit EnableScanBox(actualMode,id); + return qDefs::OK; } diff --git a/slsDetectorGui/src/qTabActions.cpp b/slsDetectorGui/src/qTabActions.cpp index 59c531a4d..e315c4858 100644 --- a/slsDetectorGui/src/qTabActions.cpp +++ b/slsDetectorGui/src/qTabActions.cpp @@ -181,7 +181,7 @@ void qTabActions::Initialization(){ connect(group, SIGNAL(buttonClicked(QAbstractButton*)), this,SLOT(Expand(QAbstractButton*))); //enable scan box in plot tab for(int i=0;ivalue() << endl; #endif - spinDacs[id]->setValue(myDet->setDAC(spinDacs[id]->value(),getSLSIndex(id))); + spinDacs[id]->setValue((double)myDet->setDAC(spinDacs[id]->value(),getSLSIndex(id))); } @@ -246,7 +246,7 @@ void qTabDeveloper::RefreshAdcs(){ #endif adcTimer->stop(); for(int i=0;isetValue(myDet->getADC(getSLSIndex(i+NUM_DAC_WIDGETS))); + spinAdcs[i]->setValue((double)myDet->getADC(getSLSIndex(i+NUM_DAC_WIDGETS))); adcTimer->start(ADC_TIMEOUT); } @@ -260,8 +260,7 @@ void qTabDeveloper::Refresh(){ #endif //dacs for(int i=0;isetValue(myDet->setDAC(-1,getSLSIndex(i))); - + spinDacs[i]->setValue((double)myDet->setDAC(-1,getSLSIndex(i))); //adcs RefreshAdcs(); } diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index e34e3c39a..fe8c11de3 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -143,15 +143,15 @@ void qTabMeasurement::SetupTimingMode(){ int triggers = (int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1); if((frames==1)&&(triggers==1)){ comboTimingMode->setCurrentIndex((int)None); - setTimingMode((int)None); + SetTimingMode((int)None); }else{ comboTimingMode->setCurrentIndex((int)Auto); - setTimingMode((int)Auto); + SetTimingMode((int)Auto); } }else{ //mode +1 since the detector class has no timingmode as "None" comboTimingMode->setCurrentIndex((int)mode+1); - setTimingMode((int)mode+1); + SetTimingMode((int)mode+1); } } // Mode NOT ENABLED. @@ -162,7 +162,7 @@ void qTabMeasurement::SetupTimingMode(){ "\n\nSetting the following defaults:\nTiming Mode \t: None\n" "Number of Frames \t: 1\nNumber of Triggers \t: 1","Measurement"); comboTimingMode->setCurrentIndex((int)None); - setTimingMode((int)None); + SetTimingMode((int)None); } } } @@ -183,7 +183,7 @@ void qTabMeasurement::Initialization(int timingChange){ //Start/Stop Acquisition connect(btnStartStop, SIGNAL(clicked()), this, SLOT(startStopAcquisition())); //Timing Mode - connect(comboTimingMode, SIGNAL(currentIndexChanged(int)), this, SLOT(setTimingMode(int)));// + connect(comboTimingMode, SIGNAL(currentIndexChanged(int)), this, SLOT(SetTimingMode(int)));// //progress bar connect(progressTimer, SIGNAL(timeout()), this, SLOT(UpdateProgress())); //enable write to file @@ -467,7 +467,7 @@ void qTabMeasurement::setNumProbes(int val){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void qTabMeasurement::setTimingMode(int mode){ +void qTabMeasurement::SetTimingMode(int mode){ #ifdef VERBOSE cout << "Setting Timing mode to " << comboTimingMode->currentText().toAscii().data() << endl; #endif diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index 765929759..ea952d41f 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -8,11 +8,11 @@ #include "qTabPlot.h" #include "qDefs.h" #include "qDrawPlot.h" -/** Project Class Headers */ +// Project Class Headers #include "slsDetector.h" #include "multiSlsDetector.h" -/** Qt Include Headers */ -/** C++ Include Headers */ +// Qt Include Headers +// C++ Include Headers #include #include #include @@ -55,7 +55,7 @@ void qTabPlot::SetupWidgetWindow(){ scanLevel[0]=false; scanLevel[1]=false; -/** Plot Axis*/ +// Plot Axis myPlot->SetPlotTitle(defaultPlotTitle); dispTitle->setText(defaultPlotTitle); dispTitle->setEnabled(false); @@ -75,7 +75,7 @@ void qTabPlot::SetupWidgetWindow(){ dispYMax->setValidator(new QDoubleValidator(dispYMax)); dispZMax->setValidator(new QDoubleValidator(dispZMax)); - /** Plotting Frequency */ + // Plotting Frequency stackedLayout = new QStackedLayout; stackedLayout->setSpacing(0); @@ -106,13 +106,13 @@ void qTabPlot::SetupWidgetWindow(){ stackWidget->setLayout(stackedLayout); - /** Depending on whether the detector is 1d or 2d*/ + // 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; + case slsDetectorDefs::MYTHEN: isOrginallyOneD = true; Select1DPlot(true); break; + case slsDetectorDefs::EIGER: isOrginallyOneD = false; Select1DPlot(false);break; + case slsDetectorDefs::GOTTHARD: isOrginallyOneD = true; Select1DPlot(true);break; default: - cout<<"ERROR: Detector Type is Generic"<setEnabled(true); chkZMin->setEnabled(true); chkZMax->setEnabled(true); - myPlot->SetImageXAxisTitle(defaultImageXAxisTitle); - dispXAxis->setText(defaultImageXAxisTitle); - myPlot->SetImageYAxisTitle(defaultImageYAxisTitle); - dispYAxis->setText(defaultImageYAxisTitle); + + //threshold scan + if((scanLevel[0]==2)||(scanLevel[1]==2)){ + myPlot->SetImageXAxisTitle("Channel Number"); + dispXAxis->setText("Channel Number"); + dispYAxis->setText("Threshold"); + myPlot->SetImageYAxisTitle("Threshold"); + } + else{ + myPlot->SetImageXAxisTitle(defaultImageXAxisTitle); + dispXAxis->setText(defaultImageXAxisTitle); + dispYAxis->setText(defaultImageYAxisTitle); + myPlot->SetImageYAxisTitle(defaultImageYAxisTitle); + } myPlot->SetImageZAxisTitle(defaultImageZAxisTitle); dispZAxis->setText(defaultImageZAxisTitle); myPlot->Select2DPlot(); @@ -157,29 +167,29 @@ void qTabPlot::Select1DPlot(bool b){ void qTabPlot::Initialization(){ -/** Plot arguments box*/ - connect(radioNoPlot, SIGNAL(clicked()),this, SLOT(SetPlot())); - connect(radioHistogram, SIGNAL(clicked()),this, SLOT(SetPlot())); - connect(radioDataGraph, SIGNAL(clicked()),this, SLOT(SetPlot())); -/** Scan box*/ +// Plot arguments box + connect(radioNoPlot, SIGNAL(toggled(bool)),this, SLOT(SetPlot())); + connect(radioHistogram, SIGNAL(toggled(bool)),this, SLOT(SetPlot())); + connect(radioDataGraph, SIGNAL(toggled(bool)),this, SLOT(SetPlot())); +// Scan box //connect(scna, SIGNAL(toggled(bool)),this, SLOT(scanstuff(bool))); -/** Snapshot box*/ +// Snapshot box connect(btnClone, SIGNAL(clicked()),myPlot, SLOT(ClonePlot())); connect(btnCloseClones, SIGNAL(clicked()),myPlot, SLOT(CloseClones())); -/** 1D Plot box*/ +// 1D Plot box connect(chkSuperimpose, SIGNAL(toggled(bool)), this, SLOT(EnablePersistency(bool))); connect(spinPersistency,SIGNAL(valueChanged(int)), myPlot,SLOT(SetPersistency(int))); connect(chkPoints, SIGNAL(toggled(bool)), myPlot, SLOT(SetDottedPlot(bool))); -/** 2D Plot box*/ +// 2D Plot box connect(chkInterpolate, SIGNAL(toggled(bool)),myPlot, SIGNAL(InterpolateSignal(bool))); connect(chkContour, SIGNAL(toggled(bool)),myPlot, SIGNAL(ContourSignal(bool))); connect(chkLogz, SIGNAL(toggled(bool)),myPlot, SIGNAL(LogzSignal(bool))); -/** Plotting frequency box */ +// Plotting frequency box connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency())); connect(comboTimeGapUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency())); connect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetFrequency())); connect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency())); -/** Plot Axis **/ +// Plot Axis * connect(chkTitle, SIGNAL(toggled(bool)), this, SLOT(EnableTitles())); connect(chkXAxis, SIGNAL(toggled(bool)), this, SLOT(EnableTitles())); connect(chkYAxis, SIGNAL(toggled(bool)), this, SLOT(EnableTitles())); @@ -205,8 +215,8 @@ void qTabPlot::Initialization(){ connect(dispZMax, SIGNAL(returnPressed()), this, SLOT(SetZRange())); connect(this, SIGNAL(SetZRangeSignal(double,double)),myPlot, SIGNAL(SetZRangeSignal(double,double))); -/** Common Buttons*/ -/** Save */ +// Common Buttons +// Save connect(btnSave, SIGNAL(clicked()), myPlot, SLOT(SavePlot())); } @@ -227,20 +237,20 @@ void qTabPlot::EnablePersistency(bool enable){ void qTabPlot::SetTitles(){ - /** Plot Title*/ + // Plot Title if(dispTitle->isEnabled()) myPlot->SetPlotTitle(dispTitle->text()); - /** X Axis */ + // X Axis if(dispXAxis->isEnabled()){ if(isOneD) myPlot->SetHistXAxisTitle(dispXAxis->text()); else myPlot->SetImageXAxisTitle(dispXAxis->text()); } - /** Y Axis */ + // Y Axis if(dispYAxis->isEnabled()){ if(isOneD) myPlot->SetHistYAxisTitle(dispYAxis->text()); else myPlot->SetImageYAxisTitle(dispYAxis->text()); } - /** Z Axis */ + // Z Axis if(dispZAxis->isEnabled()) myPlot->SetImageZAxisTitle(dispZAxis->text()); } @@ -250,13 +260,13 @@ void qTabPlot::SetTitles(){ void qTabPlot::EnableTitles(){ - /** Plot Title*/ + // Plot Title dispTitle->setEnabled(chkTitle->isChecked()); if(!chkTitle->isChecked()){ myPlot->SetPlotTitle(defaultPlotTitle); dispTitle->setText(defaultPlotTitle); } - /** X Axis */ + // X Axis dispXAxis->setEnabled(chkXAxis->isChecked()); if(!chkXAxis->isChecked()){ if(isOneD){ @@ -268,7 +278,7 @@ void qTabPlot::EnableTitles(){ dispXAxis->setText(defaultImageXAxisTitle); } } - /** Y Axis */ + // Y Axis dispYAxis->setEnabled(chkYAxis->isChecked()); if(!chkYAxis->isChecked()){ if(isOneD){ @@ -279,7 +289,7 @@ void qTabPlot::EnableTitles(){ dispYAxis->setText(defaultImageYAxisTitle); } } - /** Z Axis */ + // Z Axis dispZAxis->setEnabled(chkZAxis->isChecked()); if(!chkZAxis->isChecked()){ myPlot->SetImageZAxisTitle(defaultImageZAxisTitle); @@ -313,27 +323,27 @@ void qTabPlot::EnableRange(){ void qTabPlot::SetAxesRange(){ bool changed = false; - /** x min */ + // x min changed = (dispXMin->isEnabled())&&(!dispXMin->text().isEmpty()); if(changed) myPlot->SetXYRangeValues(dispXMin->text().toDouble(),qDefs::XMINIMUM); myPlot->IsXYRangeValues(changed,qDefs::XMINIMUM); - /** x max */ + // x max changed = (dispXMax->isEnabled())&&(!dispXMax->text().isEmpty()); if(changed) myPlot->SetXYRangeValues(dispXMax->text().toDouble(),qDefs::XMAXIMUM); myPlot->IsXYRangeValues(changed,qDefs::XMAXIMUM); - /** y min */ + // y min changed = (dispYMin->isEnabled())&&(!dispYMin->text().isEmpty()); if(changed) myPlot->SetXYRangeValues(dispYMin->text().toDouble(),qDefs::YMINIMUM); myPlot->IsXYRangeValues(changed,qDefs::YMINIMUM); - /** y max */ + // y max changed = (dispYMax->isEnabled())&&(!dispYMax->text().isEmpty()); if(changed) myPlot->SetXYRangeValues(dispYMax->text().toDouble(),qDefs::YMAXIMUM); myPlot->IsXYRangeValues(changed,qDefs::YMAXIMUM); - /** To remind the updateplot in qdrawplot to set range after updating plot*/ + // To remind the updateplot in qdrawplot to set range after updating plot myPlot->SetXYRange(true); } @@ -360,31 +370,46 @@ void qTabPlot::EnableZRange(){ void qTabPlot::SetPlot(){ +#ifdef VERBOSE + cout << "Entering Set Plot()" ; +#endif if(radioNoPlot->isChecked()){ + cout << " - No Plot" << endl; + Select1DPlot(isOrginallyOneD); myPlot->EnablePlot(false); - /**if enable is true, disable everything */ - if(isOneD) {box1D->show(); box1D->setEnabled(false); box2D->hide();} - if(!isOneD){box2D->show(); box2D->setEnabled(false); box1D->hide();} + //if enable is true, disable everything + if(isOrginallyOneD) {box1D->show(); box1D->setEnabled(false); box2D->hide();} + if(!isOrginallyOneD){box2D->show(); box2D->setEnabled(false); box1D->hide();} boxSnapshot->setEnabled(false); boxSave->setEnabled(false); boxFrequency->setEnabled(false); boxPlotAxis->setEnabled(false); boxScan->setEnabled(false); - }else { + }else if(radioDataGraph->isChecked()){ + cout << " - DataGraph" << endl; myPlot->EnablePlot(true); - /**if enable is true, disable everything */ - if(isOneD) {box1D->show();box1D->setEnabled(true);} else box1D->hide(); - if(!isOneD){box2D->show();box2D->setEnabled(true);} else box2D->hide(); + //if enable is true, disable everything + if(isOrginallyOneD) {box1D->show();box1D->setEnabled(true);} else box1D->hide(); + if(!isOrginallyOneD){box2D->show();box2D->setEnabled(true);} else box2D->hide(); + Select1DPlot(isOrginallyOneD); boxSnapshot->setEnabled(true); boxSave->setEnabled(true); boxFrequency->setEnabled(true); boxPlotAxis->setEnabled(true); - - if(radioHistogram->isChecked()) - boxScan->setEnabled(false); - else - //check first if there is a scan from actions tab - boxScan->setEnabled(false); + }else{ + cout << " - Histogram" << endl; + myPlot->EnablePlot(true); + Select1DPlot(false); + box1D->hide(); + box2D->show(); + box2D->setEnabled(true); + boxSnapshot->setEnabled(true); + boxSave->setEnabled(true); + boxFrequency->setEnabled(false); + boxPlotAxis->setEnabled(true); + boxScan->setEnabled(false); + myPlot->SetPlotTimer(250); + emit ThresholdScanSignal(0); } } @@ -405,7 +430,7 @@ void qTabPlot::SetFrequency(){ stackedLayout->setCurrentIndex(comboFrequency->currentIndex()); switch(comboFrequency->currentIndex()){ case 0: - /* Get the time interval from gui in ms*/ + // Get the time interval from gui in ms timeMS = (qDefs::getNSTime((qDefs::timeUnit)comboTimeGapUnit->currentIndex(),spinTimeGap->value()))/(1e6); if(timeMSsetValue(minPlotTimer); comboTimeGapUnit->setCurrentIndex(qDefs::MILLISECONDS); } - /**This is done so that its known which one was selected */ + //This is done so that its known which one was selected myPlot->SetFrameFactor(0); - /** Setting the timer value(ms) between plots */ + // Setting the timer value(ms) between plots myPlot->SetPlotTimer(timeMS); #ifdef VERBOSE - cout<<"Plotting Frequency: Time Gap - "<value()<currentIndex())<value() << qDefs::getUnitString((qDefs::timeUnit)comboTimeGapUnit->currentIndex()) << endl; #endif break; case 1: acqPeriodMS = (myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,-1)*(1E-6)); - /** gets the acq period * number of nth frames*/ + // gets the acq period * number of nth frames timeMS = (spinNthFrame->value())*acqPeriodMS; - /** To make sure the period between plotting is not less than minimum plot timer in ms*/ + // To make sure the period between plotting is not less than minimum plot timer in ms if(timeMSPlot Tab: Interval between Plots - The nth Image must be larger.

" @@ -434,10 +459,10 @@ void qTabPlot::SetFrequency(){ "for the chosen Acquisition Period.","Plot"); spinNthFrame->setValue(minFrame); } - /** Setting the timer value (nth frames) between plots */ + // Setting the timer value (nth frames) between plots myPlot->SetFrameFactor(spinNthFrame->value()); #ifdef VERBOSE - cout<<"Plotting Frequency: Nth Frame - "<value()<value() << endl; #endif break; } @@ -451,10 +476,13 @@ void qTabPlot::SetFrequency(){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void qTabPlot::EnableScanBox(bool enable,int id){ - /**find out when this is enabled*/ +void qTabPlot::EnableScanBox(int mode,int id){ +#ifdef VERBOSE + cout << "Entering Enable Scan Box()" << endl; +#endif - scanLevel[id]=enable; + + scanLevel[id]=mode; //both are disabled if((!scanLevel[0])&&(!scanLevel[1])){ boxScan->setEnabled(false); @@ -467,22 +495,30 @@ void qTabPlot::EnableScanBox(bool enable,int id){ else{ if(!boxScan->isEnabled()) { boxScan->setEnabled(true); - radioFileIndex->setEnabled(false); + radioFileIndex->setEnabled(false);/**???*/ } //disable one and check the other if(id) { - radioLevel0->setEnabled(!enable); - radioLevel0->setChecked(!enable); - radioLevel1->setEnabled(enable); - radioLevel1->setChecked(enable); + radioLevel0->setEnabled(!mode); + radioLevel0->setChecked(!mode); + radioLevel1->setEnabled(mode); + radioLevel1->setChecked(mode); }else{ - radioLevel0->setEnabled(enable); - radioLevel0->setChecked(enable); - radioLevel1->setEnabled(!enable); - radioLevel1->setChecked(!enable); + radioLevel0->setEnabled(mode); + radioLevel0->setChecked(mode); + radioLevel1->setEnabled(!mode); + radioLevel1->setChecked(!mode); } } - /**if(boxScan->isEnabled()){ + + //check for threshold + if((scanLevel[0]==2)||(scanLevel[1]==2)) + radioHistogram->setChecked(true); + else + radioDataGraph->setChecked(true); + + /* + if(boxScan->isEnabled()){ myDet->setPlotType(i); }*/ } From 423a47cd9e4b40c73f6d6d77efd6be8bfd1d7969 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 17 Aug 2012 10:29:46 +0000 Subject: [PATCH 029/332] git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@29 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_detectormain.ui | 2 - .../forms/form_energy_calibration.ui | 350 ++++++++++++++++++ slsDetectorGui/forms/form_tab_advanced.ui | 95 ----- slsDetectorGui/include/qDetectorMain.h | 3 + slsDetectorGui/include/qEnergyCalibration.h | 59 +++ slsDetectorGui/include/qTabAdvanced.h | 11 +- slsDetectorGui/src/qDetectorMain.cpp | 10 - slsDetectorGui/src/qEnergyCalibration.cpp | 58 +++ slsDetectorGui/src/qTabAdvanced.cpp | 37 +- slsDetectorGui/src/qTabMeasurement.cpp | 19 +- 10 files changed, 486 insertions(+), 158 deletions(-) create mode 100644 slsDetectorGui/forms/form_energy_calibration.ui create mode 100644 slsDetectorGui/include/qEnergyCalibration.h create mode 100644 slsDetectorGui/src/qEnergyCalibration.cpp diff --git a/slsDetectorGui/forms/form_detectormain.ui b/slsDetectorGui/forms/form_detectormain.ui index ea4ae989a..e7aedd325 100644 --- a/slsDetectorGui/forms/form_detectormain.ui +++ b/slsDetectorGui/forms/form_detectormain.ui @@ -232,8 +232,6 @@ - -
diff --git a/slsDetectorGui/forms/form_energy_calibration.ui b/slsDetectorGui/forms/form_energy_calibration.ui new file mode 100644 index 000000000..058aac8ad --- /dev/null +++ b/slsDetectorGui/forms/form_energy_calibration.ui @@ -0,0 +1,350 @@ + + + EnergyCalibrationObject + + + + 0 + 0 + 500 + 300 + + + + + 0 + 0 + + + + Energy Calibration + + + false + + + QWizard::ModernStyle + + + Qt::AutoText + + + + + 0 + 0 + + + + ArrowCursor + + + Qt::NoFocus + + + + + + <font color = "darkblue">Calibration Setup</font> + + + + + + + 30 + + + 9 + + + 9 + + + 9 + + + 5 + + + + + + 0 + 0 + + + + Qt::NoFocus + + + Start New Calibration + + + + + + + + 0 + 0 + + + + Qt::NoFocus + + + Add to Existing Calibration + + + + + + + + 0 + 0 + + + + Qt::NoFocus + + + Generate Calibration Files + + + + + + + + 0 + 0 + + + + Qt::NoFocus + + + Detector Online + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 15 + + + + + + + + + 0 + 0 + + + + <font color="red">No File Selected</font> + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + + + 0 + 0 + + + + <font color = "darkblue">Summary of the Calibration</font> + + + + + + + 30 + + + + + Settings: + + + + + + + + Standard + + + + + Fast + + + + + High Gain + + + + + Dynamic Gain + + + + + Low Gain + + + + + Medium Gain + + + + + Very High Gain + + + + + + + + Number of Modules: + + + + + + + + + + Serial Numbers: + + + + + + + true + + + + + + + Number of energies: + + + + + + + Energies: + + + + + + + + <font color = "darkblue">Add Calibration Step</font> + + + + + + + + <font color = "darkblue">Add Calibration Step OFFLINE</font> + + + + + + + + <font color = "darkblue">Finalize Calibration</font> + + + + + + + + <font color = "darkblue">Fit Module</font> + + + + + + + + <font color = "darkblue">Linear Fit of Module</font> + + + + + + + + <font color = "darkblue">Error</font> + + + + + + + + <font color = "darkblue">Calibrating...</font> + + + + + + + + <font color = "darkblue">Finished</font> + + + + + + + + + diff --git a/slsDetectorGui/forms/form_tab_advanced.ui b/slsDetectorGui/forms/form_tab_advanced.ui index b871f7575..30075ae9b 100644 --- a/slsDetectorGui/forms/form_tab_advanced.ui +++ b/slsDetectorGui/forms/form_tab_advanced.ui @@ -44,101 +44,6 @@ PushButton - - - - 10 - 14 - 91 - 41 - - - - Qt::NoFocus - - - Gets both the temperature of ADC and FPGA - - - Get -Temperature - - - - - - 180 - 40 - 151 - 21 - - - - Reads temperature of FPGA. - #temp_fpga# - - - false - - - Qt::AlignCenter - - - true - - - - - - 120 - 10 - 41 - 20 - - - - ADC: - - - - - - 120 - 40 - 41 - 20 - - - - FPGA: - - - - - - 180 - 10 - 151 - 21 - - - - Reads temperature of ADC. - #temp_adc# - - - - - - false - - - Qt::AlignCenter - - - true - -
diff --git a/slsDetectorGui/include/qDetectorMain.h b/slsDetectorGui/include/qDetectorMain.h index 476c33022..5142b62b8 100644 --- a/slsDetectorGui/include/qDetectorMain.h +++ b/slsDetectorGui/include/qDetectorMain.h @@ -28,6 +28,8 @@ class multiSlsDetector; #include #include +#include +using namespace std; /** To Over-ride the QTabWidget class to get the tabBar */ class MyTabWidget:public QTabWidget{ @@ -103,6 +105,7 @@ private: qTabDeveloper *tab_developer; /**Messages tab */ qTabMessages *tab_messages; + /**if the developer tab should be enabled,known from command line */ int isDeveloper; diff --git a/slsDetectorGui/include/qEnergyCalibration.h b/slsDetectorGui/include/qEnergyCalibration.h new file mode 100644 index 000000000..e33ed3584 --- /dev/null +++ b/slsDetectorGui/include/qEnergyCalibration.h @@ -0,0 +1,59 @@ +/* + * qEnergyCalibration.h + * + * Created on: May 10, 2012 + * Author: l_maliakal_d + */ + +#ifndef QENERGY_CALIBRATION_H_ +#define QENERGY_CALIBRATION_H_ + +/** Form Header */ +#include "ui_form_energy_calibration.h" +/** Project Class Headers */ +class multiSlsDetector; + +/** + *@short sets up the advanced parameters + */ +class qEnergyCalibration:public QWizard, private Ui::EnergyCalibrationObject{ + Q_OBJECT + +public: + /** \short The constructor + * @param parent is the parent tab widget + * @param detector is the detector returned from the detector tab + */ + qEnergyCalibration(QWidget *parent,multiSlsDetector*& detector); + + /** Destructor + */ + ~qEnergyCalibration(); + + /** To refresh and update widgets + */ + void Refresh(); + + +private: + /** The sls detector object */ + multiSlsDetector *myDet; + + /** Sets up the widget + */ + void SetupWidgetWindow(); + + /** Sets up all the slots and signals + */ + void Initialization(); + + + +private slots: + + +}; + + + +#endif /* QENERGY_CALIBRATION_H_ */ diff --git a/slsDetectorGui/include/qTabAdvanced.h b/slsDetectorGui/include/qTabAdvanced.h index a0573418f..e6fff7459 100644 --- a/slsDetectorGui/include/qTabAdvanced.h +++ b/slsDetectorGui/include/qTabAdvanced.h @@ -39,9 +39,6 @@ private: /** The sls detector object */ multiSlsDetector *myDet; - /** The sls detector object type*/ - int myDetType; - /** Sets up the widget */ void SetupWidgetWindow(); @@ -50,14 +47,10 @@ private: */ void Initialization(); - /** Enables/Disables all the widgets - */ - void Enable(bool enable); + private slots: -/** Get Temperature data - */ -void getTemperature(); + }; diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 72e4aea25..8a5f28509 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -357,16 +357,6 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ qDefs::InfoMessage("The configuration parameters have been successfully saved.","Main"); } } - else if(action==actionEnergyCalibration){ -#ifdef VERBOSE - cout << "Executing Energy Calibration" << endl; -#endif - } - else{ -#ifdef VERBOSE - cout << "Executing Angular Calibration" << endl; -#endif - } Refresh(tabs->currentIndex()); } diff --git a/slsDetectorGui/src/qEnergyCalibration.cpp b/slsDetectorGui/src/qEnergyCalibration.cpp new file mode 100644 index 000000000..d543ccbba --- /dev/null +++ b/slsDetectorGui/src/qEnergyCalibration.cpp @@ -0,0 +1,58 @@ +/* + * qEnergyCalibration.cpp + * + * Created on: May 10, 2012 + * Author: l_maliakal_d + */ +#include "qEnergyCalibration.h" +#include "qDefs.h" +/** Project Class Headers */ +#include "slsDetector.h" +#include "multiSlsDetector.h" +/** C++ Include Headers */ +#include +using namespace std; + + + + +qEnergyCalibration::qEnergyCalibration(QWidget *parent,multiSlsDetector*& detector):QWizard(parent),myDet(detector){ + setupUi(this); + SetupWidgetWindow(); + Initialization(); +} + + + + +qEnergyCalibration::~qEnergyCalibration(){ + delete myDet; +} + + + + +void qEnergyCalibration::SetupWidgetWindow(){ + +} + + + +void qEnergyCalibration::Initialization(){ + +} + + + + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qEnergyCalibration::Refresh(){ + +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp index bc9be2167..6825b7307 100644 --- a/slsDetectorGui/src/qTabAdvanced.cpp +++ b/slsDetectorGui/src/qTabAdvanced.cpp @@ -18,7 +18,6 @@ using namespace std; qTabAdvanced::qTabAdvanced(QWidget *parent,multiSlsDetector*& detector):QWidget(parent),myDet(detector){ setupUi(this); - myDetType = (int)myDet->getDetectorsType(); SetupWidgetWindow(); Initialization(); } @@ -34,48 +33,16 @@ qTabAdvanced::~qTabAdvanced(){ void qTabAdvanced::SetupWidgetWindow(){ - /** Temperature */ - if(myDetType==slsDetectorDefs::GOTTHARD) - getTemperature(); //check if gotthard??? - else{ - btnTemp->setEnabled(false); - dispTempAdc->setEnabled(false); - dispTempFpga->setEnabled(false); - } + } void qTabAdvanced::Initialization(){ - /** Temperature */ - connect(btnTemp,SIGNAL(clicked()),this,SLOT(getTemperature()));//check if gotthard??? + } - -void qTabAdvanced::Enable(bool enable){ - btnTemp->setEnabled(enable); - dispTempAdc->setEnabled(enable); - dispTempFpga->setEnabled(enable); - pushButton->setEnabled(enable); -} - - -void qTabAdvanced::getTemperature(){ - char ctemp[200]; - /** adc */ - double tempadc = myDet->getADC(slsDetectorDefs::TEMPERATURE_ADC); - sprintf(ctemp,"%f%cC",tempadc,0x00B0); - dispTempAdc->setText(QString(ctemp)); - /** fpga */ - double tempfpga = myDet->getADC(slsDetectorDefs::TEMPERATURE_FPGA); - sprintf(ctemp,"%f%cC",tempfpga,0x00B0); - dispTempFpga->setText(QString(ctemp)); -#ifdef VERBOSE - cout<<"Temperature of ADC: "<setExternalCommunicationMode(slsDetectorDefs::AUTO_TIMING)==slsDetectorDefs::AUTO_TIMING) success = true; break; - case Auto://Number of Frames, Exposure Time, Acquisition Period + case Auto://#Frames, ExpTime, Period + setNumTriggers(1); lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true); lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true); if(myDet->setExternalCommunicationMode(slsDetectorDefs::AUTO_TIMING)==slsDetectorDefs::AUTO_TIMING) success = true; break; - case Trigger_Exp_Series://Number of Frames, Exposure Time, Acquisition Period, Number of Triggers, Delay + case Trigger_Exp_Series://#Frames, #Triggers, ExpTime, Period, Delay lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true); lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true); @@ -505,13 +506,15 @@ void qTabMeasurement::SetTimingMode(int mode){ if(myDet->setExternalCommunicationMode(slsDetectorDefs::TRIGGER_EXPOSURE)==slsDetectorDefs::TRIGGER_EXPOSURE) success = true; break; - case Trigger_Frame://Exposure Time, Number of Triggers + case Trigger_Frame://ExpTime, #Triggers + setNumFrames(1); lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true); lblNumTriggers->setEnabled(true); spinNumTriggers->setEnabled(true); if(myDet->setExternalCommunicationMode(slsDetectorDefs::TRIGGER_FRAME)==slsDetectorDefs::TRIGGER_FRAME) success = true; break; - case Trigger_Readout://Number of Frames, Exposure Time, Acquisition Period, Delay + case Trigger_Readout://#Frames, ExpTime, Period, Delay + setNumTriggers(1); lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true); lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true); @@ -519,13 +522,14 @@ void qTabMeasurement::SetTimingMode(int mode){ if(myDet->setExternalCommunicationMode(slsDetectorDefs::TRIGGER_READOUT)==slsDetectorDefs::TRIGGER_READOUT) success = true; break; - case Gated://Number of Frames, Number of Gates + case Gated://#Frames, #Gates + setNumTriggers(1); lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); lblNumGates->setEnabled(true); spinNumGates->setEnabled(true); if(myDet->setExternalCommunicationMode(slsDetectorDefs::GATE_FIX_NUMBER)==slsDetectorDefs::GATE_FIX_NUMBER) success = true; break; - case Gated_Start://Number of Frames, Exposure Time, Acquisition Period, Number of Triggers, Number of Gates + case Gated_Start://#Frames, #Triggers, #Gates, ExpTime, Period lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true); lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true); @@ -534,7 +538,8 @@ void qTabMeasurement::SetTimingMode(int mode){ if(myDet->setExternalCommunicationMode(slsDetectorDefs::GATE_WITH_START_TRIGGER)==slsDetectorDefs::GATE_WITH_START_TRIGGER) success = true; break; - case Trigger_Window://Number of Triggers + case Trigger_Window://#Triggers + setNumFrames(1); lblNumTriggers->setEnabled(true); spinNumTriggers->setEnabled(true); if(myDet->setExternalCommunicationMode(slsDetectorDefs::TRIGGER_WINDOW)==slsDetectorDefs::TRIGGER_WINDOW) success = true; From 92406bf6a8abc3b90e655ddf927917d86ebed6b1 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 17 Aug 2012 10:35:39 +0000 Subject: [PATCH 030/332] energy calibration is not needed anymore git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@30 af1100a4-978c-4157-bff7-07162d2ba061 --- .../forms/form_energy_calibration.ui | 350 ------------------ slsDetectorGui/include/qEnergyCalibration.h | 59 --- slsDetectorGui/src/qEnergyCalibration.cpp | 58 --- 3 files changed, 467 deletions(-) delete mode 100644 slsDetectorGui/forms/form_energy_calibration.ui delete mode 100644 slsDetectorGui/include/qEnergyCalibration.h delete mode 100644 slsDetectorGui/src/qEnergyCalibration.cpp diff --git a/slsDetectorGui/forms/form_energy_calibration.ui b/slsDetectorGui/forms/form_energy_calibration.ui deleted file mode 100644 index 058aac8ad..000000000 --- a/slsDetectorGui/forms/form_energy_calibration.ui +++ /dev/null @@ -1,350 +0,0 @@ - - - EnergyCalibrationObject - - - - 0 - 0 - 500 - 300 - - - - - 0 - 0 - - - - Energy Calibration - - - false - - - QWizard::ModernStyle - - - Qt::AutoText - - - - - 0 - 0 - - - - ArrowCursor - - - Qt::NoFocus - - - - - - <font color = "darkblue">Calibration Setup</font> - - - - - - - 30 - - - 9 - - - 9 - - - 9 - - - 5 - - - - - - 0 - 0 - - - - Qt::NoFocus - - - Start New Calibration - - - - - - - - 0 - 0 - - - - Qt::NoFocus - - - Add to Existing Calibration - - - - - - - - 0 - 0 - - - - Qt::NoFocus - - - Generate Calibration Files - - - - - - - - 0 - 0 - - - - Qt::NoFocus - - - Detector Online - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 15 - - - - - - - - - 0 - 0 - - - - <font color="red">No File Selected</font> - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - - 0 - 0 - - - - <font color = "darkblue">Summary of the Calibration</font> - - - - - - - 30 - - - - - Settings: - - - - - - - - Standard - - - - - Fast - - - - - High Gain - - - - - Dynamic Gain - - - - - Low Gain - - - - - Medium Gain - - - - - Very High Gain - - - - - - - - Number of Modules: - - - - - - - - - - Serial Numbers: - - - - - - - true - - - - - - - Number of energies: - - - - - - - Energies: - - - - - - - - <font color = "darkblue">Add Calibration Step</font> - - - - - - - - <font color = "darkblue">Add Calibration Step OFFLINE</font> - - - - - - - - <font color = "darkblue">Finalize Calibration</font> - - - - - - - - <font color = "darkblue">Fit Module</font> - - - - - - - - <font color = "darkblue">Linear Fit of Module</font> - - - - - - - - <font color = "darkblue">Error</font> - - - - - - - - <font color = "darkblue">Calibrating...</font> - - - - - - - - <font color = "darkblue">Finished</font> - - - - - - - - - diff --git a/slsDetectorGui/include/qEnergyCalibration.h b/slsDetectorGui/include/qEnergyCalibration.h deleted file mode 100644 index e33ed3584..000000000 --- a/slsDetectorGui/include/qEnergyCalibration.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * qEnergyCalibration.h - * - * Created on: May 10, 2012 - * Author: l_maliakal_d - */ - -#ifndef QENERGY_CALIBRATION_H_ -#define QENERGY_CALIBRATION_H_ - -/** Form Header */ -#include "ui_form_energy_calibration.h" -/** Project Class Headers */ -class multiSlsDetector; - -/** - *@short sets up the advanced parameters - */ -class qEnergyCalibration:public QWizard, private Ui::EnergyCalibrationObject{ - Q_OBJECT - -public: - /** \short The constructor - * @param parent is the parent tab widget - * @param detector is the detector returned from the detector tab - */ - qEnergyCalibration(QWidget *parent,multiSlsDetector*& detector); - - /** Destructor - */ - ~qEnergyCalibration(); - - /** To refresh and update widgets - */ - void Refresh(); - - -private: - /** The sls detector object */ - multiSlsDetector *myDet; - - /** Sets up the widget - */ - void SetupWidgetWindow(); - - /** Sets up all the slots and signals - */ - void Initialization(); - - - -private slots: - - -}; - - - -#endif /* QENERGY_CALIBRATION_H_ */ diff --git a/slsDetectorGui/src/qEnergyCalibration.cpp b/slsDetectorGui/src/qEnergyCalibration.cpp deleted file mode 100644 index d543ccbba..000000000 --- a/slsDetectorGui/src/qEnergyCalibration.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * qEnergyCalibration.cpp - * - * Created on: May 10, 2012 - * Author: l_maliakal_d - */ -#include "qEnergyCalibration.h" -#include "qDefs.h" -/** Project Class Headers */ -#include "slsDetector.h" -#include "multiSlsDetector.h" -/** C++ Include Headers */ -#include -using namespace std; - - - - -qEnergyCalibration::qEnergyCalibration(QWidget *parent,multiSlsDetector*& detector):QWizard(parent),myDet(detector){ - setupUi(this); - SetupWidgetWindow(); - Initialization(); -} - - - - -qEnergyCalibration::~qEnergyCalibration(){ - delete myDet; -} - - - - -void qEnergyCalibration::SetupWidgetWindow(){ - -} - - - -void qEnergyCalibration::Initialization(){ - -} - - - - - -//------------------------------------------------------------------------------------------------------------------------------------------------- - - -void qEnergyCalibration::Refresh(){ - -} - - -//------------------------------------------------------------------------------------------------------------------------------------------------- - From 685e236828bd5c7a8a71dc3dcf89c38a143d1765 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 17 Aug 2012 10:37:06 +0000 Subject: [PATCH 031/332] energy calibration is not needed anymore git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@31 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qTabMeasurement.h | 2 +- slsDetectorGui/src/qDetectorMain.cpp | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/slsDetectorGui/include/qTabMeasurement.h b/slsDetectorGui/include/qTabMeasurement.h index ddb24149d..a5fff4c01 100644 --- a/slsDetectorGui/include/qTabMeasurement.h +++ b/slsDetectorGui/include/qTabMeasurement.h @@ -98,13 +98,13 @@ void UpdateFinished(); */ void SetCurrentMeasurement(int val); +private slots: /** Sets the timing mode * @ param mode cane be None, Auto, Gated, Trigger Exposure Series, * Trigger Frame, Trigger Readout, External Trigger Window */ void SetTimingMode(int mode); -private slots: /** Set number of measurements * @param num number of measurements to be set */ void setNumMeasurements(int num); diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 8a5f28509..58bbc32c2 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -224,7 +224,6 @@ void qDetectorMain::Initialization(){ connect(tab_measurement, SIGNAL(CheckPlotIntervalSignal()), tab_plot,SLOT(SetFrequency())); // Plot tab connect(tab_plot, SIGNAL(DisableZoomSignal(bool)), this,SLOT(SetZoomToolTip(bool))); - connect(tab_plot, SIGNAL(ThresholdScanSignal(int)), tab_measurement,SLOT(SetTimingMode(int))); // Actions tab connect(tab_actions, SIGNAL(EnableScanBox(int,int)), tab_plot,SLOT(EnableScanBox(int,int))); // Plotting From b21b4d066cdb452918378f8328b5b4bb385b9baa Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 17 Aug 2012 13:12:08 +0000 Subject: [PATCH 032/332] included high voltage for developer tab in gotthard git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@32 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qTabDeveloper.h | 12 +++- slsDetectorGui/src/qTabDeveloper.cpp | 99 ++++++++++++++++++++++++-- 2 files changed, 104 insertions(+), 7 deletions(-) diff --git a/slsDetectorGui/include/qTabDeveloper.h b/slsDetectorGui/include/qTabDeveloper.h index ab1ca4c1b..525e372d1 100644 --- a/slsDetectorGui/include/qTabDeveloper.h +++ b/slsDetectorGui/include/qTabDeveloper.h @@ -16,9 +16,12 @@ class multiSlsDetector; #include #include #include +#include #include #include #include +#include +#include /** C++ Include Headers */ #include #include @@ -92,8 +95,12 @@ private: QLabel *lblAdcs[20]; MyDoubleSpinBox *spinDacs[20]; QDoubleSpinBox *spinAdcs[20]; + QLabel *lblHV; + QComboBox *comboHV; QTimer *adcTimer; - + QGridLayout *dacLayout; + QString tipHV; + QPalette red; /** Sets up the widget */ void SetupWidgetWindow(); @@ -128,6 +135,9 @@ void RefreshAdcs(); */ void SetDacValues(int id); +/** Set High Voltage + */ +void SetHighVoltage(); }; diff --git a/slsDetectorGui/src/qTabDeveloper.cpp b/slsDetectorGui/src/qTabDeveloper.cpp index 015df584c..9abd46c6d 100644 --- a/slsDetectorGui/src/qTabDeveloper.cpp +++ b/slsDetectorGui/src/qTabDeveloper.cpp @@ -47,7 +47,12 @@ void qTabDeveloper::SetupWidgetWindow(){ //Detector Type detType=myDet->getDetectorsType(); - //the nu + //palette + red = QPalette(); + red.setColor(QPalette::Active,QPalette::WindowText,Qt::red); + + + //the number of dacs and adcs switch(detType){ case slsDetectorDefs::MYTHEN: NUM_DAC_WIDGETS = 6; @@ -102,8 +107,31 @@ void qTabDeveloper::SetupWidgetWindow(){ //dacs boxDacs = new QGroupBox("Dacs",this); boxDacs->setFixedHeight(25+(NUM_DAC_WIDGETS/2)*35); - layout->addWidget(boxDacs,0,0); CreateDACWidgets(); + + //HV for gotthard + if(detType==slsDetectorDefs::GOTTHARD){ + boxDacs->setFixedHeight(boxDacs->height()+35); + + lblHV = new QLabel("High Voltage",boxDacs); + comboHV = new QComboBox(boxDacs); + comboHV->addItem("0"); + comboHV->addItem("90"); + comboHV->addItem("110"); + comboHV->addItem("120"); + comboHV->addItem("150"); + comboHV->addItem("180"); + comboHV->addItem("200"); + tipHV = "Set high voltage to 0, 90, 110, 120, 150 or 200V."; + lblHV->setToolTip(tipHV); + comboHV->setToolTip(tipHV); + dacLayout->addWidget(lblHV,(int)(NUM_DAC_WIDGETS/2),1); + dacLayout->addWidget(comboHV,(int)(NUM_DAC_WIDGETS/2),2); + connect(comboHV, SIGNAL(currentIndexChanged(int)), this, SLOT(SetHighVoltage())); + } + layout->addWidget(boxDacs,0,0); + + //adcs if((detType==slsDetectorDefs::GOTTHARD)||(detType==slsDetectorDefs::AGIPD)){ setFixedHeight((50+(NUM_DAC_WIDGETS/2)*35)+(50+(NUM_ADC_WIDGETS/2)*35)); @@ -138,7 +166,7 @@ void qTabDeveloper::Initialization(){ void qTabDeveloper::CreateDACWidgets(){ - QGridLayout *dacLayout = new QGridLayout(boxDacs); + dacLayout = new QGridLayout(boxDacs); for(int i=0;ivalue() << endl; + cout << "Setting dac:" << dacNames[id] << " : " << spinDacs[id]->value() << endl; #endif + spinDacs[id]->setValue((double)myDet->setDAC((dacs_t)spinDacs[id]->value(),getSLSIndex(id))); +} - spinDacs[id]->setValue((double)myDet->setDAC(spinDacs[id]->value(),getSLSIndex(id))); + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabDeveloper::SetHighVoltage(){ +#ifdef VERBOSE + cout << "Setting high voltage:" << comboHV->currentText().toAscii().constData() << endl; +#endif + int highvoltage = comboHV->currentText().toInt(); + int ret = myDet->setDAC(highvoltage,slsDetectorDefs::HV_POT); + //error + if(ret != highvoltage){ + qDefs::ErrorMessage("High Voltage could not be set to this value.","Developer"); + lblHV->setPalette(red); + lblHV->setText("High Voltage:*"); + QString errTip = tipHV+QString("

High Voltage could not be set. The return value is ")+ + QString::number(ret)+ QString(""); + lblHV->setToolTip(errTip); + comboHV->setToolTip(errTip); + }else{ + lblHV->setPalette(lblDacs[0]->palette()); + lblHV->setText("High Voltage:"); + lblHV->setToolTip(tipHV); + comboHV->setToolTip(tipHV); + } } @@ -223,7 +277,7 @@ slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(int index){ case 6: return slsDetectorDefs::G_VREF_COMP; case 7: return slsDetectorDefs::G_IB_TESTC; case 8: return slsDetectorDefs::TEMPERATURE_ADC; - case 9: return slsDetectorDefs::TEMPERATURE_FPGA; + case 9:return slsDetectorDefs::TEMPERATURE_FPGA; default: qDefs::ErrorMessage("Unknown DAC/ADC Index. Weird Error","Developer"); Refresh(); @@ -263,6 +317,39 @@ void qTabDeveloper::Refresh(){ spinDacs[i]->setValue((double)myDet->setDAC(-1,getSLSIndex(i))); //adcs RefreshAdcs(); + + //gotthard -high voltage + if(detType == slsDetectorDefs::GOTTHARD){ + disconnect(comboHV, SIGNAL(currentIndexChanged(int)), this, SLOT(SetHighVoltage())); + + //default should be correct + lblHV->setPalette(lblDacs[0]->palette()); + lblHV->setText("High Voltage:"); + lblHV->setToolTip(tipHV); + comboHV->setToolTip(tipHV); + //getting hv value + int ret = myDet->setDAC(-1,slsDetectorDefs::HV_POT); + switch(ret){ + case 0: comboHV->setCurrentIndex(0);break; + case 90: comboHV->setCurrentIndex(1);break; + case 110: comboHV->setCurrentIndex(2);break; + case 120: comboHV->setCurrentIndex(3);break; + case 150: comboHV->setCurrentIndex(4);break; + case 180: comboHV->setCurrentIndex(5);break; + case 200: comboHV->setCurrentIndex(6);break; + default: comboHV->setCurrentIndex(0);//error + lblHV->setPalette(red); + lblHV->setText("High Voltage:*"); + QString errTip = tipHV+QString("

High Voltage could not be set. The return value is ")+ + QString::number(ret)+ QString(""); + lblHV->setToolTip(errTip); + comboHV->setToolTip(errTip); + break; + } + + connect(comboHV, SIGNAL(currentIndexChanged(int)), this, SLOT(SetHighVoltage())); + } + } From 6c19d75359698f0b05cd46800042423d6462d7a9 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 17 Aug 2012 13:16:02 +0000 Subject: [PATCH 033/332] included high voltage for developer tab in gotthard git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@33 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qScanWidget.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/slsDetectorGui/src/qScanWidget.cpp b/slsDetectorGui/src/qScanWidget.cpp index 89d919b33..5331ca144 100644 --- a/slsDetectorGui/src/qScanWidget.cpp +++ b/slsDetectorGui/src/qScanWidget.cpp @@ -175,9 +175,9 @@ void qScanWidget::Initialization(){ //precision connect(spinPrecision, SIGNAL(valueChanged(int)), this, SLOT(SetPrecision(int))); //range values - connect(spinFrom, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); - connect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); - connect(spinSize, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); + connect(spinFrom, SIGNAL(editingFinished()), this, SLOT(SetRangeSteps())); + connect(spinTo, SIGNAL(editingFinished()), this, SLOT(SetRangeSteps())); + connect(spinSize, SIGNAL(editingFinished()), this, SLOT(SetRangeSteps())); //custom values connect(comboCustom, SIGNAL(currentIndexChanged(int)), this, SLOT(SetCustomSteps())); connect(btnCustom, SIGNAL(clicked()), this, SLOT(DeleteCustomSteps())); @@ -510,15 +510,15 @@ void qScanWidget::SetNSteps(int num){ if(radioRange->isChecked()){ //calculate the step size and display it if(num==1){ - disconnect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); + disconnect(spinTo, SIGNAL(editingFinished()), this, SLOT(SetRangeSteps())); spinTo->setValue(spinFrom->value()); - connect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); + connect(spinTo, SIGNAL(editingFinished()), this, SLOT(SetRangeSteps())); }else if(num>1) num--; double stepSize = (spinTo->value()-spinFrom->value())/num; - disconnect(spinSize,SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); + disconnect(spinSize,SIGNAL(editingFinished()), this, SLOT(SetRangeSteps())); spinSize->setValue(stepSize); - connect(spinSize, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); + connect(spinSize, SIGNAL(editingFinished()), this, SLOT(SetRangeSteps())); //set these positions SetRangeSteps(); }else if(radioCustom->isChecked()){ @@ -541,9 +541,9 @@ void qScanWidget::SetRangeSteps(){ double sizeVal = spinSize->value(); //if step size is 0, min and max should be same if(!sizeVal){ - disconnect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); + disconnect(spinTo, SIGNAL(editingFinished()), this, SLOT(SetRangeSteps())); spinTo->setValue(fromVal); - connect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); + connect(spinTo, SIGNAL(editingFinished()), this, SLOT(SetRangeSteps())); QString tip = rangeTip + QString("

" "Note: Increase the step size from zero to be able to change the range."); lblSize->setToolTip(tip); @@ -563,9 +563,9 @@ void qScanWidget::SetRangeSteps(){ //actualNumSteps will be negative if fromsetValue(-1*sizeVal); - connect(spinSize, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); + connect(spinSize, SIGNAL(editingFinished()), this, SLOT(SetRangeSteps())); sizeVal = spinSize->value(); } //increment is required like vice versa in setNSteps From 40af9384b54fd6e40831f6ff2ec824bea6f61b5d Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 17 Aug 2012 14:31:47 +0000 Subject: [PATCH 034/332] fixed the losing focus too often problem in rangeSizeWidget for scanwidget git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@34 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/slsDetectorGui.pro | 2 +- slsDetectorGui/src/qScanWidget.cpp | 85 ++++++++++++++++++++++++------ 2 files changed, 69 insertions(+), 18 deletions(-) diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index 60f610edb..c7593e21e 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -6,7 +6,7 @@ UI_HEADERS_DIR = forms/include RESOURCES += icons.qrc -DEFINES += VERBOSE DACS_INT +DEFINES += VERBOSE DACS_INT VERYVERBOSE target.path += $(DESTDIR) diff --git a/slsDetectorGui/src/qScanWidget.cpp b/slsDetectorGui/src/qScanWidget.cpp index 5331ca144..8ce46108e 100644 --- a/slsDetectorGui/src/qScanWidget.cpp +++ b/slsDetectorGui/src/qScanWidget.cpp @@ -87,17 +87,21 @@ void qScanWidget::SetupWidgetWindow(){ spinFrom->setValue(0); spinFrom->setToolTip(rangeTip); spinFrom->setMaximum(1000000); + spinFrom->setKeyboardTracking(false); lblTo->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); lblTo->setToolTip(rangeTip); spinTo->setValue(1); spinTo->setToolTip(rangeTip); spinTo->setMaximum(1000000); + spinTo->setKeyboardTracking(false); lblSize->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); lblSize->setToolTip(rangeTip); lblSize->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); lblSize->setFixedWidth(67); spinSize->setValue(1); + spinSize->setSingleStep(0.1); spinSize->setToolTip(rangeTip); + spinSize->setKeyboardTracking(false); layoutRange->addItem(new QSpacerItem(40,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); layoutRange->addWidget(lblFrom); layoutRange->addItem(new QSpacerItem(5,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); @@ -175,9 +179,9 @@ void qScanWidget::Initialization(){ //precision connect(spinPrecision, SIGNAL(valueChanged(int)), this, SLOT(SetPrecision(int))); //range values - connect(spinFrom, SIGNAL(editingFinished()), this, SLOT(SetRangeSteps())); - connect(spinTo, SIGNAL(editingFinished()), this, SLOT(SetRangeSteps())); - connect(spinSize, SIGNAL(editingFinished()), this, SLOT(SetRangeSteps())); + connect(spinFrom, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); + connect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); + connect(spinSize, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); //custom values connect(comboCustom, SIGNAL(currentIndexChanged(int)), this, SLOT(SetCustomSteps())); connect(btnCustom, SIGNAL(clicked()), this, SLOT(DeleteCustomSteps())); @@ -191,8 +195,8 @@ void qScanWidget::Initialization(){ void qScanWidget::EnableSizeWidgets(){ -#ifdef VERBOSE - cout << "Entering enable size widgets" << endl; +#ifdef VERYVERBOSE + cout << "Entering EnableSizeWidgets()" << endl; #endif //setting to defaults is not done here as this is called even if mode changes //so only if its to change the size widget type, its set to default for the others @@ -286,6 +290,9 @@ void qScanWidget::EnableSizeWidgets(){ void qScanWidget::SetMode(int mode){ +#ifdef VERYVERBOSE + cout << "Entering SetMode()" << endl; +#endif #ifdef VERBOSE cout << "Setting\tscan:" << id << "\tmode:" << mode << endl; #endif @@ -332,6 +339,9 @@ void qScanWidget::SetMode(int mode){ int qScanWidget::SetScan(int mode){ +#ifdef VERYVERBOSE + cout << "Entering SetScan()" << endl; +#endif string parameter = string(dispParameter->text().toAscii().constData()); string script = string(dispScript->text().toAscii().constData()); #ifdef VERBOSE @@ -384,6 +394,9 @@ int qScanWidget::SetScan(int mode){ //------------------------------------------------------------------------------------------------------------------------------------------------- void qScanWidget::BrowsePath(){ +#ifdef VERYVERBOSE + cout << "Entering BrowsePath()" << endl; +#endif #ifdef VERBOSE cout << "Browsing Script File Path\tscan:" << id << endl; #endif @@ -404,6 +417,9 @@ void qScanWidget::BrowsePath(){ //------------------------------------------------------------------------------------------------------------------------------------------------- void qScanWidget::SetScriptFile(){ +#ifdef VERYVERBOSE + cout << "Entering SetScriptFile()" << endl; +#endif QString fName = dispScript->text();bool set = false; #ifdef VERBOSE cout << "Setting\tscan:" << id << "\tscript:" << fName.toAscii().constData() << endl; @@ -465,6 +481,9 @@ void qScanWidget::SetScriptFile(){ void qScanWidget::SetParameter(){ +#ifdef VERYVERBOSE + cout << "Entering SetParameter()" << endl; +#endif QString parameter = dispParameter->text(); #ifdef VERBOSE cout << "Setting\tscan:" << id << "\tparameter:" << parameter.toAscii().constData() << endl; @@ -485,6 +504,9 @@ void qScanWidget::SetParameter(){ void qScanWidget::SetPrecision(int value){ +#ifdef VERYVERBOSE + cout << "Entering SetPrecision()" << endl; +#endif #ifdef VERBOSE cout << "Setting\tscan:" << id << "\tprecision:" << value << endl; #endif @@ -498,7 +520,9 @@ void qScanWidget::SetPrecision(int value){ void qScanWidget::SetNSteps(int num){ - +#ifdef VERYVERBOSE + cout << "Entering SetNSteps()" << endl; +#endif #ifdef VERBOSE cout << "Setting number of steps" << endl; #endif @@ -510,15 +534,15 @@ void qScanWidget::SetNSteps(int num){ if(radioRange->isChecked()){ //calculate the step size and display it if(num==1){ - disconnect(spinTo, SIGNAL(editingFinished()), this, SLOT(SetRangeSteps())); + disconnect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); spinTo->setValue(spinFrom->value()); - connect(spinTo, SIGNAL(editingFinished()), this, SLOT(SetRangeSteps())); + connect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); }else if(num>1) num--; double stepSize = (spinTo->value()-spinFrom->value())/num; - disconnect(spinSize,SIGNAL(editingFinished()), this, SLOT(SetRangeSteps())); + disconnect(spinSize,SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); spinSize->setValue(stepSize); - connect(spinSize, SIGNAL(editingFinished()), this, SLOT(SetRangeSteps())); + connect(spinSize, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); //set these positions SetRangeSteps(); }else if(radioCustom->isChecked()){ @@ -534,6 +558,9 @@ void qScanWidget::SetNSteps(int num){ void qScanWidget::SetRangeSteps(){ +#ifdef VERYVERBOSE + cout << "Entering SetRangeSteps()" << endl; +#endif #ifdef VERBOSE cout << "Setting\tscan:" << id << "\trange\t"; #endif @@ -541,9 +568,9 @@ void qScanWidget::SetRangeSteps(){ double sizeVal = spinSize->value(); //if step size is 0, min and max should be same if(!sizeVal){ - disconnect(spinTo, SIGNAL(editingFinished()), this, SLOT(SetRangeSteps())); + disconnect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); spinTo->setValue(fromVal); - connect(spinTo, SIGNAL(editingFinished()), this, SLOT(SetRangeSteps())); + connect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); QString tip = rangeTip + QString("

" "Note: Increase the step size from zero to be able to change the range."); lblSize->setToolTip(tip); @@ -563,9 +590,9 @@ void qScanWidget::SetRangeSteps(){ //actualNumSteps will be negative if fromsetValue(-1*sizeVal); - connect(spinSize, SIGNAL(editingFinished()), this, SLOT(SetRangeSteps())); + connect(spinSize, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); sizeVal = spinSize->value(); } //increment is required like vice versa in setNSteps @@ -593,6 +620,11 @@ void qScanWidget::SetRangeSteps(){ if(SetScan(comboScript->currentIndex())==qDefs::OK){ char cId[5];sprintf(cId,"%d",id); QString script = dispScript->text(); + + disconnect(spinFrom, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); + disconnect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); + disconnect(spinSize, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); + //positions wont be loaded if its custom script if((comboScript->currentIndex()==CustomScript)&&((script=="")||(script=="none"))){ qDefs::InfoMessage(string("Scan Level ")+string(cId)+ @@ -613,6 +645,11 @@ void qScanWidget::SetRangeSteps(){ string(cNum)+string(""),"ScanWidget"); } } + + connect(spinFrom, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); + connect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); + connect(spinSize, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); + } } @@ -621,7 +658,9 @@ void qScanWidget::SetRangeSteps(){ int qScanWidget::SetCustomSteps(){ - +#ifdef VERYVERBOSE + cout << "Entering SetCustomSteps()" << endl; +#endif #ifdef VERBOSE cout << "Setting\tscan:" << id << "\tcustom\tnum pos:" << comboCustom->count() << endl; #endif @@ -707,6 +746,9 @@ int qScanWidget::SetCustomSteps(){ void qScanWidget::DeleteCustomSteps(){ +#ifdef VERYVERBOSE + cout << "Entering DeleteCustomSteps()" << endl; +#endif QString pos = comboCustom->currentText(); bool found = false; //loops through to find the index and to make sure its in the list @@ -729,6 +771,9 @@ void qScanWidget::DeleteCustomSteps(){ void qScanWidget::SetFileSteps(){ +#ifdef VERYVERBOSE + cout << "Entering SetFileSteps()" << endl; +#endif QString fName = dispFile->text(); #ifdef VERBOSE cout << "Setting\tscan:" << id << "\tfile\t:" << fName.toAscii().constData() << endl; @@ -848,6 +893,9 @@ void qScanWidget::SetFileSteps(){ void qScanWidget::BrowseFileStepsPath(){ +#ifdef VERYVERBOSE + cout << "Entering BrowseFileStepsPath()" << endl; +#endif #ifdef VERBOSE cout << "Browsing Steps File Path\tscan:" << id << endl; #endif @@ -871,8 +919,8 @@ void qScanWidget::BrowseFileStepsPath(){ void qScanWidget::LoadPositions(){ -#ifdef VERBOSE - cout << "Loading positions" << endl; +#ifdef VERYVERBOSE + cout << "Entering LoadPositions()" << endl; #endif disconnect(comboCustom, SIGNAL(currentIndexChanged(int)), this, SLOT(SetCustomSteps())); disconnect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps(int))); @@ -937,6 +985,9 @@ void qScanWidget::LoadPositions(){ void qScanWidget::Refresh(){ +#ifdef VERYVERBOSE + cout << "Entering Refresh()" << endl; +#endif int mode = (myDet->getScanMode(id)); string script = myDet->getScanScript(id); string parameter = myDet->getScanParameter(id); From 1ce04ef7854f2b9f08d189d2f6cf07c7d92bc6bc Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 21 Aug 2012 11:53:23 +0000 Subject: [PATCH 035/332] updated plot to show index instead of frame number git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@35 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_plot.ui | 7 +- slsDetectorGui/include/qDrawPlot.h | 2 + slsDetectorGui/include/qTabMeasurement.h | 1 + slsDetectorGui/include/qTabPlot.h | 31 +++- slsDetectorGui/src/qDetectorMain.cpp | 1 + slsDetectorGui/src/qDrawPlot.cpp | 62 ++++---- slsDetectorGui/src/qTabMeasurement.cpp | 14 ++ slsDetectorGui/src/qTabPlot.cpp | 175 +++++++++++++---------- 8 files changed, 185 insertions(+), 108 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index 5bbd6f55a..569816ca4 100644 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -519,6 +519,9 @@ Level 0 + + true +
@@ -607,7 +610,7 @@ All Frames - true + false @@ -1051,7 +1054,7 @@ - true + false diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index 404a7fa81..c9786a557 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -137,6 +137,8 @@ private: int currentMeasurement; /** currentFrame */ int currentFrame; + /** current Index */ + int currentIndex; /** Number of Exposures */ int number_of_exposures; /** Duration between Exposures */ diff --git a/slsDetectorGui/include/qTabMeasurement.h b/slsDetectorGui/include/qTabMeasurement.h index a5fff4c01..af3cd90e5 100644 --- a/slsDetectorGui/include/qTabMeasurement.h +++ b/slsDetectorGui/include/qTabMeasurement.h @@ -167,6 +167,7 @@ signals: void StartSignal(); void StopSignal(); void CheckPlotIntervalSignal(); +void EnableNthFrameSignal(bool); }; diff --git a/slsDetectorGui/include/qTabPlot.h b/slsDetectorGui/include/qTabPlot.h index 46b746f9f..c161d3456 100644 --- a/slsDetectorGui/include/qTabPlot.h +++ b/slsDetectorGui/include/qTabPlot.h @@ -16,6 +16,8 @@ class multiSlsDetector; class qDrawPlot; /** Qt Include Headers */ #include +#include +#include /** *@short sets up the Plot parameters @@ -51,12 +53,14 @@ private: bool isOneD; bool isOrginallyOneD; - int scanLevel[2]; + /**whether to enable nth frame according to timing mode*/ + bool enableNFrame; - QStackedLayout* stackedLayout; - QSpinBox *spinNthFrame; - QDoubleSpinBox *spinTimeGap; - QComboBox *comboTimeGapUnit; + QStackedLayout *stackedLayout; + QSpinBox *spinNthFrame; + QDoubleSpinBox *spinTimeGap; + QComboBox *comboTimeGapUnit; + QButtonGroup *btnGroupScan; /** some Default Values */ static QString defaultPlotTitle; @@ -75,6 +79,11 @@ private: */ void Initialization(); + /** This enabled/disables the nth frame from frequency plot + * @param enable enable/disable + */ + void EnablingNthFrameFunction(bool enable); + @@ -85,9 +94,18 @@ void SetFrequency(); * @param enable to enable the scan group box * @param id is 0 if its scan level 0 or scan level 1 */ -void EnableScanBox(int mode,int id); +void EnableScanBox(int mode=-1,int id=-1); +/** a variable is set when timing mode has been changed. + * This variable is also disabled if exptime>acq period to be on safe side + * Its to check whether to enabled nth frame for frequency plot + * @param enable enable/disable + */ +void EnableNthFrame(bool enable){enableNFrame = enable;}; +/** Sets the scan argument of the plot + */ +void SetScanArgument(); private slots: @@ -119,7 +137,6 @@ signals: void DisableZoomSignal(bool); void SetZRangeSignal(double,double); void EnableZRangeSignal(bool); -void ThresholdScanSignal(int); }; diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 58bbc32c2..3427df528 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -222,6 +222,7 @@ void qDetectorMain::Initialization(){ 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())); + connect(tab_measurement, SIGNAL(EnableNthFrameSignal(bool)), tab_plot,SLOT(EnableNthFrame(bool))); // Plot tab connect(tab_plot, SIGNAL(DisableZoomSignal(bool)), this,SLOT(SetZoomToolTip(bool))); // Actions tab diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 8fba07e9b..dcf77f9e1 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -51,7 +51,7 @@ qDrawPlot::~qDrawPlot(){ void qDrawPlot::SetupWidgetWindow(){ #ifdef VERBOSE - cout<<"Setting up plot variables"<setTimer(slsDetectorDefs::ACQUISITION_TIME,-1))*1E-9); - cout<<"\tExposure Time:"<setTimer(slsDetectorDefs::FRAME_PERIOD,-1))*1E-9); - cout<<"\tAcquisition Period:"<getFileIndex(); + cout << "\tCurrent Index:" << currentIndex << endl; StartDaq(true); running=!running; @@ -202,14 +205,14 @@ void qDrawPlot::StartStopDaqToggle(bool stop_if_running){ void qDrawPlot::StartDaq(bool start){ if(start){ #ifdef VERBOSE - cout<<"Start Daq(true) function"<registerDataCallback(&(GetDataCallBack),this); // Start acquiring data from server @@ -270,7 +273,7 @@ bool qDrawPlot::StartOrStopThread(bool start){ // This is manually done instead of keeping track of thread because // this thread returns immediately after executing the acquire command gui_acquisition_thread_running=1; - cout<<"Started acquiring threaddd:"<myDet->acquire(1); - cout<<"after acquire ...."<progressIndex; //if theres an old copy, try to get lock again if(oldCopy){ #ifdef VERBOSE - cout<<"Copying old data: "<0;i--) memcpy(histYAxis[i],yvalues[i-1],nPixelsX*sizeof(double)); @@ -338,7 +343,7 @@ int qDrawPlot::GetData(detectorData *data){ }//2d else{ // Titles - sprintf(temp_title,"Image Number %d",oldFrameNumber); + sprintf(temp_title,"Image Index %d",oldFrameNumber); imageTitle = temp_title; // copy data //memcpy(lastImageArray,image_data,nPixelsX*nPixelsY*sizeof(double)); @@ -354,6 +359,7 @@ int qDrawPlot::GetData(detectorData *data){ progress=(int)data->progressIndex; //lastImageNumber= currentFrame+1; currentFrame++; + currentIndex++; return 0; } //what comes here has plot enabled AND (frame factor OR data pause over ) @@ -361,7 +367,7 @@ int qDrawPlot::GetData(detectorData *data){ if((currentFrame)<(number_of_exposures)){ #ifdef VERYVERBOSE - cout<<"Reading in image: "<stop(); @@ -528,7 +535,7 @@ void qDrawPlot::UpdatePlot(){ if(lastImageNumber){ if(histNBins){ #ifdef VERYVERBOSE - cout<<"Last Image Number: "<SetXTitle(histXAxisTitle.toAscii().constData()); @@ -602,6 +609,7 @@ void qDrawPlot::UpdatePlot(){ }// To start the next measurement else{ emit SetCurrentMeasurementSignal(currentMeasurement); + currentIndex++; StopDaqForGui(); StartDaq(true); } @@ -626,7 +634,7 @@ void qDrawPlot::ClonePlot(){ } // no space for more clone widget references if(!found){ - cout<<"Too many clones"<setToolTip(errPeriodTip); lblPeriod->setPalette(red); lblPeriod->setText("Acquisition Period:*"); + emit EnableNthFrameSignal(false); } else { spinPeriod->setToolTip(acqPeriodTip); lblPeriod->setToolTip(acqPeriodTip); lblPeriod->setPalette(lblTimingMode->palette()); lblPeriod->setText("Acquisition Period:"); + emit EnableNthFrameSignal(true); } + //Check if the interval between plots is ok emit CheckPlotIntervalSignal(); } @@ -558,6 +561,7 @@ void qTabMeasurement::SetTimingMode(int mode){ return; } + if(mode!=None){//Number of Probes if(myDet->getDetectorsType()==slsDetectorDefs::MYTHEN){ lblNumProbes->setEnabled(true); spinNumProbes->setEnabled(true); @@ -668,9 +672,19 @@ void qTabMeasurement::SetTimingMode(int mode){ myPlot->setFrameEnabled(lblNumFrames->isEnabled()); myPlot->setTriggerEnabled(lblNumTriggers->isEnabled()); + + //check if period is enabled and alright, only then the nth frame frequency is enabled + if((lblPeriod->isEnabled())&&(lblPeriod->text()=="Acquisition Period:")) + emit EnableNthFrameSignal(true); + else emit EnableNthFrameSignal(false); + return; } + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + void qTabMeasurement::EnableFileWrite(bool enable){ #ifdef VERBOSE cout << "Enable File Write:" << enable << endl; diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index ea952d41f..391ff2dfc 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -12,6 +12,7 @@ #include "slsDetector.h" #include "multiSlsDetector.h" // Qt Include Headers +#include // C++ Include Headers #include #include @@ -52,8 +53,27 @@ qTabPlot::~qTabPlot(){ void qTabPlot::SetupWidgetWindow(){ - scanLevel[0]=false; - scanLevel[1]=false; + //check if nth frame should be enabled + enableNFrame = true; + //according to timing mode + slsDetectorDefs::externalCommunicationMode mode = myDet->setExternalCommunicationMode(); + if( (mode==slsDetectorDefs::GATE_FIX_NUMBER)|| + (mode==slsDetectorDefs::TRIGGER_FRAME) || + (mode==slsDetectorDefs::TRIGGER_WINDOW) || + ((mode==slsDetectorDefs::AUTO_TIMING)&&((int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1)==1)&&((int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1)==1)) ) + enableNFrame = false; + //according to if exptime > acq period + if((myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-9))>(myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,-1)*(1E-9))) + enableNFrame = false; + + + +//scan arguments + btnGroupScan = new QButtonGroup(this); + btnGroupScan->addButton(radioLevel0,0); + btnGroupScan->addButton(radioLevel1,1); + btnGroupScan->addButton(radioFileIndex,2); + btnGroupScan->addButton(radioAllFrames,3); // Plot Axis myPlot->SetPlotTitle(defaultPlotTitle); @@ -129,10 +149,10 @@ void qTabPlot::Select1DPlot(bool b){ chkZAxis->setEnabled(false); chkZMin->setEnabled(false); chkZMax->setEnabled(false); - myPlot->SetHistXAxisTitle(defaultHistXAxisTitle); dispXAxis->setText(defaultHistXAxisTitle); - myPlot->SetHistYAxisTitle(defaultHistYAxisTitle); dispYAxis->setText(defaultHistYAxisTitle); + myPlot->SetHistXAxisTitle(defaultHistXAxisTitle); + myPlot->SetHistYAxisTitle(defaultHistYAxisTitle); myPlot->Select1DPlot(); }else{ box1D->hide(); @@ -140,22 +160,12 @@ void qTabPlot::Select1DPlot(bool b){ chkZAxis->setEnabled(true); chkZMin->setEnabled(true); chkZMax->setEnabled(true); - - //threshold scan - if((scanLevel[0]==2)||(scanLevel[1]==2)){ - myPlot->SetImageXAxisTitle("Channel Number"); - dispXAxis->setText("Channel Number"); - dispYAxis->setText("Threshold"); - myPlot->SetImageYAxisTitle("Threshold"); - } - else{ - myPlot->SetImageXAxisTitle(defaultImageXAxisTitle); - dispXAxis->setText(defaultImageXAxisTitle); - dispYAxis->setText(defaultImageYAxisTitle); - myPlot->SetImageYAxisTitle(defaultImageYAxisTitle); - } - myPlot->SetImageZAxisTitle(defaultImageZAxisTitle); + dispXAxis->setText(defaultImageXAxisTitle); + dispYAxis->setText(defaultImageYAxisTitle); dispZAxis->setText(defaultImageZAxisTitle); + myPlot->SetImageXAxisTitle(defaultImageXAxisTitle); + myPlot->SetImageYAxisTitle(defaultImageYAxisTitle); + myPlot->SetImageZAxisTitle(defaultImageZAxisTitle); myPlot->Select2DPlot(); } @@ -172,7 +182,7 @@ void qTabPlot::Initialization(){ connect(radioHistogram, SIGNAL(toggled(bool)),this, SLOT(SetPlot())); connect(radioDataGraph, SIGNAL(toggled(bool)),this, SLOT(SetPlot())); // Scan box - //connect(scna, SIGNAL(toggled(bool)),this, SLOT(scanstuff(bool))); + connect(btnGroupScan, SIGNAL(buttonClicked(QAbstractButton *)),this, SLOT(SetScanArgument())); // Snapshot box connect(btnClone, SIGNAL(clicked()),myPlot, SLOT(ClonePlot())); connect(btnCloseClones, SIGNAL(clicked()),myPlot, SLOT(CloseClones())); @@ -213,7 +223,8 @@ void qTabPlot::Initialization(){ connect(dispYMax, SIGNAL(returnPressed()), this, SLOT(SetAxesRange())); connect(dispZMin, SIGNAL(returnPressed()), this, SLOT(SetZRange())); connect(dispZMax, SIGNAL(returnPressed()), this, SLOT(SetZRange())); - connect(this, SIGNAL(SetZRangeSignal(double,double)),myPlot, SIGNAL(SetZRangeSignal(double,double))); + + connect(this,SIGNAL(SetZRangeSignal(double,double)),myPlot, SIGNAL(SetZRangeSignal(double,double))); // Common Buttons // Save @@ -390,26 +401,16 @@ void qTabPlot::SetPlot(){ myPlot->EnablePlot(true); //if enable is true, disable everything if(isOrginallyOneD) {box1D->show();box1D->setEnabled(true);} else box1D->hide(); - if(!isOrginallyOneD){box2D->show();box2D->setEnabled(true);} else box2D->hide(); + if(!isOrginallyOneD){box2D->show();box2D->setEnabled(true);} else box2D->hide(); Select1DPlot(isOrginallyOneD); boxSnapshot->setEnabled(true); boxSave->setEnabled(true); boxFrequency->setEnabled(true); boxPlotAxis->setEnabled(true); + EnableScanBox(); }else{ cout << " - Histogram" << endl; - myPlot->EnablePlot(true); - Select1DPlot(false); - box1D->hide(); - box2D->show(); - box2D->setEnabled(true); - boxSnapshot->setEnabled(true); - boxSave->setEnabled(true); - boxFrequency->setEnabled(false); - boxPlotAxis->setEnabled(true); - boxScan->setEnabled(false); - myPlot->SetPlotTimer(250); - emit ThresholdScanSignal(0); + //select(2d) will set oneD to false, but originallyoneD will remember } } @@ -452,7 +453,7 @@ void qTabPlot::SetFrequency(){ timeMS = (spinNthFrame->value())*acqPeriodMS; // To make sure the period between plotting is not less than minimum plot timer in ms if(timeMSPlot Tab: Interval between Plots - The nth Image must be larger.

" "Condition to be satisfied:\n(Acquisition Period)*(nth Image) >= 250ms." "

Nth image adjusted to minimum, " @@ -477,57 +478,87 @@ void qTabPlot::SetFrequency(){ void qTabPlot::EnableScanBox(int mode,int id){ -#ifdef VERBOSE - cout << "Entering Enable Scan Box()" << endl; +#ifdef VERYVERBOSE + cout << "Entering Enable Scan Box() \t mode:" << mode << " \t id:" << id << endl; #endif + int mode0 = myDet->getScanMode(0); + int mode1 = myDet->getScanMode(1); - scanLevel[id]=mode; - //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);/**???*/ + boxScan->setEnabled(mode0||mode1); + + if(boxScan->isEnabled()){ + //make sure nth frame frequency plot is disabled + EnablingNthFrameFunction(false); + + //if level0 or 1, check argument to find which scan enabled last from actions tab + if((btnGroupScan->checkedId()!=2)&&(btnGroupScan->checkedId()!=3)){ + cout<<"mode:"<0){ + if(!id) radioLevel0->setChecked(true); + else radioLevel1->setChecked(true); + } } - //disable one and check the other - if(id) { - radioLevel0->setEnabled(!mode); - radioLevel0->setChecked(!mode); - radioLevel1->setEnabled(mode); - radioLevel1->setChecked(mode); - }else{ - radioLevel0->setEnabled(mode); - radioLevel0->setChecked(mode); - radioLevel1->setEnabled(!mode); - radioLevel1->setChecked(!mode); + + radioLevel0->setEnabled(mode0); + radioLevel1->setEnabled(mode1); + }else EnablingNthFrameFunction(enableNFrame); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + +void qTabPlot::EnablingNthFrameFunction(bool enable){ +#ifdef VERYVERBOSE + cout << "Enabling Nth Frame : " << enable << endl; +#endif + QStandardItemModel* model = qobject_cast(comboFrequency->model()); + QStandardItem* item = model->itemFromIndex(model->index(1, comboFrequency->modelColumn(), comboFrequency->rootModelIndex())); + + //enabling/disabling is easy if it wasnt selected anyway + if(comboFrequency->currentIndex()!=1) + item->setEnabled(enable); + else{ + //only when it was enabled before and now to disable is a problem + if(!enable){ + spinTimeGap->setValue(myPlot->GetMinimumPlotTimer()); + comboFrequency->setCurrentIndex(0); + item->setEnabled(false); } } - //check for threshold - if((scanLevel[0]==2)||(scanLevel[1]==2)) - radioHistogram->setChecked(true); - else - radioDataGraph->setChecked(true); - - /* - if(boxScan->isEnabled()){ - myDet->setPlotType(i); - }*/ } +//------------------------------------------------------------------------------------------------------------------------------------------------- + +void qTabPlot::SetScanArgument(){ + switch(btnGroupScan->checkedId()){ + //level0 + case 0: + break; + + //level1 + case 1: + break; + + //file index + case 2: + break; + + //all frames + case 3: + break; + } + +} //------------------------------------------------------------------------------------------------------------------------------------------------- + void qTabPlot::Refresh(){ SetFrequency(); + EnableScanBox(); } From cc176ea404fc9e93d37f0468a451ad4ba2d48286 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 21 Aug 2012 12:05:22 +0000 Subject: [PATCH 036/332] updated plot to show index instead of frame number git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@36 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qDrawPlot.h | 362 ++++++++++++++++------------- slsDetectorGui/src/qTabPlot.cpp | 4 + 2 files changed, 198 insertions(+), 168 deletions(-) diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index c9786a557..d8aceb9a1 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -36,6 +36,9 @@ class qCloneWidget; class qDrawPlot:public QWidget{ Q_OBJECT + + + public: /** \short The constructor */ qDrawPlot(QWidget *parent,multiSlsDetector*& detector); @@ -100,176 +103,8 @@ public: void setTriggerEnabled(bool enable){isTriggerEnabled = enable;}; -private: - /** The sls detector object */ - multiSlsDetector *myDet; -/** Widgets needed to plot the clone */ - /** Max Number of Clone Windows */ - static const int MAXCloneWindows = 50; - /** Array of clone window widget pointers */ - qCloneWidget *winClone[MAXCloneWindows]; - -/** Widgets needed to set up plot*/ - QGroupBox *boxPlot; - QGridLayout *layout; - QGridLayout *plotLayout; - /** Timer to update plot */ - QTimer* plot_update_timer; - - /** Timer to pause getting data from client */ - QTimer* data_pause_timer; - bool data_pause_over; - - - /** 1D object */ - SlsQt1DPlot* plot1D; - /** 2D object */ - SlsQt2DPlotLayout* plot2D; - /** vector of 1D hist values */ - QVector plot1D_hists; - - - /** Number of Measurements */ - int number_of_measurements; - /** Current Measurement */ - int currentMeasurement; - /** currentFrame */ - int currentFrame; - /** current Index */ - int currentIndex; - /** Number of Exposures */ - int number_of_exposures; - /** Duration between Exposures */ - double acquisitionPeriod; - /** Acquisition Time */ - double exposureTime; - - -/**variables for threads */ - /** */ - volatile bool stop_signal; - /** */ - pthread_mutex_t last_image_complete_mutex; - -/**variables for histograms */ - /** X Axis Title in 2D */ - QString imageXAxisTitle; - /** Y Axis Title in 2D */ - QString imageYAxisTitle; - /** Z Axis Title in 2D */ - QString imageZAxisTitle; - /** X Axis Title in 1D */ - QString histXAxisTitle; - /** Y Axis Title in 1D */ - QString histYAxisTitle; - /** Title for all the graphs in 1D */ - std::string histTitle[MAX_1DPLOTS]; - /** Title in 2D */ - std::string imageTitle; - /** 1D or 2D */ - unsigned int plot_in_scope; - /** Number of Pixels in X Axis */ - unsigned int nPixelsX; - /** Number of Pixels in Y Axis */ - unsigned int nPixelsY; - /** Current Image Number */ - unsigned int lastImageNumber; - int last_plot_number; - - /** Number of graphs in 1D */ - unsigned int nHists; - /** Total Number of X axis values/channels in 1D */ - int histNBins; - /** X Axis value in 1D */ - double* histXAxis; - /** Y Axis value in 1D */ - double* histYAxis[MAX_1DPLOTS]; - /** Current Image Values in 2D */ - double* lastImageArray; - /** temporary Y Axis value in 1D */ - double* yvalues[MAX_1DPLOTS]; - /** temporary Image Values in 2D */ - double* image_data; - - /**persistency to be reached*/ - int persistency; - /** persistency takes time to reach as it increases per frame - * this is the current one */ - int currentPersistency; - /** to update the progress for each getData() so that - * measurement tab can request on a timer basis*/ - int progress; - /**If plot is enabled from plot tab*/ - bool plotEnable; - /**If plot is dotted */ - bool plotDotted; - - - /**if an acquisition is running, so as not to refresh tab - * and also to update plot only if running (while creating clones)*/ - bool running; - - /** if the min/max of x and y has been changed, - * to notify while plotting */ - bool XYRangeChanged; - /**the specific min/max of x/y*/ - double XYRangeValues[4]; - /**if the specific min/max of x/y is enabled */ - bool IsXYRange[4]; - - /** Default timer between plots*/ - static const double PLOT_TIMER_MS = 250; - /** Specific timer value between plots */ - double timerValue; - /** every nth frame when to plot */ - int frameFactor; - /** old data that did not get lock(for frame factor)**/ - bool oldCopy; - int oldFrameNumber; - /**if frame is enabled in measurement tab */ - bool isFrameEnabled; - /**if trigger is enabled in measurement tab */ - bool isTriggerEnabled; - - - /** Initializes all its members and the thread */ - void Initialization(); - /** Sets up the widget */ - void SetupWidgetWindow(); - - - /** Gets the image title */ - const char* GetImageTitle() {return imageTitle.c_str();} - /** Gets the hist title for a 1D plot */ - const char* GetHistTitle(int i) {return (i>=0&&i=0&&i=0&&i=0&&i plot1D_hists; + + +/** Number of Measurements */ +int number_of_measurements; +/** Current Measurement */ +int currentMeasurement; +/** currentFrame */ +int currentFrame; +/** current Index */ +int currentIndex; +/** Number of Exposures */ +int number_of_exposures; +/** Duration between Exposures */ +double acquisitionPeriod; +/** Acquisition Time */ +double exposureTime; + + +/**variables for threads */ +/** */ +volatile bool stop_signal; +/** */ +pthread_mutex_t last_image_complete_mutex; + +/**variables for histograms */ +/** X Axis Title in 2D */ +QString imageXAxisTitle; +/** Y Axis Title in 2D */ +QString imageYAxisTitle; +/** Z Axis Title in 2D */ +QString imageZAxisTitle; +/** X Axis Title in 1D */ +QString histXAxisTitle; +/** Y Axis Title in 1D */ +QString histYAxisTitle; +/** Title for all the graphs in 1D */ +std::string histTitle[MAX_1DPLOTS]; +/** Title in 2D */ +std::string imageTitle; +/** 1D or 2D */ +unsigned int plot_in_scope; +/** Number of Pixels in X Axis */ +unsigned int nPixelsX; +/** Number of Pixels in Y Axis */ +unsigned int nPixelsY; +/** Current Image Number */ +unsigned int lastImageNumber; +int last_plot_number; + +/** Number of graphs in 1D */ +unsigned int nHists; +/** Total Number of X axis values/channels in 1D */ +int histNBins; +/** X Axis value in 1D */ +double* histXAxis; +/** Y Axis value in 1D */ +double* histYAxis[MAX_1DPLOTS]; +/** Current Image Values in 2D */ +double* lastImageArray; +/** temporary Y Axis value in 1D */ +double* yvalues[MAX_1DPLOTS]; +/** temporary Image Values in 2D */ +double* image_data; + +/**persistency to be reached*/ +int persistency; +/** persistency takes time to reach as it increases per frame + * this is the current one */ +int currentPersistency; +/** to update the progress for each getData() so that + * measurement tab can request on a timer basis*/ +int progress; +/**If plot is enabled from plot tab*/ +bool plotEnable; +/**If plot is dotted */ +bool plotDotted; + + +/**if an acquisition is running, so as not to refresh tab + * and also to update plot only if running (while creating clones)*/ +bool running; + +/** if the min/max of x and y has been changed, + * to notify while plotting */ +bool XYRangeChanged; +/**the specific min/max of x/y*/ +double XYRangeValues[4]; +/**if the specific min/max of x/y is enabled */ +bool IsXYRange[4]; + +/** Default timer between plots*/ +static const double PLOT_TIMER_MS = 250; +/** Specific timer value between plots */ +double timerValue; +/** every nth frame when to plot */ +int frameFactor; +/** old data that did not get lock(for frame factor)**/ +bool oldCopy; +int oldFrameNumber; +/**if frame is enabled in measurement tab */ +bool isFrameEnabled; +/**if trigger is enabled in measurement tab */ +bool isTriggerEnabled; + +/** scan arguments*/ +enum scanArguments{None,Level0,Level1,FileIndex,AllFrames}; + + + signals: void UpdatingPlotFinished(); void InterpolateSignal(bool); diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index 391ff2dfc..2da1506e9 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -534,6 +534,10 @@ void qTabPlot::EnablingNthFrameFunction(bool enable){ void qTabPlot::SetScanArgument(){ switch(btnGroupScan->checkedId()){ + + //let qdrawplot know which scan argument + //myPlot-> + //level0 case 0: break; From 73152572a5327732672a081d3fd8be68ead64da1 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 21 Aug 2012 16:52:41 +0000 Subject: [PATCH 037/332] a rough idea of a scan is implemented with all frames git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@37 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qDrawPlot.h | 12 +- slsDetectorGui/include/qTabPlot.h | 6 + slsDetectorGui/slsDetectorGui.pro | 2 +- slsDetectorGui/src/qDrawPlot.cpp | 202 ++++++++++++++--------------- slsDetectorGui/src/qTabPlot.cpp | 105 +++++++++++---- 5 files changed, 185 insertions(+), 142 deletions(-) diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index d8aceb9a1..e269a1bd4 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -126,6 +126,8 @@ void SavePlot(); void SetPersistency(int val); /** sets style of plot to dotted */ void SetDottedPlot(bool enable){plotDotted = enable;}; +/** sets the scan argument to prepare the plot*/ +void SetScanArgument(int scanArg){scanArgument = scanArg;}; @@ -166,10 +168,7 @@ static void* DataStartAcquireThread(void *this_pointer); static int GetDataCallBack(detectorData *data, void *this_pointer); /** This is called by the GetDataCallBack function to copy the data */ int GetData(detectorData *data); -/** This is called by the detector class to copy the scan data it jus acquired */ -static int GetScanDataCallBack(detectorData *data, void *this_pointer); -/** This is called by the GetDataCallBack function to copy the scan data */ -int GetScanData(detectorData *data); + @@ -195,7 +194,7 @@ void UpdatePause(){data_pause_over=true;}; - +private: /** The sls detector object */ multiSlsDetector *myDet; @@ -329,7 +328,8 @@ bool isFrameEnabled; bool isTriggerEnabled; /** scan arguments*/ -enum scanArguments{None,Level0,Level1,FileIndex,AllFrames}; +enum scanArgumentList{None,Level0,Level1,FileIndex,AllFrames}; +int scanArgument; diff --git a/slsDetectorGui/include/qTabPlot.h b/slsDetectorGui/include/qTabPlot.h index c161d3456..0d75a9d76 100644 --- a/slsDetectorGui/include/qTabPlot.h +++ b/slsDetectorGui/include/qTabPlot.h @@ -19,6 +19,7 @@ class qDrawPlot; #include #include + /** *@short sets up the Plot parameters */ @@ -70,6 +71,11 @@ private: static QString defaultImageYAxisTitle; static QString defaultImageZAxisTitle; + /** scans */ + static const QString modeNames[5]; + + + /** methods */ /** Sets up the widget */ diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index c7593e21e..a57c8e744 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -6,7 +6,7 @@ UI_HEADERS_DIR = forms/include RESOURCES += icons.qrc -DEFINES += VERBOSE DACS_INT VERYVERBOSE +DEFINES += VERBOSE DACS_INT #VERYVERBOSE target.path += $(DESTDIR) diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index dcf77f9e1..bd54aac77 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -86,6 +86,7 @@ void qDrawPlot::SetupWidgetWindow(){ data_pause_over = true;//to get the first image isFrameEnabled = false; isTriggerEnabled = false; + scanArgument = None; // This is so that it initially stop and plots running = 1; for(int i=0;igetPositions(); numPos = ((numPos==0)?1:numPos); + int numScan0 = myDet->getScanSteps(0); numScan0 = ((numScan0==0)?1:numScan0); + int numScan1 = myDet->getScanSteps(1); numScan1 = ((numScan1==0)?1:numScan1); + + number_of_exposures = number_of_exposures * numPos * numScan0 * numScan1; cout << "\tNumber of Exposures:" << number_of_exposures << endl; + + // ExposureTime exposureTime= ((double)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1))*1E-9); cout << "\tExposure Time:" << setprecision (10) << exposureTime << endl; @@ -253,8 +268,15 @@ bool qDrawPlot::StartOrStopThread(bool start){ stop_signal = 0; oldFrameNumber = 0; histNBins = nPixelsX; - if(!image_data) image_data = new double[nPixelsX*nPixelsY]; - if(!lastImageArray) lastImageArray = new double[nPixelsX*nPixelsY]; + + /**delete it if it exists and create again and for originally 1d, initalize it with all 0*/ + if(image_data) delete [] image_data; + image_data = new double[nPixelsY*nPixelsX]; + //if(!image_data) image_data = new double[nPixelsY*nPixelsX]; + //if(!lastImageArray) lastImageArray = new double[nPixelsY*nPixelsX]; + if(lastImageArray) delete [] lastImageArray; + lastImageArray = new double[nPixelsY*nPixelsX]; + if(!histXAxis) histXAxis = new double [nPixelsX]; for(unsigned int px=0;pxstart((int)(PLOT_TIMER_MS/2)); - }//if frame factor or last frame of last measurement... for all other factors, RETURN - else{ - if(((currentFrame+1==number_of_exposures)&&(currentMeasurement+1==number_of_measurements)) - ||(!((currentFrame)%frameFactor))) - oldCopy = false;//if this works, then we forget old data - else{ - //lastImageNumber= currentFrame+1; - currentFrame++; - currentIndex++; - progress=(int)data->progressIndex; - //if theres an old copy, try to get lock again - if(oldCopy){ -#ifdef VERBOSE - cout << "Copying old data: " << oldFrameNumber << endl; -#endif - if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ - char temp_title[2000]; - // only if you got the lock, do u need to remember lastimagenumber to plot - lastImageNumber= currentFrame; - //1d - if(plot_in_scope==1){ - // Titles - sprintf(temp_title,"Frame Index%d",oldFrameNumber); histTitle[0] = temp_title; - // copy data//memcpy(histXAxis, xvalues,nPixelsX*sizeof(double)); - for(int i=currentPersistency;i>0;i--) - memcpy(histYAxis[i],yvalues[i-1],nPixelsX*sizeof(double)); - memcpy(histYAxis[0],yvalues[0],nPixelsX*sizeof(double)); - }//2d - else{ - // Titles - sprintf(temp_title,"Image Index %d",oldFrameNumber); - imageTitle = temp_title; - // copy data - //memcpy(lastImageArray,image_data,nPixelsX*nPixelsY*sizeof(double)); - } - pthread_mutex_unlock(&(last_image_complete_mutex)); - } + /** all frames shouldnt go in here */ + if(scanArgument!=AllFrames){ + //not frame factor + if(!frameFactor){ + //if the time is not over, RETURN + if(!data_pause_over){ + //lastImageNumber= currentFrame+1; + currentFrame++; + currentIndex++; + return 0; + } + data_pause_over=false; + data_pause_timer->start((int)(PLOT_TIMER_MS/2)); + }//if frame factor or last frame of last measurement... for all other factors, RETURN + else{ + if(((currentFrame+1==number_of_exposures)&&(currentMeasurement+1==number_of_measurements)) + ||(!((currentFrame)%frameFactor))) + oldCopy = false;//if this works, then we forget old data + else{ + //lastImageNumber= currentFrame+1; + currentFrame++; + currentIndex++; + progress=(int)data->progressIndex; + //if theres an old copy, try to get lock again + if(oldCopy){ +#ifdef VERBOSE + cout << "Copying old data: " << oldFrameNumber << endl; +#endif + if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ + char temp_title[2000]; + // only if you got the lock, do u need to remember lastimagenumber to plot + lastImageNumber= currentFrame; + //1d + if(plot_in_scope==1){ + // Titles + sprintf(temp_title,"Frame Index%d",oldFrameNumber); histTitle[0] = temp_title; + // copy data//memcpy(histXAxis, xvalues,nPixelsX*sizeof(double)); + for(int i=currentPersistency;i>0;i--) + memcpy(histYAxis[i],yvalues[i-1],nPixelsX*sizeof(double)); + memcpy(histYAxis[0],yvalues[0],nPixelsX*sizeof(double)); + }//2d + else{ + // Titles + sprintf(temp_title,"Image Index %d",oldFrameNumber); + imageTitle = temp_title; + // copy data + //memcpy(lastImageArray,image_data,nPixelsX*nPixelsY*sizeof(double)); + } + pthread_mutex_unlock(&(last_image_complete_mutex)); + } + } + return 0; } - return 0; } } //if plot disabled, RETURN @@ -369,6 +394,21 @@ int qDrawPlot::GetData(detectorData *data){ #ifdef VERYVERBOSE cout << "Reading in image: " << currentIndex << endl; #endif + + //if scan argument is all frames + if(scanArgument==AllFrames){ + if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ + lastImageNumber= currentFrame+1; + char temp_title[2000]; sprintf(temp_title,"Image Index %d",currentIndex); imageTitle = temp_title; + memcpy(lastImageArray+(currentFrame*nPixelsX),data->values,nPixelsX*sizeof(double)); + pthread_mutex_unlock(&(last_image_complete_mutex)); + } + currentFrame++; + currentIndex++; + return 0; + } + + if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ char temp_title[2000]; // only if you got the lock, do u need to remember lastimagenumber to plot @@ -434,61 +474,6 @@ int qDrawPlot::GetData(detectorData *data){ return 0; } - -//------------------------------------------------------------------------------------------------------------------------------------------------- - - -int qDrawPlot::GetScanDataCallBack(detectorData *data, void *this_pointer){ - ((qDrawPlot*)this_pointer)->GetScanData(data); - return 0; -} - - -//------------------------------------------------------------------------------------------------------------------------------------------------- - - -int qDrawPlot::GetScanData(detectorData *data){/* -#ifdef VERYVERBOSE - cout << "Entering GetScanDatafunction"<progressIndex; - //lastImageNumber= currentFrame+1; - currentThrehold++; - return 0; - } - //what comes here has plot enabled AND (frame factor OR data pause over ) - progress=(int)data->progressIndex; - -#ifdef VERYVERBOSE - cout<<"Reading in image: "<values,nPixelsX*sizeof(double)); - - pthread_mutex_unlock(&(last_image_complete_mutex)); - } - currentThrehold++; - - } -#ifdef VERYVERBOSE - cout<<"Exiting GetScanData function"<0&&nPixelsY>0){ @@ -601,7 +587,7 @@ void qDrawPlot::UpdatePlot(){ } // if a measurement is over else{ - currentMeasurement++; + currentMeasurement++;cout<<"currentMeasurement:"<addButton(radioAllFrames,3); // Plot Axis - myPlot->SetPlotTitle(defaultPlotTitle); - dispTitle->setText(defaultPlotTitle); dispTitle->setEnabled(false); dispXAxis->setEnabled(false); dispYAxis->setEnabled(false); @@ -128,13 +127,18 @@ void qTabPlot::SetupWidgetWindow(){ // Depending on whether the detector is 1d or 2d switch(myDet->getDetectorsType()){ - case slsDetectorDefs::MYTHEN: isOrginallyOneD = true; Select1DPlot(true); break; - case slsDetectorDefs::EIGER: isOrginallyOneD = false; Select1DPlot(false);break; - case slsDetectorDefs::GOTTHARD: isOrginallyOneD = true; Select1DPlot(true);break; + case slsDetectorDefs::MYTHEN: isOrginallyOneD = true; break; + case slsDetectorDefs::EIGER: isOrginallyOneD = false; break; + case slsDetectorDefs::GOTTHARD: isOrginallyOneD = true; break; default: cout << "ERROR: Detector Type is Generic" << endl; exit(-1); } + + Select1DPlot(isOrginallyOneD); + + //to check if this should be enabled + EnableScanBox(); } @@ -143,6 +147,8 @@ void qTabPlot::SetupWidgetWindow(){ void qTabPlot::Select1DPlot(bool b){ isOneD = b; + dispTitle->setText(defaultPlotTitle); + myPlot->SetPlotTitle(defaultPlotTitle); if(b){ box1D->show(); box2D->hide(); @@ -169,7 +175,6 @@ void qTabPlot::Select1DPlot(bool b){ myPlot->Select2DPlot(); } - boxScan->setEnabled(false); } @@ -386,11 +391,13 @@ void qTabPlot::SetPlot(){ #endif if(radioNoPlot->isChecked()){ cout << " - No Plot" << endl; - Select1DPlot(isOrginallyOneD); + + //Select1DPlot(isOrginallyOneD); + //if(isOrginallyOneD) {box1D->show(); box2D->hide();} + //if(!isOrginallyOneD){box2D->show(); box1D->hide();} myPlot->EnablePlot(false); //if enable is true, disable everything - if(isOrginallyOneD) {box1D->show(); box1D->setEnabled(false); box2D->hide();} - if(!isOrginallyOneD){box2D->show(); box2D->setEnabled(false); box1D->hide();} + boxSnapshot->setEnabled(false); boxSave->setEnabled(false); boxFrequency->setEnabled(false); @@ -398,10 +405,11 @@ void qTabPlot::SetPlot(){ boxScan->setEnabled(false); }else if(radioDataGraph->isChecked()){ cout << " - DataGraph" << endl; + myPlot->EnablePlot(true); //if enable is true, disable everything - if(isOrginallyOneD) {box1D->show();box1D->setEnabled(true);} else box1D->hide(); - if(!isOrginallyOneD){box2D->show();box2D->setEnabled(true);} else box2D->hide(); + if(isOrginallyOneD) {box1D->show(); box2D->hide();} + if(!isOrginallyOneD) {box2D->show(); box1D->hide();} Select1DPlot(isOrginallyOneD); boxSnapshot->setEnabled(true); boxSave->setEnabled(true); @@ -504,6 +512,9 @@ void qTabPlot::EnableScanBox(int mode,int id){ radioLevel0->setEnabled(mode0); radioLevel1->setEnabled(mode1); }else EnablingNthFrameFunction(enableNFrame); + + //sets the scan argument + SetScanArgument(); } @@ -533,27 +544,67 @@ void qTabPlot::EnablingNthFrameFunction(bool enable){ //------------------------------------------------------------------------------------------------------------------------------------------------- void qTabPlot::SetScanArgument(){ - switch(btnGroupScan->checkedId()){ - //let qdrawplot know which scan argument - //myPlot-> + //as default from histogram and default titles are set here if scanbox is disabled + Select1DPlot(isOrginallyOneD); - //level0 - case 0: - break; + //this function is also called just to update, could be no scan + if(boxScan->isEnabled()){ - //level1 - case 1: - break; + //setting the title according to the scans + QString mainTitle = QString(" Level 0 : ") + modeNames[myDet->getScanMode(0)] + + QString(" | Level 1 : ") + modeNames[myDet->getScanMode(1)] + QString(""); + dispTitle->setText(mainTitle); + myPlot->SetPlotTitle(mainTitle); - //file index - case 2: - break; - //all frames - case 3: - break; - } + //let qdrawplot know which scan argument + myPlot->SetScanArgument(btnGroupScan->checkedId()+1); + /** What happens for 2d????*/ + //settings the x and y titles + switch(btnGroupScan->checkedId()){ + //level0 + case 0: + dispXAxis->setText("Channel Number"); + dispYAxis->setText("Scan Level 0"); + myPlot->SetHistXAxisTitle("Channel Number"); + myPlot->SetHistYAxisTitle("Scan Level 0"); + myPlot->Select1DPlot(); + break; + + //level1 + case 1: + dispXAxis->setText("Channel Number"); + dispYAxis->setText("Scan Level 1"); + myPlot->SetHistXAxisTitle("Channel Number"); + myPlot->SetHistYAxisTitle("Scan Level 1"); + myPlot->Select1DPlot(); + break; + + //file index + case 2: + dispXAxis->setText("Channel Number"); + dispYAxis->setText("File Index"); + myPlot->SetHistXAxisTitle("Channel Number"); + myPlot->SetHistYAxisTitle("File Index"); + myPlot->Select1DPlot(); + break; + + //all frames + case 3: + Select1DPlot(false); + dispXAxis->setText("Channel Number"); + dispYAxis->setText("Threshold"); + dispZAxis->setText("Intensity"); + myPlot->SetImageXAxisTitle("Channel Number"); + myPlot->SetImageYAxisTitle("Threshold"); + myPlot->SetImageZAxisTitle("Intensity"); + myPlot->Select2DPlot(); + break; + } + }else //done here so that it isnt set by default each time + myPlot->SetScanArgument(0); + } From ee3a54601cfa77a9cfb3b08990cb088ccc52655e Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Mon, 27 Aug 2012 14:11:58 +0000 Subject: [PATCH 038/332] the scans work git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@38 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_advanced.ui | 344 ++++++++++++++++++- slsDetectorGui/forms/form_tab_debugging.ui | 16 +- slsDetectorGui/forms/form_tab_plot.ui | 8 +- slsDetectorGui/include/qCloneWidget.h | 5 + slsDetectorGui/include/qDrawPlot.h | 53 ++- slsDetectorGui/include/qScanWidget.h | 2 +- slsDetectorGui/include/qTabActions.h | 14 +- slsDetectorGui/include/qTabDataOutput.h | 4 + slsDetectorGui/include/qTabPlot.h | 4 +- slsDetectorGui/include/qTabSettings.h | 8 +- slsDetectorGui/src/qCloneWidget.cpp | 61 +--- slsDetectorGui/src/qDetectorMain.cpp | 5 +- slsDetectorGui/src/qDrawPlot.cpp | 371 ++++++++++++++------- slsDetectorGui/src/qScanWidget.cpp | 2 +- slsDetectorGui/src/qTabActions.cpp | 100 ++++-- slsDetectorGui/src/qTabDataOutput.cpp | 8 +- slsDetectorGui/src/qTabPlot.cpp | 152 +++++---- slsDetectorGui/src/qTabSettings.cpp | 14 +- 18 files changed, 852 insertions(+), 319 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_advanced.ui b/slsDetectorGui/forms/form_tab_advanced.ui index 30075ae9b..a78e1c4ea 100644 --- a/slsDetectorGui/forms/form_tab_advanced.ui +++ b/slsDetectorGui/forms/form_tab_advanced.ui @@ -6,8 +6,8 @@ 0 0 - 748 - 339 + 775 + 345
@@ -31,18 +31,344 @@ Form - + - 69 - 229 - 75 - 25 + 25 + 83 + 740 + 93 - - PushButton + + Files: + + + 0 + + + 0 + + + 0 + + + 5 + + + -1 + + + 9 + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + Trimbit File: + + + + + + + + 0 + 0 + + + + Load + + + + + + + + 0 + 0 + + + + Save + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 120 + 20 + + + + + + + + + 0 + 0 + + + + Calibration File: + + + + + + + + 0 + 0 + + + + Load + + + + + + + + 0 + 0 + + + + Save + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + + + + + + + + 0 + 0 + + + + Output File: + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + + + + + + + + Browse + + + + + + + + + + + 25 + 200 + 726 + 58 + + + + Trimming Method + + + + + 10 + 20 + 711 + 31 + + + + + 15 + + + + + + 0 + 0 + + + + None + + + + + + + + 0 + 0 + + + + Adjust to Fix Count Level + + + + + + + + 0 + 0 + + + + Equalize to Median + + + + + + + + 0 + 0 + + + + Optimize Settings + + + + + + + + 0 + 0 + + + + Offline Improvement + + + + + + + + + + 25 + 20 + 726 + 58 + + + + Calibration Logs + + + + + 35 + 20 + 626 + 31 + + + + + 15 + + + + + Energy Calibration + + + + + + + Angular Calibration + + + + + + horizontalLayoutWidget_2 + checkBox_3 diff --git a/slsDetectorGui/forms/form_tab_debugging.ui b/slsDetectorGui/forms/form_tab_debugging.ui index aeca75ca8..4e02206dc 100644 --- a/slsDetectorGui/forms/form_tab_debugging.ui +++ b/slsDetectorGui/forms/form_tab_debugging.ui @@ -34,9 +34,9 @@ - 265 - 30 - 251 + 30 + 50 + 321 36 @@ -75,7 +75,7 @@ 30 - 165 + 140 321 156 @@ -126,9 +126,9 @@ - 265 - 95 - 251 + 425 + 55 + 316 25 @@ -140,7 +140,7 @@ 425 - 165 + 140 321 156 diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index 569816ca4..56a301af5 100644 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -487,13 +487,13 @@ - Scan - Y Axis Values + 2D Scan - Y Axis Values - false + true - false + true @@ -1443,7 +1443,7 @@
- + true diff --git a/slsDetectorGui/include/qCloneWidget.h b/slsDetectorGui/include/qCloneWidget.h index 0fe0def05..8316989f3 100644 --- a/slsDetectorGui/include/qCloneWidget.h +++ b/slsDetectorGui/include/qCloneWidget.h @@ -65,6 +65,11 @@ public: * */ void SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis[],string histTitle[]); +public slots: +/** Save Plots automatically by save all clones + * returns -1 if fail*/ +int SavePlotAutomatic(); + private: /** clone window id*/ diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index e269a1bd4..f0e578f65 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -27,6 +27,7 @@ class qCloneWidget; /** C++ Include Headers */ + #define MAX_1DPLOTS 10 @@ -120,8 +121,12 @@ void Clear1DPlot(); void ClonePlot(); /** Closes all the clone plots */ void CloseClones(); +/** Saves all the clone plots */ +void SaveClones(); /** To Save plot */ void SavePlot(); +/** Save all plots **/ +void SaveAll(bool enable); /** Sets persistency from plot tab */ void SetPersistency(int val); /** sets style of plot to dotted */ @@ -168,9 +173,8 @@ static void* DataStartAcquireThread(void *this_pointer); static int GetDataCallBack(detectorData *data, void *this_pointer); /** This is called by the GetDataCallBack function to copy the data */ int GetData(detectorData *data); - - - +/** Saves all the plots. All sets saveError to true if not saved.*/ +void SavePlotAutomatic(); @@ -187,9 +191,12 @@ void StartDaq(bool start); /** To set the reference to zero after closing a clone * @param id is the id of the clone */ void CloneCloseEvent(int id); - +/**After a pause, the gui is allowed to collect the data + * this is called when it is over */ void UpdatePause(){data_pause_over=true;}; - +/** Shows the first save error message while automatic saving + * @param fileName file name of the first file that it tried to save.*/ +void ShowSaveErrorMessage(QString fileName); @@ -233,14 +240,21 @@ int currentMeasurement; int currentFrame; /** current Index */ int currentIndex; +/** current Scan Division Level */ +int currentScanDivLevel; +/** current scan Value */ +double currentScanValue; /** Number of Exposures */ int number_of_exposures; +/** Number of Frames Per Measurement */ +int number_of_frames; /** Duration between Exposures */ double acquisitionPeriod; /** Acquisition Time */ double exposureTime; + /**variables for threads */ /** */ volatile bool stop_signal; @@ -266,8 +280,19 @@ std::string imageTitle; unsigned int plot_in_scope; /** Number of Pixels in X Axis */ unsigned int nPixelsX; -/** Number of Pixels in Y Axis */ -unsigned int nPixelsY; +/** Number of pixel bins in Y Axis */ +int nPixelsY; +/** Min Pixel number for Y Axis*/ +double minPixelsY; +/** Max Pixel number for Y Axis*/ +double maxPixelsY; +/** starting pixel */ +double startPixel; +/** end Pixel*/ +double endPixel; +/** pixel width */ +double pixelWidth; + /** Current Image Number */ unsigned int lastImageNumber; int last_plot_number; @@ -299,8 +324,14 @@ int progress; bool plotEnable; /**If plot is dotted */ bool plotDotted; - - +/** Save all plots */ +bool saveAll; +/** If error, while automatically saving plots, checks this at the end of an acquistion */ +bool saveError; +/** index of last saved image for automatic saving*/ +int lastSavedFrame; +/** index of measurement number of last saved image for automatic saving*/ +int lastSavedMeasurement; /**if an acquisition is running, so as not to refresh tab * and also to update plot only if running (while creating clones)*/ bool running; @@ -319,9 +350,6 @@ static const double PLOT_TIMER_MS = 250; double timerValue; /** every nth frame when to plot */ int frameFactor; -/** old data that did not get lock(for frame factor)**/ -bool oldCopy; -int oldFrameNumber; /**if frame is enabled in measurement tab */ bool isFrameEnabled; /**if trigger is enabled in measurement tab */ @@ -341,6 +369,7 @@ void LogzSignal(bool); void SetZRangeSignal(double,double); void EnableZRangeSignal(bool); void SetCurrentMeasurementSignal(int); +void saveErrorSignal(QString); }; diff --git a/slsDetectorGui/include/qScanWidget.h b/slsDetectorGui/include/qScanWidget.h index 0b7598ec6..bb7fb2fa9 100644 --- a/slsDetectorGui/include/qScanWidget.h +++ b/slsDetectorGui/include/qScanWidget.h @@ -145,7 +145,7 @@ void BrowseFileStepsPath(); signals: -void EnableScanBox(int,int); +void EnableScanBox(); }; diff --git a/slsDetectorGui/include/qTabActions.h b/slsDetectorGui/include/qTabActions.h index a10b033ad..aaa16951c 100644 --- a/slsDetectorGui/include/qTabActions.h +++ b/slsDetectorGui/include/qTabActions.h @@ -12,9 +12,9 @@ /* Qt Project Class Headers */ #include "qActionsWidget.h" #include "qScanWidget.h" -/** Project Class Headers */ +/** C++ Project Class Headers */ class multiSlsDetector; -class qActionsWidget; +#include "sls_detector_defs.h" /** Qt Include Headers */ #include #include @@ -48,11 +48,19 @@ public: */ void Refresh(); +public slots: +/** Disable Positions + * @param enable true if to disable + * */ +void EnablePositions(bool enable); + private: /** The sls detector object */ multiSlsDetector *myDet; + slsDetectorDefs::detectorType detType; + enum actionIndex{Scan0=1, Scan1, NumPositions=4, NumTotalActions=9}; QGridLayout *gridLayout; @@ -111,7 +119,7 @@ void SetPosition(); void DeletePosition(); signals: -void EnableScanBox(int,int); +void EnableScanBox(); }; diff --git a/slsDetectorGui/include/qTabDataOutput.h b/slsDetectorGui/include/qTabDataOutput.h index f2c9b7edb..a0c3cb1f4 100644 --- a/slsDetectorGui/include/qTabDataOutput.h +++ b/slsDetectorGui/include/qTabDataOutput.h @@ -92,6 +92,10 @@ void SetAngularCorrection(); /**discard bad channels*/ void DiscardBadChannels(); + +signals: +/**signal to enable/disable positions in Actions*/ +void AngularConversionSignal(bool); }; diff --git a/slsDetectorGui/include/qTabPlot.h b/slsDetectorGui/include/qTabPlot.h index 0d75a9d76..2187a6a99 100644 --- a/slsDetectorGui/include/qTabPlot.h +++ b/slsDetectorGui/include/qTabPlot.h @@ -97,10 +97,8 @@ public slots: /** 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(int mode=-1,int id=-1); +void EnableScanBox(); /** a variable is set when timing mode has been changed. * This variable is also disabled if exptime>acq period to be on safe side diff --git a/slsDetectorGui/include/qTabSettings.h b/slsDetectorGui/include/qTabSettings.h index 4404368a0..77d867180 100644 --- a/slsDetectorGui/include/qTabSettings.h +++ b/slsDetectorGui/include/qTabSettings.h @@ -38,12 +38,6 @@ 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 */ @@ -55,7 +49,7 @@ private: /** detector type */ slsDetectorDefs::detectorType detType; - bool expertMode; + enum{Standard,Fast,HighGain,DynamicGain,LowGain,MediumGain,VeryHighGain,Undefined,Uninitialized,NumSettings}; diff --git a/slsDetectorGui/src/qCloneWidget.cpp b/slsDetectorGui/src/qCloneWidget.cpp index c0345813b..606138be5 100644 --- a/slsDetectorGui/src/qCloneWidget.cpp +++ b/slsDetectorGui/src/qCloneWidget.cpp @@ -66,7 +66,7 @@ void qCloneWidget::SetupWidgetWindow(QString title,int numDim,SlsQt1DPlot*& plot cloneBox->setContentsMargins(0,0,0,0); cloneBox->setTitle(title); cloneBox->setAlignment(Qt::AlignHCenter); - cloneBox->setFont(QFont("Sans Serif",11,QFont::Bold)); + cloneBox->setFont(QFont("Sans Serif",11,QFont::Normal)); /** According to dimensions, create appropriate 1D or 2Dplot */ if(numDim==1){ cloneplot1D = plot1D; @@ -82,49 +82,6 @@ void qCloneWidget::SetupWidgetWindow(QString title,int numDim,SlsQt1DPlot*& plot cloneBox->setContentsMargins(0,5,0,0); } - /** Save group box */ -/* - boxSave = new QGroupBox("Save Image",this); - boxSave->setFixedHeight(45); - boxSave->setContentsMargins(0,8,0,0); - layoutSave = new QHBoxLayout; - boxSave->setLayout(layoutSave); - * Label file name - lblFName = new QLabel("File Name:",this); - layoutSave->addWidget(lblFName); - * To get 0 spacing between the next 2 widgets file name and file format - hLayoutSave = new QHBoxLayout(); - layoutSave->addLayout(hLayoutSave); - hLayoutSave->setSpacing(0); - * file name - dispFName = new QLineEdit(this); - dispFName->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); - hLayoutSave->addWidget(dispFName); - * file format - comboFormat = new QComboBox(this); - comboFormat->setFrame(true); - comboFormat->addItem(".gif"); - comboFormat->addItem(".pdf"); - comboFormat->addItem(".png"); - comboFormat->addItem(".gif+"); - comboFormat->addItem(".jpg"); - comboFormat->addItem(".ps"); - comboFormat->addItem(".eps"); - comboFormat->addItem(".xpm"); - comboFormat->addItem(".C"); - hLayoutSave->addWidget(comboFormat); - * save button - btnSave = new QPushButton("Save",this); - btnSave->setFocusPolicy(Qt::NoFocus); - layoutSave->addWidget(btnSave); - * automatic file name check box - chkAutoFName = new QCheckBox("Automatic File Name",this); - layoutSave->addWidget(chkAutoFName); - * automatic save all check box - chkSaveAll = new QCheckBox("Save All",this); - layoutSave->addWidget(chkSaveAll); -*/ - /** main window widgets */ //mainLayout->addWidget(boxSave,0,0); mainLayout->addWidget(cloneBox,1,0); @@ -192,6 +149,22 @@ void qCloneWidget::SavePlot(){ "Formats: .png, .jpg, .xpm.","Snapshot"); } + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +int qCloneWidget::SavePlotAutomatic(){ + char cID[10]; + sprintf(cID,"%d",id); + QString fName = QString(filePath.c_str())+"/Snapshot_"+QString(cID)+".png"; + QImage img(cloneBox->size().width(),cloneBox->size().height(),QImage::Format_RGB32); + QPainter painter(&img); + cloneBox->render(&painter); + if(img.save(fName)) + return 0; + else return -1; + +} //------------------------------------------------------------------------------------------------------------------------------------------------- void qCloneWidget::closeEvent(QCloseEvent* event){ diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 3427df528..98723fe25 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -223,10 +223,12 @@ void qDetectorMain::Initialization(){ connect(tab_measurement, SIGNAL(StopSignal()), this,SLOT(EnableTabs())); connect(tab_measurement, SIGNAL(CheckPlotIntervalSignal()), tab_plot,SLOT(SetFrequency())); connect(tab_measurement, SIGNAL(EnableNthFrameSignal(bool)), tab_plot,SLOT(EnableNthFrame(bool))); + // Data Output Tab + connect(tab_dataoutput, SIGNAL(AngularConversionSignal(bool)), tab_actions,SLOT(EnablePositions(bool))); // Plot tab connect(tab_plot, SIGNAL(DisableZoomSignal(bool)), this,SLOT(SetZoomToolTip(bool))); // Actions tab - connect(tab_actions, SIGNAL(EnableScanBox(int,int)), tab_plot,SLOT(EnableScanBox(int,int))); + connect(tab_actions, SIGNAL(EnableScanBox()), tab_plot,SLOT(EnableScanBox())); // Plotting // When the acquisition is finished, must update the meas tab connect(myPlot, SIGNAL(UpdatingPlotFinished()), this, SLOT(EnableTabs())); @@ -269,7 +271,6 @@ void qDetectorMain::EnableModes(QAction *action){ 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 diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index bd54aac77..7c26be425 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -66,7 +66,7 @@ void qDrawPlot::SetupWidgetWindow(){ nPixelsX = myDet->getTotalNumberOfChannels(); nPixelsY = 100; - + minPixelsY = 0; lastImageArray = 0; image_data = 0; //1d @@ -77,12 +77,12 @@ void qDrawPlot::SetupWidgetWindow(){ currentPersistency = 0; progress = 0; plotEnable=true; + + saveAll = false; plotDotted = false; XYRangeChanged = false; timerValue = PLOT_TIMER_MS; frameFactor=0; - oldCopy = false; - oldFrameNumber = 0; data_pause_over = true;//to get the first image isFrameEnabled = false; isTriggerEnabled = false; @@ -177,38 +177,36 @@ void qDrawPlot::StartStopDaqToggle(bool stop_if_running){ //to get the first image data_pause_over = true; + // Number of Exposures int numFrames = (isFrameEnabled)*((int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1)); int numTriggers = (isTriggerEnabled)*((int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1)); - numFrames = ((numFrames==0)?1:numFrames); numTriggers = ((numTriggers==0)?1:numTriggers); - number_of_exposures = numFrames * numTriggers; - //cout << "\tNumber of Exposures:" << number_of_exposures << endl; - /* have to also look at vector created using npixelsy as size*/ - if(scanArgument==AllFrames) - nPixelsY = number_of_exposures; - else nPixelsY = 100; + number_of_frames = numFrames * numTriggers; + cout << "\tNumber of Frames per Scan/Measurement:" << number_of_frames << endl; - //get #pos and #scansets for level 0 and level 1 - int numPos = myDet->getPositions(); numPos = ((numPos==0)?1:numPos); + //get #scansets for level 0 and level 1 int numScan0 = myDet->getScanSteps(0); numScan0 = ((numScan0==0)?1:numScan0); int numScan1 = myDet->getScanSteps(1); numScan1 = ((numScan1==0)?1:numScan1); - number_of_exposures = number_of_exposures * numPos * numScan0 * numScan1; + number_of_exposures = number_of_frames * numScan0 * numScan1; cout << "\tNumber of Exposures:" << number_of_exposures << endl; - // ExposureTime exposureTime= ((double)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1))*1E-9); cout << "\tExposure Time:" << setprecision (10) << exposureTime << endl; // Acquisition Period acquisitionPeriod= ((double)(myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,-1))*1E-9); cout << "\tAcquisition Period:" << setprecision (10) << acquisitionPeriod << endl; - // Current Index - currentIndex = myDet->getFileIndex(); - cout << "\tCurrent Index:" << currentIndex << endl; + + + //for save automatically, + saveError = false; + lastSavedFrame = -1; + lastSavedMeasurement = -1; + StartDaq(true); running=!running; @@ -266,21 +264,74 @@ bool qDrawPlot::StartOrStopThread(bool start){ progress = 0; currentFrame = 0; stop_signal = 0; - oldFrameNumber = 0; + + //for 2d scans + int currentIndex = myDet->getFileIndex(); + currentScanValue = 0; + currentScanDivLevel = 0; + + + if(scanArgument!=None){ + if(scanArgument==AllFrames){ + maxPixelsY = currentIndex + number_of_exposures - 1; + minPixelsY = currentIndex; + nPixelsY = number_of_exposures; + }else if(scanArgument==FileIndex){ + maxPixelsY = currentIndex + number_of_frames - 1; + minPixelsY = currentIndex; + nPixelsY = number_of_frames; + }else if(scanArgument==Level0){ + //no need to check if numsteps=0,cuz otherwise this mode wont be set in plot tab + int numSteps = myDet->getScanSteps(0); + //if(values) delete [] values; + double *values = new double[numSteps]; + myDet->getScanSteps(0,values); + + maxPixelsY = values[numSteps-1]; + minPixelsY = values[0]; + nPixelsY = numSteps; + currentScanValue = values[0]; + } + pixelWidth = (maxPixelsY -minPixelsY)/(nPixelsY-1); + startPixel = minPixelsY -(pixelWidth/2); + endPixel = maxPixelsY + (pixelWidth/2); + }else{//no scan + nPixelsY = number_of_exposures; + maxPixelsY = 100; + minPixelsY = 0; + startPixel = -0.5; + endPixel = nPixelsY-0.5; + } + cout<<"nPixelsY:"<start((int)(PLOT_TIMER_MS/2)); - }//if frame factor or last frame of last measurement... for all other factors, RETURN - else{ - if(((currentFrame+1==number_of_exposures)&&(currentMeasurement+1==number_of_measurements)) - ||(!((currentFrame)%frameFactor))) - oldCopy = false;//if this works, then we forget old data - else{ - //lastImageNumber= currentFrame+1; - currentFrame++; - currentIndex++; - progress=(int)data->progressIndex; - //if theres an old copy, try to get lock again - if(oldCopy){ -#ifdef VERBOSE - cout << "Copying old data: " << oldFrameNumber << endl; -#endif - if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ - char temp_title[2000]; - // only if you got the lock, do u need to remember lastimagenumber to plot - lastImageNumber= currentFrame; - //1d - if(plot_in_scope==1){ - // Titles - sprintf(temp_title,"Frame Index%d",oldFrameNumber); histTitle[0] = temp_title; - // copy data//memcpy(histXAxis, xvalues,nPixelsX*sizeof(double)); - for(int i=currentPersistency;i>0;i--) - memcpy(histYAxis[i],yvalues[i-1],nPixelsX*sizeof(double)); - memcpy(histYAxis[0],yvalues[0],nPixelsX*sizeof(double)); - }//2d - else{ - // Titles - sprintf(temp_title,"Image Index %d",oldFrameNumber); - imageTitle = temp_title; - // copy data - //memcpy(lastImageArray,image_data,nPixelsX*nPixelsY*sizeof(double)); - } - pthread_mutex_unlock(&(last_image_complete_mutex)); - } - } - return 0; - } - } - } - //if plot disabled, RETURN + + //Plot Disabled if(!plotEnable) { progress=(int)data->progressIndex; - //lastImageNumber= currentFrame+1; currentFrame++; - currentIndex++; return 0; } + + + + //Nth Frame + if(frameFactor){ + //when to copy data + if(((currentFrame+1==number_of_exposures)&&(currentMeasurement+1==number_of_measurements)) + ||(!((currentFrame)%frameFactor))); + //return if not + else{ + progress=(int)data->progressIndex; + currentFrame++; + return 0; + } + } + + + + //Not Nth Frame, Not time out yet + else{ + //if the time is not over, RETURN + if(!data_pause_over){ + progress=(int)data->progressIndex; + currentFrame++; + return 0; + } + data_pause_over=false; + data_pause_timer->start((int)(PLOT_TIMER_MS/2)); + } + + //what comes here has plot enabled AND (frame factor OR data pause over ) progress=(int)data->progressIndex; + + //current index + currentIndex = myDet->getFileIndexFromFileName(string(data->fileName)); + + //scan variable + int currentScanVariable0 = myDet->getCurrentScanVariable(0); + int currentScanVariable1 = myDet->getCurrentScanVariable(1); + + if((currentFrame)<(number_of_exposures)){ #ifdef VERYVERBOSE cout << "Reading in image: " << currentIndex << endl; #endif - - //if scan argument is all frames - if(scanArgument==AllFrames){ - if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ - lastImageNumber= currentFrame+1; - char temp_title[2000]; sprintf(temp_title,"Image Index %d",currentIndex); imageTitle = temp_title; - memcpy(lastImageArray+(currentFrame*nPixelsX),data->values,nPixelsX*sizeof(double)); - pthread_mutex_unlock(&(last_image_complete_mutex)); + //if scan argument is 2d + if(scanArgument!=None){ + if(scanArgument==AllFrames){ + /*title should include which scan, also by measurement tab*/ + if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ + lastImageNumber= currentFrame+1; + char temp_title[2000]; sprintf(temp_title,"Image Index %d",currentIndex); imageTitle = temp_title; + memcpy(lastImageArray+(currentScanDivLevel*nPixelsX),data->values,nPixelsX*sizeof(double)); + pthread_mutex_unlock(&(last_image_complete_mutex)); + } + currentFrame++; + currentScanDivLevel++; + return 0; } - currentFrame++; - currentIndex++; - return 0; + else if(scanArgument==FileIndex){ + /*title should include which scan, also by measurement tab*/ + if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ + if(currentIndex == minPixelsY) currentScanDivLevel = 0; + lastImageNumber= currentFrame+1; + char temp_title[2000]; sprintf(temp_title,"Image Index %d",currentIndex); imageTitle = temp_title; + //memcpy(lastImageArray+(currentIndex*nPixelsX),data->values,nPixelsX*sizeof(double)); + for(unsigned int px=0;pxvalues[px]; + pthread_mutex_unlock(&(last_image_complete_mutex)); + } + currentFrame++; + currentScanDivLevel++; + return 0; + } + else if(scanArgument==Level0){ + /*title should include which scan, also by measurement tab*/ + if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ + if(currentScanVariable0!=currentScanValue) currentScanDivLevel++; + currentScanValue = currentScanVariable0; + + lastImageNumber= currentFrame+1; + char temp_title[2000]; sprintf(temp_title,"Image Index %d",currentIndex); imageTitle = temp_title; + //memcpy(lastImageArray+(currentIndex*nPixelsX),data->values,nPixelsX*sizeof(double)); + + //for(int i=values[currentScan];ivalues,nPixelsX*sizeof(double)); + + //memcpy(lastImageArray+(currentScanDivLevel*nPixelsX),data->values,nPixelsX*sizeof(double)); + for(unsigned int px=0;pxvalues[px]; + cout<<"lastImageArray[0*1280+500]:"<values[px]; + pthread_mutex_unlock(&(last_image_complete_mutex)); + } + currentFrame++; + return 0; + } + } - + //normal measurement or 1d scans if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ char temp_title[2000]; // only if you got the lock, do u need to remember lastimagenumber to plot @@ -443,29 +517,8 @@ int qDrawPlot::GetData(detectorData *data){ //SHOULD BE memcpy(lastImageArray,data->values,nPixelsX*nPixelsY*sizeof(double)); } pthread_mutex_unlock(&(last_image_complete_mutex)); - }//copies old data only if its frame factor - else if(frameFactor){ - oldCopy = true; - oldFrameNumber = currentIndex; - //1D - if(plot_in_scope==1){ - // Persistency - if(currentPersistency < persistency)currentPersistency++; - else currentPersistency=persistency; - nHists = currentPersistency+1; - // copy old data - for(int i=currentPersistency;i>0;i--) - memcpy(yvalues[i],yvalues[i-1],nPixelsX*sizeof(double)); - nHists = currentPersistency+1; - memcpy(yvalues[0],data->values,nPixelsX*sizeof(double)); - }//2D - else{ - // copy old data - //memcpy(image_data,data->values,nPixelsX*nPixelsY*sizeof(double)); - } } currentFrame++; - currentIndex++; } } #ifdef VERYVERBOSE @@ -548,6 +601,7 @@ void qDrawPlot::UpdatePlot(){ plot1D->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]); XYRangeChanged = false; } + if(saveAll) SavePlotAutomatic(); } } //2-d plot stuff @@ -555,7 +609,8 @@ void qDrawPlot::UpdatePlot(){ if(lastImageArray){ if(lastImageNumber&&last_plot_number!=(int)lastImageNumber && //there is a new plot nPixelsX>0&&nPixelsY>0){ - plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,-0.5,nPixelsY-0.5,lastImageArray); + //plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,-0.5,nPixelsY-0.5,lastImageArray); + plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,startPixel,endPixel,lastImageArray); plot2D->setTitle(GetImageTitle()); plot2D->SetXTitle(imageXAxisTitle); plot2D->SetYTitle(imageYAxisTitle); @@ -572,6 +627,7 @@ void qDrawPlot::UpdatePlot(){ plot2D->GetPlot()->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]); XYRangeChanged = false; } + if(saveAll) SavePlotAutomatic(); } } last_plot_number=lastImageNumber; @@ -595,7 +651,6 @@ void qDrawPlot::UpdatePlot(){ }// To start the next measurement else{ emit SetCurrentMeasurementSignal(currentMeasurement); - currentIndex++; StopDaqForGui(); StartDaq(true); } @@ -659,6 +714,27 @@ void qDrawPlot::ClonePlot(){ connect(winClone[i], SIGNAL(CloneClosedSignal(int)),this, SLOT(CloneCloseEvent(int))); } +//------------------------------------------------------------------------------------------------------------------------------------------------- + +void qDrawPlot::SaveClones(){ + char errID[200]; + string errMessage= "The Snapshots with ID's: "; + bool success = true; + for(int i=0;iSavePlotAutomatic()){ + success = false; + sprintf(errID,"%d",i); + errMessage.append(string(errID)+string(", ")); + } + } + if(success) + qDefs::InfoMessage("The Snapshots have all been saved successfully in .png.","Dock"); + else + qDefs::WarningMessage(errMessage + string("were not saved."),"Dock"); +} + + //------------------------------------------------------------------------------------------------------------------------------------------------- void qDrawPlot::CloseClones(){ @@ -697,6 +773,57 @@ void qDrawPlot::SavePlot(){ "Formats: .png, .jpg, .xpm.","Dock"); } + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qDrawPlot::SaveAll(bool enable){ + string msg = string("The Files will be saved as:\n")+ + string(myDet->getFilePath().c_str())+string("/")+ + string(myDet->getFileName().c_str())+string("_[File Index].png"); + qDefs::InfoMessage(msg,"Dock"); + saveAll = enable; +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + +void qDrawPlot::SavePlotAutomatic(){ + //no need to save the same plot many times + if((currentFrame>lastSavedFrame)&&(currentMeasurement>=lastSavedMeasurement)){ + lastSavedFrame = currentFrame; + lastSavedMeasurement = currentMeasurement; + char cID[10]; + sprintf(cID,"%d",lastSavedFrame); + QString fName = QString(myDet->getFilePath().c_str())+QString("/")+ + QString(myDet->getFileName().c_str())+QString("_")+ + QString(cID)+".png"; + QImage img(size().width(),size().height(),QImage::Format_RGB32); + QPainter painter(&img); + render(&painter); + //if error while saving + if(!img.save(fName)){ + //mention the error only the first time + if(!saveError){ + //so it doesnt repeat again + saveError = true; + connect(this,SIGNAL(saveErrorSignal(QString)),this,SLOT(ShowSaveErrorMessage(QString))); + emit saveErrorSignal(fName); + } + } + } +} + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qDrawPlot::ShowSaveErrorMessage(QString fileName){ + qDefs::WarningMessage(string("Automatic Saving: Could not save the first file:\n")+ + string(fileName.toAscii().constData()) + string("\n\nNote: Will not show future file save errors for this acquisition."),"Dock"); + +} + + //------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/slsDetectorGui/src/qScanWidget.cpp b/slsDetectorGui/src/qScanWidget.cpp index 8ce46108e..158db4b0b 100644 --- a/slsDetectorGui/src/qScanWidget.cpp +++ b/slsDetectorGui/src/qScanWidget.cpp @@ -385,7 +385,7 @@ int qScanWidget::SetScan(int mode){ } } - emit EnableScanBox(actualMode,id); + emit EnableScanBox(); return qDefs::OK; } diff --git a/slsDetectorGui/src/qTabActions.cpp b/slsDetectorGui/src/qTabActions.cpp index e315c4858..1c39a0420 100644 --- a/slsDetectorGui/src/qTabActions.cpp +++ b/slsDetectorGui/src/qTabActions.cpp @@ -81,13 +81,6 @@ void qTabActions::SetupWidgetWindow(){ btnExpand[i]->setToolTip(tip); group->addButton(btnExpand[i],i); - //Number of positions is only for mythen or gotthard - slsDetectorDefs::detectorType detType = myDet->getDetectorsType(); - if((detType == slsDetectorDefs::EIGER) || (detType == slsDetectorDefs::AGIPD)) { - lblName[NumPositions]->setEnabled(false); - btnExpand[NumPositions]->setEnabled(false); - } - //add the widgets to the layout , depending on the type create the widgets gridLayout->addWidget(btnExpand[i],(i*2),0); gridLayout->addWidget(lblName[i],(i*2),1); @@ -111,6 +104,21 @@ void qTabActions::SetupWidgetWindow(){ } + //Number of positions is only for mythen or gotthard + detType = myDet->getDetectorsType(); + if((detType == slsDetectorDefs::EIGER) || (detType == slsDetectorDefs::AGIPD)) { + lblName[NumPositions]->setEnabled(false); + btnExpand[NumPositions]->setEnabled(false); + }else{ + //disable positions if angular conversion is enabled + int ang; + if(!myDet->getAngularConversion(ang)){ + lblName[NumPositions]->setEnabled(false); + btnExpand[NumPositions]->setEnabled(false); + } + + } + } @@ -181,7 +189,7 @@ void qTabActions::Initialization(){ connect(group, SIGNAL(buttonClicked(QAbstractButton*)), this,SLOT(Expand(QAbstractButton*))); //enable scan box in plot tab for(int i=0;isetEnabled(true); + btnExpand[NumPositions]->setEnabled(true); + }else{ + //to collapse if it was expanded + if(btnExpand[NumPositions]->text()=="-") + Expand(group->button(NumPositions)); + comboPos->clear(); + lblName[NumPositions]->setPalette(lblName[NumPositions-1]->palette()); + lblName[NumPositions]->setEnabled(false); + btnExpand[NumPositions]->setEnabled(false); + } +} + + //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -308,38 +337,43 @@ void qTabActions::Refresh(){ #ifdef VERBOSE cout << "\nUpdating all action widgets " << endl; #endif - if(lblName[NumPositions]->isEnabled()){ - //delete existing positions - if (positions) delete [] positions; - //get number of positions - int numPos=myDet->getPositions(); - comboPos->setMaxCount(numPos); + if((detType == slsDetectorDefs::MYTHEN) || (detType == slsDetectorDefs::GOTTHARD)){ + //positions is enabled only if angular conversion is enabled + int ang; if(!myDet->getAngularConversion(ang)) EnablePositions(false); - //set the number of positions in the gui - disconnect(spinNumPos, SIGNAL(valueChanged(int)), this, SLOT(SetPosition())); - spinNumPos->setValue(numPos); - connect(spinNumPos, SIGNAL(valueChanged(int)), this, SLOT(SetPosition())); + if(lblName[NumPositions]->isEnabled()){ + //delete existing positions + if (positions) delete [] positions; + //get number of positions + int numPos=myDet->getPositions(); + comboPos->setMaxCount(numPos); - positions=new double[numPos]; - //load the positions - myDet->getPositions(positions); + //set the number of positions in the gui + disconnect(spinNumPos, SIGNAL(valueChanged(int)), this, SLOT(SetPosition())); + spinNumPos->setValue(numPos); + connect(spinNumPos, SIGNAL(valueChanged(int)), this, SLOT(SetPosition())); - //delete the combolist and reload it - disconnect(comboPos,SIGNAL(currentIndexChanged(int)), this, SLOT(SetPosition())); - comboPos->setEnabled(numPos); - lblPosList->setEnabled(numPos); - lblPosList->setText("List of Positions: "); - lblPosList->setPalette(normal); - for(int i=0;icount();i++) - comboPos->removeItem(i); - for(int i=0;iinsertItem(i,QString("%1").arg(positions[i])); - connect(comboPos, SIGNAL(currentIndexChanged(int)), this, SLOT(SetPosition())); + positions=new double[numPos]; + //load the positions + myDet->getPositions(positions); + + //delete the combolist and reload it + disconnect(comboPos,SIGNAL(currentIndexChanged(int)), this, SLOT(SetPosition())); + comboPos->setEnabled(numPos); + lblPosList->setEnabled(numPos); + lblPosList->setText("List of Positions: "); + lblPosList->setPalette(normal); + for(int i=0;icount();i++) + comboPos->removeItem(i); + for(int i=0;iinsertItem(i,QString("%1").arg(positions[i])); + connect(comboPos, SIGNAL(currentIndexChanged(int)), this, SLOT(SetPosition())); #ifdef VERBOSE - cout << "Updated position widget\tnum:" << numPos << endl << endl; + cout << "Updated position widget\tnum:" << numPos << endl << endl; #endif + } } for(int i=0;iRefresh(); diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index 3aeb9512f..9c570092c 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -343,16 +343,21 @@ void qTabDataOutput::SetAngularCorrection(){ cout << "Entering Set Angular Correction function" << endl; #endif if(chkAngular->isChecked()){ - myDet->setAngularConversionFile("default"); + if(myDet->setAngularConversionFile("default")){ #ifdef VERBOSE cout << "Setting angular conversion to default" << endl; #endif + }else{ + qDefs::WarningMessage("Angular Conversion could not be set.","Data Output"); + chkAngular->setChecked(false); + } }else{ myDet->setAngularConversionFile(""); #ifdef VERBOSE cout << "Unsetting angular correction" << endl; #endif } + emit AngularConversionSignal(chkAngular->isChecked()); } @@ -393,6 +398,7 @@ void qTabDataOutput::Refresh(){ int ang; if(myDet->getAngularConversion(ang)) chkAngular->setChecked(true); + emit AngularConversionSignal(chkAngular->isChecked()); } //discard bad channels from server if(myDet->getBadChannelCorrection()) chkDiscardBad->setChecked(true); diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index 2feb82ea3..f76cd10aa 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -94,6 +94,20 @@ void qTabPlot::SetupWidgetWindow(){ dispYMax->setValidator(new QDoubleValidator(dispYMax)); dispZMax->setValidator(new QDoubleValidator(dispZMax)); + //default titles + dispTitle->setText(defaultPlotTitle); + myPlot->SetPlotTitle(defaultPlotTitle); + dispXAxis->setText(defaultHistXAxisTitle); + dispYAxis->setText(defaultHistYAxisTitle); + myPlot->SetHistXAxisTitle(defaultHistXAxisTitle); + myPlot->SetHistYAxisTitle(defaultHistYAxisTitle); + dispXAxis->setText(defaultImageXAxisTitle); + dispYAxis->setText(defaultImageYAxisTitle); + dispZAxis->setText(defaultImageZAxisTitle); + myPlot->SetImageXAxisTitle(defaultImageXAxisTitle); + myPlot->SetImageYAxisTitle(defaultImageYAxisTitle); + myPlot->SetImageZAxisTitle(defaultImageZAxisTitle); + // Plotting Frequency stackedLayout = new QStackedLayout; @@ -147,18 +161,12 @@ void qTabPlot::SetupWidgetWindow(){ void qTabPlot::Select1DPlot(bool b){ isOneD = b; - dispTitle->setText(defaultPlotTitle); - myPlot->SetPlotTitle(defaultPlotTitle); if(b){ box1D->show(); box2D->hide(); chkZAxis->setEnabled(false); chkZMin->setEnabled(false); chkZMax->setEnabled(false); - dispXAxis->setText(defaultHistXAxisTitle); - dispYAxis->setText(defaultHistYAxisTitle); - myPlot->SetHistXAxisTitle(defaultHistXAxisTitle); - myPlot->SetHistYAxisTitle(defaultHistYAxisTitle); myPlot->Select1DPlot(); }else{ box1D->hide(); @@ -166,15 +174,8 @@ void qTabPlot::Select1DPlot(bool b){ chkZAxis->setEnabled(true); chkZMin->setEnabled(true); chkZMax->setEnabled(true); - dispXAxis->setText(defaultImageXAxisTitle); - dispYAxis->setText(defaultImageYAxisTitle); - dispZAxis->setText(defaultImageZAxisTitle); - myPlot->SetImageXAxisTitle(defaultImageXAxisTitle); - myPlot->SetImageYAxisTitle(defaultImageYAxisTitle); - myPlot->SetImageZAxisTitle(defaultImageZAxisTitle); myPlot->Select2DPlot(); } - } @@ -188,9 +189,11 @@ void qTabPlot::Initialization(){ connect(radioDataGraph, SIGNAL(toggled(bool)),this, SLOT(SetPlot())); // Scan box connect(btnGroupScan, SIGNAL(buttonClicked(QAbstractButton *)),this, SLOT(SetScanArgument())); + connect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox())); // Snapshot box connect(btnClone, SIGNAL(clicked()),myPlot, SLOT(ClonePlot())); connect(btnCloseClones, SIGNAL(clicked()),myPlot, SLOT(CloseClones())); + connect(btnSaveClones, SIGNAL(clicked()),myPlot, SLOT(SaveClones())); // 1D Plot box connect(chkSuperimpose, SIGNAL(toggled(bool)), this, SLOT(EnablePersistency(bool))); connect(spinPersistency,SIGNAL(valueChanged(int)), myPlot,SLOT(SetPersistency(int))); @@ -228,12 +231,14 @@ void qTabPlot::Initialization(){ connect(dispYMax, SIGNAL(returnPressed()), this, SLOT(SetAxesRange())); connect(dispZMin, SIGNAL(returnPressed()), this, SLOT(SetZRange())); connect(dispZMax, SIGNAL(returnPressed()), this, SLOT(SetZRange())); +// Save + connect(btnSave, SIGNAL(clicked()), myPlot, SLOT(SavePlot())); + connect(chkSaveAll, SIGNAL(toggled(bool)), myPlot, SLOT(SaveAll(bool))); connect(this,SIGNAL(SetZRangeSignal(double,double)),myPlot, SIGNAL(SetZRangeSignal(double,double))); -// Common Buttons -// Save - connect(btnSave, SIGNAL(clicked()), myPlot, SLOT(SavePlot())); + + } @@ -485,7 +490,7 @@ void qTabPlot::SetFrequency(){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void qTabPlot::EnableScanBox(int mode,int id){ +void qTabPlot::EnableScanBox(){ #ifdef VERYVERBOSE cout << "Entering Enable Scan Box() \t mode:" << mode << " \t id:" << id << endl; #endif @@ -493,25 +498,42 @@ void qTabPlot::EnableScanBox(int mode,int id){ int mode0 = myDet->getScanMode(0); int mode1 = myDet->getScanMode(1); + //if it was checked before or disabled before, it remembers to check it again + bool checkedBefore = (boxScan->isChecked()||(!boxScan->isEnabled())); + //only now enable/disable boxScan->setEnabled(mode0||mode1); + //if there are scan if(boxScan->isEnabled()){ //make sure nth frame frequency plot is disabled EnablingNthFrameFunction(false); - //if level0 or 1, check argument to find which scan enabled last from actions tab - if((btnGroupScan->checkedId()!=2)&&(btnGroupScan->checkedId()!=3)){ - cout<<"mode:"<0){ - if(!id) radioLevel0->setChecked(true); - else radioLevel1->setChecked(true); + //if 2d is chosen or not for scan + if(boxScan->isChecked()){ + + boxScan->setChecked(checkedBefore); + //make sure nth frame frequency plot is disabled + EnablingNthFrameFunction(false); + + // + if(mode0 && mode1){ + if(!radioFileIndex->isChecked()) radioAllFrames->setChecked(true); + radioLevel0->setEnabled(false); + radioLevel1->setEnabled(false); + }else{ + radioLevel0->setEnabled(mode0); + radioLevel1->setEnabled(mode1); + } + + //only if level0 or level1 is checked + if((radioLevel0->isChecked())||(radioLevel1->isChecked())){ + if(mode0) radioLevel0->setChecked(true); + if(mode1) radioLevel1->setChecked(true); } } + } + else EnablingNthFrameFunction(enableNFrame); - radioLevel0->setEnabled(mode0); - radioLevel1->setEnabled(mode1); - }else EnablingNthFrameFunction(enableNFrame); //sets the scan argument SetScanArgument(); @@ -542,13 +564,13 @@ void qTabPlot::EnablingNthFrameFunction(bool enable){ } //------------------------------------------------------------------------------------------------------------------------------------------------- - +/** What happens for 2d????*/ void qTabPlot::SetScanArgument(){ //as default from histogram and default titles are set here if scanbox is disabled Select1DPlot(isOrginallyOneD); - //this function is also called just to update, could be no scan + //if scans if(boxScan->isEnabled()){ //setting the title according to the scans @@ -556,52 +578,58 @@ void qTabPlot::SetScanArgument(){ QString(" | Level 1 : ") + modeNames[myDet->getScanMode(1)] + QString(""); dispTitle->setText(mainTitle); myPlot->SetPlotTitle(mainTitle); + }else{ + dispTitle->setText(defaultPlotTitle); + myPlot->SetPlotTitle(defaultPlotTitle); + dispXAxis->setText(defaultHistXAxisTitle); + dispYAxis->setText(defaultHistYAxisTitle); + myPlot->SetHistXAxisTitle(defaultHistXAxisTitle); + myPlot->SetHistYAxisTitle(defaultHistYAxisTitle); + dispXAxis->setText(defaultImageXAxisTitle); + dispYAxis->setText(defaultImageYAxisTitle); + dispZAxis->setText(defaultImageZAxisTitle); + myPlot->SetImageXAxisTitle(defaultImageXAxisTitle); + myPlot->SetImageYAxisTitle(defaultImageYAxisTitle); + myPlot->SetImageZAxisTitle(defaultImageZAxisTitle); + } + //for 2d + if((boxScan->isEnabled())&&(boxScan->isChecked())){ //let qdrawplot know which scan argument myPlot->SetScanArgument(btnGroupScan->checkedId()+1); - /** What happens for 2d????*/ - //settings the x and y titles + + //default titles for 2d scan + dispXAxis->setText("Channel Number"); + myPlot->SetImageXAxisTitle("Channel Number"); + dispZAxis->setText("Counts"); + myPlot->SetImageZAxisTitle("Counts"); + + //titles for y of 2d scan switch(btnGroupScan->checkedId()){ - //level0 - case 0: - dispXAxis->setText("Channel Number"); + case 0://level0 dispYAxis->setText("Scan Level 0"); - myPlot->SetHistXAxisTitle("Channel Number"); - myPlot->SetHistYAxisTitle("Scan Level 0"); - myPlot->Select1DPlot(); + myPlot->SetImageYAxisTitle("Scan Level 0"); break; - - //level1 - case 1: - dispXAxis->setText("Channel Number"); + case 1://level1 dispYAxis->setText("Scan Level 1"); - myPlot->SetHistXAxisTitle("Channel Number"); - myPlot->SetHistYAxisTitle("Scan Level 1"); - myPlot->Select1DPlot(); + myPlot->SetImageYAxisTitle("Scan Level 1"); break; - - //file index - case 2: - dispXAxis->setText("Channel Number"); + break; + case 2://file index dispYAxis->setText("File Index"); - myPlot->SetHistXAxisTitle("Channel Number"); - myPlot->SetHistYAxisTitle("File Index"); - myPlot->Select1DPlot(); + myPlot->SetImageYAxisTitle("File Index"); break; - - //all frames - case 3: - Select1DPlot(false); - dispXAxis->setText("Channel Number"); - dispYAxis->setText("Threshold"); - dispZAxis->setText("Intensity"); - myPlot->SetImageXAxisTitle("Channel Number"); - myPlot->SetImageYAxisTitle("Threshold"); - myPlot->SetImageZAxisTitle("Intensity"); - myPlot->Select2DPlot(); + case 3://all frames + dispYAxis->setText("All Frames"); + myPlot->SetImageYAxisTitle("All Frames"); break; } + + //set plot to 2d + Select1DPlot(false); + myPlot->Select2DPlot(); + }else //done here so that it isnt set by default each time myPlot->SetScanArgument(0); diff --git a/slsDetectorGui/src/qTabSettings.cpp b/slsDetectorGui/src/qTabSettings.cpp index 43939e73e..430046fde 100644 --- a/slsDetectorGui/src/qTabSettings.cpp +++ b/slsDetectorGui/src/qTabSettings.cpp @@ -17,7 +17,7 @@ using namespace std; //------------------------------------------------------------------------------------------------------------------------------------------------- qTabSettings::qTabSettings(QWidget *parent,multiSlsDetector*& detector,int detID): - QWidget(parent),myDet(detector),detID(detID), expertMode(false){ + QWidget(parent),myDet(detector),detID(detID){ setupUi(this); SetupWidgetWindow(); @@ -172,9 +172,9 @@ void qTabSettings::setSettings(int index){ lblThreshold->setEnabled(false); spinThreshold->setEnabled(false); }else{ - lblThreshold->setEnabled(expertMode); - spinThreshold->setEnabled(expertMode); - if(expertMode) SetEnergy(); + lblThreshold->setEnabled(true); + spinThreshold->setEnabled(true); + SetEnergy(); } } } @@ -273,9 +273,9 @@ void qTabSettings::Refresh(){ lblThreshold->setEnabled(false); spinThreshold->setEnabled(false); }else{ - lblThreshold->setEnabled(expertMode); - spinThreshold->setEnabled(expertMode); - if(expertMode) SetEnergy(); + lblThreshold->setEnabled(true); + spinThreshold->setEnabled(true); + SetEnergy(); } } From 51e7feb60502ea1f29789e3cab79f264ab913650 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Mon, 27 Aug 2012 14:50:59 +0000 Subject: [PATCH 039/332] the scans work git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@39 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_detectormain.ui | 33 +++++++++++++++++--- slsDetectorGui/src/qDetectorMain.cpp | 37 +++++++++++++++++++++-- 2 files changed, 63 insertions(+), 7 deletions(-) diff --git a/slsDetectorGui/forms/form_detectormain.ui b/slsDetectorGui/forms/form_detectormain.ui index e7aedd325..9d3577730 100644 --- a/slsDetectorGui/forms/form_detectormain.ui +++ b/slsDetectorGui/forms/form_detectormain.ui @@ -232,6 +232,11 @@ + + + + + @@ -380,7 +385,7 @@ p, li { white-space: pre-wrap; } - &Open Setup + Load &Setup @@ -388,7 +393,7 @@ p, li { white-space: pre-wrap; } - &Save Setup + Save &Setup @@ -401,12 +406,12 @@ p, li { white-space: pre-wrap; } - &Open Configuration + Load &Configuration - &Save Configuration + Save &Configuration @@ -481,6 +486,26 @@ p, li { white-space: pre-wrap; } &Dockable Windows + + + Load &Trimbits + + + + + Save &Trimbits + + + + + Load C&alibration + + + + + Save C&alibration + + diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 98723fe25..b09024f6c 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -147,6 +147,10 @@ void qDetectorMain::SetUpWidgetWindow(){ tabs->setTabEnabled(Debugging,false); //beamline mode to false tabs->setTabEnabled(Advanced,false); + actionLoadTrimbits->hide(); + actionSaveTrimbits->hide(); + actionLoadCalibration->hide(); + actionSaveCalibration->hide(); dockWidgetPlot->setFloating(false); dockWidgetPlot->setFeatures(QDockWidget::NoDockWidgetFeatures); tabs->setTabEnabled(Developer,isDeveloper); @@ -271,6 +275,17 @@ void qDetectorMain::EnableModes(QAction *action){ else if(action==actionExpert){ enable = actionExpert->isChecked(); tabs->setTabEnabled(Advanced,enable); + if(enable){ + actionLoadTrimbits->show(); + actionSaveTrimbits->show(); + actionLoadCalibration->show(); + actionSaveCalibration->show(); + }else{ + actionLoadTrimbits->hide(); + actionSaveTrimbits->hide(); + actionLoadCalibration->hide(); + actionSaveCalibration->hide(); + } #ifdef VERBOSE cout << "Setting Expert Mode to " << enable << endl; #endif @@ -299,7 +314,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ if(action==actionOpenSetup){ #ifdef VERBOSE - cout << "Opening Setup" << endl; + cout << "Loading Setup" << endl; #endif QString fName = QString(myDet->getFilePath().c_str()); fName = QFileDialog::getOpenFileName(this, @@ -332,7 +347,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ } else if(action==actionOpenConfiguration){ #ifdef VERBOSE - cout << "Opening Configuration" << endl; + cout << "Loading Configuration" << endl; #endif QString fName = QString(myDet->getFilePath().c_str()); fName = QFileDialog::getOpenFileName(this, @@ -477,14 +492,30 @@ void qDetectorMain::EnableTabs(){ if(enable==false){ tabs->setTabEnabled(Debugging,enable); tabs->setTabEnabled(Advanced,enable); + actionLoadTrimbits->hide(); + actionSaveTrimbits->hide(); + actionLoadCalibration->hide(); + actionSaveCalibration->hide(); tabs->setTabEnabled(Developer,enable); } else{ // enable these tabs only if they were enabled earlier if(actionDebug->isChecked()) tabs->setTabEnabled(Debugging,enable); - if(actionExpert->isChecked()) + if(actionExpert->isChecked()){ tabs->setTabEnabled(Advanced,enable); + if(enable){ + actionLoadTrimbits->show(); + actionSaveTrimbits->show(); + actionLoadCalibration->show(); + actionSaveCalibration->show(); + }else{ + actionLoadTrimbits->hide(); + actionSaveTrimbits->hide(); + actionLoadCalibration->hide(); + actionSaveCalibration->hide(); + } + } if(isDeveloper) tabs->setTabEnabled(Developer,enable); } From c9ecec183f0d8b158438d49e944559e277f03206 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 29 Aug 2012 09:06:49 +0000 Subject: [PATCH 040/332] included position scan git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@40 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_scan.ui | 5 + slsDetectorGui/forms/form_tab_advanced.ui | 215 ---------------------- slsDetectorGui/include/qDetectorMain.h | 2 + slsDetectorGui/include/qDrawPlot.h | 1 + slsDetectorGui/include/qScanWidget.h | 2 +- slsDetectorGui/slsDetectorGui.pro | 2 +- slsDetectorGui/src/qCloneWidget.cpp | 2 +- slsDetectorGui/src/qDetectorMain.cpp | 75 +++++--- slsDetectorGui/src/qDrawPlot.cpp | 46 +++-- slsDetectorGui/src/qScanWidget.cpp | 66 +++---- slsDetectorGui/src/qTabPlot.cpp | 3 +- 11 files changed, 116 insertions(+), 303 deletions(-) diff --git a/slsDetectorGui/forms/form_scan.ui b/slsDetectorGui/forms/form_scan.ui index 68321732c..0d8cf06ea 100644 --- a/slsDetectorGui/forms/form_scan.ui +++ b/slsDetectorGui/forms/form_scan.ui @@ -369,6 +369,11 @@ Trimbits Scan + + + Position Scan + + Custom Script diff --git a/slsDetectorGui/forms/form_tab_advanced.ui b/slsDetectorGui/forms/form_tab_advanced.ui index a78e1c4ea..38987ac72 100644 --- a/slsDetectorGui/forms/form_tab_advanced.ui +++ b/slsDetectorGui/forms/form_tab_advanced.ui @@ -31,208 +31,6 @@ Form - - - - 25 - 83 - 740 - 93 - - - - Files: - - - - 0 - - - 0 - - - 0 - - - 5 - - - -1 - - - 9 - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - Trimbit File: - - - - - - - - 0 - 0 - - - - Load - - - - - - - - 0 - 0 - - - - Save - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 120 - 20 - - - - - - - - - 0 - 0 - - - - Calibration File: - - - - - - - - 0 - 0 - - - - Load - - - - - - - - 0 - 0 - - - - Save - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 40 - 20 - - - - - - - - - - - 0 - 0 - - - - Output File: - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 40 - 20 - - - - - - - - - - - Browse - - - - - - - @@ -310,19 +108,6 @@ - - - - - 0 - 0 - - - - Offline Improvement - - - diff --git a/slsDetectorGui/include/qDetectorMain.h b/slsDetectorGui/include/qDetectorMain.h index 5142b62b8..1e80ccd3f 100644 --- a/slsDetectorGui/include/qDetectorMain.h +++ b/slsDetectorGui/include/qDetectorMain.h @@ -68,6 +68,8 @@ private: multiSlsDetector *myDet; /** sls detector id */ int detID; + /** true for mythen and eiger */ + bool digitalDetector; /** The Plot widget */ qDrawPlot *myPlot; /**Tab Widget */ diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index f0e578f65..e7bb9f3c9 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -206,6 +206,7 @@ private: multiSlsDetector *myDet; + /** Widgets needed to plot the clone */ /** Max Number of Clone Windows */ static const int MAXCloneWindows = 50; diff --git a/slsDetectorGui/include/qScanWidget.h b/slsDetectorGui/include/qScanWidget.h index bb7fb2fa9..927fb7e22 100644 --- a/slsDetectorGui/include/qScanWidget.h +++ b/slsDetectorGui/include/qScanWidget.h @@ -45,7 +45,7 @@ private: int id; /**type of steps*/ enum sizeIndex{RangeValues, CustomValues, FileValues}; - enum modes{None,EnergyScan,ThresholdScan,TrimbitsScan,CustomScript,NumModes}; + enum modes{None,EnergyScan,ThresholdScan,TrimbitsScan,PositionScan,CustomScript,NumModes}; static const string modeNames[NumModes]; /**values*/ diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index a57c8e744..c7593e21e 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -6,7 +6,7 @@ UI_HEADERS_DIR = forms/include RESOURCES += icons.qrc -DEFINES += VERBOSE DACS_INT #VERYVERBOSE +DEFINES += VERBOSE DACS_INT VERYVERBOSE target.path += $(DESTDIR) diff --git a/slsDetectorGui/src/qCloneWidget.cpp b/slsDetectorGui/src/qCloneWidget.cpp index 606138be5..5539ed5ce 100644 --- a/slsDetectorGui/src/qCloneWidget.cpp +++ b/slsDetectorGui/src/qCloneWidget.cpp @@ -79,7 +79,7 @@ void qCloneWidget::SetupWidgetWindow(QString title,int numDim,SlsQt1DPlot*& plot //cloneplot2D->setContentsMargins(0,0,0,0); gridClone->addWidget(cloneplot2D,0,0); cloneBox->setFlat(true); - cloneBox->setContentsMargins(0,5,0,0); + cloneBox->setContentsMargins(0,20,0,0); } /** main window widgets */ diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index b09024f6c..80e5683ec 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -147,10 +147,10 @@ void qDetectorMain::SetUpWidgetWindow(){ tabs->setTabEnabled(Debugging,false); //beamline mode to false tabs->setTabEnabled(Advanced,false); - actionLoadTrimbits->hide(); - actionSaveTrimbits->hide(); - actionLoadCalibration->hide(); - actionSaveCalibration->hide(); + actionLoadTrimbits->setVisible(false); + actionSaveTrimbits->setVisible(false); + actionLoadCalibration->setVisible(false); + actionSaveCalibration->setVisible(false); dockWidgetPlot->setFloating(false); dockWidgetPlot->setFeatures(QDockWidget::NoDockWidgetFeatures); tabs->setTabEnabled(Developer,isDeveloper); @@ -193,10 +193,11 @@ void qDetectorMain::SetUpDetector(){ else{ 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; + switch(detType){//digitalDetector decides if trimbits should be shown + case slsDetectorDefs::MYTHEN: digitalDetector = true; break; + case slsDetectorDefs::EIGER: digitalDetector = true; break; + case slsDetectorDefs::GOTTHARD: digitalDetector = false;break; + case slsDetectorDefs::AGIPD: digitalDetector = false;break; default: string detName = myDet->slsDetectorBase::getDetectorType(detType); string errorMess = host+string(" has unknown detector type \"")+ @@ -275,16 +276,16 @@ void qDetectorMain::EnableModes(QAction *action){ else if(action==actionExpert){ enable = actionExpert->isChecked(); tabs->setTabEnabled(Advanced,enable); - if(enable){ - actionLoadTrimbits->show(); - actionSaveTrimbits->show(); - actionLoadCalibration->show(); - actionSaveCalibration->show(); + if((enable)&&(digitalDetector)){ + actionLoadTrimbits->setVisible(true); + actionSaveTrimbits->setVisible(true); + actionLoadCalibration->setVisible(true); + actionSaveCalibration->setVisible(true); }else{ - actionLoadTrimbits->hide(); - actionSaveTrimbits->hide(); - actionLoadCalibration->hide(); - actionSaveCalibration->hide(); + actionLoadTrimbits->setVisible(false); + actionSaveTrimbits->setVisible(false); + actionLoadCalibration->setVisible(false); + actionSaveCalibration->setVisible(false); } #ifdef VERBOSE cout << "Setting Expert Mode to " << enable << endl; @@ -373,6 +374,20 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ qDefs::InfoMessage("The configuration parameters have been successfully saved.","Main"); } } + else if(action==actionLoadTrimbits){ +#ifdef VERBOSE + cout << "Loading Trimbits" << endl; +#endif + QString fName = QString(myDet->getFilePath().c_str()); + fName = QFileDialog::getOpenFileName(this, + tr("Load Detector Trimbits"),fName, + tr("Trimbit files (*.trim *.sn*)")); + // Gets called when cancelled as well + if (!fName.isEmpty()){ + //myDet->readConfigurationFile(string(fName.toAscii().constData())); + qDefs::InfoMessage("The parameters have been successfully configured.","Main"); + } + } Refresh(tabs->currentIndex()); } @@ -492,10 +507,10 @@ void qDetectorMain::EnableTabs(){ if(enable==false){ tabs->setTabEnabled(Debugging,enable); tabs->setTabEnabled(Advanced,enable); - actionLoadTrimbits->hide(); - actionSaveTrimbits->hide(); - actionLoadCalibration->hide(); - actionSaveCalibration->hide(); + actionLoadTrimbits->setVisible(false); + actionSaveTrimbits->setVisible(false); + actionLoadCalibration->setVisible(false); + actionSaveCalibration->setVisible(false); tabs->setTabEnabled(Developer,enable); } else{ @@ -504,16 +519,16 @@ void qDetectorMain::EnableTabs(){ tabs->setTabEnabled(Debugging,enable); if(actionExpert->isChecked()){ tabs->setTabEnabled(Advanced,enable); - if(enable){ - actionLoadTrimbits->show(); - actionSaveTrimbits->show(); - actionLoadCalibration->show(); - actionSaveCalibration->show(); + if((enable)&&(digitalDetector)){ + actionLoadTrimbits->setVisible(true); + actionSaveTrimbits->setVisible(true); + actionLoadCalibration->setVisible(true); + actionSaveCalibration->setVisible(true); }else{ - actionLoadTrimbits->hide(); - actionSaveTrimbits->hide(); - actionLoadCalibration->hide(); - actionSaveCalibration->hide(); + actionLoadTrimbits->setVisible(false); + actionSaveTrimbits->setVisible(false); + actionLoadCalibration->setVisible(false); + actionSaveCalibration->setVisible(false); } } if(isDeveloper) diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 7c26be425..089d03430 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -264,6 +264,7 @@ bool qDrawPlot::StartOrStopThread(bool start){ progress = 0; currentFrame = 0; stop_signal = 0; + histTitle[0] = ""; //for 2d scans int currentIndex = myDet->getFileIndex(); @@ -283,7 +284,6 @@ bool qDrawPlot::StartOrStopThread(bool start){ }else if(scanArgument==Level0){ //no need to check if numsteps=0,cuz otherwise this mode wont be set in plot tab int numSteps = myDet->getScanSteps(0); - //if(values) delete [] values; double *values = new double[numSteps]; myDet->getScanSteps(0,values); @@ -292,6 +292,17 @@ bool qDrawPlot::StartOrStopThread(bool start){ nPixelsY = numSteps; currentScanValue = values[0]; } + else { + //no need to check if numsteps=0,cuz otherwise this mode wont be set in plot tab + int numSteps = myDet->getScanSteps(1); + double *values = new double[numSteps]; + myDet->getScanSteps(1,values); + + maxPixelsY = values[numSteps-1]; + minPixelsY = values[0]; + nPixelsY = numSteps; + currentScanValue = values[0]; + } pixelWidth = (maxPixelsY -minPixelsY)/(nPixelsY-1); startPixel = minPixelsY -(pixelWidth/2); endPixel = maxPixelsY + (pixelWidth/2); @@ -375,6 +386,8 @@ int qDrawPlot::GetData(detectorData *data){ cout << "Entering GetDatafunction" << endl; #endif if(!stop_signal){ + //set title + SetPlotTitle(QString(data->fileName).section('/',-1)); //Plot Disabled if(!plotEnable) { @@ -432,7 +445,6 @@ int qDrawPlot::GetData(detectorData *data){ //if scan argument is 2d if(scanArgument!=None){ if(scanArgument==AllFrames){ - /*title should include which scan, also by measurement tab*/ if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ lastImageNumber= currentFrame+1; char temp_title[2000]; sprintf(temp_title,"Image Index %d",currentIndex); imageTitle = temp_title; @@ -444,12 +456,10 @@ int qDrawPlot::GetData(detectorData *data){ return 0; } else if(scanArgument==FileIndex){ - /*title should include which scan, also by measurement tab*/ if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ if(currentIndex == minPixelsY) currentScanDivLevel = 0; lastImageNumber= currentFrame+1; char temp_title[2000]; sprintf(temp_title,"Image Index %d",currentIndex); imageTitle = temp_title; - //memcpy(lastImageArray+(currentIndex*nPixelsX),data->values,nPixelsX*sizeof(double)); for(unsigned int px=0;pxvalues[px]; pthread_mutex_unlock(&(last_image_complete_mutex)); } @@ -458,28 +468,29 @@ int qDrawPlot::GetData(detectorData *data){ return 0; } else if(scanArgument==Level0){ - /*title should include which scan, also by measurement tab*/ if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ if(currentScanVariable0!=currentScanValue) currentScanDivLevel++; currentScanValue = currentScanVariable0; - lastImageNumber= currentFrame+1; char temp_title[2000]; sprintf(temp_title,"Image Index %d",currentIndex); imageTitle = temp_title; - //memcpy(lastImageArray+(currentIndex*nPixelsX),data->values,nPixelsX*sizeof(double)); - - //for(int i=values[currentScan];ivalues,nPixelsX*sizeof(double)); - - //memcpy(lastImageArray+(currentScanDivLevel*nPixelsX),data->values,nPixelsX*sizeof(double)); for(unsigned int px=0;pxvalues[px]; - cout<<"lastImageArray[0*1280+500]:"<values[px]; pthread_mutex_unlock(&(last_image_complete_mutex)); } currentFrame++; return 0; } - + else { + if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ + if(currentScanVariable1!=currentScanValue) currentScanDivLevel++; + currentScanValue = currentScanVariable1; + lastImageNumber= currentFrame+1; + char temp_title[2000]; sprintf(temp_title,"Image Index %d",currentIndex); imageTitle = temp_title; + for(unsigned int px=0;pxvalues[px]; + pthread_mutex_unlock(&(last_image_complete_mutex)); + } + currentFrame++; + return 0; + } } //normal measurement or 1d scans @@ -490,8 +501,9 @@ int qDrawPlot::GetData(detectorData *data){ //1d if(plot_in_scope==1){ - // Titles - sprintf(temp_title,"Frame Index %d",currentIndex); histTitle[0] = temp_title; + // Titles changed to "" inside startstopthread + //sprintf(temp_title,"Frame Index %d",currentIndex); histTitle[0] = temp_title; + // Persistency if(currentPersistency < persistency)currentPersistency++; else currentPersistency=persistency; diff --git a/slsDetectorGui/src/qScanWidget.cpp b/slsDetectorGui/src/qScanWidget.cpp index 158db4b0b..24e513e8b 100644 --- a/slsDetectorGui/src/qScanWidget.cpp +++ b/slsDetectorGui/src/qScanWidget.cpp @@ -25,7 +25,7 @@ using namespace std; int qScanWidget::NUM_SCAN_WIDGETS(0); -const string qScanWidget::modeNames[NumModes]={"","energy","threshold","trimbits","custom script"}; +const string qScanWidget::modeNames[NumModes]={"","energy","threshold","trimbits","position","custom script"}; //------------------------------------------------------------------------------------------------------------------------------------------------- qScanWidget::qScanWidget(QWidget *parent,multiSlsDetector*& detector): @@ -331,7 +331,7 @@ void qScanWidget::SetMode(int mode){ EnableSizeWidgets(); //set the mode - SetScan(mode); + /*SetScan(mode);*/ } @@ -354,27 +354,15 @@ int qScanWidget::SetScan(int mode){ else values = NULL; for(int i=0;isetScan(id,modeNames[mode],actualNumSteps,values,parameter); - break; - case EnergyScan: - myDet->setScan(id,modeNames[mode],actualNumSteps,values,parameter); - break; - case ThresholdScan: - myDet->setScan(id,modeNames[mode],actualNumSteps,values,parameter); - break; - case TrimbitsScan: - myDet->setScan(id,modeNames[mode],actualNumSteps,values,parameter); - break; - case CustomScript: + if(mode==CustomScript) myDet->setScan(id,script,actualNumSteps,values,parameter); - break; - } + else + cout<<"return values:"<setScan(id,modeNames[mode],actualNumSteps,values,parameter)<getScanMode(id); + int actualMode = myDet->getScanMode(id);cout<<"actualmode:"<text().section('/',-1); //is a file if(file.contains('.')){ @@ -468,12 +461,12 @@ void qScanWidget::SetScriptFile(){ //dont display if theres a none fName = dispScript->text(); - if( (!fName.compare("none"))|| - (!fName.compare("energy"))|| - (!fName.compare("threshold"))|| - (!fName.compare("trimbits")) ) - dispScript->setText(""); - + //none isnt in the modeNames list, so check separately + if(!fName.compare("none")) + dispScript->setText(""); + for(int i=1;isetText(""); } @@ -492,11 +485,12 @@ void qScanWidget::SetParameter(){ myDet->setScanParameter(id,parameter.toAscii().constData()); //dont display if theres a none parameter = dispParameter->text(); - if( (!parameter.compare("none"))|| - (!parameter.compare("energy"))|| - (!parameter.compare("threshold"))|| - (!parameter.compare("trimbits")) ) + //none isnt in the modeNames list, so check separately + if(!parameter.compare("none")) dispParameter->setText(""); + for(int i=1;isetText(""); } diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index f76cd10aa..92fe7d639 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -572,7 +572,6 @@ void qTabPlot::SetScanArgument(){ //if scans if(boxScan->isEnabled()){ - //setting the title according to the scans QString mainTitle = QString(" Level 0 : ") + modeNames[myDet->getScanMode(0)] + QString(" | Level 1 : ") + modeNames[myDet->getScanMode(1)] + QString(""); @@ -641,7 +640,7 @@ void qTabPlot::SetScanArgument(){ void qTabPlot::Refresh(){ SetFrequency(); - EnableScanBox(); + if(!myPlot->isRunning()) EnableScanBox(); } From 86ccd014abe7223279b0f0e2a9158db29d709129 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 29 Aug 2012 09:07:05 +0000 Subject: [PATCH 041/332] included position scan git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@41 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/slsDetectorGui.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index c7593e21e..a57c8e744 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -6,7 +6,7 @@ UI_HEADERS_DIR = forms/include RESOURCES += icons.qrc -DEFINES += VERBOSE DACS_INT VERYVERBOSE +DEFINES += VERBOSE DACS_INT #VERYVERBOSE target.path += $(DESTDIR) From fa5817ab7702bef030cc7a22b8cbd1d43cbc3a7c Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Thu, 30 Aug 2012 08:28:16 +0000 Subject: [PATCH 042/332] constant size scan widget works properly now git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@42 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_scan.ui | 13 +- slsDetectorGui/include/qScanWidget.h | 12 +- slsDetectorGui/src/qScanWidget.cpp | 173 ++++++++++++++------------- 3 files changed, 112 insertions(+), 86 deletions(-) diff --git a/slsDetectorGui/forms/form_scan.ui b/slsDetectorGui/forms/form_scan.ui index 0d8cf06ea..6088a7396 100644 --- a/slsDetectorGui/forms/form_scan.ui +++ b/slsDetectorGui/forms/form_scan.ui @@ -101,7 +101,15 @@ - <nobr>Defines scan range for a constant step size.</nobr> + <nobr> +Defines scan range for a <b>Constant Step Size</b> with the following constraints: +</nobr><br><nobr> +1. <b>Number of Steps</b> >=2. +</nobr><br><nobr> +2. <b>Size</b> not equal to 0. +</nobr><br><nobr> +3. <b>From</b> not equal to <b>To</b>. +</nobr><br> Constant Step Size @@ -334,6 +342,9 @@ 0 + + false + 0 diff --git a/slsDetectorGui/include/qScanWidget.h b/slsDetectorGui/include/qScanWidget.h index 927fb7e22..658e99370 100644 --- a/slsDetectorGui/include/qScanWidget.h +++ b/slsDetectorGui/include/qScanWidget.h @@ -117,9 +117,17 @@ void SetParameter(); void SetPrecision(int value); /** Set number of steps - * @param int num is the number of steps * */ -void SetNSteps(int num); +void SetNSteps(); + +/** Range type: If size is changed, + * the Number of steps is calculated + * */ +void RangeCalculateNumSteps(); + +/** Range type: If size is changed, the To is calculated + * */ +void RangeCalculateTo(); /** Set range for scan * */ diff --git a/slsDetectorGui/src/qScanWidget.cpp b/slsDetectorGui/src/qScanWidget.cpp index 24e513e8b..1c18e9ff8 100644 --- a/slsDetectorGui/src/qScanWidget.cpp +++ b/slsDetectorGui/src/qScanWidget.cpp @@ -18,6 +18,7 @@ #include #include #include +#include using namespace std; @@ -72,6 +73,7 @@ void qScanWidget::SetupWidgetWindow(){ stackedLayout = new QStackedLayout; stackedLayout->setSpacing(0); + // Range Size Layout QWidget *widgetRange = new QWidget; QHBoxLayout *layoutRange = new QHBoxLayout(widgetRange); @@ -88,12 +90,16 @@ void qScanWidget::SetupWidgetWindow(){ spinFrom->setToolTip(rangeTip); spinFrom->setMaximum(1000000); spinFrom->setKeyboardTracking(false); + spinFrom->setFixedWidth(80); + spinFrom->setDecimals(4); lblTo->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); lblTo->setToolTip(rangeTip); spinTo->setValue(1); spinTo->setToolTip(rangeTip); spinTo->setMaximum(1000000); spinTo->setKeyboardTracking(false); + spinTo->setFixedWidth(80); + spinTo->setDecimals(4); lblSize->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); lblSize->setToolTip(rangeTip); lblSize->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); @@ -102,6 +108,8 @@ void qScanWidget::SetupWidgetWindow(){ spinSize->setSingleStep(0.1); spinSize->setToolTip(rangeTip); spinSize->setKeyboardTracking(false); + spinSize->setDecimals(4); + spinSize->setMinimum(0.0001); layoutRange->addItem(new QSpacerItem(40,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); layoutRange->addWidget(lblFrom); layoutRange->addItem(new QSpacerItem(5,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); @@ -175,13 +183,13 @@ void qScanWidget::Initialization(){ //sizewidgets connect(btnGroup, SIGNAL(buttonClicked(QAbstractButton*)),this,SLOT(EnableSizeWidgets())); //numsteps - connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps(int))); + connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps())); //precision connect(spinPrecision, SIGNAL(valueChanged(int)), this, SLOT(SetPrecision(int))); //range values - connect(spinFrom, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); - connect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); - connect(spinSize, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); + connect(spinFrom, SIGNAL(valueChanged(double)), this, SLOT(RangeCalculateNumSteps())); + connect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(RangeCalculateNumSteps())); + connect(spinSize, SIGNAL(valueChanged(double)), this, SLOT(RangeCalculateTo())); //custom values connect(comboCustom, SIGNAL(currentIndexChanged(int)), this, SLOT(SetCustomSteps())); connect(btnCustom, SIGNAL(clicked()), this, SLOT(DeleteCustomSteps())); @@ -223,6 +231,7 @@ void qScanWidget::EnableSizeWidgets(){ #ifdef VERBOSE cout << "Constant Range Values" << endl; #endif + spinSteps->setMinimum(2); radioCustom->setText("Specific Values"); radioCustom->setPalette(normal); radioCustom->setToolTip(customTip); @@ -235,13 +244,15 @@ void qScanWidget::EnableSizeWidgets(){ btnFile->setToolTip(fileTip); stackedLayout->setCurrentIndex(RangeValues); - SetRangeSteps(); + + SetRangeSteps(); } //custom values else if(radioCustom->isChecked()){ #ifdef VERBOSE cout << "Custom Values" << endl; #endif + spinSteps->setMinimum(0); //defaults for other mode radioFile->setPalette(normal); radioFile->setText("Values from File:"); @@ -251,19 +262,21 @@ void qScanWidget::EnableSizeWidgets(){ //change it back as this list is what will be loaded. //also numstpes could have been changed in other modes too - disconnect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps(int))); + disconnect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps())); spinSteps ->setValue(comboCustom->count()); - connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps(int))); + connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps())); stackedLayout->setCurrentIndex(CustomValues); //only for custom steps out here because many signals go through //custom steps and we want to give the info msg only when changig range types if(SetCustomSteps()==qDefs::OK){ +#ifdef VERYVERBOSE char cNum[200];sprintf(cNum,"%d",actualNumSteps); char cId[5];sprintf(cId,"%d",id); qDefs::InfoMessage(string("Scan Level ")+string(cId)+ string(": Specific Values

Number of positions added: ")+ string(cNum)+string(""),"ScanWidget"); +#endif } } @@ -272,6 +285,7 @@ void qScanWidget::EnableSizeWidgets(){ #ifdef VERBOSE cout << "File Values" << endl; #endif + spinSteps->setMinimum(0); //defaults for other mode radioCustom->setText("Specific Values"); radioCustom->setPalette(normal); @@ -354,15 +368,15 @@ int qScanWidget::SetScan(int mode){ else values = NULL; for(int i=0;isetScan(id,script,actualNumSteps,values,parameter); else - cout<<"return values:"<setScan(id,modeNames[mode],actualNumSteps,values,parameter)<setScan(id,modeNames[mode],actualNumSteps,values,parameter); //custom script - int actualMode = myDet->getScanMode(id);cout<<"actualmode:"<getScanMode(id); if((mode==CustomScript)&&((script=="")||(script=="none"))){ return qDefs::OK; }else{//mode NOT set @@ -513,7 +527,7 @@ void qScanWidget::SetPrecision(int value){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void qScanWidget::SetNSteps(int num){ +void qScanWidget::SetNSteps(){ #ifdef VERYVERBOSE cout << "Entering SetNSteps()" << endl; #endif @@ -521,25 +535,16 @@ void qScanWidget::SetNSteps(int num){ cout << "Setting number of steps" << endl; #endif - int numSteps = spinSteps->value(); - comboCustom->setMaxCount(numSteps); - //check if its ok if(radioRange->isChecked()){ - //calculate the step size and display it - if(num==1){ - disconnect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); - spinTo->setValue(spinFrom->value()); - connect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); - }else if(num>1) - num--; - double stepSize = (spinTo->value()-spinFrom->value())/num; - disconnect(spinSize,SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); - spinSize->setValue(stepSize); - connect(spinSize, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); + double oldSize = spinSize->value(); + //calculate size = (to - from)/(num-1) + double size = (abs((spinTo->value())-(spinFrom->value()))) / (spinSteps->value()-1); + spinSize->setValue(size); //set these positions - SetRangeSteps(); + if(oldSize==size) SetRangeSteps(); }else if(radioCustom->isChecked()){ + comboCustom->setMaxCount(spinSteps->value()); SetCustomSteps(); }else if(radioFile->isChecked()){ SetFileSteps(); @@ -551,6 +556,45 @@ void qScanWidget::SetNSteps(int num){ //------------------------------------------------------------------------------------------------------------------------------------------------- +void qScanWidget::RangeCalculateNumSteps(){ +#ifdef VERYVERBOSE + cout << "Entering RangeCalculateNumSteps()" << endl; +#endif + //check if to=from + if(spinTo->value()==spinFrom->value()){ + spinTo->setValue( ((spinSize->value())*(spinSteps->value())) - (spinSize->value()) + (spinFrom->value()) ); + SetRangeSteps(); + }else{ + //num = ((to-from)/(size)) +1 + double size = spinSize->value(); + double numerator = abs((spinTo->value())-(spinFrom->value())); + //check if (to-from)/size is an int and that its =1 cuz numSteps minimum=2 + bool valid = (fmod(numerator,size)==0) && ((numerator/size)>0); + + if(valid) //calculate num steps + spinSteps->setValue( (int)(numerator / size) + 1); + else //change size instead + spinSize->setValue(numerator / (spinSteps->value()-1)); + } +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qScanWidget::RangeCalculateTo(){ +#ifdef VERYVERBOSE + cout << "Entering RangeCalculateTo()" << endl; +#endif + //to = size*num - size + from + spinTo->setValue( ((spinSize->value())*(spinSteps->value())) - (spinSize->value()) + (spinFrom->value()) ); + SetRangeSteps(); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + void qScanWidget::SetRangeSteps(){ #ifdef VERYVERBOSE cout << "Entering SetRangeSteps()" << endl; @@ -560,37 +604,9 @@ void qScanWidget::SetRangeSteps(){ #endif double fromVal = spinFrom->value(); double sizeVal = spinSize->value(); - //if step size is 0, min and max should be same - if(!sizeVal){ - disconnect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); - spinTo->setValue(fromVal); - connect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); - QString tip = rangeTip + QString("

" - "Note: Increase the step size from zero to be able to change the range."); - lblSize->setToolTip(tip); - spinSize->setToolTip(tip); - lblSize->setText("step size:*"); - lblSize->setPalette(red); - }else{ - lblSize->setToolTip(rangeTip); - spinSize->setToolTip(rangeTip); - lblSize->setText("step size:"); - lblSize->setPalette(normal); - } - //if min and max is the same - if(fromVal==spinTo->value()) actualNumSteps = 0; - else actualNumSteps = (int)((spinTo->value()-fromVal)/sizeVal); + actualNumSteps = spinSteps->value(); + - //actualNumSteps will be negative if fromsetValue(-1*sizeVal); - connect(spinSize, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); - sizeVal = spinSize->value(); - } - //increment is required like vice versa in setNSteps - actualNumSteps++; #ifdef VERBOSE cout << "num pos:" << actualNumSteps << endl; #endif @@ -600,24 +616,16 @@ void qScanWidget::SetRangeSteps(){ for(int i=0;isetValue(actualNumSteps); - connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps(int))); - //sets the scan if(SetScan(comboScript->currentIndex())==qDefs::OK){ char cId[5];sprintf(cId,"%d",id); QString script = dispScript->text(); - disconnect(spinFrom, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); - disconnect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); - disconnect(spinSize, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); //positions wont be loaded if its custom script if((comboScript->currentIndex()==CustomScript)&&((script=="")||(script=="none"))){ @@ -629,25 +637,21 @@ void qScanWidget::SetRangeSteps(){ if(myDet->getScanSteps(id)!=actualNumSteps){ qDefs::WarningMessage(string("Scan Level ")+string(cId)+ string(": Values From File

" - "The positions list was not set for an unknown reason."),"ScanWidget"); + "The positions list was not set for an unknown reason."),"ScanWidget"); /*LoadPositions(); comboScript->setCurrentIndex(myDet->getScanMode(id))*/ - }else{//SUCCESS + } +#ifdef VERYVERBOSE + else{//SUCCESS char cNum[200];sprintf(cNum,"%d",actualNumSteps); qDefs::InfoMessage(string("Scan Level ")+string(cId)+ string(": Constant Step Size

Number of positions added: ")+ string(cNum)+string(""),"ScanWidget"); } +#endif } - - connect(spinFrom, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); - connect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); - connect(spinSize, SIGNAL(valueChanged(double)), this, SLOT(SetRangeSteps())); - } - } - //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -694,7 +698,7 @@ int qScanWidget::SetCustomSteps(){ for(int i=0;iitemText(i).toDouble(); #ifdef VERBOSE - cout<<"positions["<setValue(actualNumSteps); - connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps(int))); + connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps())); inFile.close(); }else {//could not open file #ifdef VERBOSE @@ -871,12 +875,15 @@ void qScanWidget::SetFileSteps(){ qDefs::WarningMessage(string("Scan Level ")+string(cId)+ string(": Values From File

" "The positions list was not set for an unknown reason."),"ScanWidget"); - }else{//SUCCESS + } +#ifdef VERYVERBOSE + else{//SUCCESS char cNum[200];sprintf(cNum,"%d",actualNumSteps); qDefs::InfoMessage(string("Scan Level ")+string(cId)+ string(": Values From File

Number of positions added: ")+ string(cNum)+string(""),"ScanWidget"); } +#endif } } } @@ -917,7 +924,7 @@ void qScanWidget::LoadPositions(){ cout << "Entering LoadPositions()" << endl; #endif disconnect(comboCustom, SIGNAL(currentIndexChanged(int)), this, SLOT(SetCustomSteps())); - disconnect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps(int))); + disconnect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps())); disconnect(btnGroup, SIGNAL(buttonClicked(QAbstractButton*)),this,SLOT(EnableSizeWidgets())); @@ -966,7 +973,7 @@ void qScanWidget::LoadPositions(){ btnCustom->setEnabled(numSteps&&mode); connect(comboCustom, SIGNAL(currentIndexChanged(int)), this, SLOT(SetCustomSteps())); - connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps(int))); + connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps())); connect(btnGroup, SIGNAL(buttonClicked(QAbstractButton*)),this,SLOT(EnableSizeWidgets())); @@ -1002,7 +1009,7 @@ void qScanWidget::Refresh(){ #ifdef VERBOSE cout << "Updated\tscan:" << id << "\t" - "mode:"< Date: Thu, 30 Aug 2012 08:35:45 +0000 Subject: [PATCH 043/332] deleted some forms not used git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@43 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_drawplot.ui | 77 ---------------------- slsDetectorGui/forms/form_tab_actions.ui | 37 ----------- slsDetectorGui/forms/form_tab_developer.ui | 50 -------------- 3 files changed, 164 deletions(-) delete mode 100644 slsDetectorGui/forms/form_drawplot.ui delete mode 100644 slsDetectorGui/forms/form_tab_actions.ui delete mode 100644 slsDetectorGui/forms/form_tab_developer.ui diff --git a/slsDetectorGui/forms/form_drawplot.ui b/slsDetectorGui/forms/form_drawplot.ui deleted file mode 100644 index 7aa9c11a0..000000000 --- a/slsDetectorGui/forms/form_drawplot.ui +++ /dev/null @@ -1,77 +0,0 @@ - - - DrawPlotObject - - - - 0 - 0 - 800 - 400 - - - - - 0 - 0 - - - - - 0 - 0 - - - - Form - - - - - 0 - -2 - 795 - 400 - - - - - 0 - 0 - - - - - 50 - false - - - - Startup Image - - - true - - - false - - - - - -3 - 16 - 788 - 383 - - - - - QLayout::SetNoConstraint - - - - - - - - diff --git a/slsDetectorGui/forms/form_tab_actions.ui b/slsDetectorGui/forms/form_tab_actions.ui deleted file mode 100644 index 69f2bbc34..000000000 --- a/slsDetectorGui/forms/form_tab_actions.ui +++ /dev/null @@ -1,37 +0,0 @@ - - - TabActionsObject - - - - 0 - 0 - 734 - 339 - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - Form - - - - - diff --git a/slsDetectorGui/forms/form_tab_developer.ui b/slsDetectorGui/forms/form_tab_developer.ui deleted file mode 100644 index 1bb8779c3..000000000 --- a/slsDetectorGui/forms/form_tab_developer.ui +++ /dev/null @@ -1,50 +0,0 @@ - - - TabDeveloperObject - - - - 0 - 0 - 748 - 339 - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 1000 - 1000 - - - - Form - - - - - 232 - 141 - 75 - 25 - - - - PushButton - - - - - - From 4686cb9c0e541afbf34b43f89b84a5cf3557bfcb Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Thu, 30 Aug 2012 16:45:11 +0000 Subject: [PATCH 044/332] the angles should work now git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@44 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_plot.ui | 32 ++++- slsDetectorGui/include/qCloneWidget.h | 9 ++ slsDetectorGui/include/qDrawPlot.h | 28 +++- .../slsDetectorPlotting/include/SlsQt1DPlot.h | 6 +- slsDetectorGui/src/qCloneWidget.cpp | 22 +++ slsDetectorGui/src/qDetectorMain.cpp | 2 +- slsDetectorGui/src/qDrawPlot.cpp | 130 +++++++++++++----- slsDetectorGui/src/qScanWidget.cpp | 6 +- slsDetectorGui/src/qTabActions.cpp | 24 ++-- slsDetectorGui/src/qTabDataOutput.cpp | 2 +- slsDetectorGui/src/qTabPlot.cpp | 58 ++++++-- 11 files changed, 240 insertions(+), 79 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index 56a301af5..12a77f896 100644 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -196,11 +196,14 @@ 10 20 - 350 + 361 26 + + 0 + @@ -243,20 +246,39 @@ - 170 + 140 10 + + + + true + + + + 0 + 0 + + + + Lines + + + true + + +
- 145 - 20 - 126 + 120 + 21 + 121 23 diff --git a/slsDetectorGui/include/qCloneWidget.h b/slsDetectorGui/include/qCloneWidget.h index 8316989f3..adacf4d07 100644 --- a/slsDetectorGui/include/qCloneWidget.h +++ b/slsDetectorGui/include/qCloneWidget.h @@ -65,6 +65,15 @@ public: * */ void SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis[],string histTitle[]); + /** Get the 1D hist values to plot for angle plotting + * @param nHists Number of graphs in 1D + * @param histNBins Total Number of X axis values/channels in 1D + * @param histXAxis X Axis value in 1D + * @param histYAxis Y Axis value in 1D + * @param histTitle Title for all the graphs in 1D + * */ + void SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis,string histTitle[]); + public slots: /** Save Plots automatically by save all clones * returns -1 if fail*/ diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index e7bb9f3c9..f7f96ed94 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -24,6 +24,7 @@ class qCloneWidget; #include #include #include +#include "qwt_symbol.h" /** C++ Include Headers */ @@ -68,6 +69,8 @@ public: void DisableZoom(bool disable); /** Enables plot from the plot tab*/ void EnablePlot(bool enable); + /** Enable angle plot */ + void EnableAnglePlot(bool enable){anglePlot = enable;}; /** Its a reminder to update plot to set the xy range * This is done only when there is a plot to update */ @@ -129,8 +132,10 @@ void SavePlot(); void SaveAll(bool enable); /** Sets persistency from plot tab */ void SetPersistency(int val); -/** sets style of plot to dotted */ -void SetDottedPlot(bool enable){plotDotted = enable;}; +/** sets style of plot to lines*/ +void SetLines(bool enable){lines = enable;}; +/** sets markers */ +void SetMarkers(bool enable){markers = enable;}; /** sets the scan argument to prepare the plot*/ void SetScanArgument(int scanArg){scanArgument = scanArg;}; @@ -176,6 +181,10 @@ int GetData(detectorData *data); /** Saves all the plots. All sets saveError to true if not saved.*/ void SavePlotAutomatic(); +void SetStyle(SlsQtH1D* h){ + if(lines) h->setStyle(QwtPlotCurve::Lines); else h->setStyle(QwtPlotCurve::Dots); + if(markers) h->setSymbol(*marker); else h->setSymbol(*noMarker);}; + @@ -281,6 +290,8 @@ std::string imageTitle; unsigned int plot_in_scope; /** Number of Pixels in X Axis */ unsigned int nPixelsX; +/** Number of angle Pixels in X Axis */ +int nAnglePixelsX; /** Number of pixel bins in Y Axis */ int nPixelsY; /** Min Pixel number for Y Axis*/ @@ -306,6 +317,10 @@ int histNBins; double* histXAxis; /** Y Axis value in 1D */ double* histYAxis[MAX_1DPLOTS]; +/** X Axis for angles in 1D */ +double* histXAngleAxis; +/** Y Axis for angles in 1D (no persistency) */ +double* histYAngleAxis; /** Current Image Values in 2D */ double* lastImageArray; /** temporary Y Axis value in 1D */ @@ -324,7 +339,11 @@ int progress; /**If plot is enabled from plot tab*/ bool plotEnable; /**If plot is dotted */ -bool plotDotted; +bool lines; +bool markers; +/** Plot marker */ +QwtSymbol *marker; +QwtSymbol *noMarker; /** Save all plots */ bool saveAll; /** If error, while automatically saving plots, checks this at the end of an acquistion */ @@ -360,6 +379,9 @@ bool isTriggerEnabled; enum scanArgumentList{None,Level0,Level1,FileIndex,AllFrames}; int scanArgument; +/** enable angle plot */ +bool anglePlot; + signals: diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h index c1af10d47..3b5e64ea9 100644 --- a/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h @@ -8,8 +8,6 @@ * DisableZoom, * SetXMinMax,SetYMinMax, * GetXMinimum,GetXMaximum,GetYMinimum,GetYMaximum} - * 07.08.2012:{function to change lines, points etc } - * SetDotStyle * */ #ifndef SLSQT1DPLOT_H @@ -62,9 +60,7 @@ class SlsQtH1D:public QwtPlotCurve{ SlsQtH1D* Add(double v); - /** Added by Dhanya to change style of graph*/ - void SetDotStyle(bool enable){if(enable) setStyle(QwtPlotCurve::Dots); else setStyle(QwtPlotCurve::Lines);}; - /**---*/ + private: int ndata; diff --git a/slsDetectorGui/src/qCloneWidget.cpp b/slsDetectorGui/src/qCloneWidget.cpp index 5539ed5ce..064616ac1 100644 --- a/slsDetectorGui/src/qCloneWidget.cpp +++ b/slsDetectorGui/src/qCloneWidget.cpp @@ -114,8 +114,29 @@ void qCloneWidget::SetCloneHists(int nHists,int histNBins,double* histXAxis,doub } //cloneplot1D->UnZoom(); } + + //------------------------------------------------------------------------------------------------------------------------------------------------- + +void qCloneWidget::SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis,string histTitle[]){ + /** for each plot*/cout<<"qclone nhists:"<cloneplot1D_hists.size()){ + cloneplot1D_hists.append(k=new SlsQtH1D("1d plot",histNBins,histXAxis,histYAxis)); + k->SetLineColor(hist_num+1); + }else{ + k=cloneplot1D_hists.at(hist_num); + k->SetData(histNBins,histXAxis,histYAxis); + } + k->setTitle(histTitle[hist_num].c_str()); + k->Attach(cloneplot1D); + } + //cloneplot1D->UnZoom(); +}//------------------------------------------------------------------------------------------------------------------------------------------------- + char* qCloneWidget::GetCurrentTimeStamp(){ char output[30]; char *result; @@ -129,6 +150,7 @@ char* qCloneWidget::GetCurrentTimeStamp(){ return result; } + //------------------------------------------------------------------------------------------------------------------------------------------------- void qCloneWidget::SavePlot(){ diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 80e5683ec..d9e369cd1 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -232,7 +232,7 @@ void qDetectorMain::Initialization(){ connect(tab_dataoutput, SIGNAL(AngularConversionSignal(bool)), tab_actions,SLOT(EnablePositions(bool))); // Plot tab connect(tab_plot, SIGNAL(DisableZoomSignal(bool)), this,SLOT(SetZoomToolTip(bool))); - // Actions tab + // Actions tab (also for angles) connect(tab_actions, SIGNAL(EnableScanBox()), tab_plot,SLOT(EnableScanBox())); // Plotting // When the acquisition is finished, must update the meas tab diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 089d03430..900cd86c6 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -8,6 +8,7 @@ #include "qDrawPlot.h" #include "qCloneWidget.h" #include "slsDetector.h" + // Project Class Headers #include "slsDetector.h" #include "multiSlsDetector.h" @@ -66,20 +67,27 @@ void qDrawPlot::SetupWidgetWindow(){ nPixelsX = myDet->getTotalNumberOfChannels(); nPixelsY = 100; + nAnglePixelsX = 1; + minPixelsY = 0; + //2d lastImageArray = 0; image_data = 0; //1d nHists = 0; histNBins = 0; histXAxis = 0; + histXAngleAxis = 0; + histYAngleAxis = 0; persistency = 0; currentPersistency = 0; + progress = 0; - plotEnable=true; + plotEnable = true; + anglePlot = false; saveAll = false; - plotDotted = false; + XYRangeChanged = false; timerValue = PLOT_TIMER_MS; frameFactor=0; @@ -114,8 +122,9 @@ void qDrawPlot::SetupWidgetWindow(){ char temp_title[2000]; for(int i=0;iaddWidget(plot1D,1,1,1,1); plotLayout->addWidget(plot2D,1,1,1,1); + + //marker + lines = true; + markers = false; + marker = new QwtSymbol(); + marker->setStyle(QwtSymbol::Cross); + marker->setSize(5,5); + noMarker = new QwtSymbol(); + + + + } //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -190,8 +211,9 @@ void qDrawPlot::StartStopDaqToggle(bool stop_if_running){ //get #scansets for level 0 and level 1 int numScan0 = myDet->getScanSteps(0); numScan0 = ((numScan0==0)?1:numScan0); int numScan1 = myDet->getScanSteps(1); numScan1 = ((numScan1==0)?1:numScan1); + int numPos = myDet->getPositions(); numPos = ((numPos==0) ?1:numPos); - number_of_exposures = number_of_frames * numScan0 * numScan1; + number_of_exposures = number_of_frames * numScan0 * numScan1 * numPos; cout << "\tNumber of Exposures:" << number_of_exposures << endl; // ExposureTime @@ -260,6 +282,9 @@ bool qDrawPlot::StartOrStopThread(bool start){ //start part if(start){ + if(myDet->getRunStatus()==slsDetectorDefs::IDLE) + cout<getRunStatus()<progressIndex; - currentFrame++; - return 0; + if((scanArgument==None)&&(!anglePlot)){ + //if the time is not over, RETURN + if(!data_pause_over){ + progress=(int)data->progressIndex; + currentFrame++; + return 0; + } + data_pause_over=false; + data_pause_timer->start((int)(PLOT_TIMER_MS/2)); } - data_pause_over=false; - data_pause_timer->start((int)(PLOT_TIMER_MS/2)); } @@ -442,8 +469,25 @@ int qDrawPlot::GetData(detectorData *data){ #ifdef VERYVERBOSE cout << "Reading in image: " << currentIndex << endl; #endif + //angle plotting + if(anglePlot){ + if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ + lastImageNumber= currentFrame+1; + nAnglePixelsX = data->npoints; + histNBins = nAnglePixelsX; + nHists=1; + if(histXAngleAxis) delete [] histXAngleAxis; histXAngleAxis = new double[nAnglePixelsX]; + if(histYAngleAxis) delete [] histYAngleAxis; histYAngleAxis = new double[nAnglePixelsX]; + memcpy(histXAngleAxis,data->angles,nAnglePixelsX*sizeof(double)); + memcpy(histYAngleAxis,data->values,nAnglePixelsX*sizeof(double)); + pthread_mutex_unlock(&(last_image_complete_mutex)); + } + currentFrame++; + return 0; + } //if scan argument is 2d if(scanArgument!=None){ + //alframes if(scanArgument==AllFrames){ if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ lastImageNumber= currentFrame+1; @@ -455,7 +499,8 @@ int qDrawPlot::GetData(detectorData *data){ currentScanDivLevel++; return 0; } - else if(scanArgument==FileIndex){ + //file index + if(scanArgument==FileIndex){ if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ if(currentIndex == minPixelsY) currentScanDivLevel = 0; lastImageNumber= currentFrame+1; @@ -467,7 +512,8 @@ int qDrawPlot::GetData(detectorData *data){ currentScanDivLevel++; return 0; } - else if(scanArgument==Level0){ + //level0 + if(scanArgument==Level0){ if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ if(currentScanVariable0!=currentScanValue) currentScanDivLevel++; currentScanValue = currentScanVariable0; @@ -479,18 +525,18 @@ int qDrawPlot::GetData(detectorData *data){ currentFrame++; return 0; } - else { - if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ - if(currentScanVariable1!=currentScanValue) currentScanDivLevel++; - currentScanValue = currentScanVariable1; - lastImageNumber= currentFrame+1; - char temp_title[2000]; sprintf(temp_title,"Image Index %d",currentIndex); imageTitle = temp_title; - for(unsigned int px=0;pxvalues[px]; - pthread_mutex_unlock(&(last_image_complete_mutex)); - } - currentFrame++; - return 0; + //level1 + if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ + if(currentScanVariable1!=currentScanValue) currentScanDivLevel++; + currentScanValue = currentScanVariable1; + lastImageNumber= currentFrame+1; + char temp_title[2000]; sprintf(temp_title,"Image Index %d",currentIndex); imageTitle = temp_title; + for(unsigned int px=0;pxvalues[px]; + pthread_mutex_unlock(&(last_image_complete_mutex)); } + currentFrame++; + return 0; + } //normal measurement or 1d scans @@ -502,18 +548,15 @@ int qDrawPlot::GetData(detectorData *data){ //1d if(plot_in_scope==1){ // Titles changed to "" inside startstopthread - //sprintf(temp_title,"Frame Index %d",currentIndex); histTitle[0] = temp_title; - // Persistency if(currentPersistency < persistency)currentPersistency++; else currentPersistency=persistency; nHists = currentPersistency+1; + histNBins = nPixelsX; // copy data - //memcpy(histXAxis, xvalues,nPixelsX*sizeof(double)); for(int i=currentPersistency;i>0;i--) memcpy(histYAxis[i],histYAxis[i-1],nPixelsX*sizeof(double)); memcpy(histYAxis[0],data->values,nPixelsX*sizeof(double)); - //for(int i=0;i<(int)nPixelsX;i++) *(yvalues[0]+i) = (double)*(data->values+i); } //2d else{ @@ -593,13 +636,21 @@ void qDrawPlot::UpdatePlot(){ for(int hist_num=0;hist_num<(int)nHists;hist_num++){ SlsQtH1D* h; if(hist_num+1>plot1D_hists.size()){ - plot1D_hists.append(h=new SlsQtH1D("1d plot",histNBins,histXAxis,GetHistYAxis(hist_num))); + if(anglePlot) + plot1D_hists.append(h=new SlsQtH1D("1d plot",histNBins,histXAngleAxis,histYAngleAxis)); + else + plot1D_hists.append(h=new SlsQtH1D("1d plot",histNBins,histXAxis,GetHistYAxis(hist_num))); h->SetLineColor(hist_num+1); }else{ h=plot1D_hists.at(hist_num); - h->SetData(histNBins,histXAxis,GetHistYAxis(hist_num)); + if(anglePlot) + h->SetData(histNBins,histXAngleAxis,histYAngleAxis); + else + h->SetData(histNBins,histXAxis,GetHistYAxis(hist_num)); } - h->SetDotStyle(plotDotted); + //h->setSymbol(*noSymbol); + //h->SetDotStyle(plotDotted); + SetStyle(h); h->setTitle(GetHistTitle(hist_num)); h->Attach(plot1D); } @@ -701,7 +752,12 @@ void qDrawPlot::ClonePlot(){ plot1D->SetXTitle(histXAxisTitle.toAscii().constData()); plot1D->SetYTitle(histYAxisTitle.toAscii().constData()); plotLayout->addWidget(plot1D,1,1,1,1); - if(running) winClone[i]->SetCloneHists((int)nHists,histNBins,histXAxis,histYAxis,histTitle); + if(running){ + if(anglePlot) + winClone[i]->SetCloneHists((int)nHists,histNBins,histXAxis,histYAxis,histTitle); + else + winClone[i]->SetCloneHists((int)nHists,histNBins,histXAngleAxis,histYAngleAxis,histTitle); + } } else{ plot2D = new SlsQt2DPlotLayout(boxPlot); diff --git a/slsDetectorGui/src/qScanWidget.cpp b/slsDetectorGui/src/qScanWidget.cpp index 1c18e9ff8..9bcb344ca 100644 --- a/slsDetectorGui/src/qScanWidget.cpp +++ b/slsDetectorGui/src/qScanWidget.cpp @@ -341,11 +341,11 @@ void qScanWidget::SetMode(int mode){ } - //set the group box widgets + //set the group box widgets and also calls setscan EnableSizeWidgets(); - //set the mode - /*SetScan(mode);*/ + //set the mode if mode = none + if(!mode) SetScan(mode); } diff --git a/slsDetectorGui/src/qTabActions.cpp b/slsDetectorGui/src/qTabActions.cpp index 1c39a0420..44790291c 100644 --- a/slsDetectorGui/src/qTabActions.cpp +++ b/slsDetectorGui/src/qTabActions.cpp @@ -273,17 +273,20 @@ void qTabActions::SetPosition(){ lblPosList->setPalette(normal); lblPosList->setToolTip("Enter the positions at which the detector should be moved.
" "Number of entries is restricted to Number of Positions field."); - //delete existing positions - if (positions) delete [] positions; - positions=new double[numPos]; - //copying the list - for(int i=0;iitemText(i).toDouble(); - //setting the list and catching error - if(myDet->setPositions(numPos,positions)!=numPos) - qDefs::WarningMessage("The positions list was not set for some reason.","Actions"); } + //delete existing positions + if (positions) delete [] positions; + positions=new double[comboPos->count()]; + //copying the list + for(int i=0;icount();i++) + positions[i] = comboPos->itemText(i).toDouble(); + //setting the list and catching error + if(myDet->setPositions(comboPos->count(),positions)!=comboPos->count()) + qDefs::WarningMessage("The positions list was not set for some reason.","Actions"); + + + emit EnableScanBox(); } @@ -323,6 +326,7 @@ void qTabActions::EnablePositions(bool enable){ if(btnExpand[NumPositions]->text()=="-") Expand(group->button(NumPositions)); comboPos->clear(); + cout<<"Number of Positions set to :"<getPositions()<setPalette(lblName[NumPositions-1]->palette()); lblName[NumPositions]->setEnabled(false); btnExpand[NumPositions]->setEnabled(false); @@ -345,7 +349,7 @@ void qTabActions::Refresh(){ //delete existing positions if (positions) delete [] positions; //get number of positions - int numPos=myDet->getPositions(); + int numPos=myDet->getPositions();cout<<"numPOs:"<setMaxCount(numPos); //set the number of positions in the gui diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index 9c570092c..b3237bdc3 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -348,7 +348,7 @@ void qTabDataOutput::SetAngularCorrection(){ cout << "Setting angular conversion to default" << endl; #endif }else{ - qDefs::WarningMessage("Angular Conversion could not be set.","Data Output"); + qDefs::WarningMessage("Angular Conversion could not be set. Please set the default file name using the command line, if you haven't already.","Data Output"); chkAngular->setChecked(false); } }else{ diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index 92fe7d639..318746799 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -197,7 +197,8 @@ void qTabPlot::Initialization(){ // 1D Plot box connect(chkSuperimpose, SIGNAL(toggled(bool)), this, SLOT(EnablePersistency(bool))); connect(spinPersistency,SIGNAL(valueChanged(int)), myPlot,SLOT(SetPersistency(int))); - connect(chkPoints, SIGNAL(toggled(bool)), myPlot, SLOT(SetDottedPlot(bool))); + connect(chkPoints, SIGNAL(toggled(bool)), myPlot, SLOT(SetMarkers(bool))); + connect(chkLines, SIGNAL(toggled(bool)), myPlot, SLOT(SetLines(bool))); // 2D Plot box connect(chkInterpolate, SIGNAL(toggled(bool)),myPlot, SIGNAL(InterpolateSignal(bool))); connect(chkContour, SIGNAL(toggled(bool)),myPlot, SIGNAL(ContourSignal(bool))); @@ -500,8 +501,14 @@ void qTabPlot::EnableScanBox(){ //if it was checked before or disabled before, it remembers to check it again bool checkedBefore = (boxScan->isChecked()||(!boxScan->isEnabled())); + + + //none of these scan plotting options make sense if positions>0 + bool positionsExist = myDet->getPositions(); + //only now enable/disable - boxScan->setEnabled(mode0||mode1); + boxScan->setEnabled((mode0||mode1)&&(!positionsExist)); + //if there are scan if(boxScan->isEnabled()){ @@ -534,6 +541,12 @@ void qTabPlot::EnableScanBox(){ } else EnablingNthFrameFunction(enableNFrame); + //positions + if((positionsExist)&&(chkSuperimpose->isChecked())) chkSuperimpose->setChecked(false); + chkSuperimpose->setEnabled(!positionsExist); + boxFrequency->setEnabled(!positionsExist); + myPlot->EnableAnglePlot(positionsExist); + //sets the scan argument SetScanArgument(); @@ -568,22 +581,14 @@ void qTabPlot::EnablingNthFrameFunction(bool enable){ void qTabPlot::SetScanArgument(){ //as default from histogram and default titles are set here if scanbox is disabled - Select1DPlot(isOrginallyOneD); - - //if scans - if(boxScan->isEnabled()){ - //setting the title according to the scans - QString mainTitle = QString(" Level 0 : ") + modeNames[myDet->getScanMode(0)] + - QString(" | Level 1 : ") + modeNames[myDet->getScanMode(1)] + QString(""); - dispTitle->setText(mainTitle); - myPlot->SetPlotTitle(mainTitle); - }else{ - dispTitle->setText(defaultPlotTitle); - myPlot->SetPlotTitle(defaultPlotTitle); + dispTitle->setText(defaultPlotTitle); + myPlot->SetPlotTitle(defaultPlotTitle); + if(isOrginallyOneD){ dispXAxis->setText(defaultHistXAxisTitle); dispYAxis->setText(defaultHistYAxisTitle); myPlot->SetHistXAxisTitle(defaultHistXAxisTitle); myPlot->SetHistYAxisTitle(defaultHistYAxisTitle); + }else{ dispXAxis->setText(defaultImageXAxisTitle); dispYAxis->setText(defaultImageYAxisTitle); dispZAxis->setText(defaultImageZAxisTitle); @@ -591,6 +596,31 @@ void qTabPlot::SetScanArgument(){ myPlot->SetImageYAxisTitle(defaultImageYAxisTitle); myPlot->SetImageZAxisTitle(defaultImageZAxisTitle); } + Select1DPlot(isOrginallyOneD); + + //if scans(1D or 2D) + if(boxScan->isEnabled()){ + //setting the title according to the scans + QString mainTitle = QString(" Level 0 : ") + modeNames[myDet->getScanMode(0)] + + QString(" | Level 1 : ") + modeNames[myDet->getScanMode(1)] + QString(""); + dispTitle->setText(mainTitle); + myPlot->SetPlotTitle(mainTitle); + Select1DPlot(isOrginallyOneD); + + }//angles (1D) + else if(myDet->getPositions()){ + //if scan, change title + if((myDet->getScanMode(0))||(myDet->getScanMode(1))){ + QString mainTitle = QString(" Level 0 : ") + modeNames[myDet->getScanMode(0)] + + QString(" | Level 1 : ") + modeNames[myDet->getScanMode(1)] + QString(""); + dispTitle->setText(mainTitle); + myPlot->SetPlotTitle(mainTitle); + } + dispXAxis->setText("Angles"); + myPlot->SetHistXAxisTitle("Angles"); + Select1DPlot(true); + } + //for 2d if((boxScan->isEnabled())&&(boxScan->isChecked())){ From a25b74c9ab143c68052aed8d95ecdfc9177696df Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 31 Aug 2012 15:09:13 +0000 Subject: [PATCH 045/332] angle done, more of trimming...save, load, yet to fix number of probes git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@45 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_measurement.ui | 75 ++++++++-- slsDetectorGui/include/qDetectorMain.h | 1 - slsDetectorGui/slsDetectorGui.pro | 2 +- slsDetectorGui/src/qDetectorMain.cpp | 140 ++++++++++++++++--- slsDetectorGui/src/qDrawPlot.cpp | 13 +- slsDetectorGui/src/qTabDebugging.cpp | 7 +- slsDetectorGui/src/qTabDeveloper.cpp | 7 +- slsDetectorGui/src/qTabPlot.cpp | 2 +- slsDetectorGui/src/qTabSettings.cpp | 3 + 9 files changed, 204 insertions(+), 46 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_measurement.ui b/slsDetectorGui/forms/form_tab_measurement.ui index ea826ebb5..b9ea4b54d 100644 --- a/slsDetectorGui/forms/form_tab_measurement.ui +++ b/slsDetectorGui/forms/form_tab_measurement.ui @@ -188,6 +188,10 @@ false + + Number of Triggers to be expected. + #cycles# + Number of Triggers: @@ -205,8 +209,8 @@ - Run index (automatically incremented) - #index# + Number of Triggers to be expected. + #cycles# @@ -221,7 +225,7 @@ - 1 + 0 2000000000 @@ -236,6 +240,10 @@ false + + The Delay between Trigger Edge and Start of Exposure ( or Readout). +#delay# + Delay After Trigger: @@ -253,8 +261,8 @@ - Frame period between exposures. - #period# + The Delay between Trigger Edge and Start of Exposure ( or Readout). +#delay# Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter @@ -281,6 +289,10 @@ 0 + + The Delay between Trigger Edge and Start of Exposure ( or Readout). +#delay# + Qt::LeftToRight @@ -330,6 +342,10 @@ 0 + + Number of Gate Signals per Frame. + #gates# + Number of Gates: @@ -347,8 +363,8 @@ - Run index (automatically incremented) - #index# + Number of Gate Signals per Frame. + #gates# @@ -363,7 +379,7 @@ - 1 + 0 2000000000 @@ -384,6 +400,10 @@ 0 + + The data are accumulated over several (frames) pump-cycles. Set cycles to 1. +#probes# + Number of Probes: @@ -401,8 +421,8 @@ - Run index (automatically incremented) - #index# + The data are accumulated over several (frames) pump-cycles. Set cycles to 1. +#probes# @@ -417,7 +437,7 @@ - 1 + 0 2000000000 @@ -626,8 +646,15 @@ false - Frame period between exposures. - #period# + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<table style="-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;"> +<tr> +<td style="border: none;"> +<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Frame period between exposures. </p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> #period#</p></td></tr></table></body></html> Acquisition Period: @@ -646,8 +673,15 @@ - Frame period between exposures. - #period# + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<table style="-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;"> +<tr> +<td style="border: none;"> +<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Frame period between exposures. </p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> #period#</p></td></tr></table></body></html> Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter @@ -674,6 +708,17 @@ 0 + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<table style="-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;"> +<tr> +<td style="border: none;"> +<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Frame period between exposures. </p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> #period#</p></td></tr></table></body></html> + Qt::LeftToRight diff --git a/slsDetectorGui/include/qDetectorMain.h b/slsDetectorGui/include/qDetectorMain.h index 1e80ccd3f..d8494a4c0 100644 --- a/slsDetectorGui/include/qDetectorMain.h +++ b/slsDetectorGui/include/qDetectorMain.h @@ -111,7 +111,6 @@ private: /**if the developer tab should be enabled,known from command line */ int isDeveloper; - /**Sets up the layout of the widget * */ void SetUpWidgetWindow(); diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index a57c8e744..4a8021f79 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -6,7 +6,7 @@ UI_HEADERS_DIR = forms/include RESOURCES += icons.qrc -DEFINES += VERBOSE DACS_INT #VERYVERBOSE +DEFINES += VERBOSE #VERYVERBOSE #DACS_INT target.path += $(DESTDIR) diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index d9e369cd1..cc5255196 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -97,15 +97,15 @@ void qDetectorMain::SetUpWidgetWindow(){ tabs = new MyTabWidget(this); layoutTabs->addWidget(tabs); // creating all the tab widgets - tab_messages = new qTabMessages (this, myDet); - tab_measurement = new qTabMeasurement (this, myDet,myPlot); - 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); + tab_messages = new qTabMessages (this, myDet); cout<<"Messages ready"<setFloating(false); dockWidgetPlot->setFeatures(QDockWidget::NoDockWidgetFeatures); tabs->setTabEnabled(Developer,isDeveloper); + if(!digitalDetector) actionExpert->setEnabled(false); + // Other setup //Height of plot and central widget @@ -323,8 +325,9 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ tr("Detector Setup files (*.det)")); // Gets called when cancelled as well if (!fName.isEmpty()){ - myDet->retrieveDetectorSetup(string(fName.toAscii().constData())); - qDefs::InfoMessage("The parameters have been successfully setup.","Main"); + if(myDet->retrieveDetectorSetup(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL) + qDefs::InfoMessage("The Setup Parameters have been loaded successfully.","Main"); + else qDefs::WarningMessage("The Loading of Setup Parameters has failed.","Main"); } } else if(action==actionSaveSetup){ @@ -337,8 +340,9 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ tr("Detector Setup files (*.det) ")); // 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"); + if(myDet->dumpDetectorSetup(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL) + qDefs::InfoMessage("The Setup Parameters have been saved successfully.","Main"); + else qDefs::WarningMessage("The Saving of Setup Parameters has failed.","Main"); } } else if(action==actionMeasurementWizard){ @@ -356,8 +360,9 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ tr("Configuration files (*.config)")); // Gets called when cancelled as well if (!fName.isEmpty()){ - myDet->readConfigurationFile(string(fName.toAscii().constData())); - qDefs::InfoMessage("The parameters have been successfully configured.","Main"); + if(myDet->readConfigurationFile(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL) + qDefs::InfoMessage("The Configuration Parameters have been configured successfully.","Main"); + else qDefs::WarningMessage("The Loading of Configuration Parameters has failed.","Main"); } } else if(action==actionSaveConfiguration){ @@ -370,8 +375,9 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ tr("Configuration files (*.config) ")); // 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"); + if(myDet->writeConfigurationFile(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL) + qDefs::InfoMessage("The Configuration Parameters have been saved successfully.","Main"); + else qDefs::WarningMessage("The Saving of Configuration Parameters has failed.","Main"); } } else if(action==actionLoadTrimbits){ @@ -384,8 +390,104 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ tr("Trimbit files (*.trim *.sn*)")); // Gets called when cancelled as well if (!fName.isEmpty()){ - //myDet->readConfigurationFile(string(fName.toAscii().constData())); - qDefs::InfoMessage("The parameters have been successfully configured.","Main"); + if(myDet->loadSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) + qDefs::InfoMessage("The Trimbits have been loaded successfully.","Main"); + else qDefs::WarningMessage("The Loading of Trimbits has failed.","Main"); + } + } + else if(action==actionSaveTrimbits){ +#ifdef VERBOSE + cout << "Saving Trimbits" << endl; +#endif + QString fName = QString(myDet->getFilePath().c_str()); + fName = QFileDialog::getSaveFileName(this, + tr("Save Current Detector Trimbits"),fName, + tr("Trimbit files (*.trim *.sn*) ")); + // Gets called when cancelled as well + if (!fName.isEmpty()){ + if(myDet->saveSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) + qDefs::InfoMessage("The Trimbits have been saved successfully.","Main"); + else qDefs::WarningMessage("The Saving of Trimbits has failed.","Main"); + } + } + else if(action==actionLoadCalibration){ +#ifdef VERBOSE + cout << "Loading Calibration Data" << endl; +#endif + QString fName = QString(myDet->getFilePath().c_str()); + fName = QFileDialog::getOpenFileName(this, + tr("Load Detector Calibration Data"),fName, + tr("Calibration files (*.cal *.sn*)")); + // Gets called when cancelled as well + if (!fName.isEmpty()){ + int nMod = myDet->setNumberOfModules(); + slsDetector *detector; + slsDetectorDefs::sls_detector_module *myMod=NULL; + string sFname= fName.toAscii().constData(); + double gain,offset; + for(int i=0;igetSlsDetector(i); + if(detector){ + if (sFname.find(".cal")==string::npos) { + if (sFname.find(".sn")==string::npos && sFname.find(".cal")) { + ostringstream ostfn; + ostfn << sFname << ".sn" << setfill('0') << setw(3) << hex << myDet->getId(slsDetectorDefs::MODULE_SERIAL_NUMBER, i); + fn=ostfn.str(); + }} + if(detector->readCalibrationFile(fn,gain,offset)==-1) + qDefs::WarningMessage(string("Could not open Calibration File.\n")+ fn,"Main"); + else{ + if(myMod = detector->getModule(i)){ + myMod->gain = gain; + myMod->offset = offset; + detector->setModule(*myMod); + detector->deleteModule(myMod); + } + } + } + detector = NULL; + } + + //if(energyConversion::readCalibrationFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) + // qDefs::InfoMessage("The Calibration Data have been loaded successfully.","Main"); + //else qDefs::WarningMessage("The Loading of Calibration Data has failed.","Main"); + } + } + else if(action==actionSaveCalibration){ +#ifdef VERBOSE + cout << "Saving Calibration Data" << endl; +#endif + QString fName = QString(myDet->getFilePath().c_str()); + fName = QFileDialog::getSaveFileName(this, + tr("Save Current Detector Calibration Data"),fName, + tr("Calibration files (*.cal *.sn*) ")); + // Gets called when cancelled as well + if (!fName.isEmpty()){ + int nMod = myDet->setNumberOfModules(); + cout<<"nmode:"<getSlsDetector(i); + if(detector){ + ostringstream ostfn; + ostfn << sFname << ".sn" << setfill('0') << setw(3) << hex << myDet->getId(slsDetectorDefs::MODULE_SERIAL_NUMBER, i); + fn=ostfn.str(); + if(myMod = detector->getModule(i)){ + if(detector->writeCalibrationFile(fn,myMod->gain,myMod->offset)==-1) + qDefs::WarningMessage(string("Could not open Calibration File.\n")+ fn,"Main"); + detector->deleteModule(myMod); + } + } + detector = NULL; + } + //if(energyConversion::writeCalibrationFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) + // qDefs::InfoMessage("The Calibration Data have been saved successfully.","Main"); + //else qDefs::WarningMessage("The Saving of Calibration Data has failed.","Main"); } } diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 900cd86c6..9e67308c5 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -211,9 +211,14 @@ void qDrawPlot::StartStopDaqToggle(bool stop_if_running){ //get #scansets for level 0 and level 1 int numScan0 = myDet->getScanSteps(0); numScan0 = ((numScan0==0)?1:numScan0); int numScan1 = myDet->getScanSteps(1); numScan1 = ((numScan1==0)?1:numScan1); - int numPos = myDet->getPositions(); numPos = ((numPos==0) ?1:numPos); - number_of_exposures = number_of_frames * numScan0 * numScan1 * numPos; + + number_of_exposures = number_of_frames * numScan0 * numScan1; + if(anglePlot) { + int numPos = myDet->getPositions(); //numPos = ((numPos==0) ?1:numPos); + number_of_exposures = numScan0 * numScan1;/*number_of_exposures * numPos;*/ + + } cout << "\tNumber of Exposures:" << number_of_exposures << endl; // ExposureTime @@ -616,7 +621,7 @@ void qDrawPlot::Clear1DPlot(){ void qDrawPlot::UpdatePlot(){ #ifdef VERYVERBOSE - cout << "Entering UpdatePlot function" << endl; + /*cout << "Entering UpdatePlot function" << endl;*/ #endif plot_update_timer->stop(); @@ -628,7 +633,7 @@ void qDrawPlot::UpdatePlot(){ if(lastImageNumber){ if(histNBins){ #ifdef VERYVERBOSE - cout << "Last Image Number: " << lastImageNumber << endl; + /*cout << "Last Image Number: " << lastImageNumber << endl;*/ #endif Clear1DPlot(); plot1D->SetXTitle(histXAxisTitle.toAscii().constData()); diff --git a/slsDetectorGui/src/qTabDebugging.cpp b/slsDetectorGui/src/qTabDebugging.cpp index 7e77113ec..3dc131bb6 100644 --- a/slsDetectorGui/src/qTabDebugging.cpp +++ b/slsDetectorGui/src/qTabDebugging.cpp @@ -44,13 +44,14 @@ void qTabDebugging::SetupWidgetWindow(){ 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;isetNumberOfModules(); + +/* for(int i=0;igetSlsDetector(i); if(s->setTCPSocket()!=slsDetectorDefs::FAIL){ comboModule->addItem(QString::number(i)); } - } + }*/ } //------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/slsDetectorGui/src/qTabDeveloper.cpp b/slsDetectorGui/src/qTabDeveloper.cpp index 9abd46c6d..7324d94de 100644 --- a/slsDetectorGui/src/qTabDeveloper.cpp +++ b/slsDetectorGui/src/qTabDeveloper.cpp @@ -154,7 +154,7 @@ void qTabDeveloper::SetupWidgetWindow(){ void qTabDeveloper::Initialization(){ - connect(adcTimer, SIGNAL(timeout()), this, SLOT(RefreshAdcs())); + if(NUM_ADC_WIDGETS) connect(adcTimer, SIGNAL(timeout()), this, SLOT(RefreshAdcs())); for(int i=0;islsDetectorBase::getDetectorType(detType),"Developer"); exit(-1); break; } + return slsDetectorDefs::HUMIDITY; } @@ -316,7 +319,7 @@ void qTabDeveloper::Refresh(){ for(int i=0;isetValue((double)myDet->setDAC(-1,getSLSIndex(i))); //adcs - RefreshAdcs(); + if(NUM_ADC_WIDGETS) RefreshAdcs(); //gotthard -high voltage if(detType == slsDetectorDefs::GOTTHARD){ diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index 318746799..939484f45 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -493,7 +493,7 @@ void qTabPlot::SetFrequency(){ void qTabPlot::EnableScanBox(){ #ifdef VERYVERBOSE - cout << "Entering Enable Scan Box() \t mode:" << mode << " \t id:" << id << endl; + cout << "Entering Enable Scan Box()" << endl; #endif int mode0 = myDet->getScanMode(0); diff --git a/slsDetectorGui/src/qTabSettings.cpp b/slsDetectorGui/src/qTabSettings.cpp index 430046fde..f76a5bad9 100644 --- a/slsDetectorGui/src/qTabSettings.cpp +++ b/slsDetectorGui/src/qTabSettings.cpp @@ -41,6 +41,9 @@ void qTabSettings::SetupWidgetWindow(){ SetupDetectorSettings(); comboSettings->setCurrentIndex(myDet->getSettings(detID)); + //threshold + spinThreshold->setValue(myDet->getThresholdEnergy()); + //expert mode is not enabled initially lblThreshold->setEnabled(false); spinThreshold->setEnabled(false); From f0217ce9b1b2d2505232b77a60fadae188c44550 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Mon, 3 Sep 2012 09:25:09 +0000 Subject: [PATCH 046/332] loading and saving trimbits and calibration file works now git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@46 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_advanced.ui | 202 +++++++++++++--------- slsDetectorGui/src/qDetectorMain.cpp | 83 ++------- 2 files changed, 137 insertions(+), 148 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_advanced.ui b/slsDetectorGui/forms/form_tab_advanced.ui index 38987ac72..56142c7ac 100644 --- a/slsDetectorGui/forms/form_tab_advanced.ui +++ b/slsDetectorGui/forms/form_tab_advanced.ui @@ -31,86 +31,6 @@ Form - - - - 25 - 200 - 726 - 58 - - - - Trimming Method - - - - - 10 - 20 - 711 - 31 - - - - - 15 - - - - - - 0 - 0 - - - - None - - - - - - - - 0 - 0 - - - - Adjust to Fix Count Level - - - - - - - - 0 - 0 - - - - Equalize to Median - - - - - - - - 0 - 0 - - - - Optimize Settings - - - - - - @@ -152,8 +72,126 @@
- horizontalLayoutWidget_2 - checkBox_3 + + + + true + + + + 20 + 150 + 731 + 156 + + + + Trimming + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + false + + + + + 15 + 20 + 701 + 126 + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 45 + 10 + + + + + + + + + 0 + 0 + + + + Trimming Method: + + + + + + + + 0 + 0 + + + + + None + + + + + Adjust to Fix Count Level + + + + + Equalize to Median + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 75 + 10 + + + + + + + + true + + + + 0 + 0 + + + + Optimize Settings + + + + + diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index cc5255196..d9d0f5de0 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -327,7 +327,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ if (!fName.isEmpty()){ if(myDet->retrieveDetectorSetup(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL) qDefs::InfoMessage("The Setup Parameters have been loaded successfully.","Main"); - else qDefs::WarningMessage("The Loading of Setup Parameters has failed.","Main"); + else qDefs::WarningMessage(string("Could not load the Setup Parameters from file:\n")+fName.toAscii().constData(),"Main"); } } else if(action==actionSaveSetup){ @@ -342,7 +342,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ if (!fName.isEmpty()){ if(myDet->dumpDetectorSetup(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL) qDefs::InfoMessage("The Setup Parameters have been saved successfully.","Main"); - else qDefs::WarningMessage("The Saving of Setup Parameters has failed.","Main"); + else qDefs::WarningMessage(string("Could not save the Setup Parameters from file:\n")+fName.toAscii().constData(),"Main"); } } else if(action==actionMeasurementWizard){ @@ -362,7 +362,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ if (!fName.isEmpty()){ if(myDet->readConfigurationFile(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL) qDefs::InfoMessage("The Configuration Parameters have been configured successfully.","Main"); - else qDefs::WarningMessage("The Loading of Configuration Parameters has failed.","Main"); + else qDefs::WarningMessage(string("Could not load the Configuration Parameters from file:\n")+fName.toAscii().constData(),"Main"); } } else if(action==actionSaveConfiguration){ @@ -377,14 +377,14 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ if (!fName.isEmpty()){ if(myDet->writeConfigurationFile(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL) qDefs::InfoMessage("The Configuration Parameters have been saved successfully.","Main"); - else qDefs::WarningMessage("The Saving of Configuration Parameters has failed.","Main"); + else qDefs::WarningMessage(string("Could not save the Configuration Parameters from file:\n")+fName.toAscii().constData(),"Main"); } } else if(action==actionLoadTrimbits){ #ifdef VERBOSE cout << "Loading Trimbits" << endl; #endif - QString fName = QString(myDet->getFilePath().c_str()); + QString fName = QString(myDet->getSettingsDir()); fName = QFileDialog::getOpenFileName(this, tr("Load Detector Trimbits"),fName, tr("Trimbit files (*.trim *.sn*)")); @@ -392,14 +392,14 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ if (!fName.isEmpty()){ if(myDet->loadSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) qDefs::InfoMessage("The Trimbits have been loaded successfully.","Main"); - else qDefs::WarningMessage("The Loading of Trimbits has failed.","Main"); + else qDefs::WarningMessage(string("Could not load the Trimbits from file:\n")+fName.toAscii().constData(),"Main"); } } else if(action==actionSaveTrimbits){ #ifdef VERBOSE cout << "Saving Trimbits" << endl; #endif - QString fName = QString(myDet->getFilePath().c_str()); + QString fName = QString(myDet->getSettingsDir()); fName = QFileDialog::getSaveFileName(this, tr("Save Current Detector Trimbits"),fName, tr("Trimbit files (*.trim *.sn*) ")); @@ -407,87 +407,38 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ if (!fName.isEmpty()){ if(myDet->saveSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) qDefs::InfoMessage("The Trimbits have been saved successfully.","Main"); - else qDefs::WarningMessage("The Saving of Trimbits has failed.","Main"); + else qDefs::WarningMessage(string("Could not save the Trimbits to file:\n")+fName.toAscii().constData(),"Main"); } } else if(action==actionLoadCalibration){ #ifdef VERBOSE cout << "Loading Calibration Data" << endl; #endif - QString fName = QString(myDet->getFilePath().c_str()); + QString fName = QString(myDet->getCalDir()); fName = QFileDialog::getOpenFileName(this, tr("Load Detector Calibration Data"),fName, tr("Calibration files (*.cal *.sn*)")); // Gets called when cancelled as well if (!fName.isEmpty()){ - int nMod = myDet->setNumberOfModules(); - slsDetector *detector; - slsDetectorDefs::sls_detector_module *myMod=NULL; - string sFname= fName.toAscii().constData(); - double gain,offset; - for(int i=0;igetSlsDetector(i); - if(detector){ - if (sFname.find(".cal")==string::npos) { - if (sFname.find(".sn")==string::npos && sFname.find(".cal")) { - ostringstream ostfn; - ostfn << sFname << ".sn" << setfill('0') << setw(3) << hex << myDet->getId(slsDetectorDefs::MODULE_SERIAL_NUMBER, i); - fn=ostfn.str(); - }} - if(detector->readCalibrationFile(fn,gain,offset)==-1) - qDefs::WarningMessage(string("Could not open Calibration File.\n")+ fn,"Main"); - else{ - if(myMod = detector->getModule(i)){ - myMod->gain = gain; - myMod->offset = offset; - detector->setModule(*myMod); - detector->deleteModule(myMod); - } - } - } - detector = NULL; - } - - //if(energyConversion::readCalibrationFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) - // qDefs::InfoMessage("The Calibration Data have been loaded successfully.","Main"); - //else qDefs::WarningMessage("The Loading of Calibration Data has failed.","Main"); + if(myDet->loadCalibrationFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) + qDefs::InfoMessage("The Calibration Data have been loaded successfully.","Main"); + else qDefs::WarningMessage(string("Could not load the Calibration data from file:\n")+ fName.toAscii().constData(),"Main"); } } else if(action==actionSaveCalibration){ #ifdef VERBOSE cout << "Saving Calibration Data" << endl; #endif - QString fName = QString(myDet->getFilePath().c_str()); + QString fName = QString(myDet->getCalDir()); fName = QFileDialog::getSaveFileName(this, tr("Save Current Detector Calibration Data"),fName, tr("Calibration files (*.cal *.sn*) ")); // Gets called when cancelled as well if (!fName.isEmpty()){ - int nMod = myDet->setNumberOfModules(); - cout<<"nmode:"<getSlsDetector(i); - if(detector){ - ostringstream ostfn; - ostfn << sFname << ".sn" << setfill('0') << setw(3) << hex << myDet->getId(slsDetectorDefs::MODULE_SERIAL_NUMBER, i); - fn=ostfn.str(); - if(myMod = detector->getModule(i)){ - if(detector->writeCalibrationFile(fn,myMod->gain,myMod->offset)==-1) - qDefs::WarningMessage(string("Could not open Calibration File.\n")+ fn,"Main"); - detector->deleteModule(myMod); - } - } - detector = NULL; - } - //if(energyConversion::writeCalibrationFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) - // qDefs::InfoMessage("The Calibration Data have been saved successfully.","Main"); - //else qDefs::WarningMessage("The Saving of Calibration Data has failed.","Main"); + if(myDet->saveCalibrationFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) + qDefs::InfoMessage("The Calibration Data have been saved successfully.","Main"); + else qDefs::WarningMessage(string("Could not save the Calibration data to file:\n")+fName.toAscii().constData(),"Main"); + } } From a754e419fe70fcfafdf997c008205e00790b58eb Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Mon, 3 Sep 2012 09:35:01 +0000 Subject: [PATCH 047/332] loading and saving trimbits and calibration file works now git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@47 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qDetectorMain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index d9d0f5de0..223fd8211 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -429,7 +429,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ #ifdef VERBOSE cout << "Saving Calibration Data" << endl; #endif - QString fName = QString(myDet->getCalDir()); + QString fName = QString(myDet->getCalDir())+QString("/newTrims"); fName = QFileDialog::getSaveFileName(this, tr("Save Current Detector Calibration Data"),fName, tr("Calibration files (*.cal *.sn*) ")); From 63fadd3633e78ad2f80d554ecda3ce37e90d0038 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 4 Sep 2012 10:30:18 +0000 Subject: [PATCH 048/332] added color to collapse in actions, changed angular for number of data to be received, corrected constant size scan widget git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@48 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_advanced.ui | 631 ++++++++++++++++++---- slsDetectorGui/forms/form_tab_settings.ui | 5 +- slsDetectorGui/include/qScanWidget.h | 2 +- slsDetectorGui/include/qTabActions.h | 39 +- slsDetectorGui/include/qTabAdvanced.h | 12 +- slsDetectorGui/src/qActionsWidget.cpp | 5 +- slsDetectorGui/src/qDetectorMain.cpp | 6 +- slsDetectorGui/src/qDrawPlot.cpp | 6 +- slsDetectorGui/src/qScanWidget.cpp | 19 +- slsDetectorGui/src/qTabActions.cpp | 48 +- slsDetectorGui/src/qTabAdvanced.cpp | 45 ++ 11 files changed, 683 insertions(+), 135 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_advanced.ui b/slsDetectorGui/forms/form_tab_advanced.ui index 56142c7ac..306024a56 100644 --- a/slsDetectorGui/forms/form_tab_advanced.ui +++ b/slsDetectorGui/forms/form_tab_advanced.ui @@ -11,7 +11,7 @@ - + 0 0 @@ -31,58 +31,16 @@ Form - - - - 25 - 20 - 726 - 58 - - - - Calibration Logs - - - - - 35 - 20 - 626 - 31 - - - - - 15 - - - - - Energy Calibration - - - - - - - Angular Calibration - - - - - - true - 20 - 150 - 731 - 156 + 25 + 90 + 721 + 226 @@ -94,34 +52,24 @@ false - + + true + + 15 - 20 - 701 - 126 + 25 + 691 + 195 - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 45 - 10 - - - - + + + 12 + - + 0 @@ -133,33 +81,8 @@ - - - - - 0 - 0 - - - - - None - - - - - Adjust to Fix Count Level - - - - - Equalize to Median - - - - - - + + Qt::Horizontal @@ -168,14 +91,213 @@ - 75 - 10 + 20 + 20 - - + + + + + 0 + 0 + + + + Exposure Time: + + + + + + + true + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Exposure time of each frame. + #exptime# + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + 5 + + + 0.000000000000000 + + + 2000000000.000000000000000 + + + 1.000000000000000 + + + + + + + true + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Qt::LeftToRight + + + 2 + + + + hr + + + + + min + + + + + s + + + + + ms + + + + + us + + + + + ns + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 50 + 20 + + + + + + + + + 0 + 0 + + + + Output Directory: + + + + + + + + + + + 0 + 0 + + + + Browse + + + + + + + 0 + + + + + + + + 0 + 0 + + + + Start Trimming + + + + + true @@ -185,11 +307,320 @@ 0 + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Exposure time of each frame. + #exptime# + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + 5 + + + 0.000000000000000 + + + 2000000000.000000000000000 + + + 560.000000000000000 + + + + + + + + 0 + 0 + + + + Sets the Threshold DAC + + + Threshold: + + + + + + + true + + + + 0 + 0 + + + + + 0 + 0 + + Optimize Settings + + + + + 0 + 0 + + + + Resolution (a.u.): + + + + + + + + 0 + 0 + + + + Number of measurements (not in real time) that will be acquired. + #frames# + + + + + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + 1 + + + 2000000000 + + + 4 + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + Adjust to Fix Count Level + + + + + Equalize to Median + + + + + + + + + 0 + 0 + + + + Counts/ Channel: + + + + + + + + 0 + 0 + + + + Number of measurements (not in real time) that will be acquired. + #frames# + + + + + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + 1 + + + 2000000000 + + + 500 + + + + + + + + + + 25 + 10 + 341 + 61 + + + + Trimbits Plot Mode + + + + + 15 + 20 + 311 + 31 + + + + + 34 + + + + + + 0 + 0 + + + + No Plot + + + + + + + + 0 + 0 + + + + Data Graph + + + + + + + + 0 + 0 + + + + Histogram + + + + + + + + + + 405 + 10 + 341 + 61 + + + + Calibration Logs + + + + + 15 + 20 + 311 + 31 + + + + + 42 + + + + + + 0 + 0 + + + + Energy Calibration + + + + + + + + 0 + 0 + + + + Angular Calibration + + + diff --git a/slsDetectorGui/forms/form_tab_settings.ui b/slsDetectorGui/forms/form_tab_settings.ui index 415b80f3a..c95ddb9b2 100644 --- a/slsDetectorGui/forms/form_tab_settings.ui +++ b/slsDetectorGui/forms/form_tab_settings.ui @@ -109,8 +109,11 @@ + + false + - eV + eV -100000 diff --git a/slsDetectorGui/include/qScanWidget.h b/slsDetectorGui/include/qScanWidget.h index 658e99370..1aa7d632a 100644 --- a/slsDetectorGui/include/qScanWidget.h +++ b/slsDetectorGui/include/qScanWidget.h @@ -86,7 +86,7 @@ private: /** Sets up the scan parameters * returns if it was set - */ + */ int SetScan(int mode); private slots: diff --git a/slsDetectorGui/include/qTabActions.h b/slsDetectorGui/include/qTabActions.h index aaa16951c..77ad9be44 100644 --- a/slsDetectorGui/include/qTabActions.h +++ b/slsDetectorGui/include/qTabActions.h @@ -56,6 +56,28 @@ void EnablePositions(bool enable); private: + /** Sets up the widget */ + void SetupWidgetWindow(); + + /** Sets up all the slots and signals */ + void Initialization(); + + /** creates the Num Positions object */ + void CreatePositionsWidget(); + + /** Returns the index in each of the classes + * of actionwidget and scanwidget + * @param index the index in the list of all widgets + * returns actual index of the class + */ + int GetActualIndex(int index); + + /** Updates to green color if collapsed and mode not none + */ + void UpdateCollapseColors(); + + + /** The sls detector object */ multiSlsDetector *myDet; @@ -88,23 +110,6 @@ private: double *positions; QPalette normal; - - /** Sets up the widget */ - void SetupWidgetWindow(); - - /** Sets up all the slots and signals */ - void Initialization(); - - /** creates the Num Positions object */ - void CreatePositionsWidget(); - - /** Returns the index in each of the classes - * of actionwidget and scanwidget - * @param index the index in the list of all widgets - * returns actual index of the class - */ - int GetActualIndex(int index); - private slots: /** To Expand the Action Widget * */ diff --git a/slsDetectorGui/include/qTabAdvanced.h b/slsDetectorGui/include/qTabAdvanced.h index e6fff7459..38f0185ca 100644 --- a/slsDetectorGui/include/qTabAdvanced.h +++ b/slsDetectorGui/include/qTabAdvanced.h @@ -12,6 +12,8 @@ #include "ui_form_tab_advanced.h" /** Project Class Headers */ class multiSlsDetector; +/** Qt Include Header */ +#include /** *@short sets up the advanced parameters @@ -36,9 +38,6 @@ public: private: - /** The sls detector object */ - multiSlsDetector *myDet; - /** Sets up the widget */ void SetupWidgetWindow(); @@ -48,9 +47,14 @@ private: void Initialization(); + /** The sls detector object */ + multiSlsDetector *myDet; + private slots: - +/** Enable/Disable Energy and Calibration Logs + */ +void SetLogs(); }; diff --git a/slsDetectorGui/src/qActionsWidget.cpp b/slsDetectorGui/src/qActionsWidget.cpp index e92850ad5..b15cd2351 100644 --- a/slsDetectorGui/src/qActionsWidget.cpp +++ b/slsDetectorGui/src/qActionsWidget.cpp @@ -80,6 +80,7 @@ void qActionsWidget::SetMode(int mode){ if(mode) myDet->setActionScript(id,fName.toAscii().constData()); else myDet->setActionScript(id,""); //mode is not set when fname is blank + if(!fName.isEmpty()){ //check if mode didnt get set if(mode!=myDet->getActionMode(id)){ @@ -95,6 +96,7 @@ void qActionsWidget::SetMode(int mode){ } } } + } @@ -189,9 +191,10 @@ void qActionsWidget::Refresh(){ string script = myDet->getActionScript(id); string parameter = myDet->getActionParameter(id); + //settings values and checking for none dispScript->setText(QString(script.c_str())); - SetScriptFile(); + if(mode)SetScriptFile(); dispParameter->setText(QString(parameter.c_str())); SetParameter(); //set mode which also checks everything diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 223fd8211..dc48642ba 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -398,7 +398,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ else if(action==actionSaveTrimbits){ #ifdef VERBOSE cout << "Saving Trimbits" << endl; -#endif +#endif//different output directory so as not to overwrite QString fName = QString(myDet->getSettingsDir()); fName = QFileDialog::getSaveFileName(this, tr("Save Current Detector Trimbits"),fName, @@ -428,8 +428,8 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ else if(action==actionSaveCalibration){ #ifdef VERBOSE cout << "Saving Calibration Data" << endl; -#endif - QString fName = QString(myDet->getCalDir())+QString("/newTrims"); +#endif//different output directory so as not to overwrite + QString fName = QString(myDet->getCalDir()); fName = QFileDialog::getSaveFileName(this, tr("Save Current Detector Calibration Data"),fName, tr("Calibration files (*.cal *.sn*) ")); diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 9e67308c5..72a543aa4 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -214,11 +214,9 @@ void qDrawPlot::StartStopDaqToggle(bool stop_if_running){ number_of_exposures = number_of_frames * numScan0 * numScan1; - if(anglePlot) { - int numPos = myDet->getPositions(); //numPos = ((numPos==0) ?1:numPos); - number_of_exposures = numScan0 * numScan1;/*number_of_exposures * numPos;*/ + if(anglePlot) number_of_exposures = numScan0 * numScan1; + - } cout << "\tNumber of Exposures:" << number_of_exposures << endl; // ExposureTime diff --git a/slsDetectorGui/src/qScanWidget.cpp b/slsDetectorGui/src/qScanWidget.cpp index 9bcb344ca..c30b33c8b 100644 --- a/slsDetectorGui/src/qScanWidget.cpp +++ b/slsDetectorGui/src/qScanWidget.cpp @@ -231,7 +231,7 @@ void qScanWidget::EnableSizeWidgets(){ #ifdef VERBOSE cout << "Constant Range Values" << endl; #endif - spinSteps->setMinimum(2); + radioCustom->setText("Specific Values"); radioCustom->setPalette(normal); radioCustom->setToolTip(customTip); @@ -245,7 +245,11 @@ void qScanWidget::EnableSizeWidgets(){ stackedLayout->setCurrentIndex(RangeValues); - SetRangeSteps(); + int oldNumSteps = spinSteps->value(); + //if the steps change, it calls SetRangeSteps on its own. + RangeCalculateNumSteps(); + if(oldNumSteps==spinSteps->value()) SetRangeSteps(); + spinSteps->setMinimum(2); } //custom values else if(radioCustom->isChecked()){ @@ -887,6 +891,15 @@ void qScanWidget::SetFileSteps(){ } } } + //ERROR IN WRITING FILENAME OR READING FILE + else{ + actualNumSteps=0; + positions.resize(0); + SetScan(comboScript->currentIndex()); + disconnect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps())); + spinSteps->setValue(actualNumSteps); + connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps())); + } } @@ -997,7 +1010,7 @@ void qScanWidget::Refresh(){ //settings values and checking for none dispScript->setText(QString(script.c_str())); - SetScriptFile(); + if(mode) SetScriptFile(); dispParameter->setText(QString(parameter.c_str())); SetParameter(); spinPrecision->setValue(precision); diff --git a/slsDetectorGui/src/qTabActions.cpp b/slsDetectorGui/src/qTabActions.cpp index 44790291c..a08aaae71 100644 --- a/slsDetectorGui/src/qTabActions.cpp +++ b/slsDetectorGui/src/qTabActions.cpp @@ -211,14 +211,26 @@ void qTabActions::Expand(QAbstractButton *button ){ if(index==NumPositions) { positionWidget->hide(); setFixedHeight(height()-30);//-80 if the checkboxes are included + if(myDet->getPositions()) { + palette->setColor(QPalette::WindowText,Qt::darkGreen); + lblName[index]->setPalette(*palette); + } } else if((index==Scan0)||(index==Scan1)) { scanWidget[GetActualIndex(index)]->hide(); setFixedHeight(height()-130); + if(myDet->getScanMode(GetActualIndex(index))){ + palette->setColor(QPalette::WindowText,Qt::darkGreen); + lblName[index]->setPalette(*palette); + } } else { actionWidget[GetActualIndex(index)]->hide(); setFixedHeight(height()-30); + if(myDet->getActionMode(GetActualIndex(index))){ + palette->setColor(QPalette::WindowText,Qt::darkGreen); + lblName[index]->setPalette(*palette); + } } }else{ // Expand @@ -349,7 +361,7 @@ void qTabActions::Refresh(){ //delete existing positions if (positions) delete [] positions; //get number of positions - int numPos=myDet->getPositions();cout<<"numPOs:"<getPositions(); comboPos->setMaxCount(numPos); //set the number of positions in the gui @@ -383,6 +395,8 @@ void qTabActions::Refresh(){ scanWidget[i]->Refresh(); for(int i=0;iRefresh(); + + UpdateCollapseColors(); } @@ -405,3 +419,35 @@ int qTabActions::GetActualIndex(int index){ //------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabActions::UpdateCollapseColors(){ +#ifdef VERYVERBOSE + cout << "Updating Collapse Colors" << endl; +#endif + for(int i=0;iisEnabled()){ + if(myDet->getPositions()) palette->setColor(QPalette::WindowText,Qt::darkGreen); + else palette->setColor(QPalette::WindowText,Qt::black); + lblName[i]->setPalette(*palette); + } + } + //scans + else if((i==Scan0)||(i==Scan1)){ + if(myDet->getScanMode(GetActualIndex(i))) palette->setColor(QPalette::WindowText,Qt::darkGreen); + else palette->setColor(QPalette::WindowText,Qt::black); + lblName[i]->setPalette(*palette); + } + //actions + else{ + if(myDet->getActionMode(GetActualIndex(i))) palette->setColor(QPalette::WindowText,Qt::darkGreen); + else palette->setColor(QPalette::WindowText,Qt::black); + lblName[i]->setPalette(*palette); + } + } + +} +//------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp index 6825b7307..ee803ddc9 100644 --- a/slsDetectorGui/src/qTabAdvanced.cpp +++ b/slsDetectorGui/src/qTabAdvanced.cpp @@ -14,6 +14,7 @@ using namespace std; +//------------------------------------------------------------------------------------------------------------------------------------------------- qTabAdvanced::qTabAdvanced(QWidget *parent,multiSlsDetector*& detector):QWidget(parent),myDet(detector){ @@ -23,6 +24,8 @@ qTabAdvanced::qTabAdvanced(QWidget *parent,multiSlsDetector*& detector):QWidget( } +//------------------------------------------------------------------------------------------------------------------------------------------------- + qTabAdvanced::~qTabAdvanced(){ @@ -30,6 +33,7 @@ qTabAdvanced::~qTabAdvanced(){ } +//------------------------------------------------------------------------------------------------------------------------------------------------- void qTabAdvanced::SetupWidgetWindow(){ @@ -37,8 +41,41 @@ void qTabAdvanced::SetupWidgetWindow(){ } +//------------------------------------------------------------------------------------------------------------------------------------------------- + void qTabAdvanced::Initialization(){ + //energy/angular logs + connect(chkEnergyLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs())); + connect(chkAngularLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs())); + + +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabAdvanced::SetLogs(){ + QCheckBox *checkedBox = qobject_cast(sender()); + int index = ((!checkedBox->text().compare("Energy Calibration"))?slsDetectorDefs::enCalLog:slsDetectorDefs::angCalLog); + bool enable = checkedBox->isChecked(); +#ifdef VERBOSE + if(index==slsDetectorDefs::enCalLog) + cout << "Setting Energy Calibration Logs to " << enable << endl; + else + cout << "Setting Angular Calibration Logs to " << enable << endl; +#endif + //set/unset the log + myDet->setAction(index,(enable?"set":"none")); + //verify + if(myDet->getActionMode(index)!=(enable)){ +#ifdef VERBOSE + cout << "Could not set/reset Log." << endl; +#endif + qDefs::WarningMessage("Could not set/reset Log.","Advanced"); + checkedBox->setChecked(!enable); + } } @@ -47,6 +84,14 @@ void qTabAdvanced::Initialization(){ void qTabAdvanced::Refresh(){ + //energy/angular logs + chkEnergyLog->setChecked(myDet->getActionMode(slsDetectorDefs::enCalLog)); + chkAngularLog->setChecked(myDet->getActionMode(slsDetectorDefs::angCalLog)); +#ifdef VERBOSE + cout << "Energy Calibration Log set to " << chkEnergyLog->isChecked() << endl; + cout << "Angular Calibration Log set to " << chkAngularLog->isChecked() << endl; +#endif + } From e32c1de0af692382ccfac9d7ef88d76cf579f0bf Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 5 Sep 2012 07:33:55 +0000 Subject: [PATCH 049/332] stop signal works, call back works, number of probes to expert mode, angular works git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@49 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qDrawPlot.h | 24 +- slsDetectorGui/include/qTabMeasurement.h | 179 ++++++------ slsDetectorGui/src/qCloneWidget.cpp | 16 +- slsDetectorGui/src/qDetectorMain.cpp | 32 +- slsDetectorGui/src/qDrawPlot.cpp | 354 +++++++++++++---------- slsDetectorGui/src/qTabActions.cpp | 3 +- slsDetectorGui/src/qTabDataOutput.cpp | 1 + slsDetectorGui/src/qTabMeasurement.cpp | 9 +- 8 files changed, 356 insertions(+), 262 deletions(-) diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index f7f96ed94..b603c8c46 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -138,8 +138,8 @@ void SetLines(bool enable){lines = enable;}; void SetMarkers(bool enable){markers = enable;}; /** sets the scan argument to prepare the plot*/ void SetScanArgument(int scanArg){scanArgument = scanArg;}; - - +/** sets stop_signal to true */ +void StopAcquisition(){ stop_signal = true; }; @@ -178,12 +178,24 @@ static void* DataStartAcquireThread(void *this_pointer); static int GetDataCallBack(detectorData *data, void *this_pointer); /** This is called by the GetDataCallBack function to copy the data */ int GetData(detectorData *data); +/** This is called by detector class when acquisition is finished + * @param currentProgress current progress of measurement + * @param detectorStatus current status of the detector + * @param this_pointer is the pointer pointing to this object + * */ +static int GetAcquisitionFinishedCallBack(double currentProgress,int detectorStatus, void *this_pointer); +/** This is called by detector class when acquisition is finished + * @param currentProgress current progress of measurement + * @param detectorStatus current status of the detector + * */ +int AcquisitionFinished(double currentProgress,int detectorStatus); /** Saves all the plots. All sets saveError to true if not saved.*/ void SavePlotAutomatic(); - +/** Sets the style of the 1d plot */ void SetStyle(SlsQtH1D* h){ if(lines) h->setStyle(QwtPlotCurve::Lines); else h->setStyle(QwtPlotCurve::Dots); - if(markers) h->setSymbol(*marker); else h->setSymbol(*noMarker);}; + if(markers) h->setSymbol(*marker); else h->setSymbol(*noMarker); +}; @@ -248,8 +260,8 @@ int number_of_measurements; int currentMeasurement; /** currentFrame */ int currentFrame; -/** current Index */ -int currentIndex; +/** variable to check if its the nth frame */ +int numFactor; /** current Scan Division Level */ int currentScanDivLevel; /** current scan Value */ diff --git a/slsDetectorGui/include/qTabMeasurement.h b/slsDetectorGui/include/qTabMeasurement.h index af3cd90e5..eda4f5373 100644 --- a/slsDetectorGui/include/qTabMeasurement.h +++ b/slsDetectorGui/include/qTabMeasurement.h @@ -40,27 +40,29 @@ public: */ void Refresh(); + /** To enable expert mode + * @param enable to enable if true + */ + void SetExpertMode(bool enable){expertMode = enable;SetupTimingMode();}; + + + +public slots: + + /** update plot is finished, + * changes start/stop text and enables/disables all widgets + */ + void UpdateFinished(); + + /** updates the current measurement + * @param val the value to be updated + */ + void SetCurrentMeasurement(int val); + + + private: - /** The sls detector object */ - multiSlsDetector *myDet; - - /** The Plot widget */ - qDrawPlot *myPlot; - - enum{None, Auto, Trigger_Exp_Series, Trigger_Frame, Trigger_Readout, Gated, Gated_Start, Trigger_Window, NumTimingModes}; - - QTimer *progressTimer; - - int numMeasurement; - - int currentMeasurement; - - QString acqPeriodTip; - QString errPeriodTip; - QPalette red; - -/** methods */ /** Sets up the widget */ void SetupWidgetWindow(); @@ -86,88 +88,99 @@ private: void Enable(bool enable); -public slots: - -/** update plot is finished, - * changes start/stop text and enables/disables all widgets - */ -void UpdateFinished(); - -/** updates the current measurement - * @param val the value to be updated - */ -void SetCurrentMeasurement(int val); private slots: -/** Sets the timing mode - * @ param mode cane be None, Auto, Gated, Trigger Exposure Series, - * Trigger Frame, Trigger Readout, External Trigger Window - */ -void SetTimingMode(int mode); + /** Sets the timing mode + * @ param mode cane be None, Auto, Gated, Trigger Exposure Series, + * Trigger Frame, Trigger Readout, External Trigger Window + */ + void SetTimingMode(int mode); -/** Set number of measurements - * @param num number of measurements to be set */ -void setNumMeasurements(int num); + /** Set number of measurements + * @param num number of measurements to be set */ + void setNumMeasurements(int num); -/** Set file name - * @param fName name of file - */ -void setFileName(const QString& fName); + /** Set file name + * @param fName name of file + */ + void setFileName(const QString& fName); -/** Set index of file name - * @param index index of selection - */ -void setRunIndex(int index); + /** Set index of file name + * @param index index of selection + */ + void setRunIndex(int index); -/** starts/stops Acquisition - */ -void startStopAcquisition(); + /** starts/stops Acquisition + */ + void startStopAcquisition(); -/** Set number of frames - * @param val number of frames to be set - */ -void setNumFrames(int val); + /** Set number of frames + * @param val number of frames to be set + */ + void setNumFrames(int val); -/** Set acquisition time - */ -void setExposureTime(); + /** Set acquisition time + */ + void setExposureTime(); -/** Set frame period between exposures - */ -void setAcquisitionPeriod(); + /** Set frame period between exposures + */ + void setAcquisitionPeriod(); -/** Set number of triggers - * @param val number of triggers to be set - */ -void setNumTriggers(int val); + /** Set number of triggers + * @param val number of triggers to be set + */ + void setNumTriggers(int val); -/** Set delay - */ -void setDelay(); + /** Set delay + */ + void setDelay(); -/** Set number of gates - * @param val number of gates to be set - */ -void setNumGates(int val); + /** Set number of gates + * @param val number of gates to be set + */ + void setNumGates(int val); -/** Set number of probes - * @param val number of probes to be set - */ -void setNumProbes(int val); + /** Set number of probes + * @param val number of probes to be set + */ + void setNumProbes(int val); -/** Update progress*/ -void UpdateProgress(); + /** Update progress*/ + void UpdateProgress(); + + /** Enable write to file */ + void EnableFileWrite(bool enable); + + + +private: + /** The sls detector object */ + multiSlsDetector *myDet; + /** The Plot widget */ + qDrawPlot *myPlot; + /** enum for the timing mode */ + enum{None, Auto, Trigger_Exp_Series, Trigger_Frame, Trigger_Readout, Gated, Gated_Start, Trigger_Window, NumTimingModes}; + /** timer to update the progress*/ + QTimer *progressTimer; + /** number of measurements*/ + int numMeasurement; + /** current measurement */ + int currentMeasurement; + /** tool tip variables*/ + QString acqPeriodTip; + QString errPeriodTip; + QPalette red; + /** expert mode */ + bool expertMode; -/** Enable write to file */ -void EnableFileWrite(bool enable); signals: - -void StartSignal(); -void StopSignal(); -void CheckPlotIntervalSignal(); -void EnableNthFrameSignal(bool); + void StartSignal(); + void StopSignal(); + void CheckPlotIntervalSignal(); + void EnableNthFrameSignal(bool); }; diff --git a/slsDetectorGui/src/qCloneWidget.cpp b/slsDetectorGui/src/qCloneWidget.cpp index 064616ac1..cef7130c1 100644 --- a/slsDetectorGui/src/qCloneWidget.cpp +++ b/slsDetectorGui/src/qCloneWidget.cpp @@ -157,7 +157,13 @@ void qCloneWidget::SavePlot(){ //QString fName = QString(filePath.c_str())+'/'+dispFName->text()+comboFormat->currentText(); char cID[10]; sprintf(cID,"%d",id); - QString fName = QString(filePath.c_str())+"/Snapshot_"+QString(cID)+".png"; + //title + QString fName = QString(filePath.c_str()); + if(cloneBox->title().contains('.')){ + fName.append(QString('/')+cloneBox->title()); + fName.replace(".dat",".png"); + }else fName.append(QString("/Snapshot_unknown_title.png")); + //save QImage img(cloneBox->size().width(),cloneBox->size().height(),QImage::Format_RGB32); QPainter painter(&img); cloneBox->render(&painter); @@ -178,7 +184,13 @@ void qCloneWidget::SavePlot(){ int qCloneWidget::SavePlotAutomatic(){ char cID[10]; sprintf(cID,"%d",id); - QString fName = QString(filePath.c_str())+"/Snapshot_"+QString(cID)+".png"; + //title + QString fName = QString(filePath.c_str()); + if(cloneBox->title().contains('.')){ + fName.append(QString('/')+cloneBox->title()); + fName.replace(".dat",".png"); + }else fName.append(QString("/Snapshot_unknown_title.png")); + //save QImage img(cloneBox->size().width(),cloneBox->size().height(),QImage::Format_RGB32); QPainter painter(&img); cloneBox->render(&painter); diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index dc48642ba..551085e1e 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -227,6 +227,7 @@ void qDetectorMain::Initialization(){ connect(tabs, SIGNAL(currentChanged(int)), this, SLOT(Refresh(int)));//( QWidget*))); // Measurement tab connect(tab_measurement, SIGNAL(StartSignal()), this,SLOT(EnableTabs())); + connect(tab_measurement, SIGNAL(StopSignal()), myPlot,SLOT(StopAcquisition())); connect(tab_measurement, SIGNAL(StopSignal()), this,SLOT(EnableTabs())); connect(tab_measurement, SIGNAL(CheckPlotIntervalSignal()), tab_plot,SLOT(SetFrequency())); connect(tab_measurement, SIGNAL(EnableNthFrameSignal(bool)), tab_plot,SLOT(EnableNthFrame(bool))); @@ -274,21 +275,20 @@ void qDetectorMain::EnableModes(QAction *action){ #endif } - //Set ExpertMode + //Set ExpertMode(comes here only if its a digital detector) else if(action==actionExpert){ enable = actionExpert->isChecked(); + tabs->setTabEnabled(Advanced,enable); - if((enable)&&(digitalDetector)){ - actionLoadTrimbits->setVisible(true); - actionSaveTrimbits->setVisible(true); - actionLoadCalibration->setVisible(true); - actionSaveCalibration->setVisible(true); - }else{ - actionLoadTrimbits->setVisible(false); - actionSaveTrimbits->setVisible(false); - actionLoadCalibration->setVisible(false); - actionSaveCalibration->setVisible(false); - } + actionLoadTrimbits->setVisible(enable); + actionSaveTrimbits->setVisible(enable); + actionLoadCalibration->setVisible(enable); + actionSaveCalibration->setVisible(enable); + + if(myDet->getDetectorsType()==slsDetectorDefs::MYTHEN) + tab_measurement->SetExpertMode(enable); + + #ifdef VERBOSE cout << "Setting Expert Mode to " << enable << endl; #endif @@ -387,7 +387,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ QString fName = QString(myDet->getSettingsDir()); fName = QFileDialog::getOpenFileName(this, tr("Load Detector Trimbits"),fName, - tr("Trimbit files (*.trim *.sn*)")); + tr("Trimbit files (*.trim noise.sn*)")); // Gets called when cancelled as well if (!fName.isEmpty()){ if(myDet->loadSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) @@ -402,7 +402,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ QString fName = QString(myDet->getSettingsDir()); fName = QFileDialog::getSaveFileName(this, tr("Save Current Detector Trimbits"),fName, - tr("Trimbit files (*.trim *.sn*) ")); + tr("Trimbit files (*.trim noise.sn*) ")); // Gets called when cancelled as well if (!fName.isEmpty()){ if(myDet->saveSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) @@ -417,7 +417,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ QString fName = QString(myDet->getCalDir()); fName = QFileDialog::getOpenFileName(this, tr("Load Detector Calibration Data"),fName, - tr("Calibration files (*.cal *.sn*)")); + tr("Calibration files (*.cal calibration.sn*)")); // Gets called when cancelled as well if (!fName.isEmpty()){ if(myDet->loadCalibrationFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) @@ -432,7 +432,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ QString fName = QString(myDet->getCalDir()); fName = QFileDialog::getSaveFileName(this, tr("Save Current Detector Calibration Data"),fName, - tr("Calibration files (*.cal *.sn*) ")); + tr("Calibration files (*.cal calibration.sn*) ")); // Gets called when cancelled as well if (!fName.isEmpty()){ if(myDet->saveCalibrationFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 72a543aa4..ccfb5e8a2 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -184,6 +184,9 @@ void qDrawPlot::Initialization(){ //------------------------------------------------------------------------------------------------------------------------------------------------- void qDrawPlot::StartStopDaqToggle(bool stop_if_running){ +#ifdef VERYVERBOSE + cout << "Entering StartStopDaqToggle(" << stop_if_running << ")" <setTimer(slsDetectorDefs::FRAME_PERIOD,-1))*1E-9); cout << "\tAcquisition Period:" << setprecision (10) << acquisitionPeriod << endl; + //to take the first data if frameFactor + numFactor = 0; //for save automatically, saveError = false; @@ -286,8 +291,8 @@ bool qDrawPlot::StartOrStopThread(bool start){ if(start){ if(myDet->getRunStatus()==slsDetectorDefs::IDLE) - cout<getRunStatus()<getRunStatus()<registerDataCallback(&(GetDataCallBack),this); + //Setting the callback function to alert when acquisition finished from detector class + myDet->registerAcquisitionFinishedCallback(&(GetAcquisitionFinishedCallBack),this); // Start acquiring data from server if(!firstTime) pthread_join(gui_acquisition_thread,NULL);//wait until he's finished, ie. exits pthread_create(&gui_acquisition_thread, NULL,DataStartAcquireThread, (void*) this); @@ -414,40 +419,36 @@ int qDrawPlot::GetData(detectorData *data){ cout << "Entering GetDatafunction" << endl; #endif if(!stop_signal){ + //set title SetPlotTitle(QString(data->fileName).section('/',-1)); + //set progress + progress=(int)data->progressIndex; + + //Plot Disabled - if(!plotEnable) { - progress=(int)data->progressIndex; - currentFrame++; - return 0; - } - + if(!plotEnable) return 0; //Nth Frame if(frameFactor){ - //when to copy data - if(((currentFrame+1==number_of_exposures)&&(currentMeasurement+1==number_of_measurements)) - ||(!((currentFrame)%frameFactor))); + //plots if numfactor becomes 0 + if(!numFactor) numFactor=frameFactor-1; //return if not else{ - progress=(int)data->progressIndex; - currentFrame++; + numFactor--; return 0; } } - //Not Nth Frame, Not time out yet + //Not Nth Frame, to check time out(NOT for 2dScans and angle plots) else{ if((scanArgument==None)&&(!anglePlot)){ //if the time is not over, RETURN if(!data_pause_over){ - progress=(int)data->progressIndex; - currentFrame++; return 0; } data_pause_over=false; @@ -456,128 +457,146 @@ int qDrawPlot::GetData(detectorData *data){ } - //what comes here has plot enabled AND (frame factor OR data pause over ) - progress=(int)data->progressIndex; - //current index - currentIndex = myDet->getFileIndexFromFileName(string(data->fileName)); - - //scan variable - int currentScanVariable0 = myDet->getCurrentScanVariable(0); - int currentScanVariable1 = myDet->getCurrentScanVariable(1); + //angle plotting + if(anglePlot){ + if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ + lastImageNumber= currentFrame+1; + nAnglePixelsX = data->npoints; + histNBins = nAnglePixelsX; + nHists=1; + if(histXAngleAxis) delete [] histXAngleAxis; histXAngleAxis = new double[nAnglePixelsX]; + if(histYAngleAxis) delete [] histYAngleAxis; histYAngleAxis = new double[nAnglePixelsX]; + memcpy(histXAngleAxis,data->angles,nAnglePixelsX*sizeof(double)); + memcpy(histYAngleAxis,data->values,nAnglePixelsX*sizeof(double)); + pthread_mutex_unlock(&(last_image_complete_mutex)); + } + currentFrame++; + return 0; + } - if((currentFrame)<(number_of_exposures)){ -#ifdef VERYVERBOSE - cout << "Reading in image: " << currentIndex << endl; -#endif - //angle plotting - if(anglePlot){ + + //if scan argument is 2d + if(scanArgument!=None){ + //alframes + if(scanArgument==AllFrames){ if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ + //variables lastImageNumber= currentFrame+1; - nAnglePixelsX = data->npoints; - histNBins = nAnglePixelsX; - nHists=1; - if(histXAngleAxis) delete [] histXAngleAxis; histXAngleAxis = new double[nAnglePixelsX]; - if(histYAngleAxis) delete [] histYAngleAxis; histYAngleAxis = new double[nAnglePixelsX]; - memcpy(histXAngleAxis,data->angles,nAnglePixelsX*sizeof(double)); - memcpy(histYAngleAxis,data->values,nAnglePixelsX*sizeof(double)); + //title + char temp_title[2000]; + sprintf(temp_title,"Image Index %d",myDet->getFileIndexFromFileName(string(data->fileName))); + imageTitle = temp_title; + //copy data + memcpy(lastImageArray+(currentScanDivLevel*nPixelsX),data->values,nPixelsX*sizeof(double)); pthread_mutex_unlock(&(last_image_complete_mutex)); } currentFrame++; + currentScanDivLevel++; return 0; } - //if scan argument is 2d - if(scanArgument!=None){ - //alframes - if(scanArgument==AllFrames){ - if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ - lastImageNumber= currentFrame+1; - char temp_title[2000]; sprintf(temp_title,"Image Index %d",currentIndex); imageTitle = temp_title; - memcpy(lastImageArray+(currentScanDivLevel*nPixelsX),data->values,nPixelsX*sizeof(double)); - pthread_mutex_unlock(&(last_image_complete_mutex)); - } - currentFrame++; - currentScanDivLevel++; - return 0; - } - //file index - if(scanArgument==FileIndex){ - if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ - if(currentIndex == minPixelsY) currentScanDivLevel = 0; - lastImageNumber= currentFrame+1; - char temp_title[2000]; sprintf(temp_title,"Image Index %d",currentIndex); imageTitle = temp_title; - for(unsigned int px=0;pxvalues[px]; - pthread_mutex_unlock(&(last_image_complete_mutex)); - } - currentFrame++; - currentScanDivLevel++; - return 0; - } - //level0 - if(scanArgument==Level0){ - if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ - if(currentScanVariable0!=currentScanValue) currentScanDivLevel++; - currentScanValue = currentScanVariable0; - lastImageNumber= currentFrame+1; - char temp_title[2000]; sprintf(temp_title,"Image Index %d",currentIndex); imageTitle = temp_title; - for(unsigned int px=0;pxvalues[px]; - pthread_mutex_unlock(&(last_image_complete_mutex)); - } - currentFrame++; - return 0; - } - //level1 + //file index + if(scanArgument==FileIndex){ if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ - if(currentScanVariable1!=currentScanValue) currentScanDivLevel++; - currentScanValue = currentScanVariable1; + //variables + int currentIndex = myDet->getFileIndexFromFileName(string(data->fileName)); + if(currentIndex == minPixelsY) currentScanDivLevel = 0; lastImageNumber= currentFrame+1; - char temp_title[2000]; sprintf(temp_title,"Image Index %d",currentIndex); imageTitle = temp_title; + //title + char temp_title[2000]; + sprintf(temp_title,"Image Index %d",currentIndex); + imageTitle = temp_title; + //copy data + for(unsigned int px=0;pxvalues[px]; + pthread_mutex_unlock(&(last_image_complete_mutex)); + } + currentFrame++; + currentScanDivLevel++; + return 0; + } + //level0 + if(scanArgument==Level0){ + if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ + //get scanvariable0 + int currentIndex = 0, p = 0; double cs0 = 0 , cs1 = 0; + myDet->getVariablesFromFileName(string(data->fileName), currentIndex, p, cs0, cs1); + int currentScanVariable0 = (int)cs0; + //variables + if(currentScanVariable0!=currentScanValue) currentScanDivLevel++; + currentScanValue = currentScanVariable0; + lastImageNumber= currentFrame+1; + //title + char temp_title[2000]; + sprintf(temp_title,"Image Index %d",currentIndex); + imageTitle = temp_title; + //copy data for(unsigned int px=0;pxvalues[px]; pthread_mutex_unlock(&(last_image_complete_mutex)); } currentFrame++; return 0; - } - - //normal measurement or 1d scans + //level1 if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ - char temp_title[2000]; - // only if you got the lock, do u need to remember lastimagenumber to plot + //get scanvariable1 + int currentIndex = 0, p = 0; double cs0 = 0 , cs1 = 0; + myDet->getVariablesFromFileName(string(data->fileName), currentIndex, p, cs0, cs1); + int currentScanVariable1 = (int)cs1; + //variables + if(currentScanVariable1!=currentScanValue) currentScanDivLevel++; + currentScanValue = currentScanVariable1; lastImageNumber= currentFrame+1; - - //1d - if(plot_in_scope==1){ - // Titles changed to "" inside startstopthread - // Persistency - if(currentPersistency < persistency)currentPersistency++; - else currentPersistency=persistency; - nHists = currentPersistency+1; - histNBins = nPixelsX; - // copy data - for(int i=currentPersistency;i>0;i--) - memcpy(histYAxis[i],histYAxis[i-1],nPixelsX*sizeof(double)); - memcpy(histYAxis[0],data->values,nPixelsX*sizeof(double)); - } - //2d - else{ - // Titles - sprintf(temp_title,"Image Index %d",currentIndex); - imageTitle = temp_title; - // manufacture data for now - for(unsigned int px=0;pxvalues,nPixelsX*nPixelsY*sizeof(double)); - } + //title + char temp_title[2000]; + sprintf(temp_title,"Image Index %d",currentIndex); + imageTitle = temp_title; + //copy data + for(unsigned int px=0;pxvalues[px]; pthread_mutex_unlock(&(last_image_complete_mutex)); } currentFrame++; + return 0; + } + + //normal measurement or 1d scans + if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ + char temp_title[2000]; + // only if you got the lock, do u need to remember lastimagenumber to plot + lastImageNumber= currentFrame+1; + + //1d + if(plot_in_scope==1){ + // Titles changed to "" inside startstopthread + // Persistency + if(currentPersistency < persistency)currentPersistency++; + else currentPersistency=persistency; + nHists = currentPersistency+1; + histNBins = nPixelsX; + // copy data + for(int i=currentPersistency;i>0;i--) + memcpy(histYAxis[i],histYAxis[i-1],nPixelsX*sizeof(double)); + memcpy(histYAxis[0],data->values,nPixelsX*sizeof(double)); + } + //2d + else{ + // Titles + sprintf(temp_title,"Image Index %d",myDet->getFileIndexFromFileName(string(data->fileName))); + imageTitle = temp_title; + // manufacture data for now + for(unsigned int px=0;pxvalues,nPixelsX*nPixelsY*sizeof(double)); + } + pthread_mutex_unlock(&(last_image_complete_mutex)); + } + currentFrame++; + } #ifdef VERYVERBOSE cout << "Exiting GetData function" << endl; @@ -585,6 +604,50 @@ int qDrawPlot::GetData(detectorData *data){ return 0; } + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +int qDrawPlot::GetAcquisitionFinishedCallBack(double currentProgress,int detectorStatus, void *this_pointer){ + ((qDrawPlot*)this_pointer)->AcquisitionFinished(currentProgress,detectorStatus); + return 0; +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +int qDrawPlot::AcquisitionFinished(double currentProgress,int detectorStatus){ +#ifdef VERBOSE + cout << "Entering Acquisition Finished with status " << + slsDetectorBase::runStatusType((slsDetectorDefs::runStatus(detectorStatus))) << " and progress " << currentProgress << endl; +#endif + + //error + if((detectorStatus==slsDetectorDefs::IDLE) && (currentProgress!=100)){ + cout<<"in here"<stop(); @@ -630,9 +693,6 @@ void qDrawPlot::UpdatePlot(){ //1-d plot stuff if(lastImageNumber){ if(histNBins){ -#ifdef VERYVERBOSE - /*cout << "Last Image Number: " << lastImageNumber << endl;*/ -#endif Clear1DPlot(); plot1D->SetXTitle(histXAxisTitle.toAscii().constData()); plot1D->SetYTitle(histYAxisTitle.toAscii().constData()); @@ -699,33 +759,21 @@ void qDrawPlot::UpdatePlot(){ last_plot_number=lastImageNumber; if(plotEnable) UnlockLastImageArray(); - // Measurement not over, continue - if(number_of_exposures!=currentFrame){//las plot number? - //if the interval is a timer and not nth frame * - if(!frameFactor) - plot_update_timer->start((int)timerValue); - else - plot_update_timer->start((int)PLOT_TIMER_MS); - } - // if a measurement is over - else{ - currentMeasurement++;cout<<"currentMeasurement:"<start((int)timerValue); + else + plot_update_timer->start((int)PLOT_TIMER_MS); + } //------------------------------------------------------------------------------------------------------------------------------------------------- void qDrawPlot::StopUpdatePlot(){ +#ifdef VERYVERBOSE + cout << "Entering StopUpdatePlot()" << endl; +#endif plot_update_timer->stop(); } @@ -832,8 +880,12 @@ void qDrawPlot::SavePlot(){ QPainter painter(&savedImage); render(&painter); - // save image - QString fName = QString(myDet->getFilePath().c_str())+"/Image.png"; + QString fName = QString(myDet->getFilePath().c_str()); + if(boxPlot->title().contains('.')){ + fName.append(QString('/')+boxPlot->title()); + fName.replace(".dat",".png"); + }else fName.append(QString("/Image.png")); + fName = QFileDialog::getSaveFileName(0,tr("Save Image"),fName,tr("PNG Files (*.png);;XPM Files(*.xpm);;JPEG Files(*.jpg)"),0,QFileDialog::ShowDirsOnly); if (!fName.isEmpty()) @@ -851,7 +903,7 @@ void qDrawPlot::SavePlot(){ void qDrawPlot::SaveAll(bool enable){ string msg = string("The Files will be saved as:\n")+ string(myDet->getFilePath().c_str())+string("/")+ - string(myDet->getFileName().c_str())+string("_[File Index].png"); + string(myDet->getFileName().c_str())+string("[title].png"); qDefs::InfoMessage(msg,"Dock"); saveAll = enable; } @@ -866,9 +918,13 @@ void qDrawPlot::SavePlotAutomatic(){ lastSavedMeasurement = currentMeasurement; char cID[10]; sprintf(cID,"%d",lastSavedFrame); - QString fName = QString(myDet->getFilePath().c_str())+QString("/")+ - QString(myDet->getFileName().c_str())+QString("_")+ - QString(cID)+".png"; + //title + QString fName = QString(myDet->getFilePath().c_str()); + if(boxPlot->title().contains('.')){ + fName.append(QString('/')+boxPlot->title()); + fName.replace(".dat",".png"); + }else fName.append(QString("/Image_unknown_title.png")); + //save QImage img(size().width(),size().height(),QImage::Format_RGB32); QPainter painter(&img); render(&painter); diff --git a/slsDetectorGui/src/qTabActions.cpp b/slsDetectorGui/src/qTabActions.cpp index a08aaae71..f7aa17d22 100644 --- a/slsDetectorGui/src/qTabActions.cpp +++ b/slsDetectorGui/src/qTabActions.cpp @@ -337,7 +337,8 @@ void qTabActions::EnablePositions(bool enable){ //to collapse if it was expanded if(btnExpand[NumPositions]->text()=="-") Expand(group->button(NumPositions)); - comboPos->clear(); + for(int i=0;icount();i++) + comboPos->removeItem(i); cout<<"Number of Positions set to :"<getPositions()<setPalette(lblName[NumPositions-1]->palette()); lblName[NumPositions]->setEnabled(false); diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index b3237bdc3..b162997da 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -357,6 +357,7 @@ void qTabDataOutput::SetAngularCorrection(){ cout << "Unsetting angular correction" << endl; #endif } + emit AngularConversionSignal(chkAngular->isChecked()); } diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 07c045ebc..1b7695fe0 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -26,7 +26,7 @@ using namespace std; qTabMeasurement::qTabMeasurement(QWidget *parent,multiSlsDetector*& detector, qDrawPlot*& plot): - QWidget(parent),myDet(detector),myPlot(plot){ + QWidget(parent),myDet(detector),myPlot(plot),expertMode(false){ setupUi(this); SetupWidgetWindow(); Initialization(); @@ -80,8 +80,7 @@ void qTabMeasurement::SetupWidgetWindow(){ SetupTimingMode(); //file write enabled/disabled - myDet->enableWriteToFile(true); - //check if file enabled + chkFile->setChecked(myDet->enableWriteToFile()); } @@ -292,6 +291,7 @@ void qTabMeasurement::startStopAcquisition(){ progressTimer->start(100); emit StartSignal(); + myPlot->StartStopDaqToggle(); }else{ #ifdef VERBOSE cout << "Stopping Acquisition" << endl<< endl; @@ -304,7 +304,6 @@ void qTabMeasurement::startStopAcquisition(){ Enable(1); emit StopSignal(); } - myPlot->StartStopDaqToggle(); } @@ -563,7 +562,7 @@ void qTabMeasurement::SetTimingMode(int mode){ if(mode!=None){//Number of Probes - if(myDet->getDetectorsType()==slsDetectorDefs::MYTHEN){ + if((myDet->getDetectorsType()==slsDetectorDefs::MYTHEN)&&(expertMode)){ lblNumProbes->setEnabled(true); spinNumProbes->setEnabled(true); } } From b67f3a83d8946a9a719fde0705b33497e7ebce0b Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 5 Sep 2012 08:42:03 +0000 Subject: [PATCH 050/332] stop signal works, call back works, number of probes to expert mode, angular works git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@50 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qCloneWidget.h | 8 +++++-- slsDetectorGui/src/qCloneWidget.cpp | 31 +++++++++++++++++++++++++-- slsDetectorGui/src/qDrawPlot.cpp | 7 ++++++ 3 files changed, 42 insertions(+), 4 deletions(-) diff --git a/slsDetectorGui/include/qCloneWidget.h b/slsDetectorGui/include/qCloneWidget.h index adacf4d07..57bc42084 100644 --- a/slsDetectorGui/include/qCloneWidget.h +++ b/slsDetectorGui/include/qCloneWidget.h @@ -62,8 +62,10 @@ public: * @param histXAxis X Axis value in 1D * @param histYAxis Y Axis value in 1D * @param histTitle Title for all the graphs in 1D + * @param lines style of plot if lines or dots + * @param markers style of plot markers or not * */ - void SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis[],string histTitle[]); + void SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis[],string histTitle[],bool lines,bool markers); /** Get the 1D hist values to plot for angle plotting * @param nHists Number of graphs in 1D @@ -71,8 +73,10 @@ public: * @param histXAxis X Axis value in 1D * @param histYAxis Y Axis value in 1D * @param histTitle Title for all the graphs in 1D + * @param lines style of plot if lines or dots + * @param markers style of plot markers or not * */ - void SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis,string histTitle[]); + void SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis,string histTitle[],bool lines,bool markers); public slots: /** Save Plots automatically by save all clones diff --git a/slsDetectorGui/src/qCloneWidget.cpp b/slsDetectorGui/src/qCloneWidget.cpp index cef7130c1..77e5e02c4 100644 --- a/slsDetectorGui/src/qCloneWidget.cpp +++ b/slsDetectorGui/src/qCloneWidget.cpp @@ -14,6 +14,7 @@ #include #include #include +#include "qwt_symbol.h" /** C++ Include Headers */ #include using namespace std; @@ -97,7 +98,7 @@ void qCloneWidget::SetupWidgetWindow(QString title,int numDim,SlsQt1DPlot*& plot //------------------------------------------------------------------------------------------------------------------------------------------------- -void qCloneWidget::SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis[],string histTitle[]){ +void qCloneWidget::SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis[],string histTitle[],bool lines,bool markers){ /** for each plot*/cout<<"qclone nhists:"<SetData(histNBins,histXAxis,histYAxis[hist_num]); } + //style of plot + if(lines) k->setStyle(QwtPlotCurve::Lines); + else k->setStyle(QwtPlotCurve::Dots); + if(markers) { + QwtSymbol *marker = new QwtSymbol(); + marker->setStyle(QwtSymbol::Cross); + marker->setSize(5,5); + k->setSymbol(*marker); + }else { + QwtSymbol *noMarker = new QwtSymbol(); + k->setSymbol(*noMarker); + } + //set title and attach plot k->setTitle(histTitle[hist_num].c_str()); k->Attach(cloneplot1D); } @@ -119,7 +133,7 @@ void qCloneWidget::SetCloneHists(int nHists,int histNBins,double* histXAxis,doub //------------------------------------------------------------------------------------------------------------------------------------------------- -void qCloneWidget::SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis,string histTitle[]){ +void qCloneWidget::SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis,string histTitle[],bool lines,bool markers){ /** for each plot*/cout<<"qclone nhists:"<SetData(histNBins,histXAxis,histYAxis); } + //style of plot + if(lines) k->setStyle(QwtPlotCurve::Lines); + else k->setStyle(QwtPlotCurve::Dots); + if(markers) { + QwtSymbol *marker = new QwtSymbol(); + marker->setStyle(QwtSymbol::Cross); + marker->setSize(5,5); + k->setSymbol(*marker); + }else { + QwtSymbol *noMarker = new QwtSymbol(); + k->setSymbol(*noMarker); + } + //set title and attach plot k->setTitle(histTitle[hist_num].c_str()); k->Attach(cloneplot1D); } diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index ccfb5e8a2..af133260b 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -808,6 +808,13 @@ void qDrawPlot::ClonePlot(){ winClone[i]->SetCloneHists((int)nHists,histNBins,histXAxis,histYAxis,histTitle); else winClone[i]->SetCloneHists((int)nHists,histNBins,histXAngleAxis,histYAngleAxis,histTitle); + // update range + if(!IsXYRange[qDefs::XMINIMUM]) XYRangeValues[qDefs::XMINIMUM]= plot1D->GetXMinimum(); + if(!IsXYRange[qDefs::XMAXIMUM]) XYRangeValues[qDefs::XMAXIMUM]= plot1D->GetXMaximum(); + if(!IsXYRange[qDefs::YMINIMUM]) XYRangeValues[qDefs::YMINIMUM]= plot1D->GetYMinimum(); + if(!IsXYRange[qDefs::YMAXIMUM]) XYRangeValues[qDefs::YMAXIMUM]= plot1D->GetYMaximum(); + plot1D->SetXMinMax(XYRangeValues[qDefs::XMINIMUM],XYRangeValues[qDefs::XMAXIMUM]); + plot1D->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]); } } else{ From a4a0237711585e72309630fc5f252cb0d8974aa1 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 7 Sep 2012 08:17:16 +0000 Subject: [PATCH 051/332] trim tab works except for graph git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@51 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_advanced.ui | 110 +++++--- slsDetectorGui/forms/form_tab_debugging.ui | 164 ++++++++---- slsDetectorGui/include/qCloneWidget.h | 15 +- slsDetectorGui/include/qDefs.h | 69 +++-- slsDetectorGui/include/qDrawPlot.h | 7 +- slsDetectorGui/include/qTabAdvanced.h | 55 +++- slsDetectorGui/src/qActionsWidget.cpp | 10 +- slsDetectorGui/src/qCloneWidget.cpp | 36 ++- slsDetectorGui/src/qDetectorMain.cpp | 40 +-- slsDetectorGui/src/qDrawPlot.cpp | 178 +++++++------ slsDetectorGui/src/qScanWidget.cpp | 28 +- slsDetectorGui/src/qTabActions.cpp | 2 +- slsDetectorGui/src/qTabAdvanced.cpp | 288 ++++++++++++++++++++- slsDetectorGui/src/qTabDataOutput.cpp | 4 +- slsDetectorGui/src/qTabDebugging.cpp | 6 + slsDetectorGui/src/qTabDeveloper.cpp | 10 +- slsDetectorGui/src/qTabMeasurement.cpp | 20 +- slsDetectorGui/src/qTabMessages.cpp | 4 +- slsDetectorGui/src/qTabPlot.cpp | 20 +- slsDetectorGui/src/qTabSettings.cpp | 13 +- 20 files changed, 776 insertions(+), 303 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_advanced.ui b/slsDetectorGui/forms/form_tab_advanced.ui index 306024a56..f629631ec 100644 --- a/slsDetectorGui/forms/form_tab_advanced.ui +++ b/slsDetectorGui/forms/form_tab_advanced.ui @@ -31,7 +31,7 @@ Form - + true @@ -55,6 +55,9 @@ true + + true + @@ -98,7 +101,7 @@ - + 0 @@ -140,6 +143,9 @@ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + false + 5 @@ -248,29 +254,51 @@ - - - - 0 - 0 - - - - Output Directory: - - - - - - - - + 0 0 + + <nobr> +Trimfile to which the resulting trimbits will be written. +</nobr><br><nobr> +An extension given by the modules serial number will be attached. +</nobr> + + + Output Trim File: + + + + + + + <nobr> +Trimfile to which the resulting trimbits will be written. +</nobr><br><nobr> +An extension given by the modules serial number will be attached. +</nobr> + + + + + + + + 0 + 0 + + + + <nobr> +Trimfile to which the resulting trimbits will be written. +</nobr><br><nobr> +An extension given by the modules serial number will be attached. +</nobr> + Browse @@ -284,7 +312,7 @@ - + 0 @@ -297,12 +325,12 @@ - + true - + 0 0 @@ -326,14 +354,17 @@ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + false + - 5 + 3 0.000000000000000 - 2000000000.000000000000000 + 10000.000000000000000 560.000000000000000 @@ -352,7 +383,7 @@ Sets the Threshold DAC - Threshold: + Threshold (DACu): @@ -379,7 +410,7 @@ - + 0 @@ -392,7 +423,7 @@ - + 0 @@ -412,6 +443,9 @@ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + false + @@ -419,7 +453,7 @@ 1 - 2000000000 + 9 4 @@ -453,7 +487,7 @@ - + 0 @@ -466,7 +500,7 @@ - + 0 @@ -486,14 +520,17 @@ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + false + - 1 + 0 - 2000000000 + 16000000 500 @@ -529,7 +566,7 @@ 34 - + 0 @@ -539,10 +576,13 @@ No Plot + + true + - + 0 @@ -555,7 +595,7 @@ - + 0 diff --git a/slsDetectorGui/forms/form_tab_debugging.ui b/slsDetectorGui/forms/form_tab_debugging.ui index 4e02206dc..bd8703d92 100644 --- a/slsDetectorGui/forms/form_tab_debugging.ui +++ b/slsDetectorGui/forms/form_tab_debugging.ui @@ -31,46 +31,6 @@ Form - - - - 30 - 50 - 321 - 36 - - - - - - - Module Number: - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - All Modules - - - - - - @@ -112,30 +72,23 @@ - 15 + 75 115 - 291 + 150 25 + + + 0 + 0 + + Run - - - - 425 - 55 - 316 - 25 - - - - Get Detector Information - - @@ -177,17 +130,114 @@ - 15 + 85 115 - 291 + 150 25 + + + 0 + 0 + + Run + + + + 45 + 30 + 291 + 36 + + + + + + + Detector Status: + + + + + + + Offline + + + + + + + + + 440 + 29 + 291 + 76 + + + + + + + Module Number: + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + + All Modules + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 150 + 16777215 + + + + Get Information + + + + + diff --git a/slsDetectorGui/include/qCloneWidget.h b/slsDetectorGui/include/qCloneWidget.h index 57bc42084..507f06887 100644 --- a/slsDetectorGui/include/qCloneWidget.h +++ b/slsDetectorGui/include/qCloneWidget.h @@ -10,8 +10,8 @@ /** Qt Project Class Headers */ class SlsQtH1D; -class SlsQt1DPlot; -class SlsQt2DPlotLayout; +#include "SlsQt1DPlot.h" +#include "SlsQt2DPlotLayout.h" /** Qt Include Headers */ #include #include @@ -29,6 +29,7 @@ class SlsQt2DPlotLayout; #include /** C++ Include Headers */ #include +#include using namespace std; /** @@ -78,6 +79,16 @@ public: * */ void SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis,string histTitle[],bool lines,bool markers); + /**Set the range of the 1d plot + * @param IsXYRange array of x,y,min,max if these values are set + * @param XYRangeValues array of set values of x,y, min, max + */ + void SetRange(bool IsXYRange[], double XYRangeValues[]); + + /** Returns the 1d plot + */ + SlsQt1DPlot* Get1dPlot(){return cloneplot1D;}; + public slots: /** Save Plots automatically by save all clones * returns -1 if fail*/ diff --git a/slsDetectorGui/include/qDefs.h b/slsDetectorGui/include/qDefs.h index 8390a562e..e66dc5757 100644 --- a/slsDetectorGui/include/qDefs.h +++ b/slsDetectorGui/include/qDefs.h @@ -26,6 +26,16 @@ public: OK, FAIL }; + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + enum MessageIndex{ + WARNING, + CRITICAL, + INFORMATION, + QUESTION + }; + //------------------------------------------------------------------------------------------------------------------------------------------------- /** unit of time */ @@ -112,46 +122,35 @@ public: //------------------------------------------------------------------------------------------------------------------------------------------------- - /**displays an warning message - * @param warningMessage the message to be displayed - * @param source is the tab or the source of the warning + /**displays an warning,error,info message + * @param message the message to be displayed + * @param source is the tab or the source of the message * */ - static void WarningMessage(string warningMessage,string source) - { - static QMessageBox* warningBox; - source.append(": WARNING"); - warningBox= new QMessageBox(QMessageBox::Warning,source.c_str(),tr(warningMessage.c_str()),QMessageBox::Ok, warningBox); - warningBox->exec(); - } - -//------------------------------------------------------------------------------------------------------------------------------------------------- - - /**displays an error message - * @param errorMessage the message to be displayed - * @param source is the tab or the source of the error - * */ - static void ErrorMessage(string errorMessage,string source) - { - static QMessageBox* errorBox; - source.append(": ERROR"); - errorBox= new QMessageBox(QMessageBox::Critical,source.c_str(),tr(errorMessage.c_str()),QMessageBox::Ok, errorBox); - errorBox->exec(); - } - -//------------------------------------------------------------------------------------------------------------------------------------------------- - - /**displays an information message - * @param infoMessage the message to be displayed - * @param source is the tab or the source of the information - * */ - static void InfoMessage(string infoMessage,string source) + static int Message(MessageIndex index, string message,string source) { static QMessageBox* msgBox; - source.append(": INFORMATION"); - msgBox= new QMessageBox(QMessageBox::Information,source.c_str(),tr(infoMessage.c_str()),QMessageBox::Ok, msgBox); - msgBox->exec(); + switch(index){ + case WARNING: + source.append(": WARNING"); + msgBox= new QMessageBox(QMessageBox::Warning,source.c_str(),tr(message.c_str()),QMessageBox::Ok, msgBox); + break; + case CRITICAL: + source.append(": CRITICAL"); + msgBox= new QMessageBox(QMessageBox::Critical,source.c_str(),tr(message.c_str()),QMessageBox::Ok, msgBox); + break; + case INFORMATION: + source.append(": INFORMATION"); + msgBox= new QMessageBox(QMessageBox::Information,source.c_str(),tr(message.c_str()),QMessageBox::Ok, msgBox); + break; + default: + source.append(": QUESTION"); + msgBox= new QMessageBox(QMessageBox::Question,source.c_str(),tr(message.c_str()),QMessageBox::Ok| QMessageBox::Cancel, msgBox); + break; + } + if(msgBox->exec()==QMessageBox::Ok) return OK; else return FAIL; } + //------------------------------------------------------------------------------------------------------------------------------------------------- /** range of x and y axes diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index b603c8c46..f16c63eeb 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -15,8 +15,6 @@ class multiSlsDetector; #include "SlsQt1DPlot.h" #include "SlsQt2DPlotLayout.h" #include "qDefs.h" -class SlsQt1DPlot; -class SlsQt2DPlotLayout; class qCloneWidget; /** Qt Include Headers */ #include @@ -218,8 +216,8 @@ void UpdatePause(){data_pause_over=true;}; /** Shows the first save error message while automatic saving * @param fileName file name of the first file that it tried to save.*/ void ShowSaveErrorMessage(QString fileName); - - +/**Shows an error message when acquisition stopped unexpectedly*/ +void ShowAcquisitionErrorMessage(); private: @@ -405,6 +403,7 @@ void SetZRangeSignal(double,double); void EnableZRangeSignal(bool); void SetCurrentMeasurementSignal(int); void saveErrorSignal(QString); +void AcquisitionErrorSignal(); }; diff --git a/slsDetectorGui/include/qTabAdvanced.h b/slsDetectorGui/include/qTabAdvanced.h index 38f0185ca..6621efa37 100644 --- a/slsDetectorGui/include/qTabAdvanced.h +++ b/slsDetectorGui/include/qTabAdvanced.h @@ -12,6 +12,7 @@ #include "ui_form_tab_advanced.h" /** Project Class Headers */ class multiSlsDetector; +#include "sls_detector_defs.h" /** Qt Include Header */ #include @@ -37,6 +38,7 @@ public: void Refresh(); + private: /** Sets up the widget */ @@ -47,14 +49,59 @@ private: void Initialization(); + +private slots: + /** Enable/Disable Energy and Calibration Logs + */ + void SetLogs(); + + /** Set acquisition time + */ + void SetExposureTime(); + + /** Set the Threshold dac value + */ + void SetThreshold(); + + /** Set output directory for trimming + */ + void SetOutputFile(); + + /** Browse output directory for trimming + */ + void BrowseOutputFile(); + + /** Enables trimming method and calls SetTrimmingMethod if enabled + * @param enable to enable trimming + */ + void EnableTrimming(bool enable); + + /** Enabling resolution and Counts if this is enabled + * @param enable to enable + */ + void SetOptimize(bool enable); + + /** Sets the trimming method + * @param mode trimming method + */ + void SetTrimmingMethod(int mode); + + /** Ensures the right trimming mode and Executes Trimming + */ + void StartTrimming(); + +private: /** The sls detector object */ multiSlsDetector *myDet; + /** Tool Tip for the output dir */ + QString outputDirTip; + QString errOutputTip; + QPalette red; + + /** Trimming mode */ + slsDetectorDefs::trimMode trimmingMode; -private slots: -/** Enable/Disable Energy and Calibration Logs - */ -void SetLogs(); }; diff --git a/slsDetectorGui/src/qActionsWidget.cpp b/slsDetectorGui/src/qActionsWidget.cpp index b15cd2351..7464227da 100644 --- a/slsDetectorGui/src/qActionsWidget.cpp +++ b/slsDetectorGui/src/qActionsWidget.cpp @@ -84,13 +84,13 @@ void qActionsWidget::SetMode(int mode){ if(!fName.isEmpty()){ //check if mode didnt get set if(mode!=myDet->getActionMode(id)){ - qDefs::WarningMessage("The mode could not be changed.","ActionsWidget"); + qDefs::Message(qDefs::WARNING,"The mode could not be changed.","ActionsWidget"); comboScript->setCurrentIndex(myDet->getActionMode(id)); }//if mode got set and its custom script else if(mode){ //when the file name did not get set correctly if(fName.compare(QString(myDet->getActionScript(id).c_str()))){ - qDefs::WarningMessage("The file path could not be set.","ActionsWidget"); + qDefs::Message(qDefs::WARNING,"The file path could not be set.","ActionsWidget"); dispScript->setText(QString(myDet->getActionScript(id).c_str())); SetScriptFile(); } @@ -141,12 +141,12 @@ void qActionsWidget::SetScriptFile(){ if(QFile::exists(fName)) set = true; //if the file doesnt exist, set it to what it was before else{ - qDefs::WarningMessage("The script file entered does not exist","ActionsWidget"); + qDefs::Message(qDefs::WARNING,"The script file entered does not exist","ActionsWidget"); dispScript->setText(QString(myDet->getActionScript(id).c_str())); } }//not a file, set it to what it was before else { - qDefs::WarningMessage("The script file path entered is not a file","ActionsWidget"); + qDefs::Message(qDefs::WARNING,"The script file path entered is not a file","ActionsWidget"); dispScript->setText(QString(myDet->getActionScript(id).c_str())); } } @@ -158,7 +158,7 @@ void qActionsWidget::SetScriptFile(){ if(fName.compare(QString(myDet->getActionScript(id).c_str()))){ //did not get set, write what is was before if(!fName.isEmpty()) - qDefs::WarningMessage("The script file could not be set. Reverting to previous file.","ActionsWidget"); + qDefs::Message(qDefs::WARNING,"The script file could not be set. Reverting to previous file.","ActionsWidget"); dispScript->setText(QString(myDet->getActionScript(id).c_str())); } } diff --git a/slsDetectorGui/src/qCloneWidget.cpp b/slsDetectorGui/src/qCloneWidget.cpp index 77e5e02c4..980e37a9f 100644 --- a/slsDetectorGui/src/qCloneWidget.cpp +++ b/slsDetectorGui/src/qCloneWidget.cpp @@ -8,16 +8,13 @@ /** Qt Project Class Headers */ #include "qCloneWidget.h" #include "qDefs.h" -#include "SlsQt1DPlot.h" -#include "SlsQt2DPlotLayout.h" /** Qt Include Headers */ #include #include #include #include "qwt_symbol.h" /** C++ Include Headers */ -#include -using namespace std; + //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -99,7 +96,7 @@ void qCloneWidget::SetupWidgetWindow(QString title,int numDim,SlsQt1DPlot*& plot //------------------------------------------------------------------------------------------------------------------------------------------------- void qCloneWidget::SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis[],string histTitle[],bool lines,bool markers){ - /** for each plot*/cout<<"qclone nhists:"<Attach(cloneplot1D); } //cloneplot1D->UnZoom(); -}//------------------------------------------------------------------------------------------------------------------------------------------------- +} + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qCloneWidget::SetRange(bool IsXYRange[],double XYRangeValues[]){ + double XYCloneRangeValues[4]; + if(!IsXYRange[qDefs::XMINIMUM]) XYCloneRangeValues[qDefs::XMINIMUM]= cloneplot1D->GetXMinimum(); + else XYCloneRangeValues[qDefs::XMINIMUM]= XYRangeValues[qDefs::XMINIMUM]; + if(!IsXYRange[qDefs::XMAXIMUM]) XYCloneRangeValues[qDefs::XMAXIMUM]= cloneplot1D->GetXMaximum(); + else XYCloneRangeValues[qDefs::XMAXIMUM]= XYRangeValues[qDefs::XMAXIMUM]; + if(!IsXYRange[qDefs::YMINIMUM]) XYCloneRangeValues[qDefs::YMINIMUM]= cloneplot1D->GetYMinimum(); + else XYCloneRangeValues[qDefs::YMINIMUM]= XYRangeValues[qDefs::YMINIMUM]; + if(!IsXYRange[qDefs::YMAXIMUM]) XYCloneRangeValues[qDefs::YMAXIMUM]= cloneplot1D->GetYMaximum(); + else XYCloneRangeValues[qDefs::YMAXIMUM]= XYRangeValues[qDefs::YMAXIMUM]; + cloneplot1D->SetXMinMax(XYCloneRangeValues[qDefs::XMINIMUM],XYCloneRangeValues[qDefs::XMAXIMUM]); + cloneplot1D->SetYMinMax(XYCloneRangeValues[qDefs::YMINIMUM],XYCloneRangeValues[qDefs::YMAXIMUM]); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + char* qCloneWidget::GetCurrentTimeStamp(){ char output[30]; @@ -198,9 +216,9 @@ void qCloneWidget::SavePlot(){ fName = QFileDialog::getSaveFileName(this,tr("Save Snapshot "),fName,tr("PNG Files (*.png);;XPM Files(*.xpm);;JPEG Files(*.jpg)"),0,QFileDialog::ShowDirsOnly); if (!fName.isEmpty()) if((img.save(fName))) - qDefs::InfoMessage("The SnapShot has been successfully saved","Snapshot"); + qDefs::Message(qDefs::INFORMATION,"The SnapShot has been successfully saved","Snapshot"); else - qDefs::WarningMessage("Attempt to save snapshot failed.\n" + qDefs::Message(qDefs::WARNING,"Attempt to save snapshot failed.\n" "Formats: .png, .jpg, .xpm.","Snapshot"); } diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 551085e1e..803d08b8e 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -184,11 +184,11 @@ void qDetectorMain::SetUpDetector(){ #endif char cIndex[10]; sprintf(cIndex,"%d",detID); - qDefs::ErrorMessage(string("No Detector Connected at id : ")+string(cIndex),"Main"); + qDefs::Message(qDefs::CRITICAL,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"); + qDefs::Message(qDefs::CRITICAL,string("The detector ")+host+string(" is not connected. Exiting GUI."),"Main"); cout << "The detector " << host << "is not connected. Exiting GUI." << endl; exit(-1); } @@ -204,7 +204,7 @@ void qDetectorMain::SetUpDetector(){ string detName = myDet->slsDetectorBase::getDetectorType(detType); string errorMess = host+string(" has unknown detector type \"")+ detName+string("\". Exiting GUI."); - qDefs::ErrorMessage(errorMess,"Main"); + qDefs::Message(qDefs::CRITICAL,errorMess,"Main"); exit(-1); } setWindowTitle("SLS Detector GUI : "+ @@ -326,8 +326,8 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ // Gets called when cancelled as well if (!fName.isEmpty()){ if(myDet->retrieveDetectorSetup(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL) - qDefs::InfoMessage("The Setup Parameters have been loaded successfully.","Main"); - else qDefs::WarningMessage(string("Could not load the Setup Parameters from file:\n")+fName.toAscii().constData(),"Main"); + qDefs::Message(qDefs::INFORMATION,"The Setup Parameters have been loaded successfully.","Main"); + else qDefs::Message(qDefs::WARNING,string("Could not load the Setup Parameters from file:\n")+fName.toAscii().constData(),"Main"); } } else if(action==actionSaveSetup){ @@ -341,8 +341,8 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ // Gets called when cancelled as well if (!fName.isEmpty()){ if(myDet->dumpDetectorSetup(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL) - qDefs::InfoMessage("The Setup Parameters have been saved successfully.","Main"); - else qDefs::WarningMessage(string("Could not save the Setup Parameters from file:\n")+fName.toAscii().constData(),"Main"); + qDefs::Message(qDefs::INFORMATION,"The Setup Parameters have been saved successfully.","Main"); + else qDefs::Message(qDefs::WARNING,string("Could not save the Setup Parameters from file:\n")+fName.toAscii().constData(),"Main"); } } else if(action==actionMeasurementWizard){ @@ -361,8 +361,8 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ // Gets called when cancelled as well if (!fName.isEmpty()){ if(myDet->readConfigurationFile(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL) - qDefs::InfoMessage("The Configuration Parameters have been configured successfully.","Main"); - else qDefs::WarningMessage(string("Could not load the Configuration Parameters from file:\n")+fName.toAscii().constData(),"Main"); + qDefs::Message(qDefs::INFORMATION,"The Configuration Parameters have been configured successfully.","Main"); + else qDefs::Message(qDefs::WARNING,string("Could not load the Configuration Parameters from file:\n")+fName.toAscii().constData(),"Main"); } } else if(action==actionSaveConfiguration){ @@ -376,8 +376,8 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ // Gets called when cancelled as well if (!fName.isEmpty()){ if(myDet->writeConfigurationFile(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL) - qDefs::InfoMessage("The Configuration Parameters have been saved successfully.","Main"); - else qDefs::WarningMessage(string("Could not save the Configuration Parameters from file:\n")+fName.toAscii().constData(),"Main"); + qDefs::Message(qDefs::INFORMATION,"The Configuration Parameters have been saved successfully.","Main"); + else qDefs::Message(qDefs::WARNING,string("Could not save the Configuration Parameters from file:\n")+fName.toAscii().constData(),"Main"); } } else if(action==actionLoadTrimbits){ @@ -391,8 +391,8 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ // Gets called when cancelled as well if (!fName.isEmpty()){ if(myDet->loadSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) - qDefs::InfoMessage("The Trimbits have been loaded successfully.","Main"); - else qDefs::WarningMessage(string("Could not load the Trimbits from file:\n")+fName.toAscii().constData(),"Main"); + qDefs::Message(qDefs::INFORMATION,"The Trimbits have been loaded successfully.","Main"); + else qDefs::Message(qDefs::WARNING,string("Could not load the Trimbits from file:\n")+fName.toAscii().constData(),"Main"); } } else if(action==actionSaveTrimbits){ @@ -406,8 +406,8 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ // Gets called when cancelled as well if (!fName.isEmpty()){ if(myDet->saveSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) - qDefs::InfoMessage("The Trimbits have been saved successfully.","Main"); - else qDefs::WarningMessage(string("Could not save the Trimbits to file:\n")+fName.toAscii().constData(),"Main"); + qDefs::Message(qDefs::INFORMATION,"The Trimbits have been saved successfully.","Main"); + else qDefs::Message(qDefs::WARNING,string("Could not save the Trimbits to file:\n")+fName.toAscii().constData(),"Main"); } } else if(action==actionLoadCalibration){ @@ -421,8 +421,8 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ // Gets called when cancelled as well if (!fName.isEmpty()){ if(myDet->loadCalibrationFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) - qDefs::InfoMessage("The Calibration Data have been loaded successfully.","Main"); - else qDefs::WarningMessage(string("Could not load the Calibration data from file:\n")+ fName.toAscii().constData(),"Main"); + qDefs::Message(qDefs::INFORMATION,"The Calibration Data have been loaded successfully.","Main"); + else qDefs::Message(qDefs::WARNING,string("Could not load the Calibration data from file:\n")+ fName.toAscii().constData(),"Main"); } } else if(action==actionSaveCalibration){ @@ -436,8 +436,8 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ // Gets called when cancelled as well if (!fName.isEmpty()){ if(myDet->saveCalibrationFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) - qDefs::InfoMessage("The Calibration Data have been saved successfully.","Main"); - else qDefs::WarningMessage(string("Could not save the Calibration data to file:\n")+fName.toAscii().constData(),"Main"); + qDefs::Message(qDefs::INFORMATION,"The Calibration Data have been saved successfully.","Main"); + else qDefs::Message(qDefs::WARNING,string("Could not save the Calibration data to file:\n")+fName.toAscii().constData(),"Main"); } } @@ -455,7 +455,7 @@ void qDetectorMain::ExecuteHelp(QAction *action){ cout << "About: Common GUI for Mythen, Eiger, Gotthard and Agipd detectors" << endl; #endif //

A heading

- qDefs::InfoMessage("

SLS Detector GUI version: 1.0

" + qDefs::Message(qDefs::INFORMATION,"

SLS Detector GUI version: 1.0

" "Common GUI to control the SLS Detectors: " "Mythen, Eiger, Gotthard and Agipd.

" "It can be operated in parallel with the command line interface:
" diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index af133260b..52e271f96 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -120,9 +120,10 @@ void qDrawPlot::SetupWidgetWindow(){ histXAxisTitle="Channel Number"; histYAxisTitle="Counts"; - char temp_title[2000]; + for(int i=0;igetRunStatus()==slsDetectorDefs::IDLE) cout<getRunStatus()<getRunStatus(); + string status = slsDetectorBase::runStatusType(slsDetectorDefs::runStatus(detStatus)); + qDefs::Message(qDefs::WARNING,string("The acquisiton has ended abruptly. Current Detector Status: ")+status+string("."),"Dock"); +} //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -684,87 +691,88 @@ void qDrawPlot::UpdatePlot(){ #ifdef VERYVERBOSE cout << "Entering UpdatePlot function" << endl; #endif - plot_update_timer->stop(); // only if no plot isnt enabled if(plotEnable){ LockLastImageArray(); //1-d plot stuff - if(lastImageNumber){ - if(histNBins){ - Clear1DPlot(); - plot1D->SetXTitle(histXAxisTitle.toAscii().constData()); - plot1D->SetYTitle(histYAxisTitle.toAscii().constData()); - for(int hist_num=0;hist_num<(int)nHists;hist_num++){ - SlsQtH1D* h; - if(hist_num+1>plot1D_hists.size()){ - if(anglePlot) - plot1D_hists.append(h=new SlsQtH1D("1d plot",histNBins,histXAngleAxis,histYAngleAxis)); - else - plot1D_hists.append(h=new SlsQtH1D("1d plot",histNBins,histXAxis,GetHistYAxis(hist_num))); - h->SetLineColor(hist_num+1); - }else{ - h=plot1D_hists.at(hist_num); - if(anglePlot) - h->SetData(histNBins,histXAngleAxis,histYAngleAxis); - else - h->SetData(histNBins,histXAxis,GetHistYAxis(hist_num)); + if(plot_in_scope==1){ + if(lastImageNumber){ + if(histNBins){ + Clear1DPlot(); + plot1D->SetXTitle(histXAxisTitle.toAscii().constData()); + plot1D->SetYTitle(histYAxisTitle.toAscii().constData()); + for(int hist_num=0;hist_num<(int)nHists;hist_num++){ + SlsQtH1D* h; + if(hist_num+1>plot1D_hists.size()){ + if(anglePlot) + plot1D_hists.append(h=new SlsQtH1D("1d plot",histNBins,histXAngleAxis,histYAngleAxis)); + else + plot1D_hists.append(h=new SlsQtH1D("1d plot",histNBins,histXAxis,GetHistYAxis(hist_num))); + h->SetLineColor(hist_num+1); + }else{ + h=plot1D_hists.at(hist_num); + if(anglePlot) + h->SetData(histNBins,histXAngleAxis,histYAngleAxis); + else + h->SetData(histNBins,histXAxis,GetHistYAxis(hist_num)); + } + SetStyle(h); + h->setTitle(GetHistTitle(hist_num)); + h->Attach(plot1D); } - //h->setSymbol(*noSymbol); - //h->SetDotStyle(plotDotted); - SetStyle(h); - h->setTitle(GetHistTitle(hist_num)); - h->Attach(plot1D); + // update range if required + if(XYRangeChanged){ + if(!IsXYRange[qDefs::XMINIMUM]) XYRangeValues[qDefs::XMINIMUM]= plot1D->GetXMinimum(); + if(!IsXYRange[qDefs::XMAXIMUM]) XYRangeValues[qDefs::XMAXIMUM]= plot1D->GetXMaximum(); + if(!IsXYRange[qDefs::YMINIMUM]) XYRangeValues[qDefs::YMINIMUM]= plot1D->GetYMinimum(); + if(!IsXYRange[qDefs::YMAXIMUM]) XYRangeValues[qDefs::YMAXIMUM]= plot1D->GetYMaximum(); + plot1D->SetXMinMax(XYRangeValues[qDefs::XMINIMUM],XYRangeValues[qDefs::XMAXIMUM]); + plot1D->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]); + XYRangeChanged = false; + } + if(saveAll) SavePlotAutomatic(); + } + } + }//2-d plot stuff + else{ + if(lastImageArray){ + if(lastImageNumber&&last_plot_number!=(int)lastImageNumber && //there is a new plot + nPixelsX>0&&nPixelsY>0){ + //plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,-0.5,nPixelsY-0.5,lastImageArray); + plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,startPixel,endPixel,lastImageArray); + plot2D->setTitle(GetImageTitle()); + plot2D->SetXTitle(imageXAxisTitle); + plot2D->SetYTitle(imageYAxisTitle); + plot2D->SetZTitle(imageZAxisTitle); + plot2D->UpdateNKeepSetRangeIfSet(); //this will keep a "set" z range, and call Plot()->Update(); } // update range if required if(XYRangeChanged){ - if(!IsXYRange[qDefs::XMINIMUM]) XYRangeValues[qDefs::XMINIMUM]= plot1D->GetXMinimum(); - if(!IsXYRange[qDefs::XMAXIMUM]) XYRangeValues[qDefs::XMAXIMUM]= plot1D->GetXMaximum(); - if(!IsXYRange[qDefs::YMINIMUM]) XYRangeValues[qDefs::YMINIMUM]= plot1D->GetYMinimum(); - if(!IsXYRange[qDefs::YMAXIMUM]) XYRangeValues[qDefs::YMAXIMUM]= plot1D->GetYMaximum(); - plot1D->SetXMinMax(XYRangeValues[qDefs::XMINIMUM],XYRangeValues[qDefs::XMAXIMUM]); - plot1D->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]); + if(!IsXYRange[qDefs::XMINIMUM]) XYRangeValues[qDefs::XMINIMUM]= plot2D->GetPlot()->GetXMinimum(); + if(!IsXYRange[qDefs::XMAXIMUM]) XYRangeValues[qDefs::XMAXIMUM]= plot2D->GetPlot()->GetXMaximum(); + if(!IsXYRange[qDefs::YMINIMUM]) XYRangeValues[qDefs::YMINIMUM]= plot2D->GetPlot()->GetYMinimum(); + if(!IsXYRange[qDefs::YMAXIMUM]) XYRangeValues[qDefs::YMAXIMUM]= plot2D->GetPlot()->GetYMaximum(); + plot2D->GetPlot()->SetXMinMax(XYRangeValues[qDefs::XMINIMUM],XYRangeValues[qDefs::XMAXIMUM]); + plot2D->GetPlot()->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]); XYRangeChanged = false; } if(saveAll) SavePlotAutomatic(); } } - //2-d plot stuff - //cout<<"npixelsx:"<0&&nPixelsY>0){ - //plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,-0.5,nPixelsY-0.5,lastImageArray); - plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,startPixel,endPixel,lastImageArray); - plot2D->setTitle(GetImageTitle()); - plot2D->SetXTitle(imageXAxisTitle); - plot2D->SetYTitle(imageYAxisTitle); - plot2D->SetZTitle(imageZAxisTitle); - plot2D->UpdateNKeepSetRangeIfSet(); //this will keep a "set" z range, and call Plot()->Update(); - } - // update range if required - if(XYRangeChanged){ - if(!IsXYRange[qDefs::XMINIMUM]) XYRangeValues[qDefs::XMINIMUM]= plot2D->GetPlot()->GetXMinimum(); - if(!IsXYRange[qDefs::XMAXIMUM]) XYRangeValues[qDefs::XMAXIMUM]= plot2D->GetPlot()->GetXMaximum(); - if(!IsXYRange[qDefs::YMINIMUM]) XYRangeValues[qDefs::YMINIMUM]= plot2D->GetPlot()->GetYMinimum(); - if(!IsXYRange[qDefs::YMAXIMUM]) XYRangeValues[qDefs::YMAXIMUM]= plot2D->GetPlot()->GetYMaximum(); - plot2D->GetPlot()->SetXMinMax(XYRangeValues[qDefs::XMINIMUM],XYRangeValues[qDefs::XMAXIMUM]); - plot2D->GetPlot()->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]); - XYRangeChanged = false; - } - if(saveAll) SavePlotAutomatic(); - } } last_plot_number=lastImageNumber; if(plotEnable) UnlockLastImageArray(); - - if(!frameFactor) - plot_update_timer->start((int)timerValue); - else - plot_update_timer->start((int)PLOT_TIMER_MS); + //if acqq stopped before this line, it continues from here, shouldnt restart plotting timer + if(!stop_signal){ + if(!frameFactor) + plot_update_timer->start((int)timerValue); + else + plot_update_timer->start((int)PLOT_TIMER_MS); + } } @@ -804,17 +812,21 @@ void qDrawPlot::ClonePlot(){ plot1D->SetYTitle(histYAxisTitle.toAscii().constData()); plotLayout->addWidget(plot1D,1,1,1,1); if(running){ - if(anglePlot) - winClone[i]->SetCloneHists((int)nHists,histNBins,histXAxis,histYAxis,histTitle); - else - winClone[i]->SetCloneHists((int)nHists,histNBins,histXAngleAxis,histYAngleAxis,histTitle); // update range - if(!IsXYRange[qDefs::XMINIMUM]) XYRangeValues[qDefs::XMINIMUM]= plot1D->GetXMinimum(); - if(!IsXYRange[qDefs::XMAXIMUM]) XYRangeValues[qDefs::XMAXIMUM]= plot1D->GetXMaximum(); - if(!IsXYRange[qDefs::YMINIMUM]) XYRangeValues[qDefs::YMINIMUM]= plot1D->GetYMinimum(); - if(!IsXYRange[qDefs::YMAXIMUM]) XYRangeValues[qDefs::YMAXIMUM]= plot1D->GetYMaximum(); - plot1D->SetXMinMax(XYRangeValues[qDefs::XMINIMUM],XYRangeValues[qDefs::XMAXIMUM]); - plot1D->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]); + bool found =false; + for(int index=0;index<4;index++) + if(IsXYRange[index]){ + found=true; + break; + } + if(found) winClone[i]->SetRange(IsXYRange,XYRangeValues); + //copy data + LockLastImageArray(); + if(!anglePlot) + winClone[i]->SetCloneHists((int)nHists,histNBins,histXAxis,histYAxis,histTitle,lines,markers); + else + winClone[i]->SetCloneHists((int)nHists,histNBins,histXAngleAxis,histYAngleAxis,histTitle,lines,markers); + UnlockLastImageArray(); } } else{ @@ -855,9 +867,9 @@ void qDrawPlot::SaveClones(){ } } if(success) - qDefs::InfoMessage("The Snapshots have all been saved successfully in .png.","Dock"); + qDefs::Message(qDefs::INFORMATION,"The Snapshots have all been saved successfully in .png.","Dock"); else - qDefs::WarningMessage(errMessage + string("were not saved."),"Dock"); + qDefs::Message(qDefs::WARNING,errMessage + string("were not saved."),"Dock"); } @@ -897,9 +909,9 @@ void qDrawPlot::SavePlot(){ if (!fName.isEmpty()) if(savedImage.save(fName)) - qDefs::InfoMessage("The Image has been successfully saved","Dock"); + qDefs::Message(qDefs::INFORMATION,"The Image has been successfully saved","Dock"); else - qDefs::WarningMessage("Attempt to save image failed.\n" + qDefs::Message(qDefs::WARNING,"Attempt to save image failed.\n" "Formats: .png, .jpg, .xpm.","Dock"); } @@ -911,7 +923,7 @@ void qDrawPlot::SaveAll(bool enable){ string msg = string("The Files will be saved as:\n")+ string(myDet->getFilePath().c_str())+string("/")+ string(myDet->getFileName().c_str())+string("[title].png"); - qDefs::InfoMessage(msg,"Dock"); + qDefs::Message(qDefs::INFORMATION,msg,"Dock"); saveAll = enable; } @@ -952,7 +964,7 @@ void qDrawPlot::SavePlotAutomatic(){ void qDrawPlot::ShowSaveErrorMessage(QString fileName){ - qDefs::WarningMessage(string("Automatic Saving: Could not save the first file:\n")+ + qDefs::Message(qDefs::WARNING,string("Automatic Saving: Could not save the first file:\n")+ string(fileName.toAscii().constData()) + string("\n\nNote: Will not show future file save errors for this acquisition."),"Dock"); } diff --git a/slsDetectorGui/src/qScanWidget.cpp b/slsDetectorGui/src/qScanWidget.cpp index c30b33c8b..830f8ef21 100644 --- a/slsDetectorGui/src/qScanWidget.cpp +++ b/slsDetectorGui/src/qScanWidget.cpp @@ -277,7 +277,7 @@ void qScanWidget::EnableSizeWidgets(){ #ifdef VERYVERBOSE char cNum[200];sprintf(cNum,"%d",actualNumSteps); char cId[5];sprintf(cId,"%d",id); - qDefs::InfoMessage(string("Scan Level ")+string(cId)+ + qDefs::Message(qDefs::INFORMATION,string("Scan Level ")+string(cId)+ string(": Specific Values

Number of positions added: ")+ string(cNum)+string(""),"ScanWidget"); #endif @@ -385,7 +385,7 @@ int qScanWidget::SetScan(int mode){ return qDefs::OK; }else{//mode NOT set if((mode!=actualMode)&&(actualNumSteps)){ - qDefs::WarningMessage("The mode could not be changed for an unknown reason.","ScanWidget"); + qDefs::Message(qDefs::WARNING,"The mode could not be changed for an unknown reason.","ScanWidget"); comboScript->setCurrentIndex(actualMode); return qDefs::FAIL; } @@ -455,12 +455,12 @@ void qScanWidget::SetScriptFile(){ set = true; //if the file doesnt exist, set it to what it was before else{ - qDefs::WarningMessage("The script file entered does not exist","ScanWidget"); + qDefs::Message(qDefs::WARNING,"The script file entered does not exist","ScanWidget"); dispScript->setText(QString(myDet->getScanScript(id).c_str())); } }//not a file, set it to what it was before else { - qDefs::WarningMessage("The script file path entered is not a file","ScanWidget"); + qDefs::Message(qDefs::WARNING,"The script file path entered is not a file","ScanWidget"); dispScript->setText(QString(myDet->getScanScript(id).c_str())); } } @@ -471,7 +471,7 @@ void qScanWidget::SetScriptFile(){ if(fName.compare(QString(myDet->getScanScript(id).c_str()))){ //did not get set, write what is was before if(!fName.isEmpty()) - qDefs::WarningMessage("The script file could not be set. Reverting to previous file.","ScanWidget"); + qDefs::Message(qDefs::WARNING,"The script file could not be set. Reverting to previous file.","ScanWidget"); dispScript->setText(QString(myDet->getScanScript(id).c_str())); } @@ -524,7 +524,7 @@ void qScanWidget::SetPrecision(int value){ #endif myDet->setScanPrecision(id,value); if(myDet->getScanPrecision(id)!=value) - qDefs::WarningMessage("The precision was not set for an unknown reason.","ScanWidget");; + qDefs::Message(qDefs::WARNING,"The precision was not set for an unknown reason.","ScanWidget");; } @@ -633,13 +633,13 @@ void qScanWidget::SetRangeSteps(){ //positions wont be loaded if its custom script if((comboScript->currentIndex()==CustomScript)&&((script=="")||(script=="none"))){ - qDefs::InfoMessage(string("Scan Level ")+string(cId)+ + qDefs::Message(qDefs::INFORMATION,string("Scan Level ")+string(cId)+ string(": Constant Step Size

" "Positions could not be loaded as the script file path is empty."),"ScanWidget"); }else{ //error loading positions if(myDet->getScanSteps(id)!=actualNumSteps){ - qDefs::WarningMessage(string("Scan Level ")+string(cId)+ + qDefs::Message(qDefs::WARNING,string("Scan Level ")+string(cId)+ string(": Values From File

" "The positions list was not set for an unknown reason."),"ScanWidget"); /*LoadPositions(); @@ -648,7 +648,7 @@ void qScanWidget::SetRangeSteps(){ #ifdef VERYVERBOSE else{//SUCCESS char cNum[200];sprintf(cNum,"%d",actualNumSteps); - qDefs::InfoMessage(string("Scan Level ")+string(cId)+ + qDefs::Message(qDefs::INFORMATION,string("Scan Level ")+string(cId)+ string(": Constant Step Size

Number of positions added: ")+ string(cNum)+string(""),"ScanWidget"); } @@ -712,13 +712,13 @@ int qScanWidget::SetCustomSteps(){ QString script = dispScript->text(); //positions wont be loaded if its custom script if((comboScript->currentIndex()==CustomScript)&&((script=="")||(script=="none"))){ - qDefs::InfoMessage(string("Scan Level ")+string(cId)+ + qDefs::Message(qDefs::INFORMATION,string("Scan Level ")+string(cId)+ string(": Values From File

" "Positions could not be loaded as the script file path is empty."),"ScanWidget"); return qDefs::FAIL; }else{ if(myDet->getScanSteps(id)!=actualNumSteps){ - qDefs::WarningMessage("The positions list was not set for an unknown reason.","ScanWidget"); + qDefs::Message(qDefs::WARNING,"The positions list was not set for an unknown reason.","ScanWidget"); LoadPositions(); comboScript->setCurrentIndex(myDet->getScanMode(id)); return qDefs::FAIL; @@ -870,20 +870,20 @@ void qScanWidget::SetFileSteps(){ radioFile->setToolTip(fileTip);dispFile->setToolTip(fileTip);btnFile->setToolTip(fileTip); //positions wont be loaded if its custom script if((comboScript->currentIndex()==CustomScript)&&((script=="")||(script=="none"))){ - qDefs::InfoMessage(string("Scan Level ")+string(cId)+ + qDefs::Message(qDefs::INFORMATION,string("Scan Level ")+string(cId)+ string(": Values From File

" "Positions could not be loaded as the script file path is empty."),"ScanWidget"); }else{ //error loading positions if(myDet->getScanSteps(id)!=actualNumSteps){ - qDefs::WarningMessage(string("Scan Level ")+string(cId)+ + qDefs::Message(qDefs::WARNING,string("Scan Level ")+string(cId)+ string(": Values From File

" "The positions list was not set for an unknown reason."),"ScanWidget"); } #ifdef VERYVERBOSE else{//SUCCESS char cNum[200];sprintf(cNum,"%d",actualNumSteps); - qDefs::InfoMessage(string("Scan Level ")+string(cId)+ + qDefs::Message(qDefs::INFORMATION,string("Scan Level ")+string(cId)+ string(": Values From File

Number of positions added: ")+ string(cNum)+string(""),"ScanWidget"); } diff --git a/slsDetectorGui/src/qTabActions.cpp b/slsDetectorGui/src/qTabActions.cpp index f7aa17d22..daf760546 100644 --- a/slsDetectorGui/src/qTabActions.cpp +++ b/slsDetectorGui/src/qTabActions.cpp @@ -295,7 +295,7 @@ void qTabActions::SetPosition(){ positions[i] = comboPos->itemText(i).toDouble(); //setting the list and catching error if(myDet->setPositions(comboPos->count(),positions)!=comboPos->count()) - qDefs::WarningMessage("The positions list was not set for some reason.","Actions"); + qDefs::Message(qDefs::WARNING,"The positions list was not set for some reason.","Actions"); emit EnableScanBox(); diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp index ee803ddc9..0b27e904b 100644 --- a/slsDetectorGui/src/qTabAdvanced.cpp +++ b/slsDetectorGui/src/qTabAdvanced.cpp @@ -9,6 +9,8 @@ /** Project Class Headers */ #include "slsDetector.h" #include "multiSlsDetector.h" +/** Qt Include Headers */ +#include /** C++ Include Headers */ #include using namespace std; @@ -37,7 +39,20 @@ qTabAdvanced::~qTabAdvanced(){ void qTabAdvanced::SetupWidgetWindow(){ +//executed even for non digital, so make sure its necessary + slsDetectorDefs::detectorType detType = myDet->getDetectorsType(); + if((detType==slsDetectorDefs::MYTHEN)||(detType==slsDetectorDefs::EIGER)){ + outputDirTip = dispFile->toolTip(); + errOutputTip = QString("

" + "Output Trim File should contain both existing directory and a file name.
" + "The extensions are automatically added.

" + "Enter valid Output Trim File to enable Start Trimming button.
"); + red = QPalette(); + red.setColor(QPalette::Active,QPalette::WindowText,Qt::red); + boxTrimming->setChecked(false); + SetOptimize(false); + } } @@ -49,6 +64,28 @@ void qTabAdvanced::Initialization(){ connect(chkEnergyLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs())); connect(chkAngularLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs())); + //exptime + connect(spinExpTime, SIGNAL(valueChanged(double)), this, SLOT(SetExposureTime())); + connect(comboExpUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetExposureTime())); + + //threshold dac + connect(spinThreshold, SIGNAL(valueChanged(double)), this, SLOT(SetThreshold())); + + //output directory + connect(dispFile, SIGNAL(editingFinished()), this, SLOT(SetOutputFile())); + connect(btnFile, SIGNAL(clicked()), this, SLOT(BrowseOutputFile())); + + //enable trimming method group box + connect(boxTrimming, SIGNAL(toggled(bool)), this, SLOT(EnableTrimming(bool))); + + //trimming method combo + connect(comboMethod, SIGNAL(currentIndexChanged(int)), this, SLOT(SetTrimmingMethod(int))); + + //method options + connect(chkOptimize, SIGNAL(toggled(bool)), this, SLOT(SetOptimize(bool))); + + //start Trimming + connect(btnStart, SIGNAL(clicked()), this, SLOT(StartTrimming())); } @@ -73,7 +110,7 @@ void qTabAdvanced::SetLogs(){ #ifdef VERBOSE cout << "Could not set/reset Log." << endl; #endif - qDefs::WarningMessage("Could not set/reset Log.","Advanced"); + qDefs::Message(qDefs::WARNING,"Could not set/reset Log.","Advanced"); checkedBox->setChecked(!enable); } @@ -83,7 +120,233 @@ void qTabAdvanced::SetLogs(){ //------------------------------------------------------------------------------------------------------------------------------------------------- +void qTabAdvanced::SetExposureTime(){ + //Get the value of timer in ns + double exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value()); +#ifdef VERBOSE + cout << "Setting Exposure Time to " << exptimeNS << " clocks" << "/" << spinExpTime->value() << qDefs::getUnitString((qDefs::timeUnit)comboExpUnit->currentIndex()) << endl; +#endif + myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,(int64_t)exptimeNS); + +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabAdvanced::SetThreshold(){ +#ifdef VERBOSE + cout << "Setting Threshold DACu:" << spinThreshold->value() << endl; +#endif + spinThreshold->setValue((double)myDet->setDAC((dacs_t)spinThreshold->value(),slsDetectorDefs::THRESHOLD)); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabAdvanced::SetOutputFile(){ +#ifdef VERBOSE + cout << "Setting Output File for Trimming" << endl; +#endif + QString dirPath = dispFile->text().section('/',0,-2,QString::SectionIncludeLeadingSep); + cout<<"directory:"<text().section('/',-1); + cout<<"file name:"<setToolTip(outputDirTip); + lblFile->setToolTip(outputDirTip); + lblFile->setPalette(lblExpTime->palette()); + lblFile->setText("Output Trim File: "); + btnStart->setEnabled(true); + + + //check if you're overwriting original trimsettings + QDir dir; + //gets the clean absolute path + dirPath = dir.absoluteFilePath(dirPath); + dirPath = dir.cleanPath(dirPath); + QString trimdir = QString(myDet->getSettingsFile()).section('/',0,-2,QString::SectionIncludeLeadingSep); + trimdir = dir.absoluteFilePath(trimdir); + trimdir = dir.cleanPath(trimdir); + if(!dirPath.compare(trimdir)){ + int ret = qDefs::Message(qDefs::QUESTION,string("This will possibly overwrite your original trimbits.
" + "Proposed file path:") + string(dirPath.toAscii().constData())+ + string("
Do you still want to continue?"),"Advanced"); + if(ret==qDefs::FAIL){ + dispFile->setText(""); + dispFile->setToolTip(outputDirTip + errOutputTip); + lblFile->setToolTip(outputDirTip + errOutputTip); + lblFile->setPalette(red); + lblFile->setText("Output Trim File:*"); + btnStart->setEnabled(false); + } + } + + }//if the directory doesnt exist or if file name is empty + else{ + cout<<"Invalid Trimming output File"<setToolTip(outputDirTip + errOutputTip); + lblFile->setToolTip(outputDirTip + errOutputTip); + lblFile->setPalette(red); + lblFile->setText("Output Trim File:*"); + btnStart->setEnabled(false); + } +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabAdvanced::BrowseOutputFile(){ +#ifdef VERBOSE + cout << "Browsing Output Dir for Trimming:" << endl; +#endif + QString fName = dispFile->text(); + //dialog + fName = QFileDialog::getSaveFileName(this, + tr("Choose file to write the trimbits to"),fName, + tr("Trimbit files (*.trim noise.sn*) ")); + //if empty, set the file name and it calls SetFileSteps, else ignore + if (!fName.isEmpty()){ + dispFile->setText(fName); + SetOutputFile(); + } +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabAdvanced::EnableTrimming(bool enable){ +#ifdef VERBOSE + cout << "Enable Trimming set to:" << enable << endl; +#endif + if(enable){ + //show error label if invalid output dir + SetOutputFile(); + SetTrimmingMethod(comboMethod->currentIndex()); + }else{ + //error label shouldnt show when disabled + dispFile->setToolTip(outputDirTip); + lblFile->setToolTip(outputDirTip); + lblFile->setPalette(lblExpTime->palette()); + lblFile->setText("Output Trim File: "); + } +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- +void qTabAdvanced::SetOptimize(bool enable){ +#ifdef VERBOSE + cout << "Setting Optimize to:" << enable << endl; +#endif + //trimming method is adjust to count + if(!comboMethod->currentIndex()){ + lblCounts->setEnabled(true); + spinCounts->setEnabled(true); + lblResolution->setEnabled(enable); + spinResolution->setEnabled(enable); + }//trimming method is equalize to median + else{ + lblCounts->setEnabled(false); + spinCounts->setEnabled(false); + lblResolution->setEnabled(true); + spinResolution->setEnabled(true); + } +} + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabAdvanced::SetTrimmingMethod(int mode){ +#ifdef VERBOSE + cout << "Setting Trimming method to :" << mode << endl; +#endif + //make sure the right resolution/Counts is enabled + SetOptimize(chkOptimize->isChecked()); + + //set mode + switch(mode){ + case 0: trimmingMode = slsDetectorDefs::NOISE_TRIMMING; break; + case 1: trimmingMode = slsDetectorDefs::IMPROVE_TRIMMING; break; + } +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabAdvanced::StartTrimming(){ + + int parameter1, parameter2; + //optimize + bool optimize = chkOptimize->isChecked(); + + //set the mode again and also set resolution, counts + switch(trimmingMode){ + + case slsDetectorDefs::NOISE_TRIMMING: + //define parameters + parameter1 = spinCounts->value(); + parameter2 = spinResolution->value(); + if(!optimize){ + parameter2 = -1; + trimmingMode = slsDetectorDefs::FIXEDSETTINGS_TRIMMING; +#ifdef VERBOSE + cout << "Trimming Mode: FIXEDSETTINGS_TRIMMING" << endl; +#endif + }else{ +#ifdef VERBOSE + cout << "Trimming Mode: NOISE_TRIMMING" << endl; +#endif + } + break; + + case slsDetectorDefs::IMPROVE_TRIMMING: +#ifdef VERBOSE + cout << "Trimming Mode: IMPROVE_TRIMMING" << endl; +#endif + //define parameters + parameter1 = spinResolution->value(); + parameter2 = 1; + if(!optimize) parameter2 = 0; + break; + default: + cout << "Should never come here. Start Trimming will have only 2 methods." << endl; + break; + } + +#ifdef VERBOSE + +#endif + //execute + int ret = myDet->executeTrimming(trimmingMode,parameter1,parameter2,-1); + if((ret!=slsDetectorDefs::FAIL)&&(ret!=-1)){ + //save trim file + ret = myDet->saveSettingsFile(string(dispFile->text().toAscii().constData()),-1); + if((ret!=slsDetectorDefs::FAIL)&&(ret!=-1)) + qDefs::Message(qDefs::INFORMATION,"The Trimbits have been saved successfully.","Advanced"); + else qDefs::Message(qDefs::WARNING,string("Could not Save the Trimbits to file:\n")+dispFile->text().toAscii().constData(),"Advanced"); + } + else + qDefs::Message(qDefs::WARNING,"Atleast 1 channel could not be trimmed.","Advanced"); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + void qTabAdvanced::Refresh(){ + //disconnect + disconnect(chkEnergyLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs())); + disconnect(chkAngularLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs())); + disconnect(spinExpTime, SIGNAL(valueChanged(double)), this, SLOT(SetExposureTime())); + disconnect(comboExpUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetExposureTime())); + disconnect(spinThreshold, SIGNAL(valueChanged(double)), this, SLOT(SetThreshold())); + //energy/angular logs chkEnergyLog->setChecked(myDet->getActionMode(slsDetectorDefs::enCalLog)); chkAngularLog->setChecked(myDet->getActionMode(slsDetectorDefs::angCalLog)); @@ -92,6 +355,29 @@ void qTabAdvanced::Refresh(){ cout << "Angular Calibration Log set to " << chkAngularLog->isChecked() << endl; #endif + //exptime + qDefs::timeUnit unit; + double time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-9)))); +#ifdef VERBOSE + cout << "Getting acquisition time : " << time << qDefs::getUnitString(unit) << endl; +#endif + spinExpTime->setValue(time); + comboExpUnit->setCurrentIndex((int)unit); + + + //threshold + double threshold = (double)myDet->setDAC(-1,slsDetectorDefs::THRESHOLD); +#ifdef VERBOSE + cout << "Getting Threshold DACu : " << threshold << endl; +#endif + spinThreshold->setValue(threshold); + + //connect + connect(chkEnergyLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs())); + connect(chkAngularLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs())); + connect(spinExpTime, SIGNAL(valueChanged(double)), this, SLOT(SetExposureTime())); + connect(comboExpUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetExposureTime())); + connect(spinThreshold, SIGNAL(valueChanged(double)), this, SLOT(SetThreshold())); } diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index b162997da..fbe623c51 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -149,7 +149,7 @@ void qTabDataOutput::SetFlatField(){ if(myDet->setFlatFieldCorrectionFile(file.toAscii().constData())<0){ string sDir = dir.toAscii().constData(),sFile = file.toAscii().constData(); if(sDir.length()<1) {sDir = string(QDir::current().absolutePath().toAscii().constData()); /*"/home/";*/} - qDefs::WarningMessage("Invalid Flat Field file: "+sDir+"/"+sFile+ + qDefs::Message(qDefs::WARNING,"Invalid Flat Field file: "+sDir+"/"+sFile+ ".\nUnsetting Flat Field.","Data Output"); //Unsetting flat field @@ -348,7 +348,7 @@ void qTabDataOutput::SetAngularCorrection(){ cout << "Setting angular conversion to default" << endl; #endif }else{ - qDefs::WarningMessage("Angular Conversion could not be set. Please set the default file name using the command line, if you haven't already.","Data Output"); + qDefs::Message(qDefs::WARNING,"Angular Conversion could not be set. Please set the default file name using the command line, if you haven't already.","Data Output"); chkAngular->setChecked(false); } }else{ diff --git a/slsDetectorGui/src/qTabDebugging.cpp b/slsDetectorGui/src/qTabDebugging.cpp index 3dc131bb6..e599fb4c5 100644 --- a/slsDetectorGui/src/qTabDebugging.cpp +++ b/slsDetectorGui/src/qTabDebugging.cpp @@ -40,12 +40,18 @@ void qTabDebugging::SetupWidgetWindow(){ // Detector Type detType=myDet->getDetectorsType(); + //status + int detStatus = (int)myDet->getRunStatus(); + string status = slsDetectorBase::runStatusType(slsDetectorDefs::runStatus(detStatus)); + lblStatus->setText(QString(status.c_str()).toUpper()); + if(detType==slsDetectorDefs::EIGER) lblModule->setText("Half Module Number:"); else lblModule->setText("Module Number:"); // loading combo box module numbers int max = myDet->setNumberOfModules(); + /* for(int i=0;igetSlsDetector(i); if(s->setTCPSocket()!=slsDetectorDefs::FAIL){ diff --git a/slsDetectorGui/src/qTabDeveloper.cpp b/slsDetectorGui/src/qTabDeveloper.cpp index 7324d94de..fdc2e43d5 100644 --- a/slsDetectorGui/src/qTabDeveloper.cpp +++ b/slsDetectorGui/src/qTabDeveloper.cpp @@ -85,7 +85,7 @@ void qTabDeveloper::SetupWidgetWindow(){ break; default: - qDefs::ErrorMessage(string("Unknown detector type:")+myDet->slsDetectorBase::getDetectorType(detType),"Developer"); + qDefs::Message(qDefs::CRITICAL,string("Unknown detector type:")+myDet->slsDetectorBase::getDetectorType(detType),"Developer"); exit(-1); break; } @@ -228,7 +228,7 @@ void qTabDeveloper::SetHighVoltage(){ int ret = myDet->setDAC(highvoltage,slsDetectorDefs::HV_POT); //error if(ret != highvoltage){ - qDefs::ErrorMessage("High Voltage could not be set to this value.","Developer"); + qDefs::Message(qDefs::CRITICAL,"High Voltage could not be set to this value.","Developer"); lblHV->setPalette(red); lblHV->setText("High Voltage:*"); QString errTip = tipHV+QString("

High Voltage could not be set. The return value is ")+ @@ -258,7 +258,7 @@ slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(int index){ case 4: return slsDetectorDefs::CALIBRATION_PULSE; case 5: return slsDetectorDefs::PREAMP; default: - qDefs::ErrorMessage("Unknown DAC/ADC Index. Weird Error","Developer"); + qDefs::Message(qDefs::CRITICAL,"Unknown DAC/ADC Index. Weird Error","Developer"); Refresh(); break; } @@ -280,13 +280,13 @@ slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(int index){ case 8: return slsDetectorDefs::TEMPERATURE_ADC; case 9:return slsDetectorDefs::TEMPERATURE_FPGA; default: - qDefs::ErrorMessage("Unknown DAC/ADC Index. Weird Error","Developer"); + qDefs::Message(qDefs::CRITICAL,"Unknown DAC/ADC Index. Weird Error","Developer"); Refresh(); break; } break; default: - qDefs::ErrorMessage(string("Unknown detector type:")+myDet->slsDetectorBase::getDetectorType(detType),"Developer"); + qDefs::Message(qDefs::CRITICAL,string("Unknown detector type:")+myDet->slsDetectorBase::getDetectorType(detType),"Developer"); exit(-1); break; } diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 1b7695fe0..ec5dce44a 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -127,7 +127,7 @@ void qTabMeasurement::SetupTimingMode(){ item[(int)Trigger_Window]->setEnabled(false); break; default: - qDefs::ErrorMessage("Unknown detector type.","Measurement"); + qDefs::Message(qDefs::CRITICAL,"Unknown detector type.","Measurement"); exit(-1); break; } @@ -157,7 +157,7 @@ void qTabMeasurement::SetupTimingMode(){ // This should not happen -only if the server and gui has a mismatch // on which all modes are allowed in detectors else{ - qDefs::WarningMessage("Unknown Timing Mode detected from detector." + qDefs::Message(qDefs::WARNING,"Unknown Timing Mode detected from detector." "\n\nSetting the following defaults:\nTiming Mode \t: None\n" "Number of Frames \t: 1\nNumber of Triggers \t: 1","Measurement"); comboTimingMode->setCurrentIndex((int)None); @@ -191,20 +191,20 @@ void qTabMeasurement::Initialization(int timingChange){ //Number of Frames connect(spinNumFrames,SIGNAL(valueChanged(int)), this, SLOT(setNumFrames(int))); //Exposure Time - connect(spinExpTime,SIGNAL(valueChanged(double)), this, SLOT(setExposureTime()));//..myplot + connect(spinExpTime,SIGNAL(valueChanged(double)), this, SLOT(setExposureTime())); connect(comboExpUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setExposureTime())); //Frame Period between exposures - connect(spinPeriod,SIGNAL(valueChanged(double)), this, SLOT(setAcquisitionPeriod()));//..myplot + connect(spinPeriod,SIGNAL(valueChanged(double)), this, SLOT(setAcquisitionPeriod())); connect(comboPeriodUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setAcquisitionPeriod())); //Number of Triggers - connect(spinNumTriggers,SIGNAL(valueChanged(int)), this, SLOT(setNumTriggers(int)));// + connect(spinNumTriggers,SIGNAL(valueChanged(int)), this, SLOT(setNumTriggers(int))); //Delay After Trigger - connect(spinDelay,SIGNAL(valueChanged(double)), this, SLOT(setDelay()));// + connect(spinDelay,SIGNAL(valueChanged(double)), this, SLOT(setDelay())); connect(comboDelayUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setDelay())); //Number of Gates - connect(spinNumGates,SIGNAL(valueChanged(int)), this, SLOT(setNumGates(int)));// + connect(spinNumGates,SIGNAL(valueChanged(int)), this, SLOT(setNumGates(int))); //Number of Probes - connect(spinNumProbes,SIGNAL(valueChanged(int)), this, SLOT(setNumProbes(int)));// + connect(spinNumProbes,SIGNAL(valueChanged(int)), this, SLOT(setNumProbes(int))); } @@ -548,11 +548,11 @@ void qTabMeasurement::SetTimingMode(int mode){ break; default: //This should never happen - qDefs::ErrorMessage("Timing mode unknown to GUI","Measurement"); + qDefs::Message(qDefs::CRITICAL,"Timing mode unknown to GUI","Measurement"); exit(-1); } if(!success){ - qDefs::WarningMessage("The detector timing mode could not be set.\n" + qDefs::Message(qDefs::WARNING,"The detector timing mode could not be set.\n" "Please check the external flags." "\n\nSetting the following defaults:\nTiming Mode \t: None\n" "Number of Frames \t: 1\nNumber of Triggers \t: 1","Measurement"); diff --git a/slsDetectorGui/src/qTabMessages.cpp b/slsDetectorGui/src/qTabMessages.cpp index 94a7c5889..3b50e616c 100644 --- a/slsDetectorGui/src/qTabMessages.cpp +++ b/slsDetectorGui/src/qTabMessages.cpp @@ -91,10 +91,10 @@ void qTabMessages::SaveLog() { if(outfile.open(QIODevice::WriteOnly | QIODevice::Text)){//Append QTextStream out(&outfile); out<toPlainText() << endl; - qDefs::InfoMessage(string("The Log has been successfully saved to " + qDefs::Message(qDefs::INFORMATION,string("The Log has been successfully saved to " "")+fName.toAscii().constData(),"Messages"); } - else qDefs::WarningMessage("Attempt to save log file failed.","Messages"); + else qDefs::Message(qDefs::WARNING,"Attempt to save log file failed.","Messages"); } } diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index 939484f45..cb8bc9ea7 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -226,12 +226,12 @@ void qTabPlot::Initialization(){ connect(chkZMax, SIGNAL(toggled(bool)), this, SLOT(EnableZRange())); connect(this, SIGNAL(EnableZRangeSignal(bool)), myPlot, SIGNAL(EnableZRangeSignal(bool))); - connect(dispXMin, SIGNAL(returnPressed()), this, SLOT(SetAxesRange())); - connect(dispXMax, SIGNAL(returnPressed()), this, SLOT(SetAxesRange())); - connect(dispYMin, SIGNAL(returnPressed()), this, SLOT(SetAxesRange())); - connect(dispYMax, SIGNAL(returnPressed()), this, SLOT(SetAxesRange())); - connect(dispZMin, SIGNAL(returnPressed()), this, SLOT(SetZRange())); - connect(dispZMax, SIGNAL(returnPressed()), this, SLOT(SetZRange())); + connect(dispXMin, SIGNAL(editingFinished()), this, SLOT(SetAxesRange())); + connect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetAxesRange())); + connect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetAxesRange())); + connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetAxesRange())); + connect(dispZMin, SIGNAL(editingFinished()), this, SLOT(SetZRange())); + connect(dispZMax, SIGNAL(editingFinished()), this, SLOT(SetZRange())); // Save connect(btnSave, SIGNAL(clicked()), myPlot, SLOT(SavePlot())); connect(chkSaveAll, SIGNAL(toggled(bool)), myPlot, SLOT(SaveAll(bool))); @@ -344,6 +344,10 @@ void qTabPlot::EnableRange(){ void qTabPlot::SetAxesRange(){ +#ifdef VERBOSE + cout << "Setting Range" << endl; +#endif + bool changed = false; // x min changed = (dispXMin->isEnabled())&&(!dispXMin->text().isEmpty()); @@ -448,7 +452,7 @@ void qTabPlot::SetFrequency(){ // Get the time interval from gui in ms timeMS = (qDefs::getNSTime((qDefs::timeUnit)comboTimeGapUnit->currentIndex(),spinTimeGap->value()))/(1e6); if(timeMSsetValue(minPlotTimer); comboTimeGapUnit->setCurrentIndex(qDefs::MILLISECONDS); @@ -468,7 +472,7 @@ void qTabPlot::SetFrequency(){ // To make sure the period between plotting is not less than minimum plot timer in ms if(timeMSPlot Tab: Interval between Plots - The nth Image must be larger.

" + qDefs::Message(qDefs::WARNING,"Plot Tab: Interval between Plots - The nth Image must be larger.

" "Condition to be satisfied:\n(Acquisition Period)*(nth Image) >= 250ms." "

Nth image adjusted to minimum, " "for the chosen Acquisition Period.","Plot"); diff --git a/slsDetectorGui/src/qTabSettings.cpp b/slsDetectorGui/src/qTabSettings.cpp index f76a5bad9..99475afa6 100644 --- a/slsDetectorGui/src/qTabSettings.cpp +++ b/slsDetectorGui/src/qTabSettings.cpp @@ -12,6 +12,7 @@ #include "multiSlsDetector.h" // C++ Include Headers #include +#include using namespace std; //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -115,7 +116,7 @@ void qTabSettings::SetupDetectorSettings(){ item[(int)VeryHighGain]->setEnabled(true); break; default: - qDefs::ErrorMessage("Unknown detector type.","Settings"); + qDefs::Message(qDefs::CRITICAL,"Unknown detector type.","Settings"); exit(-1); break; } @@ -123,7 +124,7 @@ void qTabSettings::SetupDetectorSettings(){ // This should not happen -only if the server and gui has a mismatch // on which all modes are allowed in detectors if(!(item[(int)sett]->isEnabled())){ - qDefs::ErrorMessage("Unknown Detector Settings retrieved from detector. " + qDefs::Message(qDefs::CRITICAL,"Unknown Detector Settings retrieved from detector. " "Exiting GUI.","Settings"); #ifdef VERBOSE cout << "ERROR: Unknown Detector Settings retrieved from detector." << endl; @@ -190,7 +191,7 @@ void qTabSettings::SetNumberOfModules(int index){ #endif int i = myDet->setNumberOfModules(index); if(index!=i) - qDefs::WarningMessage("Number of modules cannot be set for this value.","Settings"); + qDefs::Message(qDefs::WARNING,"Number of modules cannot be set for this value.","Settings"); #ifdef VERBOSE cout << "ERROR: Setting number of modules to "<< i << endl; #endif @@ -214,7 +215,7 @@ void qTabSettings::SetDynamicRange(int index){ #endif ret=myDet->setDynamicRange(dr); if(ret!=dr){ - qDefs::WarningMessage("Dynamic Range cannot be set to this value.","Settings"); + qDefs::Message(qDefs::WARNING,"Dynamic Range cannot be set to this value.","Settings"); #ifdef VERBOSE cout << "ERROR: Setting dynamic range to "<< ret << endl; #endif @@ -239,8 +240,8 @@ void qTabSettings::SetEnergy(){ int index = spinThreshold->value(); myDet->setThresholdEnergy(index); int ret = (int)myDet->getThresholdEnergy(); - if(ret!=index){ - qDefs::WarningMessage("Threshold energy could not be set.","Settings"); + if((ret-index)>200){ + qDefs::Message(qDefs::WARNING,"Threshold energy could not be set. The difference is greater than 200.","Settings"); disconnect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy())); spinThreshold->setValue(ret); connect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy())); From c9db2c42727fa3b1f32aab641b33ef477afce204 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 7 Sep 2012 16:29:32 +0000 Subject: [PATCH 052/332] included images git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@52 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_action.ui | 8 +- slsDetectorGui/forms/form_scan.ui | 8 +- slsDetectorGui/forms/form_tab_advanced.ui | 209 +++++++++++-------- slsDetectorGui/forms/form_tab_dataoutput.ui | 12 +- slsDetectorGui/forms/form_tab_debugging.ui | 16 +- slsDetectorGui/forms/form_tab_measurement.ui | 14 +- slsDetectorGui/forms/form_tab_plot.ui | 50 +++-- slsDetectorGui/forms/form_tab_settings.ui | 4 +- slsDetectorGui/include/icons.qrc | 12 ++ slsDetectorGui/include/qActionsWidget.h | 2 +- slsDetectorGui/include/qScanWidget.h | 1 + slsDetectorGui/include/qTabActions.h | 4 + slsDetectorGui/include/qTabAdvanced.h | 4 + slsDetectorGui/include/qTabDataOutput.h | 6 +- slsDetectorGui/include/qTabMeasurement.h | 3 +- slsDetectorGui/include/qTabSettings.h | 6 +- slsDetectorGui/src/qActionsWidget.cpp | 1 + slsDetectorGui/src/qDetectorMain.cpp | 4 +- slsDetectorGui/src/qScanWidget.cpp | 3 +- slsDetectorGui/src/qTabActions.cpp | 41 +++- slsDetectorGui/src/qTabAdvanced.cpp | 18 +- slsDetectorGui/src/qTabDataOutput.cpp | 16 +- slsDetectorGui/src/qTabMeasurement.cpp | 12 +- slsDetectorGui/src/qTabMessages.cpp | 12 +- slsDetectorGui/src/qTabSettings.cpp | 12 +- 25 files changed, 331 insertions(+), 147 deletions(-) diff --git a/slsDetectorGui/forms/form_action.ui b/slsDetectorGui/forms/form_action.ui index 65973ed65..33d93c35e 100644 --- a/slsDetectorGui/forms/form_action.ui +++ b/slsDetectorGui/forms/form_action.ui @@ -109,6 +109,10 @@ Browse + + + :/icons/images/browse.png:/icons/images/browse.png + @@ -158,6 +162,8 @@ - + + + diff --git a/slsDetectorGui/forms/form_scan.ui b/slsDetectorGui/forms/form_scan.ui index 6088a7396..f01e88cb0 100644 --- a/slsDetectorGui/forms/form_scan.ui +++ b/slsDetectorGui/forms/form_scan.ui @@ -428,6 +428,10 @@ Defines scan range for a <b>Constant Step Size</b> with the followin Browse + + + :/icons/images/browse.png:/icons/images/browse.png + @@ -466,6 +470,8 @@ Defines scan range for a <b>Constant Step Size</b> with the followin - + + + diff --git a/slsDetectorGui/forms/form_tab_advanced.ui b/slsDetectorGui/forms/form_tab_advanced.ui index f629631ec..60e3ed53a 100644 --- a/slsDetectorGui/forms/form_tab_advanced.ui +++ b/slsDetectorGui/forms/form_tab_advanced.ui @@ -31,6 +31,10 @@ Form + + + :/icons/images/refresh.png:/icons/images/refresh.png + true @@ -38,8 +42,8 @@ 25 - 90 - 721 + 100 + 726 226 @@ -63,7 +67,7 @@ 15 25 - 691 + 696 195 @@ -302,6 +306,10 @@ An extension given by the modules serial number will be attached. Browse + + + :/icons/images/browse.png:/icons/images/browse.png + @@ -320,7 +328,11 @@ An extension given by the modules serial number will be attached. - Start Trimming + Start Trimming + + + + :/icons/images/start.png:/icons/images/start.png @@ -540,70 +552,101 @@ An extension given by the modules serial number will be attached. - + 25 10 341 - 61 + 76 - Trimbits Plot Mode + Trimbits Plot + + + true - 15 - 20 - 311 - 31 + 120 + 22 + 211 + 44 - 34 + 17 - - - - 0 - 0 - + + + <nobr> +Updates plot with Trimbits from Shared Memory, not from Detector. +</nobr> + + + false - No Plot + Refresh - - true + + + :/icons/images/refresh.png:/icons/images/refresh.png + + + + 16 + 16 + - - - - 0 - 0 - + + + <nobr> +Plots Trimbits from Detector. This will take time. +</nobr> + + Get Trimbits + + + + :/icons/images/download.png:/icons/images/download.png + + + + + + + + + 15 + 20 + 101 + 46 + + + + + + + Histogram + + + + + Data Graph - - - - - - - 0 - 0 - - - - Histogram + + true @@ -615,56 +658,58 @@ An extension given by the modules serial number will be attached. 405 10 - 341 - 61 + 346 + 76 Calibration Logs - - - - 15 - 20 - 311 - 31 - + + + + + 420 + 37 + 313 + 31 + + + + + 42 - - - 42 - - - - - - 0 - 0 - - - - Energy Calibration - - - - - - - - 0 - 0 - - - - Angular Calibration - - - - - + + + + + 0 + 0 + + + + Energy Calibration + + + + + + + + 0 + 0 + + + + Angular Calibration + + + + - + + + diff --git a/slsDetectorGui/forms/form_tab_dataoutput.ui b/slsDetectorGui/forms/form_tab_dataoutput.ui index e2da366fb..104a296ee 100644 --- a/slsDetectorGui/forms/form_tab_dataoutput.ui +++ b/slsDetectorGui/forms/form_tab_dataoutput.ui @@ -234,6 +234,10 @@ Browse + + + :/icons/images/browse.png:/icons/images/browse.png + @@ -309,12 +313,18 @@ Browse + + + :/icons/images/browse.png:/icons/images/browse.png + - + + + diff --git a/slsDetectorGui/forms/form_tab_debugging.ui b/slsDetectorGui/forms/form_tab_debugging.ui index bd8703d92..4817294f8 100644 --- a/slsDetectorGui/forms/form_tab_debugging.ui +++ b/slsDetectorGui/forms/form_tab_debugging.ui @@ -87,6 +87,10 @@ Run + + + :/icons/images/start.png:/icons/images/start.png + @@ -145,6 +149,10 @@ Run + + + :/icons/images/start.png:/icons/images/start.png + @@ -234,11 +242,17 @@ Get Information + + + :/icons/images/download.png:/icons/images/download.png + - + + + diff --git a/slsDetectorGui/forms/form_tab_measurement.ui b/slsDetectorGui/forms/form_tab_measurement.ui index b9ea4b54d..4832f0138 100644 --- a/slsDetectorGui/forms/form_tab_measurement.ui +++ b/slsDetectorGui/forms/form_tab_measurement.ui @@ -157,6 +157,16 @@ Start + + + :/icons/images/start.png:/icons/images/start.png + + + true + + + false + @@ -930,6 +940,8 @@ p, li { white-space: pre-wrap; } - + + + diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index 12a77f896..3b8c0f53d 100644 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -377,7 +377,7 @@ - 30 + 18 20 @@ -409,7 +409,7 @@ - 18 + 15 20 @@ -495,7 +495,17 @@ Qt::NoFocus - Save + Save + + + + :/icons/images/save.png:/icons/images/save.png + + + + 16 + 16 + @@ -1315,7 +1325,7 @@ 10 15 - 336 + 331 31 @@ -1323,7 +1333,7 @@ - + 0 0 @@ -1369,7 +1379,11 @@ Qt::NoFocus - Create + Create + + + + :/icons/images/new.png:/icons/images/new.png false @@ -1379,7 +1393,7 @@ - + 0 0 @@ -1425,7 +1439,11 @@ Qt::NoFocus - Close All + Close All + + + + :/icons/images/close.png:/icons/images/close.png false @@ -1442,7 +1460,7 @@ - 40 + 20 20 @@ -1458,7 +1476,7 @@ - 40 + 20 20 @@ -1470,7 +1488,7 @@ true - + 0 0 @@ -1516,7 +1534,11 @@ Qt::NoFocus - Save All + Save All + + + + :/icons/images/saveAll.png:/icons/images/saveAll.png false @@ -1527,6 +1549,8 @@ - + + + diff --git a/slsDetectorGui/forms/form_tab_settings.ui b/slsDetectorGui/forms/form_tab_settings.ui index c95ddb9b2..e6419b58a 100644 --- a/slsDetectorGui/forms/form_tab_settings.ui +++ b/slsDetectorGui/forms/form_tab_settings.ui @@ -200,6 +200,8 @@ - + + + diff --git a/slsDetectorGui/include/icons.qrc b/slsDetectorGui/include/icons.qrc index 7ae9757eb..071da30c4 100644 --- a/slsDetectorGui/include/icons.qrc +++ b/slsDetectorGui/include/icons.qrc @@ -1,5 +1,17 @@ ../images/mountain.png + ../images/refresh.png + ../images/save.png + ../images/saveAll.png + ../images/close.png + ../images/add.png + ../images/new.png + ../images/download.png + ../images/browse.png + ../images/start.png + ../images/erase.png + ../images/remove.png + ../images/stop.png diff --git a/slsDetectorGui/include/qActionsWidget.h b/slsDetectorGui/include/qActionsWidget.h index 23ff9f3df..f10d02abf 100644 --- a/slsDetectorGui/include/qActionsWidget.h +++ b/slsDetectorGui/include/qActionsWidget.h @@ -35,6 +35,7 @@ public: /**to update the widgets*/ void Refresh(); + /**number of action widgets*/ static int NUM_ACTION_WIDGETS; @@ -46,7 +47,6 @@ private: /**id of the action widget*/ int id; - /** Sets up the widget */ void SetupWidgetWindow(); diff --git a/slsDetectorGui/include/qScanWidget.h b/slsDetectorGui/include/qScanWidget.h index 1aa7d632a..317d1e21c 100644 --- a/slsDetectorGui/include/qScanWidget.h +++ b/slsDetectorGui/include/qScanWidget.h @@ -35,6 +35,7 @@ public: /**to update the widgets*/ void Refresh(); + /**number of scan widgets*/ static int NUM_SCAN_WIDGETS; diff --git a/slsDetectorGui/include/qTabActions.h b/slsDetectorGui/include/qTabActions.h index 77ad9be44..0add44491 100644 --- a/slsDetectorGui/include/qTabActions.h +++ b/slsDetectorGui/include/qTabActions.h @@ -48,6 +48,7 @@ public: */ void Refresh(); + public slots: /** Disable Positions * @param enable true if to disable @@ -83,6 +84,7 @@ private: slsDetectorDefs::detectorType detType; + enum actionIndex{Scan0=1, Scan1, NumPositions=4, NumTotalActions=9}; QGridLayout *gridLayout; @@ -109,6 +111,8 @@ private: double *positions; QPalette normal; + QIcon *iconPlus; + QIcon *iconMinus; private slots: /** To Expand the Action Widget diff --git a/slsDetectorGui/include/qTabAdvanced.h b/slsDetectorGui/include/qTabAdvanced.h index 6621efa37..ec1afa5e7 100644 --- a/slsDetectorGui/include/qTabAdvanced.h +++ b/slsDetectorGui/include/qTabAdvanced.h @@ -90,6 +90,10 @@ private slots: */ void StartTrimming(); + /**Updates plot from shared memory + */ + void UpdatePlot(); + private: /** The sls detector object */ multiSlsDetector *myDet; diff --git a/slsDetectorGui/include/qTabDataOutput.h b/slsDetectorGui/include/qTabDataOutput.h index a0c3cb1f4..a0bee6f67 100644 --- a/slsDetectorGui/include/qTabDataOutput.h +++ b/slsDetectorGui/include/qTabDataOutput.h @@ -27,9 +27,8 @@ 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,multiSlsDetector*& detector,int detID); + qTabDataOutput(QWidget *parent,multiSlsDetector*& detector); /** Destructor */ @@ -45,9 +44,6 @@ private: /** The sls detector object */ multiSlsDetector *myDet; - /**detector id */ - int detID; - /** detector type */ slsDetectorDefs::detectorType detType; diff --git a/slsDetectorGui/include/qTabMeasurement.h b/slsDetectorGui/include/qTabMeasurement.h index eda4f5373..aa46f6477 100644 --- a/slsDetectorGui/include/qTabMeasurement.h +++ b/slsDetectorGui/include/qTabMeasurement.h @@ -173,7 +173,8 @@ private: QPalette red; /** expert mode */ bool expertMode; - + QIcon *iconStart; + QIcon *iconStop; signals: diff --git a/slsDetectorGui/include/qTabSettings.h b/slsDetectorGui/include/qTabSettings.h index 77d867180..e65c3e74a 100644 --- a/slsDetectorGui/include/qTabSettings.h +++ b/slsDetectorGui/include/qTabSettings.h @@ -26,9 +26,8 @@ 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 */ - qTabSettings(QWidget *parent,multiSlsDetector*& detector,int detID); + qTabSettings(QWidget *parent,multiSlsDetector*& detector); /** Destructor */ @@ -43,9 +42,6 @@ private: /** The sls detector object */ multiSlsDetector *myDet; - /**detector id */ - int detID; - /** detector type */ slsDetectorDefs::detectorType detType; diff --git a/slsDetectorGui/src/qActionsWidget.cpp b/slsDetectorGui/src/qActionsWidget.cpp index 7464227da..75a6d3b62 100644 --- a/slsDetectorGui/src/qActionsWidget.cpp +++ b/slsDetectorGui/src/qActionsWidget.cpp @@ -45,6 +45,7 @@ void qActionsWidget::SetupWidgetWindow(){ NUM_ACTION_WIDGETS++; setFixedHeight(25); + } diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 803d08b8e..16f876b13 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -99,10 +99,10 @@ void qDetectorMain::SetUpWidgetWindow(){ // creating all the tab widgets tab_messages = new qTabMessages (this, myDet); cout<<"Messages ready"<setContentsMargins(0, 0, 0, 0); comboCustom = new QComboBox(widgetCustom); - btnCustom = new QPushButton("Delete",widgetCustom); + btnCustom = new QPushButton("Delete ",widgetCustom); + btnCustom->setIcon(QIcon( ":/icons/images/close.png" )); comboCustom->setEditable(true); comboCustom->setCompleter(false); comboCustom->setValidator(new QDoubleValidator(comboCustom)); diff --git a/slsDetectorGui/src/qTabActions.cpp b/slsDetectorGui/src/qTabActions.cpp index daf760546..e16dc3eef 100644 --- a/slsDetectorGui/src/qTabActions.cpp +++ b/slsDetectorGui/src/qTabActions.cpp @@ -56,8 +56,13 @@ void qTabActions::SetupWidgetWindow(){ // Buttongroup to know which +/- button was clicked group = new QButtonGroup(this); + group->setExclusive(false); palette = new QPalette(); + QPalette p; + p.setColor(QPalette::Shadow,QColor(0,0,0,0)); + p.setColor(QPalette::Button,QColor(0,0,0,0)); + char names[NumTotalActions][200] = { "Action at Start", "Scan Level 0", @@ -70,15 +75,30 @@ void qTabActions::SetupWidgetWindow(){ "Action at Stop" }; + //creating the icons for the buttons + iconPlus = new QIcon(":/icons/images/add.png"); + iconMinus = new QIcon(":/icons/images/remove.png"); + + QString tip = "
Click on the \"+\" to Expand or \"-\" to Collapse."; + // For each level of Actions for(int i=0;isetFixedSize(20,20); - QString tip = "Click on the \"+\" to Expand or \"-\" to Collapse."; + btnExpand[i] = new QPushButton(); + lblName[i]->setToolTip(tip); + + btnExpand[i]->setCheckable(true); + btnExpand[i]->setChecked(false); + btnExpand[i]->setFixedSize(16,16); btnExpand[i]->setToolTip(tip); + btnExpand[i]->setIcon(*iconPlus); + btnExpand[i]->setFocusPolicy(Qt::NoFocus); + btnExpand[i]->setFlat(true); + btnExpand[i]->setIconSize(QSize(16,16)); + btnExpand[i]->setPalette(p); + group->addButton(btnExpand[i],i); //add the widgets to the layout , depending on the type create the widgets @@ -157,7 +177,9 @@ void qTabActions::CreatePositionsWidget(){ comboPos->setValidator(validate); layout->addWidget(comboPos,0,5); layout->addItem(new QSpacerItem(5,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,6); - btnDelete = new QPushButton("Delete"); + btnDelete = new QPushButton("Delete "); + btnDelete->setEnabled(false); + btnDelete->setIcon(QIcon( ":/icons/images/close.png" )); btnDelete->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); layout->addWidget(btnDelete,0,7); @@ -202,11 +224,12 @@ void qTabActions::Initialization(){ void qTabActions::Expand(QAbstractButton *button ){ int index = group->id(button); + // Collapse - if(!QString::compare(button->text(), "-")){ + if(!button->isChecked()){ palette->setColor(QPalette::WindowText,Qt::black); lblName[index]->setPalette(*palette); - button->setText("+"); + button->setIcon(*iconPlus); if(index==NumPositions) { positionWidget->hide(); @@ -234,9 +257,11 @@ void qTabActions::Expand(QAbstractButton *button ){ } }else{ // Expand + //always set title color to blue for expan\d palette->setColor(QPalette::WindowText,QColor(0,0,200,255)); lblName[index]->setPalette(*palette); - button->setText("-"); + button->setIcon(*iconMinus); + if(index==NumPositions){ positionWidget->show(); setFixedHeight(height()+30);//+80 if the checkboxes are included @@ -265,6 +290,7 @@ void qTabActions::SetPosition(){ comboPos->setMaxCount(numPos); comboPos->setEnabled(numPos); lblPosList->setEnabled(numPos); + btnDelete->setEnabled(numPos); //deleting too many or not entering enough if(numPos>comboPos->count()){ @@ -378,6 +404,7 @@ void qTabActions::Refresh(){ disconnect(comboPos,SIGNAL(currentIndexChanged(int)), this, SLOT(SetPosition())); comboPos->setEnabled(numPos); lblPosList->setEnabled(numPos); + btnDelete->setEnabled(numPos); lblPosList->setText("List of Positions: "); lblPosList->setPalette(normal); for(int i=0;icount();i++) diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp index 0b27e904b..39af2c33e 100644 --- a/slsDetectorGui/src/qTabAdvanced.cpp +++ b/slsDetectorGui/src/qTabAdvanced.cpp @@ -87,6 +87,9 @@ void qTabAdvanced::Initialization(){ //start Trimming connect(btnStart, SIGNAL(clicked()), this, SLOT(StartTrimming())); + //refresh + connect(btnRefresh, SIGNAL(clicked()), this, SLOT(UpdatePlot())); + } @@ -319,9 +322,6 @@ void qTabAdvanced::StartTrimming(){ break; } -#ifdef VERBOSE - -#endif //execute int ret = myDet->executeTrimming(trimmingMode,parameter1,parameter2,-1); if((ret!=slsDetectorDefs::FAIL)&&(ret!=-1)){ @@ -330,6 +330,8 @@ void qTabAdvanced::StartTrimming(){ if((ret!=slsDetectorDefs::FAIL)&&(ret!=-1)) qDefs::Message(qDefs::INFORMATION,"The Trimbits have been saved successfully.","Advanced"); else qDefs::Message(qDefs::WARNING,string("Could not Save the Trimbits to file:\n")+dispFile->text().toAscii().constData(),"Advanced"); + //updates plots + UpdatePlot(); } else qDefs::Message(qDefs::WARNING,"Atleast 1 channel could not be trimmed.","Advanced"); @@ -339,6 +341,16 @@ void qTabAdvanced::StartTrimming(){ //------------------------------------------------------------------------------------------------------------------------------------------------- +void qTabAdvanced::UpdatePlot(){ +#ifdef VERBOSE + cout << "Updating Plot" << endl; +#endif + +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + void qTabAdvanced::Refresh(){ //disconnect disconnect(chkEnergyLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs())); diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index fbe623c51..fee9b331e 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -25,8 +25,9 @@ using namespace std; //------------------------------------------------------------------------------------------------------------------------------------------------- -qTabDataOutput::qTabDataOutput(QWidget *parent,multiSlsDetector*& detector,int detID): - QWidget(parent),myDet(detector),detID(detID){ + +qTabDataOutput::qTabDataOutput(QWidget *parent,multiSlsDetector*& detector): + QWidget(parent),myDet(detector){ setupUi(this); SetupWidgetWindow(); Initialization(); @@ -241,7 +242,7 @@ void qTabDataOutput::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); @@ -251,14 +252,14 @@ void qTabDataOutput::SetRateCorrection(){ //auto if(radioAuto->isChecked()){ spinDeadTime->setEnabled(false); - s->setRateCorrection(-1); + myDet->setRateCorrection(-1); #ifdef VERBOSE cout << "Setting rate corrections with default dead time" << endl; #endif }//custom dead time else{ spinDeadTime->setEnabled(true); - s->setRateCorrection((double)spinDeadTime->value()); + myDet->setRateCorrection((double)spinDeadTime->value()); #ifdef VERBOSE cout << "Setting rate corrections with dead time "<< spinDeadTime->value() << endl; #endif @@ -270,7 +271,7 @@ void qTabDataOutput::SetRateCorrection(){ spinDeadTime->setEnabled(false); //Unsetting rate correction - s->setRateCorrection(0); + myDet->setRateCorrection(0); #ifdef VERBOSE cout << "Unsetting rate correction" << endl; #endif @@ -291,8 +292,7 @@ void qTabDataOutput::UpdateRateCorrectionFromServer(){ disconnect(spinDeadTime, SIGNAL(valueChanged(double)), this, SLOT(SetRateCorrection())); double rate; - slsDetector *s = myDet->getSlsDetector(detID); - rate = (double)s->getRateCorrectionTau(); + rate = (double)myDet->getRateCorrectionTau(); #ifdef VERBOSE cout << "Getting rate correction from server:" << rate << " : "; #endif diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index ec5dce44a..3e6b30b2f 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -81,6 +81,11 @@ void qTabMeasurement::SetupWidgetWindow(){ //file write enabled/disabled chkFile->setChecked(myDet->enableWriteToFile()); + + //creating the icons for the buttons + iconStart = new QIcon(":/icons/images/start.png"); + iconStop = new QIcon(":/icons/images/stop.png"); + } @@ -278,12 +283,13 @@ void qTabMeasurement::setRunIndex(int index){ void qTabMeasurement::startStopAcquisition(){ - if(!btnStartStop->text().compare("Start")){ + if(btnStartStop->isChecked()){ #ifdef VERBOSE cout << endl << endl << "Starting Acquisition" << endl; #endif //btnStartStop->setStyleSheet("color:red"); btnStartStop->setText("Stop"); + btnStartStop->setIcon(*iconStop); Enable(0); progressBar->setValue(0); //the progress which keeps adding up for all the measurements @@ -301,6 +307,8 @@ void qTabMeasurement::startStopAcquisition(){ //btnStartStop->setStyleSheet("background:rgb(239,239,239)"); progressTimer->stop(); btnStartStop->setText("Start"); + btnStartStop->setIcon(*iconStart); + btnStartStop->setChecked(false); Enable(1); emit StopSignal(); } @@ -313,6 +321,8 @@ void qTabMeasurement::startStopAcquisition(){ void qTabMeasurement::UpdateFinished(){ disconnect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); btnStartStop->setText("Start"); + btnStartStop->setIcon(*iconStart); + btnStartStop->setChecked(false); //btnStartStop->setStyleSheet("color:green"); //btnStartStop->setStyleSheet("background:rgb(239,239,239)"); Enable(1); diff --git a/slsDetectorGui/src/qTabMessages.cpp b/slsDetectorGui/src/qTabMessages.cpp index 3b50e616c..fc7836462 100644 --- a/slsDetectorGui/src/qTabMessages.cpp +++ b/slsDetectorGui/src/qTabMessages.cpp @@ -16,7 +16,6 @@ #include #include #include -#include /** C++ Include Headers */ #include #include @@ -47,15 +46,16 @@ void qTabMessages::SetupWidgetWindow(){ dispLog->setFocusPolicy(Qt::NoFocus); dispLog->setTextColor(Qt::darkBlue); - QSizePolicy sizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); - btnSave = new QPushButton("Save Log",this); + btnSave = new QPushButton("Save Log ",this); btnSave->setFocusPolicy(Qt::NoFocus); - btnSave->setSizePolicy(sizePolicy); + btnSave->setFixedWidth(100); + btnSave->setIcon(QIcon( ":/icons/images/save.png" )); - btnClear = new QPushButton("Clear",this); + btnClear = new QPushButton("Clear ",this); btnClear->setFocusPolicy(Qt::NoFocus); - btnClear->setSizePolicy(sizePolicy); + btnClear->setFixedWidth(100); + btnClear->setIcon(QIcon( ":/icons/images/erase.png" )); gridLayout->addWidget(btnSave,0,0,1,1); gridLayout->addWidget(btnClear,0,4,1,1); diff --git a/slsDetectorGui/src/qTabSettings.cpp b/slsDetectorGui/src/qTabSettings.cpp index 99475afa6..eadf9cc17 100644 --- a/slsDetectorGui/src/qTabSettings.cpp +++ b/slsDetectorGui/src/qTabSettings.cpp @@ -17,8 +17,8 @@ using namespace std; //------------------------------------------------------------------------------------------------------------------------------------------------- -qTabSettings::qTabSettings(QWidget *parent,multiSlsDetector*& detector,int detID): - QWidget(parent),myDet(detector),detID(detID){ +qTabSettings::qTabSettings(QWidget *parent,multiSlsDetector*& detector): + QWidget(parent),myDet(detector){ setupUi(this); SetupWidgetWindow(); @@ -40,7 +40,7 @@ void qTabSettings::SetupWidgetWindow(){ // Settings SetupDetectorSettings(); - comboSettings->setCurrentIndex(myDet->getSettings(detID)); + comboSettings->setCurrentIndex(myDet->getSettings()); //threshold spinThreshold->setValue(myDet->getThresholdEnergy()); @@ -68,7 +68,7 @@ void qTabSettings::SetupWidgetWindow(){ void qTabSettings::SetupDetectorSettings(){ // Get detector settings from detector - slsDetectorDefs::detectorSettings sett = myDet->getSettings(detID); + slsDetectorDefs::detectorSettings sett = myDet->getSettings(); // To be able to index items on a combo box model = qobject_cast(comboSettings->model()); @@ -163,7 +163,7 @@ void qTabSettings::setSettings(int index){ if(index!=(int)Uninitialized) item[(int)Uninitialized]->setEnabled(false); } - slsDetectorDefs::detectorSettings sett = myDet->setSettings((slsDetectorDefs::detectorSettings)index,detID); + slsDetectorDefs::detectorSettings sett = myDet->setSettings((slsDetectorDefs::detectorSettings)index); #ifdef VERBOSE cout << "Settings have been set to " << myDet->slsDetectorBase::getDetectorSettings(sett) << endl; #endif @@ -256,7 +256,7 @@ void qTabSettings::SetEnergy(){ void qTabSettings::Refresh(){ // Settings SetupDetectorSettings(); - comboSettings->setCurrentIndex(myDet->getSettings(detID)); + comboSettings->setCurrentIndex(myDet->getSettings()); // Number of Modules spinNumModules->setValue(myDet->setNumberOfModules()); From b85e03adfd19d5c87ecbcece52fb93392a08f8ba Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 7 Sep 2012 16:33:24 +0000 Subject: [PATCH 053/332] included images git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@53 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qDetectorMain.cpp | 1 + slsDetectorGui/src/qTabMeasurement.cpp | 4 ---- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 16f876b13..8102f03fe 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -176,6 +176,7 @@ void qDetectorMain::SetUpDetector(){ //instantiate detector and set window title myDet = new multiSlsDetector(detID); string host = myDet->getHostname(detID); + cout<<"online:"<setOnline();<getSlsDetector(detID); //if hostname doesnt exist even in shared memory if(!host.length()){ diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 3e6b30b2f..cd0a7b43d 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -303,8 +303,6 @@ void qTabMeasurement::startStopAcquisition(){ cout << "Stopping Acquisition" << endl<< endl; #endif myDet->stopAcquisition(); - //btnStartStop->setStyleSheet("color:green"); - //btnStartStop->setStyleSheet("background:rgb(239,239,239)"); progressTimer->stop(); btnStartStop->setText("Start"); btnStartStop->setIcon(*iconStart); @@ -323,8 +321,6 @@ void qTabMeasurement::UpdateFinished(){ btnStartStop->setText("Start"); btnStartStop->setIcon(*iconStart); btnStartStop->setChecked(false); - //btnStartStop->setStyleSheet("color:green"); - //btnStartStop->setStyleSheet("background:rgb(239,239,239)"); Enable(1); connect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); UpdateProgress(); From f7078c37004a9a3a7e9d7eb5014dc30d94fe23fb Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Mon, 10 Sep 2012 17:55:44 +0000 Subject: [PATCH 054/332] updated number of measurements to be taken from the detector class git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@54 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qDrawPlot.h | 9 +- slsDetectorGui/include/qTabMeasurement.h | 4 +- slsDetectorGui/src/qDetectorMain.cpp | 67 +++--- slsDetectorGui/src/qDrawPlot.cpp | 259 +++++++++++++---------- slsDetectorGui/src/qTabAdvanced.cpp | 20 ++ slsDetectorGui/src/qTabDataOutput.cpp | 2 +- slsDetectorGui/src/qTabMeasurement.cpp | 58 +++-- 7 files changed, 253 insertions(+), 166 deletions(-) diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index f16c63eeb..5872fed19 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -94,9 +94,6 @@ public: * @param stop_if_running is 0 to stop acquisition and 1 to start acquisition */ void StartStopDaqToggle(bool stop_if_running=0); - /** Set number of measurements - * @param num number of measurements to be set */ - void setNumMeasurements(int num){number_of_measurements = num;}; /** Set frame enabled * @param enable enable*/ void setFrameEnabled(bool enable){isFrameEnabled = enable;}; @@ -168,6 +165,8 @@ int StartDaqForGui() {return StartOrStopThread(1) ? 1:0;} int StopDaqForGui() {return StartOrStopThread(0) ? 0:1;} /** Starts/stops Acquisition Thread */ bool StartOrStopThread(bool start); +/** Sets up measurement each time */ +void SetupMeasurement(); /** Resets the acquisition parameter like lastimagenumber */ int ResetDaqForGui(); /** The function which is called when start acquisition thread is created */ @@ -252,8 +251,6 @@ SlsQt2DPlotLayout* plot2D; QVector plot1D_hists; -/** Number of Measurements */ -int number_of_measurements; /** Current Measurement */ int currentMeasurement; /** currentFrame */ @@ -391,6 +388,8 @@ int scanArgument; /** enable angle plot */ bool anglePlot; +/** prevents err msg displaying twice when detector stopped, "transmitting" */ +bool alreadyDisplayed; diff --git a/slsDetectorGui/include/qTabMeasurement.h b/slsDetectorGui/include/qTabMeasurement.h index aa46f6477..10497eab9 100644 --- a/slsDetectorGui/include/qTabMeasurement.h +++ b/slsDetectorGui/include/qTabMeasurement.h @@ -43,7 +43,7 @@ public: /** To enable expert mode * @param enable to enable if true */ - void SetExpertMode(bool enable){expertMode = enable;SetupTimingMode();}; + void SetExpertMode(bool enable); @@ -163,8 +163,6 @@ private: enum{None, Auto, Trigger_Exp_Series, Trigger_Frame, Trigger_Readout, Gated, Gated_Start, Trigger_Window, NumTimingModes}; /** timer to update the progress*/ QTimer *progressTimer; - /** number of measurements*/ - int numMeasurement; /** current measurement */ int currentMeasurement; /** tool tip variables*/ diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 8102f03fe..9ca9110d9 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -174,47 +174,48 @@ void qDetectorMain::SetUpDetector(){ //instantiate detector and set window title - myDet = new multiSlsDetector(detID); - string host = myDet->getHostname(detID); - cout<<"online:"<setOnline();<getSlsDetector(detID); + myDet = new multiSlsDetector(); + string host = myDet->getHostname(); + //if hostname doesnt exist even in shared memory if(!host.length()){ #ifdef VERBOSE - cout << endl << "No Detector Connected at id:" << detID << endl; + cout << endl << "No Detector Connected." << endl; #endif - char cIndex[10]; - sprintf(cIndex,"%d",detID); - qDefs::Message(qDefs::CRITICAL,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::Message(qDefs::CRITICAL,string("The detector ")+host+string(" is not connected. Exiting GUI."),"Main"); - cout << "The detector " << host << "is not connected. Exiting GUI." << endl; + qDefs::Message(qDefs::CRITICAL,"No Detectors Connected. ","Main"); exit(-1); } - else{ - slsDetectorDefs::detectorType detType = myDet->getDetectorsType(); - // Check if type valid. If not, exit - switch(detType){//digitalDetector decides if trimbits should be shown - case slsDetectorDefs::MYTHEN: digitalDetector = true; break; - case slsDetectorDefs::EIGER: digitalDetector = true; break; - case slsDetectorDefs::GOTTHARD: digitalDetector = false;break; - case slsDetectorDefs::AGIPD: digitalDetector = false;break; - default: - string detName = myDet->slsDetectorBase::getDetectorType(detType); - string errorMess = host+string(" has unknown detector type \"")+ - detName+string("\". Exiting GUI."); - qDefs::Message(qDefs::CRITICAL,errorMess,"Main"); - exit(-1); - } - setWindowTitle("SLS Detector GUI : "+ - QString(slsDetectorBase::getDetectorType(detType).c_str())+ " - "+QString(host.c_str())); + + //check if the detector is not even connected + string offline = myDet->checkOnline(); + if(!offline.empty()){ + qDefs::Message(qDefs::CRITICAL,string("The detector(s) ")+offline+string(" is/are not connected. Exiting GUI."),"Main"); + cout << "The detector(s) " << host << " is/are not connected. Exiting GUI." << endl; + exit(-1); + } + + // Check if type valid. If not, exit + slsDetectorDefs::detectorType detType = myDet->getDetectorsType(); + switch(detType){ + //digitalDetector decides if trimbits should be shown + case slsDetectorDefs::MYTHEN: digitalDetector = true; break; + case slsDetectorDefs::EIGER: digitalDetector = true; break; + case slsDetectorDefs::GOTTHARD: digitalDetector = false;break; + case slsDetectorDefs::AGIPD: digitalDetector = false;break; + default: + string detName = myDet->slsDetectorBase::getDetectorType(detType); + string errorMess = host+string(" has unknown detector type \"")+ + detName+string("\". Exiting GUI."); + qDefs::Message(qDefs::CRITICAL,errorMess,"Main"); + exit(-1); + } + setWindowTitle("SLS Detector GUI : "+ + QString(slsDetectorBase::getDetectorType(detType).c_str())+ " - "+QString(host.c_str())); #ifdef VERBOSE - cout << endl << "Type : " << slsDetectorBase::getDetectorType(detType) << "\nDetector : " << host << endl; + cout << endl << "Type : " << slsDetectorBase::getDetectorType(detType) << "\nDetector : " << host << endl; #endif - myDet->setOnline(slsDetectorDefs::ONLINE_FLAG); - } + myDet->setOnline(slsDetectorDefs::ONLINE_FLAG); + } diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 52e271f96..c468f506b 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -28,6 +28,7 @@ using namespace std; //------------------------------------------------------------------------------------------------------------------------------------------------- + qDrawPlot::qDrawPlot(QWidget *parent,multiSlsDetector*& detector): QWidget(parent),myDet(detector){ SetupWidgetWindow(); @@ -35,8 +36,10 @@ qDrawPlot::qDrawPlot(QWidget *parent,multiSlsDetector*& detector): StartStopDaqToggle(); //as default } + //------------------------------------------------------------------------------------------------------------------------------------------------- + qDrawPlot::~qDrawPlot(){ // Clear plot Clear1DPlot(); @@ -48,13 +51,14 @@ qDrawPlot::~qDrawPlot(){ for(int i=0;isetTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,-1); // Reset Current Measurement currentMeasurement = 0; emit SetCurrentMeasurementSignal(currentMeasurement); + //to get the first image data_pause_over = true; - + //in case of error message + alreadyDisplayed = false; // Number of Exposures int numFrames = (isFrameEnabled)*((int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1)); @@ -245,8 +258,10 @@ void qDrawPlot::StartStopDaqToggle(bool stop_if_running){ } } + //------------------------------------------------------------------------------------------------------------------------------------------------- + void qDrawPlot::StartDaq(bool start){ if(start){ #ifdef VERBOSE @@ -264,8 +279,10 @@ void qDrawPlot::StartDaq(bool start){ } } + //------------------------------------------------------------------------------------------------------------------------------------------------- + int qDrawPlot::ResetDaqForGui(){ if(!StopDaqForGui()) return 0; cout << "Resetting image number" << endl; @@ -273,8 +290,10 @@ int qDrawPlot::ResetDaqForGui(){ return 1; } + //------------------------------------------------------------------------------------------------------------------------------------------------- + bool qDrawPlot::StartOrStopThread(bool start){ static bool firstTime = true; static bool gui_acquisition_thread_running = 0; @@ -291,92 +310,9 @@ bool qDrawPlot::StartOrStopThread(bool start){ //start part if(start){ - if(myDet->getRunStatus()==slsDetectorDefs::IDLE) - cout<getRunStatus()<getFileIndex(); - currentScanValue = 0; - currentScanDivLevel = 0; - - - if(scanArgument!=None){ - if(scanArgument==AllFrames){ - maxPixelsY = currentIndex + number_of_exposures - 1; - minPixelsY = currentIndex; - nPixelsY = number_of_exposures; - }else if(scanArgument==FileIndex){ - maxPixelsY = currentIndex + number_of_frames - 1; - minPixelsY = currentIndex; - nPixelsY = number_of_frames; - }else if(scanArgument==Level0){ - //no need to check if numsteps=0,cuz otherwise this mode wont be set in plot tab - int numSteps = myDet->getScanSteps(0); - double *values = new double[numSteps]; - myDet->getScanSteps(0,values); - - maxPixelsY = values[numSteps-1]; - minPixelsY = values[0]; - nPixelsY = numSteps; - currentScanValue = values[0]; - } - else { - //no need to check if numsteps=0,cuz otherwise this mode wont be set in plot tab - int numSteps = myDet->getScanSteps(1); - double *values = new double[numSteps]; - myDet->getScanSteps(1,values); - - maxPixelsY = values[numSteps-1]; - minPixelsY = values[0]; - nPixelsY = numSteps; - currentScanValue = values[0]; - } - pixelWidth = (maxPixelsY -minPixelsY)/(nPixelsY-1); - startPixel = minPixelsY -(pixelWidth/2); - endPixel = maxPixelsY + (pixelWidth/2); - }else{//no scan - nPixelsY = 100;//number_of_exposures; - maxPixelsY = 100; - minPixelsY = 0; - startPixel = -0.5; - endPixel = nPixelsY-0.5; - } - cout<<"nPixelsY:"<getRunStatus()==slsDetectorDefs::IDLE) + cout<getRunStatus()<getFileIndex(); + currentScanValue = 0; + currentScanDivLevel = 0; + + + if(scanArgument!=None){ + if(scanArgument==AllFrames){ + maxPixelsY = currentIndex + number_of_exposures - 1; + minPixelsY = currentIndex; + nPixelsY = number_of_exposures; + }else if(scanArgument==FileIndex){ + maxPixelsY = currentIndex + number_of_frames - 1; + minPixelsY = currentIndex; + nPixelsY = number_of_frames; + }else if(scanArgument==Level0){ + //no need to check if numsteps=0,cuz otherwise this mode wont be set in plot tab + int numSteps = myDet->getScanSteps(0); + double *values = new double[numSteps]; + myDet->getScanSteps(0,values); + + maxPixelsY = values[numSteps-1]; + minPixelsY = values[0]; + nPixelsY = numSteps; + currentScanValue = values[0]; + } + else { + //no need to check if numsteps=0,cuz otherwise this mode wont be set in plot tab + int numSteps = myDet->getScanSteps(1); + double *values = new double[numSteps]; + myDet->getScanSteps(1,values); + + maxPixelsY = values[numSteps-1]; + minPixelsY = values[0]; + nPixelsY = numSteps; + currentScanValue = values[0]; + } + pixelWidth = (maxPixelsY -minPixelsY)/(nPixelsY-1); + startPixel = minPixelsY -(pixelWidth/2); + endPixel = maxPixelsY + (pixelWidth/2); + }else{//no scan + nPixelsY = 100;//number_of_exposures; + maxPixelsY = 100; + minPixelsY = 0; + startPixel = -0.5; + endPixel = nPixelsY-0.5; + } + cout<<"nPixelsY:"<myDet->acquire(1); @@ -406,19 +435,24 @@ void* qDrawPlot::DataStartAcquireThread(void *this_pointer){ return this_pointer; } + //------------------------------------------------------------------------------------------------------------------------------------------------- + int qDrawPlot::GetDataCallBack(detectorData *data, void *this_pointer){ ((qDrawPlot*)this_pointer)->GetData(data); return 0; } + //------------------------------------------------------------------------------------------------------------------------------------------------- + int qDrawPlot::GetData(detectorData *data){ #ifdef VERYVERBOSE cout << "Entering GetDatafunction" << endl; #endif + cout<<"progress:"<<(int)data->progressIndex<getRunStatus(); - string status = slsDetectorBase::runStatusType(slsDetectorDefs::runStatus(detStatus)); - qDefs::Message(qDefs::WARNING,string("The acquisiton has ended abruptly. Current Detector Status: ")+status+string("."),"Dock"); + if(!alreadyDisplayed){ + alreadyDisplayed = true; + int detStatus = (int)myDet->getRunStatus(); + string status = slsDetectorBase::runStatusType(slsDetectorDefs::runStatus(detStatus)); + qDefs::Message(qDefs::WARNING,string("The acquisiton has ended abruptly. Current Detector Status: ")+status+string("."),"Dock"); + } } + //------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp index 39af2c33e..9bc2c7081 100644 --- a/slsDetectorGui/src/qTabAdvanced.cpp +++ b/slsDetectorGui/src/qTabAdvanced.cpp @@ -346,6 +346,26 @@ void qTabAdvanced::UpdatePlot(){ cout << "Updating Plot" << endl; #endif + int nPixelsX = myDet->getTotalNumberOfChannels(); + + int *histXAxis = new int[nPixelsX]; + int *histYAxis = new int[100]; + for(int i=0;igetNumberOfDetectors();det++){ + slsDetector *s = myDet->getSlsDetector(det); + channelsPerDetector=s->getTotalNumberOfChannels(); + if(s->chanregs){ + for(int i=0;ichanregs,channelsPerDetector*sizeof(int)); + } + } + } +*/ + cout<<"histyaxis[500]:"<getDetectorsType(); diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index cd0a7b43d..c1a129a4b 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -48,7 +48,7 @@ qTabMeasurement::~qTabMeasurement(){ void qTabMeasurement::SetupWidgetWindow(){ //Number of measurements - numMeasurement=1; + spinNumMeasurements->setValue((int)myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,-1)); //Timer to update the progress bar progressTimer = new QTimer(this); @@ -66,6 +66,7 @@ void qTabMeasurement::SetupWidgetWindow(){ " #period#

")+ QString("Acquisition Period should be" " greater than or equal to Exposure Time."); + //File Name dispFileName->setText(QString(myDet->getFileName().c_str())); //File Index @@ -92,6 +93,24 @@ void qTabMeasurement::SetupWidgetWindow(){ //------------------------------------------------------------------------------------------------------------------------------------------------- +void qTabMeasurement::SetExpertMode(bool enable){ + expertMode = enable; + lblNumProbes->setEnabled(enable); + spinNumProbes->setEnabled(enable); + //Number of Probes + if((enable)&&(myDet->getDetectorsType()==slsDetectorDefs::MYTHEN)){ + int val = (int)myDet->setTimer(slsDetectorDefs::PROBES_NUMBER,-1); + spinNumProbes->setValue(val); +#ifdef VERBOSE + cout << "Getting number of probes : " << val << endl; +#endif + } +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + void qTabMeasurement::SetupTimingMode(){ //Get timing mode from detector slsDetectorDefs::externalCommunicationMode mode = myDet->setExternalCommunicationMode(); @@ -251,16 +270,6 @@ void qTabMeasurement::Enable(bool enable){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void qTabMeasurement::setNumMeasurements(int val){ -#ifdef VERBOSE - cout << "Setting Number of Measurements to " << val << endl; -#endif - numMeasurement = val; - myPlot->setNumMeasurements(val); -} -//------------------------------------------------------------------------------------------------------------------------------------------------- - - void qTabMeasurement::setFileName(const QString& fName){ myDet->setFileName(fName.toAscii().data()); #ifdef VERBOSE @@ -302,13 +311,13 @@ void qTabMeasurement::startStopAcquisition(){ #ifdef VERBOSE cout << "Stopping Acquisition" << endl<< endl; #endif + emit StopSignal(); myDet->stopAcquisition(); progressTimer->stop(); btnStartStop->setText("Start"); btnStartStop->setIcon(*iconStart); btnStartStop->setChecked(false); Enable(1); - emit StopSignal(); } } @@ -342,7 +351,8 @@ void qTabMeasurement::SetCurrentMeasurement(int val){ void qTabMeasurement::UpdateProgress(){ - progressBar->setValue((int)(((currentMeasurement*100)+(myPlot->GetProgress()))/numMeasurement)); + //progressBar->setValue((int)(((currentMeasurement*100)+(myPlot->GetProgress()))/spinNumMeasurements->value())); + progressBar->setValue((int)myPlot->GetProgress()); lblProgressIndex->setText(QString::number(myDet->getFileIndex())); } @@ -350,12 +360,22 @@ void qTabMeasurement::UpdateProgress(){ //------------------------------------------------------------------------------------------------------------------------------------------------- +void qTabMeasurement::setNumMeasurements(int val){ + myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,val); +#ifdef VERBOSE + cout << "Setting Number of Measurements to " << (int)myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,-1) << endl; +#endif +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + void qTabMeasurement::setNumFrames(int val){ myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,val); #ifdef VERBOSE cout << "Setting number of frames to " << (int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1) << endl; #endif - } @@ -567,12 +587,12 @@ void qTabMeasurement::SetTimingMode(int mode){ } - if(mode!=None){//Number of Probes - if((myDet->getDetectorsType()==slsDetectorDefs::MYTHEN)&&(expertMode)){ - lblNumProbes->setEnabled(true); spinNumProbes->setEnabled(true); - } + //Number of Probes + if((expertMode)&&(myDet->getDetectorsType()==slsDetectorDefs::MYTHEN)){ + lblNumProbes->setEnabled(true); spinNumProbes->setEnabled(true); } + //To disconnect all the signals before changing their values DeInitialization(); @@ -703,6 +723,8 @@ void qTabMeasurement::EnableFileWrite(bool enable){ void qTabMeasurement::Refresh(){ + //Number of measurements + spinNumMeasurements->setValue((int)myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,-1)); //File Name dispFileName->setText(QString(myDet->getFileName().c_str())); //File Index From 62b14f41993be97b5135c37400fdbb35a86a323e Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 12 Sep 2012 15:44:23 +0000 Subject: [PATCH 055/332] fixed gettrimbits, histogram(still more),start stop,scans,not accessign shared memory duign acquisition git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@55 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_advanced.ui | 13 +- slsDetectorGui/include/qDrawPlot.h | 80 +++- slsDetectorGui/include/qTabAdvanced.h | 13 +- slsDetectorGui/include/qTabDataOutput.h | 3 +- slsDetectorGui/include/qTabPlot.h | 9 +- slsDetectorGui/include/qTabSettings.h | 15 +- slsDetectorGui/src/qActionsWidget.cpp | 2 +- slsDetectorGui/src/qDetectorMain.cpp | 32 +- slsDetectorGui/src/qDrawPlot.cpp | 473 ++++++++++++++++------ slsDetectorGui/src/qScanWidget.cpp | 2 +- slsDetectorGui/src/qTabActions.cpp | 19 +- slsDetectorGui/src/qTabAdvanced.cpp | 45 +- slsDetectorGui/src/qTabDataOutput.cpp | 15 +- slsDetectorGui/src/qTabMeasurement.cpp | 47 ++- slsDetectorGui/src/qTabPlot.cpp | 15 +- slsDetectorGui/src/qTabSettings.cpp | 14 +- 16 files changed, 575 insertions(+), 222 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_advanced.ui b/slsDetectorGui/forms/form_tab_advanced.ui index 60e3ed53a..1478fff63 100644 --- a/slsDetectorGui/forms/form_tab_advanced.ui +++ b/slsDetectorGui/forms/form_tab_advanced.ui @@ -60,7 +60,7 @@ true - true + false @@ -120,7 +120,7 @@ - true + false @@ -167,7 +167,7 @@ - true + false @@ -339,7 +339,7 @@ An extension given by the modules serial number will be attached. - true + false @@ -402,7 +402,7 @@ An extension given by the modules serial number will be attached. - true + false @@ -567,6 +567,9 @@ An extension given by the modules serial number will be attached. true + + false + diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index 5872fed19..307978cd4 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -101,6 +101,12 @@ public: * @param enable enable */ void setTriggerEnabled(bool enable){isTriggerEnabled = enable;}; + /** Updates the trimbit plot + * @param fromDetector is true if the trimbits should be loaded from detector + * @param Histogram true if histogram, else data graph + * returns ok/fail + * */ + int UpdateTrimbitPlot(bool fromDetector,bool Histogram); @@ -110,7 +116,7 @@ public slots: @param i is 1 for 1D, else 2D plot */ void SelectPlot(int i=2); /** To select 1D plot */ -void Select1DPlot() {SelectPlot(1);} +void Select1DPlot() {Clear1DPlot();SelectPlot(1);} /** To select 2D plot */ void Select2DPlot() {SelectPlot(2);} /** To clear plot */ @@ -124,7 +130,7 @@ void SaveClones(); /** To Save plot */ void SavePlot(); /** Save all plots **/ -void SaveAll(bool enable); +void SaveAll(bool enable){saveAll = enable;}; /** Sets persistency from plot tab */ void SetPersistency(int val); /** sets style of plot to lines*/ @@ -132,7 +138,7 @@ void SetLines(bool enable){lines = enable;}; /** sets markers */ void SetMarkers(bool enable){markers = enable;}; /** sets the scan argument to prepare the plot*/ -void SetScanArgument(int scanArg){scanArgument = scanArg;}; +void SetScanArgument(int scanArg); /** sets stop_signal to true */ void StopAcquisition(){ stop_signal = true; }; @@ -140,6 +146,7 @@ void StopAcquisition(){ stop_signal = true; }; + private: /** Initializes all its members and the thread */ void Initialization(); @@ -163,29 +170,53 @@ int UnlockLastImageArray() {return pthread_mutex_unlock(&last_image_complete int StartDaqForGui() {return StartOrStopThread(1) ? 1:0;} /** Stops the acquisition */ int StopDaqForGui() {return StartOrStopThread(0) ? 0:1;} + /** Starts/stops Acquisition Thread */ bool StartOrStopThread(bool start); -/** Sets up measurement each time */ -void SetupMeasurement(); + +/** Sets up measurement each time + * @param currentIndex file index given by detector class + * */ +void SetupMeasurement(int currentIndex); + /** Resets the acquisition parameter like lastimagenumber */ int ResetDaqForGui(); + /** The function which is called when start acquisition thread is created */ static void* DataStartAcquireThread(void *this_pointer); + /** This is called by the detector class to copy the data it jus acquired */ static int GetDataCallBack(detectorData *data, void *this_pointer); + /** This is called by the GetDataCallBack function to copy the data */ int GetData(detectorData *data); + /** This is called by detector class when acquisition is finished * @param currentProgress current progress of measurement * @param detectorStatus current status of the detector * @param this_pointer is the pointer pointing to this object * */ static int GetAcquisitionFinishedCallBack(double currentProgress,int detectorStatus, void *this_pointer); -/** This is called by detector class when acquisition is finished + +/** This is called by static function when acquisition is finished * @param currentProgress current progress of measurement * @param detectorStatus current status of the detector * */ int AcquisitionFinished(double currentProgress,int detectorStatus); + +/** This is called by detector class when a measurement is finished + * @param currentMeasurementIndex current measurement index + * @param fileIndex current file index + * @param this_pointer is the pointer pointing to this object + * */ +static int GetMeasurementFinishedCallBack(int currentMeasurementIndex, int fileIndex, void *this_pointer); + +/** This is called by the static function when meausrement is finished + * @param currentMeasurementIndex current measurement index + * @param fileIndex current file index + * */ +int MeasurementFinished(int currentMeasurementIndex, int fileIndex); + /** Saves all the plots. All sets saveError to true if not saved.*/ void SavePlotAutomatic(); /** Sets the style of the 1d plot */ @@ -199,24 +230,32 @@ void SetStyle(SlsQtH1D* h){ private slots: -/** To update plot */ +/** To update plot + * */ void UpdatePlot(); -/** To stop updating plot */ +/** To stop updating plot + * */ void StopUpdatePlot(); /** To start or stop acquisition - * @param start is 1 to start and 0 to stop acquisition */ + * @param start is 1 to start and 0 to stop acquisition + * */ void StartDaq(bool start); /** To set the reference to zero after closing a clone - * @param id is the id of the clone */ + * @param id is the id of the clone + * */ void CloneCloseEvent(int id); /**After a pause, the gui is allowed to collect the data - * this is called when it is over */ + * this is called when it is over + * */ void UpdatePause(){data_pause_over=true;}; /** Shows the first save error message while automatic saving - * @param fileName file name of the first file that it tried to save.*/ + * @param fileName file name of the first file that it tried to save. + * */ void ShowSaveErrorMessage(QString fileName); -/**Shows an error message when acquisition stopped unexpectedly*/ -void ShowAcquisitionErrorMessage(); +/**Shows an error message when acquisition stopped unexpectedly + * @param status is the status of the detector + * */ +void ShowAcquisitionErrorMessage(QString status); private: @@ -330,10 +369,6 @@ double* histXAngleAxis; double* histYAngleAxis; /** Current Image Values in 2D */ double* lastImageArray; -/** temporary Y Axis value in 1D */ -double* yvalues[MAX_1DPLOTS]; -/** temporary Image Values in 2D */ -double* image_data; /**persistency to be reached*/ int persistency; @@ -391,6 +426,13 @@ bool anglePlot; /** prevents err msg displaying twice when detector stopped, "transmitting" */ bool alreadyDisplayed; +/**saves the file path and file name, not to access shared memory while running*/ +QString filePath; +QString fileName; + +/** Max Number of Clone Windows */ +static const int TRIM_HISTOGRAM_XMAX = 600; + signals: @@ -402,7 +444,7 @@ void SetZRangeSignal(double,double); void EnableZRangeSignal(bool); void SetCurrentMeasurementSignal(int); void saveErrorSignal(QString); -void AcquisitionErrorSignal(); +void AcquisitionErrorSignal(QString); }; diff --git a/slsDetectorGui/include/qTabAdvanced.h b/slsDetectorGui/include/qTabAdvanced.h index ec1afa5e7..0f5dd3bab 100644 --- a/slsDetectorGui/include/qTabAdvanced.h +++ b/slsDetectorGui/include/qTabAdvanced.h @@ -13,6 +13,8 @@ /** Project Class Headers */ class multiSlsDetector; #include "sls_detector_defs.h" +/** Qt Project Class Headers */ +class qDrawPlot; /** Qt Include Header */ #include @@ -26,8 +28,9 @@ public: /** \short The constructor * @param parent is the parent tab widget * @param detector is the detector returned from the detector tab + * @param plot plot object reference */ - qTabAdvanced(QWidget *parent,multiSlsDetector*& detector); + qTabAdvanced(QWidget *parent,multiSlsDetector*& detector, qDrawPlot*& plot); /** Destructor */ @@ -90,13 +93,17 @@ private slots: */ void StartTrimming(); - /**Updates plot from shared memory + /** Updates the plot with trimbits from detector/shared memory */ - void UpdatePlot(); + void UpdateTrimbitPlot(int id); private: /** The sls detector object */ multiSlsDetector *myDet; + /** The Plot widget */ + qDrawPlot *myPlot; + + QButtonGroup *btnGroup; /** Tool Tip for the output dir */ QString outputDirTip; diff --git a/slsDetectorGui/include/qTabDataOutput.h b/slsDetectorGui/include/qTabDataOutput.h index a0bee6f67..0f5a9d680 100644 --- a/slsDetectorGui/include/qTabDataOutput.h +++ b/slsDetectorGui/include/qTabDataOutput.h @@ -61,9 +61,8 @@ private: private slots: /** Sets the output directory - * @param path output path to be set */ -void setOutputDir(const QString& path); +void setOutputDir(); /** Open dialog to choose the output directory */ void browseOutputDir(); diff --git a/slsDetectorGui/include/qTabPlot.h b/slsDetectorGui/include/qTabPlot.h index 2187a6a99..1be27aed2 100644 --- a/slsDetectorGui/include/qTabPlot.h +++ b/slsDetectorGui/include/qTabPlot.h @@ -38,9 +38,7 @@ public: */ ~qTabPlot(); - /** To refresh and update widgets - */ - void Refresh(); + private: @@ -111,6 +109,11 @@ void EnableNthFrame(bool enable){enableNFrame = enable;}; */ void SetScanArgument(); +/** To refresh and update widgets + */ +void Refresh(); + + private slots: /** Selects the plot to display, enables/disables widgets diff --git a/slsDetectorGui/include/qTabSettings.h b/slsDetectorGui/include/qTabSettings.h index e65c3e74a..822052404 100644 --- a/slsDetectorGui/include/qTabSettings.h +++ b/slsDetectorGui/include/qTabSettings.h @@ -37,6 +37,13 @@ public: */ void Refresh(); + /** To enable expert mode + * @param enable to enable if true + */ + void SetExpertMode(bool enable){expertMode = enable;}; + + + private: /** The sls detector object */ @@ -45,7 +52,8 @@ private: /** detector type */ slsDetectorDefs::detectorType detType; - + /** expert mode */ + bool expertMode; enum{Standard,Fast,HighGain,DynamicGain,LowGain,MediumGain,VeryHighGain,Undefined,Uninitialized,NumSettings}; @@ -89,6 +97,11 @@ void SetDynamicRange(int index); /** Set threshold energy */ void SetEnergy(); + + +signals: +/**Update Trimbits after Set Settings */ +void UpdateTrimbitSignal(int); }; diff --git a/slsDetectorGui/src/qActionsWidget.cpp b/slsDetectorGui/src/qActionsWidget.cpp index 75a6d3b62..0e595c670 100644 --- a/slsDetectorGui/src/qActionsWidget.cpp +++ b/slsDetectorGui/src/qActionsWidget.cpp @@ -204,7 +204,7 @@ void qActionsWidget::Refresh(){ cout << "Updated\taction:" << id << "\t" "mode:"<setVisible(enable); actionSaveCalibration->setVisible(enable); - if(myDet->getDetectorsType()==slsDetectorDefs::MYTHEN) + if(digitalDetector){ tab_measurement->SetExpertMode(enable); + tab_settings->SetExpertMode(enable); + } #ifdef VERBOSE @@ -476,7 +481,14 @@ void qDetectorMain::Refresh(int index){ tabs->setCurrentIndex((index++)<(tabs->count()-1)?index:Measurement); else{ switch(tabs->currentIndex()){ - case Measurement: if(!myPlot->isRunning()) tab_measurement->Refresh(); break; + case Measurement: + if(!myPlot->isRunning()) { + tab_measurement->Refresh(); + //to recover from a trimbit plot mode + tab_plot->Refresh(); + } + break; + case Settings: tab_settings->Refresh(); break; case DataOutput: tab_dataoutput->Refresh(); break; case Plot: tab_plot->Refresh(); break; @@ -558,6 +570,17 @@ void qDetectorMain::EnableTabs(){ tabs->setTabEnabled(Settings,enable); tabs->setTabEnabled(Messages,enable); + //actions check + actionOpenSetup->setEnabled(enable); + actionSaveSetup->setEnabled(enable); + actionOpenConfiguration->setEnabled(enable); + actionSaveConfiguration->setEnabled(enable); + actionMeasurementWizard->setEnabled(enable); + actionDebug->setEnabled(enable); + actionBeamline->setEnabled(enable); + actionExpert->setEnabled(enable); + + // special tabs if(enable==false){ tabs->setTabEnabled(Debugging,enable); @@ -589,6 +612,7 @@ void qDetectorMain::EnableTabs(){ if(isDeveloper) tabs->setTabEnabled(Developer,enable); } + } diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index c468f506b..e0278443e 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -8,6 +8,7 @@ #include "qDrawPlot.h" #include "qCloneWidget.h" #include "slsDetector.h" +#include"fileIOStatic.h" // Project Class Headers #include "slsDetector.h" @@ -76,7 +77,6 @@ void qDrawPlot::SetupWidgetWindow(){ minPixelsY = 0; //2d lastImageArray = 0; - image_data = 0; //1d nHists = 0; histNBins = 0; @@ -103,7 +103,9 @@ void qDrawPlot::SetupWidgetWindow(){ alreadyDisplayed = false; // This is so that it initially stop and plots running = 1; - for(int i=0;igetFilePath().c_str()); + fileName = QString(myDet->getFileName().c_str()); } @@ -186,7 +190,7 @@ void qDrawPlot::Initialization(){ connect(this, SIGNAL(SetZRangeSignal(double,double)), plot2D, SLOT(SetZRange(double,double))); - connect(this, SIGNAL(AcquisitionErrorSignal()), this, SLOT(ShowAcquisitionErrorMessage())); + connect(this, SIGNAL(AcquisitionErrorSignal(QString)), this, SLOT(ShowAcquisitionErrorMessage(QString))); } @@ -205,8 +209,6 @@ void qDrawPlot::StartStopDaqToggle(bool stop_if_running){ running=!running; }else if(!stop_if_running){ //then start - //number of measurements - int numMeasurements = (int)myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,-1); // Reset Current Measurement currentMeasurement = 0; emit SetCurrentMeasurementSignal(currentMeasurement); @@ -235,7 +237,7 @@ void qDrawPlot::StartStopDaqToggle(bool stop_if_running){ if(anglePlot) number_of_exposures = numScan0 * numScan1; - cout << "\tNumber of Exposures:" << number_of_exposures << endl; + cout << "\tNumber of Exposures Per Measurement:" << number_of_exposures << endl; // ExposureTime exposureTime= ((double)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1))*1E-9); @@ -244,6 +246,8 @@ void qDrawPlot::StartStopDaqToggle(bool stop_if_running){ acquisitionPeriod= ((double)(myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,-1))*1E-9); cout << "\tAcquisition Period:" << setprecision (10) << acquisitionPeriod << endl; + cout << "\tFile Index:" << myDet->getFileIndex() << endl; + //to take the first data if frameFactor numFactor = 0; @@ -252,6 +256,10 @@ void qDrawPlot::StartStopDaqToggle(bool stop_if_running){ lastSavedFrame = -1; lastSavedMeasurement = -1; + //update file path and file name + filePath = QString(myDet->getFilePath().c_str()); + fileName = QString(myDet->getFileName().c_str()); + StartDaq(true); running=!running; @@ -312,13 +320,15 @@ bool qDrawPlot::StartOrStopThread(bool start){ if(start){ progress = 0; //sets up the measurement parameters - SetupMeasurement(); + SetupMeasurement(myDet->getFileIndex()); cout << "Starting new acquisition threadddd ...." << endl; // Setting the callback function to get data from detector class myDet->registerDataCallback(&(GetDataCallBack),this); //Setting the callback function to alert when acquisition finished from detector class myDet->registerAcquisitionFinishedCallback(&(GetAcquisitionFinishedCallBack),this); + //Setting the callback function to alert when each measurement finished from detector class + myDet->registerMeasurementFinishedCallback(&(GetMeasurementFinishedCallBack),this); // Start acquiring data from server if(!firstTime) pthread_join(gui_acquisition_thread,NULL);//wait until he's finished, ie. exits pthread_create(&gui_acquisition_thread, NULL,DataStartAcquireThread, (void*) this); @@ -337,69 +347,37 @@ bool qDrawPlot::StartOrStopThread(bool start){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void qDrawPlot::SetupMeasurement(){ - if(myDet->getRunStatus()==slsDetectorDefs::IDLE) - cout<getRunStatus()<getFileIndex(); - currentScanValue = 0; - currentScanDivLevel = 0; + LockLastImageArray(); + nPixelsX = myDet->getTotalNumberOfChannels(); + nPixelsY = 100;//if number of exposures, this should be checked before acquisition - if(scanArgument!=None){ - if(scanArgument==AllFrames){ - maxPixelsY = currentIndex + number_of_exposures - 1; - minPixelsY = currentIndex; - nPixelsY = number_of_exposures; - }else if(scanArgument==FileIndex){ - maxPixelsY = currentIndex + number_of_frames - 1; - minPixelsY = currentIndex; - nPixelsY = number_of_frames; - }else if(scanArgument==Level0){ - //no need to check if numsteps=0,cuz otherwise this mode wont be set in plot tab - int numSteps = myDet->getScanSteps(0); - double *values = new double[numSteps]; - myDet->getScanSteps(0,values); + //cannot do this in between measurements , so update instantly + if(scanArgument==Level0){ + //no need to check if numsteps=0,cuz otherwise this mode wont be set in plot tab + int numSteps = myDet->getScanSteps(0); + double *values = new double[numSteps]; + myDet->getScanSteps(0,values); - maxPixelsY = values[numSteps-1]; - minPixelsY = values[0]; - nPixelsY = numSteps; - currentScanValue = values[0]; - } - else { - //no need to check if numsteps=0,cuz otherwise this mode wont be set in plot tab - int numSteps = myDet->getScanSteps(1); - double *values = new double[numSteps]; - myDet->getScanSteps(1,values); + maxPixelsY = values[numSteps-1]; + minPixelsY = values[0]; + nPixelsY = numSteps; + }else if(scanArgument==Level1) { + //no need to check if numsteps=0,cuz otherwise this mode wont be set in plot tab + int numSteps = myDet->getScanSteps(1); + double *values = new double[numSteps]; + myDet->getScanSteps(1,values); - maxPixelsY = values[numSteps-1]; - minPixelsY = values[0]; - nPixelsY = numSteps; - currentScanValue = values[0]; - } - pixelWidth = (maxPixelsY -minPixelsY)/(nPixelsY-1); - startPixel = minPixelsY -(pixelWidth/2); - endPixel = maxPixelsY + (pixelWidth/2); - }else{//no scan - nPixelsY = 100;//number_of_exposures; - maxPixelsY = 100; - minPixelsY = 0; - startPixel = -0.5; - endPixel = nPixelsY-0.5; + maxPixelsY = values[numSteps-1]; + minPixelsY = values[0]; + nPixelsY = numSteps; } - cout<<"nPixelsY:"<progressIndex<fileName).section('/',-1)); //set progress progress=(int)data->progressIndex; - - +#ifdef VERBOSE + cout << "progress:" << progress << endl; +#endif //Plot Disabled if(!plotEnable) return 0; @@ -522,7 +567,7 @@ int qDrawPlot::GetData(detectorData *data){ lastImageNumber= currentFrame+1; //title char temp_title[2000]; - sprintf(temp_title,"Image Index %d",myDet->getFileIndexFromFileName(string(data->fileName))); + sprintf(temp_title,"Image Index %d",fileIOStatic::getFileIndexFromFileName(string(data->fileName))); imageTitle = temp_title; //copy data memcpy(lastImageArray+(currentScanDivLevel*nPixelsX),data->values,nPixelsX*sizeof(double)); @@ -536,7 +581,7 @@ int qDrawPlot::GetData(detectorData *data){ if(scanArgument==FileIndex){ if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ //variables - int currentIndex = myDet->getFileIndexFromFileName(string(data->fileName)); + int currentIndex = fileIOStatic::getFileIndexFromFileName(string(data->fileName)); if(currentIndex == minPixelsY) currentScanDivLevel = 0; lastImageNumber= currentFrame+1; //title @@ -556,8 +601,10 @@ int qDrawPlot::GetData(detectorData *data){ if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ //get scanvariable0 int currentIndex = 0, p = 0; double cs0 = 0 , cs1 = 0; - myDet->getVariablesFromFileName(string(data->fileName), currentIndex, p, cs0, cs1); + fileIOStatic::getVariablesFromFileName(string(data->fileName), currentIndex, p, cs0, cs1); int currentScanVariable0 = (int)cs0; + cout<<"currentScanValue:"<getVariablesFromFileName(string(data->fileName), currentIndex, p, cs0, cs1); + fileIOStatic::getVariablesFromFileName(string(data->fileName), currentIndex, p, cs0, cs1); int currentScanVariable1 = (int)cs1; //variables if(currentScanVariable1!=currentScanValue) currentScanDivLevel++; @@ -618,14 +665,13 @@ int qDrawPlot::GetData(detectorData *data){ //2d else{ // Titles - sprintf(temp_title,"Image Index %d",myDet->getFileIndexFromFileName(string(data->fileName))); + sprintf(temp_title,"Image Index %d",fileIOStatic::getFileIndexFromFileName(string(data->fileName))); imageTitle = temp_title; // manufacture data for now for(unsigned int px=0;pxvalues,nPixelsX*nPixelsY*sizeof(double)); } pthread_mutex_unlock(&(last_image_complete_mutex)); @@ -653,38 +699,30 @@ int qDrawPlot::GetAcquisitionFinishedCallBack(double currentProgress,int detecto int qDrawPlot::AcquisitionFinished(double currentProgress, int detectorStatus){ + QString status = QString(slsDetectorBase::runStatusType(slsDetectorDefs::runStatus(detectorStatus)).c_str()); #ifdef VERBOSE - cout << "Entering Acquisition Finished with status " << - slsDetectorBase::runStatusType((slsDetectorDefs::runStatus(detectorStatus))) << " and progress " << currentProgress << endl; + cout << "\nEntering Acquisition Finished with status " << status.toAscii().constData() << " and progress " << currentProgress << endl; #endif //error or stopped if((stop_signal)||(detectorStatus==slsDetectorDefs::ERROR)){ #ifdef VERBOSE - cout << "Error in Acquisition" << endl; + cout << "Error in Acquisition" << endl << endl; #endif - //just to be sure - stop_signal = 1; - StartStopDaqToggle(true); - emit AcquisitionErrorSignal(); + //stop_signal = 1;//just to be sure + emit AcquisitionErrorSignal(status); } - else{ - //all measurements are over - if(currentProgress==100){ + + //all measurements are over + else if(currentProgress==100){ #ifdef VERBOSE - cout << "Acquisition Finished" << endl; + cout << "Acquisition Finished" << endl << endl; #endif - StartStopDaqToggle(true); - emit UpdatingPlotFinished(); - } - else{//next measurement - currentMeasurement++; -#ifdef VERBOSE - cout << "currentMeasurement:" << currentMeasurement << endl; -#endif - emit SetCurrentMeasurementSignal(currentMeasurement); - SetupMeasurement(); - } } + + StartStopDaqToggle(true); + //this lets the measurement tab know its over, and to enable tabs + emit UpdatingPlotFinished(); + return 0; } @@ -692,12 +730,12 @@ int qDrawPlot::AcquisitionFinished(double currentProgress, int detectorStatus){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void qDrawPlot::ShowAcquisitionErrorMessage(){ +void qDrawPlot::ShowAcquisitionErrorMessage(QString status){ if(!alreadyDisplayed){ alreadyDisplayed = true; - int detStatus = (int)myDet->getRunStatus(); - string status = slsDetectorBase::runStatusType(slsDetectorDefs::runStatus(detStatus)); - qDefs::Message(qDefs::WARNING,string("The acquisiton has ended abruptly. Current Detector Status: ")+status+string("."),"Dock"); + qDefs::Message(qDefs::WARNING,string("The acquisiton has ended abruptly. " + "Current Detector Status: ")+status.toAscii().constData()+ + string("."),"Dock"); } } @@ -705,8 +743,38 @@ void qDrawPlot::ShowAcquisitionErrorMessage(){ //------------------------------------------------------------------------------------------------------------------------------------------------- +int qDrawPlot::GetMeasurementFinishedCallBack(int currentMeasurementIndex, int fileIndex, void *this_pointer){ + ((qDrawPlot*)this_pointer)->MeasurementFinished(currentMeasurementIndex, fileIndex); + return 0; +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +int qDrawPlot::MeasurementFinished(int currentMeasurementIndex, int fileIndex){ +#ifdef VERBOSE + cout << "Entering Measurement Finished with currentMeasurement " << currentMeasurementIndex << " and fileIndex " << fileIndex << endl; +#endif + //to make sure it plots the last frame before setting lastimagearray all to 0 + if(plot_in_scope==2) usleep(500000); + + currentMeasurement = currentMeasurementIndex + 1; +#ifdef VERBOSE + cout << "currentMeasurement:" << currentMeasurement << endl; +#endif + emit SetCurrentMeasurementSignal(currentMeasurement); + SetupMeasurement(fileIndex); + return 0; +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + void qDrawPlot::SelectPlot(int i){ //1 for 1D otherwise 2D if(i==1){ + Clear1DPlot(); plot1D->SetXTitle(histXAxisTitle.toAscii().constData()); plot1D->SetYTitle(histYAxisTitle.toAscii().constData()); plot1D->show(); @@ -724,13 +792,16 @@ void qDrawPlot::SelectPlot(int i){ //1 for 1D otherwise 2D } } + //------------------------------------------------------------------------------------------------------------------------------------------------- + void qDrawPlot::Clear1DPlot(){ for(QVector::iterator h = plot1D_hists.begin(); h!=plot1D_hists.end();h++) (*h)->Detach(plot1D); //clear plot } + //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -813,6 +884,7 @@ void qDrawPlot::UpdatePlot(){ if(plotEnable) UnlockLastImageArray(); + //if acqq stopped before this line, it continues from here, shouldnt restart plotting timer if(!stop_signal){ if(!frameFactor) @@ -823,8 +895,10 @@ void qDrawPlot::UpdatePlot(){ } + //------------------------------------------------------------------------------------------------------------------------------------------------- + void qDrawPlot::StopUpdatePlot(){ #ifdef VERYVERBOSE cout << "Entering StopUpdatePlot()" << endl; @@ -832,8 +906,10 @@ void qDrawPlot::StopUpdatePlot(){ plot_update_timer->stop(); } + //------------------------------------------------------------------------------------------------------------------------------------------------- + void qDrawPlot::ClonePlot(){ int i=0; bool found = false; @@ -850,8 +926,16 @@ void qDrawPlot::ClonePlot(){ // save height to keep maintain same height of plot int preheight = height(); + string sFilePath; + if(running) sFilePath = filePath.toAscii().constData(); + else sFilePath = myDet->getFilePath(); + + + + LockLastImageArray(); + // create clone - winClone[i] = new qCloneWidget(this,i,boxPlot->title(),(int)plot_in_scope,plot1D,plot2D,myDet->getFilePath()); + winClone[i] = new qCloneWidget(this,i,boxPlot->title(),(int)plot_in_scope,plot1D,plot2D,sFilePath); if(plot_in_scope==1){ plot1D = new SlsQt1DPlot(boxPlot); plot1D->setFont(QFont("Sans Serif",9,QFont::Normal)); @@ -885,6 +969,10 @@ void qDrawPlot::ClonePlot(){ plot2D->SetZTitle(imageZAxisTitle); plotLayout->addWidget(plot2D,1,1,1,1); } + + UnlockLastImageArray(); + + setMinimumHeight(preheight); resize(width(),preheight); @@ -899,8 +987,10 @@ void qDrawPlot::ClonePlot(){ connect(winClone[i], SIGNAL(CloneClosedSignal(int)),this, SLOT(CloneCloseEvent(int))); } + //------------------------------------------------------------------------------------------------------------------------------------------------- + void qDrawPlot::SaveClones(){ char errID[200]; string errMessage= "The Snapshots with ID's: "; @@ -922,6 +1012,7 @@ void qDrawPlot::SaveClones(){ //------------------------------------------------------------------------------------------------------------------------------------------------- + void qDrawPlot::CloseClones(){ for(int i=0;igetFilePath().c_str()); + QString fName; + if(running) fName = filePath; + else fName = QString(myDet->getFilePath().c_str()); + if(boxPlot->title().contains('.')){ fName.append(QString('/')+boxPlot->title()); fName.replace(".dat",".png"); @@ -965,6 +1063,7 @@ void qDrawPlot::SavePlot(){ //------------------------------------------------------------------------------------------------------------------------------------------------- +/* void qDrawPlot::SaveAll(bool enable){ string msg = string("The Files will be saved as:\n")+ @@ -973,19 +1072,27 @@ void qDrawPlot::SaveAll(bool enable){ qDefs::Message(qDefs::INFORMATION,msg,"Dock"); saveAll = enable; } +*/ //------------------------------------------------------------------------------------------------------------------------------------------------- + void qDrawPlot::SavePlotAutomatic(){ //no need to save the same plot many times if((currentFrame>lastSavedFrame)&&(currentMeasurement>=lastSavedMeasurement)){ + + QString qFilePath; + if(running) qFilePath = filePath; + else qFilePath = QString(myDet->getFilePath().c_str()); + + lastSavedFrame = currentFrame; lastSavedMeasurement = currentMeasurement; char cID[10]; sprintf(cID,"%d",lastSavedFrame); //title - QString fName = QString(myDet->getFilePath().c_str()); + QString fName = qFilePath; if(boxPlot->title().contains('.')){ fName.append(QString('/')+boxPlot->title()); fName.replace(".dat",".png"); @@ -1007,6 +1114,7 @@ void qDrawPlot::SavePlotAutomatic(){ } } + //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -1021,15 +1129,15 @@ void qDrawPlot::ShowSaveErrorMessage(QString fileName){ void qDrawPlot::SetPersistency(int val){ - for(int i=0;i<=val;i++){ - if(!yvalues[i]) yvalues[i] = new double [nPixelsX]; + for(int i=0;i<=val;i++) if(!histYAxis[i]) histYAxis[i] = new double [nPixelsX]; - } persistency = val; } + //------------------------------------------------------------------------------------------------------------------------------------------------- + void qDrawPlot::EnablePlot(bool enable){ #ifdef VERBOSE cout << "Plotting set to:" << enable << endl; @@ -1041,8 +1149,10 @@ void qDrawPlot::EnablePlot(bool enable){ } + //------------------------------------------------------------------------------------------------------------------------------------------------- + void qDrawPlot::DisableZoom(bool disable){ if(plot_in_scope==1) plot1D->DisableZoom(disable); @@ -1050,4 +1160,133 @@ void qDrawPlot::DisableZoom(bool disable){ plot2D->GetPlot()->DisableZoom(disable); } + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +int qDrawPlot::UpdateTrimbitPlot(bool fromDetector,bool Histogram){ + int ret,i,actualPixelsX; + double *temp; +#ifdef VERBOSE + if(fromDetector) cout << "Geting Trimbits from Detector: "; + else cout << "Getting Trimbits from Shared Memory: "; + if(Histogram) cout << "Histogram" << endl; + else cout << "Data Graph" << endl; +#endif + + + switch(myDet->getDetectorsType()){ + + + case slsDetectorDefs::MYTHEN: + //get trimbits + actualPixelsX = myDet->getTotalNumberOfChannels(); + temp = new double[actualPixelsX]; + ret = myDet->getChanRegs(temp,fromDetector); + if(!ret){ + qDefs::Message(qDefs::WARNING,"No Trimbit data found in shared memory.","Dock"); + return qDefs::FAIL; + } + + //defining axes + if(Histogram) nPixelsX = TRIM_HISTOGRAM_XMAX; + else nPixelsX = actualPixelsX; + if(histXAxis) delete [] histXAxis; histXAxis = new double [nPixelsX]; + if(histYAxis[0]) delete [] histYAxis[0];histYAxis[0] = new double [nPixelsX]; + //initializing + for(unsigned int px=0;pxSetXTitle("Channel Number"); + plot1D->SetYTitle("Trimbits"); + //set plot parameters + SlsQtH1D* h; + plot1D_hists.append(h=new SlsQtH1D("1d plot",nPixelsX,histXAxis,GetHistYAxis(0))); + h->SetLineColor(1); + h->setTitle(GetHistTitle(0)); + //attach plot + h->Attach(plot1D); + }else{ + //data + for(i=0;i0)) + cout<<"HIsty["<SetXTitle("Trimbits"); + plot1D->SetYTitle("Frequency"); + //set plot parameters + SlsQtH1D* h; + plot1D_hists.append(h=new SlsQtH1D("1d plot",nPixelsX,histXAxis,GetHistYAxis(0))); + h->SetLineColor(1); + h->setTitle(GetHistTitle(0)); + //attach plot + h->Attach(plot1D); + + } +#ifdef VERBOSE + cout << "Trimbits Plot updated" << endl; +#endif + break; + + + + + //2d + case slsDetectorDefs::EIGER: + //defining axes + nPixelsX = 100;/**??*/ + nPixelsY = 100; + if(lastImageArray) delete [] lastImageArray; lastImageArray = new double[nPixelsY*nPixelsX]; + //initializing 2d array + for(int py=0;py<(int)nPixelsY;py++) + for(int px=0;px<(int)nPixelsX;px++) + lastImageArray[py*nPixelsX+px] = 0; + //get trimbits + ret = 1;/*myDet->getChanRegs(lastImageArray,fromDetector);*/ + if(!ret){ + qDefs::Message(qDefs::WARNING,"No Trimbit data found in shared memory.","Dock"); + return qDefs::FAIL; + } + //clear/select plot and set titles + Select2DPlot(); + plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,-0.5,nPixelsY-0.5,lastImageArray); + plot2D->setTitle("Image"); + plot2D->SetXTitle("Pixel"); + plot2D->SetYTitle("Pixel"); + plot2D->SetZTitle("Trimbits"); + plot2D->UpdateNKeepSetRangeIfSet(); +#ifdef VERBOSE + cout << "Trimbits Plot updated" << endl; +#endif + break; + + + + + + //shouldnt be here + default: + break; + } + return qDefs::OK; +} + + //------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/slsDetectorGui/src/qScanWidget.cpp b/slsDetectorGui/src/qScanWidget.cpp index 9f7c83ef5..50f4d50cb 100644 --- a/slsDetectorGui/src/qScanWidget.cpp +++ b/slsDetectorGui/src/qScanWidget.cpp @@ -1028,7 +1028,7 @@ void qScanWidget::Refresh(){ "numSteps:" << actualNumSteps << "\t" //"values:" << arrSteps << "\t" "parameter:" << parameter << "\t" - "precision:" << precision << endl << endl; + "precision:" << precision << "\t***" << endl; #endif } diff --git a/slsDetectorGui/src/qTabActions.cpp b/slsDetectorGui/src/qTabActions.cpp index e16dc3eef..46d9d5bb6 100644 --- a/slsDetectorGui/src/qTabActions.cpp +++ b/slsDetectorGui/src/qTabActions.cpp @@ -354,19 +354,24 @@ void qTabActions::DeletePosition(){ void qTabActions::EnablePositions(bool enable){ #ifdef VERBOSE - cout << "\nEnable Positions: " << enable << endl; + cout << "Enable Positions: " << enable << endl; #endif if(enable){ lblName[NumPositions]->setEnabled(true); btnExpand[NumPositions]->setEnabled(true); }else{ - //to collapse if it was expanded - if(btnExpand[NumPositions]->text()=="-") - Expand(group->button(NumPositions)); + //deletes all positions for(int i=0;icount();i++) comboPos->removeItem(i); cout<<"Number of Positions set to :"<getPositions()<setPalette(lblName[NumPositions-1]->palette()); + //to collapse if it was expanded + if(btnExpand[NumPositions]->isChecked()){ + disconnect(group, SIGNAL(buttonClicked(QAbstractButton*)), this,SLOT(Expand(QAbstractButton*))); + btnExpand[NumPositions]->setChecked(false); + connect(group, SIGNAL(buttonClicked(QAbstractButton*)), this,SLOT(Expand(QAbstractButton*))); + Expand(group->button(NumPositions)); + } lblName[NumPositions]->setEnabled(false); btnExpand[NumPositions]->setEnabled(false); } @@ -378,7 +383,7 @@ void qTabActions::EnablePositions(bool enable){ void qTabActions::Refresh(){ #ifdef VERBOSE - cout << "\nUpdating all action widgets " << endl; + cout << "\nUpdating all action widgets: " << endl; #endif if((detType == slsDetectorDefs::MYTHEN) || (detType == slsDetectorDefs::GOTTHARD)){ //positions is enabled only if angular conversion is enabled @@ -415,7 +420,7 @@ void qTabActions::Refresh(){ #ifdef VERBOSE - cout << "Updated position widget\tnum:" << numPos << endl << endl; + cout << "Updated position widget\tnum:" << numPos << "\t***" << endl; #endif } } @@ -423,7 +428,7 @@ void qTabActions::Refresh(){ scanWidget[i]->Refresh(); for(int i=0;iRefresh(); - + cout << endl; UpdateCollapseColors(); } diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp index 9bc2c7081..b7109ad7f 100644 --- a/slsDetectorGui/src/qTabAdvanced.cpp +++ b/slsDetectorGui/src/qTabAdvanced.cpp @@ -6,6 +6,7 @@ */ #include "qTabAdvanced.h" #include "qDefs.h" +#include "qDrawPlot.h" /** Project Class Headers */ #include "slsDetector.h" #include "multiSlsDetector.h" @@ -19,7 +20,8 @@ using namespace std; //------------------------------------------------------------------------------------------------------------------------------------------------- -qTabAdvanced::qTabAdvanced(QWidget *parent,multiSlsDetector*& detector):QWidget(parent),myDet(detector){ +qTabAdvanced::qTabAdvanced(QWidget *parent,multiSlsDetector*& detector, qDrawPlot*& plot): + QWidget(parent),myDet(detector),myPlot(plot),btnGroup(NULL){ setupUi(this); SetupWidgetWindow(); Initialization(); @@ -52,7 +54,12 @@ void qTabAdvanced::SetupWidgetWindow(){ boxTrimming->setChecked(false); SetOptimize(false); + + btnGroup = new QButtonGroup(this); + btnGroup->addButton(btnRefresh,0); + btnGroup->addButton(btnGetTrimbits,1); } + } @@ -88,7 +95,8 @@ void qTabAdvanced::Initialization(){ connect(btnStart, SIGNAL(clicked()), this, SLOT(StartTrimming())); //refresh - connect(btnRefresh, SIGNAL(clicked()), this, SLOT(UpdatePlot())); + connect(btnGroup, SIGNAL(buttonClicked(int)), this, SLOT(UpdateTrimbitPlot(int))); + } @@ -331,7 +339,7 @@ void qTabAdvanced::StartTrimming(){ qDefs::Message(qDefs::INFORMATION,"The Trimbits have been saved successfully.","Advanced"); else qDefs::Message(qDefs::WARNING,string("Could not Save the Trimbits to file:\n")+dispFile->text().toAscii().constData(),"Advanced"); //updates plots - UpdatePlot(); + myPlot->UpdateTrimbitPlot(false,radioHistogram->isChecked()); } else qDefs::Message(qDefs::WARNING,"Atleast 1 channel could not be trimmed.","Advanced"); @@ -341,36 +349,17 @@ void qTabAdvanced::StartTrimming(){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void qTabAdvanced::UpdatePlot(){ -#ifdef VERBOSE - cout << "Updating Plot" << endl; -#endif - - int nPixelsX = myDet->getTotalNumberOfChannels(); - - int *histXAxis = new int[nPixelsX]; - int *histYAxis = new int[100]; - for(int i=0;igetNumberOfDetectors();det++){ - slsDetector *s = myDet->getSlsDetector(det); - channelsPerDetector=s->getTotalNumberOfChannels(); - if(s->chanregs){ - for(int i=0;ichanregs,channelsPerDetector*sizeof(int)); - } - } - } -*/ - cout<<"histyaxis[500]:"<UpdateTrimbitPlot(false,radioHistogram->isChecked()); + //from detector + else myPlot->UpdateTrimbitPlot(true,radioHistogram->isChecked()); } //------------------------------------------------------------------------------------------------------------------------------------------------- + void qTabAdvanced::Refresh(){ //disconnect disconnect(chkEnergyLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs())); diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index 032452bf2..18b68a98e 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -46,7 +46,7 @@ qTabDataOutput::~qTabDataOutput(){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void qTabDataOutput::SetupWidgetWindow(){cout<<"in here"<getDetectorsType(); @@ -74,7 +74,7 @@ void qTabDataOutput::SetupWidgetWindow(){cout<<"in here"<text(); + + //gets rid of the end '/'s + disconnect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(setOutputDir())); + while(path.endsWith('/')) path.chop(1); + dispOutputDir->setText(path); + connect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(setOutputDir())); + myDet->setFilePath(string(path.toAscii().constData())); #ifdef VERBOSE cout << "Output Directory changed to :"<getFilePath() << endl; #endif + } diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index c1a129a4b..4032474ec 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -306,6 +306,7 @@ void qTabMeasurement::startStopAcquisition(){ progressTimer->start(100); emit StartSignal(); + myPlot->StartStopDaqToggle(); }else{ #ifdef VERBOSE @@ -326,14 +327,16 @@ void qTabMeasurement::startStopAcquisition(){ void qTabMeasurement::UpdateFinished(){ - disconnect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); - btnStartStop->setText("Start"); - btnStartStop->setIcon(*iconStart); - btnStartStop->setChecked(false); - Enable(1); - connect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); - UpdateProgress(); - progressTimer->stop(); + if(btnStartStop->isChecked()){ + disconnect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); + btnStartStop->setText("Start"); + btnStartStop->setIcon(*iconStart); + btnStartStop->setChecked(false); + Enable(1); + connect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); + UpdateProgress(); + progressTimer->stop(); + } } @@ -723,20 +726,22 @@ void qTabMeasurement::EnableFileWrite(bool enable){ void qTabMeasurement::Refresh(){ - //Number of measurements - spinNumMeasurements->setValue((int)myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,-1)); - //File Name - dispFileName->setText(QString(myDet->getFileName().c_str())); - //File Index - spinIndex->setValue(myDet->getFileIndex()); - //progress label index - lblProgressIndex->setText(QString::number(myDet->getFileIndex())); - //Timing mode* - SetupTimingMode(); + if(!myPlot->isRunning()){ + //Number of measurements + spinNumMeasurements->setValue((int)myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,-1)); + //File Name + dispFileName->setText(QString(myDet->getFileName().c_str())); + //File Index + spinIndex->setValue(myDet->getFileIndex());cout<<"file index:"<getFileIndex()<setText(QString::number(myDet->getFileIndex())); + //Timing mode* + SetupTimingMode(); - // to let qdrawplot know that triggers or frames are used - myPlot->setFrameEnabled(lblNumFrames->isEnabled()); - myPlot->setTriggerEnabled(lblNumTriggers->isEnabled()); + // to let qdrawplot know that triggers or frames are used + myPlot->setFrameEnabled(lblNumFrames->isEnabled()); + myPlot->setTriggerEnabled(lblNumTriggers->isEnabled()); + } } diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index cb8bc9ea7..c56919add 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -504,7 +504,7 @@ void qTabPlot::EnableScanBox(){ int mode1 = myDet->getScanMode(1); //if it was checked before or disabled before, it remembers to check it again - bool checkedBefore = (boxScan->isChecked()||(!boxScan->isEnabled())); + bool checkedBefore = boxScan->isChecked();//||(!boxScan->isEnabled())); //none of these scan plotting options make sense if positions>0 @@ -548,7 +548,8 @@ void qTabPlot::EnableScanBox(){ //positions if((positionsExist)&&(chkSuperimpose->isChecked())) chkSuperimpose->setChecked(false); chkSuperimpose->setEnabled(!positionsExist); - boxFrequency->setEnabled(!positionsExist); + //box frequency should be enabled cuz its a normal 1d plot + boxFrequency->setEnabled(positionsExist); myPlot->EnableAnglePlot(positionsExist); @@ -673,8 +674,14 @@ void qTabPlot::SetScanArgument(){ void qTabPlot::Refresh(){ - SetFrequency(); - if(!myPlot->isRunning()) EnableScanBox(); + if(!myPlot->isRunning()){ + connect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox())); + SetFrequency(); + EnableScanBox(); + }else{ + disconnect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox())); + boxScan->setEnabled(false); + } } diff --git a/slsDetectorGui/src/qTabSettings.cpp b/slsDetectorGui/src/qTabSettings.cpp index eadf9cc17..1b3812ab3 100644 --- a/slsDetectorGui/src/qTabSettings.cpp +++ b/slsDetectorGui/src/qTabSettings.cpp @@ -18,7 +18,7 @@ using namespace std; //------------------------------------------------------------------------------------------------------------------------------------------------- qTabSettings::qTabSettings(QWidget *parent,multiSlsDetector*& detector): - QWidget(parent),myDet(detector){ + QWidget(parent),myDet(detector),expertMode(false){ setupUi(this); SetupWidgetWindow(); @@ -170,7 +170,7 @@ void qTabSettings::setSettings(int index){ if((detType==slsDetectorDefs::GOTTHARD)||(detType==slsDetectorDefs::AGIPD)){ lblThreshold->setEnabled(false); spinThreshold->setEnabled(false); - }else{ + }else{//mythen or eiger if((index==Undefined)||(index==Uninitialized)){ lblThreshold->setEnabled(false); @@ -179,8 +179,12 @@ void qTabSettings::setSettings(int index){ lblThreshold->setEnabled(true); spinThreshold->setEnabled(true); SetEnergy(); + //also update trimbits plot + if(expertMode) emit UpdateTrimbitSignal(0); } } + + } //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -234,10 +238,10 @@ void qTabSettings::SetDynamicRange(int index){ void qTabSettings::SetEnergy(){ + int index = spinThreshold->value(); #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)>200){ @@ -256,7 +260,11 @@ void qTabSettings::SetEnergy(){ void qTabSettings::Refresh(){ // Settings SetupDetectorSettings(); + //changin the combo settings also plots the trimbits for mythen and eiger, so disconnect + disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int))); comboSettings->setCurrentIndex(myDet->getSettings()); + connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int))); + // Number of Modules spinNumModules->setValue(myDet->setNumberOfModules()); From 38451caa7c9bf5d1ea8dfc60e23e59bf27f137ee Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 14 Sep 2012 14:55:53 +0000 Subject: [PATCH 056/332] should all be done now git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@56 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_detectormain.ui | 2 - slsDetectorGui/forms/form_tab_debugging.ui | 463 +++++++++++++++------ slsDetectorGui/include/qDrawPlot.h | 2 +- slsDetectorGui/include/qTabDebugging.h | 53 ++- slsDetectorGui/src/qDetectorMain.cpp | 14 +- slsDetectorGui/src/qDrawPlot.cpp | 2 +- slsDetectorGui/src/qTabAdvanced.cpp | 5 +- slsDetectorGui/src/qTabDebugging.cpp | 442 +++++++++++++++++++- slsDetectorGui/src/qTabMessages.cpp | 8 +- 9 files changed, 823 insertions(+), 168 deletions(-) diff --git a/slsDetectorGui/forms/form_detectormain.ui b/slsDetectorGui/forms/form_detectormain.ui index 9d3577730..06396987c 100644 --- a/slsDetectorGui/forms/form_detectormain.ui +++ b/slsDetectorGui/forms/form_detectormain.ui @@ -227,8 +227,6 @@ - - diff --git a/slsDetectorGui/forms/form_tab_debugging.ui b/slsDetectorGui/forms/form_tab_debugging.ui index 4817294f8..5f17ee00d 100644 --- a/slsDetectorGui/forms/form_tab_debugging.ui +++ b/slsDetectorGui/forms/form_tab_debugging.ui @@ -34,124 +34,385 @@ - 30 - 140 - 321 - 156 + 45 + 75 + 686 + 231 + + Qt::NoFocus + - Digital Tests + Tests 15 - 20 + 110 141 51 - + + + Qt::NoFocus + - Detector Module + Readout Firmware - + + + Qt::NoFocus + - Test xxx + Readout Software - - - - 75 - 115 - 150 - 25 - - - - - 0 - 0 - - - - Run - - - - :/icons/images/start.png:/icons/images/start.png - - - - - - - 425 - 140 - 321 - 156 - - - - Analog Tests - - + 15 - 20 + 185 + 656 + 36 + + + + + + + + 0 + 0 + + + + Run Test + + + + :/icons/images/start.png:/icons/images/start.png + + + + + + + + + 415 + 30 + 256 + 31 + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 100 + 16777215 + + + + Module: + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + true + + + + All Modules + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 20 + + + + + + + + + + 280 + 110 141 51 - + + + Qt::NoFocus + - Detector Module + Readout Bus - + + + Qt::NoFocus + - Test xxx + Readout Memory - + - 85 - 115 - 150 - 25 + 530 + 110 + 141 + 26 - - - 0 - 0 - + + + + + Qt::NoFocus + + + Chip + + + + + + + + + 15 + 30 + 276 + 31 + - - Run + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 150 + 16777215 + + + + Readout: + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 20 + + + + + + + + + + 15 + 60 + 276 + 31 + - - - :/icons/images/start.png:/icons/images/start.png + + + + + + 0 + 0 + + + + + 150 + 16777215 + + + + Status: + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 20 + + + + + + + + + 0 + 0 + + + + IDLE + + + + + + + + + 530 + 135 + 141 + 26 + + + + + + + Qt::NoFocus + + + Module Firmware + + + + + + + + + 5 + 95 + 676 + 16 + + + + Qt::Horizontal + + + + + + 5 + 165 + 676 + 16 + + + + Qt::Horizontal @@ -159,70 +420,16 @@ 45 - 30 - 291 - 36 + 25 + 686 + 31 - + - - - Detector Status: - - - - - - - Offline - - - - - - - - - 440 - 29 - 291 - 76 - - - - - - - Module Number: - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - All Modules - - - - - - + 0 0 @@ -235,12 +442,12 @@ - 150 + 16777215 16777215 - Get Information + Get ID Information diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index 307978cd4..3a5aba2a0 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -431,7 +431,7 @@ QString filePath; QString fileName; /** Max Number of Clone Windows */ -static const int TRIM_HISTOGRAM_XMAX = 600; +static const int TRIM_HISTOGRAM_XMAX = 63; diff --git a/slsDetectorGui/include/qTabDebugging.h b/slsDetectorGui/include/qTabDebugging.h index 8b9ad1820..480833354 100644 --- a/slsDetectorGui/include/qTabDebugging.h +++ b/slsDetectorGui/include/qTabDebugging.h @@ -12,8 +12,9 @@ #include "ui_form_tab_debugging.h" /** Project Class Headers */ class multiSlsDetector; +class slsDetector; /** Qt Include Headers */ - +#include /** C++ Include Headers */ #include "sls_detector_defs.h" @@ -39,12 +40,6 @@ public: void Refresh(); private: - /** The sls detector object */ - multiSlsDetector *myDet; - - /** detector type */ - slsDetectorDefs::detectorType detType; - /** Sets up the widget */ void SetupWidgetWindow(); @@ -54,6 +49,50 @@ private: void Initialization(); + +private slots: + /** Updates the module list depending on current detector + */ + void UpdateModuleList(); + + /** Updates the status depending on current detector + */ + void UpdateStatus(); + + /** Gets id and versions etc + */ + void GetInfo(); + + /** Sets id and versions on the display widget + */ + void SetParameters(QTreeWidgetItem *item); + + /** Test detector and module + */ + void TestDetector(); + +private: + /** The multi sls detector object */ + multiSlsDetector *myDet; + + /** detector type */ + slsDetectorDefs::detectorType detType; + + /**sls detecctor object */ + slsDetector *det; + + /** Tree Widget displaying the detectors, modules */ + QTreeWidget *treeDet; + /** Widget displaying the serial numbers, mac addresses etc */ + QFrame *dispFrame; + QLabel *lblDetectorId; + QLabel *lblDetectorSerial; + QLabel *lblDetectorFirmware; + QLabel *lblDetectorSoftware; + QLabel *lblModuleId; + QLabel *lblModuleFirmware; + QLabel *lblModuleSerial; + QPalette *blue; }; diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 4ca7cd356..8d13a7265 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -352,11 +352,6 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ else qDefs::Message(qDefs::WARNING,string("Could not save the Setup Parameters from file:\n")+fName.toAscii().constData(),"Main"); } } - else if(action==actionMeasurementWizard){ -#ifdef VERBOSE - cout << "Measurement Wizard" << endl; -#endif - } else if(action==actionOpenConfiguration){ #ifdef VERBOSE cout << "Loading Configuration" << endl; @@ -461,13 +456,18 @@ void qDetectorMain::ExecuteHelp(QAction *action){ #ifdef VERBOSE cout << "About: Common GUI for Mythen, Eiger, Gotthard and Agipd detectors" << endl; #endif + char version[200]; + sprintf(version,"%llx",myDet->getId(slsDetectorDefs::THIS_SOFTWARE_VERSION)); + string thisClientVersion = string(version); //

A heading

- qDefs::Message(qDefs::INFORMATION,"

SLS Detector GUI version: 1.0

" + qDefs::Message(qDefs::INFORMATION,"

" + "SLS Detector GUI version: 1.0
" + "SLS Detector Client version: "+thisClientVersion+"

" "Common GUI to control the SLS Detectors: " "Mythen, Eiger, Gotthard and Agipd.

" "It can be operated in parallel with the command line interface:
" "sls_detector_put,
sls_detector_get,
sls_detector_acquire and
sls_detector_help.

" - "The software is still in progress. " + "The GUI Software is still in progress. " "Please report bugs to dhanya.maliakal@psi.ch.<\\p>","About SLS Detector GUI"); } } diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index e0278443e..b98cfb571 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -1220,7 +1220,7 @@ int qDrawPlot::UpdateTrimbitPlot(bool fromDetector,bool Histogram){ for(i=0;iaddButton(btnRefresh,0); btnGroup->addButton(btnGetTrimbits,1); + + + + Initialization(); } } diff --git a/slsDetectorGui/src/qTabDebugging.cpp b/slsDetectorGui/src/qTabDebugging.cpp index e599fb4c5..93d512f91 100644 --- a/slsDetectorGui/src/qTabDebugging.cpp +++ b/slsDetectorGui/src/qTabDebugging.cpp @@ -9,6 +9,9 @@ // Project Class Headers #include "slsDetector.h" #include "multiSlsDetector.h" +// Qt Include Headers +#include +#include // C++ Include Headers #include using namespace std; @@ -18,7 +21,8 @@ using namespace std; //------------------------------------------------------------------------------------------------------------------------------------------------- -qTabDebugging::qTabDebugging(QWidget *parent,multiSlsDetector*& detector):QWidget(parent),myDet(detector){ +qTabDebugging::qTabDebugging(QWidget *parent,multiSlsDetector*& detector): + QWidget(parent),myDet(detector),treeDet(NULL){ setupUi(this); SetupWidgetWindow(); Initialization(); @@ -37,41 +41,443 @@ qTabDebugging::~qTabDebugging(){ void qTabDebugging::SetupWidgetWindow(){ + + blue = new QPalette(); + blue->setColor(QPalette::Active,QPalette::WindowText,Qt::darkBlue); + + // Detector Type detType=myDet->getDetectorsType(); - - //status - int detStatus = (int)myDet->getRunStatus(); - string status = slsDetectorBase::runStatusType(slsDetectorDefs::runStatus(detStatus)); - lblStatus->setText(QString(status.c_str()).toUpper()); - - if(detType==slsDetectorDefs::EIGER) lblModule->setText("Half Module Number:"); - else lblModule->setText("Module Number:"); - - // loading combo box module numbers - int max = myDet->setNumberOfModules(); + ///change module label + switch(detType){ + case slsDetectorDefs::EIGER: + lblDetector->setText("Half Module:"); + chkDetectorFirmware->setText("Half Module Firmware:"); + chkDetectorSoftware->setText("Half Module Software:"); + chkDetectorMemory->setText("Half Module Memory:"); + chkDetectorBus->setText("Half Module Bus:"); + lblModule->hide(); + comboModule->hide(); + chkModuleFirmware->hide(); + chkChip->setEnabled(false); + chkModuleFirmware->setEnabled(false); + break; + case slsDetectorDefs::GOTTHARD: + lblDetector->setText("Module:"); + chkDetectorFirmware->setText("Module Firmware:"); + chkDetectorSoftware->setText("Module Software:"); + chkDetectorMemory->setText("Module Memory:"); + chkDetectorBus->setText("Module Bus:"); + lblModule->hide(); + comboModule->hide(); + chkModuleFirmware->hide(); + chkChip->setEnabled(false); + chkModuleFirmware->setEnabled(false); + break; + case slsDetectorDefs::MYTHEN: + break; + default: + //leave everything as it is(mythen is default) + break; + } -/* for(int i=0;igetSlsDetector(i); - if(s->setTCPSocket()!=slsDetectorDefs::FAIL){ - comboModule->addItem(QString::number(i)); - } - }*/ + //add detectors + for(int i=0;igetNumberOfDetectors();i++){ + comboDetector->addItem(QString(myDet->getHostname(i).c_str())); + } + + + //add modules and status for current detector + if(detType==slsDetectorDefs::MYTHEN) UpdateModuleList(); + UpdateStatus(); + } //------------------------------------------------------------------------------------------------------------------------------------------------- void qTabDebugging::Initialization(){ + if(detType==slsDetectorDefs::MYTHEN) + connect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateModuleList())); + + connect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateStatus())); + connect(btnGetInfo, SIGNAL(clicked()), this, SLOT(GetInfo())); + connect(btnTest, SIGNAL(clicked()), this, SLOT(TestDetector())); } +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabDebugging::UpdateModuleList(){ + det = myDet->getSlsDetector(comboDetector->currentIndex()); + //deletes all modules except "all modules" + for(int i=0;icount()-1;i++) + comboModule->removeItem(i); + for(int i=0;igetNMods();i++){ + comboModule->addItem(QString("Module %1").arg(i)); + } + +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabDebugging::UpdateStatus(){ + det = myDet->getSlsDetector(comboDetector->currentIndex()); + int detStatus = (int)det->getRunStatus(); + string status = slsDetectorBase::runStatusType(slsDetectorDefs::runStatus(detStatus)); + lblStatus->setText(QString(status.c_str()).toUpper()); + + +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabDebugging::GetInfo(){ + //window + QFrame* popup1 = new QFrame(this, Qt::Popup | Qt::SubWindow ); + QList items; + + + + //layout + QGridLayout *layout = new QGridLayout(popup1); + //treewidget + treeDet = new QTreeWidget(popup1); + layout->addWidget(treeDet,0,0); + //display the details + dispFrame = new QFrame(popup1); + QGridLayout *formLayout = new QGridLayout(dispFrame); + lblDetectorId = new QLabel(""); lblDetectorId->setPalette(*blue); + lblDetectorSerial = new QLabel(""); lblDetectorSerial->setPalette(*blue); + lblDetectorFirmware = new QLabel(""); lblDetectorFirmware->setPalette(*blue); + lblDetectorSoftware = new QLabel(""); lblDetectorSoftware->setPalette(*blue); + lblModuleId = new QLabel(""); lblModuleId->setPalette(*blue); + lblModuleSerial = new QLabel(""); lblModuleSerial->setPalette(*blue); + lblModuleFirmware = new QLabel(""); lblModuleFirmware->setPalette(*blue); + //to make sure the size is constant + lblDetectorFirmware->setFixedWidth(100); + layout->addWidget(dispFrame,0,1); + + switch(detType){ + + case slsDetectorDefs::MYTHEN:{ + //display widget + formLayout->addWidget(new QLabel("Readout:"),0,0); + formLayout->addItem(new QSpacerItem(15,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,1); + formLayout->addWidget(lblDetectorId,0,2); + formLayout->addWidget(new QLabel("Readout MAC Address:"),1,0); + formLayout->addWidget(lblDetectorSerial,1,2); + formLayout->addWidget(new QLabel("Readout Firmware Version:"),2,0); + formLayout->addWidget(lblDetectorFirmware,2,2); + formLayout->addWidget(new QLabel("Readout Software Version:"),3,0); + formLayout->addWidget(lblDetectorSoftware,3,2); + formLayout->addWidget(new QLabel("Module:"),4,0); + formLayout->addWidget(lblModuleId,4,2); + formLayout->addWidget(new QLabel("Module Serial Number:"),5,0); + formLayout->addWidget(lblModuleSerial,5,2); + formLayout->addWidget(new QLabel("Module Firmware Version:"),6,0); + formLayout->addWidget(lblModuleFirmware,6,2); + + + //tree widget + treeDet->setHeaderLabel("Mythen Detector"); + //gets det names + for (int i=0;icount();i++) + items.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString("Readout (%1)").arg(comboDetector->itemText(i))))); + treeDet->insertTopLevelItems(0, items); + //gets module names + for (int i=0;icount();i++){ + QList childItems; + det = myDet->getSlsDetector(i); + for(int j=0;jgetNMods();j++) + childItems.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString("Module %1").arg(j)))); + treeDet->topLevelItem(i)->insertChildren(0,childItems); + } + + break; + } + + + + case slsDetectorDefs::EIGER:{ + //display widget + formLayout->addWidget(new QLabel("Half Module:"),0,0); + formLayout->addItem(new QSpacerItem(15,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,1); + formLayout->addWidget(lblDetectorId,0,2); + formLayout->addWidget(new QLabel("Half Module MAC Address:"),1,0); + formLayout->addWidget(lblDetectorSerial,1,2); + formLayout->addWidget(new QLabel("Half Module Firmware Version:"),2,0); + formLayout->addWidget(lblDetectorFirmware,2,2); + formLayout->addWidget(new QLabel("Half Module Software Version:"),3,0); + formLayout->addWidget(lblDetectorSoftware,3,2); + + //tree widget + treeDet->setHeaderLabel("Eiger Detector"); + //get num modules + for (int i=0;icount()/2;i++) + items.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString("Module %1").arg(i)))); + treeDet->insertTopLevelItems(0, items); + //gets det names + for (int i=0;icount();i++){ + QList childItems; + childItems.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString("Half Module (%1)").arg(comboDetector->itemText(i))))); + treeDet->topLevelItem(i*2)->insertChildren(0,childItems); + } + break; + } + + + + case slsDetectorDefs::GOTTHARD:{ + + //display widget + formLayout->addWidget(new QLabel("Module:"),0,0); + formLayout->addItem(new QSpacerItem(15,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,1); + formLayout->addWidget(lblDetectorId,0,2); + formLayout->addWidget(new QLabel("Module MAC Address:"),1,0); + formLayout->addWidget(lblDetectorSerial,1,2); + formLayout->addWidget(new QLabel("Module Firmware Version:"),2,0); + formLayout->addWidget(lblDetectorFirmware,2,2); + formLayout->addWidget(new QLabel("Module Software Version:"),3,0); + formLayout->addWidget(lblDetectorSoftware,3,2); + //tree widget + treeDet->setHeaderLabel("Gotthard Detector"); + //gets det names + for (int i=0;icount();i++) + items.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString("Module (%1)").arg(comboDetector->itemText(i))))); + treeDet->insertTopLevelItems(0, items); + + break; + } + + + + default: + break; + } + + //show and center widget + + int x = ((parentWidget()->width()) - (popup1->frameGeometry().width())) / 2; + int y = ((parentWidget()->height()) - (popup1->frameGeometry().height())) / 2; + QDesktopWidget *desktop = QApplication::desktop(); + int screen = desktop->screenNumber(this); + popup1->setWindowModality(Qt::WindowModal); + popup1->move( (desktop->screenGeometry(screen).x())+x, (desktop->screenGeometry(screen).y())+y ); + popup1->show(); + + //put the first parameters + SetParameters(treeDet->topLevelItem(0)); + + //initializations + connect(treeDet, SIGNAL(itemDoubleClicked(QTreeWidgetItem *,int)) , this, SLOT(SetParameters(QTreeWidgetItem *))); + +} +//------------------------------------------------------------------------------------------------------------------------------------------------- + +void qTabDebugging::SetParameters(QTreeWidgetItem *item){ + char value[200]; + int i; + + + switch(detType){ + + case slsDetectorDefs::MYTHEN:{ + if(item->text(0).contains("Readout")){ + //find index + for(i=0;icount();i++) + if(item== treeDet->topLevelItem(i)) + break; + + det = myDet->getSlsDetector(i); + lblDetectorId->setText(comboDetector->itemText(i)); + sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SERIAL_NUMBER)); + lblDetectorSerial->setText(QString(value)); + sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_FIRMWARE_VERSION)); + lblDetectorFirmware ->setText(QString(value)); + sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SOFTWARE_VERSION)); + lblDetectorSoftware->setText(QString(value)); + + lblModuleId->setText(""); + lblModuleSerial->setText(""); + lblModuleFirmware->setText(""); + }else{ + //find index + for(i=0;icount();i++) + if(item->parent() == treeDet->topLevelItem(i)) + break; + int im = item->parent()->indexOfChild(item); + + det = myDet->getSlsDetector(i); + lblDetectorId->setText(comboDetector->itemText(i)); + sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SERIAL_NUMBER)); + lblDetectorSerial->setText(QString(value)); + sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_FIRMWARE_VERSION)); + lblDetectorFirmware ->setText(QString(value)); + sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SOFTWARE_VERSION)); + lblDetectorSoftware->setText(QString(value)); + + lblModuleId->setText(QString("%1").arg(im)); + sprintf(value,"%llx",det->getId(slsDetectorDefs::MODULE_SERIAL_NUMBER,im)); + lblModuleSerial->setText(QString(value)); + sprintf(value,"%llx",det->getId(slsDetectorDefs::MODULE_FIRMWARE_VERSION,im)); + lblModuleFirmware->setText(QString(value)); + } + break; + } + + + + + case slsDetectorDefs::EIGER:{ + //only if half module clicked + if(item->text(0).contains("Half Module")){ + //find index + for(i=0;icount();i++) + if(item== treeDet->topLevelItem(i)) + break; + + det = myDet->getSlsDetector(i); + lblDetectorId->setText(comboDetector->itemText(i)); + sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SERIAL_NUMBER)); + lblDetectorSerial->setText(QString(value)); + sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_FIRMWARE_VERSION)); + lblDetectorFirmware ->setText(QString(value)); + sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SOFTWARE_VERSION)); + lblDetectorSoftware->setText(QString(value)); + } + break; + } + + + + + case slsDetectorDefs::GOTTHARD:{ + //find index + for(i=0;icount();i++) + if(item== treeDet->topLevelItem(i)) + break; + + det = myDet->getSlsDetector(i); + lblDetectorId->setText(comboDetector->itemText(i)); + sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SERIAL_NUMBER)); + lblDetectorSerial->setText(QString(value)); + sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_FIRMWARE_VERSION)); + lblDetectorFirmware ->setText(QString(value)); + sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SOFTWARE_VERSION)); + lblDetectorSoftware->setText(QString(value)); + break; + } + + + + default: + break; + } +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabDebugging::TestDetector(){ +#ifdef VERBOSE + cout << "Testing" << endl; +#endif + + int retval=slsDetectorDefs::FAIL; + QString message; + QString Detector = "Detector"; + + //main messagebox title + switch(detType){ + case slsDetectorDefs::MYTHEN: + message = QString("Test Results for %1 and %2:

").arg(comboDetector->currentText(),comboModule->currentText()); + break; + case slsDetectorDefs::EIGER: Detector = "Half Module"; break; + case slsDetectorDefs::GOTTHARD: Detector = "Module"; break; + default: break; + } + + + if(detType==slsDetectorDefs::MYTHEN) + message = QString("Test Results for %1 and %2:

").arg(comboDetector->currentText(),comboModule->currentText()); + else message = QString("Test Results for %1:

").arg(comboDetector->currentText()); + + //get sls det object + det = myDet->getSlsDetector(comboDetector->currentIndex()); + + //detector firmware + if(chkDetectorFirmware->isChecked()){ + retval = det->digitalTest(slsDetectorDefs::DETECTOR_FIRMWARE_TEST); + if(retval== slsDetectorDefs::FAIL) message.append(QString("%1 Firmware: FAIL
").arg(Detector)); + else message.append(QString("%1 Firmware: %2
").arg(Detector,QString::number(retval))); +#ifdef VERBOSE + cout<<"Detector Firmware: "<isChecked()){ + retval = det->digitalTest(slsDetectorDefs::DETECTOR_SOFTWARE_TEST); + if(retval== slsDetectorDefs::FAIL) message.append(QString("%1 Software: FAIL
").arg(Detector)); + else message.append(QString("%1 Software: %2
").arg(Detector,QString::number(retval))); +#ifdef VERBOSE + cout<<"Detector Software: "<isChecked()){ + retval = det->digitalTest(slsDetectorDefs::DETECTOR_BUS_TEST); + if(retval== slsDetectorDefs::FAIL) message.append(QString("%1 Bus:     FAIL
").arg(Detector)); + else message.append(QString("%1 Bus:     %2
").arg(Detector,QString::number(retval))); +#ifdef VERBOSE + cout<<"Detector Bus: "<isChecked()){ + retval = det->digitalTest(slsDetectorDefs::DETECTOR_MEMORY_TEST); + if(retval== slsDetectorDefs::FAIL) message.append(QString("%1 Memory:  FAIL
").arg(Detector)); + else message.append(QString("%1 Memory:  %2
").arg(Detector,QString::number(retval))); +#ifdef VERBOSE + cout<<"Detector Memory: "<isChecked()){ + retval = det->digitalTest(slsDetectorDefs::CHIP_TEST,comboModule->currentIndex()); + if(retval== slsDetectorDefs::FAIL) message.append("
Chip: FAIL
"); + else message.append(QString("Chip: %1
").arg(retval)); +#ifdef VERBOSE + cout<<"Chip: "<isChecked()){ + retval = det->digitalTest(slsDetectorDefs::MODULE_FIRMWARE_TEST,comboModule->currentIndex()); + if(retval== slsDetectorDefs::FAIL) message.append("Module Firmware: FAIL
"); + else message.append(QString("Module Firmware: %1
").arg(retval)); +#ifdef VERBOSE + cout<<"Module Firmware: "<setFixedWidth(100); btnClear->setIcon(QIcon( ":/icons/images/erase.png" )); - gridLayout->addWidget(btnSave,0,0,1,1); - gridLayout->addWidget(btnClear,0,4,1,1); - gridLayout->addWidget(dispLog,1,0,1,5); + gridLayout->addItem(new QSpacerItem(15,10,QSizePolicy::Fixed,QSizePolicy::Fixed),0,0); + gridLayout->addWidget(btnSave,1,0,1,1); + gridLayout->addWidget(btnClear,1,4,1,1); + gridLayout->addItem(new QSpacerItem(15,10,QSizePolicy::Fixed,QSizePolicy::Fixed),2,0); + gridLayout->addWidget(dispLog,3,0,1,5); qout=new qDebugStream(std::cout,this); } From 4527e9f61b11261019ec681472af92e51179c051 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 14 Sep 2012 15:19:09 +0000 Subject: [PATCH 057/332] should be completely done except for mods in mythen for debuggin git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@57 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/slsDetectorGui.pro | 2 +- slsDetectorGui/src/qDetectorMain.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index 4a8021f79..c6eb217ad 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -6,7 +6,7 @@ UI_HEADERS_DIR = forms/include RESOURCES += icons.qrc -DEFINES += VERBOSE #VERYVERBOSE #DACS_INT +DEFINES += VERBOSE DACS_INT #VERYVERBOSE target.path += $(DESTDIR) diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 8d13a7265..21f8e557d 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -155,8 +155,9 @@ void qDetectorMain::SetUpWidgetWindow(){ dockWidgetPlot->setFeatures(QDockWidget::NoDockWidgetFeatures); tabs->setTabEnabled(Developer,isDeveloper); if(!digitalDetector) actionExpert->setEnabled(false); - - +#ifdef VERBOSE + cout << "Advanced Enabled:" << digitalDetector << endl; +#endif // Other setup //Height of plot and central widget heightPlotWindow = dockWidgetPlot->size().height(); From 34d20aa712d7aa53837de32ee2db15c9da0d7521 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Mon, 17 Sep 2012 12:12:25 +0000 Subject: [PATCH 058/332] change filename in plot only when you get to plot git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@58 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qDrawPlot.h | 6 ++- slsDetectorGui/include/qTabPlot.h | 69 +++++++++++++++------------- slsDetectorGui/slsDetectorGui.pro | 2 +- slsDetectorGui/src/qDetectorMain.cpp | 3 +- slsDetectorGui/src/qDrawPlot.cpp | 32 ++++++++----- 5 files changed, 66 insertions(+), 46 deletions(-) diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index 3a5aba2a0..6b9ba3a72 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -52,7 +52,7 @@ public: int GetProgress(){return progress;}; /** sets plot Title */ - void SetPlotTitle(QString title) {boxPlot->setTitle(title);} + void SetPlotTitle(QString title) {plotTitle = title;} /** sets 1D X Axis Title */ void SetHistXAxisTitle(QString title) {histXAxisTitle = title;} /** sets 1D Y Axis Title */ @@ -116,7 +116,7 @@ public slots: @param i is 1 for 1D, else 2D plot */ void SelectPlot(int i=2); /** To select 1D plot */ -void Select1DPlot() {Clear1DPlot();SelectPlot(1);} +void Select1DPlot() {SelectPlot(1);} /** To select 2D plot */ void Select2DPlot() {SelectPlot(2);} /** To clear plot */ @@ -332,6 +332,8 @@ QString histYAxisTitle; std::string histTitle[MAX_1DPLOTS]; /** Title in 2D */ std::string imageTitle; +/** plot Title */ +QString plotTitle; /** 1D or 2D */ unsigned int plot_in_scope; /** Number of Pixels in X Axis */ diff --git a/slsDetectorGui/include/qTabPlot.h b/slsDetectorGui/include/qTabPlot.h index 1be27aed2..538f32e97 100644 --- a/slsDetectorGui/include/qTabPlot.h +++ b/slsDetectorGui/include/qTabPlot.h @@ -42,37 +42,6 @@ public: private: - /** The sls detector object */ - multiSlsDetector *myDet; - - /** The Plot widget */ - qDrawPlot *myPlot; - - /** 1d/2d plot */ - bool isOneD; - bool isOrginallyOneD; - - /**whether to enable nth frame according to timing mode*/ - bool enableNFrame; - - QStackedLayout *stackedLayout; - QSpinBox *spinNthFrame; - QDoubleSpinBox *spinTimeGap; - QComboBox *comboTimeGapUnit; - QButtonGroup *btnGroupScan; - - /** some Default Values */ - static QString defaultPlotTitle; - static QString defaultHistXAxisTitle; - static QString defaultHistYAxisTitle; - static QString defaultImageXAxisTitle; - static QString defaultImageYAxisTitle; - static QString defaultImageZAxisTitle; - - /** scans */ - static const QString modeNames[5]; - - /** methods */ /** Sets up the widget @@ -114,6 +83,12 @@ void SetScanArgument(); void Refresh(); +/** Disables scanbox while running + * @param disable true to disable + */ +//void DisableScanBoxWhileRunning(bool disable); + + private slots: /** Selects the plot to display, enables/disables widgets @@ -140,6 +115,38 @@ void EnableZRange(); void SetPlot(); +private: +/** The sls detector object */ +multiSlsDetector *myDet; + +/** The Plot widget */ +qDrawPlot *myPlot; + +/** 1d/2d plot */ +bool isOneD; +bool isOrginallyOneD; + +/**whether to enable nth frame according to timing mode*/ +bool enableNFrame; + +QStackedLayout *stackedLayout; +QSpinBox *spinNthFrame; +QDoubleSpinBox *spinTimeGap; +QComboBox *comboTimeGapUnit; +QButtonGroup *btnGroupScan; + +/** some Default Values */ +static QString defaultPlotTitle; +static QString defaultHistXAxisTitle; +static QString defaultHistYAxisTitle; +static QString defaultImageXAxisTitle; +static QString defaultImageYAxisTitle; +static QString defaultImageZAxisTitle; + +/** scans */ +static const QString modeNames[5]; + + signals: void DisableZoomSignal(bool); void SetZRangeSignal(double,double); diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index c6eb217ad..5fd91c07c 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -6,7 +6,7 @@ UI_HEADERS_DIR = forms/include RESOURCES += icons.qrc -DEFINES += VERBOSE DACS_INT #VERYVERBOSE +DEFINES += VERBOSE VERYVERBOSE #DACS_INT #VERYVERBOSE target.path += $(DESTDIR) diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 21f8e557d..c97da8e0a 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -246,7 +246,8 @@ void qDetectorMain::Initialization(){ // 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(UpdatingPlotFinished()), tab_plot, SLOT(Refresh())); + //This should not be called as it will change file name to measurement when run finished + //connect(myPlot, SIGNAL(UpdatingPlotFinished()), tab_plot, SLOT(Refresh())); connect(myPlot, SIGNAL(SetCurrentMeasurementSignal(int)), tab_measurement, SLOT(SetCurrentMeasurement(int))); // menubar // Modes Menu diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index b98cfb571..99421e7b8 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -127,6 +127,7 @@ void qDrawPlot::SetupWidgetWindow(){ // Default titles- only for the initial picture histXAxisTitle="Channel Number"; histYAxisTitle="Counts"; + plotTitle = "Measurement"; for(int i=0;igetFilePath().c_str()); fileName = QString(myDet->getFileName().c_str()); + + + // Setting the callback function to get data from detector class + myDet->registerDataCallback(&(GetDataCallBack),this); + //Setting the callback function to alert when acquisition finished from detector class + myDet->registerAcquisitionFinishedCallback(&(GetAcquisitionFinishedCallBack),this); + //Setting the callback function to alert when each measurement finished from detector class + myDet->registerMeasurementFinishedCallback(&(GetMeasurementFinishedCallBack),this); + } @@ -261,6 +271,7 @@ void qDrawPlot::StartStopDaqToggle(bool stop_if_running){ fileName = QString(myDet->getFileName().c_str()); + StartDaq(true); running=!running; } @@ -323,12 +334,6 @@ bool qDrawPlot::StartOrStopThread(bool start){ SetupMeasurement(myDet->getFileIndex()); cout << "Starting new acquisition threadddd ...." << endl; - // Setting the callback function to get data from detector class - myDet->registerDataCallback(&(GetDataCallBack),this); - //Setting the callback function to alert when acquisition finished from detector class - myDet->registerAcquisitionFinishedCallback(&(GetAcquisitionFinishedCallBack),this); - //Setting the callback function to alert when each measurement finished from detector class - myDet->registerMeasurementFinishedCallback(&(GetMeasurementFinishedCallBack),this); // Start acquiring data from server if(!firstTime) pthread_join(gui_acquisition_thread,NULL);//wait until he's finished, ie. exits pthread_create(&gui_acquisition_thread, NULL,DataStartAcquireThread, (void*) this); @@ -353,8 +358,11 @@ void qDrawPlot::SetScanArgument(int scanArg){ #endif scanArgument = scanArg; + if(plot_in_scope==1) Clear1DPlot(); + LockLastImageArray(); + nPixelsX = myDet->getTotalNumberOfChannels(); nPixelsY = 100;//if number of exposures, this should be checked before acquisition @@ -418,7 +426,8 @@ void qDrawPlot::SetupMeasurement(int currentIndex){ currentFrame = 0; //for 2d scans currentScanDivLevel = 0; - lastImageNumber = 0; + //if(plot_in_scope==2) + if(!running) lastImageNumber = 0;/**Just now */ //initializing 2d array for(int py=0;py<(int)nPixelsY;py++) @@ -495,7 +504,7 @@ int qDrawPlot::GetDataCallBack(detectorData *data, void *this_pointer){ int qDrawPlot::GetData(detectorData *data){ #ifdef VERYVERBOSE - cout << "Entering GetDatafunction" << endl; + cout << "******Entering GetDatafunction********" << endl; #endif if(!stop_signal){ @@ -774,7 +783,7 @@ int qDrawPlot::MeasurementFinished(int currentMeasurementIndex, int fileIndex){ void qDrawPlot::SelectPlot(int i){ //1 for 1D otherwise 2D if(i==1){ - Clear1DPlot(); + //Clear1DPlot(); it clears the last measurement plot1D->SetXTitle(histXAxisTitle.toAscii().constData()); plot1D->SetYTitle(histYAxisTitle.toAscii().constData()); plot1D->show(); @@ -810,7 +819,8 @@ void qDrawPlot::UpdatePlot(){ cout << "Entering UpdatePlot function" << endl; #endif plot_update_timer->stop(); - + //set plot title + boxPlot->setTitle(plotTitle); // only if no plot isnt enabled if(plotEnable){ LockLastImageArray(); @@ -1195,7 +1205,7 @@ int qDrawPlot::UpdateTrimbitPlot(bool fromDetector,bool Histogram){ if(histYAxis[0]) delete [] histYAxis[0];histYAxis[0] = new double [nPixelsX]; //initializing for(unsigned int px=0;px Date: Mon, 17 Sep 2012 12:20:01 +0000 Subject: [PATCH 059/332] change filename in plot only when you get to plot git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@59 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_plot.ui | 62 +++------------------------ 1 file changed, 7 insertions(+), 55 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index 3b8c0f53d..1a55404bd 100644 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -357,9 +357,9 @@ - 80 + 10 20 - 271 + 227 26 @@ -367,54 +367,6 @@ 0 - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 18 - 20 - - - - - - - - true - - - - 0 - 0 - - - - Automatic File Name - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 15 - 20 - - - - @@ -427,7 +379,7 @@ - Save All + Save All with Automatic File Name @@ -436,21 +388,21 @@ - 11 + 264 19 - 70 + 76 25 - + 0 0 - 70 + 16777215 16777215 From d01852892ba0e60f10732592a33fd87940ea03a5 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 19 Sep 2012 14:40:27 +0000 Subject: [PATCH 060/332] done git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@60 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_detectormain.ui | 1 - slsDetectorGui/forms/form_tab_advanced.ui | 2 +- slsDetectorGui/include/qDetectorMain.h | 6 +- slsDetectorGui/include/qTabAdvanced.h | 2 + slsDetectorGui/slsDetectorGui.pro | 2 +- slsDetectorGui/src/qDetectorMain.cpp | 191 ++++++++++++---------- slsDetectorGui/src/qDrawPlot.cpp | 102 +++++++----- slsDetectorGui/src/qTabActions.cpp | 8 +- slsDetectorGui/src/qTabAdvanced.cpp | 169 +++++++++++-------- slsDetectorGui/src/qTabDataOutput.cpp | 84 +++++++++- slsDetectorGui/src/qTabDebugging.cpp | 16 +- slsDetectorGui/src/qTabDeveloper.cpp | 11 +- slsDetectorGui/src/qTabMeasurement.cpp | 24 ++- slsDetectorGui/src/qTabPlot.cpp | 14 +- slsDetectorGui/src/qTabSettings.cpp | 34 +++- 15 files changed, 450 insertions(+), 216 deletions(-) diff --git a/slsDetectorGui/forms/form_detectormain.ui b/slsDetectorGui/forms/form_detectormain.ui index 06396987c..60a1a4afe 100644 --- a/slsDetectorGui/forms/form_detectormain.ui +++ b/slsDetectorGui/forms/form_detectormain.ui @@ -241,7 +241,6 @@ &Modes - diff --git a/slsDetectorGui/forms/form_tab_advanced.ui b/slsDetectorGui/forms/form_tab_advanced.ui index 1478fff63..374ac2249 100644 --- a/slsDetectorGui/forms/form_tab_advanced.ui +++ b/slsDetectorGui/forms/form_tab_advanced.ui @@ -656,7 +656,7 @@ Plots Trimbits from Detector. This will take time. - + 405 diff --git a/slsDetectorGui/include/qDetectorMain.h b/slsDetectorGui/include/qDetectorMain.h index d8494a4c0..0e798f0c6 100644 --- a/slsDetectorGui/include/qDetectorMain.h +++ b/slsDetectorGui/include/qDetectorMain.h @@ -123,9 +123,13 @@ private: * */ void Initialization(); + /** Loads config file at start up + * */ + void LoadConfigFile(const string fName); + private slots: -/** Enables modes as selected -Debug, Beamline, Expert, Dockable(calls setdockablemode()) +/** Enables modes as selected -Debug, Expert, Dockable(calls setdockablemode()) * */ void EnableModes(QAction *action); diff --git a/slsDetectorGui/include/qTabAdvanced.h b/slsDetectorGui/include/qTabAdvanced.h index 0f5dd3bab..30462698f 100644 --- a/slsDetectorGui/include/qTabAdvanced.h +++ b/slsDetectorGui/include/qTabAdvanced.h @@ -113,6 +113,8 @@ private: /** Trimming mode */ slsDetectorDefs::trimMode trimmingMode; + bool isEnergy; + bool isAngular; }; diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index 5fd91c07c..bdd716277 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -6,7 +6,7 @@ UI_HEADERS_DIR = forms/include RESOURCES += icons.qrc -DEFINES += VERBOSE VERYVERBOSE #DACS_INT #VERYVERBOSE +DEFINES += VERBOSE #DACS_INT #VERYVERBOSE target.path += $(DESTDIR) diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index c97da8e0a..7ea0fb139 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -48,11 +48,12 @@ 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){ + string configFName = ""; // Getting all the command line arguments for(int iarg=1; iargsetTabEnabled(Debugging,false); - //beamline mode to false tabs->setTabEnabled(Advanced,false); + tabs->setTabEnabled(Developer,isDeveloper); actionLoadTrimbits->setVisible(false); actionSaveTrimbits->setVisible(false); actionLoadCalibration->setVisible(false); actionSaveCalibration->setVisible(false); + dockWidgetPlot->setFloating(false); dockWidgetPlot->setFeatures(QDockWidget::NoDockWidgetFeatures); - tabs->setTabEnabled(Developer,isDeveloper); - if(!digitalDetector) actionExpert->setEnabled(false); -#ifdef VERBOSE - cout << "Advanced Enabled:" << digitalDetector << endl; -#endif + // Other setup //Height of plot and central widget heightPlotWindow = dockWidgetPlot->size().height(); @@ -175,7 +176,7 @@ void qDetectorMain::SetUpDetector(){ //instantiate detector and set window title - myDet = new multiSlsDetector(); + myDet = new multiSlsDetector(detID); string host = myDet->getHostname(); //if hostname doesnt exist even in shared memory @@ -198,11 +199,10 @@ void qDetectorMain::SetUpDetector(){ // Check if type valid. If not, exit slsDetectorDefs::detectorType detType = myDet->getDetectorsType(); switch(detType){ - //digitalDetector decides if trimbits should be shown - case slsDetectorDefs::MYTHEN: digitalDetector = true; break; - case slsDetectorDefs::EIGER: digitalDetector = true; break; - case slsDetectorDefs::GOTTHARD: digitalDetector = false;break; - case slsDetectorDefs::AGIPD: digitalDetector = false;break; + case slsDetectorDefs::MYTHEN: break; + case slsDetectorDefs::EIGER: break; + case slsDetectorDefs::GOTTHARD: actionLoadTrimbits->setText("Load Settings"); actionSaveTrimbits->setText("Save Settings"); break; + case slsDetectorDefs::AGIPD: actionLoadTrimbits->setText("Load Settings"); actionSaveTrimbits->setText("Save Settings"); break; default: string detName = myDet->slsDetectorBase::getDetectorType(detType); string errorMess = host+string(" has unknown detector type \"")+ @@ -236,9 +236,11 @@ void qDetectorMain::Initialization(){ connect(tab_measurement, SIGNAL(EnableNthFrameSignal(bool)), tab_plot,SLOT(EnableNthFrame(bool))); // Data Output Tab connect(tab_dataoutput, SIGNAL(AngularConversionSignal(bool)), tab_actions,SLOT(EnablePositions(bool))); + //enable scanbox( for angles) + connect(tab_dataoutput, SIGNAL(AngularConversionSignal(bool)), tab_plot,SLOT(EnableScanBox())); // Plot tab connect(tab_plot, SIGNAL(DisableZoomSignal(bool)), this,SLOT(SetZoomToolTip(bool))); - // Actions tab (also for angles) + // Actions tab (only for scan) connect(tab_actions, SIGNAL(EnableScanBox()), tab_plot,SLOT(EnableScanBox())); //settings to advanced tab(int=id is always 0 to only refresh) connect(tab_settings, SIGNAL(UpdateTrimbitSignal(int)), tab_advanced,SLOT(UpdateTrimbitPlot(int))); @@ -259,6 +261,23 @@ void qDetectorMain::Initialization(){ } + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qDetectorMain::LoadConfigFile(const string fName){ +#ifdef VERBOSe + cout << "Loading config file at start up:" << fName << endl; +#endif + QString file = QString(fName.c_str());//.section('/',-1); + if((file.contains('.'))&&(QFile::exists(file))){ + if(myDet->readConfigurationFile(fName)!=slsDetectorDefs::FAIL) + qDefs::Message(qDefs::INFORMATION,"The Configuration Parameters have been loaded successfully at start up.","Main"); + else qDefs::Message(qDefs::WARNING,string("Could not load the Configuration Parameters at start up from file:\n")+fName,"Main"); + }else qDefs::Message(qDefs::WARNING,string("Start up configuration failed to load. The following file does not exist:\n")+fName,"Main"); +} + + //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -274,14 +293,6 @@ void qDetectorMain::EnableModes(QAction *action){ #endif } - //Set BeamlineMode - else if(action==actionBeamline){ - enable = actionBeamline->isChecked(); -#ifdef VERBOSE - cout << "Setting Beamline Mode to " << enable << endl; -#endif - } - //Set ExpertMode(comes here only if its a digital detector) else if(action==actionExpert){ enable = actionExpert->isChecked(); @@ -291,13 +302,8 @@ void qDetectorMain::EnableModes(QAction *action){ actionSaveTrimbits->setVisible(enable); actionLoadCalibration->setVisible(enable); actionSaveCalibration->setVisible(enable); - - if(digitalDetector){ - tab_measurement->SetExpertMode(enable); - tab_settings->SetExpertMode(enable); - } - - + tab_measurement->SetExpertMode(enable); + tab_settings->SetExpertMode(enable); #ifdef VERBOSE cout << "Setting Expert Mode to " << enable << endl; #endif @@ -385,33 +391,71 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ } } else if(action==actionLoadTrimbits){ -#ifdef VERBOSE - cout << "Loading Trimbits" << endl; -#endif QString fName = QString(myDet->getSettingsDir()); - fName = QFileDialog::getOpenFileName(this, - tr("Load Detector Trimbits"),fName, - tr("Trimbit files (*.trim noise.sn*)")); - // Gets called when cancelled as well - if (!fName.isEmpty()){ - if(myDet->loadSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) - qDefs::Message(qDefs::INFORMATION,"The Trimbits have been loaded successfully.","Main"); - else qDefs::Message(qDefs::WARNING,string("Could not load the Trimbits from file:\n")+fName.toAscii().constData(),"Main"); + //gotthard + if(actionLoadTrimbits->text().contains("Settings")){ +#ifdef VERBOSE + cout << "Loading Settings" << endl; +#endif + fName = QFileDialog::getOpenFileName(this, + tr("Load Detector Settings"),fName, + tr("Settings files (*.settings settings.sn*)")); + // Gets called when cancelled as well + if (!fName.isEmpty()){ + if(myDet->loadSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) + qDefs::Message(qDefs::INFORMATION,"The Settings have been loaded successfully.","Main"); + else qDefs::Message(qDefs::WARNING,string("Could not load the Settings from file:\n")+fName.toAscii().constData(),"Main"); + } + + }//mythen and eiger + else{ +#ifdef VERBOSE + cout << "Loading Trimbits" << endl; +#endif + + fName = QFileDialog::getOpenFileName(this, + tr("Load Detector Trimbits"),fName, + tr("Trimbit files (*.trim noise.sn*)")); + // Gets called when cancelled as well + if (!fName.isEmpty()){ + if(myDet->loadSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) + qDefs::Message(qDefs::INFORMATION,"The Trimbits have been loaded successfully.","Main"); + else qDefs::Message(qDefs::WARNING,string("Could not load the Trimbits from file:\n")+fName.toAscii().constData(),"Main"); + } } } else if(action==actionSaveTrimbits){ + //gotthard + if(actionLoadTrimbits->text().contains("Settings")){ #ifdef VERBOSE - cout << "Saving Trimbits" << endl; + cout << "Saving Settings" << endl; +#endif + //different output directory so as not to overwrite + QString fName = QString(myDet->getSettingsDir()); + fName = QFileDialog::getSaveFileName(this, + tr("Save Current Detector Settings"),fName, + tr("Settings files (*.settings settings.sn*) ")); + // Gets called when cancelled as well + if (!fName.isEmpty()){ + if(myDet->saveSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) + qDefs::Message(qDefs::INFORMATION,"The Settings have been saved successfully.","Main"); + else qDefs::Message(qDefs::WARNING,string("Could not save the Settings to file:\n")+fName.toAscii().constData(),"Main"); + } + }//mythen and eiger + else{ +#ifdef VERBOSE + cout << "Saving Trimbits" << endl; #endif//different output directory so as not to overwrite - QString fName = QString(myDet->getSettingsDir()); - fName = QFileDialog::getSaveFileName(this, - tr("Save Current Detector Trimbits"),fName, - tr("Trimbit files (*.trim noise.sn*) ")); - // Gets called when cancelled as well - if (!fName.isEmpty()){ - if(myDet->saveSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) - qDefs::Message(qDefs::INFORMATION,"The Trimbits have been saved successfully.","Main"); - else qDefs::Message(qDefs::WARNING,string("Could not save the Trimbits to file:\n")+fName.toAscii().constData(),"Main"); + QString fName = QString(myDet->getSettingsDir()); + fName = QFileDialog::getSaveFileName(this, + tr("Save Current Detector Trimbits"),fName, + tr("Trimbit files (*.trim noise.sn*) ")); + // Gets called when cancelled as well + if (!fName.isEmpty()){ + if(myDet->saveSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) + qDefs::Message(qDefs::INFORMATION,"The Trimbits have been saved successfully.","Main"); + else qDefs::Message(qDefs::WARNING,string("Could not save the Trimbits to file:\n")+fName.toAscii().constData(),"Main"); + } } } else if(action==actionLoadCalibration){ @@ -579,41 +623,20 @@ void qDetectorMain::EnableTabs(){ actionSaveConfiguration->setEnabled(enable); actionMeasurementWizard->setEnabled(enable); actionDebug->setEnabled(enable); - actionBeamline->setEnabled(enable); actionExpert->setEnabled(enable); // special tabs - if(enable==false){ - tabs->setTabEnabled(Debugging,enable); - tabs->setTabEnabled(Advanced,enable); - actionLoadTrimbits->setVisible(false); - actionSaveTrimbits->setVisible(false); - actionLoadCalibration->setVisible(false); - actionSaveCalibration->setVisible(false); - tabs->setTabEnabled(Developer,enable); - } - else{ - // enable these tabs only if they were enabled earlier - if(actionDebug->isChecked()) - tabs->setTabEnabled(Debugging,enable); - if(actionExpert->isChecked()){ - tabs->setTabEnabled(Advanced,enable); - if((enable)&&(digitalDetector)){ - actionLoadTrimbits->setVisible(true); - actionSaveTrimbits->setVisible(true); - actionLoadCalibration->setVisible(true); - actionSaveCalibration->setVisible(true); - }else{ - actionLoadTrimbits->setVisible(false); - actionSaveTrimbits->setVisible(false); - actionLoadCalibration->setVisible(false); - actionSaveCalibration->setVisible(false); - } - } - if(isDeveloper) - tabs->setTabEnabled(Developer,enable); - } + tabs->setTabEnabled(Debugging,enable && (actionDebug->isChecked())); + tabs->setTabEnabled(Developer,enable && isDeveloper); + //expert + bool expertTab = enable && (actionExpert->isChecked()); + tabs->setTabEnabled(Advanced,expertTab); + actionLoadTrimbits->setVisible(expertTab); + actionSaveTrimbits->setVisible(expertTab); + actionLoadCalibration->setVisible(expertTab); + actionSaveCalibration->setVisible(expertTab); + } diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 99421e7b8..c7e12b13b 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -468,13 +468,14 @@ void qDrawPlot::SetupMeasurement(int currentIndex){ endPixel = maxPixelsY + (pixelWidth/2); } } - - cout<<"\nnPixelsY:"<angles==NULL){ + cout<<"\n\nWARNING:RETURNED NULL instead of angles."<values,nAnglePixelsX*sizeof(double)); + SetHistXAxisTitle("Channel Number"); + + } + else{ + + lastImageNumber= currentFrame+1; + nAnglePixelsX = data->npoints; + histNBins = nAnglePixelsX; + nHists=1; + if(histXAngleAxis) delete [] histXAngleAxis; histXAngleAxis = new double[nAnglePixelsX]; + if(histYAngleAxis) delete [] histYAngleAxis; histYAngleAxis = new double[nAnglePixelsX]; + memcpy(histXAngleAxis,data->angles,nAnglePixelsX*sizeof(double)); + memcpy(histYAngleAxis,data->values,nAnglePixelsX*sizeof(double)); + SetHistXAxisTitle("Angles"); + } + pthread_mutex_unlock(&(last_image_complete_mutex)); + } + currentFrame++; + return 0; + } + + + //Nth Frame if(frameFactor){ //plots if numfactor becomes 0 @@ -535,7 +573,7 @@ int qDrawPlot::GetData(detectorData *data){ //Not Nth Frame, to check time out(NOT for 2dScans and angle plots) else{ - if((scanArgument==None)&&(!anglePlot)){ + if(scanArgument==None){ //if the time is not over, RETURN if(!data_pause_over){ return 0; @@ -548,25 +586,6 @@ int qDrawPlot::GetData(detectorData *data){ - //angle plotting - if(anglePlot){ - if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ - lastImageNumber= currentFrame+1; - nAnglePixelsX = data->npoints; - histNBins = nAnglePixelsX; - nHists=1; - if(histXAngleAxis) delete [] histXAngleAxis; histXAngleAxis = new double[nAnglePixelsX]; - if(histYAngleAxis) delete [] histYAngleAxis; histYAngleAxis = new double[nAnglePixelsX]; - memcpy(histXAngleAxis,data->angles,nAnglePixelsX*sizeof(double)); - memcpy(histYAngleAxis,data->values,nAnglePixelsX*sizeof(double)); - pthread_mutex_unlock(&(last_image_complete_mutex)); - } - currentFrame++; - return 0; - } - - - //if scan argument is 2d if(scanArgument!=None){ //alframes @@ -708,9 +727,12 @@ int qDrawPlot::GetAcquisitionFinishedCallBack(double currentProgress,int detecto int qDrawPlot::AcquisitionFinished(double currentProgress, int detectorStatus){ +#ifdef VERBOSE + cout << "\nEntering Acquisition Finished with status " ; +#endif QString status = QString(slsDetectorBase::runStatusType(slsDetectorDefs::runStatus(detectorStatus)).c_str()); #ifdef VERBOSE - cout << "\nEntering Acquisition Finished with status " << status.toAscii().constData() << " and progress " << currentProgress << endl; + cout << status.toAscii().constData() << " and progress " << currentProgress << endl; #endif //error or stopped if((stop_signal)||(detectorStatus==slsDetectorDefs::ERROR)){ @@ -766,7 +788,8 @@ int qDrawPlot::MeasurementFinished(int currentMeasurementIndex, int fileIndex){ cout << "Entering Measurement Finished with currentMeasurement " << currentMeasurementIndex << " and fileIndex " << fileIndex << endl; #endif //to make sure it plots the last frame before setting lastimagearray all to 0 - if(plot_in_scope==2) usleep(500000); + //if(plot_in_scope==2) + usleep(500000); currentMeasurement = currentMeasurementIndex + 1; #ifdef VERBOSE @@ -827,6 +850,9 @@ void qDrawPlot::UpdatePlot(){ //1-d plot stuff if(plot_in_scope==1){ if(lastImageNumber){ +#ifdef VERYVERBOSE + cout << "Last Image Number:" << lastImageNumber << endl; +#endif if(histNBins){ Clear1DPlot(); plot1D->SetXTitle(histXAxisTitle.toAscii().constData()); @@ -902,7 +928,9 @@ void qDrawPlot::UpdatePlot(){ else plot_update_timer->start((int)PLOT_TIMER_MS); } - +#ifdef VERYVERBOSE + cout << "Exiting UpdatePlot function" << endl; +#endif } @@ -1071,20 +1099,6 @@ void qDrawPlot::SavePlot(){ } -//------------------------------------------------------------------------------------------------------------------------------------------------- - -/* - -void qDrawPlot::SaveAll(bool enable){ - string msg = string("The Files will be saved as:\n")+ - string(myDet->getFilePath().c_str())+string("/")+ - string(myDet->getFileName().c_str())+string("[title].png"); - qDefs::Message(qDefs::INFORMATION,msg,"Dock"); - saveAll = enable; -} -*/ - - //------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/slsDetectorGui/src/qTabActions.cpp b/slsDetectorGui/src/qTabActions.cpp index 46d9d5bb6..da533052b 100644 --- a/slsDetectorGui/src/qTabActions.cpp +++ b/slsDetectorGui/src/qTabActions.cpp @@ -324,7 +324,6 @@ void qTabActions::SetPosition(){ qDefs::Message(qDefs::WARNING,"The positions list was not set for some reason.","Actions"); - emit EnableScanBox(); } @@ -375,6 +374,7 @@ void qTabActions::EnablePositions(bool enable){ lblName[NumPositions]->setEnabled(false); btnExpand[NumPositions]->setEnabled(false); } + } @@ -383,7 +383,7 @@ void qTabActions::EnablePositions(bool enable){ void qTabActions::Refresh(){ #ifdef VERBOSE - cout << "\nUpdating all action widgets: " << endl; + cout << endl <<"**Updating all action widgets: " << endl; #endif if((detType == slsDetectorDefs::MYTHEN) || (detType == slsDetectorDefs::GOTTHARD)){ //positions is enabled only if angular conversion is enabled @@ -428,8 +428,10 @@ void qTabActions::Refresh(){ scanWidget[i]->Refresh(); for(int i=0;iRefresh(); - cout << endl; UpdateCollapseColors(); +#ifdef VERBOSE + cout << "**Updated all action widgets: " << endl << endl; +#endif } diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp index 08412ada6..defb1032b 100644 --- a/slsDetectorGui/src/qTabAdvanced.cpp +++ b/slsDetectorGui/src/qTabAdvanced.cpp @@ -21,7 +21,7 @@ using namespace std; qTabAdvanced::qTabAdvanced(QWidget *parent,multiSlsDetector*& detector, qDrawPlot*& plot): - QWidget(parent),myDet(detector),myPlot(plot),btnGroup(NULL){ + QWidget(parent),myDet(detector),myPlot(plot),btnGroup(NULL),isEnergy(false),isAngular(false){ setupUi(this); SetupWidgetWindow(); } @@ -42,27 +42,42 @@ qTabAdvanced::~qTabAdvanced(){ void qTabAdvanced::SetupWidgetWindow(){ //executed even for non digital, so make sure its necessary slsDetectorDefs::detectorType detType = myDet->getDetectorsType(); - if((detType==slsDetectorDefs::MYTHEN)||(detType==slsDetectorDefs::EIGER)){ - outputDirTip = dispFile->toolTip(); - errOutputTip = QString("

" - "Output Trim File should contain both existing directory and a file name.
" - "The extensions are automatically added.

" - "Enter valid Output Trim File to enable Start Trimming button.
"); - red = QPalette(); - red.setColor(QPalette::Active,QPalette::WindowText,Qt::red); - - boxTrimming->setChecked(false); - SetOptimize(false); - - btnGroup = new QButtonGroup(this); - btnGroup->addButton(btnRefresh,0); - btnGroup->addButton(btnGetTrimbits,1); + switch(detType){ + case slsDetectorDefs::MYTHEN: isEnergy = true; isAngular = true; break; + case slsDetectorDefs::EIGER: isEnergy = true; isAngular = false; break; + case slsDetectorDefs::GOTTHARD: isEnergy = false; isAngular = true; break; + default: break; + } + if(!isAngular && !isEnergy) boxLogs->setEnabled(false); + else{ + if(!isAngular) chkAngularLog->setEnabled(false); + if(!isEnergy){ + chkEnergyLog->setEnabled(false); + boxPlot->setEnabled(false); + boxTrimming->setEnabled(false); + } + else{ + outputDirTip = dispFile->toolTip(); + errOutputTip = QString("

" + "Output Trim File should contain both existing directory and a file name.
" + "The extensions are automatically added.

" + "Enter valid Output Trim File to enable Start Trimming button.
"); + red = QPalette(); + red.setColor(QPalette::Active,QPalette::WindowText,Qt::red); + + boxTrimming->setChecked(false); + SetOptimize(false); + + btnGroup = new QButtonGroup(this); + btnGroup->addButton(btnRefresh,0); + btnGroup->addButton(btnGetTrimbits,1); + } + Initialization(); } - } @@ -71,35 +86,38 @@ void qTabAdvanced::SetupWidgetWindow(){ void qTabAdvanced::Initialization(){ //energy/angular logs - connect(chkEnergyLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs())); - connect(chkAngularLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs())); + if(isAngular) + connect(chkEnergyLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs())); - //exptime - connect(spinExpTime, SIGNAL(valueChanged(double)), this, SLOT(SetExposureTime())); - connect(comboExpUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetExposureTime())); + if(isEnergy){ + connect(chkAngularLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs())); - //threshold dac - connect(spinThreshold, SIGNAL(valueChanged(double)), this, SLOT(SetThreshold())); + //exptime + connect(spinExpTime, SIGNAL(valueChanged(double)), this, SLOT(SetExposureTime())); + connect(comboExpUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetExposureTime())); - //output directory - connect(dispFile, SIGNAL(editingFinished()), this, SLOT(SetOutputFile())); - connect(btnFile, SIGNAL(clicked()), this, SLOT(BrowseOutputFile())); + //threshold dac + connect(spinThreshold, SIGNAL(valueChanged(double)), this, SLOT(SetThreshold())); - //enable trimming method group box - connect(boxTrimming, SIGNAL(toggled(bool)), this, SLOT(EnableTrimming(bool))); + //output directory + connect(dispFile, SIGNAL(editingFinished()), this, SLOT(SetOutputFile())); + connect(btnFile, SIGNAL(clicked()), this, SLOT(BrowseOutputFile())); - //trimming method combo - connect(comboMethod, SIGNAL(currentIndexChanged(int)), this, SLOT(SetTrimmingMethod(int))); + //enable trimming method group box + connect(boxTrimming, SIGNAL(toggled(bool)), this, SLOT(EnableTrimming(bool))); - //method options - connect(chkOptimize, SIGNAL(toggled(bool)), this, SLOT(SetOptimize(bool))); + //trimming method combo + connect(comboMethod, SIGNAL(currentIndexChanged(int)), this, SLOT(SetTrimmingMethod(int))); - //start Trimming - connect(btnStart, SIGNAL(clicked()), this, SLOT(StartTrimming())); + //method options + connect(chkOptimize, SIGNAL(toggled(bool)), this, SLOT(SetOptimize(bool))); - //refresh - connect(btnGroup, SIGNAL(buttonClicked(int)), this, SLOT(UpdateTrimbitPlot(int))); + //start Trimming + connect(btnStart, SIGNAL(clicked()), this, SLOT(StartTrimming())); + //refresh + connect(btnGroup, SIGNAL(buttonClicked(int)), this, SLOT(UpdateTrimbitPlot(int))); + } } @@ -295,7 +313,7 @@ void qTabAdvanced::SetTrimmingMethod(int mode){ void qTabAdvanced::StartTrimming(){ - int parameter1, parameter2; + int parameter1=0, parameter2=0; //optimize bool optimize = chkOptimize->isChecked(); @@ -364,45 +382,66 @@ void qTabAdvanced::UpdateTrimbitPlot(int id){ void qTabAdvanced::Refresh(){ - //disconnect - disconnect(chkEnergyLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs())); - disconnect(chkAngularLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs())); - disconnect(spinExpTime, SIGNAL(valueChanged(double)), this, SLOT(SetExposureTime())); - disconnect(comboExpUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetExposureTime())); - disconnect(spinThreshold, SIGNAL(valueChanged(double)), this, SLOT(SetThreshold())); - - //energy/angular logs - chkEnergyLog->setChecked(myDet->getActionMode(slsDetectorDefs::enCalLog)); - chkAngularLog->setChecked(myDet->getActionMode(slsDetectorDefs::angCalLog)); #ifdef VERBOSE - cout << "Energy Calibration Log set to " << chkEnergyLog->isChecked() << endl; - cout << "Angular Calibration Log set to " << chkAngularLog->isChecked() << endl; + cout << endl << "**Updating Advanced Tab" << endl; #endif - //exptime - qDefs::timeUnit unit; - double time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-9)))); + if(isAngular){ #ifdef VERBOSE - cout << "Getting acquisition time : " << time << qDefs::getUnitString(unit) << endl; + cout << "Angular Calibration Log set to " << chkAngularLog->isChecked() << endl; #endif - spinExpTime->setValue(time); - comboExpUnit->setCurrentIndex((int)unit); + + disconnect(chkAngularLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs())); + + chkAngularLog->setChecked(myDet->getActionMode(slsDetectorDefs::angCalLog)); + + connect(chkAngularLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs())); + } - //threshold - double threshold = (double)myDet->setDAC(-1,slsDetectorDefs::THRESHOLD); + if(isEnergy){ + //disconnect + disconnect(chkEnergyLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs())); + disconnect(spinExpTime, SIGNAL(valueChanged(double)), this, SLOT(SetExposureTime())); + disconnect(comboExpUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetExposureTime())); + disconnect(spinThreshold, SIGNAL(valueChanged(double)), this, SLOT(SetThreshold())); + + + //energy/angular logs + chkEnergyLog->setChecked(myDet->getActionMode(slsDetectorDefs::enCalLog)); +#ifdef VERBOSE + cout << "Energy Calibration Log set to " << chkEnergyLog->isChecked() << endl; +#endif + + + //exptime + qDefs::timeUnit unit; + double time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-9)))); +#ifdef VERBOSE + cout << "Getting acquisition time : " << time << qDefs::getUnitString(unit) << endl; +#endif + spinExpTime->setValue(time); + comboExpUnit->setCurrentIndex((int)unit); + + + //threshold + double threshold = (double)myDet->setDAC(-1,slsDetectorDefs::THRESHOLD); #ifdef VERBOSE cout << "Getting Threshold DACu : " << threshold << endl; #endif - spinThreshold->setValue(threshold); + spinThreshold->setValue(threshold); - //connect - connect(chkEnergyLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs())); - connect(chkAngularLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs())); - connect(spinExpTime, SIGNAL(valueChanged(double)), this, SLOT(SetExposureTime())); - connect(comboExpUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetExposureTime())); - connect(spinThreshold, SIGNAL(valueChanged(double)), this, SLOT(SetThreshold())); + //connect + connect(chkEnergyLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs())); + connect(spinExpTime, SIGNAL(valueChanged(double)), this, SLOT(SetExposureTime())); + connect(comboExpUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetExposureTime())); + connect(spinThreshold, SIGNAL(valueChanged(double)), this, SLOT(SetThreshold())); + } + +#ifdef VERBOSE + cout << "**Updated Advanced Tab" << endl << endl; +#endif } diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index 18b68a98e..9096c4471 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -30,8 +30,6 @@ qTabDataOutput::qTabDataOutput(QWidget *parent,multiSlsDetector*& detector): QWidget(parent),myDet(detector){ setupUi(this); SetupWidgetWindow(); - Initialization(); - Refresh(); } @@ -66,6 +64,52 @@ void qTabDataOutput::SetupWidgetWindow(){ QString("" "Enter a valid file to enable Flat Field."); + + Initialization(); + + + // output dir +#ifdef VERBOSE + cout << "Getting output directory" << endl; +#endif + dispOutputDir->setText(QString(myDet->getFilePath().c_str())); + + + //flat field correction from server +#ifdef VERBOSE + cout << "Getting flat field" << endl; +#endif + UpdateFlatFieldFromServer(); + + + //rate correction - not for charge integrating detectors + if((detType == slsDetectorDefs::MYTHEN)||(detType == slsDetectorDefs::EIGER)){ +#ifdef VERBOSE + cout << "Getting rate correction" << endl; +#endif + UpdateRateCorrectionFromServer(); + } + + + //update angular conversion from server + if((detType == slsDetectorDefs::MYTHEN)||(detType == slsDetectorDefs::GOTTHARD)){ +#ifdef VERBOSE + cout << "Getting angular conversion" << endl; +#endif + int ang; + if(myDet->getAngularConversion(ang)) + chkAngular->setChecked(true); + emit AngularConversionSignal(chkAngular->isChecked()); + } + + + //discard bad channels from server +#ifdef VERBOSE + cout << "Getting bad channel correction" << endl; +#endif + if(myDet->getBadChannelCorrection()) chkDiscardBad->setChecked(true); + + } @@ -396,22 +440,56 @@ void qTabDataOutput::DiscardBadChannels(){ void qTabDataOutput::Refresh(){ +#ifdef VERBOSE + cout << endl << "**Updating DataOutput Tab" << endl; +#endif + + // output dir +#ifdef VERBOSE + cout << "Getting output directory" << endl; +#endif dispOutputDir->setText(QString(myDet->getFilePath().c_str())); + + //flat field correction from server +#ifdef VERBOSE + cout << "Getting flat field" << endl; +#endif UpdateFlatFieldFromServer(); + + //rate correction - not for charge integrating detectors - if((detType == slsDetectorDefs::MYTHEN)||(detType == slsDetectorDefs::EIGER)) + if((detType == slsDetectorDefs::MYTHEN)||(detType == slsDetectorDefs::EIGER)){ +#ifdef VERBOSE + cout << "Getting rate correction" << endl; +#endif UpdateRateCorrectionFromServer(); + } + + //update angular conversion from server if((detType == slsDetectorDefs::MYTHEN)||(detType == slsDetectorDefs::GOTTHARD)){ +#ifdef VERBOSE + cout << "Getting angular conversion" << endl; +#endif int ang; if(myDet->getAngularConversion(ang)) chkAngular->setChecked(true); emit AngularConversionSignal(chkAngular->isChecked()); } + + //discard bad channels from server +#ifdef VERBOSE + cout << "Getting bad channel correction" << endl; +#endif if(myDet->getBadChannelCorrection()) chkDiscardBad->setChecked(true); + + +#ifdef VERBOSE + cout << "**Updated DataOutput Tab" << endl << endl; +#endif } diff --git a/slsDetectorGui/src/qTabDebugging.cpp b/slsDetectorGui/src/qTabDebugging.cpp index 93d512f91..d7806ed67 100644 --- a/slsDetectorGui/src/qTabDebugging.cpp +++ b/slsDetectorGui/src/qTabDebugging.cpp @@ -112,6 +112,9 @@ void qTabDebugging::Initialization(){ void qTabDebugging::UpdateModuleList(){ +#ifdef VERBOSE + cout << "Getting Module List" << endl; +#endif det = myDet->getSlsDetector(comboDetector->currentIndex()); //deletes all modules except "all modules" for(int i=0;icount()-1;i++) @@ -127,6 +130,9 @@ void qTabDebugging::UpdateModuleList(){ void qTabDebugging::UpdateStatus(){ +#ifdef VERBOSE + cout << "Getting Status" << endl; +#endif det = myDet->getSlsDetector(comboDetector->currentIndex()); int detStatus = (int)det->getRunStatus(); string status = slsDetectorBase::runStatusType(slsDetectorDefs::runStatus(detStatus)); @@ -140,6 +146,9 @@ void qTabDebugging::UpdateStatus(){ void qTabDebugging::GetInfo(){ +#ifdef VERBOSE + cout << "Getting Info" << endl; +#endif //window QFrame* popup1 = new QFrame(this, Qt::Popup | Qt::SubWindow ); QList items; @@ -477,8 +486,13 @@ void qTabDebugging::TestDetector(){ void qTabDebugging::Refresh(){ +#ifdef VERBOSE + cout << endl << "**Updating Debugging Tab" << endl; +#endif UpdateStatus(); - +#ifdef VERBOSE + cout << "**Updated Debugging Tab" << endl << endl; +#endif } diff --git a/slsDetectorGui/src/qTabDeveloper.cpp b/slsDetectorGui/src/qTabDeveloper.cpp index fdc2e43d5..32a00201d 100644 --- a/slsDetectorGui/src/qTabDeveloper.cpp +++ b/slsDetectorGui/src/qTabDeveloper.cpp @@ -313,7 +313,11 @@ void qTabDeveloper::RefreshAdcs(){ void qTabDeveloper::Refresh(){ #ifdef VERBOSE - cout << "Updating Dacs and Adcs" <setToolTip(tipHV); comboHV->setToolTip(tipHV); //getting hv value - int ret = myDet->setDAC(-1,slsDetectorDefs::HV_POT); + int ret = (int)myDet->setDAC(-1,slsDetectorDefs::HV_POT); switch(ret){ case 0: comboHV->setCurrentIndex(0);break; case 90: comboHV->setCurrentIndex(1);break; @@ -353,6 +357,9 @@ void qTabDeveloper::Refresh(){ connect(comboHV, SIGNAL(currentIndexChanged(int)), this, SLOT(SetHighVoltage())); } +#ifdef VERBOSE + cout << "**Updated Developer Tab" << endl << endl; +#endif } diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 4032474ec..801618133 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -726,16 +726,35 @@ void qTabMeasurement::EnableFileWrite(bool enable){ void qTabMeasurement::Refresh(){ +#ifdef VERBOSE + cout << endl << "**Updating Measurement Tab" << endl; +#endif + if(!myPlot->isRunning()){ + //Number of measurements +#ifdef VERBOSE + cout << "Getting number of measurements" << endl; +#endif spinNumMeasurements->setValue((int)myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,-1)); + + //File Name +#ifdef VERBOSE + cout << "Getting file name" << endl; +#endif dispFileName->setText(QString(myDet->getFileName().c_str())); + //File Index +#ifdef VERBOSE + cout << "Getting file index" << endl; +#endif spinIndex->setValue(myDet->getFileIndex());cout<<"file index:"<getFileIndex()<setText(QString::number(myDet->getFileIndex())); - //Timing mode* + + //Timing mode SetupTimingMode(); // to let qdrawplot know that triggers or frames are used @@ -743,6 +762,9 @@ void qTabMeasurement::Refresh(){ myPlot->setTriggerEnabled(lblNumTriggers->isEnabled()); } +#ifdef VERBOSE + cout << "**Updated Measurement Tab" << endl << endl; +#endif } diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index c56919add..d4ba8a550 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -506,9 +506,9 @@ void qTabPlot::EnableScanBox(){ //if it was checked before or disabled before, it remembers to check it again bool checkedBefore = boxScan->isChecked();//||(!boxScan->isEnabled())); - + int ang; //none of these scan plotting options make sense if positions>0 - bool positionsExist = myDet->getPositions(); + bool positionsExist = myDet->getAngularConversion(ang);//myDet->getPositions(); //only now enable/disable boxScan->setEnabled((mode0||mode1)&&(!positionsExist)); @@ -603,6 +603,7 @@ void qTabPlot::SetScanArgument(){ } Select1DPlot(isOrginallyOneD); + int ang; //if scans(1D or 2D) if(boxScan->isEnabled()){ //setting the title according to the scans @@ -613,7 +614,8 @@ void qTabPlot::SetScanArgument(){ Select1DPlot(isOrginallyOneD); }//angles (1D) - else if(myDet->getPositions()){ + else if(myDet->getAngularConversion(ang)){ + //else if(myDet->getPositions()){ //if scan, change title if((myDet->getScanMode(0))||(myDet->getScanMode(1))){ QString mainTitle = QString(" Level 0 : ") + modeNames[myDet->getScanMode(0)] + @@ -674,6 +676,9 @@ void qTabPlot::SetScanArgument(){ void qTabPlot::Refresh(){ +#ifdef VERBOSE + cout << endl << "**Updating Plot Tab" << endl; +#endif if(!myPlot->isRunning()){ connect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox())); SetFrequency(); @@ -682,6 +687,9 @@ void qTabPlot::Refresh(){ disconnect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox())); boxScan->setEnabled(false); } +#ifdef VERBOSE + cout << "**Updated Plot Tab" << endl << endl; +#endif } diff --git a/slsDetectorGui/src/qTabSettings.cpp b/slsDetectorGui/src/qTabSettings.cpp index 1b3812ab3..068811924 100644 --- a/slsDetectorGui/src/qTabSettings.cpp +++ b/slsDetectorGui/src/qTabSettings.cpp @@ -56,6 +56,7 @@ void qTabSettings::SetupWidgetWindow(){ // Dynamic Range switch(myDet->setDynamicRange(-1)){ case 32: comboDynamicRange->setCurrentIndex(0); break; + case 24: comboDynamicRange->setCurrentIndex(0); break; case 16: comboDynamicRange->setCurrentIndex(1); break; case 8: comboDynamicRange->setCurrentIndex(2); break; case 4: comboDynamicRange->setCurrentIndex(3); break; @@ -214,10 +215,11 @@ void qTabSettings::SetDynamicRange(int index){ case 3: dr=4; break; default: dr=32; break; } + ret=myDet->setDynamicRange(dr); + if((ret==24)&&(dr==32)) dr = ret; #ifdef VERBOSE cout << "Setting dynamic range to "<< dr << endl; #endif - ret=myDet->setDynamicRange(dr); if(ret!=dr){ qDefs::Message(qDefs::WARNING,"Dynamic Range cannot be set to this value.","Settings"); #ifdef VERBOSE @@ -225,6 +227,7 @@ void qTabSettings::SetDynamicRange(int index){ #endif switch(ret){ case 32: comboDynamicRange->setCurrentIndex(0); break; + case 24: comboDynamicRange->setCurrentIndex(0); break; case 16: comboDynamicRange->setCurrentIndex(1); break; case 8: comboDynamicRange->setCurrentIndex(2); break; case 4: comboDynamicRange->setCurrentIndex(3); break; @@ -246,11 +249,10 @@ void qTabSettings::SetEnergy(){ int ret = (int)myDet->getThresholdEnergy(); if((ret-index)>200){ qDefs::Message(qDefs::WARNING,"Threshold energy could not be set. The difference is greater than 200.","Settings"); - disconnect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy())); - spinThreshold->setValue(ret); - connect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy())); } - + disconnect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy())); + spinThreshold->setValue(ret); + connect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy())); } @@ -258,19 +260,34 @@ void qTabSettings::SetEnergy(){ void qTabSettings::Refresh(){ +#ifdef VERBOSE + cout << endl << "**Updating Settings Tab" << endl; +#endif + // Settings +#ifdef VERBOSE + cout << "Getting settings" << endl; +#endif SetupDetectorSettings(); //changin the combo settings also plots the trimbits for mythen and eiger, so disconnect disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int))); comboSettings->setCurrentIndex(myDet->getSettings()); connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int))); + // Number of Modules +#ifdef VERBOSE + cout << "Getting number of modules" << endl; +#endif spinNumModules->setValue(myDet->setNumberOfModules()); // Dynamic Range +#ifdef VERBOSE + cout << "Getting dynamic range" << endl; +#endif switch(myDet->setDynamicRange(-1)){ case 32: comboDynamicRange->setCurrentIndex(0); break; + case 24: comboDynamicRange->setCurrentIndex(0); break; case 16: comboDynamicRange->setCurrentIndex(1); break; case 8: comboDynamicRange->setCurrentIndex(2); break; case 4: comboDynamicRange->setCurrentIndex(3); break; @@ -287,11 +304,16 @@ void qTabSettings::Refresh(){ }else{ lblThreshold->setEnabled(true); spinThreshold->setEnabled(true); +#ifdef VERBOSE + cout << "Getting threshold energy" << endl; +#endif SetEnergy(); } } - +#ifdef VERBOSE + cout << "**Updated Settings Tab" << endl << endl; +#endif } From 4f1c03c879ac1dfa79ceca6b744a25ff2855ddc1 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 19 Sep 2012 15:10:28 +0000 Subject: [PATCH 061/332] removed possible chances of a shared memory access during acquisition, start button to entable tabs, to refresh plot tab and startstoptoggle git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@61 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/slsDetectorGui.pro | 2 +- slsDetectorGui/src/qDetectorMain.cpp | 8 +++++++- slsDetectorGui/src/qDrawPlot.cpp | 4 ++-- slsDetectorGui/src/qTabMeasurement.cpp | 2 -- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index bdd716277..c05de4cf7 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -6,7 +6,7 @@ UI_HEADERS_DIR = forms/include RESOURCES += icons.qrc -DEFINES += VERBOSE #DACS_INT #VERYVERBOSE +DEFINES += VERBOSE #VERYVERBOSE #DACS_INT #VERYVERBOSE target.path += $(DESTDIR) diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 7ea0fb139..130347adb 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -230,7 +230,6 @@ void qDetectorMain::Initialization(){ connect(tabs, SIGNAL(currentChanged(int)), this, SLOT(Refresh(int)));//( QWidget*))); // Measurement tab connect(tab_measurement, SIGNAL(StartSignal()), this,SLOT(EnableTabs())); - connect(tab_measurement, SIGNAL(StartSignal()), tab_plot,SLOT(Refresh())); connect(tab_measurement, SIGNAL(StopSignal()), myPlot,SLOT(StopAcquisition())); connect(tab_measurement, SIGNAL(CheckPlotIntervalSignal()), tab_plot,SLOT(SetFrequency())); connect(tab_measurement, SIGNAL(EnableNthFrameSignal(bool)), tab_plot,SLOT(EnableNthFrame(bool))); @@ -637,6 +636,13 @@ void qDetectorMain::EnableTabs(){ actionLoadCalibration->setVisible(expertTab); actionSaveCalibration->setVisible(expertTab); + //moved to here, so that its all in order, instead of signals and different threads + if(!enable) { + //set the plot type first(acccss shared memory) + tab_plot->Refresh(); + //sets running to true + myPlot->StartStopDaqToggle(); + } } diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index c7e12b13b..3e93a902a 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -354,7 +354,7 @@ bool qDrawPlot::StartOrStopThread(bool start){ void qDrawPlot::SetScanArgument(int scanArg){ #ifdef VERBOSE - cout << "SetScanArgument function" << endl; + cout << "SetScanArgument function:" << running << endl; #endif scanArgument = scanArg; @@ -415,7 +415,7 @@ void qDrawPlot::SetScanArgument(int scanArg){ void qDrawPlot::SetupMeasurement(int currentIndex){ #ifdef VERBOSE - cout << "SetupMeasurement function" << endl; + cout << "SetupMeasurement function:" << running << endl; #endif LockLastImageArray(); diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 801618133..fb720ef0f 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -306,8 +306,6 @@ void qTabMeasurement::startStopAcquisition(){ progressTimer->start(100); emit StartSignal(); - - myPlot->StartStopDaqToggle(); }else{ #ifdef VERBOSE cout << "Stopping Acquisition" << endl<< endl; From 12eeebb4397600625743a480d5d328727e6f21d0 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Thu, 20 Sep 2012 09:25:44 +0000 Subject: [PATCH 062/332] done git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@62 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/slsDetectorGui.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index c05de4cf7..06aed327f 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -6,7 +6,7 @@ UI_HEADERS_DIR = forms/include RESOURCES += icons.qrc -DEFINES += VERBOSE #VERYVERBOSE #DACS_INT #VERYVERBOSE +DEFINES += VERBOSE DACS_INT #VERYVERBOSE target.path += $(DESTDIR) From 8c250ed26aebd008c6215f27fcf32201c7ee236e Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Thu, 20 Sep 2012 10:12:05 +0000 Subject: [PATCH 063/332] modified makefile git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@63 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/Makefile | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 slsDetectorGui/Makefile diff --git a/slsDetectorGui/Makefile b/slsDetectorGui/Makefile new file mode 100644 index 000000000..098e2a751 --- /dev/null +++ b/slsDetectorGui/Makefile @@ -0,0 +1,16 @@ +PROG= bin/slsDetectorGui +DIR= $(shell ls src/* slsDetectorPlotting/include/* slsDetectorPlotting/src/* include/* forms/include/*) + + +all: $(PROG) + + +clean: Makefile.gui + +Makefile.gui: slsDetectorGui.pro + if test -e Makefile.gui; then make -f Makefile.gui clean;fi + qmake -o Makefile.gui + +$(PROG): Makefile.gui $(DIR) + make -f Makefile.gui + From cd0d1976bc8e5c6c95be8bee787c09b387d11fa5 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Thu, 20 Sep 2012 10:19:27 +0000 Subject: [PATCH 064/332] changed qw dir git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@64 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/slsDetectorGui.pro | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index 06aed327f..fdced7387 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -20,7 +20,7 @@ QMAKE_CLEAN += docs/*/* \ LIBS += -Wl,-Bstatic -L../slsDetectorSoftware -lSlsDetector -Wl,-Bdynamic\ - -L/usr/local/qwt-5.2.3-svn/lib -lqwt + -L$(QWTDIR)/lib -lqwt DEPENDPATH += \ slsDetectorPlotting/include\ @@ -29,7 +29,7 @@ DEPENDPATH += \ INCLUDEPATH += \ - /usr/local/qwt-5.2.3-svn/include\ + $(QWTDIR)/include\ slsDetectorPlotting/include\ include\ forms/include\ From 1273a3b1a1adac8bfe54a47e891d52f70d700a75 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 21 Sep 2012 08:32:47 +0000 Subject: [PATCH 065/332] added images git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@65 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/images/add.png | Bin 0 -> 702 bytes slsDetectorGui/images/browse.png | Bin 0 -> 884 bytes slsDetectorGui/images/close.png | Bin 0 -> 812 bytes slsDetectorGui/images/download.png | Bin 0 -> 757 bytes slsDetectorGui/images/erase.png | Bin 0 -> 606 bytes slsDetectorGui/images/new.png | Bin 0 -> 644 bytes slsDetectorGui/images/refresh.png | Bin 0 -> 1066 bytes slsDetectorGui/images/refresher.png | Bin 0 -> 692 bytes slsDetectorGui/images/remove.png | Bin 0 -> 359 bytes slsDetectorGui/images/save.png | Bin 0 -> 674 bytes slsDetectorGui/images/saveAll.png | Bin 0 -> 755 bytes slsDetectorGui/images/start.png | Bin 0 -> 499 bytes slsDetectorGui/images/stop.png | Bin 0 -> 519 bytes 13 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 slsDetectorGui/images/add.png create mode 100644 slsDetectorGui/images/browse.png create mode 100644 slsDetectorGui/images/close.png create mode 100644 slsDetectorGui/images/download.png create mode 100644 slsDetectorGui/images/erase.png create mode 100644 slsDetectorGui/images/new.png create mode 100644 slsDetectorGui/images/refresh.png create mode 100644 slsDetectorGui/images/refresher.png create mode 100644 slsDetectorGui/images/remove.png create mode 100644 slsDetectorGui/images/save.png create mode 100644 slsDetectorGui/images/saveAll.png create mode 100644 slsDetectorGui/images/start.png create mode 100644 slsDetectorGui/images/stop.png diff --git a/slsDetectorGui/images/add.png b/slsDetectorGui/images/add.png new file mode 100644 index 0000000000000000000000000000000000000000..41058cb95b43ea515e63af40db2cd073aeca295f GIT binary patch literal 702 zcmV;v0zv(WP)1q-7w5~B+@y1;1LYYA}!E91t5 zh5vwiNWemXXrdw!Ap~3GO!ogM(leRGnSAq`lkc1%_)k3Pzh|F~eRohA zM@zxo;f|_jBdK&G)nU!sa(nm9UhiahobIc;xRKYY4*dSm_}tbzk`|z-C(GG(xy@s} zkgsJ4%+9al)7p@$zh$N?EkI6JhP%G}s$6fql+1t3&0#9|RUW^y_$n8hQ)C@lv;0gp@T10tZpx zVbYsWXe?Bthsrg=bTZERGj*O!vjngSuq*|~Fv-nQ3PO`UBCaODBt-Z&mhjCtgFbjXLGq9CdqqPemL&?y?= z5$YJ088!(fn$VtN7|jEYK~9bleBn+Kh7BXaksW9Tfv^O;pjD@fspKfp@UIK)u;UO8 z#5D`FlBte3ii<6dQkw*Wq=SDdiq);4m#5S#=ve6VtjZJS?-htpcl>`fnN2k=q&_d%<&w6^F={VkxH8j4NnX_ke km83du9qqpVdN7slFQ6jV?;TlEGXMYp07*qoM6N<$f-}%XkN^Mx literal 0 HcmV?d00001 diff --git a/slsDetectorGui/images/browse.png b/slsDetectorGui/images/browse.png new file mode 100644 index 0000000000000000000000000000000000000000..e9404d3c772872d463c93bf26de9d2e800e9ff93 GIT binary patch literal 884 zcmV-)1B?8LP);q5rm76K07J!Ka0GhwY61!ZRF*5UA2DyY?g<0Rk-a@MJ(5+ zHLxOFR_9oj=~|}g8iwIIPUUd>BM0900k&<^{^y?m zZ)F~98*U(2V=Y3eFfPQIqu-8p(%yZ;U!`j|?d;v&hH$+_MN&X6Lq3zmLbi;|sY~bx zox}35f!d&nP)$Gr0>aQWQM_3?LUZ^a*I zTxR&9e*nz&0EcMn=I(l!k$kYZ7|1d#B| zjc4h@H=f!RiQf0+wb~ApLmZ8D0wqTvogv&Q9K==-O7jyiSgtB&o|s9`F*TEUj1IrP zXKUw%_V50@E_)h|fmt?Kr3}3&+jldGa~Ee5^wz;$ zo!k1l#)O=;a>YSzp$J`7WZMita7<2RaQ>=>!J)??WIFljQ3!e2EA;q8vYSSR6RRKX z?>-L+5Z;y|!Iw-vRodlL4!@-X*w&vwz2zcx_8TAm!!H-s(F?mDZWrG&79(xw-dg zSy0pKYOOX?S9Ayx1O>eMPX%AXErDh1g{Bz{uDv&&`02#)_x=WEKdZf*W|Axb0000< KMNUMnLSTZ$TB^tZ literal 0 HcmV?d00001 diff --git a/slsDetectorGui/images/close.png b/slsDetectorGui/images/close.png new file mode 100644 index 0000000000000000000000000000000000000000..7173b4e900f1afa29b76665b007fa2c0975402ac GIT binary patch literal 812 zcmV+{1JnG8P)Nkl*%=J3^|9P;U7ReSmr}X zWO%qWHZv1bSlAzQm%~9-K>;-t6)o>z-cfk`8!%YfTmfbAW^-a}##(eHBRWk(^(cC} z!Rvu;j|Zg`wU;hYRbAbD4`PeqqYp3#RxO5tnB>_QCr2|XEr+@bCo$TaP~93fr(*Pm zE!1DRimS4cn!-ZLJ)U#NV5RB@S{77H)oGJPq)wrGS`yavJ8(O`QNA|~SIZ}2b5Ap9 zR3x?6i)q-k8+XlX-q>tiM_`yTL5R%rIouyDG{K0|9DsXTIx{l&()rCsd-DedM~vfD zNfB@I)?jJ*j^n+PCNG?U1!@>fJOIyz28oK3!EY$OpZ4*2%*)>C6YxdZEvoj+C)&?V zS0gw?#pZT64;e}Xj23@iS^^3$ifjr*ID2yS?a{gFUyuoV(} zT`+8f%QIyj%>tpDbBW8@$4A-RcySS?0dDj$*+irs;`8HDo@XZ0^+X!+(zsTV>a%e; z%sK(3;+Vl3su-EJ8e7F#foW9Lc7c!-~?%)bO)sLh@O4ZIv_;=>mb`9S~_KuM?#`>5)_xf z+#tN3J5Y2G*13Ih{&ksT1%$!$B~l=UBuGYrvzut@V^{k92b^{xflesy^Fj;PZzw z#PoDXJnL&owAVX`VW&tKge4J|*HFd8>>3TEmTg4n8ML*_4e?{GZo{I^3KNK~V|Ya~ z%uP;(Fq~bn6aLXF$04yQ+SXzOTxoQH>KgjzqK3KeGYUrZh(yS}A$h-LN915j`M)ce zpEvy;R)L0x)9c%wlwv8U;Ek4W65I*6{N|l&dz(uYaLfvxXCsHZO%CRPj@!WmGeie8 zb`-q`O3triBpY!PbPtr*n7!dWO)i}CX!xC`_`yyV{F%aa$fR$2pjeiz?qYjNcA=VWo787bmFDo z366PiVR{2&ixD85-U2v(ts-Kjc|d=;PnVR?E{Wt53$o;8hTm-k&u(>cH3?+0Oz9$o z$+HxpVKEQr>NVBbtKY@asiSJX8`=FAM7Zs4)Ju(&e+Nt)Yes<+-mh3Fcj+HiR_0UAZvU^{yI)dUTiZ{R z0k=bg!dUHpthGV{ zMy7v^On=}1`4eOE{LM7-~PU0 z<%o6s^koIsFgT*46Uy@I*V2D~AU6M#muF_bfA7zahFa#oKY#sw%ES`q`}5awtg*01 zLnDae%a;}Zftm$MOaJ|rkYMI`_Vmw}+G^&%fByb`#KaaC{_DqbbQgmSm^fjAu9>*_ z-mfJkA`(?qfBz{du`pb|^ygzO&}JaG1Js=I>pO;KumS1m>B?ngWyksW_(Wele*B-2 zgM;z!zI}gQ7ZouBE&h9xnIkUu*H^5X!3G!_8nOaY*9ucp)1ZI<{xQ6I{N(=&PY(vB zPoMtoVq}f${qqB-X1EvRf3E+}!0-#GZo#WwvA;n43l<9;Kr9F}L`*-fp%tt9u=eSa`D_PJjOTD)cBNqUaZ&a5C{Pg1Q0gTg%xE5gP#X+wd)Ex z1fL}q4GE88Px7h7)JYD=WU~!G^JfO41ujJ{qOxDb@%BCNo98TXl+5B&CXMiHEXV;l zMd1M3MXg$eJLE>+4nHn<&f>`KZcDtB{eYKp2(L2>8VBT6^)G;~>+rt!;PjRgIPdAj zvG!g|{3R2{D>;m}TBKwH4yqd)l3^Gez{XmwhWfF8pl z2NVj0Uw~$^vzUv|VPJg#L@S|h=P66PphlomgBZbO4k#9jl4+WM09aJ%Im~>V!K6Bg zRb$oq)+uyi`R4Kshq5~DShBg(>Fl7j!~vyJNn(ZY4*-iwr2^U}s1625^?=9C93=k>P%f9LeHlqv z#`d;0bNv4J*qdPR0d39T04kE~o_~k1{?q9+;_)T)^mJorcz9y!`P3M7WLWxEK&u0G z7ZRd~wI6Hd^ozj6bRckB({#grXdFO^9AG=K0pAl+b#!FtPH2Aqp}lh}U@Ogi*gWbK eEYo(()`g$Q@+i;+HXEb>0000SBT^vI!PPa~u&Iw5sX}w;5uKr)~>k_M_ zOCOs^Y8f{jaTDp%I2OIts!>2)Lo8oEt65R1*G_@I#csw2C7X;zDjkBkJ0g5|%$Pd& ziJVSgWWF)0bA@yC%g}QrR>gY7|B62@(CtdwRkISifd)we21l<+RBZdudj=4GAt5f zaQLTH^XY5y1+VlD$@_CwIo*8F_DIWKrOHF#tK#+hIl`A;>(_7ouK455pUVor zk9iur-}NHn^!A8-cXA62&oV18FtRXlFu8agVEVkldfMxzpmaXDnyP;--^BY5Zw zcg@)wrYGM2@l-zh-knbKrmM~QWqRI5Vf9JpDHk~!^Q+d)e4LtG6wdbJ%Ja``92POh zvkK4d+$;Rt?%yK4y4l&g`GRiF{qV-iNx=Et?PKXzZ+?_}eCp-DGwi#)br&@mtT>l` z;nFPD+>E7uFK4|k)}A9_)fHjYd^_H%;na(%WqIO%5!@N_Gn)%~zRL7Mx9jlZj>EaTZ|d38!=M#$!5=J$uneJ9MC zee1)EZE;h2PgZwE?N*-h4v++*q6#CVE9FeJ$f%d|Rd0vnnLgsU<+Kw{KtR zp54g?mDfLiUjN2&^M%Ld$yW9e9V(Z2nS$SOb}-EEXz>VYSyj}e88nBbW?9MG>+e3d z-@9G^d6%Dleb)Iy0^zxD-5*4GuC)7Ud3B4KqQURbUcZxFFFFd^*1SA)^3Ffm!`(sU zKNdf)`ghN%=Im^b^zwy9^X?z{GRyYblMltt^KB)KRxu_RSD1xPS3RNOK) zGT3m%)C7q54UIM#8EiK)xn{OugOLFPgX3*hk#yT@3t&2P^HVa@Dlv6#;W0GXVr076 c$lwA@=Lc31&-dNWfjSvHUHx3vIVCg!0Bl_6kN^Mx literal 0 HcmV?d00001 diff --git a/slsDetectorGui/images/refresher.png b/slsDetectorGui/images/refresher.png new file mode 100644 index 0000000000000000000000000000000000000000..df73f0121697f6104522e5cd659f43b8557c1d05 GIT binary patch literal 692 zcmV;l0!#ggP)b}m3`L>S|E~SzSC1|9%W%UKs=9|B-*@mN79e z`SbFUKQF(t3pjFYxxNFXWs$bH4xfDss)7x22!ybgpyFOgxX# z-a{_c{kXm)#VLx61%>PLVI%s1FZ9; zkqz#zqYkh^(NN&)VKpK-Kn{?`E79qE1wX3J`n7^hec%DOBOO(JMfr?fkBpe}7YBZ#r&rjI7riFeG z^nAyGMUSm@b@fn*IFS?Y#GC6PNfJDcMmVb1Q63H>76PGYHhaG3Vb?U_8U}36VUa+W z5?HN}Ethy%EHIr+kWy|+vR1WTzvjR(oT4#R3&OfTYo`+raHF`3HYn@BuDEQPCHgIEVlM002ovPDHLk FV1iJCmf-*Z literal 0 HcmV?d00001 diff --git a/slsDetectorGui/images/save.png b/slsDetectorGui/images/save.png new file mode 100644 index 0000000000000000000000000000000000000000..ff544b86d2666ba2efe9f51d3b7d5a3fe6d36b91 GIT binary patch literal 674 zcmV;T0$u%yP)fO(2(25PHxkDSqIgB4{fpMTz)TZOm6=h_pn~yT#9AinKPVNt(v5 z*rHWYv4{#%sUXsN(UL^zp?L9BA=oxGF}vf;n|w6To4d@uxAWfo=KtP|0RQ<2?BhM> zU8c_ZGcGTfx0pc?1UjH(xi11in@VS3d@KoiNy_!#9N2&Wm(xX<{oE@e`Qd(q@H*O^rww zY3EquSU^=(P!$#aDn}C=K>7g)b&vazNX`LluC_(+M-v)1W8{w6wM&psb)T7{qx)odE%_-n{0~ z1N-(@0KV=n80;T_{x1>mL%Vv#5;E-k^O zE0?kRWyq~i7)#JmfR5gS$q!RJvU}&QJar`I+nf#<3WXrIvH}--dsp>SfOs^9rReo~ zRPgEZ3j!C)*lz0pS(b68)X31Uh%u=#!AFENV2#Q{9zq4=Q8AFXGH8HA6EPAoQmr6h zz{kS1D|fnJfg6fICBzV@5HX~dwy~w1hxgtogCv~Hoim+#&UgNM&Xgc+EzK==qtWPt zy!^wcao>O_2moOhfgsR3eHQ3Vq|dUVU}Wee)_gnDHhkIZehA0aB zJqsXY8^FAxD(LTfjFn&zq_LqPB@n?->25^Up=>QF9mqVZPA^`0HW0vvx8rbLaN+CZ zBvymVAa%8MDy!1e)&aZSz9mQlaQSHv{q3LrhGE}xoOhOBX4+2`EP>R!ud6Jfxvd>X zkK|)FQ&bg-qH@59&x^A~#h9C+fMp7(t+~blO}9Fb&lE5@s+Op-M0Fbwn486@ZvX{_ z#h9PBj=Xp>>dovT_b^x3(iQ z%a+dEb{a%evbgXa?_PQNUUGAjPD%tRy?lj-pK-cy;9w?yDbUWb#<2~B&Rmfdq+|)J zON;pO=_699Bogri%w{vlCD%oD*Ul00|5auXVPG-N!Xh2ea?^vSPx_HaB+%8<&5y#2`9}|XA=5-wHJMCe zllFig^<2Se9Z=U$kHHr{F7IAFm@ez>YFJIK({zghHXnN0Y#w$>Y5`FWoWiO@gN@%g^KH zsv6UEskNuWXUUV;(@0Wfl9FIWbG)Hbo$0eG~YCF^h+ix0)cV> zG;1C>hxP#8X@B2n%>+5RC9`S)h+pbc p@!(TQb&I`F--M4KelGnlE&yfqzY#-b#(n?*002ovPDHLkV1k6C;06Ey literal 0 HcmV?d00001 diff --git a/slsDetectorGui/images/stop.png b/slsDetectorGui/images/stop.png new file mode 100644 index 0000000000000000000000000000000000000000..316926dee6739c3ff3488dfe7e51ea4519b28916 GIT binary patch literal 519 zcmV+i0{H!jP)C$-sf5A8 z%4#!MTB2y$y57C#-RXs+s);Xocgy#F?|bk25d1Tc^|?Gg_N#Yy zdpvd$E0w_1bui!Fz!0l37<@(@9m%fY;a3~Dh(yAjq0ky+vw}p`kK`P<&j;73R5+AK z#O&wn9maL0ze2-iq4=1Ombkzao1<>vHkwCrXN@P!IH^x8SB+CrADj9U$0m1_4 z@kpeJ{cK^Sraod0=K|O$m4O)n^ePewn19SbIUXbqDczu34ltz%Kvd9NBk))TwjE$X z06j7$eukl$^Xi+$q`qJVXNF04bf=AN(rmDZV)aD~nn>{dvia5OfH)vu$KbY(&#l~> zaT|zrAuW54$1@q!;EXZ`_b4;?9OXcOKex8C Date: Fri, 21 Sep 2012 08:37:34 +0000 Subject: [PATCH 066/332] Makefile with clean label addded git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@66 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/Makefile | 5 +++-- slsDetectorGui/include/qDetectorMain.h | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/slsDetectorGui/Makefile b/slsDetectorGui/Makefile index 098e2a751..e7b2ca5e7 100644 --- a/slsDetectorGui/Makefile +++ b/slsDetectorGui/Makefile @@ -5,10 +5,11 @@ DIR= $(shell ls src/* slsDetectorPlotting/include/* slsDetectorPlotting/src/* in all: $(PROG) -clean: Makefile.gui +clean: + if test -e Makefile.gui; then make -f Makefile.gui clean; make -f Makefile.gui mocclean; fi + Makefile.gui: slsDetectorGui.pro - if test -e Makefile.gui; then make -f Makefile.gui clean;fi qmake -o Makefile.gui $(PROG): Makefile.gui $(DIR) diff --git a/slsDetectorGui/include/qDetectorMain.h b/slsDetectorGui/include/qDetectorMain.h index 0e798f0c6..cc595ac1f 100644 --- a/slsDetectorGui/include/qDetectorMain.h +++ b/slsDetectorGui/include/qDetectorMain.h @@ -27,6 +27,7 @@ class multiSlsDetector; #include #include #include +#include #include using namespace std; From 197de5c9950d96140e43696f1977a0d16fa2cace Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 21 Sep 2012 10:14:03 +0000 Subject: [PATCH 067/332] checked in the change about config file at the very start of gui and gui version git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@67 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qDefs.h | 3 +++ slsDetectorGui/include/qDetectorMain.h | 3 ++- slsDetectorGui/src/qDetectorMain.cpp | 21 ++++++++++++--------- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/slsDetectorGui/include/qDefs.h b/slsDetectorGui/include/qDefs.h index e66dc5757..a117438ac 100644 --- a/slsDetectorGui/include/qDefs.h +++ b/slsDetectorGui/include/qDefs.h @@ -19,6 +19,9 @@ public: /** Empty Constructor */ qDefs(){}; +//------------------------------------------------------------------------------------------------------------------------------------------------- + +#define GUI_VERSION 0.1 //------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/slsDetectorGui/include/qDetectorMain.h b/slsDetectorGui/include/qDetectorMain.h index cc595ac1f..b4ec2cdb6 100644 --- a/slsDetectorGui/include/qDetectorMain.h +++ b/slsDetectorGui/include/qDetectorMain.h @@ -117,8 +117,9 @@ private: void SetUpWidgetWindow(); /**Sets up detector + * @param fName file name of the config file at start up * */ - void SetUpDetector(); + void SetUpDetector(const string fName); /**Sets up the signals and the slots * */ diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 130347adb..907ff9c14 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -64,11 +64,9 @@ qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app, QWidget * } setupUi(this); - SetUpDetector(); + SetUpDetector(configFName); SetUpWidgetWindow(); Initialization(); - if(!configFName.empty()) LoadConfigFile(configFName); - } @@ -172,11 +170,16 @@ void qDetectorMain::SetUpWidgetWindow(){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void qDetectorMain::SetUpDetector(){ +void qDetectorMain::SetUpDetector(const string fName){ //instantiate detector and set window title myDet = new multiSlsDetector(detID); + + //loads the config file at startup + if(!fName.empty()) LoadConfigFile(fName); + + //gets the hostname if it worked string host = myDet->getHostname(); //if hostname doesnt exist even in shared memory @@ -271,9 +274,9 @@ void qDetectorMain::LoadConfigFile(const string fName){ QString file = QString(fName.c_str());//.section('/',-1); if((file.contains('.'))&&(QFile::exists(file))){ if(myDet->readConfigurationFile(fName)!=slsDetectorDefs::FAIL) - qDefs::Message(qDefs::INFORMATION,"The Configuration Parameters have been loaded successfully at start up.","Main"); - else qDefs::Message(qDefs::WARNING,string("Could not load the Configuration Parameters at start up from file:\n")+fName,"Main"); - }else qDefs::Message(qDefs::WARNING,string("Start up configuration failed to load. The following file does not exist:\n")+fName,"Main"); + qDefs::Message(qDefs::INFORMATION,"The Configuration Parameters have been loaded successfully at start up.","Main"); + else qDefs::Message(qDefs::WARNING,string("Could not load the Configuration Parameters at start up from file:
")+fName,"Main"); + }else qDefs::Message(qDefs::WARNING,string("Start up configuration failed to load. The following file does not exist:
")+fName,"Main"); } @@ -506,14 +509,14 @@ void qDetectorMain::ExecuteHelp(QAction *action){ string thisClientVersion = string(version); //

A heading

qDefs::Message(qDefs::INFORMATION,"

" - "SLS Detector GUI version: 1.0
" + "SLS Detector GUI version: " + string(QString("%1").arg(GUI_VERSION).toAscii().constData())+"
" "SLS Detector Client version: "+thisClientVersion+"

" "Common GUI to control the SLS Detectors: " "Mythen, Eiger, Gotthard and Agipd.

" "It can be operated in parallel with the command line interface:
" "sls_detector_put,
sls_detector_get,
sls_detector_acquire and
sls_detector_help.

" "The GUI Software is still in progress. " - "Please report bugs to dhanya.maliakal@psi.ch.<\\p>","About SLS Detector GUI"); + "Please report bugs to dhanya.maliakal@psi.ch or anna.bergamaschi@psi.ch.<\\p>","About SLS Detector GUI"); } } From a79c5c61838f71ca58818f9c914b8ac008a3ba35 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 25 Sep 2012 07:22:04 +0000 Subject: [PATCH 068/332] fixed advanced tab, optimize settings, threshold and exposure time enabling, histogram plotting crashing git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@68 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_advanced.ui | 10 +-- slsDetectorGui/include/qDefs.h | 2 +- slsDetectorGui/include/qDrawPlot.h | 4 + slsDetectorGui/src/qDrawPlot.cpp | 90 ++++++++++++----------- slsDetectorGui/src/qTabAdvanced.cpp | 24 +++--- slsDetectorGui/src/qTabSettings.cpp | 4 +- 6 files changed, 70 insertions(+), 64 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_advanced.ui b/slsDetectorGui/forms/form_tab_advanced.ui index 374ac2249..26b6b7045 100644 --- a/slsDetectorGui/forms/form_tab_advanced.ui +++ b/slsDetectorGui/forms/form_tab_advanced.ui @@ -60,7 +60,7 @@ true - false + true @@ -120,7 +120,7 @@ - false + true @@ -167,7 +167,7 @@ - false + true @@ -339,7 +339,7 @@ An extension given by the modules serial number will be attached. - false + true @@ -402,7 +402,7 @@ An extension given by the modules serial number will be attached. - false + true diff --git a/slsDetectorGui/include/qDefs.h b/slsDetectorGui/include/qDefs.h index a117438ac..b87f47158 100644 --- a/slsDetectorGui/include/qDefs.h +++ b/slsDetectorGui/include/qDefs.h @@ -21,7 +21,7 @@ public: qDefs(){}; //------------------------------------------------------------------------------------------------------------------------------------------------- -#define GUI_VERSION 0.1 +#define GUI_VERSION 0.11 //------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index 6b9ba3a72..6ea6d18d8 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -369,6 +369,10 @@ double* histYAxis[MAX_1DPLOTS]; double* histXAngleAxis; /** Y Axis for angles in 1D (no persistency) */ double* histYAngleAxis; +/** X Axis for trimbits in 1D */ +double* histTrimbits; + + /** Current Image Values in 2D */ double* lastImageArray; diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 3e93a902a..4332132b0 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -82,7 +82,7 @@ void qDrawPlot::SetupWidgetWindow(){ histNBins = 0; histXAxis = 0; histXAngleAxis = 0; - histYAngleAxis = 0; + histYAngleAxis = 0;histTrimbits=0; persistency = 0; currentPersistency = 0; @@ -1190,90 +1190,98 @@ void qDrawPlot::DisableZoom(bool disable){ int qDrawPlot::UpdateTrimbitPlot(bool fromDetector,bool Histogram){ int ret,i,actualPixelsX; - double *temp; + //double *temp=0,*trimXAxis=0,*trimYAxis=0; #ifdef VERBOSE - if(fromDetector) cout << "Geting Trimbits from Detector: "; - else cout << "Getting Trimbits from Shared Memory: "; - if(Histogram) cout << "Histogram" << endl; - else cout << "Data Graph" << endl; + if(fromDetector) cout << "Geting Trimbits from Detector" << endl; + else cout << "Getting Trimbits from Shared Memory" << endl; #endif + slsDetectorDefs::detectorType detType = myDet->getDetectorsType(); + if(detType == slsDetectorDefs::MYTHEN){ - switch(myDet->getDetectorsType()){ - - - case slsDetectorDefs::MYTHEN: //get trimbits actualPixelsX = myDet->getTotalNumberOfChannels(); - temp = new double[actualPixelsX]; - ret = myDet->getChanRegs(temp,fromDetector); + if(histTrimbits) delete [] histTrimbits; histTrimbits = new double[actualPixelsX]; + ret = myDet->getChanRegs(histTrimbits,fromDetector); if(!ret){ qDefs::Message(qDefs::WARNING,"No Trimbit data found in shared memory.","Dock"); return qDefs::FAIL; } - +#ifdef VERBOSE + cout << "Got Trimbits" << endl; +#endif //defining axes - if(Histogram) nPixelsX = TRIM_HISTOGRAM_XMAX; + if(Histogram) nPixelsX = TRIM_HISTOGRAM_XMAX+1; else nPixelsX = actualPixelsX; - if(histXAxis) delete [] histXAxis; histXAxis = new double [nPixelsX]; - if(histYAxis[0]) delete [] histYAxis[0];histYAxis[0] = new double [nPixelsX]; + + if(histXAxis) delete [] histXAxis; histXAxis = new double [nPixelsX]; + if(histYAxis[0]) delete [] histYAxis[0]; histYAxis[0]= new double [nPixelsX]; //initializing - for(unsigned int px=0;pxsetTitle("Trimbits Plot - Data Graph"); plot1D->SetXTitle("Channel Number"); plot1D->SetYTitle("Trimbits"); //set plot parameters SlsQtH1D* h; - plot1D_hists.append(h=new SlsQtH1D("1d plot",nPixelsX,histXAxis,GetHistYAxis(0))); + plot1D_hists.append(h=new SlsQtH1D("1d plot",nPixelsX,histXAxis,histYAxis[0])); h->SetLineColor(1); h->setTitle(GetHistTitle(0)); //attach plot h->Attach(plot1D); - }else{ - //data - for(i=0;i=0)){ + value = (int) histTrimbits[i]; + histYAxis[0][value]++; + } + else cout<<"OUT OF BOUNDS:"<0)) cout<<"HIsty["<setTitle("Trimbits Plot - Histogram"); plot1D->SetXTitle("Trimbits"); plot1D->SetYTitle("Frequency"); //set plot parameters SlsQtH1D* h; - plot1D_hists.append(h=new SlsQtH1D("1d plot",nPixelsX,histXAxis,GetHistYAxis(0))); + plot1D_hists.append(h=new SlsQtH1D("1d plot",nPixelsX,histXAxis,histYAxis[0])); h->SetLineColor(1); h->setTitle(GetHistTitle(0)); //attach plot h->Attach(plot1D); - } + + + #ifdef VERBOSE cout << "Trimbits Plot updated" << endl; #endif - break; + } + else if(detType == slsDetectorDefs::EIGER){ - //2d - case slsDetectorDefs::EIGER: //defining axes nPixelsX = 100;/**??*/ nPixelsY = 100; @@ -1299,16 +1307,10 @@ int qDrawPlot::UpdateTrimbitPlot(bool fromDetector,bool Histogram){ #ifdef VERBOSE cout << "Trimbits Plot updated" << endl; #endif - break; - - - - - - //shouldnt be here - default: - break; } + + + return qDefs::OK; } diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp index defb1032b..05da30fe2 100644 --- a/slsDetectorGui/src/qTabAdvanced.cpp +++ b/slsDetectorGui/src/qTabAdvanced.cpp @@ -353,17 +353,17 @@ void qTabAdvanced::StartTrimming(){ //execute int ret = myDet->executeTrimming(trimmingMode,parameter1,parameter2,-1); + if((ret!=slsDetectorDefs::FAIL)&&(ret!=-1)); + else + qDefs::Message(qDefs::WARNING,"Atleast 1 channel could not be trimmed.","Advanced"); + //save trim file + ret = myDet->saveSettingsFile(string(dispFile->text().toAscii().constData()),-1); if((ret!=slsDetectorDefs::FAIL)&&(ret!=-1)){ - //save trim file - ret = myDet->saveSettingsFile(string(dispFile->text().toAscii().constData()),-1); - if((ret!=slsDetectorDefs::FAIL)&&(ret!=-1)) - qDefs::Message(qDefs::INFORMATION,"The Trimbits have been saved successfully.","Advanced"); - else qDefs::Message(qDefs::WARNING,string("Could not Save the Trimbits to file:\n")+dispFile->text().toAscii().constData(),"Advanced"); + qDefs::Message(qDefs::INFORMATION,"The Trimbits have been saved successfully.","Advanced"); //updates plots myPlot->UpdateTrimbitPlot(false,radioHistogram->isChecked()); } - else - qDefs::Message(qDefs::WARNING,"Atleast 1 channel could not be trimmed.","Advanced"); + else qDefs::Message(qDefs::WARNING,string("Could not Save the Trimbits to file:\n")+dispFile->text().toAscii().constData(),"Advanced"); } @@ -371,10 +371,12 @@ void qTabAdvanced::StartTrimming(){ void qTabAdvanced::UpdateTrimbitPlot(int id){ - //refresh - if(!id) myPlot->UpdateTrimbitPlot(false,radioHistogram->isChecked()); - //from detector - else myPlot->UpdateTrimbitPlot(true,radioHistogram->isChecked()); + if(boxPlot->isChecked()){ + //refresh + if(!id) myPlot->UpdateTrimbitPlot(false,radioHistogram->isChecked()); + //from detector + else myPlot->UpdateTrimbitPlot(true,radioHistogram->isChecked()); + } } diff --git a/slsDetectorGui/src/qTabSettings.cpp b/slsDetectorGui/src/qTabSettings.cpp index 068811924..b68652894 100644 --- a/slsDetectorGui/src/qTabSettings.cpp +++ b/slsDetectorGui/src/qTabSettings.cpp @@ -70,7 +70,6 @@ void qTabSettings::SetupWidgetWindow(){ void qTabSettings::SetupDetectorSettings(){ // Get detector settings from detector slsDetectorDefs::detectorSettings sett = myDet->getSettings(); - // To be able to index items on a combo box model = qobject_cast(comboSettings->model()); if (model) { @@ -268,10 +267,9 @@ void qTabSettings::Refresh(){ #ifdef VERBOSE cout << "Getting settings" << endl; #endif - SetupDetectorSettings(); //changin the combo settings also plots the trimbits for mythen and eiger, so disconnect disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int))); - comboSettings->setCurrentIndex(myDet->getSettings()); + SetupDetectorSettings();//comboSettings->setCurrentIndex(myDet->getSettings()); connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int))); From bf8a1ec0d26ced7cdc73fcd5cd88e3a6cf963e19 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 25 Sep 2012 11:31:15 +0000 Subject: [PATCH 069/332] fixed constant scan widget problem git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@69 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qScanWidget.h | 33 +++- slsDetectorGui/src/qScanWidget.cpp | 215 ++++++++++++++++++++++----- 2 files changed, 208 insertions(+), 40 deletions(-) diff --git a/slsDetectorGui/include/qScanWidget.h b/slsDetectorGui/include/qScanWidget.h index 317d1e21c..24e820c14 100644 --- a/slsDetectorGui/include/qScanWidget.h +++ b/slsDetectorGui/include/qScanWidget.h @@ -121,19 +121,42 @@ void SetPrecision(int value); * */ void SetNSteps(); -/** Range type: If size is changed, - * the Number of steps is calculated +/**Checks if size is zero and return FAIL if it does * */ -void RangeCalculateNumSteps(); +int RangeCheckSizeZero(); -/** Range type: If size is changed, the To is calculated +/**returns ok and number of steps if valid + * @param number of steps * */ -void RangeCalculateTo(); +int RangeCheckNumValid(int &num); + +/** Sets number of steps if from changed + * */ +void RangeFromChanged(); + +/** Sets number of steps if to changed + * */ +void RangeToChanged(); + +/** Sets s of steps if size changed + * */ +void RangeSizeChanged(); /** Set range for scan * */ void SetRangeSteps(); + +/** Range type: If size is changed, + * the Number of steps is calculated + * */ +//void RangeCalculateNumSteps(); + +/** Range type: If size is changed, the To is calculated + * */ +//void RangeCalculateTo(); + + /** Set custom steps * returns OK if set properly * */ diff --git a/slsDetectorGui/src/qScanWidget.cpp b/slsDetectorGui/src/qScanWidget.cpp index 50f4d50cb..3b748a364 100644 --- a/slsDetectorGui/src/qScanWidget.cpp +++ b/slsDetectorGui/src/qScanWidget.cpp @@ -89,6 +89,7 @@ void qScanWidget::SetupWidgetWindow(){ spinFrom->setValue(0); spinFrom->setToolTip(rangeTip); spinFrom->setMaximum(1000000); + spinFrom->setMinimum(-1000000); spinFrom->setKeyboardTracking(false); spinFrom->setFixedWidth(80); spinFrom->setDecimals(4); @@ -97,6 +98,7 @@ void qScanWidget::SetupWidgetWindow(){ spinTo->setValue(1); spinTo->setToolTip(rangeTip); spinTo->setMaximum(1000000); + spinTo->setMinimum(-1000000); spinTo->setKeyboardTracking(false); spinTo->setFixedWidth(80); spinTo->setDecimals(4); @@ -104,12 +106,15 @@ void qScanWidget::SetupWidgetWindow(){ lblSize->setToolTip(rangeTip); lblSize->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); lblSize->setFixedWidth(67); + spinSize->setMaximum(1000000); + spinSize->setMinimum(-1000000); spinSize->setValue(1); spinSize->setSingleStep(0.1); spinSize->setToolTip(rangeTip); spinSize->setKeyboardTracking(false); spinSize->setDecimals(4); - spinSize->setMinimum(0.0001); + + //spinSize->setMinimum(0.0001); layoutRange->addItem(new QSpacerItem(40,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); layoutRange->addWidget(lblFrom); layoutRange->addItem(new QSpacerItem(5,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); @@ -188,9 +193,9 @@ void qScanWidget::Initialization(){ //precision connect(spinPrecision, SIGNAL(valueChanged(int)), this, SLOT(SetPrecision(int))); //range values - connect(spinFrom, SIGNAL(valueChanged(double)), this, SLOT(RangeCalculateNumSteps())); - connect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(RangeCalculateNumSteps())); - connect(spinSize, SIGNAL(valueChanged(double)), this, SLOT(RangeCalculateTo())); + connect(spinFrom, SIGNAL(valueChanged(double)), this, SLOT(RangeFromChanged())); + connect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(RangeToChanged())); + connect(spinSize, SIGNAL(valueChanged(double)), this, SLOT(RangeSizeChanged())); //custom values connect(comboCustom, SIGNAL(currentIndexChanged(int)), this, SLOT(SetCustomSteps())); connect(btnCustom, SIGNAL(clicked()), this, SLOT(DeleteCustomSteps())); @@ -246,11 +251,13 @@ void qScanWidget::EnableSizeWidgets(){ stackedLayout->setCurrentIndex(RangeValues); - int oldNumSteps = spinSteps->value(); - //if the steps change, it calls SetRangeSteps on its own. - RangeCalculateNumSteps(); - if(oldNumSteps==spinSteps->value()) SetRangeSteps(); + //recaluculate number of steps + disconnect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps())); + spinSteps->setValue(1+(int)(abs((spinTo->value() - spinFrom->value()) / spinSize->value()))); + connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps())); + spinSteps->setMinimum(2); + SetRangeSteps(); } //custom values else if(radioCustom->isChecked()){ @@ -542,12 +549,11 @@ void qScanWidget::SetNSteps(){ //check if its ok if(radioRange->isChecked()){ - double oldSize = spinSize->value(); - //calculate size = (to - from)/(num-1) - double size = (abs((spinTo->value())-(spinFrom->value()))) / (spinSteps->value()-1); - spinSize->setValue(size); - //set these positions - if(oldSize==size) SetRangeSteps(); + disconnect(spinSize, SIGNAL(valueChanged(double)), this, SLOT(RangeSizeChanged())); + spinSize->setValue( (spinTo->value()-spinFrom->value()) / (spinSteps->value()-1)); + connect(spinSize, SIGNAL(valueChanged(double)), this, SLOT(RangeSizeChanged())); + + SetRangeSteps(); }else if(radioCustom->isChecked()){ comboCustom->setMaxCount(spinSteps->value()); SetCustomSteps(); @@ -561,39 +567,178 @@ void qScanWidget::SetNSteps(){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void qScanWidget::RangeCalculateNumSteps(){ +int qScanWidget::RangeCheckSizeZero(){ #ifdef VERYVERBOSE - cout << "Entering RangeCalculateNumSteps()" << endl; + cout << "Entering RangeCheckSizeZero()" << endl; #endif - //check if to=from - if(spinTo->value()==spinFrom->value()){ - spinTo->setValue( ((spinSize->value())*(spinSteps->value())) - (spinSize->value()) + (spinFrom->value()) ); - SetRangeSteps(); - }else{ - //num = ((to-from)/(size)) +1 - double size = spinSize->value(); - double numerator = abs((spinTo->value())-(spinFrom->value())); - //check if (to-from)/size is an int and that its =1 cuz numSteps minimum=2 - bool valid = (fmod(numerator,size)==0) && ((numerator/size)>0); + if((spinTo->value()-spinFrom->value())/(spinSteps->value()-1)) + return qDefs::OK; - if(valid) //calculate num steps - spinSteps->setValue( (int)(numerator / size) + 1); - else //change size instead - spinSize->setValue(numerator / (spinSteps->value()-1)); - } + return qDefs::FAIL; } //------------------------------------------------------------------------------------------------------------------------------------------------- -void qScanWidget::RangeCalculateTo(){ +int qScanWidget::RangeCheckNumValid(int &num){ #ifdef VERYVERBOSE - cout << "Entering RangeCalculateTo()" << endl; + cout << "Entering RangeCheckNumValid()" << endl; #endif - //to = size*num - size + from - spinTo->setValue( ((spinSize->value())*(spinSteps->value())) - (spinSize->value()) + (spinFrom->value()) ); + double div = abs(spinTo->value()-spinFrom->value())/(abs(spinSize->value())); + cout<<"div:"<=1 + if((floor(div)==div) && (div>0)){ + num = (int)(div) + 1; + return qDefs::OK; + } + + return qDefs::FAIL; +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qScanWidget::RangeFromChanged(){ +#ifdef VERYVERBOSE + cout << "Entering RangeFromChanged()" << endl; +#endif + bool change = false; + int numSteps; + + disconnect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps())); + disconnect(spinFrom, SIGNAL(valueChanged(double)), this, SLOT(RangeFromChanged())); + disconnect(spinSize, SIGNAL(valueChanged(double)), this, SLOT(RangeSizeChanged())); + + + //check size validity + if(RangeCheckSizeZero()==qDefs::FAIL) + qDefs::Message(qDefs::WARNING,"
From cannot be equal to To. Changing From back to previous value.","Scan"); + //check size validity + else if(RangeCheckNumValid(numSteps)==qDefs::FAIL) + qDefs::Message(qDefs::WARNING,"Number of Steps must be >= 2. Changing From back to previous value.","Scan"); + else change = true; + + //change it back from = to - size*num + size + if(!change) { + spinFrom->setValue(spinTo->value() - (spinSize->value() * spinSteps->value()) + spinSize->value()); +#ifdef VERBOSE + cout << "Changing From back:"<< spinFrom->value() << endl; +#endif + } + //change num steps + else{ + spinSteps->setValue(numSteps); + //size will lnever be zero here + //size should be positive + if(spinTo->value()>spinFrom->value()) + spinSize->setValue(abs(spinSize->value())); + //size should be negative + else if(spinSize->value()>0) + spinSize->setValue(-1*(spinSize->value())); + } + SetRangeSteps(); + + connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps())); + connect(spinFrom, SIGNAL(valueChanged(double)), this, SLOT(RangeFromChanged())); + connect(spinSize, SIGNAL(valueChanged(double)), this, SLOT(RangeSizeChanged())); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qScanWidget::RangeToChanged(){ +#ifdef VERYVERBOSE + cout << "Entering RangeToChanged()" << endl; +#endif + bool change = false; + int numSteps; + + disconnect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps())); + disconnect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(RangeToChanged())); + disconnect(spinSize, SIGNAL(valueChanged(double)), this, SLOT(RangeSizeChanged())); + + //check size validity + if(RangeCheckSizeZero()==qDefs::FAIL) + qDefs::Message(qDefs::WARNING,"From cannot be equal to To. Changing To back to previous value.","Scan"); + //check size validity + else if(RangeCheckNumValid(numSteps)==qDefs::FAIL) + qDefs::Message(qDefs::WARNING,"Number of Steps must be >= 2. Changing To back to previous value.","Scan"); + else change = true; + + //change it back to = size*num - size + from + if(!change) { + spinTo->setValue((spinSize->value() * spinSteps->value()) - spinSize->value() + spinFrom->value()); +#ifdef VERBOSE + cout << "Changing To back:"<< spinTo->value() << endl; +#endif + } + //change num steps + else{ + spinSteps->setValue(numSteps); + //size will lnever be zero here + //size should be positive + if(spinTo->value()>spinFrom->value()) + spinSize->setValue(abs(spinSize->value())); + //size should be negative + else if(spinSize->value()>0) + spinSize->setValue(-1*(spinSize->value())); + + } + + SetRangeSteps(); + + connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps())); + connect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(RangeToChanged())); + connect(spinSize, SIGNAL(valueChanged(double)), this, SLOT(RangeSizeChanged())); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qScanWidget::RangeSizeChanged(){ +#ifdef VERYVERBOSE + cout << "Entering RangeSizeChanged()" << endl; +#endif + bool change = false; + int numSteps; + + disconnect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps())); + disconnect(spinSize, SIGNAL(valueChanged(double)), this, SLOT(RangeSizeChanged())); + disconnect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(RangeToChanged())); + + //check size validity + if(!spinSize->value()) + qDefs::Message(qDefs::WARNING,"Size cannot be 0. Changing Size back to previous value.","Scan"); + //check size validity + else if(RangeCheckNumValid(numSteps)==qDefs::FAIL) + qDefs::Message(qDefs::WARNING,"Number of Steps must be >= 2. Changing To back to previous value.","Scan"); + else change = true; + + //change it back size = (to-from)/(num-1) + if(!change) { + spinSize->setValue((spinTo->value()-spinFrom->value())/(spinSteps->value()-1)); +#ifdef VERBOSE + cout << "Changing Size back:"<< spinSize->value() << endl; +#endif + } + //change num steps + else{ + spinSteps->setValue(numSteps); + //in case size changed to negative + spinTo->setValue((spinSize->value() * spinSteps->value()) - spinSize->value() + spinFrom->value()); + } + + SetRangeSteps(); + + connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps())); + connect(spinSize, SIGNAL(valueChanged(double)), this, SLOT(RangeSizeChanged())); + connect(spinTo, SIGNAL(valueChanged(double)), this, SLOT(RangeToChanged())); } From e6e991bc64dadc2cbdb865a275e1ce59bd12ab2e Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 25 Sep 2012 11:34:18 +0000 Subject: [PATCH 070/332] fixed constant scan widget problem git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@70 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qDefs.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/slsDetectorGui/include/qDefs.h b/slsDetectorGui/include/qDefs.h index b87f47158..529c43631 100644 --- a/slsDetectorGui/include/qDefs.h +++ b/slsDetectorGui/include/qDefs.h @@ -99,6 +99,12 @@ public: static double getCorrectTime(timeUnit& unit, double value){ int intUnit = (int)SECONDS; + /**0 ms*/ + if(!value){ + unit = MILLISECONDS; + return value; + } + /** hr, min, sec */ if(value>=1){ double newVal = value; From d56780d906a7eac05fcb5c9c8b030af3e0492f90 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 25 Sep 2012 11:44:49 +0000 Subject: [PATCH 071/332] bug fixed: must wait to get data for scans git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@71 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qDrawPlot.cpp | 108 +++++++++++++++++-------------- 1 file changed, 60 insertions(+), 48 deletions(-) diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 4332132b0..6a2714344 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -590,16 +590,19 @@ int qDrawPlot::GetData(detectorData *data){ if(scanArgument!=None){ //alframes if(scanArgument==AllFrames){ - if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ - //variables - lastImageNumber= currentFrame+1; - //title - char temp_title[2000]; - sprintf(temp_title,"Image Index %d",fileIOStatic::getFileIndexFromFileName(string(data->fileName))); - imageTitle = temp_title; - //copy data - memcpy(lastImageArray+(currentScanDivLevel*nPixelsX),data->values,nPixelsX*sizeof(double)); - pthread_mutex_unlock(&(last_image_complete_mutex)); + while(1){ + if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ + //variables + lastImageNumber= currentFrame+1; + //title + char temp_title[2000]; + sprintf(temp_title,"Image Index %d",fileIOStatic::getFileIndexFromFileName(string(data->fileName))); + imageTitle = temp_title; + //copy data + memcpy(lastImageArray+(currentScanDivLevel*nPixelsX),data->values,nPixelsX*sizeof(double)); + pthread_mutex_unlock(&(last_image_complete_mutex)); + break; + } } currentFrame++; currentScanDivLevel++; @@ -607,18 +610,21 @@ int qDrawPlot::GetData(detectorData *data){ } //file index if(scanArgument==FileIndex){ - if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ - //variables - int currentIndex = fileIOStatic::getFileIndexFromFileName(string(data->fileName)); - if(currentIndex == minPixelsY) currentScanDivLevel = 0; - lastImageNumber= currentFrame+1; - //title - char temp_title[2000]; - sprintf(temp_title,"Image Index %d",currentIndex); - imageTitle = temp_title; - //copy data - for(unsigned int px=0;pxvalues[px]; - pthread_mutex_unlock(&(last_image_complete_mutex)); + while(1){ + if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ + //variables + int currentIndex = fileIOStatic::getFileIndexFromFileName(string(data->fileName)); + if(currentIndex == minPixelsY) currentScanDivLevel = 0; + lastImageNumber= currentFrame+1; + //title + char temp_title[2000]; + sprintf(temp_title,"Image Index %d",currentIndex); + imageTitle = temp_title; + //copy data + for(unsigned int px=0;pxvalues[px]; + pthread_mutex_unlock(&(last_image_complete_mutex)); + break; + } } currentFrame++; currentScanDivLevel++; @@ -626,16 +632,41 @@ int qDrawPlot::GetData(detectorData *data){ } //level0 if(scanArgument==Level0){ + while(1){ + if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ + //get scanvariable0 + int currentIndex = 0, p = 0; double cs0 = 0 , cs1 = 0; + fileIOStatic::getVariablesFromFileName(string(data->fileName), currentIndex, p, cs0, cs1); + int currentScanVariable0 = (int)cs0; + cout<<"currentScanValue:"<values[px]; + pthread_mutex_unlock(&(last_image_complete_mutex)); + break; + } + } + currentFrame++; + return 0; + } + //level1 + while(1){ if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ - //get scanvariable0 + //get scanvariable1 int currentIndex = 0, p = 0; double cs0 = 0 , cs1 = 0; fileIOStatic::getVariablesFromFileName(string(data->fileName), currentIndex, p, cs0, cs1); - int currentScanVariable0 = (int)cs0; - cout<<"currentScanValue:"<values[px]; pthread_mutex_unlock(&(last_image_complete_mutex)); + break; } - currentFrame++; - return 0; - } - //level1 - if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ - //get scanvariable1 - int currentIndex = 0, p = 0; double cs0 = 0 , cs1 = 0; - fileIOStatic::getVariablesFromFileName(string(data->fileName), currentIndex, p, cs0, cs1); - int currentScanVariable1 = (int)cs1; - //variables - if(currentScanVariable1!=currentScanValue) currentScanDivLevel++; - currentScanValue = currentScanVariable1; - lastImageNumber= currentFrame+1; - //title - char temp_title[2000]; - sprintf(temp_title,"Image Index %d",currentIndex); - imageTitle = temp_title; - //copy data - for(unsigned int px=0;pxvalues[px]; - pthread_mutex_unlock(&(last_image_complete_mutex)); } currentFrame++; return 0; From 4143c648d8a9d53341a9de44097eaf76eb5df9f5 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 25 Sep 2012 12:52:49 +0000 Subject: [PATCH 072/332] bug fixed: constant scan widget: use red label to indicate wrong to, numsteps neednt be an integer git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@72 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qScanWidget.h | 4 + slsDetectorGui/src/qScanWidget.cpp | 113 +++++++++++++++++++-------- 2 files changed, 84 insertions(+), 33 deletions(-) diff --git a/slsDetectorGui/include/qScanWidget.h b/slsDetectorGui/include/qScanWidget.h index 24e820c14..bcbaba50e 100644 --- a/slsDetectorGui/include/qScanWidget.h +++ b/slsDetectorGui/include/qScanWidget.h @@ -130,6 +130,10 @@ int RangeCheckSizeZero(); * */ int RangeCheckNumValid(int &num); +/**returns fail if to is not exact + * */ +int RangeCheckToValid(); + /** Sets number of steps if from changed * */ void RangeFromChanged(); diff --git a/slsDetectorGui/src/qScanWidget.cpp b/slsDetectorGui/src/qScanWidget.cpp index 3b748a364..5669e9f7d 100644 --- a/slsDetectorGui/src/qScanWidget.cpp +++ b/slsDetectorGui/src/qScanWidget.cpp @@ -95,6 +95,7 @@ void qScanWidget::SetupWidgetWindow(){ spinFrom->setDecimals(4); lblTo->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); lblTo->setToolTip(rangeTip); + lblTo->setFixedWidth(18); spinTo->setValue(1); spinTo->setToolTip(rangeTip); spinTo->setMaximum(1000000); @@ -227,37 +228,40 @@ void qScanWidget::EnableSizeWidgets(){ radioFile->setToolTip(fileTip); dispFile->setToolTip(fileTip); btnFile->setToolTip(fileTip); + + lblTo->setPalette(normal); + lblTo->setText("to"); + lblTo->setToolTip(rangeTip); + spinTo->setToolTip(rangeTip); } else{ - // Steps are enabled for all except Range step size - /**lblSteps->setEnabled(!radioRange->isChecked()); - spinSteps->setEnabled(!radioRange->isChecked());*/ //range values if(radioRange->isChecked()){ #ifdef VERBOSE - cout << "Constant Range Values" << endl; + cout << "Constant Range Values" << endl; #endif - radioCustom->setText("Specific Values"); - radioCustom->setPalette(normal); - radioCustom->setToolTip(customTip); - comboCustom->setToolTip(customTip); + radioCustom->setText("Specific Values"); + radioCustom->setPalette(normal); + radioCustom->setToolTip(customTip); + comboCustom->setToolTip(customTip); - radioFile->setPalette(normal); - radioFile->setText("Values from File:"); - radioFile->setToolTip(fileTip); - dispFile->setToolTip(fileTip); - btnFile->setToolTip(fileTip); + radioFile->setPalette(normal); + radioFile->setText("Values from File:"); + radioFile->setToolTip(fileTip); + dispFile->setToolTip(fileTip); + btnFile->setToolTip(fileTip); - stackedLayout->setCurrentIndex(RangeValues); + stackedLayout->setCurrentIndex(RangeValues); - //recaluculate number of steps - disconnect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps())); - spinSteps->setValue(1+(int)(abs((spinTo->value() - spinFrom->value()) / spinSize->value()))); - connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps())); + //recaluculate number of steps + disconnect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps())); + spinSteps->setValue(1+(int)(abs((spinTo->value() - spinFrom->value()) / spinSize->value()))); + connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps())); - spinSteps->setMinimum(2); - SetRangeSteps(); + spinSteps->setMinimum(2); + RangeCheckToValid(); + SetRangeSteps(); } //custom values else if(radioCustom->isChecked()){ @@ -272,6 +276,11 @@ void qScanWidget::EnableSizeWidgets(){ dispFile->setToolTip(fileTip); btnFile->setToolTip(fileTip); + lblTo->setPalette(normal); + lblTo->setText("to"); + lblTo->setToolTip(rangeTip); + spinTo->setToolTip(rangeTip); + //change it back as this list is what will be loaded. //also numstpes could have been changed in other modes too disconnect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps())); @@ -304,6 +313,11 @@ void qScanWidget::EnableSizeWidgets(){ radioCustom->setToolTip(customTip); comboCustom->setToolTip(customTip); + lblTo->setPalette(normal); + lblTo->setText("to"); + lblTo->setToolTip(rangeTip); + spinTo->setToolTip(rangeTip); + stackedLayout->setCurrentIndex(FileValues); SetFileSteps(); } @@ -335,9 +349,6 @@ void qScanWidget::SetMode(int mode){ // If anything other than None is selected if(mode){ - // Steps are enabled for all except Range step size - /**lblSteps->setEnabled(!radioRange->isChecked()); - spinSteps->setEnabled(!radioRange->isChecked());*/ lblSteps->setEnabled(true); spinSteps->setEnabled(true); // Custom Script only enables the first layout with addnl parameters etc @@ -552,7 +563,7 @@ void qScanWidget::SetNSteps(){ disconnect(spinSize, SIGNAL(valueChanged(double)), this, SLOT(RangeSizeChanged())); spinSize->setValue( (spinTo->value()-spinFrom->value()) / (spinSteps->value()-1)); connect(spinSize, SIGNAL(valueChanged(double)), this, SLOT(RangeSizeChanged())); - + RangeCheckToValid(); SetRangeSteps(); }else if(radioCustom->isChecked()){ comboCustom->setMaxCount(spinSteps->value()); @@ -586,13 +597,11 @@ int qScanWidget::RangeCheckNumValid(int &num){ cout << "Entering RangeCheckNumValid()" << endl; #endif double div = abs(spinTo->value()-spinFrom->value())/(abs(spinSize->value())); - cout<<"div:"<=1 - if((floor(div)==div) && (div>0)){ - num = (int)(div) + 1; - return qDefs::OK; - } + //num = (to-from)/size +1 + num = (int)(div) + 1; + + if(num>=2) return qDefs::OK; return qDefs::FAIL; } @@ -601,6 +610,34 @@ int qScanWidget::RangeCheckNumValid(int &num){ //------------------------------------------------------------------------------------------------------------------------------------------------- +int qScanWidget::RangeCheckToValid(){ +#ifdef VERYVERBOSE + cout << "Entering RangeCheckToValid()" << endl; +#endif + double to = (spinSize->value() * spinSteps->value()) - spinSize->value() + spinFrom->value(); + + //not exact value + if (abs(to-spinTo->value())>0.01){ + lblTo->setPalette(red); + lblTo->setText("to*"); + QString tip = rangeTip + QString("

" + "To is not exact. Entering Size should recalculate To."); + lblTo->setToolTip(tip); + spinTo->setToolTip(tip); + return qDefs::FAIL; + } + + lblTo->setPalette(normal); + lblTo->setText("to"); + lblTo->setToolTip(rangeTip); + spinTo->setToolTip(rangeTip); + return qDefs::OK; +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + void qScanWidget::RangeFromChanged(){ #ifdef VERYVERBOSE cout << "Entering RangeFromChanged()" << endl; @@ -618,7 +655,8 @@ void qScanWidget::RangeFromChanged(){ qDefs::Message(qDefs::WARNING,"From cannot be equal to To. Changing From back to previous value.","Scan"); //check size validity else if(RangeCheckNumValid(numSteps)==qDefs::FAIL) - qDefs::Message(qDefs::WARNING,"Number of Steps must be >= 2. Changing From back to previous value.","Scan"); + qDefs::Message(qDefs::WARNING,"Number of Steps = 1 + ( To - From ) / Size.
" + "Number of Steps must be >= 2. Changing From back to previous value.","Scan"); else change = true; //change it back from = to - size*num + size @@ -640,6 +678,7 @@ void qScanWidget::RangeFromChanged(){ spinSize->setValue(-1*(spinSize->value())); } + RangeCheckToValid(); SetRangeSteps(); connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps())); @@ -667,7 +706,8 @@ void qScanWidget::RangeToChanged(){ qDefs::Message(qDefs::WARNING,"From cannot be equal to To. Changing To back to previous value.","Scan"); //check size validity else if(RangeCheckNumValid(numSteps)==qDefs::FAIL) - qDefs::Message(qDefs::WARNING,"Number of Steps must be >= 2. Changing To back to previous value.","Scan"); + qDefs::Message(qDefs::WARNING,"Number of Steps = 1 + ( To - From ) / Size.
" + "Number of Steps must be >= 2. Changing To back to previous value.","Scan"); else change = true; //change it back to = size*num - size + from @@ -690,6 +730,7 @@ void qScanWidget::RangeToChanged(){ } + RangeCheckToValid(); SetRangeSteps(); connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps())); @@ -717,7 +758,8 @@ void qScanWidget::RangeSizeChanged(){ qDefs::Message(qDefs::WARNING,"Size cannot be 0. Changing Size back to previous value.","Scan"); //check size validity else if(RangeCheckNumValid(numSteps)==qDefs::FAIL) - qDefs::Message(qDefs::WARNING,"Number of Steps must be >= 2. Changing To back to previous value.","Scan"); + qDefs::Message(qDefs::WARNING,"Number of Steps = 1 + ( To - From ) / Size.
" + "Number of Steps must be >= 2. Changing Size back to previous value.","Scan"); else change = true; //change it back size = (to-from)/(num-1) @@ -732,8 +774,13 @@ void qScanWidget::RangeSizeChanged(){ spinSteps->setValue(numSteps); //in case size changed to negative spinTo->setValue((spinSize->value() * spinSteps->value()) - spinSize->value() + spinFrom->value()); + lblTo->setPalette(normal); + lblTo->setText("to"); + lblTo->setToolTip(rangeTip); + spinTo->setToolTip(rangeTip); } + RangeCheckToValid(); SetRangeSteps(); connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps())); From 4e4b8b9beb997cd61482fadd097a0b1f792a57fe Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 25 Sep 2012 13:05:07 +0000 Subject: [PATCH 073/332] ang conversion enables positions without having to do refresh git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@73 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qTabActions.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/slsDetectorGui/src/qTabActions.cpp b/slsDetectorGui/src/qTabActions.cpp index da533052b..91433f9eb 100644 --- a/slsDetectorGui/src/qTabActions.cpp +++ b/slsDetectorGui/src/qTabActions.cpp @@ -139,6 +139,32 @@ void qTabActions::SetupWidgetWindow(){ } + //load positions + if(lblName[NumPositions]->isEnabled()){ + //delete existing positions + if (positions) delete [] positions; + //get number of positions + int numPos=myDet->getPositions(); + comboPos->setMaxCount(numPos); + + //set the number of positions in the gui + spinNumPos->setValue(numPos); + + positions=new double[numPos]; + //load the positions + myDet->getPositions(positions); + + //delete the combolist and reload it + comboPos->setEnabled(numPos); + lblPosList->setEnabled(numPos); + btnDelete->setEnabled(numPos); + lblPosList->setText("List of Positions: "); + lblPosList->setPalette(normal); + for(int i=0;icount();i++) comboPos->removeItem(i); + for(int i=0;iinsertItem(i,QString("%1").arg(positions[i])); + } + + } From c506fcf73916976faf0c3306734026387046bae5 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 25 Sep 2012 13:47:25 +0000 Subject: [PATCH 074/332] script fixed git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@74 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qActionsWidget.cpp | 3 ++- slsDetectorGui/src/qDetectorMain.cpp | 4 ++-- slsDetectorGui/src/qScanWidget.cpp | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/slsDetectorGui/src/qActionsWidget.cpp b/slsDetectorGui/src/qActionsWidget.cpp index 0e595c670..aa62dc80e 100644 --- a/slsDetectorGui/src/qActionsWidget.cpp +++ b/slsDetectorGui/src/qActionsWidget.cpp @@ -194,7 +194,8 @@ void qActionsWidget::Refresh(){ //settings values and checking for none - dispScript->setText(QString(script.c_str())); + if(QString(script.c_str()).compare("none")) + dispScript->setText(QString(script.c_str())); if(mode)SetScriptFile(); dispParameter->setText(QString(parameter.c_str())); SetParameter(); diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 907ff9c14..d568a2a3c 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -58,8 +58,8 @@ qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app, QWidget * 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 << "-id i \t\t : \t Sets the multi detector id to i (the default is 0). " + "Required only when more than one multi detector object is needed." << endl; } } diff --git a/slsDetectorGui/src/qScanWidget.cpp b/slsDetectorGui/src/qScanWidget.cpp index 5669e9f7d..99453ca93 100644 --- a/slsDetectorGui/src/qScanWidget.cpp +++ b/slsDetectorGui/src/qScanWidget.cpp @@ -1202,7 +1202,8 @@ void qScanWidget::Refresh(){ //settings values and checking for none - dispScript->setText(QString(script.c_str())); + if(QString(script.c_str()).compare("none")) + dispScript->setText(QString(script.c_str())); if(mode) SetScriptFile(); dispParameter->setText(QString(parameter.c_str())); SetParameter(); From bc5fddbe1eb5bfdf99f3752dffdcfbaf1c0ff9f6 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 25 Sep 2012 14:30:36 +0000 Subject: [PATCH 075/332] bug fix: tabactions: positions disabled label color git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@75 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qTabActions.cpp | 34 ++++++++++++++++-------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/slsDetectorGui/src/qTabActions.cpp b/slsDetectorGui/src/qTabActions.cpp index 91433f9eb..7cac28e22 100644 --- a/slsDetectorGui/src/qTabActions.cpp +++ b/slsDetectorGui/src/qTabActions.cpp @@ -253,7 +253,9 @@ void qTabActions::Expand(QAbstractButton *button ){ // Collapse if(!button->isChecked()){ - palette->setColor(QPalette::WindowText,Qt::black); + palette->setColor(QPalette::Active,QPalette::WindowText,Qt::black); + + lblName[index]->setPalette(*palette); button->setIcon(*iconPlus); @@ -261,7 +263,7 @@ void qTabActions::Expand(QAbstractButton *button ){ positionWidget->hide(); setFixedHeight(height()-30);//-80 if the checkboxes are included if(myDet->getPositions()) { - palette->setColor(QPalette::WindowText,Qt::darkGreen); + palette->setColor(QPalette::Active,QPalette::WindowText,Qt::darkGreen); lblName[index]->setPalette(*palette); } } @@ -269,7 +271,7 @@ void qTabActions::Expand(QAbstractButton *button ){ scanWidget[GetActualIndex(index)]->hide(); setFixedHeight(height()-130); if(myDet->getScanMode(GetActualIndex(index))){ - palette->setColor(QPalette::WindowText,Qt::darkGreen); + palette->setColor(QPalette::Active,QPalette::WindowText,Qt::darkGreen); lblName[index]->setPalette(*palette); } } @@ -277,14 +279,17 @@ void qTabActions::Expand(QAbstractButton *button ){ actionWidget[GetActualIndex(index)]->hide(); setFixedHeight(height()-30); if(myDet->getActionMode(GetActualIndex(index))){ - palette->setColor(QPalette::WindowText,Qt::darkGreen); + palette->setColor(QPalette::Active,QPalette::WindowText,Qt::darkGreen); lblName[index]->setPalette(*palette); } } }else{ // Expand //always set title color to blue for expan\d - palette->setColor(QPalette::WindowText,QColor(0,0,200,255)); + + palette->setColor(QPalette::Active,QPalette::WindowText,QColor(0,0,200,255)); + + lblName[index]->setPalette(*palette); button->setIcon(*iconMinus); @@ -389,7 +394,7 @@ void qTabActions::EnablePositions(bool enable){ for(int i=0;icount();i++) comboPos->removeItem(i); cout<<"Number of Positions set to :"<getPositions()<setPalette(lblName[NumPositions-1]->palette()); + //to collapse if it was expanded if(btnExpand[NumPositions]->isChecked()){ disconnect(group, SIGNAL(buttonClicked(QAbstractButton*)), this,SLOT(Expand(QAbstractButton*))); @@ -489,23 +494,20 @@ void qTabActions::UpdateCollapseColors(){ for(int i=0;iisEnabled()){ - if(myDet->getPositions()) palette->setColor(QPalette::WindowText,Qt::darkGreen); - else palette->setColor(QPalette::WindowText,Qt::black); - lblName[i]->setPalette(*palette); - } + if(myDet->getPositions()) palette->setColor(QPalette::Active,QPalette::WindowText,Qt::darkGreen); + else palette->setColor(QPalette::Active,QPalette::WindowText,Qt::black); + lblName[i]->setPalette(*palette); } //scans else if((i==Scan0)||(i==Scan1)){ - if(myDet->getScanMode(GetActualIndex(i))) palette->setColor(QPalette::WindowText,Qt::darkGreen); - else palette->setColor(QPalette::WindowText,Qt::black); + if(myDet->getScanMode(GetActualIndex(i))) palette->setColor(QPalette::Active,QPalette::WindowText,Qt::darkGreen); + else palette->setColor(QPalette::Active,QPalette::WindowText,Qt::black); lblName[i]->setPalette(*palette); } //actions else{ - if(myDet->getActionMode(GetActualIndex(i))) palette->setColor(QPalette::WindowText,Qt::darkGreen); - else palette->setColor(QPalette::WindowText,Qt::black); + if(myDet->getActionMode(GetActualIndex(i))) palette->setColor(QPalette::Active,QPalette::WindowText,Qt::darkGreen); + else palette->setColor(QPalette::Active,QPalette::WindowText,Qt::black); lblName[i]->setPalette(*palette); } } From f4bd585ba2558e79b104aec650a3ef6e18dfe9f5 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 25 Sep 2012 15:41:37 +0000 Subject: [PATCH 076/332] bug fix:scans: backward scan plotting works now git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@76 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qDrawPlot.h | 3 +++ slsDetectorGui/src/qDrawPlot.cpp | 43 +++++++++++++++++++++++------- 2 files changed, 36 insertions(+), 10 deletions(-) diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index 6ea6d18d8..2bb7febc8 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -439,6 +439,9 @@ QString fileName; /** Max Number of Clone Windows */ static const int TRIM_HISTOGRAM_XMAX = 63; +/**if the values increment backwards*/ +bool backwardScanPlot; + signals: diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 6a2714344..2ae32fdd7 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -101,6 +101,8 @@ void qDrawPlot::SetupWidgetWindow(){ scanArgument = None; alreadyDisplayed = false; + + backwardScanPlot = false; // This is so that it initially stop and plots running = 1; for(int i=0;imaxPixelsY){ + double temp = minPixelsY; + minPixelsY = maxPixelsY; + maxPixelsY = temp; + backwardScanPlot = true; + }else backwardScanPlot = false; + + + //1d if(histXAxis) delete [] histXAxis; histXAxis = new double [nPixelsX]; if(histYAxis[0]) delete [] histYAxis[0];histYAxis[0] = new double [nPixelsX]; @@ -455,7 +466,13 @@ void qDrawPlot::SetupMeasurement(int currentIndex){ minPixelsY = currentIndex; if(!running) nPixelsY = number_of_frames; }//level0 or level1 - else currentScanValue = minPixelsY; + else { + currentScanValue = minPixelsY; + if(backwardScanPlot){ + currentScanValue = maxPixelsY; + currentScanDivLevel = nPixelsY-1; + } + } //cannot divide by 0 if(nPixelsY==1){ @@ -468,14 +485,14 @@ void qDrawPlot::SetupMeasurement(int currentIndex){ endPixel = maxPixelsY + (pixelWidth/2); } } -/* + cout<<"nPixelsX:"<fileName), currentIndex, p, cs0, cs1); - int currentScanVariable0 = (int)cs0; cout<<"currentScanValue:"<fileName), currentIndex, p, cs0, cs1); - int currentScanVariable1 = (int)cs1; //variables - if(currentScanVariable1!=currentScanValue) currentScanDivLevel++; - currentScanValue = currentScanVariable1; + if(cs1!=currentScanValue){ + if(backwardScanPlot) currentScanDivLevel--; + else currentScanDivLevel++; + } + currentScanValue = cs1; lastImageNumber= currentFrame+1; //title char temp_title[2000]; @@ -906,6 +927,8 @@ void qDrawPlot::UpdatePlot(){ if(lastImageArray){ if(lastImageNumber&&last_plot_number!=(int)lastImageNumber && //there is a new plot nPixelsX>0&&nPixelsY>0){ + cout<<"startpixel:"<GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,-0.5,nPixelsY-0.5,lastImageArray); plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,startPixel,endPixel,lastImageArray); plot2D->setTitle(GetImageTitle()); From cfce337c46be6a592e2be7d26b71589afb0ffa71 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 25 Sep 2012 15:51:29 +0000 Subject: [PATCH 077/332] bug fix:scans: backward scan plotting works now git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@77 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qDrawPlot.h | 4 ++++ slsDetectorGui/src/qDrawPlot.cpp | 5 +++++ slsDetectorGui/src/qTabMeasurement.cpp | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index 2bb7febc8..69b7ffa5f 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -50,6 +50,8 @@ public: bool isRunning(){return running;}; /** gets the progress of acquisition to the measurement tab*/ int GetProgress(){return progress;}; + /** gets the file index to the measurement tab*/ + int GetFileIndex(){return currentFileIndex;}; /** sets plot Title */ void SetPlotTitle(QString title) {plotTitle = title;} @@ -308,6 +310,8 @@ int number_of_frames; double acquisitionPeriod; /** Acquisition Time */ double exposureTime; +/** Current index*/ +int currentFileIndex; diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 2ae32fdd7..138171b7e 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -103,6 +103,8 @@ void qDrawPlot::SetupWidgetWindow(){ alreadyDisplayed = false; backwardScanPlot = false; + + currentFileIndex = 0; // This is so that it initially stop and plots running = 1; for(int i=0;igetFilePath().c_str()); fileName = QString(myDet->getFileName().c_str()); + //update index + currentFileIndex = myDet->getFileIndex(); @@ -530,6 +534,7 @@ int qDrawPlot::GetData(detectorData *data){ SetPlotTitle(QString(data->fileName).section('/',-1)); //set progress progress=(int)data->progressIndex; + currentFileIndex = fileIOStatic::getFileIndexFromFileName(string(data->fileName)); #ifdef VERBOSE cout << "progress:" << progress << endl; #endif diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index fb720ef0f..1cde39499 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -354,7 +354,7 @@ void qTabMeasurement::SetCurrentMeasurement(int val){ void qTabMeasurement::UpdateProgress(){ //progressBar->setValue((int)(((currentMeasurement*100)+(myPlot->GetProgress()))/spinNumMeasurements->value())); progressBar->setValue((int)myPlot->GetProgress()); - lblProgressIndex->setText(QString::number(myDet->getFileIndex())); + lblProgressIndex->setText(QString::number(myPlot->GetFileIndex())); } From bdabf9e64920d67c635c0c883a06bb22130cb819 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 25 Sep 2012 16:08:10 +0000 Subject: [PATCH 078/332] bug fix: update measurement index, update index does not use sharedmemory, start run index updated after measurement git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@78 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qTabMeasurement.h | 2 -- slsDetectorGui/src/qDrawPlot.cpp | 21 ++++++++++----------- slsDetectorGui/src/qTabMeasurement.cpp | 10 ++++------ 3 files changed, 14 insertions(+), 19 deletions(-) diff --git a/slsDetectorGui/include/qTabMeasurement.h b/slsDetectorGui/include/qTabMeasurement.h index 10497eab9..a77b31664 100644 --- a/slsDetectorGui/include/qTabMeasurement.h +++ b/slsDetectorGui/include/qTabMeasurement.h @@ -163,8 +163,6 @@ private: enum{None, Auto, Trigger_Exp_Series, Trigger_Frame, Trigger_Readout, Gated, Gated_Start, Trigger_Window, NumTimingModes}; /** timer to update the progress*/ QTimer *progressTimer; - /** current measurement */ - int currentMeasurement; /** tool tip variables*/ QString acqPeriodTip; QString errPeriodTip; diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 138171b7e..f2345c516 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -618,7 +618,7 @@ int qDrawPlot::GetData(detectorData *data){ lastImageNumber= currentFrame+1; //title char temp_title[2000]; - sprintf(temp_title,"Image Index %d",fileIOStatic::getFileIndexFromFileName(string(data->fileName))); + sprintf(temp_title,"Image Index %d",currentFileIndex); imageTitle = temp_title; //copy data memcpy(lastImageArray+(currentScanDivLevel*nPixelsX),data->values,nPixelsX*sizeof(double)); @@ -635,12 +635,11 @@ int qDrawPlot::GetData(detectorData *data){ while(1){ if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ //variables - int currentIndex = fileIOStatic::getFileIndexFromFileName(string(data->fileName)); - if(currentIndex == minPixelsY) currentScanDivLevel = 0; + if(currentFileIndex == minPixelsY) currentScanDivLevel = 0; lastImageNumber= currentFrame+1; //title char temp_title[2000]; - sprintf(temp_title,"Image Index %d",currentIndex); + sprintf(temp_title,"Image Index %d",currentFileIndex); imageTitle = temp_title; //copy data for(unsigned int px=0;pxvalues[px]; @@ -657,8 +656,8 @@ int qDrawPlot::GetData(detectorData *data){ while(1){ if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ //get scanvariable0 - int currentIndex = 0, p = 0; double cs0 = 0 , cs1 = 0; - fileIOStatic::getVariablesFromFileName(string(data->fileName), currentIndex, p, cs0, cs1); + int ci = 0, p = 0; double cs0 = 0 , cs1 = 0; + fileIOStatic::getVariablesFromFileName(string(data->fileName), ci, p, cs0, cs1); cout<<"currentScanValue:"<values[px]; @@ -685,8 +684,8 @@ int qDrawPlot::GetData(detectorData *data){ while(1){ if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ //get scanvariable1 - int currentIndex = 0, p = 0; double cs0 = 0 , cs1 = 0; - fileIOStatic::getVariablesFromFileName(string(data->fileName), currentIndex, p, cs0, cs1); + int ci = 0, p = 0; double cs0 = 0 , cs1 = 0; + fileIOStatic::getVariablesFromFileName(string(data->fileName), ci, p, cs0, cs1); //variables if(cs1!=currentScanValue){ if(backwardScanPlot) currentScanDivLevel--; @@ -696,7 +695,7 @@ int qDrawPlot::GetData(detectorData *data){ lastImageNumber= currentFrame+1; //title char temp_title[2000]; - sprintf(temp_title,"Image Index %d",currentIndex); + sprintf(temp_title,"Image Index %d",currentFileIndex); imageTitle = temp_title; //copy data for(unsigned int px=0;pxvalues[px]; @@ -731,7 +730,7 @@ int qDrawPlot::GetData(detectorData *data){ //2d else{ // Titles - sprintf(temp_title,"Image Index %d",fileIOStatic::getFileIndexFromFileName(string(data->fileName))); + sprintf(temp_title,"Image Index %d",currentFileIndex); imageTitle = temp_title; // manufacture data for now for(unsigned int px=0;pxsetText(QString::number(myDet->getFileIndex())); //ly initially progressBar->setValue(0); - currentMeasurement = 0; //timing mode SetupTimingMode(); @@ -301,8 +300,6 @@ void qTabMeasurement::startStopAcquisition(){ btnStartStop->setIcon(*iconStop); Enable(0); progressBar->setValue(0); - //the progress which keeps adding up for all the measurements - currentMeasurement = 0; progressTimer->start(100); emit StartSignal(); @@ -313,6 +310,7 @@ void qTabMeasurement::startStopAcquisition(){ emit StopSignal(); myDet->stopAcquisition(); progressTimer->stop(); + spinIndex->setValue(myPlot->GetFileIndex()); btnStartStop->setText("Start"); btnStartStop->setIcon(*iconStart); btnStartStop->setChecked(false); @@ -333,6 +331,7 @@ void qTabMeasurement::UpdateFinished(){ Enable(1); connect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); UpdateProgress(); + spinIndex->setValue(myPlot->GetFileIndex()); progressTimer->stop(); } } @@ -342,8 +341,8 @@ void qTabMeasurement::UpdateFinished(){ void qTabMeasurement::SetCurrentMeasurement(int val){ - currentMeasurement = val; - lblCurrentMeasurement->setText(QString::number(val+1)); + if((val)value()) + lblCurrentMeasurement->setText(QString::number(val+1)); } @@ -352,7 +351,6 @@ void qTabMeasurement::SetCurrentMeasurement(int val){ void qTabMeasurement::UpdateProgress(){ - //progressBar->setValue((int)(((currentMeasurement*100)+(myPlot->GetProgress()))/spinNumMeasurements->value())); progressBar->setValue((int)myPlot->GetProgress()); lblProgressIndex->setText(QString::number(myPlot->GetFileIndex())); } From 1eb07b31f6b534c525c31264c858c833c0ccfe71 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 25 Sep 2012 16:55:33 +0000 Subject: [PATCH 079/332] bug fix: plot tab refresh doesnt change plot git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@79 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qTabPlot.h | 14 +++++++------- slsDetectorGui/slsDetectorGui.pro | 2 +- slsDetectorGui/src/qDetectorMain.cpp | 11 ++--------- slsDetectorGui/src/qDrawPlot.cpp | 21 +++++++++++++++++---- slsDetectorGui/src/qTabPlot.cpp | 25 ++++++++++++++++--------- 5 files changed, 43 insertions(+), 30 deletions(-) diff --git a/slsDetectorGui/include/qTabPlot.h b/slsDetectorGui/include/qTabPlot.h index 538f32e97..cee77ef64 100644 --- a/slsDetectorGui/include/qTabPlot.h +++ b/slsDetectorGui/include/qTabPlot.h @@ -38,7 +38,13 @@ public: */ ~qTabPlot(); + /** Sets the scan argument of the plot + */ + void SetScanArgument(); + /** To refresh and update widgets + */ + void Refresh(); private: @@ -59,7 +65,6 @@ private: - public slots: /** Set frequency between plots*/ void SetFrequency(); @@ -74,13 +79,8 @@ void EnableScanBox(); */ void EnableNthFrame(bool enable){enableNFrame = enable;}; -/** Sets the scan argument of the plot - */ -void SetScanArgument(); -/** To refresh and update widgets - */ -void Refresh(); + /** Disables scanbox while running diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index fdced7387..432e26292 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -6,7 +6,7 @@ UI_HEADERS_DIR = forms/include RESOURCES += icons.qrc -DEFINES += VERBOSE DACS_INT #VERYVERBOSE +DEFINES += VERBOSE DACS_INT VERYVERBOSE target.path += $(DESTDIR) diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index d568a2a3c..99adef4ea 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -529,14 +529,7 @@ void qDetectorMain::Refresh(int index){ tabs->setCurrentIndex((index++)<(tabs->count()-1)?index:Measurement); else{ switch(tabs->currentIndex()){ - case Measurement: - if(!myPlot->isRunning()) { - tab_measurement->Refresh(); - //to recover from a trimbit plot mode - tab_plot->Refresh(); - } - break; - + case Measurement: tab_measurement->Refresh(); break; case Settings: tab_settings->Refresh(); break; case DataOutput: tab_dataoutput->Refresh(); break; case Plot: tab_plot->Refresh(); break; @@ -642,7 +635,7 @@ void qDetectorMain::EnableTabs(){ //moved to here, so that its all in order, instead of signals and different threads if(!enable) { //set the plot type first(acccss shared memory) - tab_plot->Refresh(); + tab_plot->SetScanArgument(); //sets running to true myPlot->StartStopDaqToggle(); } diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index f2345c516..2d58b9b31 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -530,8 +530,6 @@ int qDrawPlot::GetData(detectorData *data){ #endif if(!stop_signal){ - //set title - SetPlotTitle(QString(data->fileName).section('/',-1)); //set progress progress=(int)data->progressIndex; currentFileIndex = fileIOStatic::getFileIndexFromFileName(string(data->fileName)); @@ -548,6 +546,9 @@ int qDrawPlot::GetData(detectorData *data){ //angle plotting if(anglePlot){ if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ + //set title + SetPlotTitle(QString(data->fileName).section('/',-1)); + cout<<"angle plot"<angles==NULL){ cout<<"\n\nWARNING:RETURNED NULL instead of angles."<fileName).section('/',-1)); //variables lastImageNumber= currentFrame+1; //title @@ -634,6 +637,8 @@ int qDrawPlot::GetData(detectorData *data){ if(scanArgument==FileIndex){ while(1){ if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ + //set title + SetPlotTitle(QString(data->fileName).section('/',-1)); //variables if(currentFileIndex == minPixelsY) currentScanDivLevel = 0; lastImageNumber= currentFrame+1; @@ -655,6 +660,8 @@ int qDrawPlot::GetData(detectorData *data){ if(scanArgument==Level0){ while(1){ if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ + //set title + SetPlotTitle(QString(data->fileName).section('/',-1)); //get scanvariable0 int ci = 0, p = 0; double cs0 = 0 , cs1 = 0; fileIOStatic::getVariablesFromFileName(string(data->fileName), ci, p, cs0, cs1); @@ -683,6 +690,8 @@ int qDrawPlot::GetData(detectorData *data){ //level1 while(1){ if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ + //set title + SetPlotTitle(QString(data->fileName).section('/',-1)); //get scanvariable1 int ci = 0, p = 0; double cs0 = 0 , cs1 = 0; fileIOStatic::getVariablesFromFileName(string(data->fileName), ci, p, cs0, cs1); @@ -710,6 +719,8 @@ int qDrawPlot::GetData(detectorData *data){ //normal measurement or 1d scans if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ + //set title + SetPlotTitle(QString(data->fileName).section('/',-1)); char temp_title[2000]; // only if you got the lock, do u need to remember lastimagenumber to plot lastImageNumber= currentFrame+1; @@ -879,8 +890,7 @@ void qDrawPlot::UpdatePlot(){ cout << "Entering UpdatePlot function" << endl; #endif plot_update_timer->stop(); - //set plot title - boxPlot->setTitle(plotTitle); + // only if no plot isnt enabled if(plotEnable){ LockLastImageArray(); @@ -957,6 +967,9 @@ void qDrawPlot::UpdatePlot(){ } last_plot_number=lastImageNumber; + //set plot title + boxPlot->setTitle(plotTitle); + if(plotEnable) UnlockLastImageArray(); diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index d4ba8a550..81301d4b5 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -150,6 +150,8 @@ void qTabPlot::SetupWidgetWindow(){ } Select1DPlot(isOrginallyOneD); + if(isOrginallyOneD) myPlot->Select1DPlot(); + else myPlot->Select2DPlot(); //to check if this should be enabled EnableScanBox(); @@ -167,14 +169,12 @@ void qTabPlot::Select1DPlot(bool b){ chkZAxis->setEnabled(false); chkZMin->setEnabled(false); chkZMax->setEnabled(false); - myPlot->Select1DPlot(); }else{ box1D->hide(); box2D->show(); chkZAxis->setEnabled(true); chkZMin->setEnabled(true); chkZMax->setEnabled(true); - myPlot->Select2DPlot(); } } @@ -188,7 +188,7 @@ void qTabPlot::Initialization(){ connect(radioHistogram, SIGNAL(toggled(bool)),this, SLOT(SetPlot())); connect(radioDataGraph, SIGNAL(toggled(bool)),this, SLOT(SetPlot())); // Scan box - connect(btnGroupScan, SIGNAL(buttonClicked(QAbstractButton *)),this, SLOT(SetScanArgument())); + /*connect(btnGroupScan, SIGNAL(buttonClicked(QAbstractButton *)),this, SLOT(SetScanArgument()));*/ connect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox())); // Snapshot box connect(btnClone, SIGNAL(clicked()),myPlot, SLOT(ClonePlot())); @@ -421,6 +421,8 @@ void qTabPlot::SetPlot(){ if(isOrginallyOneD) {box1D->show(); box2D->hide();} if(!isOrginallyOneD) {box2D->show(); box1D->hide();} Select1DPlot(isOrginallyOneD); + if(isOrginallyOneD) myPlot->Select1DPlot(); + else myPlot->Select2DPlot(); boxSnapshot->setEnabled(true); boxSave->setEnabled(true); boxFrequency->setEnabled(true); @@ -554,7 +556,7 @@ void qTabPlot::EnableScanBox(){ //sets the scan argument - SetScanArgument(); + /*SetScanArgument();*/ } @@ -602,30 +604,36 @@ void qTabPlot::SetScanArgument(){ myPlot->SetImageZAxisTitle(defaultImageZAxisTitle); } Select1DPlot(isOrginallyOneD); + if(isOrginallyOneD) myPlot->Select1DPlot(); + else myPlot->Select2DPlot(); int ang; //if scans(1D or 2D) if(boxScan->isEnabled()){ //setting the title according to the scans QString mainTitle = QString(" Level 0 : ") + modeNames[myDet->getScanMode(0)] + - QString(" | Level 1 : ") + modeNames[myDet->getScanMode(1)] + QString(""); + QString(" | Level 1 : ") + modeNames[myDet->getScanMode(1)] + QString(""); dispTitle->setText(mainTitle); myPlot->SetPlotTitle(mainTitle); Select1DPlot(isOrginallyOneD); + if(isOrginallyOneD) myPlot->Select1DPlot(); + else myPlot->Select2DPlot(); }//angles (1D) else if(myDet->getAngularConversion(ang)){ - //else if(myDet->getPositions()){ + //else if(myDet->getPositions()){ //if scan, change title if((myDet->getScanMode(0))||(myDet->getScanMode(1))){ QString mainTitle = QString(" Level 0 : ") + modeNames[myDet->getScanMode(0)] + - QString(" | Level 1 : ") + modeNames[myDet->getScanMode(1)] + QString(""); + QString(" | Level 1 : ") + modeNames[myDet->getScanMode(1)] + QString(""); dispTitle->setText(mainTitle); myPlot->SetPlotTitle(mainTitle); } dispXAxis->setText("Angles"); myPlot->SetHistXAxisTitle("Angles"); Select1DPlot(true); + myPlot->Select1DPlot(); + } @@ -669,11 +677,10 @@ void qTabPlot::SetScanArgument(){ }else //done here so that it isnt set by default each time myPlot->SetScanArgument(0); - } -//------------------------------------------------------------------------------------------------------------------------------------------------- +//------------------------------------------------------------------------------------------------------------------------------------------------- void qTabPlot::Refresh(){ #ifdef VERBOSE From 87f79a93270c64b1e21ad85fc0c633d0c31070ad Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 25 Sep 2012 17:05:38 +0000 Subject: [PATCH 080/332] without very verbose git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@80 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/slsDetectorGui.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index 432e26292..fdced7387 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -6,7 +6,7 @@ UI_HEADERS_DIR = forms/include RESOURCES += icons.qrc -DEFINES += VERBOSE DACS_INT VERYVERBOSE +DEFINES += VERBOSE DACS_INT #VERYVERBOSE target.path += $(DESTDIR) From 887303c82069d3aa8b861f3ead30f59e22c22ba5 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Mon, 1 Oct 2012 09:36:25 +0000 Subject: [PATCH 081/332] bug fix: time interval disabled when angular conversion disabled.solved git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@81 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_measurement.ui | 63 +++++++++++--------- slsDetectorGui/slsDetectorGui.pro | 2 +- slsDetectorGui/src/qTabPlot.cpp | 6 +- 3 files changed, 38 insertions(+), 33 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_measurement.ui b/slsDetectorGui/forms/form_tab_measurement.ui index 4832f0138..0b5f0d48a 100644 --- a/slsDetectorGui/forms/form_tab_measurement.ui +++ b/slsDetectorGui/forms/form_tab_measurement.ui @@ -564,6 +564,13 @@ true + + <nobr> +Exposure Time of a frame. +</nobr><br><nobr> + #exptime# +</nobr> + Exposure Time: @@ -581,8 +588,11 @@ - Exposure time of each frame. - #exptime# + <nobr> +Exposure Time of a frame. +</nobr><br><nobr> + #exptime# +</nobr> Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter @@ -612,6 +622,13 @@ 0 + + <nobr> +Exposure Time of a frame. +</nobr><br><nobr> + #exptime# +</nobr> + Qt::LeftToRight @@ -656,15 +673,11 @@ false - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> -<table style="-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;"> -<tr> -<td style="border: none;"> -<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Frame period between exposures. </p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> #period#</p></td></tr></table></body></html> + <nobr> +Frame period between exposures. +</nobr><br><nobr> + #period# +</nobr> Acquisition Period: @@ -683,15 +696,11 @@ p, li { white-space: pre-wrap; } - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> -<table style="-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;"> -<tr> -<td style="border: none;"> -<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Frame period between exposures. </p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> #period#</p></td></tr></table></body></html> + <nobr> +Frame period between exposures. +</nobr><br><nobr> + #period# +</nobr> Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter @@ -719,15 +728,11 @@ p, li { white-space: pre-wrap; } - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> -<table style="-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;"> -<tr> -<td style="border: none;"> -<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Frame period between exposures. </p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> #period#</p></td></tr></table></body></html> + <nobr> +Frame period between exposures. +</nobr><br><nobr> + #period# +</nobr> Qt::LeftToRight diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index fdced7387..432e26292 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -6,7 +6,7 @@ UI_HEADERS_DIR = forms/include RESOURCES += icons.qrc -DEFINES += VERBOSE DACS_INT #VERYVERBOSE +DEFINES += VERBOSE DACS_INT VERYVERBOSE target.path += $(DESTDIR) diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index 81301d4b5..2ac8319c7 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -509,7 +509,7 @@ void qTabPlot::EnableScanBox(){ bool checkedBefore = boxScan->isChecked();//||(!boxScan->isEnabled())); int ang; - //none of these scan plotting options make sense if positions>0 + //none of these scan plotting options make sense if positions exists bool positionsExist = myDet->getAngularConversion(ang);//myDet->getPositions(); //only now enable/disable @@ -551,7 +551,7 @@ void qTabPlot::EnableScanBox(){ if((positionsExist)&&(chkSuperimpose->isChecked())) chkSuperimpose->setChecked(false); chkSuperimpose->setEnabled(!positionsExist); //box frequency should be enabled cuz its a normal 1d plot - boxFrequency->setEnabled(positionsExist); + //boxFrequency->setEnabled(positionsExist); myPlot->EnableAnglePlot(positionsExist); @@ -688,8 +688,8 @@ void qTabPlot::Refresh(){ #endif if(!myPlot->isRunning()){ connect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox())); - SetFrequency(); EnableScanBox(); + SetFrequency(); }else{ disconnect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox())); boxScan->setEnabled(false); From 7eb48a300db7a1bbc2b41fc05435e25d72399a3a Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Mon, 1 Oct 2012 09:36:39 +0000 Subject: [PATCH 082/332] bug fix: time interval disabled when angular conversion disabled.solved git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@82 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/slsDetectorGui.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index 432e26292..fdced7387 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -6,7 +6,7 @@ UI_HEADERS_DIR = forms/include RESOURCES += icons.qrc -DEFINES += VERBOSE DACS_INT VERYVERBOSE +DEFINES += VERBOSE DACS_INT #VERYVERBOSE target.path += $(DESTDIR) From 9fc66d571ed8c39d690d3218be55f03c3c56ac96 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Mon, 1 Oct 2012 15:45:47 +0000 Subject: [PATCH 083/332] bug fix: run index, plots only new data, lockimage for clone git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@83 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qDefs.h | 2 +- slsDetectorGui/src/qCloneWidget.cpp | 4 +- slsDetectorGui/src/qDrawPlot.cpp | 137 +++++++++++++------------ slsDetectorGui/src/qTabMeasurement.cpp | 17 ++- 4 files changed, 87 insertions(+), 73 deletions(-) diff --git a/slsDetectorGui/include/qDefs.h b/slsDetectorGui/include/qDefs.h index 529c43631..5e9589b57 100644 --- a/slsDetectorGui/include/qDefs.h +++ b/slsDetectorGui/include/qDefs.h @@ -21,7 +21,7 @@ public: qDefs(){}; //------------------------------------------------------------------------------------------------------------------------------------------------- -#define GUI_VERSION 0.11 +#define GUI_VERSION 0.12 //------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/slsDetectorGui/src/qCloneWidget.cpp b/slsDetectorGui/src/qCloneWidget.cpp index 980e37a9f..7080cc548 100644 --- a/slsDetectorGui/src/qCloneWidget.cpp +++ b/slsDetectorGui/src/qCloneWidget.cpp @@ -96,7 +96,7 @@ void qCloneWidget::SetupWidgetWindow(QString title,int numDim,SlsQt1DPlot*& plot //------------------------------------------------------------------------------------------------------------------------------------------------- void qCloneWidget::SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis[],string histTitle[],bool lines,bool markers){ - /** for each plot*/cout<<"qclone histYAxis[0][500]:"<SetXTitle(histXAxisTitle.toAscii().constData()); - plot1D->SetYTitle(histYAxisTitle.toAscii().constData()); - for(int hist_num=0;hist_num<(int)nHists;hist_num++){ - SlsQtH1D* h; - if(hist_num+1>plot1D_hists.size()){ - if(anglePlot) - plot1D_hists.append(h=new SlsQtH1D("1d plot",histNBins,histXAngleAxis,histYAngleAxis)); - else - plot1D_hists.append(h=new SlsQtH1D("1d plot",histNBins,histXAxis,GetHistYAxis(hist_num))); - h->SetLineColor(hist_num+1); - }else{ - h=plot1D_hists.at(hist_num); - if(anglePlot) - h->SetData(histNBins,histXAngleAxis,histYAngleAxis); - else - h->SetData(histNBins,histXAxis,GetHistYAxis(hist_num)); + if(histNBins){ + Clear1DPlot(); + plot1D->SetXTitle(histXAxisTitle.toAscii().constData()); + plot1D->SetYTitle(histYAxisTitle.toAscii().constData()); + for(int hist_num=0;hist_num<(int)nHists;hist_num++){ + SlsQtH1D* h; + if(hist_num+1>plot1D_hists.size()){ + if(anglePlot) + plot1D_hists.append(h=new SlsQtH1D("1d plot",histNBins,histXAngleAxis,histYAngleAxis)); + else + plot1D_hists.append(h=new SlsQtH1D("1d plot",histNBins,histXAxis,GetHistYAxis(hist_num))); + h->SetLineColor(hist_num+1); + }else{ + h=plot1D_hists.at(hist_num); + if(anglePlot) + h->SetData(histNBins,histXAngleAxis,histYAngleAxis); + else + h->SetData(histNBins,histXAxis,GetHistYAxis(hist_num)); + } + SetStyle(h); + h->setTitle(GetHistTitle(hist_num)); + h->Attach(plot1D); } - SetStyle(h); - h->setTitle(GetHistTitle(hist_num)); - h->Attach(plot1D); + // update range if required + if(XYRangeChanged){ + if(!IsXYRange[qDefs::XMINIMUM]) XYRangeValues[qDefs::XMINIMUM]= plot1D->GetXMinimum(); + if(!IsXYRange[qDefs::XMAXIMUM]) XYRangeValues[qDefs::XMAXIMUM]= plot1D->GetXMaximum(); + if(!IsXYRange[qDefs::YMINIMUM]) XYRangeValues[qDefs::YMINIMUM]= plot1D->GetYMinimum(); + if(!IsXYRange[qDefs::YMAXIMUM]) XYRangeValues[qDefs::YMAXIMUM]= plot1D->GetYMaximum(); + plot1D->SetXMinMax(XYRangeValues[qDefs::XMINIMUM],XYRangeValues[qDefs::XMAXIMUM]); + plot1D->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]); + XYRangeChanged = false; + } + if(saveAll) SavePlotAutomatic(); + } + } + }//2-d plot stuff + else{ + if(lastImageArray){ + if(lastImageNumber&&last_plot_number!=(int)lastImageNumber && //there is a new plot + nPixelsX>0&&nPixelsY>0){ + cout<<"startpixel:"<GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,-0.5,nPixelsY-0.5,lastImageArray); + plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,startPixel,endPixel,lastImageArray); + plot2D->setTitle(GetImageTitle()); + plot2D->SetXTitle(imageXAxisTitle); + plot2D->SetYTitle(imageYAxisTitle); + plot2D->SetZTitle(imageZAxisTitle); + plot2D->UpdateNKeepSetRangeIfSet(); //this will keep a "set" z range, and call Plot()->Update(); } // update range if required if(XYRangeChanged){ - if(!IsXYRange[qDefs::XMINIMUM]) XYRangeValues[qDefs::XMINIMUM]= plot1D->GetXMinimum(); - if(!IsXYRange[qDefs::XMAXIMUM]) XYRangeValues[qDefs::XMAXIMUM]= plot1D->GetXMaximum(); - if(!IsXYRange[qDefs::YMINIMUM]) XYRangeValues[qDefs::YMINIMUM]= plot1D->GetYMinimum(); - if(!IsXYRange[qDefs::YMAXIMUM]) XYRangeValues[qDefs::YMAXIMUM]= plot1D->GetYMaximum(); - plot1D->SetXMinMax(XYRangeValues[qDefs::XMINIMUM],XYRangeValues[qDefs::XMAXIMUM]); - plot1D->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]); + if(!IsXYRange[qDefs::XMINIMUM]) XYRangeValues[qDefs::XMINIMUM]= plot2D->GetPlot()->GetXMinimum(); + if(!IsXYRange[qDefs::XMAXIMUM]) XYRangeValues[qDefs::XMAXIMUM]= plot2D->GetPlot()->GetXMaximum(); + if(!IsXYRange[qDefs::YMINIMUM]) XYRangeValues[qDefs::YMINIMUM]= plot2D->GetPlot()->GetYMinimum(); + if(!IsXYRange[qDefs::YMAXIMUM]) XYRangeValues[qDefs::YMAXIMUM]= plot2D->GetPlot()->GetYMaximum(); + plot2D->GetPlot()->SetXMinMax(XYRangeValues[qDefs::XMINIMUM],XYRangeValues[qDefs::XMAXIMUM]); + plot2D->GetPlot()->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]); XYRangeChanged = false; } if(saveAll) SavePlotAutomatic(); } } - }//2-d plot stuff - else{ - if(lastImageArray){ - if(lastImageNumber&&last_plot_number!=(int)lastImageNumber && //there is a new plot - nPixelsX>0&&nPixelsY>0){ - cout<<"startpixel:"<GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,-0.5,nPixelsY-0.5,lastImageArray); - plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,startPixel,endPixel,lastImageArray); - plot2D->setTitle(GetImageTitle()); - plot2D->SetXTitle(imageXAxisTitle); - plot2D->SetYTitle(imageYAxisTitle); - plot2D->SetZTitle(imageZAxisTitle); - plot2D->UpdateNKeepSetRangeIfSet(); //this will keep a "set" z range, and call Plot()->Update(); - } - // update range if required - if(XYRangeChanged){ - if(!IsXYRange[qDefs::XMINIMUM]) XYRangeValues[qDefs::XMINIMUM]= plot2D->GetPlot()->GetXMinimum(); - if(!IsXYRange[qDefs::XMAXIMUM]) XYRangeValues[qDefs::XMAXIMUM]= plot2D->GetPlot()->GetXMaximum(); - if(!IsXYRange[qDefs::YMINIMUM]) XYRangeValues[qDefs::YMINIMUM]= plot2D->GetPlot()->GetYMinimum(); - if(!IsXYRange[qDefs::YMAXIMUM]) XYRangeValues[qDefs::YMAXIMUM]= plot2D->GetPlot()->GetYMaximum(); - plot2D->GetPlot()->SetXMinMax(XYRangeValues[qDefs::XMINIMUM],XYRangeValues[qDefs::XMAXIMUM]); - plot2D->GetPlot()->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]); - XYRangeChanged = false; - } - if(saveAll) SavePlotAutomatic(); - } + //} + last_plot_number=lastImageNumber; + + //set plot title + boxPlot->setTitle(plotTitle); } + UnlockLastImageArray(); } - last_plot_number=lastImageNumber; - - //set plot title - boxPlot->setTitle(plotTitle); - - if(plotEnable) UnlockLastImageArray(); - //if acqq stopped before this line, it continues from here, shouldnt restart plotting timer if(!stop_signal){ @@ -1042,15 +1044,16 @@ void qDrawPlot::ClonePlot(){ } if(found) winClone[i]->SetRange(IsXYRange,XYRangeValues); //copy data - LockLastImageArray(); + //LockLastImageArray(); if(!anglePlot) winClone[i]->SetCloneHists((int)nHists,histNBins,histXAxis,histYAxis,histTitle,lines,markers); else winClone[i]->SetCloneHists((int)nHists,histNBins,histXAngleAxis,histYAngleAxis,histTitle,lines,markers); - UnlockLastImageArray(); + //UnlockLastImageArray(); } } else{ + plot2D = new SlsQt2DPlotLayout(boxPlot); plot2D->setFont(QFont("Sans Serif",9,QFont::Normal)); plot2D->setTitle(GetImageTitle()); diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 28a752a90..595251712 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -310,7 +310,12 @@ void qTabMeasurement::startStopAcquisition(){ emit StopSignal(); myDet->stopAcquisition(); progressTimer->stop(); - spinIndex->setValue(myPlot->GetFileIndex()); + //spin index + disconnect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int))); + spinIndex->setValue(myDet->getFileIndex()); + lblProgressIndex->setText(QString::number(spinIndex->value())); + connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int))); + btnStartStop->setText("Start"); btnStartStop->setIcon(*iconStart); btnStartStop->setChecked(false); @@ -330,8 +335,14 @@ void qTabMeasurement::UpdateFinished(){ btnStartStop->setChecked(false); Enable(1); connect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); + UpdateProgress(); - spinIndex->setValue(myPlot->GetFileIndex()); + //spin index + disconnect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int))); + spinIndex->setValue(myDet->getFileIndex()); + lblProgressIndex->setText(QString::number(spinIndex->value())); + connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int))); + progressTimer->stop(); } } @@ -352,7 +363,7 @@ void qTabMeasurement::SetCurrentMeasurement(int val){ void qTabMeasurement::UpdateProgress(){ progressBar->setValue((int)myPlot->GetProgress()); - lblProgressIndex->setText(QString::number(myPlot->GetFileIndex())); + lblProgressIndex->setText(QString::number(myPlot->GetFileIndex()+1)); } From 918765e06f2708dc2fc87234d2c82a58a2d5d5c5 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Mon, 1 Oct 2012 16:00:39 +0000 Subject: [PATCH 084/332] bug fix:output directory did not set when using browse. solved git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@84 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qTabDataOutput.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index 9096c4471..82cb45366 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -162,6 +162,7 @@ void qTabDataOutput::browseOutputDir() QString directory = QFileDialog::getExistingDirectory(this,tr("Choose Output Directory "),dispOutputDir->text()); if (!directory.isEmpty()) dispOutputDir->setText(directory); + setOutputDir(); } From b703e52563513ce0f7a37919fe914eddb8c84f95 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Mon, 8 Oct 2012 09:01:20 +0000 Subject: [PATCH 085/332] bug fix: got rid of title as measurement,as it should be empty git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@85 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_dataoutput.ui | 8 ++- slsDetectorGui/include/qDrawPlot.h | 6 +- slsDetectorGui/src/qDetectorMain.cpp | 2 +- slsDetectorGui/src/qDrawPlot.cpp | 79 +++++++++++---------- slsDetectorGui/src/qTabDataOutput.cpp | 11 +-- slsDetectorGui/src/qTabMeasurement.cpp | 1 + slsDetectorGui/src/qTabPlot.cpp | 22 ++---- 7 files changed, 67 insertions(+), 62 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_dataoutput.ui b/slsDetectorGui/forms/form_tab_dataoutput.ui index 104a296ee..853b53cb8 100644 --- a/slsDetectorGui/forms/form_tab_dataoutput.ui +++ b/slsDetectorGui/forms/form_tab_dataoutput.ui @@ -300,8 +300,14 @@ + + + 0 + 0 + + - Output Directory: + Output Directory : diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index 69b7ffa5f..5d8c31b96 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -53,8 +53,8 @@ public: /** gets the file index to the measurement tab*/ int GetFileIndex(){return currentFileIndex;}; - /** sets plot Title */ - void SetPlotTitle(QString title) {plotTitle = title;} + /** sets plot Title prefix*/ + void SetPlotTitlePrefix(QString title) {plotTitle_prefix = title;} /** sets 1D X Axis Title */ void SetHistXAxisTitle(QString title) {histXAxisTitle = title;} /** sets 1D Y Axis Title */ @@ -338,6 +338,8 @@ std::string histTitle[MAX_1DPLOTS]; std::string imageTitle; /** plot Title */ QString plotTitle; +/** plot Title prefix */ +QString plotTitle_prefix; /** 1D or 2D */ unsigned int plot_in_scope; /** Number of Pixels in X Axis */ diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 99adef4ea..0e8f4ac00 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -91,7 +91,7 @@ void qDetectorMain::SetUpWidgetWindow(){ centralwidget->setLayout(layoutTabs); // plot setup - myPlot = new qDrawPlot(dockWidgetPlot,myDet); + myPlot = new qDrawPlot(dockWidgetPlot,myDet);cout<<"DockPlot ready"<setWidget(myPlot); //tabs setup diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 2f5f161d7..febd7a493 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -119,7 +119,7 @@ void qDrawPlot::SetupWidgetWindow(){ setFont(QFont("Sans Serif",9)); layout = new QGridLayout; this->setLayout(layout); - boxPlot = new QGroupBox("Measurement"); + boxPlot = new QGroupBox(""); layout->addWidget(boxPlot,1,1); boxPlot->setAlignment(Qt::AlignHCenter); boxPlot->setFont(QFont("Sans Serif",11,QFont::Normal)); @@ -131,8 +131,8 @@ void qDrawPlot::SetupWidgetWindow(){ // Default titles- only for the initial picture histXAxisTitle="Channel Number"; histYAxisTitle="Counts"; - plotTitle = "Measurement"; - + plotTitle = ""; + plotTitle_prefix = ""; for(int i=0;ifileName).section('/',-1)); + while(1){ + if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ + //set title + plotTitle=QString(plotTitle_prefix)+QString(data->fileName).section('/',-1); - cout<<"angle plot"<angles==NULL){ - cout<<"\n\nWARNING:RETURNED NULL instead of angles."<values,nAnglePixelsX*sizeof(double)); - SetHistXAxisTitle("Channel Number"); + cout<angles==NULL){ + cout<<"\n\nWARNING:RETURNED NULL instead of angles."<values,nAnglePixelsX*sizeof(double)); + SetHistXAxisTitle("Channel Number"); + } + else{ + + lastImageNumber= currentFrame+1; + nAnglePixelsX = data->npoints; + histNBins = nAnglePixelsX; + nHists=1; + if(histXAngleAxis) delete [] histXAngleAxis; histXAngleAxis = new double[nAnglePixelsX]; + if(histYAngleAxis) delete [] histYAngleAxis; histYAngleAxis = new double[nAnglePixelsX]; + memcpy(histXAngleAxis,data->angles,nAnglePixelsX*sizeof(double)); + memcpy(histYAngleAxis,data->values,nAnglePixelsX*sizeof(double)); + SetHistXAxisTitle("Angles"); + } + pthread_mutex_unlock(&(last_image_complete_mutex)); + break; } - else{ - - lastImageNumber= currentFrame+1; - nAnglePixelsX = data->npoints; - histNBins = nAnglePixelsX; - nHists=1; - if(histXAngleAxis) delete [] histXAngleAxis; histXAngleAxis = new double[nAnglePixelsX]; - if(histYAngleAxis) delete [] histYAngleAxis; histYAngleAxis = new double[nAnglePixelsX]; - memcpy(histXAngleAxis,data->angles,nAnglePixelsX*sizeof(double)); - memcpy(histYAngleAxis,data->values,nAnglePixelsX*sizeof(double)); - SetHistXAxisTitle("Angles"); - } - pthread_mutex_unlock(&(last_image_complete_mutex)); } currentFrame++; return 0; @@ -616,7 +619,7 @@ int qDrawPlot::GetData(detectorData *data){ while(1){ if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ //set title - SetPlotTitle(QString(data->fileName).section('/',-1)); + plotTitle=QString(plotTitle_prefix)+QString(data->fileName).section('/',-1); //variables lastImageNumber= currentFrame+1; //title @@ -638,7 +641,7 @@ int qDrawPlot::GetData(detectorData *data){ while(1){ if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ //set title - SetPlotTitle(QString(data->fileName).section('/',-1)); + plotTitle=QString(plotTitle_prefix)+QString(data->fileName).section('/',-1); //variables if(currentFileIndex == minPixelsY) currentScanDivLevel = 0; lastImageNumber= currentFrame+1; @@ -661,7 +664,7 @@ int qDrawPlot::GetData(detectorData *data){ while(1){ if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ //set title - SetPlotTitle(QString(data->fileName).section('/',-1)); + plotTitle=QString(plotTitle_prefix)+QString(data->fileName).section('/',-1); //get scanvariable0 int ci = 0, p = 0; double cs0 = 0 , cs1 = 0; fileIOStatic::getVariablesFromFileName(string(data->fileName), ci, p, cs0, cs1); @@ -691,7 +694,7 @@ int qDrawPlot::GetData(detectorData *data){ while(1){ if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ //set title - SetPlotTitle(QString(data->fileName).section('/',-1)); + plotTitle=QString(plotTitle_prefix)+QString(data->fileName).section('/',-1); //get scanvariable1 int ci = 0, p = 0; double cs0 = 0 , cs1 = 0; fileIOStatic::getVariablesFromFileName(string(data->fileName), ci, p, cs0, cs1); @@ -720,7 +723,7 @@ int qDrawPlot::GetData(detectorData *data){ //normal measurement or 1d scans if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ //set title - SetPlotTitle(QString(data->fileName).section('/',-1)); + plotTitle=QString(plotTitle_prefix)+QString(data->fileName).section('/',-1); char temp_title[2000]; // only if you got the lock, do u need to remember lastimagenumber to plot lastImageNumber= currentFrame+1; @@ -1285,7 +1288,7 @@ int qDrawPlot::UpdateTrimbitPlot(bool fromDetector,bool Histogram){ //data memcpy(histYAxis[0],histTrimbits,nPixelsX*sizeof(double)); //title - boxPlot->setTitle("Trimbits Plot - Data Graph"); + boxPlot->setTitle("Trimbits_Plot_Data Graph"); plot1D->SetXTitle("Channel Number"); plot1D->SetYTitle("Trimbits"); //set plot parameters @@ -1314,7 +1317,7 @@ int qDrawPlot::UpdateTrimbitPlot(bool fromDetector,bool Histogram){ //delete [] histTrimbits; //title - boxPlot->setTitle("Trimbits Plot - Histogram"); + boxPlot->setTitle("Trimbits_Plot_Histogram"); plot1D->SetXTitle("Trimbits"); plot1D->SetYTitle("Frequency"); //set plot parameters diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index 82cb45366..d5887033d 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -119,7 +119,7 @@ void qTabDataOutput::SetupWidgetWindow(){ void qTabDataOutput::Initialization(){ //output dir connect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(setOutputDir())); - connect(btnOutputBrowse, SIGNAL(clicked()), this, SLOT(browseOutputDir())); + 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())); @@ -138,19 +138,22 @@ void qTabDataOutput::Initialization(){ void qTabDataOutput::setOutputDir(){ + disconnect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(setOutputDir())); + QString path = dispOutputDir->text(); //gets rid of the end '/'s - disconnect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(setOutputDir())); while(path.endsWith('/')) path.chop(1); dispOutputDir->setText(path); - connect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(setOutputDir())); + + //if(QFile::exists(path)) + myDet->setFilePath(string(path.toAscii().constData())); #ifdef VERBOSE cout << "Output Directory changed to :"<getFilePath() << endl; #endif - + connect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(setOutputDir())); } diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 595251712..f5c2ae8da 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -81,6 +81,7 @@ void qTabMeasurement::SetupWidgetWindow(){ //file write enabled/disabled chkFile->setChecked(myDet->enableWriteToFile()); + dispFileName->setEnabled(myDet->enableWriteToFile()); //creating the icons for the buttons iconStart = new QIcon(":/icons/images/start.png"); diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index 2ac8319c7..4adce2b2f 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -23,7 +23,7 @@ using namespace std; const QString qTabPlot::modeNames[5]={"None","Energy Scan","Threshold Scan","Trimbits Scan","Custom Script Scan"}; -QString qTabPlot::defaultPlotTitle("Measurement"); +QString qTabPlot::defaultPlotTitle(""); QString qTabPlot::defaultHistXAxisTitle("Channel Number"); QString qTabPlot::defaultHistYAxisTitle("Counts"); QString qTabPlot::defaultImageXAxisTitle("Pixel"); @@ -95,8 +95,8 @@ void qTabPlot::SetupWidgetWindow(){ dispZMax->setValidator(new QDoubleValidator(dispZMax)); //default titles - dispTitle->setText(defaultPlotTitle); - myPlot->SetPlotTitle(defaultPlotTitle); + dispTitle->setText(""); + myPlot->SetPlotTitlePrefix(""); dispXAxis->setText(defaultHistXAxisTitle); dispYAxis->setText(defaultHistYAxisTitle); myPlot->SetHistXAxisTitle(defaultHistXAxisTitle); @@ -261,7 +261,7 @@ void qTabPlot::EnablePersistency(bool enable){ void qTabPlot::SetTitles(){ // Plot Title if(dispTitle->isEnabled()) - myPlot->SetPlotTitle(dispTitle->text()); + myPlot->SetPlotTitlePrefix(dispTitle->text()); // X Axis if(dispXAxis->isEnabled()){ if(isOneD) myPlot->SetHistXAxisTitle(dispXAxis->text()); @@ -285,8 +285,8 @@ void qTabPlot::EnableTitles(){ // Plot Title dispTitle->setEnabled(chkTitle->isChecked()); if(!chkTitle->isChecked()){ - myPlot->SetPlotTitle(defaultPlotTitle); - dispTitle->setText(defaultPlotTitle); + myPlot->SetPlotTitlePrefix(""); + dispTitle->setText(""); } // X Axis dispXAxis->setEnabled(chkXAxis->isChecked()); @@ -588,8 +588,6 @@ void qTabPlot::EnablingNthFrameFunction(bool enable){ void qTabPlot::SetScanArgument(){ //as default from histogram and default titles are set here if scanbox is disabled - dispTitle->setText(defaultPlotTitle); - myPlot->SetPlotTitle(defaultPlotTitle); if(isOrginallyOneD){ dispXAxis->setText(defaultHistXAxisTitle); dispYAxis->setText(defaultHistYAxisTitle); @@ -611,10 +609,6 @@ void qTabPlot::SetScanArgument(){ //if scans(1D or 2D) if(boxScan->isEnabled()){ //setting the title according to the scans - QString mainTitle = QString(" Level 0 : ") + modeNames[myDet->getScanMode(0)] + - QString(" | Level 1 : ") + modeNames[myDet->getScanMode(1)] + QString(""); - dispTitle->setText(mainTitle); - myPlot->SetPlotTitle(mainTitle); Select1DPlot(isOrginallyOneD); if(isOrginallyOneD) myPlot->Select1DPlot(); else myPlot->Select2DPlot(); @@ -624,10 +618,6 @@ void qTabPlot::SetScanArgument(){ //else if(myDet->getPositions()){ //if scan, change title if((myDet->getScanMode(0))||(myDet->getScanMode(1))){ - QString mainTitle = QString(" Level 0 : ") + modeNames[myDet->getScanMode(0)] + - QString(" | Level 1 : ") + modeNames[myDet->getScanMode(1)] + QString(""); - dispTitle->setText(mainTitle); - myPlot->SetPlotTitle(mainTitle); } dispXAxis->setText("Angles"); myPlot->SetHistXAxisTitle("Angles"); From 87410f09deb376883726271738acfa1b139c8868 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 10 Oct 2012 10:25:31 +0000 Subject: [PATCH 086/332] check if outdir exists,indent Actions,degreeC,cascode,thresholdscan(ev),not saving data secondary title,got rid of 2d sampledata git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@86 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_scan.ui | 2 +- slsDetectorGui/forms/form_tab_dataoutput.ui | 29 ++++++++- slsDetectorGui/forms/form_tab_plot.ui | 2 +- slsDetectorGui/include/qDefs.h | 2 +- slsDetectorGui/include/qDrawPlot.h | 6 +- slsDetectorGui/include/qTabActions.h | 12 +++- slsDetectorGui/include/qTabDataOutput.h | 1 + slsDetectorGui/src/qDrawPlot.cpp | 33 +++++----- slsDetectorGui/src/qScanWidget.cpp | 6 +- slsDetectorGui/src/qTabActions.cpp | 67 ++++++++++++++++----- slsDetectorGui/src/qTabDataOutput.cpp | 33 ++++++++-- slsDetectorGui/src/qTabDeveloper.cpp | 17 +++--- slsDetectorGui/src/qTabMeasurement.cpp | 3 +- 13 files changed, 156 insertions(+), 57 deletions(-) diff --git a/slsDetectorGui/forms/form_scan.ui b/slsDetectorGui/forms/form_scan.ui index f01e88cb0..e5790c978 100644 --- a/slsDetectorGui/forms/form_scan.ui +++ b/slsDetectorGui/forms/form_scan.ui @@ -367,7 +367,7 @@ Defines scan range for a <b>Constant Step Size</b> with the followin - Energy Scan + Energy Scan (eV) diff --git a/slsDetectorGui/forms/form_tab_dataoutput.ui b/slsDetectorGui/forms/form_tab_dataoutput.ui index 853b53cb8..e2ad9d6d6 100644 --- a/slsDetectorGui/forms/form_tab_dataoutput.ui +++ b/slsDetectorGui/forms/form_tab_dataoutput.ui @@ -299,23 +299,48 @@ -1 - + 0 0 + + <nobr> +Directory where one saves the data. +</nobr><br> + #outdir# +<br> + + Output Directory : - + + + <nobr> +Directory where one saves the data. +</nobr><br> + #outdir# +<br> + + + + + <nobr> +Directory where one saves the data. +</nobr><br> + #outdir# +<br> + + Browse diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index 1a55404bd..8ddd673c9 100644 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -638,7 +638,7 @@ - Title: + Title Prefix: diff --git a/slsDetectorGui/include/qDefs.h b/slsDetectorGui/include/qDefs.h index 5e9589b57..9d55103a8 100644 --- a/slsDetectorGui/include/qDefs.h +++ b/slsDetectorGui/include/qDefs.h @@ -21,7 +21,7 @@ public: qDefs(){}; //------------------------------------------------------------------------------------------------------------------------------------------------- -#define GUI_VERSION 0.12 +#define GUI_VERSION 0.13 //------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index 5d8c31b96..f970ad1c2 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -52,6 +52,9 @@ public: int GetProgress(){return progress;}; /** gets the file index to the measurement tab*/ int GetFileIndex(){return currentFileIndex;}; + /** sets file write enable , if not enabled, + * file index wont increase and so you need secondary titles to differentitate between plots*/ + void SetEnableFileWrite(bool enable){fileSaveEnable = enable;}; /** sets plot Title prefix*/ void SetPlotTitlePrefix(QString title) {plotTitle_prefix = title;} @@ -448,7 +451,8 @@ static const int TRIM_HISTOGRAM_XMAX = 63; /**if the values increment backwards*/ bool backwardScanPlot; - +/**if files will be saved and index increased*/ +bool fileSaveEnable; signals: void UpdatingPlotFinished(); diff --git a/slsDetectorGui/include/qTabActions.h b/slsDetectorGui/include/qTabActions.h index 0add44491..35f955124 100644 --- a/slsDetectorGui/include/qTabActions.h +++ b/slsDetectorGui/include/qTabActions.h @@ -85,7 +85,17 @@ private: slsDetectorDefs::detectorType detType; - enum actionIndex{Scan0=1, Scan1, NumPositions=4, NumTotalActions=9}; + enum actionIndex{ + ActionStart, + Scan0, + Scan1, + ActionBefore, + NumPositions, + HeaderBefore, + HeaderAfter, + ActionAfter, + ActionStop, + NumTotalActions}; QGridLayout *gridLayout; QButtonGroup *group; diff --git a/slsDetectorGui/include/qTabDataOutput.h b/slsDetectorGui/include/qTabDataOutput.h index 0f5a9d680..8c65edb0a 100644 --- a/slsDetectorGui/include/qTabDataOutput.h +++ b/slsDetectorGui/include/qTabDataOutput.h @@ -49,6 +49,7 @@ private: QString flatFieldTip; QString errFlatFieldTip; + QString outDirTip; QPalette red; /** methods */ diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index febd7a493..1a3364524 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -66,15 +66,17 @@ void qDrawPlot::SetupWidgetWindow(){ //gui_acquisition_thread_running = 0; // Default Plotting plot_in_scope = 0; - //2d lastImageNumber = 0; last_plot_number = 0; nPixelsX = myDet->getTotalNumberOfChannels(); nPixelsY = 100; nAnglePixelsX = 1; - minPixelsY = 0; + maxPixelsY = 0; + startPixel=-0.5; + endPixel=nPixelsY-0.5; + //2d lastImageArray = 0; //1d @@ -156,6 +158,7 @@ void qDrawPlot::SetupWidgetWindow(){ plot2D = new SlsQt2DPlotLayout(boxPlot); plot2D->setFont(QFont("Sans Serif",9,QFont::Normal)); + plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,startPixel,endPixel,lastImageArray); plot2D->setTitle(GetImageTitle()); plot2D->SetXTitle(imageXAxisTitle); plot2D->SetYTitle(imageYAxisTitle); @@ -182,6 +185,8 @@ void qDrawPlot::SetupWidgetWindow(){ fileName = QString(myDet->getFileName().c_str()); + fileSaveEnable= myDet->enableWriteToFile(); + // Setting the callback function to get data from detector class myDet->registerDataCallback(&(GetDataCallBack),this); @@ -540,7 +545,10 @@ int qDrawPlot::GetData(detectorData *data){ //Plot Disabled if(!plotEnable) return 0; - + // secondary title necessary to differentiate between frames when not saving data + char temp_title[2000]; + if(fileSaveEnable) strcpy(temp_title,""); + else sprintf(temp_title,"#%d",currentFrame); //angle plotting @@ -549,8 +557,9 @@ int qDrawPlot::GetData(detectorData *data){ if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ //set title plotTitle=QString(plotTitle_prefix)+QString(data->fileName).section('/',-1); + // Title + histTitle[0] = temp_title; - cout<angles==NULL){ cout<<"\n\nWARNING:RETURNED NULL instead of angles."<values,nPixelsX*sizeof(double)); @@ -646,8 +653,6 @@ int qDrawPlot::GetData(detectorData *data){ if(currentFileIndex == minPixelsY) currentScanDivLevel = 0; lastImageNumber= currentFrame+1; //title - char temp_title[2000]; - sprintf(temp_title,"Image Index %d",currentFileIndex); imageTitle = temp_title; //copy data for(unsigned int px=0;pxvalues[px]; @@ -678,8 +683,6 @@ int qDrawPlot::GetData(detectorData *data){ currentScanValue = cs0; lastImageNumber= currentFrame+1; //title - char temp_title[2000]; - sprintf(temp_title,"Image Index %d",currentFileIndex); imageTitle = temp_title; //copy data for(unsigned int px=0;pxvalues[px]; @@ -706,8 +709,6 @@ int qDrawPlot::GetData(detectorData *data){ currentScanValue = cs1; lastImageNumber= currentFrame+1; //title - char temp_title[2000]; - sprintf(temp_title,"Image Index %d",currentFileIndex); imageTitle = temp_title; //copy data for(unsigned int px=0;pxvalues[px]; @@ -724,13 +725,13 @@ int qDrawPlot::GetData(detectorData *data){ if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ //set title plotTitle=QString(plotTitle_prefix)+QString(data->fileName).section('/',-1); - char temp_title[2000]; // only if you got the lock, do u need to remember lastimagenumber to plot lastImageNumber= currentFrame+1; //1d if(plot_in_scope==1){ - // Titles changed to "" inside startstopthread + // Titles + histTitle[0] = temp_title; // Persistency if(currentPersistency < persistency)currentPersistency++; else currentPersistency=persistency; @@ -742,9 +743,8 @@ int qDrawPlot::GetData(detectorData *data){ memcpy(histYAxis[0],data->values,nPixelsX*sizeof(double)); } //2d - else{ + else{cout<GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,startPixel,endPixel,lastImageArray); plot2D->setFont(QFont("Sans Serif",9,QFont::Normal)); plot2D->setTitle(GetImageTitle()); plot2D->SetXTitle(imageXAxisTitle); diff --git a/slsDetectorGui/src/qScanWidget.cpp b/slsDetectorGui/src/qScanWidget.cpp index 99453ca93..dabe62075 100644 --- a/slsDetectorGui/src/qScanWidget.cpp +++ b/slsDetectorGui/src/qScanWidget.cpp @@ -92,7 +92,7 @@ void qScanWidget::SetupWidgetWindow(){ spinFrom->setMinimum(-1000000); spinFrom->setKeyboardTracking(false); spinFrom->setFixedWidth(80); - spinFrom->setDecimals(4); + spinFrom->setDecimals(2); lblTo->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); lblTo->setToolTip(rangeTip); lblTo->setFixedWidth(18); @@ -102,7 +102,7 @@ void qScanWidget::SetupWidgetWindow(){ spinTo->setMinimum(-1000000); spinTo->setKeyboardTracking(false); spinTo->setFixedWidth(80); - spinTo->setDecimals(4); + spinTo->setDecimals(2); lblSize->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); lblSize->setToolTip(rangeTip); lblSize->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); @@ -113,7 +113,7 @@ void qScanWidget::SetupWidgetWindow(){ spinSize->setSingleStep(0.1); spinSize->setToolTip(rangeTip); spinSize->setKeyboardTracking(false); - spinSize->setDecimals(4); + spinSize->setDecimals(2); //spinSize->setMinimum(0.0001); layoutRange->addItem(new QSpacerItem(40,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); diff --git a/slsDetectorGui/src/qTabActions.cpp b/slsDetectorGui/src/qTabActions.cpp index 7cac28e22..edcc12346 100644 --- a/slsDetectorGui/src/qTabActions.cpp +++ b/slsDetectorGui/src/qTabActions.cpp @@ -40,7 +40,8 @@ qTabActions::~qTabActions(){ void qTabActions::SetupWidgetWindow(){ // Window Settings - setFixedSize(710,350); + setFixedHeight(350); + //setFixedSize(710,350); setContentsMargins(0,0,0,0); // Scroll Area Settings @@ -62,7 +63,7 @@ void qTabActions::SetupWidgetWindow(){ QPalette p; p.setColor(QPalette::Shadow,QColor(0,0,0,0)); p.setColor(QPalette::Button,QColor(0,0,0,0)); - +/*get rid of this vector*/ char names[NumTotalActions][200] = { "Action at Start", "Scan Level 0", @@ -81,6 +82,10 @@ void qTabActions::SetupWidgetWindow(){ QString tip = "Click on the \"+\" to Expand or \"-\" to Collapse."; + + + int hIndent=0, vIndent=0, colspan=6; + QLabel *lblReal; // For each level of Actions for(int i=0;isetToolTip(tip); - btnExpand[i]->setCheckable(true); btnExpand[i]->setChecked(false); btnExpand[i]->setFixedSize(16,16); @@ -98,32 +102,62 @@ void qTabActions::SetupWidgetWindow(){ btnExpand[i]->setFlat(true); btnExpand[i]->setIconSize(QSize(16,16)); btnExpand[i]->setPalette(p); - group->addButton(btnExpand[i],i); - //add the widgets to the layout , depending on the type create the widgets - gridLayout->addWidget(btnExpand[i],(i*2),0); - gridLayout->addWidget(lblName[i],(i*2),1); - if(i==NumPositions){ + //add label and button to expand or collapse + gridLayout->addWidget(btnExpand[i],vIndent,hIndent,1,1); + gridLayout->addWidget(lblName[i],vIndent,hIndent+1,1,colspan); + + //creating the action/scan/position widgets and adding them + switch(i){ + case NumPositions: CreatePositionsWidget(); - gridLayout->addWidget(positionWidget,(i*2)+1,1,1,2); + gridLayout->addWidget(positionWidget,vIndent+1,hIndent+1,1,colspan); positionWidget->hide(); - }else if((i==Scan0)||(i==Scan1)){ + break; + case Scan0: + case Scan1: scanWidget[qScanWidget::NUM_SCAN_WIDGETS] = new qScanWidget(this,myDet); - gridLayout->addWidget(scanWidget[qScanWidget::NUM_SCAN_WIDGETS-1],(i*2)+1,1,1,2); + gridLayout->addWidget(scanWidget[qScanWidget::NUM_SCAN_WIDGETS-1],vIndent+1,hIndent+1,1,colspan); scanWidget[qScanWidget::NUM_SCAN_WIDGETS-1]->hide(); - }else{ + break; + default: actionWidget[qActionsWidget::NUM_ACTION_WIDGETS] = new qActionsWidget(this,myDet); - gridLayout->addWidget(actionWidget[qActionsWidget::NUM_ACTION_WIDGETS-1],(i*2)+1,1,1,2); + gridLayout->addWidget(actionWidget[qActionsWidget::NUM_ACTION_WIDGETS-1],vIndent+1,hIndent+1,1,colspan); actionWidget[qActionsWidget::NUM_ACTION_WIDGETS-1]->hide(); + break; + } + + //incrementing the vertical and horizontal indent + vIndent+=2; + switch(i){ + case HeaderBefore: + //real time acquisition + palette->setColor(QPalette::Active,QPalette::WindowText,QColor(0,0,200,255)); + lblReal = new QLabel(" Real Time Acquisition"); + lblReal->setFixedHeight(25); + //lblReal->setPalette(*palette); + gridLayout->addWidget(lblReal,vIndent,hIndent+1,1,colspan); + vIndent++; + break; + case HeaderAfter: + hIndent-=2; + colspan+=2; + break; + case ActionAfter: + hIndent=0; + colspan=6; + break; + default: + hIndent++; + colspan--; + break; } - //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); } + //Number of positions is only for mythen or gotthard detType = myDet->getDetectorsType(); if((detType == slsDetectorDefs::EIGER) || (detType == slsDetectorDefs::AGIPD)) { @@ -174,6 +208,7 @@ void qTabActions::SetupWidgetWindow(){ void qTabActions::CreatePositionsWidget(){ positionWidget = new QWidget; positionWidget->setFixedHeight(25); + positionWidget->setFixedWidth(680); QGridLayout *layout = new QGridLayout(positionWidget); layout->setContentsMargins(0,0,0,0); diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index d5887033d..50d841b93 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -64,6 +64,7 @@ void qTabDataOutput::SetupWidgetWindow(){ QString("" "Enter a valid file to enable Flat Field."); + outDirTip = dispOutputDir->toolTip(); Initialization(); @@ -146,13 +147,29 @@ void qTabDataOutput::setOutputDir(){ while(path.endsWith('/')) path.chop(1); dispOutputDir->setText(path); - //if(QFile::exists(path)) + if(QFile::exists(path)){ + lblOutputDir->setText("Output Directory: "); + lblOutputDir->setPalette(chkRate->palette()); + lblOutputDir->setToolTip(outDirTip); + dispOutputDir->setToolTip(outDirTip); + btnOutputBrowse->setToolTip(outDirTip); + myDet->setFilePath(string(path.toAscii().constData())); + #ifdef VERBOSE + cout << "Output Directory changed to :"<getFilePath() << endl; + #endif + } + else{ + lblOutputDir->setText("Output Directory:*"); + lblOutputDir->setPalette(red); + QString errTip = outDirTip + + QString("" + "Enter a valid path to change Output Directory."); + lblOutputDir->setToolTip(errTip); + dispOutputDir->setToolTip(errTip); + btnOutputBrowse->setToolTip(errTip); + } - myDet->setFilePath(string(path.toAscii().constData())); -#ifdef VERBOSE - cout << "Output Directory changed to :"<getFilePath() << endl; -#endif connect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(setOutputDir())); } @@ -454,7 +471,11 @@ void qTabDataOutput::Refresh(){ cout << "Getting output directory" << endl; #endif dispOutputDir->setText(QString(myDet->getFilePath().c_str())); - + lblOutputDir->setText("Output Directory: "); + lblOutputDir->setPalette(chkRate->palette()); + lblOutputDir->setToolTip(outDirTip); + dispOutputDir->setToolTip(outDirTip); + btnOutputBrowse->setToolTip(outDirTip); //flat field correction from server #ifdef VERBOSE diff --git a/slsDetectorGui/src/qTabDeveloper.cpp b/slsDetectorGui/src/qTabDeveloper.cpp index 32a00201d..3b7692ab2 100644 --- a/slsDetectorGui/src/qTabDeveloper.cpp +++ b/slsDetectorGui/src/qTabDeveloper.cpp @@ -71,14 +71,14 @@ void qTabDeveloper::SetupWidgetWindow(){ case slsDetectorDefs::GOTTHARD: NUM_DAC_WIDGETS = 8; NUM_ADC_WIDGETS = 2; - dacNames.push_back("Reference Voltage:"); - dacNames.push_back("Cascade n Voltage:"); - dacNames.push_back("Cascade p Voltage:"); - dacNames.push_back("Comp. Output Voltage:"); - dacNames.push_back("Cascade out Voltage:"); - dacNames.push_back("Comp. Input Voltage:"); - dacNames.push_back("Comp. Ref Voltage:"); - dacNames.push_back("Base Test Current:"); + dacNames.push_back("v Reference:"); + dacNames.push_back("v Cascode n:"); + dacNames.push_back("v Cascode p:"); + dacNames.push_back("v Comp. Output:"); + dacNames.push_back("v Cascode out"); + dacNames.push_back("v Comp. Input:"); + dacNames.push_back("v Comp. Ref:"); + dacNames.push_back("i Base Test:"); adcNames.push_back("Temperature ADC:"); adcNames.push_back("Temperature FPGA:"); @@ -194,6 +194,7 @@ void qTabDeveloper::CreateADCWidgets(){ lblAdcs[i] = new QLabel(QString(adcNames[i].c_str()),boxAdcs); spinAdcs[i] = new QDoubleSpinBox(boxAdcs); spinAdcs[i]->setMaximum(10000); + if(detType==slsDetectorDefs::GOTTHARD) spinAdcs[i]->setSuffix(0x00b0+QString("C")); adcLayout->addWidget(lblAdcs[i],(int)(i/2),((i%2)==0)?1:4); adcLayout->addWidget(spinAdcs[i],(int)(i/2),((i%2)==0)?2:5); diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index f5c2ae8da..69d239a91 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -364,7 +364,7 @@ void qTabMeasurement::SetCurrentMeasurement(int val){ void qTabMeasurement::UpdateProgress(){ progressBar->setValue((int)myPlot->GetProgress()); - lblProgressIndex->setText(QString::number(myPlot->GetFileIndex()+1)); + lblProgressIndex->setText(QString::number(myPlot->GetFileIndex())); } @@ -728,6 +728,7 @@ void qTabMeasurement::EnableFileWrite(bool enable){ myDet->enableWriteToFile(enable); dispFileName->setEnabled(enable); if(enable) setFileName(dispFileName->text()); + myPlot->SetEnableFileWrite(enable); }; //------------------------------------------------------------------------------------------------------------------------------------------------- From 55f7145b1bc6a3cb61169549c717b3660c85bb7f Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 10 Oct 2012 12:12:00 +0000 Subject: [PATCH 087/332] bugfix:settings undefined and uninitialized not disabled anymore git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@87 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qTabSettings.cpp | 83 +++++++++++------------------ 1 file changed, 32 insertions(+), 51 deletions(-) diff --git a/slsDetectorGui/src/qTabSettings.cpp b/slsDetectorGui/src/qTabSettings.cpp index b68652894..038c2ab86 100644 --- a/slsDetectorGui/src/qTabSettings.cpp +++ b/slsDetectorGui/src/qTabSettings.cpp @@ -77,16 +77,7 @@ void qTabSettings::SetupDetectorSettings(){ index[i] = model->index(i, comboSettings->modelColumn(), comboSettings->rootModelIndex()); item[i] = model->itemFromIndex(index[i]); } - // Enabling/Disabling depending on the detector type - // Undefined and uninitialized are enabled for all detectors - if(sett==slsDetectorDefs::UNDEFINED) - item[(int)Uninitialized]->setEnabled(false); - else if(sett==slsDetectorDefs::UNINITIALIZED) - item[(int)Undefined]->setEnabled(false); - else{ - item[(int)Uninitialized]->setEnabled(false); - item[(int)Undefined]->setEnabled(false); - } + switch(detType){ case slsDetectorDefs::MYTHEN: item[(int)Standard]->setEnabled(true); @@ -116,7 +107,7 @@ void qTabSettings::SetupDetectorSettings(){ item[(int)VeryHighGain]->setEnabled(true); break; default: - qDefs::Message(qDefs::CRITICAL,"Unknown detector type.","Settings"); + qDefs::Message(qDefs::CRITICAL,"Unknown detector type. Exiting GUI.","Settings"); exit(-1); break; } @@ -124,8 +115,7 @@ void qTabSettings::SetupDetectorSettings(){ // This should not happen -only if the server and gui has a mismatch // on which all modes are allowed in detectors if(!(item[(int)sett]->isEnabled())){ - qDefs::Message(qDefs::CRITICAL,"Unknown Detector Settings retrieved from detector. " - "Exiting GUI.","Settings"); + qDefs::Message(qDefs::CRITICAL,"Unknown Detector Settings retrieved from detector. Exiting GUI.","Settings"); #ifdef VERBOSE cout << "ERROR: Unknown Detector Settings retrieved from detector." << endl; #endif @@ -152,30 +142,22 @@ void qTabSettings::Initialization(){ //------------------------------------------------------------------------------------------------------------------------------------------------- void qTabSettings::setSettings(int index){ - // The first time settings is changed from undefined or uninitialized to a proper setting, - // then undefined/uninitialized should be disabled - if(item[(int)Undefined]->isEnabled()){ - //Do not disable it if this wasnt selected again by mistake - if(index!=(int)Undefined) - item[(int)Undefined]->setEnabled(false); - }else if(item[(int)Uninitialized]->isEnabled()){ - //Do not disable it if this wasnt selected again by mistake - if(index!=(int)Uninitialized) - item[(int)Uninitialized]->setEnabled(false); + //dont set it if settings is set to undefined or uninitialized + if((index==Undefined)||(index==Uninitialized)){ + qDefs::Message(qDefs::WARNING,"Cannot change settings to Undefined or Uninitialized.","Settings"); + disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int))); + comboSettings->setCurrentIndex((int)myDet->getSettings()); + connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int))); } - slsDetectorDefs::detectorSettings sett = myDet->setSettings((slsDetectorDefs::detectorSettings)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{//mythen or eiger - if((index==Undefined)||(index==Uninitialized)){ - lblThreshold->setEnabled(false); - spinThreshold->setEnabled(false); - }else{ + else{ + slsDetectorDefs::detectorSettings sett = myDet->setSettings((slsDetectorDefs::detectorSettings)index); + #ifdef VERBOSE + cout << "Settings have been set to " << myDet->slsDetectorBase::getDetectorSettings(sett) << endl; + #endif + + //threshold + if((detType==slsDetectorDefs::MYTHEN)||(detType==slsDetectorDefs::EIGER)){ lblThreshold->setEnabled(true); spinThreshold->setEnabled(true); SetEnergy(); @@ -183,8 +165,6 @@ void qTabSettings::setSettings(int index){ if(expertMode) emit UpdateTrimbitSignal(0); } } - - } //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -263,15 +243,6 @@ void qTabSettings::Refresh(){ cout << endl << "**Updating Settings Tab" << endl; #endif - // Settings -#ifdef VERBOSE - cout << "Getting settings" << endl; -#endif - //changin the combo settings also plots the trimbits for mythen and eiger, so disconnect - disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int))); - SetupDetectorSettings();//comboSettings->setCurrentIndex(myDet->getSettings()); - connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int))); - // Number of Modules #ifdef VERBOSE @@ -292,11 +263,20 @@ void qTabSettings::Refresh(){ 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)){ + + // Settings +#ifdef VERBOSE + cout << "Getting settings" << endl; +#endif + disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int))); + comboSettings->setCurrentIndex((int)myDet->getSettings()); + connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int))); + + + //threshold + int sett = comboSettings->currentIndex(); + if((detType==slsDetectorDefs::MYTHEN)||(detType==slsDetectorDefs::EIGER)){ + if((sett==Undefined)||(sett==Uninitialized)){ lblThreshold->setEnabled(false); spinThreshold->setEnabled(false); }else{ @@ -309,6 +289,7 @@ void qTabSettings::Refresh(){ } } + #ifdef VERBOSE cout << "**Updated Settings Tab" << endl << endl; #endif From ad171a3257744fa6feb4fd9966bf1df79cced372 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 10 Oct 2012 15:42:23 +0000 Subject: [PATCH 088/332] enhancement:plotting interval changed to red for error git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@88 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_plot.ui | 9 ++ slsDetectorGui/include/qTabActions.h | 75 +++++++------ slsDetectorGui/include/qTabMeasurement.h | 1 - slsDetectorGui/include/qTabPlot.h | 134 +++++++++++------------ slsDetectorGui/src/qDetectorMain.cpp | 1 - slsDetectorGui/src/qTabMeasurement.cpp | 8 +- slsDetectorGui/src/qTabPlot.cpp | 93 +++++++++++----- 7 files changed, 182 insertions(+), 139 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index 8ddd673c9..c7533aa53 100644 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -1095,6 +1095,15 @@ 49 + + <nobr> +Interval between plots has 2 modes. A condition to be satisfied, in order to avoid losing images: +</nobr><br><br><nobr> +<b>Time Interval</b>: (Acquisition Period) * (nth Image) >= 250ms. +</nobr><br><nobr> +<b>Every nth Image</b>: minimum of 250ms. +</nobr> + Interval between Plots diff --git a/slsDetectorGui/include/qTabActions.h b/slsDetectorGui/include/qTabActions.h index 35f955124..bd5a073cd 100644 --- a/slsDetectorGui/include/qTabActions.h +++ b/slsDetectorGui/include/qTabActions.h @@ -50,35 +50,13 @@ public: public slots: -/** Disable Positions - * @param enable true if to disable - * */ -void EnablePositions(bool enable); + /** Disable Positions + * @param enable true if to disable + * */ + void EnablePositions(bool enable); private: - /** Sets up the widget */ - void SetupWidgetWindow(); - - /** Sets up all the slots and signals */ - void Initialization(); - - /** creates the Num Positions object */ - void CreatePositionsWidget(); - - /** Returns the index in each of the classes - * of actionwidget and scanwidget - * @param index the index in the list of all widgets - * returns actual index of the class - */ - int GetActualIndex(int index); - - /** Updates to green color if collapsed and mode not none - */ - void UpdateCollapseColors(); - - - /** The sls detector object */ multiSlsDetector *myDet; @@ -124,21 +102,46 @@ private: QIcon *iconPlus; QIcon *iconMinus; + + /** Sets up the widget */ + void SetupWidgetWindow(); + + /** Sets up all the slots and signals */ + void Initialization(); + + /** creates the Num Positions object */ + void CreatePositionsWidget(); + + /** Returns the index in each of the classes + * of actionwidget and scanwidget + * @param index the index in the list of all widgets + * returns actual index of the class + */ + int GetActualIndex(int index); + + /** Updates to green color if collapsed and mode not none + */ + void UpdateCollapseColors(); + + + + private slots: -/** To Expand the Action Widget - * */ -void Expand(QAbstractButton *button); + /** To Expand the Action Widget + * */ + void Expand(QAbstractButton *button); -/** Sets the positions list and the number of positions - * */ -void SetPosition(); + /** Sets the positions list and the number of positions + * */ + void SetPosition(); + + /** Deletes current position + * */ + void DeletePosition(); -/** Deletes current position - * */ -void DeletePosition(); signals: -void EnableScanBox(); + void EnableScanBox(); }; diff --git a/slsDetectorGui/include/qTabMeasurement.h b/slsDetectorGui/include/qTabMeasurement.h index a77b31664..f4d9ca1e6 100644 --- a/slsDetectorGui/include/qTabMeasurement.h +++ b/slsDetectorGui/include/qTabMeasurement.h @@ -177,7 +177,6 @@ signals: void StartSignal(); void StopSignal(); void CheckPlotIntervalSignal(); - void EnableNthFrameSignal(bool); }; diff --git a/slsDetectorGui/include/qTabPlot.h b/slsDetectorGui/include/qTabPlot.h index cee77ef64..308f0f18f 100644 --- a/slsDetectorGui/include/qTabPlot.h +++ b/slsDetectorGui/include/qTabPlot.h @@ -48,8 +48,43 @@ public: private: + /** The sls detector object */ + multiSlsDetector *myDet; + + /** The Plot widget */ + qDrawPlot *myPlot; + + /** 1d/2d plot */ + bool isOneD; + bool isOrginallyOneD; + + /**is set if its a possible wrong interval between plots*/ + bool wrongInterval; + + QStackedLayout *stackedLayout; + QSpinBox *spinNthFrame; + QDoubleSpinBox *spinTimeGap; + QComboBox *comboTimeGapUnit; + QButtonGroup *btnGroupScan; + + /** some Default Values */ + static QString defaultPlotTitle; + static QString defaultHistXAxisTitle; + static QString defaultHistYAxisTitle; + static QString defaultImageXAxisTitle; + static QString defaultImageYAxisTitle; + static QString defaultImageZAxisTitle; + + /** scans */ + static const QString modeNames[5]; + + /** error palette*/ + QPalette *red; + QString intervalTip; + + + -/** methods */ /** Sets up the widget */ void SetupWidgetWindow(); @@ -66,91 +101,52 @@ private: public slots: -/** Set frequency between plots*/ -void SetFrequency(); -/** Enable Scan box - */ -void EnableScanBox(); + /** Set frequency between plots*/ + void SetFrequency(); -/** a variable is set when timing mode has been changed. - * This variable is also disabled if exptime>acq period to be on safe side - * Its to check whether to enabled nth frame for frequency plot - * @param enable enable/disable - */ -void EnableNthFrame(bool enable){enableNFrame = enable;}; - - - - - -/** Disables scanbox while running - * @param disable true to disable - */ -//void DisableScanBoxWhileRunning(bool disable); + /** Enable Scan box + */ + void EnableScanBox(); private slots: -/** Selects the plot to display, enables/disables widgets - * @param b true to select plot dimension 1, else false to select 2D - */ -void Select1DPlot(bool b); + /** Selects the plot to display, enables/disables widgets + * @param b true to select plot dimension 1, else false to select 2D + */ + void Select1DPlot(bool b); -/**Enables Persistency depending on Superimpose checkbox */ -void EnablePersistency(bool enable); + /**Enables Persistency depending on Superimpose checkbox */ + void EnablePersistency(bool enable); -/**Sets the titles in plot axis */ -void SetTitles(); -/** Enables/Sets default Titles to default */ -void EnableTitles(); -/** Enables range of the axes */ -void EnableRange(); -/** Sets the range of the x and y axes */ -void SetAxesRange(); -/** Sets the range of the z axis */ -void SetZRange(); -/** Enables the range of the z axis */ -void EnableZRange(); -/** Set Plot to none, data graph, histogram*/ -void SetPlot(); + /**Sets the titles in plot axis */ + void SetTitles(); + /** Enables/Sets default Titles to default */ + void EnableTitles(); -private: -/** The sls detector object */ -multiSlsDetector *myDet; + /** Enables range of the axes */ + void EnableRange(); -/** The Plot widget */ -qDrawPlot *myPlot; + /** Sets the range of the x and y axes */ + void SetAxesRange(); -/** 1d/2d plot */ -bool isOneD; -bool isOrginallyOneD; + /** Sets the range of the z axis */ + void SetZRange(); -/**whether to enable nth frame according to timing mode*/ -bool enableNFrame; + /** Enables the range of the z axis */ + void EnableZRange(); -QStackedLayout *stackedLayout; -QSpinBox *spinNthFrame; -QDoubleSpinBox *spinTimeGap; -QComboBox *comboTimeGapUnit; -QButtonGroup *btnGroupScan; + /** Set Plot to none, data graph, histogram*/ + void SetPlot(); -/** some Default Values */ -static QString defaultPlotTitle; -static QString defaultHistXAxisTitle; -static QString defaultHistYAxisTitle; -static QString defaultImageXAxisTitle; -static QString defaultImageYAxisTitle; -static QString defaultImageZAxisTitle; - -/** scans */ -static const QString modeNames[5]; signals: -void DisableZoomSignal(bool); -void SetZRangeSignal(double,double); -void EnableZRangeSignal(bool); + void DisableZoomSignal(bool); + void SetZRangeSignal(double,double); + void EnableZRangeSignal(bool); + }; diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 0e8f4ac00..469c43c83 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -235,7 +235,6 @@ void qDetectorMain::Initialization(){ connect(tab_measurement, SIGNAL(StartSignal()), this,SLOT(EnableTabs())); connect(tab_measurement, SIGNAL(StopSignal()), myPlot,SLOT(StopAcquisition())); connect(tab_measurement, SIGNAL(CheckPlotIntervalSignal()), tab_plot,SLOT(SetFrequency())); - connect(tab_measurement, SIGNAL(EnableNthFrameSignal(bool)), tab_plot,SLOT(EnableNthFrame(bool))); // Data Output Tab connect(tab_dataoutput, SIGNAL(AngularConversionSignal(bool)), tab_actions,SLOT(EnablePositions(bool))); //enable scanbox( for angles) diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 69d239a91..7d9149f68 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -440,17 +440,14 @@ void qTabMeasurement::setAcquisitionPeriod(){ lblPeriod->setToolTip(errPeriodTip); lblPeriod->setPalette(red); lblPeriod->setText("Acquisition Period:*"); - emit EnableNthFrameSignal(false); } else { spinPeriod->setToolTip(acqPeriodTip); lblPeriod->setToolTip(acqPeriodTip); lblPeriod->setPalette(lblTimingMode->palette()); lblPeriod->setText("Acquisition Period:"); - emit EnableNthFrameSignal(true); } - //Check if the interval between plots is ok emit CheckPlotIntervalSignal(); } @@ -709,10 +706,7 @@ void qTabMeasurement::SetTimingMode(int mode){ myPlot->setTriggerEnabled(lblNumTriggers->isEnabled()); - //check if period is enabled and alright, only then the nth frame frequency is enabled - if((lblPeriod->isEnabled())&&(lblPeriod->text()=="Acquisition Period:")) - emit EnableNthFrameSignal(true); - else emit EnableNthFrameSignal(false); + emit CheckPlotIntervalSignal(); return; } diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index 4adce2b2f..63a5f108e 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -54,18 +54,10 @@ qTabPlot::~qTabPlot(){ void qTabPlot::SetupWidgetWindow(){ - //check if nth frame should be enabled - enableNFrame = true; - //according to timing mode - slsDetectorDefs::externalCommunicationMode mode = myDet->setExternalCommunicationMode(); - if( (mode==slsDetectorDefs::GATE_FIX_NUMBER)|| - (mode==slsDetectorDefs::TRIGGER_FRAME) || - (mode==slsDetectorDefs::TRIGGER_WINDOW) || - ((mode==slsDetectorDefs::AUTO_TIMING)&&((int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1)==1)&&((int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1)==1)) ) - enableNFrame = false; - //according to if exptime > acq period - if((myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-9))>(myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,-1)*(1E-9))) - enableNFrame = false; + //error for interval between plots + red = new QPalette();; + red->setColor(QPalette::Active,QPalette::WindowText,Qt::red); + intervalTip = boxFrequency->toolTip(); @@ -155,6 +147,7 @@ void qTabPlot::SetupWidgetWindow(){ //to check if this should be enabled EnableScanBox(); + } @@ -442,23 +435,43 @@ 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())); + disconnect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency())); + double timeMS,acqPeriodMS; double minPlotTimer = myPlot->GetMinimumPlotTimer(); - char cplotms[200]; - sprintf(cplotms,"%f ms",minPlotTimer); + char cMin[200]; + sprintf(cMin,"%f ms",minPlotTimer); stackedLayout->setCurrentIndex(comboFrequency->currentIndex()); switch(comboFrequency->currentIndex()){ case 0: // Get the time interval from gui in ms timeMS = (qDefs::getNSTime((qDefs::timeUnit)comboTimeGapUnit->currentIndex(),spinTimeGap->value()))/(1e6); - if(timeMSInterval between Plots:
" + "Time Interval must be atleast >= 1 ms. Resetting to minimum plotting time interval.","Plot"); spinTimeGap->setValue(minPlotTimer); comboTimeGapUnit->setCurrentIndex(qDefs::MILLISECONDS); + timeMS=minPlotTimer; } + + //show red for warning + if(timeMSInterval between Plots: You might be losing Images!","Plot"); + boxFrequency->setPalette(*red); + boxFrequency->setTitle("Interval between Plots*"); + QString errTip = intervalTip + QString("

" + "Time Interval Condition: min of ")+QString("%1").arg(minPlotTimer)+ + QString("ms.
You might be losing images!
"); + boxFrequency->setToolTip(errTip); + }else{ + boxFrequency->setPalette(boxSnapshot->palette()); + boxFrequency->setTitle("Interval between Plots"); + boxFrequency->setToolTip(intervalTip); + } + //This is done so that its known which one was selected myPlot->SetFrameFactor(0); // Setting the timer value(ms) between plots @@ -469,19 +482,49 @@ void qTabPlot::SetFrequency(){ break; case 1: acqPeriodMS = (myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,-1)*(1E-6)); + + //if period is 0, check exptime, if that is also 0, give warning and set to min timer + if(acqPeriodMS==0){ + acqPeriodMS = (myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-6)); + if(acqPeriodMS==0){ + qDefs::Message(qDefs::WARNING,"Interval between Plots:
" + "Every Nth Image: Period betwen Frames and Exposure Time cannot both be 0 ms.
" + "Resetting to minimum plotting time interval","Plot"); + comboFrequency->setCurrentIndex(0); + stackedLayout->setCurrentIndex(comboFrequency->currentIndex()); + spinTimeGap->setValue(minPlotTimer); + comboTimeGapUnit->setCurrentIndex(qDefs::MILLISECONDS); + timeMS=minPlotTimer; + //This is done so that its known which one was selected + myPlot->SetFrameFactor(0); + // Setting the timer value(ms) between plots + myPlot->SetPlotTimer(timeMS); + break; + } + } + // gets the acq period * number of nth frames timeMS = (spinNthFrame->value())*acqPeriodMS; - // To make sure the period between plotting is not less than minimum plot timer in ms + + //Show red to make sure the period between plotting is not less than minimum plot timer in ms if(timeMSPlot Tab: Interval between Plots - The nth Image must be larger.

" - "Condition to be satisfied:\n(Acquisition Period)*(nth Image) >= 250ms." - "

Nth image adjusted to minimum, " - "for the chosen Acquisition Period.","Plot"); - spinNthFrame->setValue(minFrame); + qDefs::Message(qDefs::WARNING,"
Interval between Plots: You might be losing Images!","Plot"); + boxFrequency->setPalette(*red); + boxFrequency->setTitle("Interval between Plots*"); + QString errTip = intervalTip + QString("

" + "Every nth Image Condition: min nth Image for this time period: ")+QString("%1").arg(minFrame)+ + QString(".
You might be losing images!
"); + boxFrequency->setToolTip(errTip); + }else{ + boxFrequency->setPalette(boxSnapshot->palette()); + boxFrequency->setTitle("Interval between Plots"); + boxFrequency->setToolTip(intervalTip); } + // Setting the timer value (nth frames) between plots myPlot->SetFrameFactor(spinNthFrame->value()); + #ifdef VERBOSE cout << "Plotting Frequency: Nth Frame - " << spinNthFrame->value() << endl; #endif @@ -491,12 +534,12 @@ void qTabPlot::SetFrequency(){ connect(comboTimeGapUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency())); connect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetFrequency())); connect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency())); + connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency())); } //------------------------------------------------------------------------------------------------------------------------------------------------- - void qTabPlot::EnableScanBox(){ #ifdef VERYVERBOSE cout << "Entering Enable Scan Box()" << endl; @@ -545,7 +588,7 @@ void qTabPlot::EnableScanBox(){ } } } - else EnablingNthFrameFunction(enableNFrame); + else EnablingNthFrameFunction(true); //positions if((positionsExist)&&(chkSuperimpose->isChecked())) chkSuperimpose->setChecked(false); From f4dc6aab220dc5f881efe034c6b32c01ab8bfaba Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Thu, 11 Oct 2012 08:36:11 +0000 Subject: [PATCH 089/332] enhancement:nth frame changed to red, instead of error and changing it back git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@89 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_measurement.ui | 27 +++++++ slsDetectorGui/src/qDrawPlot.cpp | 2 +- slsDetectorGui/src/qTabPlot.cpp | 74 +++++++++++++------- 3 files changed, 77 insertions(+), 26 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_measurement.ui b/slsDetectorGui/forms/form_tab_measurement.ui index 0b5f0d48a..f30ef53c5 100644 --- a/slsDetectorGui/forms/form_tab_measurement.ui +++ b/slsDetectorGui/forms/form_tab_measurement.ui @@ -231,6 +231,9 @@ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + false + @@ -277,6 +280,9 @@ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + false + 9 @@ -385,6 +391,9 @@ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + false + @@ -443,6 +452,9 @@ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + false + @@ -545,6 +557,9 @@ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + false + @@ -597,6 +612,9 @@ Exposure Time of a frame. Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + false + 5 @@ -705,6 +723,9 @@ Frame period between exposures. Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + false + 5 @@ -854,6 +875,9 @@ Frame period between exposures. Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + false + @@ -913,6 +937,9 @@ Frame period between exposures. Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + false + diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 1a3364524..b3a9377de 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -755,8 +755,8 @@ int qDrawPlot::GetData(detectorData *data){ } pthread_mutex_unlock(&(last_image_complete_mutex)); } + cout<<"currentframe:"<setTimer(slsDetectorDefs::FRAME_PERIOD,-1)*(1E-6)); + //if period is 0, check exptime, if that is also 0, give warning and set to min timer + if(acqPeriodMS==0){ + acqPeriodMS = (myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-6)); + if(acqPeriodMS==0){ + qDefs::Message(qDefs::WARNING,"Interval between Plots:
" + "Every Nth Image: Period betwen Frames and Exposure Time cannot both be 0 ms.
" + "Resetting to minimum plotting time interval","Plot"); + comboFrequency->setCurrentIndex(0); + stackedLayout->setCurrentIndex(comboFrequency->currentIndex()); + spinTimeGap->setValue(minPlotTimer); + comboTimeGapUnit->setCurrentIndex(qDefs::MILLISECONDS); + timeMS=minPlotTimer; + //This is done so that its known which one was selected + myPlot->SetFrameFactor(0); + // Setting the timer value(ms) between plots + myPlot->SetPlotTimer(timeMS); + + connect(comboTimeGapUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency())); + connect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetFrequency())); + connect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency())); + connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency())); + return; + } + } + + stackedLayout->setCurrentIndex(comboFrequency->currentIndex()); switch(comboFrequency->currentIndex()){ case 0: @@ -457,16 +485,29 @@ void qTabPlot::SetFrequency(){ timeMS=minPlotTimer; } - //show red for warning + + //show red if min intervalInterval between Plots: You might be losing Images!","Plot"); + //qDefs::Message(qDefs::WARNING,"Interval between Plots: You might be losing Images!","Plot"); boxFrequency->setPalette(*red); boxFrequency->setTitle("Interval between Plots*"); QString errTip = intervalTip + QString("

" "Time Interval Condition: min of ")+QString("%1").arg(minPlotTimer)+ QString("ms.
You might be losing images!
"); boxFrequency->setToolTip(errTip); - }else{ + } + //show red if acqPeriodInterval between Plots: You might be losing Images!","Plot"); + boxFrequency->setPalette(*red); + boxFrequency->setTitle("Interval between Plots*"); + QString errTip = intervalTip + QString("

" + "Time Interval Acquisition Period should be >= Time Interval between plots.
" + "You might be losing images!
"); + boxFrequency->setToolTip(errTip); + } + //correct + else{ boxFrequency->setPalette(boxSnapshot->palette()); boxFrequency->setTitle("Interval between Plots"); boxFrequency->setToolTip(intervalTip); @@ -480,28 +521,11 @@ void qTabPlot::SetFrequency(){ cout << "Plotting Frequency: Time Gap - " << spinTimeGap->value() << qDefs::getUnitString((qDefs::timeUnit)comboTimeGapUnit->currentIndex()) << endl; #endif break; - case 1: - acqPeriodMS = (myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,-1)*(1E-6)); - //if period is 0, check exptime, if that is also 0, give warning and set to min timer - if(acqPeriodMS==0){ - acqPeriodMS = (myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-6)); - if(acqPeriodMS==0){ - qDefs::Message(qDefs::WARNING,"Interval between Plots:
" - "Every Nth Image: Period betwen Frames and Exposure Time cannot both be 0 ms.
" - "Resetting to minimum plotting time interval","Plot"); - comboFrequency->setCurrentIndex(0); - stackedLayout->setCurrentIndex(comboFrequency->currentIndex()); - spinTimeGap->setValue(minPlotTimer); - comboTimeGapUnit->setCurrentIndex(qDefs::MILLISECONDS); - timeMS=minPlotTimer; - //This is done so that its known which one was selected - myPlot->SetFrameFactor(0); - // Setting the timer value(ms) between plots - myPlot->SetPlotTimer(timeMS); - break; - } - } + + + + case 1: // gets the acq period * number of nth frames timeMS = (spinNthFrame->value())*acqPeriodMS; @@ -509,7 +533,7 @@ void qTabPlot::SetFrequency(){ //Show red to make sure the period between plotting is not less than minimum plot timer in ms if(timeMSInterval between Plots: You might be losing Images!","Plot"); + //qDefs::Message(qDefs::WARNING,"Interval between Plots: You might be losing Images!","Plot"); boxFrequency->setPalette(*red); boxFrequency->setTitle("Interval between Plots*"); QString errTip = intervalTip + QString("

" From 19b6ca2eda6536fd1bccfa51a4139f68ffa1d8f8 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Thu, 11 Oct 2012 08:57:09 +0000 Subject: [PATCH 090/332] enhancement:nth frame changed to red, instead of error and changing it back git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@90 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qDrawPlot.cpp | 6 +----- slsDetectorGui/src/qTabMeasurement.cpp | 5 +---- slsDetectorGui/src/qTabPlot.cpp | 3 ++- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index b3a9377de..2ed7f2287 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -538,7 +538,7 @@ int qDrawPlot::GetData(detectorData *data){ //set progress progress=(int)data->progressIndex; currentFileIndex = fileIOStatic::getFileIndexFromFileName(string(data->fileName)); -#ifdef VERBOSE +#ifdef VERYVERBOSE cout << "progress:" << progress << endl; #endif @@ -673,8 +673,6 @@ int qDrawPlot::GetData(detectorData *data){ //get scanvariable0 int ci = 0, p = 0; double cs0 = 0 , cs1 = 0; fileIOStatic::getVariablesFromFileName(string(data->fileName), ci, p, cs0, cs1); - cout<<"currentScanValue:"<0&&nPixelsY>0){ - cout<<"startpixel:"<GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,-0.5,nPixelsY-0.5,lastImageArray); plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,startPixel,endPixel,lastImageArray); plot2D->setTitle(GetImageTitle()); diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 7d9149f68..cf295660e 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -30,7 +30,7 @@ qTabMeasurement::qTabMeasurement(QWidget *parent,multiSlsDetector*& detector, qD setupUi(this); SetupWidgetWindow(); Initialization(); - + SetupTimingMode(); } @@ -76,9 +76,6 @@ void qTabMeasurement::SetupWidgetWindow(){ //ly initially progressBar->setValue(0); - //timing mode - SetupTimingMode(); - //file write enabled/disabled chkFile->setChecked(myDet->enableWriteToFile()); dispFileName->setEnabled(myDet->enableWriteToFile()); diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index 4fc560740..4885afa9d 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -497,7 +497,8 @@ void qTabPlot::SetFrequency(){ boxFrequency->setToolTip(errTip); } //show red if acqPeriodInterval between Plots: You might be losing Images!","Plot"); boxFrequency->setPalette(*red); boxFrequency->setTitle("Interval between Plots*"); From 51faab3c7c085768997aa31c328acb0b4f0a1f39 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Thu, 11 Oct 2012 09:17:54 +0000 Subject: [PATCH 091/332] enhancement:nth frame changed to red, instead of error and changing it back git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@91 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qTabMessages.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/slsDetectorGui/src/qTabMessages.cpp b/slsDetectorGui/src/qTabMessages.cpp index f8b23e147..0b3142d77 100644 --- a/slsDetectorGui/src/qTabMessages.cpp +++ b/slsDetectorGui/src/qTabMessages.cpp @@ -45,7 +45,8 @@ void qTabMessages::SetupWidgetWindow(){ dispLog->setReadOnly(true); dispLog->setFocusPolicy(Qt::NoFocus); dispLog->setTextColor(Qt::darkBlue); - + dispLog->setTextFormat( Qt::LogText ); + dispLog->setMaxLogLines(1000); btnSave = new QPushButton("Save Log ",this); btnSave->setFocusPolicy(Qt::NoFocus); From 4ada872aaa7b13e883a10369a9c19c996ddc4f90 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 12 Oct 2012 11:58:47 +0000 Subject: [PATCH 092/332] histogram for 1d detectors without scan implemened git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@92 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qTabPlot.h | 2 +- slsDetectorGui/src/qDetectorMain.cpp | 2 + slsDetectorGui/src/qTabMessages.cpp | 2 - slsDetectorGui/src/qTabPlot.cpp | 94 +++++++++++++++++++--------- 4 files changed, 68 insertions(+), 32 deletions(-) diff --git a/slsDetectorGui/include/qTabPlot.h b/slsDetectorGui/include/qTabPlot.h index 308f0f18f..b23513e32 100644 --- a/slsDetectorGui/include/qTabPlot.h +++ b/slsDetectorGui/include/qTabPlot.h @@ -56,7 +56,7 @@ private: /** 1d/2d plot */ bool isOneD; - bool isOrginallyOneD; + bool isOriginallyOneD; /**is set if its a possible wrong interval between plots*/ bool wrongInterval; diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 469c43c83..b7ee346c9 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -638,6 +638,8 @@ void qDetectorMain::EnableTabs(){ //sets running to true myPlot->StartStopDaqToggle(); } + else//to enable scan box + tab_plot->Refresh(); } diff --git a/slsDetectorGui/src/qTabMessages.cpp b/slsDetectorGui/src/qTabMessages.cpp index 0b3142d77..016ee82fd 100644 --- a/slsDetectorGui/src/qTabMessages.cpp +++ b/slsDetectorGui/src/qTabMessages.cpp @@ -45,8 +45,6 @@ void qTabMessages::SetupWidgetWindow(){ dispLog->setReadOnly(true); dispLog->setFocusPolicy(Qt::NoFocus); dispLog->setTextColor(Qt::darkBlue); - dispLog->setTextFormat( Qt::LogText ); - dispLog->setMaxLogLines(1000); btnSave = new QPushButton("Save Log ",this); btnSave->setFocusPolicy(Qt::NoFocus); diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index 4885afa9d..65cbde362 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -133,16 +133,16 @@ void qTabPlot::SetupWidgetWindow(){ // Depending on whether the detector is 1d or 2d switch(myDet->getDetectorsType()){ - case slsDetectorDefs::MYTHEN: isOrginallyOneD = true; break; - case slsDetectorDefs::EIGER: isOrginallyOneD = false; break; - case slsDetectorDefs::GOTTHARD: isOrginallyOneD = true; break; + case slsDetectorDefs::MYTHEN: isOriginallyOneD = true; break; + case slsDetectorDefs::EIGER: isOriginallyOneD = false; break; + case slsDetectorDefs::GOTTHARD: isOriginallyOneD = true; break; default: cout << "ERROR: Detector Type is Generic" << endl; exit(-1); } - Select1DPlot(isOrginallyOneD); - if(isOrginallyOneD) myPlot->Select1DPlot(); + Select1DPlot(isOriginallyOneD); + if(isOriginallyOneD) myPlot->Select1DPlot(); else myPlot->Select2DPlot(); //to check if this should be enabled @@ -395,9 +395,9 @@ void qTabPlot::SetPlot(){ if(radioNoPlot->isChecked()){ cout << " - No Plot" << endl; - //Select1DPlot(isOrginallyOneD); - //if(isOrginallyOneD) {box1D->show(); box2D->hide();} - //if(!isOrginallyOneD){box2D->show(); box1D->hide();} + //Select1DPlot(isOriginallyOneD); + //if(isOriginallyOneD) {box1D->show(); box2D->hide();} + //if(!isOriginallyOneD){box2D->show(); box1D->hide();} myPlot->EnablePlot(false); //if enable is true, disable everything @@ -406,25 +406,25 @@ void qTabPlot::SetPlot(){ boxFrequency->setEnabled(false); boxPlotAxis->setEnabled(false); boxScan->setEnabled(false); - }else if(radioDataGraph->isChecked()){ + }else {//if(radioDataGraph->isChecked()){ cout << " - DataGraph" << endl; myPlot->EnablePlot(true); //if enable is true, disable everything - if(isOrginallyOneD) {box1D->show(); box2D->hide();} - if(!isOrginallyOneD) {box2D->show(); box1D->hide();} - Select1DPlot(isOrginallyOneD); - if(isOrginallyOneD) myPlot->Select1DPlot(); + if(isOriginallyOneD) {box1D->show(); box2D->hide();} + if(!isOriginallyOneD) {box2D->show(); box1D->hide();} + Select1DPlot(isOriginallyOneD); + if(isOriginallyOneD) myPlot->Select1DPlot(); else myPlot->Select2DPlot(); boxSnapshot->setEnabled(true); boxSave->setEnabled(true); boxFrequency->setEnabled(true); boxPlotAxis->setEnabled(true); - EnableScanBox(); - }else{ + if(!myPlot->isRunning()) EnableScanBox(); + }/*else{ cout << " - Histogram" << endl; //select(2d) will set oneD to false, but originallyoneD will remember - } + }*/ } @@ -583,9 +583,17 @@ void qTabPlot::EnableScanBox(){ //only now enable/disable boxScan->setEnabled((mode0||mode1)&&(!positionsExist)); + //after plotting, enable datagraph if it was disabled while plotting(refresh) + radioDataGraph->setEnabled(true); + //if there are scan if(boxScan->isEnabled()){ + //disable histogram + if(radioHistogram->isChecked()) + radioDataGraph->setChecked(true); + radioHistogram->setEnabled(false); + //make sure nth frame frequency plot is disabled EnablingNthFrameFunction(false); @@ -613,7 +621,17 @@ void qTabPlot::EnableScanBox(){ } } } - else EnablingNthFrameFunction(true); + else{ + //histogram for 1d + if(isOriginallyOneD){ + radioHistogram->setEnabled(true); + if(radioHistogram->isChecked()) + EnablingNthFrameFunction(false); + else + EnablingNthFrameFunction(true); + } + } + //positions if((positionsExist)&&(chkSuperimpose->isChecked())) chkSuperimpose->setChecked(false); @@ -654,9 +672,10 @@ void qTabPlot::EnablingNthFrameFunction(bool enable){ //------------------------------------------------------------------------------------------------------------------------------------------------- /** What happens for 2d????*/ void qTabPlot::SetScanArgument(){ + bool histogram = radioHistogram->isChecked(); //as default from histogram and default titles are set here if scanbox is disabled - if(isOrginallyOneD){ + if(isOriginallyOneD){ dispXAxis->setText(defaultHistXAxisTitle); dispYAxis->setText(defaultHistYAxisTitle); myPlot->SetHistXAxisTitle(defaultHistXAxisTitle); @@ -669,24 +688,21 @@ void qTabPlot::SetScanArgument(){ myPlot->SetImageYAxisTitle(defaultImageYAxisTitle); myPlot->SetImageZAxisTitle(defaultImageZAxisTitle); } - Select1DPlot(isOrginallyOneD); - if(isOrginallyOneD) myPlot->Select1DPlot(); + Select1DPlot(isOriginallyOneD); + if(isOriginallyOneD) myPlot->Select1DPlot(); else myPlot->Select2DPlot(); + int ang; //if scans(1D or 2D) - if(boxScan->isEnabled()){ + if((boxScan->isEnabled())||(histogram)){ //setting the title according to the scans - Select1DPlot(isOrginallyOneD); - if(isOrginallyOneD) myPlot->Select1DPlot(); + Select1DPlot(isOriginallyOneD); + if(isOriginallyOneD) myPlot->Select1DPlot(); else myPlot->Select2DPlot(); }//angles (1D) else if(myDet->getAngularConversion(ang)){ - //else if(myDet->getPositions()){ - //if scan, change title - if((myDet->getScanMode(0))||(myDet->getScanMode(1))){ - } dispXAxis->setText("Angles"); myPlot->SetHistXAxisTitle("Angles"); Select1DPlot(true); @@ -694,9 +710,25 @@ void qTabPlot::SetScanArgument(){ } + //histogram + if(histogram){ + //allFrames + myPlot->SetScanArgument(4); - //for 2d - if((boxScan->isEnabled())&&(boxScan->isChecked())){ + //default titles for 2d scan + dispXAxis->setText("Channel Number"); + myPlot->SetImageXAxisTitle("Channel Number"); + dispZAxis->setText("Counts"); + myPlot->SetImageZAxisTitle("Counts"); + dispYAxis->setText("All Frames"); + myPlot->SetImageYAxisTitle("All Frames"); + + //set plot to 2d + Select1DPlot(false); + myPlot->Select2DPlot(); + } + //2d + else if((boxScan->isEnabled())&&(boxScan->isChecked())){ //let qdrawplot know which scan argument myPlot->SetScanArgument(btnGroupScan->checkedId()+1); @@ -751,6 +783,10 @@ void qTabPlot::Refresh(){ }else{ disconnect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox())); boxScan->setEnabled(false); + //to toggle between no plot and the plot mode chosen while pltting + if(radioHistogram->isChecked()) + radioDataGraph->setEnabled(false); + radioHistogram->setEnabled(false); } #ifdef VERBOSE cout << "**Updated Plot Tab" << endl << endl; From 353e9baa7815715e10856339dee5d1889ad8d78d Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 12 Oct 2012 12:16:58 +0000 Subject: [PATCH 093/332] got rid of some unnecessary coutlines in plotting by dhanya git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@93 af1100a4-978c-4157-bff7-07162d2ba061 --- .../slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx index 65c6e6725..c27f46c9f 100644 --- a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx +++ b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx @@ -115,17 +115,17 @@ void SlsQt2DPlotLayout::ResetRange(){ #ifdef IAN if(z_range_ne->CheckBoxState()){ #else - if(zRangeChecked){cout<<"entering:"<GetValue(0)<<"\t"<GetValue(1)<GetValue(0)==z_range_ne->GetValue(1)) ? 1:0; - if(!z_range_ne->IsValueOk(0)||same) z_range_ne->SetValue(the_plot->GetZMinimum(),0);cout<<"isok 0:"<GetValue(0)<<"\t"<GetValue(1)<IsValueOk(1)||same) z_range_ne->SetValue(the_plot->GetZMaximum(),1);cout<<"isok1:"<GetValue(0)<<"\t"<GetValue(1)<SetRange(the_plot->GetZMinimum(),z_range_ne->GetValue(1),0); cout<<"setrange:"<GetValue(0)<<"\t"<GetValue(1)<SetRange(z_range_ne->GetValue(0),the_plot->GetZMaximum(),1); cout<<"setrange:"<GetValue(0)<<"\t"<GetValue(1)<IsValueOk(0)||same) z_range_ne->SetValue(the_plot->GetZMinimum(),0); + if(!z_range_ne->IsValueOk(1)||same) z_range_ne->SetValue(the_plot->GetZMaximum(),1); + z_range_ne->SetRange(the_plot->GetZMinimum(),z_range_ne->GetValue(1),0); + z_range_ne->SetRange(z_range_ne->GetValue(0),the_plot->GetZMaximum(),1); //set histogram range - the_plot->SetZMinMax(z_range_ne->GetValue(0),z_range_ne->GetValue(1)); cout<<"setminmax:"<GetValue(0)<<"\t"<GetValue(1)<SetZMinMax(z_range_ne->GetValue(0),z_range_ne->GetValue(1)); } the_plot->Update(); } @@ -181,9 +181,7 @@ void SlsQt2DPlotLayout::SetZRange(double zmin, double zmax){ #endif z_range_ne->SetNumber(zmin,0); z_range_ne->SetNumber(zmax,1); - cout<<"\n\nthe valuessssssssssssssss:"<GetValue(0)<<"\t"<GetValue(1)<GetValue(0)<<"\t"<GetValue(1)< Date: Fri, 12 Oct 2012 14:12:20 +0000 Subject: [PATCH 094/332] enhancement: logy with arrow buttons git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@94 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_plot.ui | 387 +++++++++++------- slsDetectorGui/include/icons.qrc | 2 + slsDetectorGui/include/qDrawPlot.h | 1 + slsDetectorGui/include/qTabPlot.h | 2 + .../slsDetectorPlotting/include/SlsQt1DPlot.h | 2 +- slsDetectorGui/src/qDrawPlot.cpp | 4 + slsDetectorGui/src/qTabPlot.cpp | 16 + 7 files changed, 274 insertions(+), 140 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index c7533aa53..98f05ce19 100644 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -92,9 +92,9 @@ - 10 + 8 20 - 361 + 358 26 @@ -191,149 +191,258 @@ false - + - 10 - 20 - 361 - 26 + 4 + 15 + 366 + 31 - - - 0 - - - - - - 0 - 0 - - - - Superimpose - - - false - - - - - - - true - - - - 0 - 0 - - - - Points - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 140 - 10 - - - - - - - - true - - - - 0 - 0 - - - - Lines - - - true - - - - - - - - - 120 - 21 - 121 - 23 - + + 0 - - - 1 - - - - - false - - - - 0 - 0 - - - - Persistency: - - - - - - - false - - - - 0 - 0 - - - - - 40 - 16777215 - - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - + + + + + 5 + 4 + 107 + 26 + + + + + + + + 0 + 0 + + + + Superimpose + + + false + + + + + + + + + 210 + 5 + 128 + 23 + + + + 1 - - 10 - - - 1 - - - - + + + + false + + + + 0 + 0 + + + + Persistency: + + + + + + + false + + + + 0 + 0 + + + + + 40 + 16777215 + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + 1 + + + 10 + + + 1 + + + + + + + + + 345 + 0 + 16 + 16 + + + + + 0 + 0 + + + + Qt::NoFocus + + + + + + + :/icons/images/rightArrow.png:/icons/images/rightArrow.png + + + + 16 + 16 + + + + true + + + + + + + + 5 + 5 + 336 + 26 + + + + + + + + 0 + 0 + + + + Log Scale (Y) + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 95 + 20 + + + + + + + + true + + + + 0 + 0 + + + + Points + + + + + + + true + + + + 0 + 0 + + + + Lines + + + true + + + + + + + + + 345 + 0 + 16 + 16 + + + + + 0 + 0 + + + + Qt::NoFocus + + + + + + + :/icons/images/leftArrow.png:/icons/images/leftArrow.png + + + + 16 + 16 + + + + true + + +
@@ -1001,7 +1110,7 @@ 10 20 - 361 + 358 26 diff --git a/slsDetectorGui/include/icons.qrc b/slsDetectorGui/include/icons.qrc index 071da30c4..abb13ecf9 100644 --- a/slsDetectorGui/include/icons.qrc +++ b/slsDetectorGui/include/icons.qrc @@ -13,5 +13,7 @@ ../images/erase.png ../images/remove.png ../images/stop.png + ../images/leftArrow.png + ../images/rightArrow.png diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index f970ad1c2..14b58f531 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -459,6 +459,7 @@ void UpdatingPlotFinished(); void InterpolateSignal(bool); void ContourSignal(bool); void LogzSignal(bool); +void LogySignal(bool); void SetZRangeSignal(double,double); void EnableZRangeSignal(bool); void SetCurrentMeasurementSignal(int); diff --git a/slsDetectorGui/include/qTabPlot.h b/slsDetectorGui/include/qTabPlot.h index b23513e32..a07cdad35 100644 --- a/slsDetectorGui/include/qTabPlot.h +++ b/slsDetectorGui/include/qTabPlot.h @@ -140,6 +140,8 @@ private slots: /** Set Plot to none, data graph, histogram*/ void SetPlot(); + /** Change pages in 1D box*/ + void Set1DPage(); signals: diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h index 3b5e64ea9..1125df904 100644 --- a/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h @@ -158,7 +158,7 @@ class SlsQt1DPlot:public QwtPlot{ void Update(); void SetLogX(bool yes=1); - void SetLogY(bool yes=1); + void SetLogY(bool yes=1); protected: diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 2ed7f2287..bd9ce2b7b 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -205,6 +205,7 @@ void qDrawPlot::Initialization(){ connect(this, SIGNAL(InterpolateSignal(bool)),plot2D, SIGNAL(InterpolateSignal(bool))); connect(this, SIGNAL(ContourSignal(bool)), plot2D, SIGNAL(ContourSignal(bool))); connect(this, SIGNAL(LogzSignal(bool)), plot2D, SLOT(SetZScaleToLog(bool))); + connect(this, SIGNAL(LogySignal(bool)), plot1D, SLOT(SetLogY(bool))); connect(this, SIGNAL(EnableZRangeSignal(bool)),plot2D, SLOT(EnableZRange(bool))); connect(this, SIGNAL(SetZRangeSignal(double,double)), plot2D, SLOT(SetZRange(double,double))); @@ -753,7 +754,9 @@ int qDrawPlot::GetData(detectorData *data){ } pthread_mutex_unlock(&(last_image_complete_mutex)); } +#ifdef VERYVERBOSE cout<<"currentframe:"<show(); // to remember which all clone widgets were closed diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index 65cbde362..3c3737aaa 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -154,6 +154,18 @@ void qTabPlot::SetupWidgetWindow(){ //------------------------------------------------------------------------------------------------------------------------------------------------- +void qTabPlot::Set1DPage(){ + QPushButton *clickedButton = qobject_cast(sender()); + if(clickedButton->icon().pixmap(QSize(16,16)).toImage()==btnLeft->icon().pixmap(QSize(16,16)).toImage()) + stackedWidget->setCurrentIndex(0); + else + stackedWidget->setCurrentIndex(1); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + void qTabPlot::Select1DPlot(bool b){ isOneD = b; if(b){ @@ -192,6 +204,10 @@ void qTabPlot::Initialization(){ connect(spinPersistency,SIGNAL(valueChanged(int)), myPlot,SLOT(SetPersistency(int))); connect(chkPoints, SIGNAL(toggled(bool)), myPlot, SLOT(SetMarkers(bool))); connect(chkLines, SIGNAL(toggled(bool)), myPlot, SLOT(SetLines(bool))); + connect(chk1DLog, SIGNAL(toggled(bool)), myPlot, SIGNAL(LogySignal(bool))); + //to change pages + connect(btnLeft, SIGNAL(clicked()), this, SLOT(Set1DPage())); + connect(btnRight, SIGNAL(clicked()), this, SLOT(Set1DPage())); // 2D Plot box connect(chkInterpolate, SIGNAL(toggled(bool)),myPlot, SIGNAL(InterpolateSignal(bool))); connect(chkContour, SIGNAL(toggled(bool)),myPlot, SIGNAL(ContourSignal(bool))); From e104b1d529569e4dd3459d83420c3e5422779355 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 16 Oct 2012 08:29:44 +0000 Subject: [PATCH 095/332] messages capture config output, still to find a way to capture all cerr output git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@95 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_plot.ui | 4 ++-- slsDetectorGui/include/qDebugStream.h | 8 +++++++- slsDetectorGui/include/qDetectorMain.h | 3 ++- slsDetectorGui/include/qTabMessages.h | 9 +++++++-- slsDetectorGui/src/qDetectorMain.cpp | 26 +++++++++++++++++--------- slsDetectorGui/src/qTabMessages.cpp | 12 ++++++++++-- 6 files changed, 45 insertions(+), 17 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index 98f05ce19..0c905f491 100644 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -208,7 +208,7 @@ 5 - 4 + 5 107 26 @@ -238,7 +238,7 @@ 210 5 128 - 23 + 26 diff --git a/slsDetectorGui/include/qDebugStream.h b/slsDetectorGui/include/qDebugStream.h index bb4607691..6b5e8a51d 100644 --- a/slsDetectorGui/include/qDebugStream.h +++ b/slsDetectorGui/include/qDebugStream.h @@ -40,9 +40,12 @@ private: class qDebugStream : public basic_streambuf { public: - qDebugStream(ostream &stream, QWidget* w) : m_stream(stream), log_window(w) { + qDebugStream(ostream &stream, ostream &estream, QWidget* w) : m_stream(stream), e_stream(estream), log_window(w) { m_old_buf = stream.rdbuf(); stream.rdbuf(this); + //e_old_buf = stream.rdbuf(); + //estream.rdbuf(this); + }; //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -57,6 +60,7 @@ public: #endif } m_stream.rdbuf(m_old_buf); + e_stream.rdbuf(e_old_buf); } //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -104,6 +108,8 @@ protected: private: ostream &m_stream; streambuf *m_old_buf; + ostream &e_stream; + streambuf *e_old_buf; string m_string; QWidget* log_window; }; diff --git a/slsDetectorGui/include/qDetectorMain.h b/slsDetectorGui/include/qDetectorMain.h index b4ec2cdb6..fd8b8c830 100644 --- a/slsDetectorGui/include/qDetectorMain.h +++ b/slsDetectorGui/include/qDetectorMain.h @@ -113,8 +113,9 @@ private: int isDeveloper; /**Sets up the layout of the widget + * @param fName file name of the config file at start up * */ - void SetUpWidgetWindow(); + void SetUpWidgetWindow(const string fName); /**Sets up detector * @param fName file name of the config file at start up diff --git a/slsDetectorGui/include/qTabMessages.h b/slsDetectorGui/include/qTabMessages.h index 6821a55f1..49d722d46 100644 --- a/slsDetectorGui/include/qTabMessages.h +++ b/slsDetectorGui/include/qTabMessages.h @@ -28,14 +28,18 @@ class qTabMessages:public QWidget{ public: /** \short The constructor * @param parent is the parent tab widget - * @param detector is the detector returned from the detector tab */ - qTabMessages(QWidget *parent,multiSlsDetector*& detector); + qTabMessages(QWidget *parent); /** Destructor */ ~qTabMessages(); + /** Set the detetor reference + * @param det the detector reference + */ + void SetDetectorReference(multiSlsDetector*& detector){myDet = detector;}; + private: /** The sls detector object */ @@ -52,6 +56,7 @@ private: /** This class creates the log */ qDebugStream *qout; + //qDebugStream *qerr; /** methods */ /** Sets up the widget */ diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index b7ee346c9..97679de97 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -64,8 +64,7 @@ qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app, QWidget * } setupUi(this); - SetUpDetector(configFName); - SetUpWidgetWindow(); + SetUpWidgetWindow(configFName); Initialization(); } @@ -84,21 +83,29 @@ qDetectorMain::~qDetectorMain(){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void qDetectorMain::SetUpWidgetWindow(){ +void qDetectorMain::SetUpWidgetWindow(const string fName){ // Layout layoutTabs= new QGridLayout; centralwidget->setLayout(layoutTabs); -// plot setup - myPlot = new qDrawPlot(dockWidgetPlot,myDet);cout<<"DockPlot ready"<setWidget(myPlot); //tabs setup tabs = new MyTabWidget(this); layoutTabs->addWidget(tabs); - // creating all the tab widgets - tab_messages = new qTabMessages (this, myDet); cout<<"Messages ready"<setWidget(myPlot); + + //settings messages to have the det reference + tab_messages->SetDetectorReference(myDet); + // creating all the other tab widgets tab_measurement = new qTabMeasurement (this, myDet,myPlot); cout<<"Measurement ready"<insertTab(Developer, scroll[Developer], "Developer"); // Prefer this to expand and not have scroll buttons tabs->insertTab(Messages, tab_messages, "Messages"); + // Default tab color defaultTabColor = tabs->tabBar()->tabTextColor(DataOutput); //Set the current tab(measurement) to blue as it is the current one @@ -267,7 +275,7 @@ void qDetectorMain::Initialization(){ void qDetectorMain::LoadConfigFile(const string fName){ -#ifdef VERBOSe +#ifdef VERBOSE cout << "Loading config file at start up:" << fName << endl; #endif QString file = QString(fName.c_str());//.section('/',-1); diff --git a/slsDetectorGui/src/qTabMessages.cpp b/slsDetectorGui/src/qTabMessages.cpp index 016ee82fd..7d22b7395 100644 --- a/slsDetectorGui/src/qTabMessages.cpp +++ b/slsDetectorGui/src/qTabMessages.cpp @@ -16,6 +16,8 @@ #include #include #include + + /** C++ Include Headers */ #include #include @@ -23,7 +25,7 @@ using namespace std; //------------------------------------------------------------------------------------------------------------------------------------------------- -qTabMessages::qTabMessages(QWidget *parent,multiSlsDetector*& detector):QWidget(parent),myDet(detector){ +qTabMessages::qTabMessages(QWidget *parent):QWidget(parent),myDet(0){ SetupWidgetWindow(); Initialization(); } @@ -33,6 +35,7 @@ qTabMessages::qTabMessages(QWidget *parent,multiSlsDetector*& detector):QWidget( qTabMessages::~qTabMessages(){ delete myDet; delete dispLog; + delete qout; } //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -62,7 +65,11 @@ void qTabMessages::SetupWidgetWindow(){ gridLayout->addItem(new QSpacerItem(15,10,QSizePolicy::Fixed,QSizePolicy::Fixed),2,0); gridLayout->addWidget(dispLog,3,0,1,5); - qout=new qDebugStream(std::cout,this); + qout=new qDebugStream(cout,cerr, this);cout<<"working!"<getFilePath().c_str()); fName = fName+"/LogFile.txt"; fName = QFileDialog::getSaveFileName(this,tr("Save Snapshot "), From 34b3a8b01b23fd819f77e9fd79f9589469257bd9 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 16 Oct 2012 09:44:09 +0000 Subject: [PATCH 096/332] bugfix: catching config count at the beginning caused it to crash. now it works without crashing. still to catch cerr output git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@96 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qDetectorMain.cpp | 21 ++++++++++++++------- slsDetectorGui/src/qTabMessages.cpp | 4 ++-- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 97679de97..d7a254b3f 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -95,23 +95,27 @@ void qDetectorMain::SetUpWidgetWindow(const string fName){ layoutTabs->addWidget(tabs); - // creating the messages tab before the plots and detector to catch config stdout - tab_messages = new qTabMessages (this); cout<<"Messages ready"<insertTab(Messages, tab_messages, "Messages"); + // settings up detector SetUpDetector(fName); + // plot setup - myPlot = new qDrawPlot(dockWidgetPlot,myDet);cout<<"DockPlot ready"<setWidget(myPlot); //settings messages to have the det reference tab_messages->SetDetectorReference(myDet); // creating all the other tab widgets tab_measurement = new qTabMeasurement (this, myDet,myPlot); cout<<"Measurement ready"<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 - tabs->insertTab(Messages, tab_messages, "Messages"); +//swap tabs so that messages is last tab + tabs->tabBar()->moveTab(tabs->indexOf(tab_messages),Messages); + tabs->setCurrentIndex(Measurement); + +//other tab properties // Default tab color defaultTabColor = tabs->tabBar()->tabTextColor(DataOutput); //Set the current tab(measurement) to blue as it is the current one diff --git a/slsDetectorGui/src/qTabMessages.cpp b/slsDetectorGui/src/qTabMessages.cpp index 7d22b7395..d0c357788 100644 --- a/slsDetectorGui/src/qTabMessages.cpp +++ b/slsDetectorGui/src/qTabMessages.cpp @@ -25,7 +25,7 @@ using namespace std; //------------------------------------------------------------------------------------------------------------------------------------------------- -qTabMessages::qTabMessages(QWidget *parent):QWidget(parent),myDet(0){ +qTabMessages::qTabMessages(QWidget *parent):QWidget(parent),myDet(0),qout(NULL){ SetupWidgetWindow(); Initialization(); } @@ -65,7 +65,7 @@ void qTabMessages::SetupWidgetWindow(){ gridLayout->addItem(new QSpacerItem(15,10,QSizePolicy::Fixed,QSizePolicy::Fixed),2,0); gridLayout->addWidget(dispLog,3,0,1,5); - qout=new qDebugStream(cout,cerr, this);cout<<"working!"< Date: Thu, 18 Oct 2012 15:28:57 +0000 Subject: [PATCH 097/332] some small changes to comly with qt4.7 version..but it still does not work git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@97 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/slsDetectorGui.pro | 1 + slsDetectorGui/slsDetectorPlotting/include/SlsQt1DZoomer.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index fdced7387..c18ff8d71 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -30,6 +30,7 @@ DEPENDPATH += \ INCLUDEPATH += \ $(QWTDIR)/include\ + $(QWTDIR)/src\ slsDetectorPlotting/include\ include\ forms/include\ diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DZoomer.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DZoomer.h index 94afd2707..e9dbfb49d 100644 --- a/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DZoomer.h +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DZoomer.h @@ -7,7 +7,7 @@ #ifndef SLSQT1DZOOMER_H #define SLSQT1DZOOMER_H - +#include #include #include class SlsQtH1D; From 04e04db2adb0e450fe417d98e9e9a124b81cf8f4 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 19 Oct 2012 10:21:56 +0000 Subject: [PATCH 098/332] problem with segmentation fault when trying to capture config loading logs at start:fixed git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@98 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qDetectorMain.h | 3 +- slsDetectorGui/include/qTabMessages.h | 10 ++---- slsDetectorGui/src/qDetectorMain.cpp | 50 +++++++++++++------------- slsDetectorGui/src/qTabMessages.cpp | 2 +- 4 files changed, 30 insertions(+), 35 deletions(-) diff --git a/slsDetectorGui/include/qDetectorMain.h b/slsDetectorGui/include/qDetectorMain.h index fd8b8c830..b4ec2cdb6 100644 --- a/slsDetectorGui/include/qDetectorMain.h +++ b/slsDetectorGui/include/qDetectorMain.h @@ -113,9 +113,8 @@ private: int isDeveloper; /**Sets up the layout of the widget - * @param fName file name of the config file at start up * */ - void SetUpWidgetWindow(const string fName); + void SetUpWidgetWindow(); /**Sets up detector * @param fName file name of the config file at start up diff --git a/slsDetectorGui/include/qTabMessages.h b/slsDetectorGui/include/qTabMessages.h index 49d722d46..ccc90691b 100644 --- a/slsDetectorGui/include/qTabMessages.h +++ b/slsDetectorGui/include/qTabMessages.h @@ -27,19 +27,15 @@ class qTabMessages:public QWidget{ public: /** \short The constructor - * @param parent is the parent tab widget + * @param parent is the parent tab widget + * @param det the detector reference */ - qTabMessages(QWidget *parent); + qTabMessages(QWidget *parent,multiSlsDetector*& detector); /** Destructor */ ~qTabMessages(); - /** Set the detetor reference - * @param det the detector reference - */ - void SetDetectorReference(multiSlsDetector*& detector){myDet = detector;}; - private: /** The sls detector object */ diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index d7a254b3f..676362488 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -64,7 +64,8 @@ qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app, QWidget * } setupUi(this); - SetUpWidgetWindow(configFName); + SetUpDetector(configFName); + SetUpWidgetWindow(); Initialization(); } @@ -83,33 +84,21 @@ qDetectorMain::~qDetectorMain(){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void qDetectorMain::SetUpWidgetWindow(const string fName){ +void qDetectorMain::SetUpWidgetWindow(){ // Layout layoutTabs= new QGridLayout; centralwidget->setLayout(layoutTabs); - -//tabs setup - tabs = new MyTabWidget(this); - layoutTabs->addWidget(tabs); - - -// creating the messages tab before the plots and detector to catch config stdout - tab_messages = new qTabMessages (this); cout<<"Messages ready"<insertTab(Messages, tab_messages, "Messages"); - -// settings up detector - SetUpDetector(fName); - -// plot setup +//plot setup myPlot = new qDrawPlot(dockWidgetPlot,myDet); cout<<"DockPlot ready"<setWidget(myPlot); - //settings messages to have the det reference - tab_messages->SetDetectorReference(myDet); - // creating all the other tab widgets +//tabs setup + tabs = new MyTabWidget(this); + layoutTabs->addWidget(tabs); cout<<"DockPlot ready"<insertTab(Advanced, scroll[Advanced], "Advanced"); tabs->insertTab(Debugging, scroll[Debugging], "Debugging"); tabs->insertTab(Developer, scroll[Developer], "Developer"); + //no scroll buttons this way + tabs->insertTab(Messages, tab_messages, "Messages"); //swap tabs so that messages is last tab - tabs->tabBar()->moveTab(tabs->indexOf(tab_messages),Messages); + tabs->tabBar()->moveTab(tabs->indexOf(tab_measurement), Measurement); + tabs->tabBar()->moveTab(tabs->indexOf(tab_settings), Settings); + tabs->tabBar()->moveTab(tabs->indexOf(tab_dataoutput), DataOutput); + tabs->tabBar()->moveTab(tabs->indexOf(tab_plot), Plot); + tabs->tabBar()->moveTab(tabs->indexOf(tab_actions), Actions); + tabs->tabBar()->moveTab(tabs->indexOf(tab_advanced), Advanced); + tabs->tabBar()->moveTab(tabs->indexOf(tab_debugging), Debugging); + tabs->tabBar()->moveTab(tabs->indexOf(tab_developer), Developer); + tabs->tabBar()->moveTab(tabs->indexOf(tab_messages), Messages); tabs->setCurrentIndex(Measurement); //other tab properties @@ -156,10 +156,7 @@ void qDetectorMain::SetUpWidgetWindow(const string fName){ // mode setup - to set up the tabs initially as disabled, not in form so done here #ifdef VERBOSE - cout << "Setting Debug Mode to 0\n" - "Setting Expert Mode to 0\n" - "Setting Developer Mode to " << isDeveloper << "" - "\nSetting Dockable Mode to false\n" << endl; + cout << "Setting Debug Mode to 0\nSetting Expert Mode to 0\nSetting Developer Mode to " << isDeveloper << "\nSetting Dockable Mode to false\n" << endl; #endif tabs->setTabEnabled(Debugging,false); tabs->setTabEnabled(Advanced,false); @@ -191,6 +188,9 @@ void qDetectorMain::SetUpDetector(const string fName){ //instantiate detector and set window title myDet = new multiSlsDetector(detID); + //create messages tab to capture config file loading logs + tab_messages = new qTabMessages (this,myDet); cout<<"Messages ready"< Date: Mon, 22 Oct 2012 14:10:32 +0000 Subject: [PATCH 099/332] added the buttons git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@99 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/images/leftArrow.png | Bin 0 -> 575 bytes slsDetectorGui/images/rightArrow.png | Bin 0 -> 556 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 slsDetectorGui/images/leftArrow.png create mode 100644 slsDetectorGui/images/rightArrow.png diff --git a/slsDetectorGui/images/leftArrow.png b/slsDetectorGui/images/leftArrow.png new file mode 100644 index 0000000000000000000000000000000000000000..34165b715020b40105dab207ca1eaea66a0c6dc1 GIT binary patch literal 575 zcmV-F0>J%=P)ogJ?YtHnlQS`u1H&*g%#UZD_jyHC`JZ6{Choq_t-Qy!R}{gE z;CI%M!3u+wh%mH7E+BFNX;L9QJI3RwR4l+&)@J3z5Eug@pbFko3xv}nF=@3-5(OmA z5=Q|^IbdO}1%LtQsz4M$xx70spBdxh^^06h^M6Y3=6>%B7*hbO1rZvf13W!Hj`X^G z%@m9rBq;j;E`q?)7_Bl>kLmo{;^Esx7QM`9`lY4JI@w{7u zQfbedzZ7Vn0${pU;n{RTp0()pdfc8G=8g!Fvqa9}oI`+ir^Bn|HDIV8pp*m*${)*| zNO7(nQIGf>1;l$qb=QOf;Fb65Ew0U5o=jG-)^h*D3NL+)OG8RknJm(c7jGt7RM)+YZL1>AOlnLtN0LcHg^KWB5!01wk+?(E{Vy&j>P_QbBRHzOj3Jy9dw40klRotY52;%I2q2Q0*!ObOux~PMT zHj`pS5ZhR5yf-#Cx%ZxXK8J*)Aq9s%@Qv?t-oyEhs4Ba`2UxDvHLI-={cV$_7Hciy zl$T$BlG_|3iUCAGjKMd8*LKt&Er}0M*l2O`!~w!~M%2j&6HD01n41v3Zza?d2gY;_ zs^A>u&l><3fXwZDja#z?YS+)RI5z{O(qM{3oX9}1BSu(lJMuK)@r5HS9-AH#;Cb5w zJ=+kT$ETpe?dk{OX2gTj6&4PcyW!w}0ueBV1mT5Lxcl}CY24!B`~(ZLlMsycGk!M! z`sWu{4wVUl5&|S?N}433GafLFwU!{aJe}XirMBgp84?JJpvEA^Lje^-E`|)jsWRRx z=MZx3o!S=wW^#(>>lsleCQNfe2ay`yH*+q_Z|V_MPkmsDyCd(I3;XI$EcWYGZTV1)e;I<2PctxCYuq3Eo z;M%KIsy~{8P0aIQLBTVC8*x0_^tkur4UJ4kR=FTL5ZI}4UVmI?GmPmZ8J#2}O)bs1 uL%SKXM-_u&R1uUhBkV1fy5)EKo&N!@U*)9YiK+(x0000 Date: Mon, 22 Oct 2012 15:34:14 +0000 Subject: [PATCH 100/332] Changes for Qwt6, but 2D plot still does not work...and should be checked if Qwt5 still works git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@100 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qDrawPlot.h | 4 + slsDetectorGui/slsDetectorGui.pro | 3 +- .../include/SlsQt1DZoomer.h | 18 +++- .../slsDetectorPlotting/include/SlsQt2DHist.h | 9 +- .../slsDetectorPlotting/include/SlsQt2DPlot.h | 7 ++ .../include/SlsQt2DZoomer.h | 16 +++- .../slsDetectorPlotting/src/SlsQt1DPlot.cxx | 25 ++++- .../slsDetectorPlotting/src/SlsQt1DZoomer.cxx | 4 + .../slsDetectorPlotting/src/SlsQt2DHist.cxx | 9 +- .../slsDetectorPlotting/src/SlsQt2DPlot.cxx | 94 +++++++++++++++++-- slsDetectorGui/src/qCloneWidget.cpp | 16 ++++ 11 files changed, 184 insertions(+), 21 deletions(-) diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index 14b58f531..9f13468ce 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -227,7 +227,11 @@ void SavePlotAutomatic(); /** Sets the style of the 1d plot */ void SetStyle(SlsQtH1D* h){ if(lines) h->setStyle(QwtPlotCurve::Lines); else h->setStyle(QwtPlotCurve::Dots); +#if QWT_VERSION<0x060000 if(markers) h->setSymbol(*marker); else h->setSymbol(*noMarker); +#else + if(markers) h->setSymbol(marker); else h->setSymbol(noMarker); +#endif }; diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index c18ff8d71..c213206cb 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -20,7 +20,7 @@ QMAKE_CLEAN += docs/*/* \ LIBS += -Wl,-Bstatic -L../slsDetectorSoftware -lSlsDetector -Wl,-Bdynamic\ - -L$(QWTDIR)/lib -lqwt + -L$(QWTDIR)/lib -lqwt -L$(QWT3D)/lib DEPENDPATH += \ slsDetectorPlotting/include\ @@ -31,6 +31,7 @@ DEPENDPATH += \ INCLUDEPATH += \ $(QWTDIR)/include\ $(QWTDIR)/src\ + $(QWT3D)/include\ slsDetectorPlotting/include\ include\ forms/include\ diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DZoomer.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DZoomer.h index e9dbfb49d..730516a60 100644 --- a/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DZoomer.h +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DZoomer.h @@ -6,10 +6,10 @@ #ifndef SLSQT1DZOOMER_H #define SLSQT1DZOOMER_H - -#include #include #include +#include + class SlsQtH1D; class SlsQt1DZoomer:public QwtPlotZoomer{ @@ -42,14 +42,24 @@ class SlsQt1DZoomer:public QwtPlotZoomer{ bool SetLogX(bool yes) { return xIsLog=yes;} bool SetLogY(bool yes) { return yIsLog=yes;} - virtual QwtText trackerText(const QwtDoublePoint &pos) const{ + +#if QWT_VERSION<0x060000 + virtual QwtText trackerText(const QwtDoublePoint &pos) const{ +#else + virtual QwtText trackerText(const QPointF &pos) const{ +#endif QColor bg(Qt::white); + #if QT_VERSION >= 0x040300 bg.setAlpha(200); #endif +#if QWT_VERSION<0x060000 QwtText text = QwtPlotZoomer::trackerText(pos); - +#else + QPoint p=pos.toPoint(); + QwtText text = QwtPlotZoomer::trackerText(p); +#endif text.setBackgroundBrush( QBrush( bg )); return text; } diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DHist.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DHist.h index b3d93a001..49ce36859 100644 --- a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DHist.h +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DHist.h @@ -77,7 +77,14 @@ class SlsQt2DHist: public QwtRasterData{ //just passes a pointer so that data is common to both the copy and the original instance return (QwtRasterData*) this; } - virtual QwtDoubleInterval range() const{ return QwtDoubleInterval(z_min,z_max);} + +#if QWT_VERSION<0x060000 + virtual QwtDoubleInterval range() const{ return QwtDoubleInterval(z_min,z_max);} +#else + virtual QwtInterval range() const{ return QwtInterval(z_min,z_max);} +#endif + + virtual double value(double x, double y) const{ //if(!interp){ //default is box like plot diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h index f2a1eaf77..d5872183e 100644 --- a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h @@ -16,6 +16,7 @@ #include +#include #include #include "SlsQt2DZoomer.h" @@ -39,8 +40,14 @@ private: QwtLinearColorMap* colorMapLinearScale; QwtLinearColorMap* colorMapLogScale; + QwtLinearColorMap* currentColorMap; +#if QWT_VERSION<0x060000 QwtValueList* contourLevelsLinear; QwtValueList* contourLevelsLog; +#else + QList contourLevelsLinear; + QList contourLevelsLog; +#endif void SetupZoom(); void SetupColorMap(); diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DZoomer.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DZoomer.h index 0b665660b..fdda79d66 100644 --- a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DZoomer.h +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DZoomer.h @@ -27,7 +27,12 @@ class SlsQt2DZoomer:public QwtPlotZoomer{ hist=h; } - virtual QwtText trackerText(const QwtDoublePoint &pos) const{ + +#if QWT_VERSION<0x060000 + virtual QwtText trackerText(const QwtDoublePoint &pos) const{ +#else + virtual QwtText trackerText(const QPointF &pos) const{ +#endif QColor bg(Qt::white); #if QT_VERSION >= 0x040300 bg.setAlpha(200); @@ -41,8 +46,15 @@ class SlsQt2DZoomer:public QwtPlotZoomer{ static char t[200]; sprintf(t,"%3.2f, %3.2f, %3.2f",pos.x(),pos.y(),hist->value(pos.x(),pos.y())); text.setText(t); - }else text = QwtPlotZoomer::trackerText(pos); + }else { +#if QWT_VERSION<0x060000 + QwtText text = QwtPlotZoomer::trackerText(pos); +#else + QPoint p=pos.toPoint(); + QwtText text = QwtPlotZoomer::trackerText(p); +#endif + } text.setBackgroundBrush( QBrush( bg )); return text; } diff --git a/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cxx b/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cxx index 0fd8af9c7..8f0f01147 100644 --- a/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cxx +++ b/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cxx @@ -119,8 +119,11 @@ void SlsQtH1D::SetData(int n, double xmin, double xmax, double *data){ // if(firstXgt0<0)firstXgt0=0.001; // if(firstYgt0<0)firstYgt0=0.001; - - setRawData(x,y,ndata); +#if QWT_VERSION<0x060000 + setRawData(x,y,ndata); +#else + setRawSamples(x,y,ndata); +#endif } void SlsQtH1D::SetData(int n, double* data_x, double *data_y){ @@ -146,7 +149,11 @@ void SlsQtH1D::SetData(int n, double* data_x, double *data_y){ if(y[b]>0&&(firstYgt0<0||firstYgt0>y[b])) firstYgt0=y[b]; } +#if QWT_VERSION<0x060000 setRawData(x,y,ndata); +#else + setRawSamples(x,y,ndata); +#endif } int SlsQtH1D::SetUpArrays(int n){ @@ -441,11 +448,19 @@ void SlsQt1DPlot::alignScales(){ } void SlsQt1DPlot::UnknownStuff(){ +#if QWT_VERSION<0x060000 // Disable polygon clipping - QwtPainter::setDeviceClipping(false); + //not supported for version 6 + QwtPainter::setDeviceClipping(false); + canvas()->setPaintAttribute(QwtPlotCanvas::PaintCached, false); + canvas()->setPaintAttribute(QwtPlotCanvas::PaintPacked, false); +#else // We don't need the cache here - canvas()->setPaintAttribute(QwtPlotCanvas::PaintCached, false); - canvas()->setPaintAttribute(QwtPlotCanvas::PaintPacked, false); + canvas()->setPaintAttribute(QwtPlotCanvas::BackingStore, false); + +#endif + + #if QT_VERSION >= 0x040000 #ifdef Q_WS_X11 diff --git a/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DZoomer.cxx b/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DZoomer.cxx index 942bd13c4..f8dd8c20b 100644 --- a/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DZoomer.cxx +++ b/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DZoomer.cxx @@ -61,7 +61,11 @@ void SlsQt1DZoomer::SetZoomBase(double xmin,double ymin,double x_width, double y plot()->replot(); } +#if QWT_VERSION<0x060000 setZoomBase(QwtDoubleRect(xmin,ymin,x_width,y_width)); +#else + setZoomBase(QRectF(xmin,ymin,x_width,y_width)); +#endif } void SlsQt1DZoomer::SetZoomBase(SlsQtH1D* h){ diff --git a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DHist.cxx b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DHist.cxx index dd9910ac4..c8d7204f1 100644 --- a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DHist.cxx +++ b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DHist.cxx @@ -54,7 +54,14 @@ void SlsQt2DHist::SetData(int nbinsx, double xmin, double xmax, int nbinsy,doubl if(x_min!=xmin||x_max!=xmax||y_min!=ymin||y_max!=ymax){ x_min=xmin;x_max=xmax; y_min=ymin;y_max=ymax; - setBoundingRect(QwtDoubleRect(xmin,ymin,x_max-x_min,y_max-y_min)); + +#if QWT_VERSION<0x060000 + setBoundingRect(QRectF(xmin,ymin,x_max-x_min,y_max-y_min)); +#else + setInterval( Qt::XAxis,QwtInterval(xmin,xmax)); + setInterval( Qt::YAxis,QwtInterval(ymin,ymax)); +#endif + } if(nbinsx*nbinsy<1){ diff --git a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx index 573227271..66a8d7ba4 100644 --- a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx +++ b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx @@ -8,6 +8,7 @@ #include #include #include +#include #if QT_VERSION >= 0x040000 #include @@ -33,11 +34,18 @@ SlsQt2DPlot::SlsQt2DPlot(QWidget *parent):QwtPlot(parent){ d_spectrogram = new QwtPlotSpectrogram(); hist = new SlsQt2DHist(); - + currentColorMap=NULL; SetupZoom(); SetupColorMap(); + +#if QWT_VERSION<0x060000 d_spectrogram->setData(*hist); +#else + d_spectrogram->setData(hist); +#endif + + d_spectrogram->attach(this); plotLayout()->setAlignCanvasToScales(true); @@ -55,7 +63,13 @@ void SlsQt2DPlot::SetupColorMap(){ colorMapLinearScale->addColorStop(0.4, Qt::blue); colorMapLinearScale->addColorStop(0.6, Qt::green); colorMapLinearScale->addColorStop(0.95, Qt::yellow); +#if QWT_VERSION<0x060000 d_spectrogram->setColorMap(*colorMapLinearScale); +#else + d_spectrogram->setColorMap(colorMapLinearScale); + currentColorMap=colorMapLinearScale; + cout << "current color map is linear" << endl; +#endif colorMapLogScale = new QwtLinearColorMap(Qt::darkCyan, Qt::red); @@ -64,11 +78,28 @@ void SlsQt2DPlot::SetupColorMap(){ colorMapLogScale->addColorStop((pow(10,2*0.60)-1)/99.0,Qt::green); colorMapLogScale->addColorStop((pow(10,2*0.95)-1)/99.0,Qt::yellow); - contourLevelsLinear = new QwtValueList(); - for(double level=0.5;level<10.0;level+=1.0 ) (*contourLevelsLinear) += level; +#if QWT_VERSION<0x060000 + contourLevelsLinear = new QwtValueList(); + for(double level=0.5;level<10.0;level+=1.0 ) (*contourLevelsLinear) += level; d_spectrogram->setContourLevels(*contourLevelsLinear); - contourLevelsLog = new QwtValueList(); - for(double level=0.5;level<10.0;level+=1.0 ) (*contourLevelsLog) += (pow(10,2*level/10.0)-1)/99.0 * 10; +#else + ; + // contourLevelsLinear = new QList(); + for(double level=0.5;level<10.0;level+=1.0 ) (contourLevelsLinear) += level; + d_spectrogram->setContourLevels(contourLevelsLinear); +#endif + + + // +#if QWT_VERSION<0x060000 + contourLevelsLog = new QwtValueList(); + for(double level=0.5;level<10.0;level+=1.0 ) (*contourLevelsLog) += (pow(10,2*level/10.0)-1)/99.0 * 10; + +#else + ; + // contourLevelsLog = new QList(); + for(double level=0.5;level<10.0;level+=1.0 ) (contourLevelsLog) += (pow(10,2*level/10.0)-1)/99.0 * 10; +#endif // A color bar on the right axis @@ -137,14 +168,23 @@ void SlsQt2DPlot::SetupZoom(){ }*/ void SlsQt2DPlot::UnZoom(){ +#if QWT_VERSION<0x060000 zoomer->setZoomBase(QwtDoubleRect(hist->GetXMin(),hist->GetYMin(),hist->GetXMax()-hist->GetXMin(),hist->GetYMax()-hist->GetYMin())); - +#else + zoomer->setZoomBase(QRectF(hist->GetXMin(),hist->GetYMin(),hist->GetXMax()-hist->GetXMin(),hist->GetYMax()-hist->GetYMin())); +#endif zoomer->setZoomBase();//Call replot for the attached plot before initializing the zoomer with its scales. // zoomer->zoom(0); } void SlsQt2DPlot::SetZoom(double xmin,double ymin,double x_width,double y_width){ + +#if QWT_VERSION<0x060000 zoomer->setZoomBase(QwtDoubleRect(xmin,ymin,x_width,y_width)); + +#else + zoomer->setZoomBase(QRectF(xmin,ymin,x_width,y_width)); +#endif } void SlsQt2DPlot::SetZMinMax(double zmin,double zmax){ @@ -153,10 +193,32 @@ void SlsQt2DPlot::SetZMinMax(double zmin,double zmax){ void SlsQt2DPlot::Update(){ +#if QWT_VERSION<0x060000 rightAxis->setColorMap(d_spectrogram->data().range(),d_spectrogram->colorMap()); +#else + ; + rightAxis->setColorMap(d_spectrogram->data()->interval(Qt::ZAxis),currentColorMap); + + + cout << "Should reset the color map? " << currentColorMap << endl; + // QwtColorMap *c=d_spectrogram->colorMap(); + // rightAxis->setColorMap(d_spectrogram->data()->interval(Qt::ZAxis),c); + +#endif + if(!zoomer->zoomRectIndex()) UnZoom(); + +#if QWT_VERSION<0x060000 setAxisScale(QwtPlot::yRight,d_spectrogram->data().range().minValue(), - d_spectrogram->data().range().maxValue()); + d_spectrogram->data().range().maxValue()); +#else + setAxisScale(QwtPlot::yRight,d_spectrogram->data()->interval(Qt::ZAxis).minValue(), + d_spectrogram->data()->interval(Qt::ZAxis).maxValue()); + + cout << "min is " << d_spectrogram->data()->interval(Qt::YAxis).minValue() << endl; +cout << "max is " << d_spectrogram->data()->interval(Qt::YAxis).maxValue() << endl; + +#endif replot(); } @@ -184,13 +246,31 @@ void SlsQt2DPlot::InterpolatedPlot(bool on){ void SlsQt2DPlot::LogZ(bool on){ if(on){ //if(hist->GetMinimum()<=0) hist->SetMinimumToFirstGreaterThanZero(); +#if QWT_VERSION<0x060000 d_spectrogram->setColorMap(*colorMapLogScale); +#else + d_spectrogram->setColorMap(colorMapLogScale); + currentColorMap=colorMapLogScale; +#endif setAxisScaleEngine(QwtPlot::yRight,new QwtLog10ScaleEngine); +#if QWT_VERSION<0x060000 d_spectrogram->setContourLevels(*contourLevelsLog); +#else + d_spectrogram->setContourLevels(contourLevelsLog); +#endif }else{ +#if QWT_VERSION<0x060000 d_spectrogram->setColorMap(*colorMapLinearScale); +#else + d_spectrogram->setColorMap(colorMapLinearScale); + currentColorMap=colorMapLinearScale; +#endif setAxisScaleEngine(QwtPlot::yRight,new QwtLinearScaleEngine); +#if QWT_VERSION<0x060000 d_spectrogram->setContourLevels(*contourLevelsLinear); +#else + d_spectrogram->setContourLevels(contourLevelsLinear); +#endif } Update(); diff --git a/slsDetectorGui/src/qCloneWidget.cpp b/slsDetectorGui/src/qCloneWidget.cpp index 7080cc548..b64c8754b 100644 --- a/slsDetectorGui/src/qCloneWidget.cpp +++ b/slsDetectorGui/src/qCloneWidget.cpp @@ -114,10 +114,18 @@ void qCloneWidget::SetCloneHists(int nHists,int histNBins,double* histXAxis,doub QwtSymbol *marker = new QwtSymbol(); marker->setStyle(QwtSymbol::Cross); marker->setSize(5,5); +#if QWT_VERSION<0x060000 k->setSymbol(*marker); +#else + k->setSymbol(marker); +#endif }else { QwtSymbol *noMarker = new QwtSymbol(); +#if QWT_VERSION<0x060000 k->setSymbol(*noMarker); +#else + k->setSymbol(noMarker); +#endif } //set title and attach plot k->setTitle(histTitle[hist_num].c_str()); @@ -149,10 +157,18 @@ void qCloneWidget::SetCloneHists(int nHists,int histNBins,double* histXAxis,doub QwtSymbol *marker = new QwtSymbol(); marker->setStyle(QwtSymbol::Cross); marker->setSize(5,5); +#if QWT_VERSION<0x060000 k->setSymbol(*marker); +#else + k->setSymbol(marker); +#endif }else { QwtSymbol *noMarker = new QwtSymbol(); +#if QWT_VERSION<0x060000 k->setSymbol(*noMarker); +#else + k->setSymbol(noMarker); +#endif } //set title and attach plot k->setTitle(histTitle[hist_num].c_str()); From 1d03067bd590560ba7e8e36fe90fc524cb7ea918 Mon Sep 17 00:00:00 2001 From: bergamaschi Date: Tue, 23 Oct 2012 10:30:32 +0000 Subject: [PATCH 101/332] works with qwt5, but qwt6 except for 2D plots git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@101 af1100a4-978c-4157-bff7-07162d2ba061 --- .../slsDetectorPlotting/include/SlsQt2DPlot.h | 16 +++- .../slsDetectorPlotting/src/SlsQt2DPlot.cxx | 80 ++++++++++++------- 2 files changed, 64 insertions(+), 32 deletions(-) diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h index d5872183e..c977e89ef 100644 --- a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h @@ -40,7 +40,6 @@ private: QwtLinearColorMap* colorMapLinearScale; QwtLinearColorMap* colorMapLogScale; - QwtLinearColorMap* currentColorMap; #if QWT_VERSION<0x060000 QwtValueList* contourLevelsLinear; QwtValueList* contourLevelsLog; @@ -52,6 +51,11 @@ private: void SetupZoom(); void SetupColorMap(); + QwtLinearColorMap* myColourMap(QVector colourStops); + + + + public: SlsQt2DPlot(QWidget * = NULL); @@ -80,12 +84,20 @@ public: void SetData(int nbinsx, double xmin, double xmax, int nbinsy,double ymin, double ymax,double *d,double zmin=0, double zmax=-1){ hist->SetData(nbinsx,xmin,xmax,nbinsy,ymin,ymax,d,zmin,zmax); + +#if QWT_VERSION<0x060000 + ; +#else + d_spectrogram->setData(hist); +#endif + + } double* GetDataPtr() {return hist->GetDataPtr();} int GetBinIndex(int bx,int by) {return hist->GetBinIndex(bx,by);} int FindBinIndex(double x,double y) {return hist->FindBinIndex(x,y);} - void SetBinValue(int bx,int by,double v) {hist->SetBinValue(bx,by,v);} + void SetBinValue(int bx,int by,double v) { hist->SetBinValue(bx,by,v);} double GetBinValue(int bx,int by) {return hist->GetBinValue(bx,by);} diff --git a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx index 66a8d7ba4..7476bc827 100644 --- a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx +++ b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx @@ -34,7 +34,6 @@ SlsQt2DPlot::SlsQt2DPlot(QWidget *parent):QwtPlot(parent){ d_spectrogram = new QwtPlotSpectrogram(); hist = new SlsQt2DHist(); - currentColorMap=NULL; SetupZoom(); SetupColorMap(); @@ -57,27 +56,33 @@ SlsQt2DPlot::SlsQt2DPlot(QWidget *parent):QwtPlot(parent){ void SlsQt2DPlot::SetupColorMap(){ + QVector cs(0); - colorMapLinearScale = new QwtLinearColorMap(Qt::darkCyan, Qt::red); - colorMapLinearScale->addColorStop(0.1, Qt::cyan); - colorMapLinearScale->addColorStop(0.4, Qt::blue); - colorMapLinearScale->addColorStop(0.6, Qt::green); - colorMapLinearScale->addColorStop(0.95, Qt::yellow); + + cs.append(0); + cs.append(0.1); + cs.append(0.4); + cs.append(0.6); + cs.append(0.95); + cs.append(1.); + + colorMapLinearScale = myColourMap(cs); #if QWT_VERSION<0x060000 d_spectrogram->setColorMap(*colorMapLinearScale); #else d_spectrogram->setColorMap(colorMapLinearScale); - currentColorMap=colorMapLinearScale; - cout << "current color map is linear" << endl; #endif - + QVector cs1(0); + - colorMapLogScale = new QwtLinearColorMap(Qt::darkCyan, Qt::red); - colorMapLogScale->addColorStop((pow(10,2*0.10)-1)/99.0, Qt::cyan); //linear scale goes from 0 to 2 and log scale goes from 1 to 100 - colorMapLogScale->addColorStop((pow(10,2*0.40)-1)/99.0,Qt::blue); - colorMapLogScale->addColorStop((pow(10,2*0.60)-1)/99.0,Qt::green); - colorMapLogScale->addColorStop((pow(10,2*0.95)-1)/99.0,Qt::yellow); + cs.append(0); + cs.append((pow(10,2*0.10)-1)/99.0); + cs.append((pow(10,2*0.40)-1)/99.0); + cs.append((pow(10,2*0.60)-1)/99.0); + cs.append((pow(10,2*0.95)-1)/99.0); + cs.append(1.); + colorMapLogScale = myColourMap(cs1); #if QWT_VERSION<0x060000 contourLevelsLinear = new QwtValueList(); for(double level=0.5;level<10.0;level+=1.0 ) (*contourLevelsLinear) += level; @@ -103,8 +108,9 @@ void SlsQt2DPlot::SetupColorMap(){ // A color bar on the right axis - rightAxis = axisWidget(QwtPlot::yRight); - rightAxis->setTitle("Intensity"); + rightAxis = axisWidget(QwtPlot::yRight); + + rightAxis->setTitle("Intensity"); rightAxis->setColorBarEnabled(true); enableAxis(QwtPlot::yRight); } @@ -192,31 +198,47 @@ void SlsQt2DPlot::SetZMinMax(double zmin,double zmax){ } +QwtLinearColorMap* SlsQt2DPlot::myColourMap(QVector colourStops) { + QwtLinearColorMap* copyMap = new QwtLinearColorMap(); + + + copyMap->addColorStop(colourStops.value(0), Qt::white); + // copyMap->addColorStop(colourStops.value(0), Qt::darkCyan); + copyMap->addColorStop(colourStops.value(1), Qt::cyan); + copyMap->addColorStop(colourStops.value(2), Qt::blue); + copyMap->addColorStop(colourStops.value(3), Qt::green); + copyMap->addColorStop(colourStops.value(4), Qt::yellow); + copyMap->addColorStop(colourStops.value(5), Qt::red); + + return copyMap; + +} + + void SlsQt2DPlot::Update(){ #if QWT_VERSION<0x060000 rightAxis->setColorMap(d_spectrogram->data().range(),d_spectrogram->colorMap()); #else - ; - rightAxis->setColorMap(d_spectrogram->data()->interval(Qt::ZAxis),currentColorMap); - - cout << "Should reset the color map? " << currentColorMap << endl; - // QwtColorMap *c=d_spectrogram->colorMap(); - // rightAxis->setColorMap(d_spectrogram->data()->interval(Qt::ZAxis),c); + QVector colourStops =((QwtLinearColorMap*)d_spectrogram->colorMap())->colorStops(); + QwtLinearColorMap* copyMap = myColourMap(colourStops); + // rightAxis->setColorMap(d_spectrogram->data()->interval(Qt::ZAxis),copyMap); + rightAxis->setColorMap(hist->range(),copyMap); + #endif if(!zoomer->zoomRectIndex()) UnZoom(); - + #if QWT_VERSION<0x060000 setAxisScale(QwtPlot::yRight,d_spectrogram->data().range().minValue(), d_spectrogram->data().range().maxValue()); #else - setAxisScale(QwtPlot::yRight,d_spectrogram->data()->interval(Qt::ZAxis).minValue(), - d_spectrogram->data()->interval(Qt::ZAxis).maxValue()); - - cout << "min is " << d_spectrogram->data()->interval(Qt::YAxis).minValue() << endl; -cout << "max is " << d_spectrogram->data()->interval(Qt::YAxis).maxValue() << endl; + // setAxisScale(QwtPlot::yRight,d_spectrogram->data()->interval(Qt::ZAxis).minValue(), d_spectrogram->data()->interval(Qt::ZAxis).maxValue()); + setAxisScale(QwtPlot::yRight,hist->range().minValue(), hist->range().maxValue()); + + cout << "min is " << d_spectrogram->data()->interval(Qt::ZAxis).minValue() << " " << hist->range().minValue() << endl; + cout << "max is " << d_spectrogram->data()->interval(Qt::ZAxis).maxValue() << " " << hist->range().maxValue() << endl; #endif replot(); @@ -250,7 +272,6 @@ void SlsQt2DPlot::LogZ(bool on){ d_spectrogram->setColorMap(*colorMapLogScale); #else d_spectrogram->setColorMap(colorMapLogScale); - currentColorMap=colorMapLogScale; #endif setAxisScaleEngine(QwtPlot::yRight,new QwtLog10ScaleEngine); #if QWT_VERSION<0x060000 @@ -263,7 +284,6 @@ void SlsQt2DPlot::LogZ(bool on){ d_spectrogram->setColorMap(*colorMapLinearScale); #else d_spectrogram->setColorMap(colorMapLinearScale); - currentColorMap=colorMapLinearScale; #endif setAxisScaleEngine(QwtPlot::yRight,new QwtLinearScaleEngine); #if QWT_VERSION<0x060000 From 3e979fdece24a880063a6bf48b26f49995a9d22b Mon Sep 17 00:00:00 2001 From: bergamaschi Date: Wed, 24 Oct 2012 09:44:31 +0000 Subject: [PATCH 102/332] finally works also with qwt6 - 2D plot color scales changed to root's git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@102 af1100a4-978c-4157-bff7-07162d2ba061 --- .../slsDetectorPlotting/include/SlsQt2DHist.h | 18 ++++ .../slsDetectorPlotting/include/SlsQt2DPlot.h | 8 +- .../slsDetectorPlotting/src/SlsQt2DHist.cxx | 3 + .../slsDetectorPlotting/src/SlsQt2DPlot.cxx | 95 +++++++++++-------- 4 files changed, 79 insertions(+), 45 deletions(-) diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DHist.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DHist.h index 49ce36859..fbca86864 100644 --- a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DHist.h +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DHist.h @@ -82,6 +82,18 @@ class SlsQt2DHist: public QwtRasterData{ virtual QwtDoubleInterval range() const{ return QwtDoubleInterval(z_min,z_max);} #else virtual QwtInterval range() const{ return QwtInterval(z_min,z_max);} + virtual QwtInterval interval(Qt::Axis axis) const { + switch (axis){ + case Qt::ZAxis: + return QwtInterval(z_min,z_max); + case Qt::XAxis: + return QwtInterval(x_min,x_max); + case Qt::YAxis: + return QwtInterval(y_min,y_max); + default: + return QwtInterval(z_min,z_max); + }; + }; #endif @@ -110,6 +122,12 @@ class SlsQt2DHist: public QwtRasterData{ double left_v = value_between_points(y0,data[b00],y1,data[b01],y); double right_v = value_between_points(y0,data[b10],y1,data[b11],y); //horazontal extrap + + + + return 0.5; + + return value_between_points(x_min+(x_int+0.5)*x_width,left_v, x_min+(x_int+1.5)*x_width,right_v,x); } diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h index c977e89ef..e4e320b49 100644 --- a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h @@ -52,6 +52,7 @@ private: void SetupColorMap(); QwtLinearColorMap* myColourMap(QVector colourStops); + QwtLinearColorMap* myColourMap(int log=0); @@ -85,13 +86,6 @@ public: void SetData(int nbinsx, double xmin, double xmax, int nbinsy,double ymin, double ymax,double *d,double zmin=0, double zmax=-1){ hist->SetData(nbinsx,xmin,xmax,nbinsy,ymin,ymax,d,zmin,zmax); -#if QWT_VERSION<0x060000 - ; -#else - d_spectrogram->setData(hist); -#endif - - } double* GetDataPtr() {return hist->GetDataPtr();} diff --git a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DHist.cxx b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DHist.cxx index c8d7204f1..30847ff66 100644 --- a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DHist.cxx +++ b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DHist.cxx @@ -60,6 +60,8 @@ void SlsQt2DHist::SetData(int nbinsx, double xmin, double xmax, int nbinsy,doubl #else setInterval( Qt::XAxis,QwtInterval(xmin,xmax)); setInterval( Qt::YAxis,QwtInterval(ymin,ymax)); + // setInterval( Qt::ZAxis,QwtInterval(zmin,zmax)); + //setInterval( Qt::ZAxis,QwtInterval(0.,1.)); #endif } @@ -103,6 +105,7 @@ void SlsQt2DHist::SetMinMax(double zmin,double zmax){ if(z_min>0) z_min/=1.02; else z_min*=1.02; if(z_max>0) z_max*=1.02; else z_max/=1.02; } + setInterval( Qt::ZAxis,QwtInterval(z_min,z_max)); } double SlsQt2DHist::GetMean(){ diff --git a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx index 7476bc827..106ad7cf6 100644 --- a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx +++ b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx @@ -55,34 +55,20 @@ SlsQt2DPlot::SlsQt2DPlot(QWidget *parent):QwtPlot(parent){ } -void SlsQt2DPlot::SetupColorMap(){ - QVector cs(0); +void SlsQt2DPlot::SetupColorMap(){ + + - cs.append(0); - cs.append(0.1); - cs.append(0.4); - cs.append(0.6); - cs.append(0.95); - cs.append(1.); - - colorMapLinearScale = myColourMap(cs); + colorMapLinearScale = myColourMap(0); #if QWT_VERSION<0x060000 d_spectrogram->setColorMap(*colorMapLinearScale); #else d_spectrogram->setColorMap(colorMapLinearScale); #endif - QVector cs1(0); - - cs.append(0); - cs.append((pow(10,2*0.10)-1)/99.0); - cs.append((pow(10,2*0.40)-1)/99.0); - cs.append((pow(10,2*0.60)-1)/99.0); - cs.append((pow(10,2*0.95)-1)/99.0); - cs.append(1.); - colorMapLogScale = myColourMap(cs1); + colorMapLogScale = myColourMap(1); #if QWT_VERSION<0x060000 contourLevelsLinear = new QwtValueList(); for(double level=0.5;level<10.0;level+=1.0 ) (*contourLevelsLinear) += level; @@ -198,21 +184,51 @@ void SlsQt2DPlot::SetZMinMax(double zmin,double zmax){ } -QwtLinearColorMap* SlsQt2DPlot::myColourMap(QVector colourStops) { - QwtLinearColorMap* copyMap = new QwtLinearColorMap(); +QwtLinearColorMap* SlsQt2DPlot::myColourMap(QVector colourStops) { + +int ns=5; + +double r[]={0.00, 0.00, 0.87, 1.00, 0.51}; +double g[]={0.00, 0.81, 1.00, 0.20, 0.00}; + double b[] = { 0.51, 1.00, 0.12, 0.00, 0.00 }; - - copyMap->addColorStop(colourStops.value(0), Qt::white); - // copyMap->addColorStop(colourStops.value(0), Qt::darkCyan); - copyMap->addColorStop(colourStops.value(1), Qt::cyan); - copyMap->addColorStop(colourStops.value(2), Qt::blue); - copyMap->addColorStop(colourStops.value(3), Qt::green); - copyMap->addColorStop(colourStops.value(4), Qt::yellow); - copyMap->addColorStop(colourStops.value(5), Qt::red); + QColor c1,c2,c; + c1.setRgbF(r[0],g[0],b[0]); + c2.setRgbF(r[ns-1],g[ns-1],b[ns-1]); + QwtLinearColorMap* copyMap = new QwtLinearColorMap(c1, c2); + + for (int is=1; isaddColorStop(colourStops.value(is),c ); + } + + return copyMap; - return copyMap; } +QwtLinearColorMap* SlsQt2DPlot::myColourMap(int log) { + +int ns=5; + + + QVector cs1(0); + QVector lcs1(0); + + + cs1.append(0.); + cs1.append(0.34); + cs1.append(0.61); + cs1.append(0.84); + cs1.append(1.); +if (log) { + for (int is=0; issetColorMap(d_spectrogram->data().range(),d_spectrogram->colorMap()); #else + // const QwtInterval zInterval = d_spectrogram->data()->interval( Qt::ZAxis ); + const QwtInterval zInterval = hist->range(); + QVector colourStops =((QwtLinearColorMap*)d_spectrogram->colorMap())->colorStops(); QwtLinearColorMap* copyMap = myColourMap(colourStops); - // rightAxis->setColorMap(d_spectrogram->data()->interval(Qt::ZAxis),copyMap); - rightAxis->setColorMap(hist->range(),copyMap); + rightAxis->setColorMap(zInterval,copyMap); #endif if(!zoomer->zoomRectIndex()) UnZoom(); #if QWT_VERSION<0x060000 + + setAxisScale(QwtPlot::yRight,d_spectrogram->data().range().minValue(), d_spectrogram->data().range().maxValue()); -#else - // setAxisScale(QwtPlot::yRight,d_spectrogram->data()->interval(Qt::ZAxis).minValue(), d_spectrogram->data()->interval(Qt::ZAxis).maxValue()); - setAxisScale(QwtPlot::yRight,hist->range().minValue(), hist->range().maxValue()); - - cout << "min is " << d_spectrogram->data()->interval(Qt::ZAxis).minValue() << " " << hist->range().minValue() << endl; - cout << "max is " << d_spectrogram->data()->interval(Qt::ZAxis).maxValue() << " " << hist->range().maxValue() << endl; +#else + + setAxisScale(QwtPlot::yRight,zInterval.minValue(), zInterval.maxValue()); + + plotLayout()->setAlignCanvasToScales(true); #endif replot(); } From 07ff5ce42dc7fd65185ba01911ff45cccc626386 Mon Sep 17 00:00:00 2001 From: bergamaschi Date: Wed, 24 Oct 2012 10:39:05 +0000 Subject: [PATCH 103/332] Some problems with LogZ solved, but stil crashing when unsetting logZ git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@103 af1100a4-978c-4157-bff7-07162d2ba061 --- .../slsDetectorPlotting/include/SlsQt2DPlot.h | 2 +- .../slsDetectorPlotting/src/SlsQt2DHist.cxx | 15 +++++- .../slsDetectorPlotting/src/SlsQt2DPlot.cxx | 50 +++++++++++-------- 3 files changed, 44 insertions(+), 23 deletions(-) diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h index e4e320b49..23daeb338 100644 --- a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h @@ -54,7 +54,7 @@ private: QwtLinearColorMap* myColourMap(QVector colourStops); QwtLinearColorMap* myColourMap(int log=0); - + int isLog; public: diff --git a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DHist.cxx b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DHist.cxx index 30847ff66..1bbe9bcaa 100644 --- a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DHist.cxx +++ b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DHist.cxx @@ -105,7 +105,12 @@ void SlsQt2DHist::SetMinMax(double zmin,double zmax){ if(z_min>0) z_min/=1.02; else z_min*=1.02; if(z_max>0) z_max*=1.02; else z_max/=1.02; } - setInterval( Qt::ZAxis,QwtInterval(z_min,z_max)); +#if QWT_VERSION<0x060000 + ; +#else + setInterval( Qt::ZAxis,QwtInterval(z_min,z_max)); +#endif + } double SlsQt2DHist::GetMean(){ @@ -122,8 +127,14 @@ double SlsQt2DHist::GetMean(){ double SlsQt2DHist::SetMinimumToFirstGreaterThanZero(){ z_min=abs(z_max)+1; for(int i=0;i0&&data[i]0 && data[i]setAttribute(QwtScaleEngine::Floating); axisScaleEngine(QwtPlot::xBottom)->setAttribute(QwtScaleEngine::Floating); @@ -61,12 +62,11 @@ void SlsQt2DPlot::SetupColorMap(){ colorMapLinearScale = myColourMap(0); -#if QWT_VERSION<0x060000 - d_spectrogram->setColorMap(*colorMapLinearScale); +#if QWT_VERSION<0x060000 + d_spectrogram->setColorMap(*colorMapLinearScale ); #else - d_spectrogram->setColorMap(colorMapLinearScale); + d_spectrogram->setColorMap(colorMapLinearScale ); #endif - colorMapLogScale = myColourMap(1); #if QWT_VERSION<0x060000 @@ -75,7 +75,7 @@ void SlsQt2DPlot::SetupColorMap(){ d_spectrogram->setContourLevels(*contourLevelsLinear); #else ; - // contourLevelsLinear = new QList(); + for(double level=0.5;level<10.0;level+=1.0 ) (contourLevelsLinear) += level; d_spectrogram->setContourLevels(contourLevelsLinear); #endif @@ -88,7 +88,7 @@ void SlsQt2DPlot::SetupColorMap(){ #else ; - // contourLevelsLog = new QList(); + for(double level=0.5;level<10.0;level+=1.0 ) (contourLevelsLog) += (pow(10,2*level/10.0)-1)/99.0 * 10; #endif @@ -235,15 +235,13 @@ void SlsQt2DPlot::Update(){ #if QWT_VERSION<0x060000 rightAxis->setColorMap(d_spectrogram->data().range(),d_spectrogram->colorMap()); #else + if (isLog) + hist->SetMinimumToFirstGreaterThanZero(); - // const QwtInterval zInterval = d_spectrogram->data()->interval( Qt::ZAxis ); - const QwtInterval zInterval = hist->range(); - - QVector colourStops =((QwtLinearColorMap*)d_spectrogram->colorMap())->colorStops(); - QwtLinearColorMap* copyMap = myColourMap(colourStops); - - rightAxis->setColorMap(zInterval,copyMap); + const QwtInterval zInterval = d_spectrogram->data()->interval( Qt::ZAxis ); + rightAxis->setColorMap(zInterval,myColourMap(isLog)); + #endif if(!zoomer->zoomRectIndex()) UnZoom(); @@ -257,10 +255,14 @@ void SlsQt2DPlot::Update(){ setAxisScale(QwtPlot::yRight,zInterval.minValue(), zInterval.maxValue()); + cout << "axis scale set" << endl; plotLayout()->setAlignCanvasToScales(true); + cout << "layout" << endl; #endif + cout << "going to replot" << endl; replot(); + cout << "done" << endl; } @@ -285,12 +287,13 @@ void SlsQt2DPlot::InterpolatedPlot(bool on){ void SlsQt2DPlot::LogZ(bool on){ - if(on){ + if(on){ +isLog=1; //if(hist->GetMinimum()<=0) hist->SetMinimumToFirstGreaterThanZero(); #if QWT_VERSION<0x060000 d_spectrogram->setColorMap(*colorMapLogScale); #else - d_spectrogram->setColorMap(colorMapLogScale); + d_spectrogram->setColorMap(myColorMap(isLog)); #endif setAxisScaleEngine(QwtPlot::yRight,new QwtLog10ScaleEngine); #if QWT_VERSION<0x060000 @@ -298,18 +301,25 @@ void SlsQt2DPlot::LogZ(bool on){ #else d_spectrogram->setContourLevels(contourLevelsLog); #endif - }else{ + }else{ +isLog=0; + #if QWT_VERSION<0x060000 d_spectrogram->setColorMap(*colorMapLinearScale); #else - d_spectrogram->setColorMap(colorMapLinearScale); -#endif - setAxisScaleEngine(QwtPlot::yRight,new QwtLinearScaleEngine); + d_spectrogram->setColorMap(myColorMap(isLog)); +#endif + + + + setAxisScaleEngine(QwtPlot::yRight,new QwtLinearScaleEngine); + #if QWT_VERSION<0x060000 d_spectrogram->setContourLevels(*contourLevelsLinear); #else d_spectrogram->setContourLevels(contourLevelsLinear); -#endif +#endif + } Update(); From 3759b48c6e073248862953891a01311cbb83fdf6 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 24 Oct 2012 11:35:16 +0000 Subject: [PATCH 104/332] editted QDrawPlot to include sample plot just before they do a 2d scan git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@104 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qDrawPlot.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index bd9ce2b7b..6cc238395 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -158,7 +158,7 @@ void qDrawPlot::SetupWidgetWindow(){ plot2D = new SlsQt2DPlotLayout(boxPlot); plot2D->setFont(QFont("Sans Serif",9,QFont::Normal)); - plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,startPixel,endPixel,lastImageArray); + //plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,startPixel,endPixel,lastImageArray); plot2D->setTitle(GetImageTitle()); plot2D->SetXTitle(imageXAxisTitle); plot2D->SetYTitle(imageYAxisTitle); @@ -1057,7 +1057,7 @@ void qDrawPlot::ClonePlot(){ else{ plot2D = new SlsQt2DPlotLayout(boxPlot); - plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,startPixel,endPixel,lastImageArray); + //plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,startPixel,endPixel,lastImageArray); plot2D->setFont(QFont("Sans Serif",9,QFont::Normal)); plot2D->setTitle(GetImageTitle()); plot2D->SetXTitle(imageXAxisTitle); From d083d80a2992c389d0a6cd99fffd697e25f28ef1 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 24 Oct 2012 11:47:20 +0000 Subject: [PATCH 105/332] got rid of sample plot for 2d again git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@105 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/slsDetectorGui.pro | 2 +- slsDetectorGui/src/qDrawPlot.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index c213206cb..94f764b93 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -30,7 +30,7 @@ DEPENDPATH += \ INCLUDEPATH += \ $(QWTDIR)/include\ - $(QWTDIR)/src\ +# $(QWTDIR)/src\ $(QWT3D)/include\ slsDetectorPlotting/include\ include\ diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 6cc238395..bd9ce2b7b 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -158,7 +158,7 @@ void qDrawPlot::SetupWidgetWindow(){ plot2D = new SlsQt2DPlotLayout(boxPlot); plot2D->setFont(QFont("Sans Serif",9,QFont::Normal)); - //plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,startPixel,endPixel,lastImageArray); + plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,startPixel,endPixel,lastImageArray); plot2D->setTitle(GetImageTitle()); plot2D->SetXTitle(imageXAxisTitle); plot2D->SetYTitle(imageYAxisTitle); @@ -1057,7 +1057,7 @@ void qDrawPlot::ClonePlot(){ else{ plot2D = new SlsQt2DPlotLayout(boxPlot); - //plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,startPixel,endPixel,lastImageArray); + plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,startPixel,endPixel,lastImageArray); plot2D->setFont(QFont("Sans Serif",9,QFont::Normal)); plot2D->setTitle(GetImageTitle()); plot2D->SetXTitle(imageXAxisTitle); From 80e0cd7fa1329bd0a3b3b96e6d15fab36d124bc2 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 24 Oct 2012 11:52:55 +0000 Subject: [PATCH 106/332] qwtsrc was commented out in pro file git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@106 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/slsDetectorGui.pro | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index 94f764b93..a7cdd16a4 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -30,8 +30,8 @@ DEPENDPATH += \ INCLUDEPATH += \ $(QWTDIR)/include\ -# $(QWTDIR)/src\ - $(QWT3D)/include\ + $(QWTDIR)/src\ + $(QWT3D)/include\ slsDetectorPlotting/include\ include\ forms/include\ From 716b3530e89bc049328afb16042f02ad706a172d Mon Sep 17 00:00:00 2001 From: bergamaschi Date: Thu, 25 Oct 2012 08:37:18 +0000 Subject: [PATCH 107/332] zero value in 2D plot set to BG, logZ does not crash any longer (?) git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@107 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx index 52ded83ca..22bc37466 100644 --- a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx +++ b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx @@ -195,9 +195,9 @@ double g[]={0.00, 0.81, 1.00, 0.20, 0.00}; QColor c1,c2,c; c1.setRgbF(r[0],g[0],b[0]); c2.setRgbF(r[ns-1],g[ns-1],b[ns-1]); - QwtLinearColorMap* copyMap = new QwtLinearColorMap(c1, c2); + QwtLinearColorMap* copyMap = new QwtLinearColorMap(Qt::lightGray, c2); - for (int is=1; isaddColorStop(colourStops.value(is),c ); } @@ -293,7 +293,7 @@ isLog=1; #if QWT_VERSION<0x060000 d_spectrogram->setColorMap(*colorMapLogScale); #else - d_spectrogram->setColorMap(myColorMap(isLog)); + d_spectrogram->setColorMap(myColourMap(isLog)); #endif setAxisScaleEngine(QwtPlot::yRight,new QwtLog10ScaleEngine); #if QWT_VERSION<0x060000 @@ -307,7 +307,7 @@ isLog=0; #if QWT_VERSION<0x060000 d_spectrogram->setColorMap(*colorMapLinearScale); #else - d_spectrogram->setColorMap(myColorMap(isLog)); + d_spectrogram->setColorMap(myColourMap(isLog)); #endif From ba923b55b748457a24a1eb17b76713d09074f609 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 7 Nov 2012 17:01:24 +0000 Subject: [PATCH 108/332] updated gui to work with receiver, start and stop receiver, show progress using callback git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@108 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qDefs.h | 2 +- slsDetectorGui/include/qDrawPlot.h | 4 +++ slsDetectorGui/slsDetectorGui.pro | 1 + .../slsDetectorPlotting/src/SlsQt2DPlot.cxx | 2 +- slsDetectorGui/src/qDrawPlot.cpp | 27 ++++++++++++++++--- slsDetectorGui/src/qTabMeasurement.cpp | 5 ++++ 6 files changed, 36 insertions(+), 5 deletions(-) diff --git a/slsDetectorGui/include/qDefs.h b/slsDetectorGui/include/qDefs.h index 9d55103a8..626dafe91 100644 --- a/slsDetectorGui/include/qDefs.h +++ b/slsDetectorGui/include/qDefs.h @@ -21,7 +21,7 @@ public: qDefs(){}; //------------------------------------------------------------------------------------------------------------------------------------------------- -#define GUI_VERSION 0.13 +#define GUI_VERSION 0.14 //------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index 9f13468ce..3d7e47962 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -222,6 +222,10 @@ static int GetMeasurementFinishedCallBack(int currentMeasurementIndex, int fileI * */ int MeasurementFinished(int currentMeasurementIndex, int fileIndex); +/** This is called by the detector class to send progress if receiver is online */ +static int GetProgressCallBack(double currentProgress, void *this_pointer); + + /** Saves all the plots. All sets saveError to true if not saved.*/ void SavePlotAutomatic(); /** Sets the style of the 1d plot */ diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index a7cdd16a4..20c459da6 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -37,6 +37,7 @@ INCLUDEPATH += \ forms/include\ ../slsDetectorSoftware/commonFiles\ ../slsDetectorSoftware/MySocketTCP\ + ../slsDetectorSoftware/slsReceiverInterface\ ../slsDetectorSoftware/slsDetector\ ../slsDetectorSoftware/slsDetectorAnalysis\ ../slsDetectorSoftware/multiSlsDetector\ diff --git a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx index 22bc37466..6b5a57a96 100644 --- a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx +++ b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx @@ -193,7 +193,7 @@ double g[]={0.00, 0.81, 1.00, 0.20, 0.00}; double b[] = { 0.51, 1.00, 0.12, 0.00, 0.00 }; QColor c1,c2,c; - c1.setRgbF(r[0],g[0],b[0]); + c1.setRgbF(r[0],g[0],b[0],0); c2.setRgbF(r[ns-1],g[ns-1],b[ns-1]); QwtLinearColorMap* copyMap = new QwtLinearColorMap(Qt::lightGray, c2); diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index bd9ce2b7b..0bd923ddb 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -194,7 +194,8 @@ void qDrawPlot::SetupWidgetWindow(){ myDet->registerAcquisitionFinishedCallback(&(GetAcquisitionFinishedCallBack),this); //Setting the callback function to alert when each measurement finished from detector class myDet->registerMeasurementFinishedCallback(&(GetMeasurementFinishedCallBack),this); - + //Setting the callback function to get progress from detector class(using receivers) + myDet->registerProgressCallback(&(GetProgressCallBack),this); } @@ -511,9 +512,20 @@ void qDrawPlot::SetupMeasurement(int currentIndex){ void* qDrawPlot::DataStartAcquireThread(void *this_pointer){ - cout << "before acquire ...." << endl; + bool receiver=(((qDrawPlot*)this_pointer)->myDet->setReceiverOnline()==slsDetectorDefs::ONLINE_FLAG); + if(receiver){ + if(((qDrawPlot*)this_pointer)->myDet->startReceiver()==slsDetectorDefs::OK) + usleep(2000000); + else{ + qDefs::Message(qDefs::CRITICAL,"could not start receiver","Plot"); + return this_pointer; + } + } ((qDrawPlot*)this_pointer)->myDet->acquire(1); - cout << "after acquire ...." << endl; + if(receiver){ + usleep(0); + ((qDrawPlot*)this_pointer)->myDet->stopReceiver(); + } return this_pointer; } @@ -813,6 +825,15 @@ int qDrawPlot::AcquisitionFinished(double currentProgress, int detectorStatus){ //------------------------------------------------------------------------------------------------------------------------------------------------- +int qDrawPlot::GetProgressCallBack(double currentProgress, void *this_pointer){ + ((qDrawPlot*)this_pointer)->progress= currentProgress; + return 0; +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + void qDrawPlot::ShowAcquisitionErrorMessage(QString status){ if(!alreadyDisplayed){ alreadyDisplayed = true; diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index cf295660e..7301f2aeb 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -318,6 +318,11 @@ void qTabMeasurement::startStopAcquisition(){ btnStartStop->setIcon(*iconStart); btnStartStop->setChecked(false); Enable(1); + + if(myDet->setReceiverOnline()==slsDetectorDefs::ONLINE_FLAG){ + usleep(0); + myDet->stopReceiver(); + } } } From 854015532e3682257157321b31c3c83dcf572b66 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Mon, 12 Nov 2012 15:47:55 +0000 Subject: [PATCH 109/332] gotthard works with receiver without tcp lock git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@109 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qDetectorMain.cpp | 1 + slsDetectorGui/src/qDrawPlot.cpp | 26 +++++++------------------- slsDetectorGui/src/qTabMeasurement.cpp | 5 ----- 3 files changed, 8 insertions(+), 24 deletions(-) diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 676362488..25e459bd8 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -646,6 +646,7 @@ void qDetectorMain::EnableTabs(){ actionLoadCalibration->setVisible(expertTab); actionSaveCalibration->setVisible(expertTab); + //moved to here, so that its all in order, instead of signals and different threads if(!enable) { //set the plot type first(acccss shared memory) diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 0bd923ddb..3fe48be05 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -221,9 +221,9 @@ void qDrawPlot::Initialization(){ void qDrawPlot::StartStopDaqToggle(bool stop_if_running){ -#ifdef VERYVERBOSE +//#ifdef VERYVERBOSE cout << "Entering StartStopDaqToggle(" << stop_if_running << ")" <myDet->setReceiverOnline()==slsDetectorDefs::ONLINE_FLAG); - if(receiver){ - if(((qDrawPlot*)this_pointer)->myDet->startReceiver()==slsDetectorDefs::OK) - usleep(2000000); - else{ - qDefs::Message(qDefs::CRITICAL,"could not start receiver","Plot"); - return this_pointer; - } - } ((qDrawPlot*)this_pointer)->myDet->acquire(1); - if(receiver){ - usleep(0); - ((qDrawPlot*)this_pointer)->myDet->stopReceiver(); - } + return this_pointer; } @@ -791,9 +779,9 @@ int qDrawPlot::GetAcquisitionFinishedCallBack(double currentProgress,int detecto int qDrawPlot::AcquisitionFinished(double currentProgress, int detectorStatus){ -#ifdef VERBOSE +//#ifdef VERBOSE cout << "\nEntering Acquisition Finished with status " ; -#endif +//#endif QString status = QString(slsDetectorBase::runStatusType(slsDetectorDefs::runStatus(detectorStatus)).c_str()); #ifdef VERBOSE cout << status.toAscii().constData() << " and progress " << currentProgress << endl; @@ -857,9 +845,9 @@ int qDrawPlot::GetMeasurementFinishedCallBack(int currentMeasurementIndex, int f int qDrawPlot::MeasurementFinished(int currentMeasurementIndex, int fileIndex){ -#ifdef VERBOSE +//#ifdef VERBOSE cout << "Entering Measurement Finished with currentMeasurement " << currentMeasurementIndex << " and fileIndex " << fileIndex << endl; -#endif +//#endif //to make sure it plots the last frame before setting lastimagearray all to 0 //if(plot_in_scope==2) usleep(500000); diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 7301f2aeb..cf295660e 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -318,11 +318,6 @@ void qTabMeasurement::startStopAcquisition(){ btnStartStop->setIcon(*iconStart); btnStartStop->setChecked(false); Enable(1); - - if(myDet->setReceiverOnline()==slsDetectorDefs::ONLINE_FLAG){ - usleep(0); - myDet->stopReceiver(); - } } } From 6e529f1c0678a96cedec37902c42433bb8a54141 Mon Sep 17 00:00:00 2001 From: bergamaschi Date: Wed, 14 Nov 2012 11:37:40 +0000 Subject: [PATCH 110/332] warings suppressed (directly with flag in .pro) git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@110 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/Makefile | 3 ++- slsDetectorGui/slsDetectorGui.pro | 16 ++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/slsDetectorGui/Makefile b/slsDetectorGui/Makefile index e7b2ca5e7..ba731307c 100644 --- a/slsDetectorGui/Makefile +++ b/slsDetectorGui/Makefile @@ -6,7 +6,8 @@ all: $(PROG) clean: - if test -e Makefile.gui; then make -f Makefile.gui clean; make -f Makefile.gui mocclean; fi + if test -e Makefile.gui; then make -f Makefile.gui clean; make -f Makefile.gui mocclean; rm Makefile.gui; else make Makefile.gui; make -f Makefile.gui clean; make -f Makefile.gui mocclean; fi + Makefile.gui: slsDetectorGui.pro diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index 20c459da6..1119523c7 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -5,7 +5,9 @@ UI_HEADERS_DIR = forms/include RESOURCES += icons.qrc - +CONFIG+=debug +QMAKE_CXXFLAGS_WARN_ON = -w +QMAKE_CFLAGS_WARN_ON = -w DEFINES += VERBOSE DACS_INT #VERYVERBOSE @@ -15,11 +17,10 @@ documentation.files = docs/* INSTALLS += target INSTALLS += documentation QMAKE_CLEAN += docs/*/* \ - $(DESTDIR)* \ - forms/include/* + $(DESTDIR)* -LIBS += -Wl,-Bstatic -L../slsDetectorSoftware -lSlsDetector -Wl,-Bdynamic\ +LIBS += -Wl,-Bstatic -L../slsDetectorSoftware -lSlsDetector -Wl,-Bdynamic\ -L$(QWTDIR)/lib -lqwt -L$(QWT3D)/lib DEPENDPATH += \ @@ -28,10 +29,13 @@ DEPENDPATH += \ forms/include + INCLUDEPATH += \ + $(shell echo "/lib/modules/`uname -r`/build/include") \ $(QWTDIR)/include\ - $(QWTDIR)/src\ - $(QWT3D)/include\ + $(QWTDIR) \ + $(QWTDIR)/src\ + $(QWT3D)/include\ slsDetectorPlotting/include\ include\ forms/include\ From 7a6bba3c77e4ec3c7f99d1034541d537b896d1b4 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 14 Nov 2012 13:39:04 +0000 Subject: [PATCH 111/332] fixed the problem with multiple frame scan, frame index and file index included in gui git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@111 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_measurement.ui | 6 +- slsDetectorGui/include/qDrawPlot.h | 11 ++-- .../slsDetectorPlotting/src/SlsQt2DPlot.cxx | 4 ++ slsDetectorGui/src/qCloneWidget.cpp | 3 + slsDetectorGui/src/qDrawPlot.cpp | 57 +++++++++++-------- slsDetectorGui/src/qTabMeasurement.cpp | 34 ++++++----- 6 files changed, 67 insertions(+), 48 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_measurement.ui b/slsDetectorGui/forms/form_tab_measurement.ui index f30ef53c5..45f5ba28c 100644 --- a/slsDetectorGui/forms/form_tab_measurement.ui +++ b/slsDetectorGui/forms/form_tab_measurement.ui @@ -75,13 +75,13 @@ - Current Index: + Current Frame: - 100 + 101 25 101 16 @@ -912,7 +912,7 @@ Frame period between exposures. - Start Run Index: + Run Index: diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index 3d7e47962..99b3102b1 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -52,6 +52,8 @@ public: int GetProgress(){return progress;}; /** gets the file index to the measurement tab*/ int GetFileIndex(){return currentFileIndex;}; + /** gets the frame index to the measurement tab*/ + int GetFrameIndex(){return currentFrameIndex;}; /** sets file write enable , if not enabled, * file index wont increase and so you need secondary titles to differentitate between plots*/ void SetEnableFileWrite(bool enable){fileSaveEnable = enable;}; @@ -180,9 +182,8 @@ int StopDaqForGui() {return StartOrStopThread(0) ? 0:1;} bool StartOrStopThread(bool start); /** Sets up measurement each time - * @param currentIndex file index given by detector class * */ -void SetupMeasurement(int currentIndex); +void SetupMeasurement(); /** Resets the acquisition parameter like lastimagenumber */ int ResetDaqForGui(); @@ -321,10 +322,10 @@ int number_of_frames; double acquisitionPeriod; /** Acquisition Time */ double exposureTime; -/** Current index*/ +/** Current file index*/ int currentFileIndex; - - +/** Current frame index*/ +int currentFrameIndex; /**variables for threads */ /** */ diff --git a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx index 6b5a57a96..3eebbd4a7 100644 --- a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx +++ b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx @@ -260,9 +260,13 @@ void SlsQt2DPlot::Update(){ plotLayout()->setAlignCanvasToScales(true); cout << "layout" << endl; #endif +#ifdef VERYVERBOSE cout << "going to replot" << endl; +#endif replot(); +#ifdef VERYVERBOSE cout << "done" << endl; +#endif } diff --git a/slsDetectorGui/src/qCloneWidget.cpp b/slsDetectorGui/src/qCloneWidget.cpp index b64c8754b..afe3905a8 100644 --- a/slsDetectorGui/src/qCloneWidget.cpp +++ b/slsDetectorGui/src/qCloneWidget.cpp @@ -223,6 +223,7 @@ void qCloneWidget::SavePlot(){ if(cloneBox->title().contains('.')){ fName.append(QString('/')+cloneBox->title()); fName.replace(".dat",".png"); + fName.replace(".raw",".png"); }else fName.append(QString("/Snapshot_unknown_title.png")); //save QImage img(cloneBox->size().width(),cloneBox->size().height(),QImage::Format_RGB32); @@ -250,7 +251,9 @@ int qCloneWidget::SavePlotAutomatic(){ if(cloneBox->title().contains('.')){ fName.append(QString('/')+cloneBox->title()); fName.replace(".dat",".png"); + fName.replace(".raw",".png"); }else fName.append(QString("/Snapshot_unknown_title.png")); + cout<<"fname:"<size().width(),cloneBox->size().height(),QImage::Format_RGB32); QPainter painter(&img); diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 3fe48be05..de541d503 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -107,6 +107,7 @@ void qDrawPlot::SetupWidgetWindow(){ backwardScanPlot = false; currentFileIndex = 0; + currentFrameIndex = 0; // This is so that it initially stop and plots running = 1; for(int i=0;igetFileName().c_str()); //update index currentFileIndex = myDet->getFileIndex(); + currentFrameIndex = 0; @@ -344,7 +347,7 @@ bool qDrawPlot::StartOrStopThread(bool start){ if(start){ progress = 0; //sets up the measurement parameters - SetupMeasurement(myDet->getFileIndex()); + SetupMeasurement(); cout << "Starting new acquisition threadddd ...." << endl; // Start acquiring data from server @@ -435,7 +438,7 @@ void qDrawPlot::SetScanArgument(int scanArg){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void qDrawPlot::SetupMeasurement(int currentIndex){ +void qDrawPlot::SetupMeasurement(){ #ifdef VERBOSE cout << "SetupMeasurement function:" << running << endl; #endif @@ -468,13 +471,13 @@ void qDrawPlot::SetupMeasurement(int currentIndex){ } else {//all frames if(scanArgument==AllFrames){ - maxPixelsY = currentIndex + number_of_exposures - 1; - minPixelsY = currentIndex; + maxPixelsY = number_of_exposures - 1; + minPixelsY = 0; if(!running) nPixelsY = number_of_exposures; }//file index else if(scanArgument==FileIndex){ - maxPixelsY = currentIndex + number_of_frames - 1; - minPixelsY = currentIndex; + maxPixelsY = number_of_frames - 1; + minPixelsY = 0; if(!running) nPixelsY = number_of_frames; }//level0 or level1 else { @@ -538,7 +541,8 @@ int qDrawPlot::GetData(detectorData *data){ //set progress progress=(int)data->progressIndex; - currentFileIndex = fileIOStatic::getFileIndexFromFileName(string(data->fileName)); + currentFrameIndex = fileIOStatic::getIndicesFromFileName(string(data->fileName),currentFileIndex); + #ifdef VERYVERBOSE cout << "progress:" << progress << endl; #endif @@ -547,10 +551,10 @@ int qDrawPlot::GetData(detectorData *data){ if(!plotEnable) return 0; // secondary title necessary to differentiate between frames when not saving data - char temp_title[2000]; + /*char temp_title[2000]; if(fileSaveEnable) strcpy(temp_title,""); else sprintf(temp_title,"#%d",currentFrame); - + */ //angle plotting if(anglePlot){ @@ -559,7 +563,7 @@ int qDrawPlot::GetData(detectorData *data){ //set title plotTitle=QString(plotTitle_prefix)+QString(data->fileName).section('/',-1); // Title - histTitle[0] = temp_title; + /*histTitle[0] = temp_title;*/ if(data->angles==NULL){ cout<<"\n\nWARNING:RETURNED NULL instead of angles."<values,nPixelsX*sizeof(double)); pthread_mutex_unlock(&(last_image_complete_mutex)); @@ -651,10 +655,10 @@ int qDrawPlot::GetData(detectorData *data){ //set title plotTitle=QString(plotTitle_prefix)+QString(data->fileName).section('/',-1); //variables - if(currentFileIndex == minPixelsY) currentScanDivLevel = 0; + if(currentFrameIndex == 0) currentScanDivLevel = 0; lastImageNumber= currentFrame+1; //title - imageTitle = temp_title; + /*imageTitle = temp_title;*/ //copy data for(unsigned int px=0;pxvalues[px]; pthread_mutex_unlock(&(last_image_complete_mutex)); @@ -672,8 +676,8 @@ int qDrawPlot::GetData(detectorData *data){ //set title plotTitle=QString(plotTitle_prefix)+QString(data->fileName).section('/',-1); //get scanvariable0 - int ci = 0, p = 0; double cs0 = 0 , cs1 = 0; - fileIOStatic::getVariablesFromFileName(string(data->fileName), ci, p, cs0, cs1); + int ci = 0, fi = 0, p = 0, di = 0; double cs0 = 0 , cs1 = 0; + fileIOStatic::getVariablesFromFileName(string(data->fileName), ci, fi, p, cs0, cs1, di); //variables if(cs0!=currentScanValue) { if(backwardScanPlot) currentScanDivLevel--; @@ -682,7 +686,7 @@ int qDrawPlot::GetData(detectorData *data){ currentScanValue = cs0; lastImageNumber= currentFrame+1; //title - imageTitle = temp_title; + /*imageTitle = temp_title;*/ //copy data for(unsigned int px=0;pxvalues[px]; pthread_mutex_unlock(&(last_image_complete_mutex)); @@ -698,8 +702,8 @@ int qDrawPlot::GetData(detectorData *data){ //set title plotTitle=QString(plotTitle_prefix)+QString(data->fileName).section('/',-1); //get scanvariable1 - int ci = 0, p = 0; double cs0 = 0 , cs1 = 0; - fileIOStatic::getVariablesFromFileName(string(data->fileName), ci, p, cs0, cs1); + int ci = 0, fi = 0, p = 0, di = 0; double cs0 = 0 , cs1 = 0; + fileIOStatic::getVariablesFromFileName(string(data->fileName), ci, fi, p, cs0, cs1, di); //variables if(cs1!=currentScanValue){ if(backwardScanPlot) currentScanDivLevel--; @@ -708,7 +712,7 @@ int qDrawPlot::GetData(detectorData *data){ currentScanValue = cs1; lastImageNumber= currentFrame+1; //title - imageTitle = temp_title; + /*imageTitle = temp_title;*/ //copy data for(unsigned int px=0;pxvalues[px]; pthread_mutex_unlock(&(last_image_complete_mutex)); @@ -730,7 +734,7 @@ int qDrawPlot::GetData(detectorData *data){ //1d if(plot_in_scope==1){ // Titles - histTitle[0] = temp_title; + /*histTitle[0] = temp_title;*/ // Persistency if(currentPersistency < persistency)currentPersistency++; else currentPersistency=persistency; @@ -744,7 +748,7 @@ int qDrawPlot::GetData(detectorData *data){ //2d else{cout<title().contains('.')){ fName.append(QString('/')+boxPlot->title()); fName.replace(".dat",".png"); + fName.replace(".raw",".png"); }else fName.append(QString("/Image.png")); fName = QFileDialog::getSaveFileName(0,tr("Save Image"),fName,tr("PNG Files (*.png);;XPM Files(*.xpm);;JPEG Files(*.jpg)"),0,QFileDialog::ShowDirsOnly); @@ -1188,6 +1194,7 @@ void qDrawPlot::SavePlotAutomatic(){ if(boxPlot->title().contains('.')){ fName.append(QString('/')+boxPlot->title()); fName.replace(".dat",".png"); + fName.replace(".raw",".png"); }else fName.append(QString("/Image_unknown_title.png")); //save QImage img(size().width(),size().height(),QImage::Format_RGB32); diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index cf295660e..8c11e4f9e 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -72,7 +72,7 @@ void qTabMeasurement::SetupWidgetWindow(){ //File Index spinIndex->setValue(myDet->getFileIndex()); //only initially - lblProgressIndex->setText(QString::number(myDet->getFileIndex())); + lblProgressIndex->setText(QString::number(0)); //ly initially progressBar->setValue(0); @@ -279,7 +279,6 @@ void qTabMeasurement::setFileName(const QString& fName){ void qTabMeasurement::setRunIndex(int index){ myDet->setFileIndex(index); - lblProgressIndex->setText(QString::number(index)); #ifdef VERBOSE cout << "Setting File Index to " << myDet->getFileIndex() << endl; #endif @@ -296,6 +295,7 @@ void qTabMeasurement::startStopAcquisition(){ //btnStartStop->setStyleSheet("color:red"); btnStartStop->setText("Stop"); btnStartStop->setIcon(*iconStop); + lblProgressIndex->setText(QString::number(0)); Enable(0); progressBar->setValue(0); progressTimer->start(100); @@ -307,12 +307,13 @@ void qTabMeasurement::startStopAcquisition(){ #endif emit StopSignal(); myDet->stopAcquisition(); - progressTimer->stop(); + + UpdateProgress(); //spin index disconnect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int))); spinIndex->setValue(myDet->getFileIndex()); - lblProgressIndex->setText(QString::number(spinIndex->value())); connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int))); + progressTimer->stop(); btnStartStop->setText("Start"); btnStartStop->setIcon(*iconStart); @@ -327,6 +328,13 @@ void qTabMeasurement::startStopAcquisition(){ void qTabMeasurement::UpdateFinished(){ if(btnStartStop->isChecked()){ + + UpdateProgress(); + disconnect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int))); + spinIndex->setValue(myDet->getFileIndex()); + connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int))); + progressTimer->stop(); + disconnect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); btnStartStop->setText("Start"); btnStartStop->setIcon(*iconStart); @@ -334,14 +342,7 @@ void qTabMeasurement::UpdateFinished(){ Enable(1); connect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); - UpdateProgress(); - //spin index - disconnect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int))); - spinIndex->setValue(myDet->getFileIndex()); - lblProgressIndex->setText(QString::number(spinIndex->value())); - connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int))); - progressTimer->stop(); } } @@ -351,7 +352,7 @@ void qTabMeasurement::UpdateFinished(){ void qTabMeasurement::SetCurrentMeasurement(int val){ if((val)value()) - lblCurrentMeasurement->setText(QString::number(val+1)); + lblCurrentMeasurement->setText(QString::number(val)); } @@ -361,7 +362,7 @@ void qTabMeasurement::SetCurrentMeasurement(int val){ void qTabMeasurement::UpdateProgress(){ progressBar->setValue((int)myPlot->GetProgress()); - lblProgressIndex->setText(QString::number(myPlot->GetFileIndex())); + lblProgressIndex->setText(QString::number(myPlot->GetFrameIndex())); } @@ -749,10 +750,13 @@ void qTabMeasurement::Refresh(){ #ifdef VERBOSE cout << "Getting file index" << endl; #endif - spinIndex->setValue(myDet->getFileIndex());cout<<"file index:"<getFileIndex()<setValue(myDet->getFileIndex()); //progress label index - lblProgressIndex->setText(QString::number(myDet->getFileIndex())); + if(myDet->getFrameIndex()==-1) + lblProgressIndex->setText("0"); + else + lblProgressIndex->setText(QString::number(myDet->getFrameIndex())); //Timing mode SetupTimingMode(); From f201a6a32b313567f4647966d6a6c9c1fb22fe26 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Thu, 15 Nov 2012 11:18:56 +0000 Subject: [PATCH 112/332] for receiver, display frame number since not in filename git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@112 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qDrawPlot.h | 7 ++++-- slsDetectorGui/src/qDrawPlot.cpp | 39 +++++++++++++++++++----------- 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index 99b3102b1..f53cfdf99 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -192,10 +192,10 @@ int ResetDaqForGui(); static void* DataStartAcquireThread(void *this_pointer); /** This is called by the detector class to copy the data it jus acquired */ -static int GetDataCallBack(detectorData *data, void *this_pointer); +static int GetDataCallBack(detectorData *data, int fIndex, void *this_pointer); /** This is called by the GetDataCallBack function to copy the data */ -int GetData(detectorData *data); +int GetData(detectorData *data, int fIndex); /** This is called by detector class when acquisition is finished * @param currentProgress current progress of measurement @@ -463,6 +463,9 @@ bool backwardScanPlot; /**if files will be saved and index increased*/ bool fileSaveEnable; +/** true if receiver online*/ +bool receiver; + signals: void UpdatingPlotFinished(); void InterpolateSignal(bool); diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index de541d503..9f4d386a0 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -108,6 +108,8 @@ void qDrawPlot::SetupWidgetWindow(){ currentFileIndex = 0; currentFrameIndex = 0; + + receiver=false; // This is so that it initially stop and plots running = 1; for(int i=0;isetReceiverOnline()==slsDetectorDefs::ONLINE_FLAG) + receiver=true; + cout << "Starting new acquisition threadddd ...." << endl; // Start acquiring data from server if(!firstTime) pthread_join(gui_acquisition_thread,NULL);//wait until he's finished, ie. exits @@ -524,8 +529,8 @@ void* qDrawPlot::DataStartAcquireThread(void *this_pointer){ //------------------------------------------------------------------------------------------------------------------------------------------------- -int qDrawPlot::GetDataCallBack(detectorData *data, void *this_pointer){ - ((qDrawPlot*)this_pointer)->GetData(data); +int qDrawPlot::GetDataCallBack(detectorData *data, int fIndex, void *this_pointer){ + ((qDrawPlot*)this_pointer)->GetData(data,fIndex); return 0; } @@ -533,7 +538,7 @@ int qDrawPlot::GetDataCallBack(detectorData *data, void *this_pointer){ //------------------------------------------------------------------------------------------------------------------------------------------------- -int qDrawPlot::GetData(detectorData *data){ +int qDrawPlot::GetData(detectorData *data,int fIndex){ #ifdef VERYVERBOSE cout << "******Entering GetDatafunction********" << endl; #endif @@ -551,10 +556,16 @@ int qDrawPlot::GetData(detectorData *data){ if(!plotEnable) return 0; // secondary title necessary to differentiate between frames when not saving data - /*char temp_title[2000]; - if(fileSaveEnable) strcpy(temp_title,""); - else sprintf(temp_title,"#%d",currentFrame); - */ + char temp_title[2000]; + if(receiver){ + //findex is used because in the receiver, you cannot know the frame index as many frames are in 1 file. + if(fIndex==-1) fIndex=currentFrame; + sprintf(temp_title,"#%d",fIndex); + }else{ + if(fileSaveEnable) strcpy(temp_title,""); + else sprintf(temp_title,"#%d",currentFrame); + } + //angle plotting if(anglePlot){ @@ -563,7 +574,7 @@ int qDrawPlot::GetData(detectorData *data){ //set title plotTitle=QString(plotTitle_prefix)+QString(data->fileName).section('/',-1); // Title - /*histTitle[0] = temp_title;*/ + histTitle[0] = temp_title; if(data->angles==NULL){ cout<<"\n\nWARNING:RETURNED NULL instead of angles."<values,nPixelsX*sizeof(double)); pthread_mutex_unlock(&(last_image_complete_mutex)); @@ -658,7 +669,7 @@ int qDrawPlot::GetData(detectorData *data){ if(currentFrameIndex == 0) currentScanDivLevel = 0; lastImageNumber= currentFrame+1; //title - /*imageTitle = temp_title;*/ + imageTitle = temp_title; //copy data for(unsigned int px=0;pxvalues[px]; pthread_mutex_unlock(&(last_image_complete_mutex)); @@ -686,7 +697,7 @@ int qDrawPlot::GetData(detectorData *data){ currentScanValue = cs0; lastImageNumber= currentFrame+1; //title - /*imageTitle = temp_title;*/ + imageTitle = temp_title; //copy data for(unsigned int px=0;pxvalues[px]; pthread_mutex_unlock(&(last_image_complete_mutex)); @@ -712,7 +723,7 @@ int qDrawPlot::GetData(detectorData *data){ currentScanValue = cs1; lastImageNumber= currentFrame+1; //title - /*imageTitle = temp_title;*/ + imageTitle = temp_title; //copy data for(unsigned int px=0;pxvalues[px]; pthread_mutex_unlock(&(last_image_complete_mutex)); @@ -734,7 +745,7 @@ int qDrawPlot::GetData(detectorData *data){ //1d if(plot_in_scope==1){ // Titles - /*histTitle[0] = temp_title;*/ + histTitle[0] = temp_title; // Persistency if(currentPersistency < persistency)currentPersistency++; else currentPersistency=persistency; @@ -748,7 +759,7 @@ int qDrawPlot::GetData(detectorData *data){ //2d else{cout< Date: Thu, 15 Nov 2012 13:53:08 +0000 Subject: [PATCH 113/332] fixed filedir for gotthard receiver problem git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@113 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_plot.ui | 10 ++++---- slsDetectorGui/include/qDrawPlot.h | 2 -- slsDetectorGui/slsDetectorGui.pro | 16 +++++++----- slsDetectorGui/src/qDrawPlot.cpp | 17 +++++------- slsDetectorGui/src/qTabDataOutput.cpp | 37 ++++++++++++++++++++++++++- slsDetectorGui/src/qTabPlot.cpp | 4 +-- 6 files changed, 59 insertions(+), 27 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index 0c905f491..f0d754300 100644 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -593,7 +593,7 @@ 10 20 - 337 + 341 26 @@ -627,7 +627,7 @@ - 11 + 9 10 @@ -656,7 +656,7 @@ - 11 + 9 10 @@ -671,7 +671,7 @@ - File Index + Frame Index
@@ -685,7 +685,7 @@ - 11 + 9 10 diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index f53cfdf99..0ab31038d 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -463,8 +463,6 @@ bool backwardScanPlot; /**if files will be saved and index increased*/ bool fileSaveEnable; -/** true if receiver online*/ -bool receiver; signals: void UpdatingPlotFinished(); diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index 1119523c7..ac0af2ac1 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -5,9 +5,11 @@ UI_HEADERS_DIR = forms/include RESOURCES += icons.qrc -CONFIG+=debug -QMAKE_CXXFLAGS_WARN_ON = -w -QMAKE_CFLAGS_WARN_ON = -w +CONFIG += debug + +QMAKE_CXXFLAGS_WARN_ON = -w +QMAKE_CFLAGS_WARN_ON = -w + DEFINES += VERBOSE DACS_INT #VERYVERBOSE @@ -20,7 +22,7 @@ QMAKE_CLEAN += docs/*/* \ $(DESTDIR)* -LIBS += -Wl,-Bstatic -L../slsDetectorSoftware -lSlsDetector -Wl,-Bdynamic\ +LIBS += -Wl,-Bstatic -L../slsDetectorSoftware -lSlsDetector -Wl,-Bdynamic\ -L$(QWTDIR)/lib -lqwt -L$(QWT3D)/lib DEPENDPATH += \ @@ -31,11 +33,11 @@ DEPENDPATH += \ INCLUDEPATH += \ - $(shell echo "/lib/modules/`uname -r`/build/include") \ + $(shell echo "/lib/modules/`uname -r`/build/include") \ $(QWTDIR)/include\ $(QWTDIR) \ - $(QWTDIR)/src\ - $(QWT3D)/include\ + $(QWTDIR)/src\ + $(QWT3D)/include\ slsDetectorPlotting/include\ include\ forms/include\ diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 9f4d386a0..1cab23125 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -109,7 +109,6 @@ void qDrawPlot::SetupWidgetWindow(){ currentFileIndex = 0; currentFrameIndex = 0; - receiver=false; // This is so that it initially stop and plots running = 1; for(int i=0;isetReceiverOnline()==slsDetectorDefs::ONLINE_FLAG) - receiver=true; cout << "Starting new acquisition threadddd ...." << endl; // Start acquiring data from server @@ -547,19 +544,15 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){ //set progress progress=(int)data->progressIndex; currentFrameIndex = fileIOStatic::getIndicesFromFileName(string(data->fileName),currentFileIndex); - #ifdef VERYVERBOSE cout << "progress:" << progress << endl; #endif - //Plot Disabled - if(!plotEnable) return 0; - // secondary title necessary to differentiate between frames when not saving data char temp_title[2000]; - if(receiver){ - //findex is used because in the receiver, you cannot know the frame index as many frames are in 1 file. - if(fIndex==-1) fIndex=currentFrame; + //findex is used because in the receiver, you cannot know the frame index as many frames are in 1 file. + if(fIndex!=-1){ + currentFrameIndex=fIndex; sprintf(temp_title,"#%d",fIndex); }else{ if(fileSaveEnable) strcpy(temp_title,""); @@ -567,6 +560,10 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){ } + //Plot Disabled + if(!plotEnable) return 0; + + //angle plotting if(anglePlot){ while(1){ diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index 50d841b93..a58ba931e 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -143,11 +143,40 @@ void qTabDataOutput::setOutputDir(){ QString path = dispOutputDir->text(); + string oldPath = myDet->getFilePath(); + bool error=false; + //gets rid of the end '/'s while(path.endsWith('/')) path.chop(1); dispOutputDir->setText(path); - if(QFile::exists(path)){ + if(myDet->setReceiverOnline()==slsDetectorDefs::ONLINE_FLAG){ + for(int i=0;igetNumberOfDetectors();i++){ + slsDetector *det = myDet->getSlsDetector(i); + det->setFilePath(string(path.toAscii().constData())); + if(det->getFilePath()!=(string(path.toAscii().constData()))){ + error=true; + break; + } + } + if(error){ + //set it back for the ones which got set + for(int i=0;igetNumberOfDetectors();i++){ + slsDetector *det = myDet->getSlsDetector(i); + det->setFilePath(oldPath); + } + }//set it in multi as well if it worked so that they reflect the same + else + myDet->setFilePath(string(path.toAscii().constData())); + } + else { + myDet->setFilePath(string(path.toAscii().constData())); + if(myDet->getFilePath()!=(string(path.toAscii().constData()))) + error=true; + } + + if(!error){ + //if(QFile::exists(path)){ lblOutputDir->setText("Output Directory: "); lblOutputDir->setPalette(chkRate->palette()); lblOutputDir->setToolTip(outDirTip); @@ -512,6 +541,12 @@ void qTabDataOutput::Refresh(){ if(myDet->getBadChannelCorrection()) chkDiscardBad->setChecked(true); + if(myDet->setReceiverOnline()==slsDetectorDefs::ONLINE_FLAG) + btnOutputBrowse->setEnabled(false); + else + btnOutputBrowse->setEnabled(true); + + #ifdef VERBOSE cout << "**Updated DataOutput Tab" << endl << endl; #endif diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index 3c3737aaa..aa110685d 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -767,8 +767,8 @@ void qTabPlot::SetScanArgument(){ break; break; case 2://file index - dispYAxis->setText("File Index"); - myPlot->SetImageYAxisTitle("File Index"); + dispYAxis->setText("Frame Index"); + myPlot->SetImageYAxisTitle("Frame Index"); break; case 3://all frames dispYAxis->setText("All Frames"); From 29a9678d3bd076047c8c3ee6fa70c0f1dbcf7caf Mon Sep 17 00:00:00 2001 From: bergamaschi Date: Wed, 21 Nov 2012 09:01:33 +0000 Subject: [PATCH 114/332] makefile changed git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@114 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/Makefile | 21 +++++++++++++----- slsDetectorGui/slsDetectorGui.pro | 37 ++++++++++++++++++------------- 2 files changed, 37 insertions(+), 21 deletions(-) diff --git a/slsDetectorGui/Makefile b/slsDetectorGui/Makefile index ba731307c..d8480b08b 100644 --- a/slsDetectorGui/Makefile +++ b/slsDetectorGui/Makefile @@ -1,18 +1,29 @@ -PROG= bin/slsDetectorGui + +PROG= $(DESTDIR)/slsDetectorGui DIR= $(shell ls src/* slsDetectorPlotting/include/* slsDetectorPlotting/src/* include/* forms/include/*) +DESTDIR?=bin +DOCDIR?=docs +LIBDIR?=../slsDetectorSoftware -all: $(PROG) - +all: $(PROG) Makefile.gui clean: if test -e Makefile.gui; then make -f Makefile.gui clean; make -f Makefile.gui mocclean; rm Makefile.gui; else make Makefile.gui; make -f Makefile.gui clean; make -f Makefile.gui mocclean; fi + cd manual && make clean Makefile.gui: slsDetectorGui.pro - qmake -o Makefile.gui + qmake -o Makefile.gui INCLUDES='$(INCLUDES)' DESTDIR=$(DESTDIR) + +doc: + cd manual && make DESTDIR=$(DOCDIR) + +htmldoc: + cd manual && make html DESTDIR=$(DOCDIR) $(PROG): Makefile.gui $(DIR) - make -f Makefile.gui + echo $(LDFLAG) + make -f Makefile.gui SLSDETLIB=$(LIBDIR) DESTDIR=$(DESTDIR) SUBLIBS='$(LDFLAG)' INCLUDES='$(INCLUDES)' diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index ac0af2ac1..f66c3aa54 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -1,8 +1,10 @@ -DESTDIR = bin + + +DESTDIR ?= bin MOC_DIR = mocs OBJECTS_DIR = objs UI_HEADERS_DIR = forms/include - +SLSDETLIB ?=../slsDetectorSoftware RESOURCES += icons.qrc CONFIG += debug @@ -18,12 +20,13 @@ documentation.path = /$(DOCPATH) documentation.files = docs/* INSTALLS += target INSTALLS += documentation -QMAKE_CLEAN += docs/*/* \ - $(DESTDIR)* +QMAKE_CLEAN += docs/*/* -LIBS += -Wl,-Bstatic -L../slsDetectorSoftware -lSlsDetector -Wl,-Bdynamic\ - -L$(QWTDIR)/lib -lqwt -L$(QWT3D)/lib +#LIBS += -Wl,-Bstatic -L../slsDetectorSoftware -lSlsDetector -Wl,-Bdynamic\ +# -L$(QWTDIR)/lib -lqwt -L$(QWT3D)/lib + +LIBS += -L$(QWTDIR)/lib -lqwt -L$(QWT3D)/lib DEPENDPATH += \ slsDetectorPlotting/include\ @@ -33,21 +36,23 @@ DEPENDPATH += \ INCLUDEPATH += \ - $(shell echo "/lib/modules/`uname -r`/build/include") \ $(QWTDIR)/include\ $(QWTDIR) \ - $(QWTDIR)/src\ - $(QWT3D)/include\ + $(QWTDIR)/src\ + $(QWT3D)/include\ slsDetectorPlotting/include\ include\ forms/include\ - ../slsDetectorSoftware/commonFiles\ - ../slsDetectorSoftware/MySocketTCP\ - ../slsDetectorSoftware/slsReceiverInterface\ - ../slsDetectorSoftware/slsDetector\ - ../slsDetectorSoftware/slsDetectorAnalysis\ - ../slsDetectorSoftware/multiSlsDetector\ - ../slsDetectorSoftware/usersFunctions + $(INCLUDES) + +# $(shell echo "/lib/modules/`uname -r`/build/include") \ +# ../slsDetectorSoftware/commonFiles\ +# ../slsDetectorSoftware/MySocketTCP\ +# ../slsDetectorSoftware/slsReceiverInterface\ +# ../slsDetectorSoftware/slsDetector\ +# ../slsDetectorSoftware/slsDetectorAnalysis\ +# ../slsDetectorSoftware/multiSlsDetector\ +# ../slsDetectorSoftware/usersFunctions SOURCES = \ slsDetectorPlotting/src/SlsQt1DPlot.cxx\ From 90e219d4026592314461b97830e80def569d61d8 Mon Sep 17 00:00:00 2001 From: bergamaschi Date: Thu, 22 Nov 2012 08:29:47 +0000 Subject: [PATCH 115/332] makefile again git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@115 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/slsDetectorGui/Makefile b/slsDetectorGui/Makefile index d8480b08b..f75ed7941 100644 --- a/slsDetectorGui/Makefile +++ b/slsDetectorGui/Makefile @@ -14,8 +14,10 @@ clean: -Makefile.gui: slsDetectorGui.pro - qmake -o Makefile.gui INCLUDES='$(INCLUDES)' DESTDIR=$(DESTDIR) +Makefile.gui: mm + +mm: + qmake -o Makefile.gui INCLUDES='$(INCLUDES)' DESTDIR=$(DESTDIR) SLSDETLIB=$(LIBDIR) SUBLIBS='$(LDFLAG)' INCLUDES='$(INCLUDES)' doc: cd manual && make DESTDIR=$(DOCDIR) From 95741a1c3380041190c5d552273b8f23ff474218 Mon Sep 17 00:00:00 2001 From: bergamaschi Date: Thu, 22 Nov 2012 10:11:54 +0000 Subject: [PATCH 116/332] project file finally ok git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@116 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/Makefile | 4 ++-- slsDetectorGui/slsDetectorGui.pro | 18 +++++++++++++----- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/slsDetectorGui/Makefile b/slsDetectorGui/Makefile index f75ed7941..e27b31dde 100644 --- a/slsDetectorGui/Makefile +++ b/slsDetectorGui/Makefile @@ -1,6 +1,6 @@ PROG= $(DESTDIR)/slsDetectorGui -DIR= $(shell ls src/* slsDetectorPlotting/include/* slsDetectorPlotting/src/* include/* forms/include/*) +#DIR= $(shell ls src/* slsDetectorPlotting/include/* slsDetectorPlotting/src/* include/ forms/*) DESTDIR?=bin DOCDIR?=docs LIBDIR?=../slsDetectorSoftware @@ -17,7 +17,7 @@ clean: Makefile.gui: mm mm: - qmake -o Makefile.gui INCLUDES='$(INCLUDES)' DESTDIR=$(DESTDIR) SLSDETLIB=$(LIBDIR) SUBLIBS='$(LDFLAG)' INCLUDES='$(INCLUDES)' + qmake -set QT_INSTALL_PREFIX $(QTDIR) && qmake -o Makefile.gui INCLUDES='$(INCLUDES)' DESTDIR=$(DESTDIR) SLSDETLIB=$(LIBDIR) SUBLIBS='$(LDFLAG)' INCLUDES='$(INCLUDES)' doc: cd manual && make DESTDIR=$(DOCDIR) diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index f66c3aa54..05d2db34d 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -7,7 +7,17 @@ UI_HEADERS_DIR = forms/include SLSDETLIB ?=../slsDetectorSoftware RESOURCES += icons.qrc -CONFIG += debug +CONFIG += debug no_include_pwd + +QMAKE_INCDIR_QT = $(QTDIR)/include/ + +QMAKE_LIBS_QT = -L$(QTDIR)/lib +QMAKE_LIBS = -L$(QTDIR)/lib + +QMAKE_UIC = $(QTDIR)/bin/uic + +QMAKE_MOC = $(QTDIR)/bin/moc +QMAKE_RCC = $(QTDIR)/bin/rcc QMAKE_CXXFLAGS_WARN_ON = -w QMAKE_CFLAGS_WARN_ON = -w @@ -26,16 +36,14 @@ QMAKE_CLEAN += docs/*/* #LIBS += -Wl,-Bstatic -L../slsDetectorSoftware -lSlsDetector -Wl,-Bdynamic\ # -L$(QWTDIR)/lib -lqwt -L$(QWT3D)/lib -LIBS += -L$(QWTDIR)/lib -lqwt -L$(QWT3D)/lib +LIBS = -L$(QWTDIR)/lib -lqwt -L$(QWT3D)/lib DEPENDPATH += \ slsDetectorPlotting/include\ include\ forms/include - - -INCLUDEPATH += \ +INCLUDEPATH = \ $(QWTDIR)/include\ $(QWTDIR) \ $(QWTDIR)/src\ From 0b8f6cc9252780c640ec379f4847d6e50cc7d929 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Mon, 26 Nov 2012 15:54:22 +0000 Subject: [PATCH 117/332] changed the check for is a file using stat and not looking for a dot in file name git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@117 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qActionsWidget.cpp | 29 ++++++------- slsDetectorGui/src/qDetectorMain.cpp | 24 ++++++++--- slsDetectorGui/src/qScanWidget.cpp | 59 ++++++++++++++------------- 3 files changed, 64 insertions(+), 48 deletions(-) diff --git a/slsDetectorGui/src/qActionsWidget.cpp b/slsDetectorGui/src/qActionsWidget.cpp index aa62dc80e..74005766e 100644 --- a/slsDetectorGui/src/qActionsWidget.cpp +++ b/slsDetectorGui/src/qActionsWidget.cpp @@ -129,29 +129,30 @@ void qActionsWidget::SetScriptFile(){ cout << "Setting\taction:" << id << "\tscript:" << fName.toAscii().constData() << endl; #endif bool set = false; + struct stat st_buf; //blank - if(fName.isEmpty()) set = true; - else if(!fName.compare("none")) set = true; + if(fName.isEmpty()) + set = true; + else if(!fName.compare("none")) + set = true; //not blank else{ - QString file = dispScript->text().section('/',-1); - //is a file - if(file.contains('.')){ - //check if it exists and set the script file - if(QFile::exists(fName)) set = true; - //if the file doesnt exist, set it to what it was before - else{ - qDefs::Message(qDefs::WARNING,"The script file entered does not exist","ActionsWidget"); - dispScript->setText(QString(myDet->getActionScript(id).c_str())); - } - }//not a file, set it to what it was before - else { + //path doesnt exist + if(stat(fName.toAscii().constData(),&st_buf)){ + qDefs::Message(qDefs::WARNING,"The script file entered does not exist","ActionsWidget"); + dispScript->setText(QString(myDet->getActionScript(id).c_str())); + } + //if its not a file + else if (!S_ISREG (st_buf.st_mode)) { qDefs::Message(qDefs::WARNING,"The script file path entered is not a file","ActionsWidget"); dispScript->setText(QString(myDet->getActionScript(id).c_str())); } + else + set=true; } + //if blank or valid file if(set){ //scan and positions wouldnt get here diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 25e459bd8..7201e97d5 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -285,12 +285,24 @@ void qDetectorMain::LoadConfigFile(const string fName){ #ifdef VERBOSE cout << "Loading config file at start up:" << fName << endl; #endif - QString file = QString(fName.c_str());//.section('/',-1); - if((file.contains('.'))&&(QFile::exists(file))){ - if(myDet->readConfigurationFile(fName)!=slsDetectorDefs::FAIL) - qDefs::Message(qDefs::INFORMATION,"The Configuration Parameters have been loaded successfully at start up.","Main"); - else qDefs::Message(qDefs::WARNING,string("Could not load the Configuration Parameters at start up from file:
")+fName,"Main"); - }else qDefs::Message(qDefs::WARNING,string("Start up configuration failed to load. The following file does not exist:
")+fName,"Main"); + struct stat st_buf; + QString file = QString(fName.c_str()); + + //path doesnt exist + if(stat(fName.c_str(),&st_buf)) + qDefs::Message(qDefs::WARNING,string("Start up configuration failed to load. The following file does not exist:
")+fName,"Main"); + + //not a file + else if (!S_ISREG (st_buf.st_mode)) + qDefs::Message(qDefs::WARNING,string("Start up configuration failed to load. The following file is not a recognized file format:
")+fName,"Main"); + + //could not load config file + else if(myDet->readConfigurationFile(fName)==slsDetectorDefs::FAIL) + qDefs::Message(qDefs::INFORMATION,"The Configuration Parameters have been loaded successfully at start up.","Main"); + + //successful + else + qDefs::Message(qDefs::INFORMATION,"The Configuration Parameters have been loaded successfully at start up.","Main"); } diff --git a/slsDetectorGui/src/qScanWidget.cpp b/slsDetectorGui/src/qScanWidget.cpp index dabe62075..666f2a23d 100644 --- a/slsDetectorGui/src/qScanWidget.cpp +++ b/slsDetectorGui/src/qScanWidget.cpp @@ -445,11 +445,12 @@ void qScanWidget::SetScriptFile(){ #ifdef VERYVERBOSE cout << "Entering SetScriptFile()" << endl; #endif - QString fName = dispScript->text();bool set = false; + QString fName = dispScript->text(); #ifdef VERBOSE cout << "Setting\tscan:" << id << "\tscript:" << fName.toAscii().constData() << endl; #endif - + bool set = false; + struct stat st_buf; //blank if(fName.isEmpty()) @@ -466,22 +467,18 @@ void qScanWidget::SetScriptFile(){ } //not blank and custom script mode if(!set){ - QString file = dispScript->text().section('/',-1); - //is a file - if(file.contains('.')){ - //check if it exists and set the script file - if(QFile::exists(fName)) - set = true; - //if the file doesnt exist, set it to what it was before - else{ - qDefs::Message(qDefs::WARNING,"The script file entered does not exist","ScanWidget"); - dispScript->setText(QString(myDet->getScanScript(id).c_str())); - } - }//not a file, set it to what it was before - else { + //path doesnt exist + if(stat(fName.toAscii().constData(),&st_buf)){ + qDefs::Message(qDefs::WARNING,"The script file entered does not exist","ScanWidget"); + dispScript->setText(QString(myDet->getScanScript(id).c_str())); + } + //if its not a file + else if (!S_ISREG (st_buf.st_mode)) { qDefs::Message(qDefs::WARNING,"The script file path entered is not a file","ScanWidget"); dispScript->setText(QString(myDet->getScanScript(id).c_str())); } + else + set=true; } //if blank or valid file @@ -974,8 +971,10 @@ void qScanWidget::SetFileSteps(){ cout << "Setting\tscan:" << id << "\tfile\t:" << fName.toAscii().constData() << endl; #endif bool set = false; + struct stat st_buf; - if(fName.isEmpty()){ //blank + //blank + if(fName.isEmpty()){ #ifdef VERBOSE cout << "Empty file" << endl; #endif @@ -983,21 +982,23 @@ void qScanWidget::SetFileSteps(){ radioFile->setText("Values from File:*"); QString errTip = fileTip + QString("

The file path is empty.");; radioFile->setToolTip(errTip);dispFile->setToolTip(errTip);btnFile->setToolTip(errTip); - }else{ + } + //not a blank + else{ QString file = dispFile->text().section('/',-1); - if(file.contains('.')){ //is a file - //check if it exists and set the script file - if(QFile::exists(fName)) set = true; - else{//if the file doesnt exist, set it to what it was before + + //path doesnt exist + if(stat(file.toAscii().constData(),&st_buf)){ #ifdef VERBOSE - cout << "The file entered does not exist." << endl; + cout << "The file entered does not exist." << endl; #endif - radioFile->setPalette(red); - radioFile->setText("Values from File:*"); - QString errTip = fileTip + QString("

The file entered does not exist."); - radioFile->setToolTip(errTip);dispFile->setToolTip(errTip);btnFile->setToolTip(errTip); - } - } else {//not a file, set it to what it was before + radioFile->setPalette(red); + radioFile->setText("Values from File:*"); + QString errTip = fileTip + QString("

The file entered does not exist."); + radioFile->setToolTip(errTip);dispFile->setToolTip(errTip);btnFile->setToolTip(errTip); + } + //if its not a file + else if (!S_ISREG (st_buf.st_mode)) { #ifdef VERBOSE cout << "The file path entered is not a file." << endl; #endif @@ -1006,6 +1007,8 @@ void qScanWidget::SetFileSteps(){ QString errTip = fileTip + QString("

The file path entered is not a file."); radioFile->setToolTip(errTip); dispFile->setToolTip(errTip);btnFile->setToolTip(errTip); } + else + set = true; } //if valid file From 382554afe9ce33cd7e3c00789254a7313e6fa7fd Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 30 Nov 2012 09:51:52 +0000 Subject: [PATCH 118/332] included spacebar as a shortcut to start and stop acq git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@118 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_measurement.ui | 3 +++ slsDetectorGui/src/qTabMeasurement.cpp | 1 + 2 files changed, 4 insertions(+) diff --git a/slsDetectorGui/forms/form_tab_measurement.ui b/slsDetectorGui/forms/form_tab_measurement.ui index 45f5ba28c..f7e9c07cf 100644 --- a/slsDetectorGui/forms/form_tab_measurement.ui +++ b/slsDetectorGui/forms/form_tab_measurement.ui @@ -161,6 +161,9 @@ :/icons/images/start.png:/icons/images/start.png + + Space + true diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 8c11e4f9e..0e9fd01c5 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -261,6 +261,7 @@ void qTabMeasurement::Enable(bool enable){ frameNotTimeResolved->setEnabled(enable); //Enable this always if(!enable) btnStartStop->setEnabled(true); + btnStartStop->setShortcut(QApplication::translate("TabMeasurementObject", "Space", 0, QApplication::UnicodeUTF8)); } From bbb6e2160766af8bed54263847d2039aa08e52fa Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 30 Nov 2012 17:05:06 +0000 Subject: [PATCH 119/332] included pedestal and also moved the frame index out of graph so it doesnt keep moving git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@119 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_measurement.ui | 2 +- slsDetectorGui/forms/form_tab_plot.ui | 197 +++++++++++++++++- slsDetectorGui/include/qCloneWidget.h | 2 + slsDetectorGui/include/qDrawPlot.h | 22 +- slsDetectorGui/include/qTabDebugging.h | 5 +- slsDetectorGui/include/qTabPlot.h | 2 + .../slsDetectorPlotting/src/SlsQt1DPlot.cxx | 2 +- slsDetectorGui/src/qCloneWidget.cpp | 8 +- slsDetectorGui/src/qDetectorMain.cpp | 2 +- slsDetectorGui/src/qDrawPlot.cpp | 103 ++++++++- slsDetectorGui/src/qTabMeasurement.cpp | 2 +- slsDetectorGui/src/qTabPlot.cpp | 31 ++- 12 files changed, 350 insertions(+), 28 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_measurement.ui b/slsDetectorGui/forms/form_tab_measurement.ui index f7e9c07cf..98a81f770 100644 --- a/slsDetectorGui/forms/form_tab_measurement.ui +++ b/slsDetectorGui/forms/form_tab_measurement.ui @@ -162,7 +162,7 @@ :/icons/images/start.png:/icons/images/start.png - Space + Shift+Space true diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index f0d754300..72063f919 100644 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -183,7 +183,7 @@ - 1D Plot Options + 1D Plot Options 1 Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter @@ -201,7 +201,7 @@ - 0 + 2 @@ -407,7 +407,7 @@
- + 345 @@ -430,7 +430,194 @@ - :/icons/images/leftArrow.png:/icons/images/leftArrow.png + :/icons/images/rightArrow.png:/icons/images/rightArrow.png + + + + 16 + 16 + + + + true + + + + + + + + 5 + 5 + 141 + 25 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + + + + + + 20 + 20 + 20 + + + + + + + + + 20 + 20 + 20 + + + + + + + + + 20 + 20 + 20 + + + + + + + + Qt::NoFocus + + + Reset Pedestal + + + + :/icons/images/remove.png:/icons/images/remove.png + + + + 16 + 16 + + + + + + + 200 + 5 + 141 + 25 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + + + + + + 20 + 20 + 20 + + + + + + + + + 20 + 20 + 20 + + + + + + + + + 20 + 20 + 20 + + + + + + + + Qt::NoFocus + + + Calculate Pedestal + + + + :/icons/images/add.png:/icons/images/add.png + + + + 16 + 16 + + + + + + + 345 + 0 + 16 + 16 + + + + + 0 + 0 + + + + Qt::NoFocus + + + + + + + :/icons/images/rightArrow.png:/icons/images/rightArrow.png @@ -593,7 +780,7 @@ 10 20 - 341 + 348 26 diff --git a/slsDetectorGui/include/qCloneWidget.h b/slsDetectorGui/include/qCloneWidget.h index 507f06887..081d5e682 100644 --- a/slsDetectorGui/include/qCloneWidget.h +++ b/slsDetectorGui/include/qCloneWidget.h @@ -126,6 +126,8 @@ private: QCheckBox *chkAutoFName; QCheckBox *chkSaveAll; + QLabel *lblHistTitle; + /** Gets the current time stamp for the window title*/ char* GetCurrentTimeStamp(); diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index 0ab31038d..a6a225cdc 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -149,8 +149,11 @@ void SetScanArgument(int scanArg); /** sets stop_signal to true */ void StopAcquisition(){ stop_signal = true; }; - - +//pedestal +/** reset pedestal */ +void ResetPedestal(); +/** Calculate Pedestal */ +void CalculatePedestal(); @@ -304,6 +307,10 @@ SlsQt2DPlotLayout* plot2D; QVector plot1D_hists; +/**label with frame index for those with many frames per file*/ +QLabel *histFrameIndexTitle; + + /** Current Measurement */ int currentMeasurement; /** currentFrame */ @@ -464,6 +471,17 @@ bool backwardScanPlot; bool fileSaveEnable; +//pedstal +/** Number of pedestal frames*/ +static const int NUM_PEDESTAL_FRAMES = 20; +/**reset pedestal*/ +bool resetPedestal; +/** pedestal values */ +double* pedestalVals; +/** count for 20 frames to calculate the pedestal */ +int pedestalCount; + + signals: void UpdatingPlotFinished(); void InterpolateSignal(bool); diff --git a/slsDetectorGui/include/qTabDebugging.h b/slsDetectorGui/include/qTabDebugging.h index 480833354..875b37e0f 100644 --- a/slsDetectorGui/include/qTabDebugging.h +++ b/slsDetectorGui/include/qTabDebugging.h @@ -13,10 +13,11 @@ /** Project Class Headers */ class multiSlsDetector; class slsDetector; +#include "sls_detector_defs.h" /** Qt Include Headers */ #include -/** C++ Include Headers */ -#include "sls_detector_defs.h" + + /** *@short sets up the Debugging parameters diff --git a/slsDetectorGui/include/qTabPlot.h b/slsDetectorGui/include/qTabPlot.h index a07cdad35..2e18513e6 100644 --- a/slsDetectorGui/include/qTabPlot.h +++ b/slsDetectorGui/include/qTabPlot.h @@ -12,6 +12,7 @@ #include "ui_form_tab_plot.h" /** Project Class Headers */ class multiSlsDetector; +#include "sls_detector_defs.h" /** Qt Project Class Headers */ class qDrawPlot; /** Qt Include Headers */ @@ -54,6 +55,7 @@ private: /** The Plot widget */ qDrawPlot *myPlot; + /** 1d/2d plot */ bool isOneD; bool isOriginallyOneD; diff --git a/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cxx b/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cxx index 8f0f01147..6fbcfefc6 100644 --- a/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cxx +++ b/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cxx @@ -276,7 +276,7 @@ SlsQt1DPlot::SlsQt1DPlot(QWidget *parent):QwtPlot(parent){ SetupZoom(); // Assign a title - insertLegend(new QwtLegend(), QwtPlot::RightLegend); + insertLegend(new QwtLegend(), QwtPlot::RightLegend); axisScaleEngine(QwtPlot::yLeft)->setAttribute(QwtScaleEngine::Floating); axisScaleEngine(QwtPlot::xBottom)->setAttribute(QwtScaleEngine::Floating); diff --git a/slsDetectorGui/src/qCloneWidget.cpp b/slsDetectorGui/src/qCloneWidget.cpp index afe3905a8..bf99a2032 100644 --- a/slsDetectorGui/src/qCloneWidget.cpp +++ b/slsDetectorGui/src/qCloneWidget.cpp @@ -71,6 +71,8 @@ void qCloneWidget::SetupWidgetWindow(QString title,int numDim,SlsQt1DPlot*& plot gridClone->addWidget(cloneplot1D,0,0); cloneBox->setFlat(false); cloneBox->setContentsMargins(0,30,0,0); + lblHistTitle = new QLabel(""); + mainLayout->addWidget(lblHistTitle,0,0); }else{ cloneplot2D = plot2D; @@ -128,7 +130,8 @@ void qCloneWidget::SetCloneHists(int nHists,int histNBins,double* histXAxis,doub #endif } //set title and attach plot - k->setTitle(histTitle[hist_num].c_str()); + lblHistTitle->setText(QString(histTitle[0].c_str())); + //k->setTitle(histTitle[hist_num].c_str()); k->Attach(cloneplot1D); } //cloneplot1D->UnZoom(); @@ -171,7 +174,8 @@ void qCloneWidget::SetCloneHists(int nHists,int histNBins,double* histXAxis,doub #endif } //set title and attach plot - k->setTitle(histTitle[hist_num].c_str()); + lblHistTitle->setText(QString(histTitle[0].c_str())); + //k->setTitle(histTitle[hist_num].c_str()); k->Attach(cloneplot1D); } //cloneplot1D->UnZoom(); diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 7201e97d5..f00b3494c 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -258,7 +258,7 @@ void qDetectorMain::Initialization(){ connect(tab_plot, SIGNAL(DisableZoomSignal(bool)), this,SLOT(SetZoomToolTip(bool))); // Actions tab (only for scan) connect(tab_actions, SIGNAL(EnableScanBox()), tab_plot,SLOT(EnableScanBox())); - //settings to advanced tab(int=id is always 0 to only refresh) + //settings to advanced tab(int is always 0 to only refresh) connect(tab_settings, SIGNAL(UpdateTrimbitSignal(int)), tab_advanced,SLOT(UpdateTrimbitPlot(int))); // Plotting // When the acquisition is finished, must update the meas tab diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 1cab23125..f16f4d110 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -123,10 +123,14 @@ void qDrawPlot::SetupWidgetWindow(){ setFont(QFont("Sans Serif",9)); layout = new QGridLayout; this->setLayout(layout); + + histFrameIndexTitle= histFrameIndexTitle = new QLabel(""); + boxPlot = new QGroupBox(""); layout->addWidget(boxPlot,1,1); boxPlot->setAlignment(Qt::AlignHCenter); boxPlot->setFont(QFont("Sans Serif",11,QFont::Normal)); + plot_update_timer = new QTimer(this); connect(plot_update_timer, SIGNAL(timeout()), this, SLOT(UpdatePlot())); data_pause_timer = new QTimer(this); @@ -190,6 +194,14 @@ void qDrawPlot::SetupWidgetWindow(){ fileSaveEnable= myDet->enableWriteToFile(); + //pedestal + resetPedestal = true; + pedestalVals = 0; + pedestalCount = -1; + + if(myDet->getDetectorsType()==slsDetectorDefs::GOTTHARD) + pedestalCount = 0; + // Setting the callback function to get data from detector class myDet->registerDataCallback(&(GetDataCallBack),this); @@ -555,8 +567,8 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){ currentFrameIndex=fIndex; sprintf(temp_title,"#%d",fIndex); }else{ - if(fileSaveEnable) strcpy(temp_title,""); - else sprintf(temp_title,"#%d",currentFrame); + if(fileSaveEnable) strcpy(temp_title,"#%d"); + else sprintf(temp_title,"",currentFrame); } @@ -748,10 +760,37 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){ else currentPersistency=persistency; nHists = currentPersistency+1; histNBins = nPixelsX; + // copy data for(int i=currentPersistency;i>0;i--) memcpy(histYAxis[i],histYAxis[i-1],nPixelsX*sizeof(double)); - memcpy(histYAxis[0],data->values,nPixelsX*sizeof(double)); + + //normal data + if(resetPedestal) + memcpy(histYAxis[0],data->values,nPixelsX*sizeof(double)); + else{ + //start adding frames to get to the pedestal value + if(pedestalCountvalues[px]; + memcpy(histYAxis[0],data->values,nPixelsX*sizeof(double)); + } + //calculate the pedestal value + else if(pedestalCount==NUM_PEDESTAL_FRAMES){ + cout << "Pedestal Calculated" << endl; + for(unsigned int px=0;pxvalues,nPixelsX*sizeof(double)); + } + //use this pedestal value henceforth + else{ + for(unsigned int px=0;pxvalues[px] - (pedestalVals[px]); + } + pedestalCount++; + + } + } //2d else{cout<hide(); boxPlot->setFlat(false); plot_in_scope=1; + layout->addWidget(histFrameIndexTitle,0,0); }else{ plot2D->SetXTitle(imageXAxisTitle); plot2D->SetYTitle(imageYAxisTitle); @@ -895,6 +935,9 @@ void qDrawPlot::SelectPlot(int i){ //1 for 1D otherwise 2D plot2D->show(); boxPlot->setFlat(true); plot_in_scope=2; + histFrameIndexTitle->setText(""); + layout->removeWidget(histFrameIndexTitle); + } } @@ -936,9 +979,9 @@ void qDrawPlot::UpdatePlot(){ SlsQtH1D* h; if(hist_num+1>plot1D_hists.size()){ if(anglePlot) - plot1D_hists.append(h=new SlsQtH1D("1d plot",histNBins,histXAngleAxis,histYAngleAxis)); + plot1D_hists.append(h=new SlsQtH1D("",histNBins,histXAngleAxis,histYAngleAxis)); else - plot1D_hists.append(h=new SlsQtH1D("1d plot",histNBins,histXAxis,GetHistYAxis(hist_num))); + plot1D_hists.append(h=new SlsQtH1D("",histNBins,histXAxis,GetHistYAxis(hist_num))); h->SetLineColor(hist_num+1); }else{ h=plot1D_hists.at(hist_num); @@ -948,7 +991,8 @@ void qDrawPlot::UpdatePlot(){ h->SetData(histNBins,histXAxis,GetHistYAxis(hist_num)); } SetStyle(h); - h->setTitle(GetHistTitle(hist_num)); + histFrameIndexTitle->setText(GetHistTitle(0)); + //h->setTitle(GetHistTitle(hist_num)); h->Attach(plot1D); } // update range if required @@ -1318,7 +1362,7 @@ int qDrawPlot::UpdateTrimbitPlot(bool fromDetector,bool Histogram){ plot1D->SetYTitle("Trimbits"); //set plot parameters SlsQtH1D* h; - plot1D_hists.append(h=new SlsQtH1D("1d plot",nPixelsX,histXAxis,histYAxis[0])); + plot1D_hists.append(h=new SlsQtH1D("",nPixelsX,histXAxis,histYAxis[0])); h->SetLineColor(1); h->setTitle(GetHistTitle(0)); //attach plot @@ -1347,7 +1391,7 @@ int qDrawPlot::UpdateTrimbitPlot(bool fromDetector,bool Histogram){ plot1D->SetYTitle("Frequency"); //set plot parameters SlsQtH1D* h; - plot1D_hists.append(h=new SlsQtH1D("1d plot",nPixelsX,histXAxis,histYAxis[0])); + plot1D_hists.append(h=new SlsQtH1D("",nPixelsX,histXAxis,histYAxis[0])); h->SetLineColor(1); h->setTitle(GetHistTitle(0)); //attach plot @@ -1398,4 +1442,47 @@ int qDrawPlot::UpdateTrimbitPlot(bool fromDetector,bool Histogram){ } +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qDrawPlot::ResetPedestal(){ +#ifdef VERBOSE + cout << "Resetting Pedestal" << endl; +#endif + while(1){ + if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ + pedestalVals = 0; + pedestalCount = 0; + resetPedestal = true; + pthread_mutex_unlock(&(last_image_complete_mutex)); + break; + } + } +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qDrawPlot::CalculatePedestal(){ +#ifdef VERBOSE + cout << "Calculating Pedestal" << endl; +#endif + while(1){ + if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ + //create array + if(pedestalVals) delete [] pedestalVals; pedestalVals = new double[nPixelsX]; + //reset all values + for(unsigned int px=0;pxsetEnabled(enable); //Enable this always if(!enable) btnStartStop->setEnabled(true); - btnStartStop->setShortcut(QApplication::translate("TabMeasurementObject", "Space", 0, QApplication::UnicodeUTF8)); + btnStartStop->setShortcut(QApplication::translate("TabMeasurementObject", "Shift+Space", 0, QApplication::UnicodeUTF8)); } diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index aa110685d..9b60d38a6 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -60,7 +60,6 @@ void qTabPlot::SetupWidgetWindow(){ intervalTip = boxFrequency->toolTip(); - //scan arguments btnGroupScan = new QButtonGroup(this); btnGroupScan->addButton(radioLevel0,0); @@ -148,6 +147,13 @@ void qTabPlot::SetupWidgetWindow(){ //to check if this should be enabled EnableScanBox(); + stackedWidget->setCurrentIndex(0); + + if(myDet->getDetectorsType()!=slsDetectorDefs::GOTTHARD){ + btnCalPedestal->setEnabled(false); + btnResetPedestal->setEnabled(false); + } + } @@ -156,10 +162,19 @@ void qTabPlot::SetupWidgetWindow(){ void qTabPlot::Set1DPage(){ QPushButton *clickedButton = qobject_cast(sender()); - if(clickedButton->icon().pixmap(QSize(16,16)).toImage()==btnLeft->icon().pixmap(QSize(16,16)).toImage()) - stackedWidget->setCurrentIndex(0); - else + if(stackedWidget->currentIndex()==0){ + //if(clickedButton->icon().pixmap(QSize(16,16)).toImage()==btnLeft->icon().pixmap(QSize(16,16)).toImage()) stackedWidget->setCurrentIndex(1); + box1D->setTitle("1D Plot Options 2"); + } + else if(stackedWidget->currentIndex()==1){ + stackedWidget->setCurrentIndex(2); + box1D->setTitle("1D Plot Options 3"); + } + else{ + stackedWidget->setCurrentIndex(0); + box1D->setTitle("1D Plot Options 1"); + } } @@ -206,8 +221,9 @@ void qTabPlot::Initialization(){ connect(chkLines, SIGNAL(toggled(bool)), myPlot, SLOT(SetLines(bool))); connect(chk1DLog, SIGNAL(toggled(bool)), myPlot, SIGNAL(LogySignal(bool))); //to change pages - connect(btnLeft, SIGNAL(clicked()), this, SLOT(Set1DPage())); connect(btnRight, SIGNAL(clicked()), this, SLOT(Set1DPage())); + connect(btnRight2, SIGNAL(clicked()), this, SLOT(Set1DPage())); + connect(btnRight3, SIGNAL(clicked()), this, SLOT(Set1DPage())); // 2D Plot box connect(chkInterpolate, SIGNAL(toggled(bool)),myPlot, SIGNAL(InterpolateSignal(bool))); connect(chkContour, SIGNAL(toggled(bool)),myPlot, SIGNAL(ContourSignal(bool))); @@ -247,6 +263,9 @@ void qTabPlot::Initialization(){ connect(this,SIGNAL(SetZRangeSignal(double,double)),myPlot, SIGNAL(SetZRangeSignal(double,double))); +//pedstal + connect(btnResetPedestal, SIGNAL(clicked()),myPlot, SLOT(ResetPedestal())); + connect(btnCalPedestal, SIGNAL(clicked()),myPlot, SLOT(CalculatePedestal())); } @@ -796,6 +815,7 @@ void qTabPlot::Refresh(){ connect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox())); EnableScanBox(); SetFrequency(); + }else{ disconnect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox())); boxScan->setEnabled(false); @@ -803,6 +823,7 @@ void qTabPlot::Refresh(){ if(radioHistogram->isChecked()) radioDataGraph->setEnabled(false); radioHistogram->setEnabled(false); + } #ifdef VERBOSE cout << "**Updated Plot Tab" << endl << endl; From 1e705df5dcbb9eb5adb8d711f6db4b0dbb761e55 Mon Sep 17 00:00:00 2001 From: bergamaschi Date: Tue, 4 Dec 2012 15:46:18 +0000 Subject: [PATCH 120/332] docs git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@120 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/slsDetectorGui.pro | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index 05d2db34d..df565fcaa 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -1,4 +1,14 @@ +QT_INSTALL_PREFIX=$(QTDIR) +QMAKE_UIC = $(QTDIR)/bin/uic +QMAKE_MOC = $(QTDIR)/bin/moc +QMAKE_RCC = $(QTDIR)/bin/rcc +QMAKE_INCDIR_QT = $(QTDIR)/include/ + +QMAKE_LIBS_QT = -L$(QTDIR)/lib +QMAKE_LIBS = -L$(QTDIR)/lib + + DESTDIR ?= bin MOC_DIR = mocs @@ -9,16 +19,6 @@ RESOURCES += icons.qrc CONFIG += debug no_include_pwd -QMAKE_INCDIR_QT = $(QTDIR)/include/ - -QMAKE_LIBS_QT = -L$(QTDIR)/lib -QMAKE_LIBS = -L$(QTDIR)/lib - -QMAKE_UIC = $(QTDIR)/bin/uic - -QMAKE_MOC = $(QTDIR)/bin/moc -QMAKE_RCC = $(QTDIR)/bin/rcc - QMAKE_CXXFLAGS_WARN_ON = -w QMAKE_CFLAGS_WARN_ON = -w From 27ef53da4a54c268521e04adbd8fe87211c7b296 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 5 Dec 2012 08:48:57 +0000 Subject: [PATCH 121/332] made some change in static member used as index to avoid compile time error with new gcc git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@121 af1100a4-978c-4157-bff7-07162d2ba061 --- .../slsDetectorPlotting/include/SlsQt2DZoomer.h | 4 ++++ slsDetectorGui/src/qTabActions.cpp | 16 +++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DZoomer.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DZoomer.h index fdda79d66..5b371aa4b 100644 --- a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DZoomer.h +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DZoomer.h @@ -2,12 +2,16 @@ /** * @author Ian Johnson * @version 1.0 + * Dhanya-05.12.2012- included an additional header */ #ifndef SLSQT2DZOOMER_H #define SLSQT2DZOOMER_H +/**included by Dhanya on 05.12.2012 to avoid compile time errors with the latest gcc*/ +#include +/**end of Change by Dhanya*/ #include #include diff --git a/slsDetectorGui/src/qTabActions.cpp b/slsDetectorGui/src/qTabActions.cpp index edcc12346..63c305619 100644 --- a/slsDetectorGui/src/qTabActions.cpp +++ b/slsDetectorGui/src/qTabActions.cpp @@ -84,7 +84,7 @@ void qTabActions::SetupWidgetWindow(){ - int hIndent=0, vIndent=0, colspan=6; + int hIndent=0, vIndent=0, colspan=6, posVal=0; QLabel *lblReal; // For each level of Actions for(int i=0;iaddWidget(scanWidget[qScanWidget::NUM_SCAN_WIDGETS-1],vIndent+1,hIndent+1,1,colspan); - scanWidget[qScanWidget::NUM_SCAN_WIDGETS-1]->hide(); + posVal = qScanWidget::NUM_SCAN_WIDGETS; + scanWidget[posVal] = new qScanWidget(this,myDet); + gridLayout->addWidget(scanWidget[posVal],vIndent+1,hIndent+1,1,colspan); + scanWidget[posVal]->hide(); break; default: - actionWidget[qActionsWidget::NUM_ACTION_WIDGETS] = new qActionsWidget(this,myDet); - gridLayout->addWidget(actionWidget[qActionsWidget::NUM_ACTION_WIDGETS-1],vIndent+1,hIndent+1,1,colspan); - actionWidget[qActionsWidget::NUM_ACTION_WIDGETS-1]->hide(); + posVal = qActionsWidget::NUM_ACTION_WIDGETS; + actionWidget[posVal] = new qActionsWidget(this,myDet); + gridLayout->addWidget(actionWidget[posVal],vIndent+1,hIndent+1,1,colspan); + actionWidget[posVal]->hide(); break; } From 4ccb47203e1771783b2bf458503ef594377e59f6 Mon Sep 17 00:00:00 2001 From: bergamaschi Date: Thu, 13 Dec 2012 11:36:50 +0000 Subject: [PATCH 122/332] manual removed from makefiile git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@122 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slsDetectorGui/Makefile b/slsDetectorGui/Makefile index e27b31dde..08268dd93 100644 --- a/slsDetectorGui/Makefile +++ b/slsDetectorGui/Makefile @@ -10,7 +10,7 @@ all: $(PROG) Makefile.gui clean: if test -e Makefile.gui; then make -f Makefile.gui clean; make -f Makefile.gui mocclean; rm Makefile.gui; else make Makefile.gui; make -f Makefile.gui clean; make -f Makefile.gui mocclean; fi - cd manual && make clean +# cd manual && make clean From adc52782f8855bdd034b8290c530095e39aecb57 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 14 Dec 2012 13:45:38 +0000 Subject: [PATCH 123/332] gui svninfo added to script git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@123 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qDefs.h | 2 +- slsDetectorGui/slsDetectorGui.pro | 2 +- slsDetectorGui/src/qDetectorMain.cpp | 8 +++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/slsDetectorGui/include/qDefs.h b/slsDetectorGui/include/qDefs.h index 626dafe91..600e01e2b 100644 --- a/slsDetectorGui/include/qDefs.h +++ b/slsDetectorGui/include/qDefs.h @@ -21,7 +21,7 @@ public: qDefs(){}; //------------------------------------------------------------------------------------------------------------------------------------------------- -#define GUI_VERSION 0.14 +static const int64_t GUI_VERSION=0x20121213; //------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index df565fcaa..d05907e6f 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -22,7 +22,7 @@ CONFIG += debug no_include_pwd QMAKE_CXXFLAGS_WARN_ON = -w QMAKE_CFLAGS_WARN_ON = -w -DEFINES += VERBOSE DACS_INT #VERYVERBOSE +DEFINES += VERBOSE DACS_INT THIS_PATH=\\\"$$PWD\\\" #VERYVERBOSE target.path += $(DESTDIR) diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index f00b3494c..b6af48bb0 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -19,6 +19,7 @@ #include "slsDetector.h" #include "multiSlsDetector.h" #include "sls_detector_defs.h" +#include "svnInfo.h" // Qt Include Headers #include #include @@ -531,11 +532,16 @@ void qDetectorMain::ExecuteHelp(QAction *action){ cout << "About: Common GUI for Mythen, Eiger, Gotthard and Agipd detectors" << endl; #endif char version[200]; + svnInfo* s = new svnInfo(string(THIS_PATH)); + sprintf(version,"%llx",(qDefs::GUI_VERSION<<32) | (s->getRevision())); + string thisGUIVersion = string(version); + sprintf(version,"%llx",myDet->getId(slsDetectorDefs::THIS_SOFTWARE_VERSION)); string thisClientVersion = string(version); + //

A heading

qDefs::Message(qDefs::INFORMATION,"

" - "SLS Detector GUI version: " + string(QString("%1").arg(GUI_VERSION).toAscii().constData())+"
" + "SLS Detector GUI version:   " + thisGUIVersion+"
" "SLS Detector Client version: "+thisClientVersion+"

" "Common GUI to control the SLS Detectors: " "Mythen, Eiger, Gotthard and Agipd.

" From 5bb8bc4574a644853c53467f53a8eda9336b805f Mon Sep 17 00:00:00 2001 From: bergamaschi Date: Mon, 17 Dec 2012 15:51:44 +0000 Subject: [PATCH 124/332] svn version headers generated, but not yet implemented in the code git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@124 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/svnInfoGui.h | 11 +++++++++++ slsDetectorGui/include/svnInfoGuiTmp.h | 11 +++++++++++ slsDetectorGui/slsDetectorGui.pro | 1 + 3 files changed, 23 insertions(+) create mode 100644 slsDetectorGui/include/svnInfoGui.h create mode 100644 slsDetectorGui/include/svnInfoGuiTmp.h diff --git a/slsDetectorGui/include/svnInfoGui.h b/slsDetectorGui/include/svnInfoGui.h new file mode 100644 index 000000000..51d774730 --- /dev/null +++ b/slsDetectorGui/include/svnInfoGui.h @@ -0,0 +1,11 @@ +//#define SVNPATH "" +#define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui" +//#define SVNREPPATH "" +#define SVNREPUUID "af1100a4-978c-4157-bff7-07162d2ba061" +//#define SVNREV 0x123 +//#define SVNKIND "" +//#define SVNSCHED "" +#define SVNAUTH "l_maliakal_d" +#define SVNREV 0x123 +#define SVNDATE 0x20121214 +// diff --git a/slsDetectorGui/include/svnInfoGuiTmp.h b/slsDetectorGui/include/svnInfoGuiTmp.h new file mode 100644 index 000000000..58e48f497 --- /dev/null +++ b/slsDetectorGui/include/svnInfoGuiTmp.h @@ -0,0 +1,11 @@ +//#define SVNPATH "" +#define SVNURL "" +//#define SVNREPPATH "" +#define SVNREPUUID "" +//#define SVNREV "" +//#define SVNKIND "" +//#define SVNSCHED "" +#define SVNAUTH "" +#define SVNREV "" +#define SVNDATE "" +// diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index d05907e6f..8fdd6b43f 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -109,6 +109,7 @@ HEADERS = \ include/qTabDebugging.h\ include/qTabDeveloper.h\ include/qTabMessages.h\ + include/svnInfoGui.h\ ../slsDetectorSoftware/commonFiles/sls_detector_defs.h From 46a4fee0832421794e3a646292f0a84421e45c0d Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Mon, 17 Dec 2012 16:39:25 +0000 Subject: [PATCH 125/332] included the revision change git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@125 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/svnInfoGui.h | 8 ++++---- slsDetectorGui/src/qDetectorMain.cpp | 9 +++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/slsDetectorGui/include/svnInfoGui.h b/slsDetectorGui/include/svnInfoGui.h index 51d774730..0d9386e1e 100644 --- a/slsDetectorGui/include/svnInfoGui.h +++ b/slsDetectorGui/include/svnInfoGui.h @@ -2,10 +2,10 @@ #define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui" //#define SVNREPPATH "" #define SVNREPUUID "af1100a4-978c-4157-bff7-07162d2ba061" -//#define SVNREV 0x123 +//#define SVNREV 0x124 //#define SVNKIND "" //#define SVNSCHED "" -#define SVNAUTH "l_maliakal_d" -#define SVNREV 0x123 -#define SVNDATE 0x20121214 +#define SVNAUTH "bergamaschi" +#define SVNREV 0x124 +#define SVNDATE 0x20121217 // diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index b6af48bb0..daad3e1c3 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -19,7 +19,7 @@ #include "slsDetector.h" #include "multiSlsDetector.h" #include "sls_detector_defs.h" -#include "svnInfo.h" +#include "svnInfoGui.h" // Qt Include Headers #include #include @@ -97,7 +97,7 @@ void qDetectorMain::SetUpWidgetWindow(){ //tabs setup tabs = new MyTabWidget(this); - layoutTabs->addWidget(tabs); cout<<"DockPlot ready"<addWidget(tabs); // creating all the other tab widgets tab_measurement = new qTabMeasurement (this, myDet,myPlot); cout<<"Measurement ready"<getRevision())); + int64_t retval= SVNREV; + retval= (retval <<32) | SVNDATE; + sprintf(version,"%llx",retval); string thisGUIVersion = string(version); sprintf(version,"%llx",myDet->getId(slsDetectorDefs::THIS_SOFTWARE_VERSION)); From b59b54e004f1a21336b2512a488fa95be47c0203 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 18 Dec 2012 12:07:45 +0000 Subject: [PATCH 126/332] got rid of segmentation fault while loading settings file which didnt refresh actions tab etc git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@126 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/svnInfoGui.h | 6 +++--- slsDetectorGui/src/qDetectorMain.cpp | 23 ++++++++++++++++++----- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/slsDetectorGui/include/svnInfoGui.h b/slsDetectorGui/include/svnInfoGui.h index 0d9386e1e..d1274ec19 100644 --- a/slsDetectorGui/include/svnInfoGui.h +++ b/slsDetectorGui/include/svnInfoGui.h @@ -2,10 +2,10 @@ #define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui" //#define SVNREPPATH "" #define SVNREPUUID "af1100a4-978c-4157-bff7-07162d2ba061" -//#define SVNREV 0x124 +//#define SVNREV 0x125 //#define SVNKIND "" //#define SVNSCHED "" -#define SVNAUTH "bergamaschi" -#define SVNREV 0x124 +#define SVNAUTH "l_maliakal_d" +#define SVNREV 0x125 #define SVNDATE 0x20121217 // diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index daad3e1c3..23cd96cf8 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -358,7 +358,7 @@ void qDetectorMain::EnableModes(QAction *action){ void qDetectorMain::ExecuteUtilities(QAction *action){ - + bool refreshTabs = false; if(action==actionOpenSetup){ #ifdef VERBOSE cout << "Loading Setup" << endl; @@ -369,9 +369,10 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ tr("Detector Setup files (*.det)")); // Gets called when cancelled as well if (!fName.isEmpty()){ - if(myDet->retrieveDetectorSetup(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL) + if(myDet->retrieveDetectorSetup(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL){ qDefs::Message(qDefs::INFORMATION,"The Setup Parameters have been loaded successfully.","Main"); - else qDefs::Message(qDefs::WARNING,string("Could not load the Setup Parameters from file:\n")+fName.toAscii().constData(),"Main"); + refreshTabs=true; + }else qDefs::Message(qDefs::WARNING,string("Could not load the Setup Parameters from file:\n")+fName.toAscii().constData(),"Main"); } } else if(action==actionSaveSetup){ @@ -399,9 +400,10 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ tr("Configuration files (*.config)")); // Gets called when cancelled as well if (!fName.isEmpty()){ - if(myDet->readConfigurationFile(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL) + if(myDet->readConfigurationFile(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL){ qDefs::Message(qDefs::INFORMATION,"The Configuration Parameters have been configured successfully.","Main"); - else qDefs::Message(qDefs::WARNING,string("Could not load the Configuration Parameters from file:\n")+fName.toAscii().constData(),"Main"); + refreshTabs=true; + }else qDefs::Message(qDefs::WARNING,string("Could not load the Configuration Parameters from file:\n")+fName.toAscii().constData(),"Main"); } } else if(action==actionSaveConfiguration){ @@ -520,6 +522,17 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ } Refresh(tabs->currentIndex()); + if(refreshTabs){ + tab_actions->Refresh(); + tab_measurement->Refresh(); + //tab_settings->Refresh(); + //tab_dataoutput->Refresh(); + //tab_advanced->Refresh(); + //tab_debugging->Refresh(); + //tab_developer->Refresh(); + tab_plot->Refresh(); + } + } From dd7385cd88594c57f07e8be6147307cc8cc2ee00 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 18 Dec 2012 14:34:48 +0000 Subject: [PATCH 127/332] included -f in config file git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@127 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/svnInfoGui.h | 6 +++--- slsDetectorGui/src/qDetectorMain.cpp | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/slsDetectorGui/include/svnInfoGui.h b/slsDetectorGui/include/svnInfoGui.h index d1274ec19..91de98058 100644 --- a/slsDetectorGui/include/svnInfoGui.h +++ b/slsDetectorGui/include/svnInfoGui.h @@ -2,10 +2,10 @@ #define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui" //#define SVNREPPATH "" #define SVNREPUUID "af1100a4-978c-4157-bff7-07162d2ba061" -//#define SVNREV 0x125 +//#define SVNREV 0x126 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "l_maliakal_d" -#define SVNREV 0x125 -#define SVNDATE 0x20121217 +#define SVNREV 0x126 +#define SVNDATE 0x20121218 // diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 23cd96cf8..2f3f3cfdf 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -55,6 +55,7 @@ qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app, QWidget * if(!strcasecmp(argv[iarg],"-developer")) {isDeveloper=1;} if(!strcasecmp(argv[iarg],"-id")) {detID=atoi(argv[iarg+1]);} if(!strcasecmp(argv[iarg],"-config")) {configFName=string(argv[iarg+1]);} + if(!strcasecmp(argv[iarg],"-f")) {configFName=string(argv[iarg+1]);} if(!strcasecmp(argv[iarg],"-help")){ cout << "Possible Arguments are:" << endl; cout << "-help \t\t : \t This help" << endl; From dbad2a41d8e0ae8b9b743a6c0716e78758720c17 Mon Sep 17 00:00:00 2001 From: l_mozzanica Date: Tue, 18 Dec 2012 15:21:09 +0000 Subject: [PATCH 128/332] git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@128 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qTabMessages.h | 2 +- slsDetectorGui/include/svnInfoGui.h | 4 ++-- slsDetectorGui/src/qTabMessages.cpp | 9 +++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/slsDetectorGui/include/qTabMessages.h b/slsDetectorGui/include/qTabMessages.h index ccc90691b..2decadc3c 100644 --- a/slsDetectorGui/include/qTabMessages.h +++ b/slsDetectorGui/include/qTabMessages.h @@ -30,7 +30,7 @@ public: * @param parent is the parent tab widget * @param det the detector reference */ - qTabMessages(QWidget *parent,multiSlsDetector*& detector); + qTabMessages(QWidget *parent,multiSlsDetector* detector); /** Destructor */ diff --git a/slsDetectorGui/include/svnInfoGui.h b/slsDetectorGui/include/svnInfoGui.h index 91de98058..a5a7f1b3a 100644 --- a/slsDetectorGui/include/svnInfoGui.h +++ b/slsDetectorGui/include/svnInfoGui.h @@ -2,10 +2,10 @@ #define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui" //#define SVNREPPATH "" #define SVNREPUUID "af1100a4-978c-4157-bff7-07162d2ba061" -//#define SVNREV 0x126 +//#define SVNREV 0x127 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "l_maliakal_d" -#define SVNREV 0x126 +#define SVNREV 0x127 #define SVNDATE 0x20121218 // diff --git a/slsDetectorGui/src/qTabMessages.cpp b/slsDetectorGui/src/qTabMessages.cpp index a09f16d32..ff9bf1593 100644 --- a/slsDetectorGui/src/qTabMessages.cpp +++ b/slsDetectorGui/src/qTabMessages.cpp @@ -25,15 +25,16 @@ using namespace std; //------------------------------------------------------------------------------------------------------------------------------------------------- -qTabMessages::qTabMessages(QWidget *parent,multiSlsDetector*& detector):QWidget(parent),myDet(detector),qout(0){ - SetupWidgetWindow(); - Initialization(); +qTabMessages::qTabMessages(QWidget *parent,multiSlsDetector* detector):QWidget(parent),qout(0){//myDet(detector), + myDet=detector; + SetupWidgetWindow(); + Initialization(); } //------------------------------------------------------------------------------------------------------------------------------------------------- qTabMessages::~qTabMessages(){ - delete myDet; + // delete myDet; delete dispLog; delete qout; } From c21d674e89cd2c1499c54ab180d2b0531163e1bc Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 18 Dec 2012 16:33:30 +0000 Subject: [PATCH 129/332] changed uint in qDebugStream so that qtabmessages work on 64bit machine git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@129 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qDebugStream.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/slsDetectorGui/include/qDebugStream.h b/slsDetectorGui/include/qDebugStream.h index 6b5e8a51d..6f21c683e 100644 --- a/slsDetectorGui/include/qDebugStream.h +++ b/slsDetectorGui/include/qDebugStream.h @@ -84,7 +84,8 @@ protected: virtual streamsize xsputn(const char *p, streamsize n) { m_string.append(p, p + n); - uint pos = 0; + //changed from uint because of 64 bit + int pos = 0; while (pos != string::npos) { From 6560a325cea8d28ed5ad0edf6b8ddc19ebe3494b Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 8 Jan 2013 14:05:49 +0000 Subject: [PATCH 130/332] no change git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@130 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/svnInfoGui.h | 4 ++-- slsDetectorGui/src/qDrawPlot.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/slsDetectorGui/include/svnInfoGui.h b/slsDetectorGui/include/svnInfoGui.h index a5a7f1b3a..4926df9f5 100644 --- a/slsDetectorGui/include/svnInfoGui.h +++ b/slsDetectorGui/include/svnInfoGui.h @@ -2,10 +2,10 @@ #define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui" //#define SVNREPPATH "" #define SVNREPUUID "af1100a4-978c-4157-bff7-07162d2ba061" -//#define SVNREV 0x127 +//#define SVNREV 0x129 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "l_maliakal_d" -#define SVNREV 0x127 +#define SVNREV 0x129 #define SVNDATE 0x20121218 // diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index f16f4d110..4c0f49fdb 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -766,9 +766,9 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){ memcpy(histYAxis[i],histYAxis[i-1],nPixelsX*sizeof(double)); //normal data - if(resetPedestal) + if(resetPedestal){ memcpy(histYAxis[0],data->values,nPixelsX*sizeof(double)); - else{ + }else{cout<<"SHOULD NOT BE HERE!!!!!!!!!!!!!"< Date: Tue, 8 Jan 2013 16:28:32 +0000 Subject: [PATCH 131/332] got rid of the weird ui look, which was due to windows style from afs git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@131 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qDetectorMain.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 2f3f3cfdf..7ef9e3953 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -23,6 +23,7 @@ // Qt Include Headers #include #include +#include // C++ Include Headers #include #include @@ -35,6 +36,7 @@ using namespace std; int main (int argc, char **argv) { QApplication *theApp = new QApplication(argc, argv); + theApp->setStyle(new QPlastiqueStyle); theApp->setWindowIcon(QIcon( ":/icons/images/mountain.png" )); qDetectorMain *det=new qDetectorMain(argc, argv, theApp,0); det->show(); From 0b05f67f9d5b2b7fdb1ece5f9817918daec19573 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 11 Jan 2013 09:59:29 +0000 Subject: [PATCH 132/332] included sls defs in every file so that int is 32 bit git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@132 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qActionsWidget.h | 2 ++ slsDetectorGui/include/qCloneWidget.h | 3 +++ slsDetectorGui/include/qDebugStream.h | 3 +++ slsDetectorGui/include/qDefs.h | 1 + slsDetectorGui/include/qDetectorMain.h | 3 ++- slsDetectorGui/include/qDrawPlot.h | 3 ++- slsDetectorGui/include/qScanWidget.h | 2 ++ slsDetectorGui/include/qTabActions.h | 3 ++- slsDetectorGui/include/qTabAdvanced.h | 4 +++- slsDetectorGui/include/qTabDataOutput.h | 4 +++- slsDetectorGui/include/qTabDebugging.h | 4 +++- slsDetectorGui/include/qTabDeveloper.h | 4 +++- slsDetectorGui/include/qTabMeasurement.h | 3 +++ slsDetectorGui/include/qTabMessages.h | 3 +++ slsDetectorGui/include/qTabPlot.h | 4 +++- slsDetectorGui/include/qTabSettings.h | 4 +++- slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h | 7 +++++++ .../slsDetectorPlotting/include/SlsQt1DZoomer.h | 8 ++++++++ slsDetectorGui/slsDetectorPlotting/include/SlsQt2DHist.h | 7 +++++++ slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h | 7 +++++++ .../slsDetectorPlotting/include/SlsQt2DPlotLayout.h | 7 +++++++ .../slsDetectorPlotting/include/SlsQt2DZoomer.h | 7 +++++++ .../slsDetectorPlotting/include/SlsQtNumberEntry.h | 7 +++++++ .../slsDetectorPlotting/include/SlsQtValidators.h | 6 ++++++ slsDetectorGui/src/qActionsWidget.cpp | 1 - slsDetectorGui/src/qCloneWidget.cpp | 1 - slsDetectorGui/src/qDetectorMain.cpp | 3 +-- slsDetectorGui/src/qScanWidget.cpp | 1 - slsDetectorGui/src/qTabActions.cpp | 1 - slsDetectorGui/src/qTabAdvanced.cpp | 1 - slsDetectorGui/src/qTabDataOutput.cpp | 1 - slsDetectorGui/src/qTabDebugging.cpp | 1 - slsDetectorGui/src/qTabDeveloper.cpp | 1 - slsDetectorGui/src/qTabMeasurement.cpp | 1 - slsDetectorGui/src/qTabMessages.cpp | 1 - slsDetectorGui/src/qTabPlot.cpp | 1 - slsDetectorGui/src/qTabSettings.cpp | 1 - 37 files changed, 98 insertions(+), 23 deletions(-) diff --git a/slsDetectorGui/include/qActionsWidget.h b/slsDetectorGui/include/qActionsWidget.h index f10d02abf..2e024c8a1 100644 --- a/slsDetectorGui/include/qActionsWidget.h +++ b/slsDetectorGui/include/qActionsWidget.h @@ -8,6 +8,8 @@ #ifndef QACTIONSWIDGET_H_ #define QACTIONSWIDGET_H_ +#include "qDefs.h" + /** Form Header */ #include "ui_form_action.h" /** Project Class Headers */ diff --git a/slsDetectorGui/include/qCloneWidget.h b/slsDetectorGui/include/qCloneWidget.h index 081d5e682..d83f38e0f 100644 --- a/slsDetectorGui/include/qCloneWidget.h +++ b/slsDetectorGui/include/qCloneWidget.h @@ -8,6 +8,9 @@ #ifndef QCLONEWIDGET_H_ #define QCLONEWIDGET_H_ +#include "qDefs.h" + + /** Qt Project Class Headers */ class SlsQtH1D; #include "SlsQt1DPlot.h" diff --git a/slsDetectorGui/include/qDebugStream.h b/slsDetectorGui/include/qDebugStream.h index 6f21c683e..f04072d0f 100644 --- a/slsDetectorGui/include/qDebugStream.h +++ b/slsDetectorGui/include/qDebugStream.h @@ -9,6 +9,9 @@ #define QDEBUGSTREAM_H_ +#include "qDefs.h" + + #include #include #include diff --git a/slsDetectorGui/include/qDefs.h b/slsDetectorGui/include/qDefs.h index 600e01e2b..500c42bc3 100644 --- a/slsDetectorGui/include/qDefs.h +++ b/slsDetectorGui/include/qDefs.h @@ -8,6 +8,7 @@ #ifndef QDEFS_H #define QDEFS_H +#include "sls_detector_defs.h" #include #include using namespace std; diff --git a/slsDetectorGui/include/qDetectorMain.h b/slsDetectorGui/include/qDetectorMain.h index b4ec2cdb6..cd0060775 100644 --- a/slsDetectorGui/include/qDetectorMain.h +++ b/slsDetectorGui/include/qDetectorMain.h @@ -7,6 +7,8 @@ #ifndef QDETECTORMAIN_H #define QDETECTORMAIN_H +#include "qDefs.h" + /** Form Header */ #include "ui_form_detectormain.h" /** Qt Project Class Headers */ @@ -22,7 +24,6 @@ class qTabDeveloper; class qTabMessages; /** Project Class Headers */ class multiSlsDetector; -#include "sls_detector_defs.h" /** Qt Include Headers */ #include #include diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index a6a225cdc..c0dd76368 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -8,13 +8,14 @@ #define QDRAWPLOT_H +#include "qDefs.h" + /** Project Class Headers */ class multiSlsDetector; #include "detectorData.h" /** Qt Project Class Headers */ #include "SlsQt1DPlot.h" #include "SlsQt2DPlotLayout.h" -#include "qDefs.h" class qCloneWidget; /** Qt Include Headers */ #include diff --git a/slsDetectorGui/include/qScanWidget.h b/slsDetectorGui/include/qScanWidget.h index bcbaba50e..329a211da 100644 --- a/slsDetectorGui/include/qScanWidget.h +++ b/slsDetectorGui/include/qScanWidget.h @@ -8,6 +8,8 @@ #ifndef QSCANWIDGET_H_ #define QSCANWIDGET_H_ +#include "qDefs.h" + /** Form Header */ #include "ui_form_scan.h" /** Project Class Headers */ diff --git a/slsDetectorGui/include/qTabActions.h b/slsDetectorGui/include/qTabActions.h index bd5a073cd..d5d497fde 100644 --- a/slsDetectorGui/include/qTabActions.h +++ b/slsDetectorGui/include/qTabActions.h @@ -8,13 +8,14 @@ #ifndef QTABACTIONS_H_ #define QTABACTIONS_H_ +#include "qDefs.h" + /* Qt Project Class Headers */ #include "qActionsWidget.h" #include "qScanWidget.h" /** C++ Project Class Headers */ class multiSlsDetector; -#include "sls_detector_defs.h" /** Qt Include Headers */ #include #include diff --git a/slsDetectorGui/include/qTabAdvanced.h b/slsDetectorGui/include/qTabAdvanced.h index 30462698f..2d9705640 100644 --- a/slsDetectorGui/include/qTabAdvanced.h +++ b/slsDetectorGui/include/qTabAdvanced.h @@ -8,11 +8,13 @@ #ifndef QTABADVANCED_H_ #define QTABADVANCED_H_ +#include "qDefs.h" + + /** Form Header */ #include "ui_form_tab_advanced.h" /** Project Class Headers */ class multiSlsDetector; -#include "sls_detector_defs.h" /** Qt Project Class Headers */ class qDrawPlot; /** Qt Include Header */ diff --git a/slsDetectorGui/include/qTabDataOutput.h b/slsDetectorGui/include/qTabDataOutput.h index 8c65edb0a..437afce4f 100644 --- a/slsDetectorGui/include/qTabDataOutput.h +++ b/slsDetectorGui/include/qTabDataOutput.h @@ -8,11 +8,13 @@ #ifndef QTABDATAOUTPUT_H_ #define QTABDATAOUTPUT_H_ +#include "qDefs.h" + + /** Form Header */ #include "ui_form_tab_dataoutput.h" /** Project Class Headers */ class multiSlsDetector; -#include "sls_detector_defs.h" /** Qt Include Headers */ #include diff --git a/slsDetectorGui/include/qTabDebugging.h b/slsDetectorGui/include/qTabDebugging.h index 875b37e0f..484dfa87d 100644 --- a/slsDetectorGui/include/qTabDebugging.h +++ b/slsDetectorGui/include/qTabDebugging.h @@ -8,12 +8,14 @@ #ifndef QTABDEBUGGING_H_ #define QTABDEBUGGING_H_ +#include "qDefs.h" + + /** Form Header */ #include "ui_form_tab_debugging.h" /** Project Class Headers */ class multiSlsDetector; class slsDetector; -#include "sls_detector_defs.h" /** Qt Include Headers */ #include diff --git a/slsDetectorGui/include/qTabDeveloper.h b/slsDetectorGui/include/qTabDeveloper.h index 525e372d1..8acf84a78 100644 --- a/slsDetectorGui/include/qTabDeveloper.h +++ b/slsDetectorGui/include/qTabDeveloper.h @@ -8,9 +8,11 @@ #ifndef QTABDEVELOPER_H_ #define QTABDEVELOPER_H_ +#include "qDefs.h" + + /** Project Class Headers */ class multiSlsDetector; -#include "sls_detector_defs.h" /** Qt Include Headers */ #include #include diff --git a/slsDetectorGui/include/qTabMeasurement.h b/slsDetectorGui/include/qTabMeasurement.h index f4d9ca1e6..bd55b9baf 100644 --- a/slsDetectorGui/include/qTabMeasurement.h +++ b/slsDetectorGui/include/qTabMeasurement.h @@ -7,6 +7,9 @@ #ifndef QTABMEASUREMENT #define QTABMEASUREMENT +#include "qDefs.h" + + /** Form Header */ #include "ui_form_tab_measurement.h" /** Project Class Headers */ diff --git a/slsDetectorGui/include/qTabMessages.h b/slsDetectorGui/include/qTabMessages.h index 2decadc3c..146fde006 100644 --- a/slsDetectorGui/include/qTabMessages.h +++ b/slsDetectorGui/include/qTabMessages.h @@ -9,6 +9,9 @@ #define QTABMESSAGES_H_ +#include "qDefs.h" + + /** Project Class Headers */ class multiSlsDetector; diff --git a/slsDetectorGui/include/qTabPlot.h b/slsDetectorGui/include/qTabPlot.h index 2e18513e6..0705d0ec4 100644 --- a/slsDetectorGui/include/qTabPlot.h +++ b/slsDetectorGui/include/qTabPlot.h @@ -8,11 +8,13 @@ #ifndef QTABPLOT_H_ #define QTABPLOT_H_ +#include "qDefs.h" + + /** Form Header */ #include "ui_form_tab_plot.h" /** Project Class Headers */ class multiSlsDetector; -#include "sls_detector_defs.h" /** Qt Project Class Headers */ class qDrawPlot; /** Qt Include Headers */ diff --git a/slsDetectorGui/include/qTabSettings.h b/slsDetectorGui/include/qTabSettings.h index 822052404..90c901910 100644 --- a/slsDetectorGui/include/qTabSettings.h +++ b/slsDetectorGui/include/qTabSettings.h @@ -8,11 +8,13 @@ #ifndef QTABSETTINGS_H_ #define QTABSETTINGS_H_ +#include "qDefs.h" + + /** Form Header */ #include "ui_form_tab_settings.h" /** Project Class Headers */ class multiSlsDetector; -#include "sls_detector_defs.h" /** Qt Include Headers */ #include diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h index 1125df904..0e9de4649 100644 --- a/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h @@ -13,6 +13,13 @@ #ifndef SLSQT1DPLOT_H #define SLSQT1DPLOT_H +#ifndef IAN +typedef double double32_t; +typedef float float32_t; +typedef int int32_t; +#endif + + #include #include #include diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DZoomer.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DZoomer.h index 730516a60..378b6f787 100644 --- a/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DZoomer.h +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DZoomer.h @@ -6,6 +6,14 @@ #ifndef SLSQT1DZOOMER_H #define SLSQT1DZOOMER_H + +#ifndef IAN +typedef double double32_t; +typedef float float32_t; +typedef int int32_t; +#endif + + #include #include #include diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DHist.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DHist.h index fbca86864..a71a32676 100644 --- a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DHist.h +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DHist.h @@ -9,6 +9,13 @@ #define SLSQT2DHIST_H +#ifndef IAN +typedef double double32_t; +typedef float float32_t; +typedef int int32_t; +#endif + + #if QT_VERSION >= 0x040000 #include diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h index 23daeb338..c1a80c395 100644 --- a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h @@ -14,6 +14,13 @@ #ifndef SLSQT2DPLOT_H #define SLSQT2DPLOT_H +#ifndef IAN +typedef double double32_t; +typedef float float32_t; +typedef int int32_t; +#endif + + #include #include diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlotLayout.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlotLayout.h index 47c82bdae..5948b2fb3 100644 --- a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlotLayout.h +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlotLayout.h @@ -11,6 +11,13 @@ #ifndef SLSQT2DPLOTLAYOUT_H #define SLSQT2DPLOTLAYOUT_H +#ifndef IAN +typedef double double32_t; +typedef float float32_t; +typedef int int32_t; +#endif + + #include #include diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DZoomer.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DZoomer.h index 5b371aa4b..2acd34dc6 100644 --- a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DZoomer.h +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DZoomer.h @@ -9,6 +9,13 @@ #ifndef SLSQT2DZOOMER_H #define SLSQT2DZOOMER_H +#ifndef IAN +typedef double double32_t; +typedef float float32_t; +typedef int int32_t; +#endif + + /**included by Dhanya on 05.12.2012 to avoid compile time errors with the latest gcc*/ #include /**end of Change by Dhanya*/ diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQtNumberEntry.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQtNumberEntry.h index 1bcd9e937..dbeb0a31e 100644 --- a/slsDetectorGui/slsDetectorPlotting/include/SlsQtNumberEntry.h +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQtNumberEntry.h @@ -7,6 +7,13 @@ #ifndef SLSQTNUMBERENTRY_H #define SLSQTNUMBERENTRY_H +#ifndef IAN +typedef double double32_t; +typedef float float32_t; +typedef int int32_t; +#endif + + #include #include diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQtValidators.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQtValidators.h index 197b162a2..bd2d70efd 100644 --- a/slsDetectorGui/slsDetectorPlotting/include/SlsQtValidators.h +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQtValidators.h @@ -7,6 +7,12 @@ #ifndef SLSQTVALIDATORS_H #define SLSQTVALIDATORS_H +#ifndef IAN +typedef double double32_t; +typedef float float32_t; +typedef int int32_t; +#endif + #include #include diff --git a/slsDetectorGui/src/qActionsWidget.cpp b/slsDetectorGui/src/qActionsWidget.cpp index 74005766e..465fed646 100644 --- a/slsDetectorGui/src/qActionsWidget.cpp +++ b/slsDetectorGui/src/qActionsWidget.cpp @@ -9,7 +9,6 @@ #include "multiSlsDetector.h" // Qt Project Class Headers #include "qActionsWidget.h" -#include "qDefs.h" // Qt Include Headers #include // C++ Include Headers diff --git a/slsDetectorGui/src/qCloneWidget.cpp b/slsDetectorGui/src/qCloneWidget.cpp index bf99a2032..0b4110168 100644 --- a/slsDetectorGui/src/qCloneWidget.cpp +++ b/slsDetectorGui/src/qCloneWidget.cpp @@ -7,7 +7,6 @@ /** Qt Project Class Headers */ #include "qCloneWidget.h" -#include "qDefs.h" /** Qt Include Headers */ #include #include diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 7ef9e3953..3b547adec 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -4,7 +4,6 @@ * ********************************************************************/ // Qt Project Class Headers #include "qDetectorMain.h" -#include "qDefs.h" #include "qDrawPlot.h" #include "qTabMeasurement.h" #include "qTabDataOutput.h" @@ -36,7 +35,7 @@ using namespace std; int main (int argc, char **argv) { QApplication *theApp = new QApplication(argc, argv); - theApp->setStyle(new QPlastiqueStyle); + theApp->setStyle(new QPlastiqueStyle);//not default when desktop is windows theApp->setWindowIcon(QIcon( ":/icons/images/mountain.png" )); qDetectorMain *det=new qDetectorMain(argc, argv, theApp,0); det->show(); diff --git a/slsDetectorGui/src/qScanWidget.cpp b/slsDetectorGui/src/qScanWidget.cpp index 666f2a23d..cff11affd 100644 --- a/slsDetectorGui/src/qScanWidget.cpp +++ b/slsDetectorGui/src/qScanWidget.cpp @@ -9,7 +9,6 @@ #include "multiSlsDetector.h" // Qt Project Class Headers #include "qScanWidget.h" -#include "qDefs.h" // Qt Include Headers #include #include diff --git a/slsDetectorGui/src/qTabActions.cpp b/slsDetectorGui/src/qTabActions.cpp index 63c305619..85e8665a3 100644 --- a/slsDetectorGui/src/qTabActions.cpp +++ b/slsDetectorGui/src/qTabActions.cpp @@ -6,7 +6,6 @@ */ // Qt Project Class Headers #include "qTabActions.h" -#include "qDefs.h" // Project Class Headers #include "slsDetector.h" #include "multiSlsDetector.h" diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp index 05da30fe2..7f6e9f5a2 100644 --- a/slsDetectorGui/src/qTabAdvanced.cpp +++ b/slsDetectorGui/src/qTabAdvanced.cpp @@ -5,7 +5,6 @@ * Author: l_maliakal_d */ #include "qTabAdvanced.h" -#include "qDefs.h" #include "qDrawPlot.h" /** Project Class Headers */ #include "slsDetector.h" diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index a58ba931e..3a47be74c 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -10,7 +10,6 @@ * ********************************************************************/ #include "qTabDataOutput.h" -#include "qDefs.h" // Project Class Headers #include "slsDetector.h" #include "multiSlsDetector.h" diff --git a/slsDetectorGui/src/qTabDebugging.cpp b/slsDetectorGui/src/qTabDebugging.cpp index d7806ed67..2aec64dc1 100644 --- a/slsDetectorGui/src/qTabDebugging.cpp +++ b/slsDetectorGui/src/qTabDebugging.cpp @@ -5,7 +5,6 @@ * Author: l_maliakal_d */ #include "qTabDebugging.h" -#include "qDefs.h" // Project Class Headers #include "slsDetector.h" #include "multiSlsDetector.h" diff --git a/slsDetectorGui/src/qTabDeveloper.cpp b/slsDetectorGui/src/qTabDeveloper.cpp index 3b7692ab2..a80b9383b 100644 --- a/slsDetectorGui/src/qTabDeveloper.cpp +++ b/slsDetectorGui/src/qTabDeveloper.cpp @@ -5,7 +5,6 @@ * Author: l_maliakal_d */ #include "qTabDeveloper.h" -#include "qDefs.h" //Project Class Headers #include "slsDetector.h" #include "multiSlsDetector.h" diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index ccd3927df..fcb07e505 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -7,7 +7,6 @@ //Qt Project Class Headers #include "qTabMeasurement.h" -#include "qDefs.h" #include "qDrawPlot.h" //Project Class Headers #include "slsDetector.h" diff --git a/slsDetectorGui/src/qTabMessages.cpp b/slsDetectorGui/src/qTabMessages.cpp index ff9bf1593..d7fc43473 100644 --- a/slsDetectorGui/src/qTabMessages.cpp +++ b/slsDetectorGui/src/qTabMessages.cpp @@ -7,7 +7,6 @@ /** Qt Project Class Headers */ #include "qTabMessages.h" -#include "qDefs.h" /** Project Class Headers */ #include "slsDetector.h" #include "multiSlsDetector.h" diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index 9b60d38a6..f6e050747 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -6,7 +6,6 @@ */ #include "qTabPlot.h" -#include "qDefs.h" #include "qDrawPlot.h" // Project Class Headers #include "slsDetector.h" diff --git a/slsDetectorGui/src/qTabSettings.cpp b/slsDetectorGui/src/qTabSettings.cpp index 038c2ab86..1ce307e04 100644 --- a/slsDetectorGui/src/qTabSettings.cpp +++ b/slsDetectorGui/src/qTabSettings.cpp @@ -6,7 +6,6 @@ */ #include "qTabSettings.h" -#include "qDefs.h" // Project Class Headers #include "slsDetector.h" #include "multiSlsDetector.h" From ac79bb86fbdad0d225835b518c323034c7ac6bf1 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 11 Jan 2013 17:21:37 +0000 Subject: [PATCH 133/332] initialized everything in gui to get rid of the initialization error git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@133 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qDrawPlot.cpp | 186 +++++++++++++++++++------------ 1 file changed, 114 insertions(+), 72 deletions(-) diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 4c0f49fdb..d42751f81 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -60,15 +60,41 @@ void qDrawPlot::SetupWidgetWindow(){ #ifdef VERBOSE cout << "Setting up plot variables" << endl; #endif + data_pause_over = true;//to get the first image + currentMeasurement = 0; + currentFrame = 0; + numFactor = 0; + currentScanDivLevel = 0; + currentScanValue = 0; + number_of_exposures = 0; + number_of_frames = 0; + acquisitionPeriod = 0; + exposureTime = 0; + currentFileIndex = 0; + currentFrameIndex = 0; + stop_signal = 0; pthread_mutex_init(&last_image_complete_mutex,NULL); - //gui_acquisition_thread_running = 0; - // Default Plotting - plot_in_scope = 0; - lastImageNumber = 0; - last_plot_number = 0; + // Default titles- only for the initial picture + + imageXAxisTitle="Pixel"; + imageYAxisTitle="Pixel"; + imageZAxisTitle="Intensity"; + histXAxisTitle="Channel Number"; + histYAxisTitle="Counts"; + for(int i=0;igetTotalNumberOfChannels(); nPixelsY = 100; nAnglePixelsX = 1; @@ -76,49 +102,86 @@ void qDrawPlot::SetupWidgetWindow(){ maxPixelsY = 0; startPixel=-0.5; endPixel=nPixelsY-0.5; + pixelWidth = 0; + + lastImageNumber = 0; + last_plot_number = 0; - //2d - lastImageArray = 0; - //1d nHists = 0; histNBins = 0; histXAxis = 0; + for(int i=0;isetStyle(QwtSymbol::Cross); + marker->setSize(5,5); + noMarker = new QwtSymbol(); + + //for save automatically, saveAll = false; - - XYRangeChanged = false; - timerValue = PLOT_TIMER_MS; - frameFactor=0; - data_pause_over = true;//to get the first image - isFrameEnabled = false; - isTriggerEnabled = false; - scanArgument = None; - - alreadyDisplayed = false; - - backwardScanPlot = false; - - currentFileIndex = 0; - currentFrameIndex = 0; + saveError = false; + lastSavedFrame = -1; + lastSavedMeasurement = -1; // This is so that it initially stop and plots running = 1; - for(int i=0;igetFilePath().c_str()); + fileName = QString(myDet->getFileName().c_str()); + + backwardScanPlot = false; + fileSaveEnable= myDet->enableWriteToFile(); + + //pedestal + resetPedestal = true; + pedestalVals = 0; + pedestalCount = -1; + + if(myDet->getDetectorsType()==slsDetectorDefs::GOTTHARD) + pedestalCount = 0; + + + + + + //widget related initialization // clone for(int i=0;isetFont(QFont("Sans Serif",9,QFont::Normal)); plot1D->SetXTitle(histXAxisTitle.toAscii().constData()); plot1D->SetYTitle(histYAxisTitle.toAscii().constData()); plot1D->hide(); +/* + SlsQtH1D* h; + histNBins = nPixelsX; + nHists = 1; + if(histXAxis) delete [] histXAxis; histXAxis = new double [nPixelsX]; + if(histYAxis[0]) delete [] histYAxis[0];histYAxis[0] = new double [nPixelsX]; + for(unsigned int px=0;px<(int)nPixelsX;px++) {histXAxis[px] = px;histYAxis[0] = 0;} + plot1D_hists.append(h=new SlsQtH1D("",histNBins,histXAxis,GetHistYAxis(0))); + h->Attach(plot1D);*/ plot2D = new SlsQt2DPlotLayout(boxPlot); plot2D->setFont(QFont("Sans Serif",9,QFont::Normal)); @@ -174,34 +228,22 @@ void qDrawPlot::SetupWidgetWindow(){ boxPlot->setFlat(true); boxPlot->setContentsMargins(0,15,0,0); + //plot1D_hists = NULL; + plotLayout = new QGridLayout(boxPlot); plotLayout->addWidget(plot1D,1,1,1,1); plotLayout->addWidget(plot2D,1,1,1,1); - //marker - lines = true; - markers = false; - marker = new QwtSymbol(); - marker->setStyle(QwtSymbol::Cross); - marker->setSize(5,5); - noMarker = new QwtSymbol(); - - - //filepath and file name - filePath = QString(myDet->getFilePath().c_str()); - fileName = QString(myDet->getFileName().c_str()); - - - fileSaveEnable= myDet->enableWriteToFile(); - - //pedestal - resetPedestal = true; - pedestalVals = 0; - pedestalCount = -1; - - if(myDet->getDetectorsType()==slsDetectorDefs::GOTTHARD) - pedestalCount = 0; - + /* + //clear eveything again + nHists=0; + histXAxis=0; + histYAxis[0]=0; + Clear1DPlot(); + for(QVector::iterator h = plot1D_hists.begin();h!=plot1D_hists.end();h++) delete *h; + plot1D_hists.clear(); +*/ + //callbacks // Setting the callback function to get data from detector class myDet->registerDataCallback(&(GetDataCallBack),this); From 6a3747638d5571b675b038ea51d5f57604abc7b2 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 15 Jan 2013 17:11:54 +0000 Subject: [PATCH 134/332] also catches cerr now git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@134 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qDebugStream.h | 42 +++++++-------------------- slsDetectorGui/include/qTabMessages.h | 2 +- slsDetectorGui/src/qTabMessages.cpp | 22 +++++++++----- 3 files changed, 26 insertions(+), 40 deletions(-) diff --git a/slsDetectorGui/include/qDebugStream.h b/slsDetectorGui/include/qDebugStream.h index f04072d0f..bfbdf0524 100644 --- a/slsDetectorGui/include/qDebugStream.h +++ b/slsDetectorGui/include/qDebugStream.h @@ -15,7 +15,6 @@ #include #include #include -#include #include #include @@ -30,9 +29,9 @@ using namespace std; class qStreamEvent:public QEvent{ public: - qStreamEvent(QString s):QEvent(static_cast(STREAMEVENT)) {str=s;}; + qStreamEvent(QString s):QEvent(static_cast(STREAMEVENT)),str(s){} /** \returns the progress index */ - QString getString() {return str;}; + QString getString() {return str;} private: QString str; @@ -43,27 +42,18 @@ private: class qDebugStream : public basic_streambuf { public: - qDebugStream(ostream &stream, ostream &estream, QWidget* w) : m_stream(stream), e_stream(estream), log_window(w) { + qDebugStream(ostream &stream, QWidget* w) : m_stream(stream), log_window(w) { m_old_buf = stream.rdbuf(); stream.rdbuf(this); - //e_old_buf = stream.rdbuf(); - //estream.rdbuf(this); - - }; + } //------------------------------------------------------------------------------------------------------------------------------------------------- ~qDebugStream(){ // output anything that is left - if (!m_string.empty()) { - qStreamEvent *ce=new qStreamEvent(m_string.c_str()); - QApplication::postEvent(log_window, ce); -#ifdef VERBOSE - cerr << m_string << endl; -#endif - } + if (!m_string.empty()) + QApplication::postEvent(log_window, new qStreamEvent(m_string.c_str())); m_stream.rdbuf(m_old_buf); - e_stream.rdbuf(e_old_buf); } //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -71,11 +61,7 @@ public: protected: virtual int_type overflow(int_type v){ if (v == '\n'){ - qStreamEvent *ce=new qStreamEvent(m_string.c_str()); - QApplication::postEvent(log_window, ce); -#ifdef VERBOSE - cerr << m_string << endl; -#endif + QApplication::postEvent(log_window, new qStreamEvent(m_string.c_str())); m_string.erase(m_string.begin(), m_string.end()); } else @@ -90,17 +76,11 @@ protected: //changed from uint because of 64 bit int pos = 0; - while (pos != string::npos) - { + while (pos != string::npos){ pos = m_string.find('\n'); - if (pos != string::npos) - { + if (pos != string::npos){ string tmp(m_string.begin(), m_string.begin() + pos); - qStreamEvent *ce=new qStreamEvent(tmp.c_str()); - QApplication::postEvent(log_window, ce); -#ifdef VERBOSE - cerr << tmp << endl; -#endif + QApplication::postEvent(log_window, new qStreamEvent(tmp.c_str())); m_string.erase(m_string.begin(), m_string.begin() + pos + 1); } } @@ -112,8 +92,6 @@ protected: private: ostream &m_stream; streambuf *m_old_buf; - ostream &e_stream; - streambuf *e_old_buf; string m_string; QWidget* log_window; }; diff --git a/slsDetectorGui/include/qTabMessages.h b/slsDetectorGui/include/qTabMessages.h index 146fde006..12a1e6759 100644 --- a/slsDetectorGui/include/qTabMessages.h +++ b/slsDetectorGui/include/qTabMessages.h @@ -55,7 +55,7 @@ private: /** This class creates the log */ qDebugStream *qout; - //qDebugStream *qerr; + qDebugStream *qerr; /** methods */ /** Sets up the widget */ diff --git a/slsDetectorGui/src/qTabMessages.cpp b/slsDetectorGui/src/qTabMessages.cpp index d7fc43473..cb80031c2 100644 --- a/slsDetectorGui/src/qTabMessages.cpp +++ b/slsDetectorGui/src/qTabMessages.cpp @@ -24,7 +24,7 @@ using namespace std; //------------------------------------------------------------------------------------------------------------------------------------------------- -qTabMessages::qTabMessages(QWidget *parent,multiSlsDetector* detector):QWidget(parent),qout(0){//myDet(detector), +qTabMessages::qTabMessages(QWidget *parent,multiSlsDetector* detector):QWidget(parent),qout(0),qerr(0){//myDet(detector), myDet=detector; SetupWidgetWindow(); Initialization(); @@ -36,6 +36,7 @@ qTabMessages::~qTabMessages(){ // delete myDet; delete dispLog; delete qout; + delete qerr; } //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -65,11 +66,9 @@ void qTabMessages::SetupWidgetWindow(){ gridLayout->addItem(new QSpacerItem(15,10,QSizePolicy::Fixed,QSizePolicy::Fixed),2,0); gridLayout->addWidget(dispLog,3,0,1,5); - qout=new qDebugStream(cout,cerr, this); - //qerr=new qDebugStream(cerr,this); + qout=new qDebugStream(std::cout,this); + qerr=new qDebugStream(std::cerr,this); - //qerr=NULL; - //qerr=new qDebugStream(std::cerr,this);cout<<"worked!"<type() == STREAMEVENT) - dispLog->append(((qStreamEvent*)e)->getString()); + if (e->type() == (STREAMEVENT)){ + QString temp = ((qStreamEvent*)e)->getString(); + dispLog->append(temp); + string t=string(temp.toAscii().constData()); + if(t.find("not connect")!=string::npos) + qDefs::Message(qDefs::WARNING,string("Caught following message:\n\n")+t,"Messages"); + else if(t.find("ould not")!=string::npos) + qDefs::Message(qDefs::WARNING,string("Caught following message:\n\n")+t,"Messages"); + + // dispLog->append(((qStreamEvent*)e)->getString()); + } } //------------------------------------------------------------------------------------------------------------------------------------------------- From bb46b9afce67581e3199b3fae24e0336a3e60ab5 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 15 Jan 2013 17:28:59 +0000 Subject: [PATCH 135/332] also catches cerr now git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@135 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qTabMessages.h | 2 ++ slsDetectorGui/src/qTabMessages.cpp | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/slsDetectorGui/include/qTabMessages.h b/slsDetectorGui/include/qTabMessages.h index 12a1e6759..6524f2a52 100644 --- a/slsDetectorGui/include/qTabMessages.h +++ b/slsDetectorGui/include/qTabMessages.h @@ -57,6 +57,8 @@ private: qDebugStream *qout; qDebugStream *qerr; + string errMsg; + /** methods */ /** Sets up the widget */ void SetupWidgetWindow(); diff --git a/slsDetectorGui/src/qTabMessages.cpp b/slsDetectorGui/src/qTabMessages.cpp index cb80031c2..859c3e9ad 100644 --- a/slsDetectorGui/src/qTabMessages.cpp +++ b/slsDetectorGui/src/qTabMessages.cpp @@ -66,6 +66,7 @@ void qTabMessages::SetupWidgetWindow(){ gridLayout->addItem(new QSpacerItem(15,10,QSizePolicy::Fixed,QSizePolicy::Fixed),2,0); gridLayout->addWidget(dispLog,3,0,1,5); + errMsg = " Please check Messages Tab. Following message was caught:

"; qout=new qDebugStream(std::cout,this); qerr=new qDebugStream(std::cerr,this); @@ -85,10 +86,12 @@ void qTabMessages::customEvent(QEvent *e) { QString temp = ((qStreamEvent*)e)->getString(); dispLog->append(temp); string t=string(temp.toAscii().constData()); + + if(t.find("not connect")!=string::npos) - qDefs::Message(qDefs::WARNING,string("Caught following message:\n\n")+t,"Messages"); + qDefs::Message(qDefs::WARNING,errMsg+t,"Messages"); else if(t.find("ould not")!=string::npos) - qDefs::Message(qDefs::WARNING,string("Caught following message:\n\n")+t,"Messages"); + qDefs::Message(qDefs::WARNING,errMsg+t,"Messages"); // dispLog->append(((qStreamEvent*)e)->getString()); } From b94e9475a0409d5c50f60654d44534c4f2a0edbb Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 15 Jan 2013 17:36:04 +0000 Subject: [PATCH 136/332] also catches cerr now git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@136 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qTabMessages.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/slsDetectorGui/src/qTabMessages.cpp b/slsDetectorGui/src/qTabMessages.cpp index 859c3e9ad..a519129a9 100644 --- a/slsDetectorGui/src/qTabMessages.cpp +++ b/slsDetectorGui/src/qTabMessages.cpp @@ -66,7 +66,7 @@ void qTabMessages::SetupWidgetWindow(){ gridLayout->addItem(new QSpacerItem(15,10,QSizePolicy::Fixed,QSizePolicy::Fixed),2,0); gridLayout->addWidget(dispLog,3,0,1,5); - errMsg = " Please check Messages Tab. Following message was caught:

"; + errMsg = " Please check Messages Tab. Following message was caught:

"; qout=new qDebugStream(std::cout,this); qerr=new qDebugStream(std::cerr,this); @@ -89,9 +89,9 @@ void qTabMessages::customEvent(QEvent *e) { if(t.find("not connect")!=string::npos) - qDefs::Message(qDefs::WARNING,errMsg+t,"Messages"); + qDefs::Message(qDefs::WARNING,errMsg+t+string(""),"Messages"); else if(t.find("ould not")!=string::npos) - qDefs::Message(qDefs::WARNING,errMsg+t,"Messages"); + qDefs::Message(qDefs::WARNING,errMsg+t+string("
"),"Messages"); // dispLog->append(((qStreamEvent*)e)->getString()); } From b10fedb8f39c68bc1af58799f782d756349dc379 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 16 Jan 2013 10:19:14 +0000 Subject: [PATCH 137/332] cleared data in gui at beginning git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@137 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qDrawPlot.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index d42751f81..7158cf61d 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -207,15 +207,21 @@ void qDrawPlot::SetupWidgetWindow(){ plot1D->SetXTitle(histXAxisTitle.toAscii().constData()); plot1D->SetYTitle(histYAxisTitle.toAscii().constData()); plot1D->hide(); -/* + SlsQtH1D* h; histNBins = nPixelsX; nHists = 1; if(histXAxis) delete [] histXAxis; histXAxis = new double [nPixelsX]; if(histYAxis[0]) delete [] histYAxis[0];histYAxis[0] = new double [nPixelsX]; - for(unsigned int px=0;px<(int)nPixelsX;px++) {histXAxis[px] = px;histYAxis[0] = 0;} - plot1D_hists.append(h=new SlsQtH1D("",histNBins,histXAxis,GetHistYAxis(0))); - h->Attach(plot1D);*/ + for(unsigned int px=0;px<(int)nPixelsX;px++) {histXAxis[px] = px;histYAxis[0][px] = 0;} + Clear1DPlot(); + plot1D->SetXTitle("X Axis"); + plot1D->SetYTitle("Y Axis"); + plot1D_hists.append(h=new SlsQtH1D("",histNBins,histXAxis,histYAxis[0])); + h->SetLineColor(1); + SetStyle(h); + h->Attach(plot1D); + Clear1DPlot(); plot2D = new SlsQt2DPlotLayout(boxPlot); plot2D->setFont(QFont("Sans Serif",9,QFont::Normal)); @@ -810,7 +816,7 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){ //normal data if(resetPedestal){ memcpy(histYAxis[0],data->values,nPixelsX*sizeof(double)); - }else{cout<<"SHOULD NOT BE HERE!!!!!!!!!!!!!"< Date: Wed, 16 Jan 2013 13:59:41 +0000 Subject: [PATCH 138/332] with all the svn revisions git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@138 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/svnInfoGui.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/slsDetectorGui/include/svnInfoGui.h b/slsDetectorGui/include/svnInfoGui.h index 4926df9f5..13a7dc1f5 100644 --- a/slsDetectorGui/include/svnInfoGui.h +++ b/slsDetectorGui/include/svnInfoGui.h @@ -2,10 +2,10 @@ #define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui" //#define SVNREPPATH "" #define SVNREPUUID "af1100a4-978c-4157-bff7-07162d2ba061" -//#define SVNREV 0x129 +//#define SVNREV 0x137 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "l_maliakal_d" -#define SVNREV 0x129 -#define SVNDATE 0x20121218 +#define SVNREV 0x137 +#define SVNDATE 0x20130116 // From 64208d5eddbc0228c6d221e1d923af8278e1cecb Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 22 Jan 2013 09:45:24 +0000 Subject: [PATCH 139/332] dataoutput browse button disabled help in red git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@139 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qTabDataOutput.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index 3a47be74c..1e8be365a 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -540,11 +540,14 @@ void qTabDataOutput::Refresh(){ if(myDet->getBadChannelCorrection()) chkDiscardBad->setChecked(true); - if(myDet->setReceiverOnline()==slsDetectorDefs::ONLINE_FLAG) + if(myDet->setReceiverOnline()==slsDetectorDefs::ONLINE_FLAG){ btnOutputBrowse->setEnabled(false); - else + btnOutputBrowse->setToolTip("This button is disabled as receiver PC is different from " + "client PC and hence different directory structures.

" + dispOutputDir->toolTip()); + }else{ btnOutputBrowse->setEnabled(true); - + btnOutputBrowse->setToolTip(dispOutputDir->toolTip()); + } #ifdef VERBOSE cout << "**Updated DataOutput Tab" << endl << endl; From 2ead554b7b270302c5fdd89421d0560e31740541 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Thu, 31 Jan 2013 11:15:38 +0000 Subject: [PATCH 140/332] fixed browse to show in red when disabled browse button for receiver, got rid of error message showing, git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@140 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qDefs.h | 60 ++++++++++++++++++++++++++++ slsDetectorGui/src/qDetectorMain.cpp | 21 ++++++---- slsDetectorGui/src/qTabMessages.cpp | 14 +++---- 3 files changed, 80 insertions(+), 15 deletions(-) diff --git a/slsDetectorGui/include/qDefs.h b/slsDetectorGui/include/qDefs.h index 500c42bc3..614115073 100644 --- a/slsDetectorGui/include/qDefs.h +++ b/slsDetectorGui/include/qDefs.h @@ -9,6 +9,11 @@ #define QDEFS_H #include "sls_detector_defs.h" +#include "error_defs.h" +#include "slsDetector.h" +#include "multiSlsDetector.h" +#include +#include #include #include using namespace std; @@ -172,6 +177,61 @@ static const int64_t GUI_VERSION=0x20121213; YMAXIMUM }; +//------------------------------------------------------------------------------------------------------------------------------------------------- + + /**checks error mask and displays the message if it exists + * @param myDet is the multidetector object + /returns error message else an empty string + * */ + static string checkErrorMessage(multiSlsDetector*& myDet){ + + int multiMask,slsMask=0; + MessageIndex errorLevel= WARNING; + slsDetector *det; + string retval=""; + char sNumber[100]; + size_t pos; + + //multidetector error mask + multiMask = myDet->getErrorMask(); + if(multiMask){ + retval.append(""); + //check every sls detector + for(int i=0;igetNumberOfDetectors();i++){ + slsMask=0; + //if the detector has error + if(multiMask&(1<")); + //get sls det error mask + det = myDet->getSlsDetector(i); + slsMask=det->getErrorMask(); +#ifdef VERYVERBOSE + //append sls det error mask + sprintf(sNumber,"0x%x",slsMask); + retval.append("Error Mask " + string(sNumber)+string("\n")); +#endif + //get the error critical level + if((slsMask>0xFFFF)|errorLevel) + errorLevel = CRITICAL; + //append error message + retval.append(string("") + errorDefs::getErrorMessage(slsMask)+string("")); + //replace all \n with
+ pos = 0; + while((pos = retval.find("\n", pos)) != string::npos){ + retval.replace(pos, 1, "
"); + pos += 1; + } + } + } + retval.append("
"); + qDefs::Message(errorLevel,retval,"Main"); + } + return retval; + }; + + //------------------------------------------------------------------------------------------------------------------------------------------------- }; diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 3b547adec..a4aa73381 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -19,6 +19,7 @@ #include "multiSlsDetector.h" #include "sls_detector_defs.h" #include "svnInfoGui.h" +#include "error_defs.h" // Qt Include Headers #include #include @@ -299,16 +300,21 @@ void qDetectorMain::LoadConfigFile(const string fName){ else if (!S_ISREG (st_buf.st_mode)) qDefs::Message(qDefs::WARNING,string("Start up configuration failed to load. The following file is not a recognized file format:
")+fName,"Main"); - //could not load config file - else if(myDet->readConfigurationFile(fName)==slsDetectorDefs::FAIL) - qDefs::Message(qDefs::INFORMATION,"The Configuration Parameters have been loaded successfully at start up.","Main"); + else{ + //could not load config file + if(myDet->readConfigurationFile(fName)==slsDetectorDefs::FAIL) + qDefs::Message(qDefs::WARNING,string("Could not load the Configuration Parameters from file:\n")+fName,"Main"); + //successful + else + qDefs::Message(qDefs::INFORMATION,"The Configuration Parameters have been loaded successfully at start up.","Main"); - //successful - else - qDefs::Message(qDefs::INFORMATION,"The Configuration Parameters have been loaded successfully at start up.","Main"); + qDefs::checkErrorMessage(myDet); + myDet->clearErrorMask(); + } } + //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -534,7 +540,8 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ //tab_developer->Refresh(); tab_plot->Refresh(); } - + qDefs::checkErrorMessage(myDet); + myDet->clearErrorMask(); } diff --git a/slsDetectorGui/src/qTabMessages.cpp b/slsDetectorGui/src/qTabMessages.cpp index a519129a9..f826ba3b5 100644 --- a/slsDetectorGui/src/qTabMessages.cpp +++ b/slsDetectorGui/src/qTabMessages.cpp @@ -82,19 +82,17 @@ void qTabMessages::Initialization(){ //------------------------------------------------------------------------------------------------------------------------------------------------- void qTabMessages::customEvent(QEvent *e) { - if (e->type() == (STREAMEVENT)){ - QString temp = ((qStreamEvent*)e)->getString(); + if (e->type() == (STREAMEVENT)) + dispLog->append(((qStreamEvent*)e)->getString()); + +/* QString temp = ((qStreamEvent*)e)->getString(); dispLog->append(temp); - string t=string(temp.toAscii().constData()); - - + string t=string(temp.toAscii().constData()); if(t.find("not connect")!=string::npos) qDefs::Message(qDefs::WARNING,errMsg+t+string("
"),"Messages"); else if(t.find("ould not")!=string::npos) qDefs::Message(qDefs::WARNING,errMsg+t+string("
"),"Messages"); - - // dispLog->append(((qStreamEvent*)e)->getString()); - } +*/ } //------------------------------------------------------------------------------------------------------------------------------------------------- From 6b311f931b68fa63ae4e35b177b9ef3eeff0aa19 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Thu, 31 Jan 2013 15:34:31 +0000 Subject: [PATCH 141/332] included shortframe in gui for time being its just adc selection git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@141 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_advanced.ui | 1411 +++++++++++---------- slsDetectorGui/include/qTabAdvanced.h | 9 + slsDetectorGui/src/qTabAdvanced.cpp | 30 +- 3 files changed, 789 insertions(+), 661 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_advanced.ui b/slsDetectorGui/forms/form_tab_advanced.ui index 26b6b7045..402ebe43a 100644 --- a/slsDetectorGui/forms/form_tab_advanced.ui +++ b/slsDetectorGui/forms/form_tab_advanced.ui @@ -7,7 +7,7 @@ 0 0 775 - 345 + 351 @@ -35,680 +35,773 @@ :/icons/images/refresh.png:/icons/images/refresh.png - - - true - + - 25 - 100 - 726 - 226 + 5 + 5 + 761 + 341 - - Trimming + + 2 - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - false - - - true - - - true - - - - - 15 - 25 - 696 - 195 - - - - - 12 + + + Trimming + + + + + 5 + 10 + 746 + 66 + - - - - - 0 - 0 - - - - Trimming Method: - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - 0 - 0 - - - - Exposure Time: - - - - - - - true - - - - 0 - 0 - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - Exposure time of each frame. - #exptime# - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - false - - - 5 - - - 0.000000000000000 - - - 2000000000.000000000000000 - - - 1.000000000000000 - - - - - - - true - - - - 0 - 0 - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - Qt::LeftToRight - - - 2 - - - - hr - - - - - min - - - - - s - - - - - ms - - - - - us - - - - - ns - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 50 - 20 - - - - - - - - - 0 - 0 - - - - <nobr> -Trimfile to which the resulting trimbits will be written. -</nobr><br><nobr> -An extension given by the modules serial number will be attached. -</nobr> - - - Output Trim File: - - - - - - - <nobr> -Trimfile to which the resulting trimbits will be written. -</nobr><br><nobr> -An extension given by the modules serial number will be attached. -</nobr> - - - - - - - - 0 - 0 - - - - <nobr> -Trimfile to which the resulting trimbits will be written. -</nobr><br><nobr> -An extension given by the modules serial number will be attached. -</nobr> - - - Browse - - - - :/icons/images/browse.png:/icons/images/browse.png - - - - - + + Trimbits Plot + + + true + + + false + + + + + 510 + 15 + 211 + 44 + + + - 0 - - - - - - - - 0 - 0 - - - - Start Trimming - - - - :/icons/images/start.png:/icons/images/start.png - - - - - - - true - - - - 0 - 0 - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - Exposure time of each frame. - #exptime# - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - false - - - 3 - - - 0.000000000000000 - - - 10000.000000000000000 - - - 560.000000000000000 - - - - - - - - 0 - 0 - - - - Sets the Threshold DAC - - - Threshold (DACu): - - - - - - - true - - - - 0 - 0 - - - - - 0 - 0 - - - - Optimize Settings - - - - - - - - 0 - 0 - - - - Resolution (a.u.): - - - - - - - - 0 - 0 - - - - Number of measurements (not in real time) that will be acquired. - #frames# - - - - - - - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - false - - - - - - 1 - - - 9 - - - 4 - - - - - - - - 0 - 0 - - - - - 0 - 0 - + 17 - - Adjust to Fix Count Level - - - - - Equalize to Median - - - - - - - - - 0 - 0 - - - - Counts/ Channel: - - - - - - - - 0 - 0 - - - - Number of measurements (not in real time) that will be acquired. - #frames# - - - - - - - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - false - - - - - - 0 - - - 16000000 - - - 500 - - - - - - - - - - 25 - 10 - 341 - 76 - - - - Trimbits Plot - - - true - - - false - - - - - 120 - 22 - 211 - 44 - - - - - 17 - - - - - <nobr> + + + <nobr> Updates plot with Trimbits from Shared Memory, not from Detector. </nobr> - - - false - - - Refresh - - - - :/icons/images/refresh.png:/icons/images/refresh.png - - - - 16 - 16 - - - - - - - - <nobr> + + + false + + + Refresh + + + + :/icons/images/refresh.png:/icons/images/refresh.png + + + + 16 + 16 + + + + + + + + <nobr> Plots Trimbits from Detector. This will take time. </nobr> - - - Get Trimbits - - - - :/icons/images/download.png:/icons/images/download.png - - - - - - - - - 15 - 20 - 101 - 46 - - - - - - - Histogram - - - - - - - Data Graph - - - true - - - - - - - - - - 405 - 10 - 346 - 76 - - - - Calibration Logs - - - - - - 420 - 37 - 313 - 31 - - - - - 42 - - - - - - 0 - 0 - - - - Energy Calibration - + + + Get Trimbits + + + + :/icons/images/download.png:/icons/images/download.png + + + + - - - - - - 0 - 0 - - - - Angular Calibration + + + + 25 + 20 + 187 + 31 + + + + + + Data Graph + + + true + + + + + + + Histogram + + + + - - + + + + true + + + + 5 + 85 + 746 + 226 + + + + Trimming + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + false + + + true + + + true + + + + + 25 + 25 + 696 + 195 + + + + + 12 + + + + + + 0 + 0 + + + + Trimming Method: + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + + 0 + 0 + + + + Exposure Time: + + + + + + + true + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Exposure time of each frame. + #exptime# + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + false + + + 5 + + + 0.000000000000000 + + + 2000000000.000000000000000 + + + 1.000000000000000 + + + + + + + true + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Qt::LeftToRight + + + 2 + + + + hr + + + + + min + + + + + s + + + + + ms + + + + + us + + + + + ns + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 50 + 20 + + + + + + + + + 0 + 0 + + + + <nobr> +Trimfile to which the resulting trimbits will be written. +</nobr><br><nobr> +An extension given by the modules serial number will be attached. +</nobr> + + + Output Trim File: + + + + + + + <nobr> +Trimfile to which the resulting trimbits will be written. +</nobr><br><nobr> +An extension given by the modules serial number will be attached. +</nobr> + + + + + + + + 0 + 0 + + + + <nobr> +Trimfile to which the resulting trimbits will be written. +</nobr><br><nobr> +An extension given by the modules serial number will be attached. +</nobr> + + + Browse + + + + :/icons/images/browse.png:/icons/images/browse.png + + + + + + + 0 + + + + + + + + 0 + 0 + + + + Start Trimming + + + + :/icons/images/start.png:/icons/images/start.png + + + + + + + true + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Exposure time of each frame. + #exptime# + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + false + + + 3 + + + 0.000000000000000 + + + 10000.000000000000000 + + + 560.000000000000000 + + + + + + + + 0 + 0 + + + + Sets the Threshold DAC + + + Threshold (DACu): + + + + + + + true + + + + 0 + 0 + + + + + 0 + 0 + + + + Optimize Settings + + + + + + + + 0 + 0 + + + + Resolution (a.u.): + + + + + + + + 0 + 0 + + + + Number of measurements (not in real time) that will be acquired. + #frames# + + + + + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + false + + + + + + 1 + + + 9 + + + 4 + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + Adjust to Fix Count Level + + + + + Equalize to Median + + + + + + + + + 0 + 0 + + + + Counts/ Channel: + + + + + + + + 0 + 0 + + + + Number of measurements (not in real time) that will be acquired. + #frames# + + + + + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + false + + + + + + 0 + + + 16000000 + + + 500 + + + + + + + + + + Logs + + + + + 5 + 10 + 746 + 66 + + + + Calibration Logs + + + + + 25 + 20 + 313 + 31 + + + + + 42 + + + + + + 0 + 0 + + + + Energy Calibration + + + + + + + + 0 + 0 + + + + Angular Calibration + + + + + + + + + + Readout + + + + + 10 + 10 + 136 + 31 + + + + + 42 + + + + + ADC: + + + + + + + + 0 + 0 + + + + 5 + + + + 0 + + + + + 1 + + + + + 2 + + + + + 3 + + + + + 4 + + + + + All + + + + + + + diff --git a/slsDetectorGui/include/qTabAdvanced.h b/slsDetectorGui/include/qTabAdvanced.h index 2d9705640..ec4dc68b2 100644 --- a/slsDetectorGui/include/qTabAdvanced.h +++ b/slsDetectorGui/include/qTabAdvanced.h @@ -56,6 +56,11 @@ private: private slots: + + /** Set ADC Readout + */ + void SetADCReadout(int i); + /** Enable/Disable Energy and Calibration Logs */ void SetLogs(); @@ -102,6 +107,10 @@ private slots: private: /** The sls detector object */ multiSlsDetector *myDet; + + /** detector type */ + slsDetectorDefs::detectorType detType; + /** The Plot widget */ qDrawPlot *myPlot; diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp index 7f6e9f5a2..dd587d343 100644 --- a/slsDetectorGui/src/qTabAdvanced.cpp +++ b/slsDetectorGui/src/qTabAdvanced.cpp @@ -40,11 +40,22 @@ qTabAdvanced::~qTabAdvanced(){ void qTabAdvanced::SetupWidgetWindow(){ //executed even for non digital, so make sure its necessary - slsDetectorDefs::detectorType detType = myDet->getDetectorsType(); + + //readout adc + lblADC->setEnabled(false); + comboADC->setEnabled(false); + + detType = myDet->getDetectorsType(); switch(detType){ case slsDetectorDefs::MYTHEN: isEnergy = true; isAngular = true; break; case slsDetectorDefs::EIGER: isEnergy = true; isAngular = false; break; - case slsDetectorDefs::GOTTHARD: isEnergy = false; isAngular = true; break; + + case slsDetectorDefs::GOTTHARD: + isEnergy = false; + isAngular = true; + lblADC->setEnabled(true); + comboADC->setEnabled(true); + break; default: break; } @@ -118,6 +129,21 @@ void qTabAdvanced::Initialization(){ connect(btnGroup, SIGNAL(buttonClicked(int)), this, SLOT(UpdateTrimbitPlot(int))); } + if(detType==slsDetectorDefs::GOTTHARD) + connect(comboADC, SIGNAL(currentIndexChanged(int)), this, SLOT(SetADCReadout(int))); + +} + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabAdvanced::SetADCReadout(int i){ + + if(i==6) i=-1; + if(myDet->configureMAC(i)==slsDetectorDefs::FAIL) + qDefs::Message(qDefs::WARNING,"Could not configure mac","Advanced"); + else + qDefs::Message(qDefs::WARNING,"ADC Readout successfully set up","Advanced"); } From 1d1e5e1202522ffeab52b3ab83a85eff9001e9b0 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Thu, 31 Jan 2013 15:42:04 +0000 Subject: [PATCH 142/332] included shortframe in gui for time being its just adc selection git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@142 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qTabAdvanced.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp index dd587d343..769b05423 100644 --- a/slsDetectorGui/src/qTabAdvanced.cpp +++ b/slsDetectorGui/src/qTabAdvanced.cpp @@ -139,7 +139,7 @@ void qTabAdvanced::Initialization(){ void qTabAdvanced::SetADCReadout(int i){ - if(i==6) i=-1; + if(i==5) i=-1; if(myDet->configureMAC(i)==slsDetectorDefs::FAIL) qDefs::Message(qDefs::WARNING,"Could not configure mac","Advanced"); else From aec136cf21ac7b3950f05cc8d828f08a7b012e11 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 6 Feb 2013 15:23:35 +0000 Subject: [PATCH 143/332] added error mask properly inherited by base; mask exist only for cannot connect to detector, receiver and could not configure mac git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@143 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qDefs.h | 60 ++++++++++------------------ slsDetectorGui/src/qDetectorMain.cpp | 5 +-- 2 files changed, 22 insertions(+), 43 deletions(-) diff --git a/slsDetectorGui/include/qDefs.h b/slsDetectorGui/include/qDefs.h index 614115073..bf5d29634 100644 --- a/slsDetectorGui/include/qDefs.h +++ b/slsDetectorGui/include/qDefs.h @@ -9,7 +9,6 @@ #define QDEFS_H #include "sls_detector_defs.h" -#include "error_defs.h" #include "slsDetector.h" #include "multiSlsDetector.h" #include @@ -179,55 +178,36 @@ static const int64_t GUI_VERSION=0x20121213; //------------------------------------------------------------------------------------------------------------------------------------------------- - /**checks error mask and displays the message if it exists + /**gets error mask and displays the message if it exists * @param myDet is the multidetector object /returns error message else an empty string * */ static string checkErrorMessage(multiSlsDetector*& myDet){ - int multiMask,slsMask=0; - MessageIndex errorLevel= WARNING; - slsDetector *det; + + int errorLevel= (int)WARNING; string retval=""; - char sNumber[100]; size_t pos; - //multidetector error mask - multiMask = myDet->getErrorMask(); - if(multiMask){ - retval.append(""); - //check every sls detector - for(int i=0;igetNumberOfDetectors();i++){ - slsMask=0; - //if the detector has error - if(multiMask&(1<")); - //get sls det error mask - det = myDet->getSlsDetector(i); - slsMask=det->getErrorMask(); -#ifdef VERYVERBOSE - //append sls det error mask - sprintf(sNumber,"0x%x",slsMask); - retval.append("Error Mask " + string(sNumber)+string("\n")); -#endif - //get the error critical level - if((slsMask>0xFFFF)|errorLevel) - errorLevel = CRITICAL; - //append error message - retval.append(string("") + errorDefs::getErrorMessage(slsMask)+string("")); - //replace all \n with
- pos = 0; - while((pos = retval.find("\n", pos)) != string::npos){ - retval.replace(pos, 1, "
"); - pos += 1; - } - } + + retval = myDet->getErrorMessage(errorLevel); + + if(!retval.empty()){ + + //replace all \n with
+ pos = 0; + while((pos = retval.find("\n", pos)) != string::npos){ + retval.replace(pos, 1, "
"); + pos += 1; } - retval.append("
"); - qDefs::Message(errorLevel,retval,"Main"); + + retval.insert(0,""); + retval.append(""); + + //display message + qDefs::Message((MessageIndex)errorLevel,retval,"Main"); } + return retval; }; diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index a4aa73381..833d58980 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -19,7 +19,6 @@ #include "multiSlsDetector.h" #include "sls_detector_defs.h" #include "svnInfoGui.h" -#include "error_defs.h" // Qt Include Headers #include #include @@ -234,9 +233,9 @@ void qDetectorMain::SetUpDetector(const string fName){ } setWindowTitle("SLS Detector GUI : "+ QString(slsDetectorBase::getDetectorType(detType).c_str())+ " - "+QString(host.c_str())); -#ifdef VERBOSE +//#ifdef VERBOSE cout << endl << "Type : " << slsDetectorBase::getDetectorType(detType) << "\nDetector : " << host << endl; -#endif +//#endif myDet->setOnline(slsDetectorDefs::ONLINE_FLAG); } From f3eb9c924f5490474e0aee6a33fddbb8f2e96553 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Thu, 7 Feb 2013 17:34:16 +0000 Subject: [PATCH 144/332] included network tab in gui, correctedmulti to be able to clear sls detectors error mask,included coud not set up network parameter error git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@144 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_advanced.ui | 693 ++++++++++++++++++- slsDetectorGui/forms/form_tab_measurement.ui | 4 +- slsDetectorGui/include/qDefs.h | 1 + slsDetectorGui/include/qTabAdvanced.h | 50 +- slsDetectorGui/src/qDetectorMain.cpp | 2 - slsDetectorGui/src/qTabAdvanced.cpp | 376 +++++++++- slsDetectorGui/src/qTabMessages.cpp | 4 +- 7 files changed, 1103 insertions(+), 27 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_advanced.ui b/slsDetectorGui/forms/form_tab_advanced.ui index 402ebe43a..60384eccb 100644 --- a/slsDetectorGui/forms/form_tab_advanced.ui +++ b/slsDetectorGui/forms/form_tab_advanced.ui @@ -35,17 +35,26 @@ :/icons/images/refresh.png:/icons/images/refresh.png - + 5 - 5 + 3 761 - 341 + 343 + + + + + QTabWidget::North + - 2 + 3 + + + Qt::ElideLeft @@ -802,6 +811,682 @@ An extension given by the modules serial number will be attached. + + + Network + + + + + 10 + 10 + 336 + 96 + + + + Detector Ports + + + + + 20 + 25 + 296 + 56 + + + + + -1 + + + + + + 0 + 0 + + + + + 180 + 0 + + + + + 127 + 16777215 + + + + Sets Control Port +#port# + + + + + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + false + + + + + + 0 + + + 2000000000 + + + 0 + + + + + + + + 0 + 0 + + + + Control Port: + + + + + + + + 0 + 0 + + + + Stop Port: + + + + + + + + 0 + 0 + + + + + 180 + 0 + + + + Sets Stop Port +#stopport# + + + + + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + false + + + + + + 0 + + + 2000000000 + + + 0 + + + + + + gridLayoutWidget_5 + dispFileName + gridLayoutWidget_7 + + + + + 410 + 10 + 336 + 96 + + + + Receiver Ports + + + + + 20 + 25 + 296 + 56 + + + + + -1 + + + + + + 0 + 0 + + + + UDP Port: + + + + + + + + 0 + 0 + + + + TCP Port: + + + + + + + + 0 + 0 + + + + + 127 + 0 + + + + Sets Receiver TCP Port +#rx_tcpport# + + + + + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + false + + + + + + 0 + + + 2000000000 + + + 0 + + + + + + + + 0 + 0 + + + + + 127 + 0 + + + + Sets Receiver UDP Port +#rx_udpport# + + + + + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + false + + + + + + 0 + + + 2000000000 + + + 0 + + + + + + + + + + 410 + 120 + 336 + 156 + + + + Receiver Parameters + + + + + 20 + 25 + 296 + 116 + + + + + -1 + + + + + + 0 + 0 + + + + + 180 + 0 + + + + Sets the Receiver Hostname, connects to it and gets the receiver mac address and eth. Sets some receiver parameters like file name, file dir, file index in receiver. +#rx_hostname# + + + none + + + + + + + + 0 + 0 + + + + UDP MAC: + + + + + + + + 0 + 0 + + + + + 180 + 0 + + + + Sets the Receiver UDP MAC +#rx_udpmac# + + + none + + + + + + + + 0 + 0 + + + + UDP IP: + + + + + + + + 0 + 0 + + + + Online: + + + + + + + + 0 + 0 + + + + Hostname / IP: + + + + + + + + 0 + 0 + + + + + 180 + 0 + + + + Sets the Receiver UDP IP +#rx_udpip# + + + none + + + + + + + + 0 + 0 + + + + <nobr>If the receiver is online<br>#r_online#</nobr>< + + + + Offline + + + + + Online + + + + + + + + + + + 10 + 120 + 336 + 156 + + + + Detector Parameters + + + + + 20 + 25 + 296 + 116 + + + + + -1 + + + + + + 0 + 0 + + + + Hostname / IP: + + + + + + + + 0 + 0 + + + + + 180 + 0 + + + + Sets the detector MAC to send packets to receiver +#detectormac# + + + + + + + + + + + 0 + 0 + + + + MAC: + + + + + + + + 0 + 0 + + + + + 180 + 0 + + + + Detector Hostname #hostname# + + + + + + false + + + 0 + + + true + + + + + + + + 0 + 0 + + + + Online: + + + + + + + + 0 + 0 + + + + IP: + + + + + + + + 0 + 0 + + + + + 180 + 0 + + + + Sets the detector IP to send packets to receiver +#detectorip# + + + + + + + + + + + 0 + 0 + + + + <nobr>If the detector is online<br>#online#</nobr>< + + + + Offline + + + + + Online + + + + + + + + + + + 410 + 285 + 336 + 25 + + + + Set Receiver + + + + + + 10 + 285 + 336 + 25 + + + + Configure MAC + + + diff --git a/slsDetectorGui/forms/form_tab_measurement.ui b/slsDetectorGui/forms/form_tab_measurement.ui index 98a81f770..24f6556c1 100644 --- a/slsDetectorGui/forms/form_tab_measurement.ui +++ b/slsDetectorGui/forms/form_tab_measurement.ui @@ -481,8 +481,8 @@ - Settings of the detector. - #settings# + Timing Mode of the detector. + #timing# diff --git a/slsDetectorGui/include/qDefs.h b/slsDetectorGui/include/qDefs.h index bf5d29634..f8836e63a 100644 --- a/slsDetectorGui/include/qDefs.h +++ b/slsDetectorGui/include/qDefs.h @@ -208,6 +208,7 @@ static const int64_t GUI_VERSION=0x20121213; qDefs::Message((MessageIndex)errorLevel,retval,"Main"); } + myDet->clearAllErrorMask(); return retval; }; diff --git a/slsDetectorGui/include/qTabAdvanced.h b/slsDetectorGui/include/qTabAdvanced.h index ec4dc68b2..b0961e192 100644 --- a/slsDetectorGui/include/qTabAdvanced.h +++ b/slsDetectorGui/include/qTabAdvanced.h @@ -38,12 +38,11 @@ public: */ ~qTabAdvanced(); +public slots: /** To refresh and update widgets */ void Refresh(); - - private: /** Sets up the widget */ @@ -104,6 +103,49 @@ private slots: */ void UpdateTrimbitPlot(int id); + /** Sets control port + * @param port control port + */ + void SetControlPort(int port); + + /** Sets stop port + * @param port stop port + */ + void SetStopPort(int port); + + /** Sets receiver tcp port + * @param port receiver tcp port + */ + void SetRxrTCPPort(int port); + + /** Sets receiver udp port + * @param port receiver udp port + */ + void SetRxrUDPPort(int port); + + /** Sets receiver online + * @param index 1 for online and 0 for offline + */ + void SetReceiverOnline(int index); + + /** Sets detector online + * @param index 1 for online and 0 for offline + */ + void SetOnline(int index); + + /** Sets network parameters like receiver udp ip, + * receiver udp mac, detector ip and detector mac + */ + void SetNetworkParameters(); + + /** Sets the receiver. which also sets the receiver parameters + */ + void SetReceiver(); + + /** Configures mac + */ + void Configuremac(); + private: /** The sls detector object */ multiSlsDetector *myDet; @@ -119,6 +161,9 @@ private: /** Tool Tip for the output dir */ QString outputDirTip; QString errOutputTip; + QString errOnlineTip; + QString detOnlineTip; + QString rxrOnlineTip; QPalette red; /** Trimming mode */ @@ -127,6 +172,7 @@ private: bool isEnergy; bool isAngular; + }; diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 833d58980..afde69957 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -308,7 +308,6 @@ void qDetectorMain::LoadConfigFile(const string fName){ qDefs::Message(qDefs::INFORMATION,"The Configuration Parameters have been loaded successfully at start up.","Main"); qDefs::checkErrorMessage(myDet); - myDet->clearErrorMask(); } } @@ -540,7 +539,6 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ tab_plot->Refresh(); } qDefs::checkErrorMessage(myDet); - myDet->clearErrorMask(); } diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp index 769b05423..75a5b73ee 100644 --- a/slsDetectorGui/src/qTabAdvanced.cpp +++ b/slsDetectorGui/src/qTabAdvanced.cpp @@ -39,11 +39,33 @@ qTabAdvanced::~qTabAdvanced(){ void qTabAdvanced::SetupWidgetWindow(){ + //executed even for non digital, so make sure its necessary //readout adc lblADC->setEnabled(false); comboADC->setEnabled(false); + //Network + lblIP->setEnabled(false); + lblMAC->setEnabled(false); + dispIP->setEnabled(false); + dispMAC->setEnabled(false); + boxRxrPorts->setEnabled(false); + boxRxr->setEnabled(false); + btnRxr->setEnabled(false); + btnConfigure->setEnabled(false); + + + red = QPalette(); + red.setColor(QPalette::Active,QPalette::WindowText,Qt::red); + outputDirTip = dispFile->toolTip(); + errOutputTip = QString("

" + "Output Trim File should contain both existing directory and a file name.
" + "The extensions are automatically added.

" + "Enter valid Output Trim File to enable Start Trimming button.
"); + detOnlineTip = comboOnline->toolTip(); + rxrOnlineTip = comboRxrOnline->toolTip(); + errOnlineTip = QString("

It is offline!"); detType = myDet->getDetectorsType(); switch(detType){ @@ -55,12 +77,20 @@ void qTabAdvanced::SetupWidgetWindow(){ isAngular = true; lblADC->setEnabled(true); comboADC->setEnabled(true); + lblIP->setEnabled(true); + lblMAC->setEnabled(true); + dispIP->setEnabled(true); + dispMAC->setEnabled(true); + boxRxrPorts->setEnabled(true); + boxRxr->setEnabled(true); + btnRxr->setEnabled(true); + btnConfigure->setEnabled(true); break; default: break; } - + //logs if(!isAngular && !isEnergy) boxLogs->setEnabled(false); else{ if(!isAngular) chkAngularLog->setEnabled(false); @@ -68,16 +98,7 @@ void qTabAdvanced::SetupWidgetWindow(){ chkEnergyLog->setEnabled(false); boxPlot->setEnabled(false); boxTrimming->setEnabled(false); - } - else{ - outputDirTip = dispFile->toolTip(); - errOutputTip = QString("

" - "Output Trim File should contain both existing directory and a file name.
" - "The extensions are automatically added.

" - "Enter valid Output Trim File to enable Start Trimming button.
"); - red = QPalette(); - red.setColor(QPalette::Active,QPalette::WindowText,Qt::red); - + }else{ boxTrimming->setChecked(false); SetOptimize(false); @@ -85,9 +106,44 @@ void qTabAdvanced::SetupWidgetWindow(){ btnGroup->addButton(btnRefresh,0); btnGroup->addButton(btnGetTrimbits,1); } - - Initialization(); } + + + //network + spinControlPort->setValue(myDet->setPort(slsDetectorDefs::CONTROL_PORT,-1)); + spinStopPort->setValue(myDet->setPort(slsDetectorDefs::STOP_PORT,-1)); + spinTCPPort->setValue(myDet->setPort(slsDetectorDefs::DATA_PORT,-1)); + spinUDPPort->setValue(atoi(myDet->getNetworkParameter(slsDetectorDefs::RECEIVER_UDP_PORT))); + + dispHostname->setText(QString(myDet->getHostname().c_str())); + dispIP->setText(QString(myDet->getNetworkParameter(slsDetectorDefs::DETECTOR_IP))); + dispMAC->setText(QString(myDet->getNetworkParameter(slsDetectorDefs::DETECTOR_MAC))); + dispRxrHostname->setText(QString(myDet->getNetworkParameter(slsDetectorDefs::RECEIVER_HOSTNAME))); + dispUDPIP->setText(QString(myDet->getNetworkParameter(slsDetectorDefs::RECEIVER_UDP_IP))); + dispUDPMAC->setText(QString(myDet->getNetworkParameter(slsDetectorDefs::RECEIVER_UDP_MAC))); + + + //check if its online and set it to red if offline + myDet->checkOnline(); + myDet->checkReceiverOnline(); + comboOnline->setCurrentIndex(myDet->setOnline()); + comboRxrOnline->setCurrentIndex(myDet->setReceiverOnline()); + if(!comboOnline->currentIndex()){ + comboOnline->setToolTip(detOnlineTip + errOnlineTip); + lblOnline->setToolTip(detOnlineTip + errOnlineTip); + lblOnline->setPalette(red); + lblOnline->setText("Online:*"); + } + if((comboRxrOnline->isEnabled())&&(!comboRxrOnline->currentIndex())){ + comboRxrOnline->setToolTip(rxrOnlineTip + errOnlineTip); + lblRxrOnline->setToolTip(rxrOnlineTip + errOnlineTip); + lblRxrOnline->setPalette(red); + lblRxrOnline->setText("Online:*"); + } + + + Initialization(); + } @@ -95,6 +151,9 @@ void qTabAdvanced::SetupWidgetWindow(){ void qTabAdvanced::Initialization(){ + + connect(tabAdvancedSettings,SIGNAL(currentChanged(int)), this, SLOT(Refresh())); + //energy/angular logs if(isAngular) connect(chkEnergyLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs())); @@ -129,8 +188,29 @@ void qTabAdvanced::Initialization(){ connect(btnGroup, SIGNAL(buttonClicked(int)), this, SLOT(UpdateTrimbitPlot(int))); } - if(detType==slsDetectorDefs::GOTTHARD) - connect(comboADC, SIGNAL(currentIndexChanged(int)), this, SLOT(SetADCReadout(int))); + //network + connect(spinControlPort, SIGNAL(valueChanged(int)), this, SLOT(SetControlPort(int))); + connect(spinStopPort, SIGNAL(valueChanged(int)), this, SLOT(SetStopPort(int))); + connect(comboOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetOnline(int))); + + if(detType==slsDetectorDefs::GOTTHARD){ + //readout + connect(comboADC, SIGNAL(currentIndexChanged(int)), this, SLOT(SetADCReadout(int))); + + //network + connect(spinTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int))); + connect(spinUDPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrUDPPort(int))); + connect(comboRxrOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetReceiverOnline(int))); + + connect(dispIP, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters())); + connect(dispMAC, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters())); + connect(dispUDPIP, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters())); + connect(dispUDPMAC, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters())); + + connect(btnRxr, SIGNAL(clicked()), this, SLOT(SetReceiver())); + connect(btnConfigure, SIGNAL(clicked()), this, SLOT(Configuremac())); + + } } @@ -408,10 +488,186 @@ void qTabAdvanced::UpdateTrimbitPlot(int id){ //------------------------------------------------------------------------------------------------------------------------------------------------- +void qTabAdvanced::SetControlPort(int port){ +#ifdef VERBOSE + cout << "Setting Control Port:" << port << endl; +#endif + disconnect(spinControlPort, SIGNAL(valueChanged(int)), this, SLOT(SetControlPort(int))); + spinStopPort->setValue(myDet->setPort(slsDetectorDefs::CONTROL_PORT,port)); + qDefs::checkErrorMessage(myDet); + connect(spinControlPort, SIGNAL(valueChanged(int)), this, SLOT(SetControlPort(int))); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabAdvanced::SetStopPort(int port){ +#ifdef VERBOSE + cout << "Setting Stop Port:" << port << endl; +#endif + disconnect(spinStopPort, SIGNAL(valueChanged(int)), this, SLOT(SetStopPort(int))); + spinControlPort->setValue(myDet->setPort(slsDetectorDefs::STOP_PORT,port)); + qDefs::checkErrorMessage(myDet); + connect(spinStopPort, SIGNAL(valueChanged(int)), this, SLOT(SetStopPort(int))); + +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabAdvanced::SetRxrTCPPort(int port){ +#ifdef VERBOSE + cout << "Setting Receiver TCP Port:" << port << endl; +#endif + disconnect(spinTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int))); + spinTCPPort->setValue(myDet->setPort(slsDetectorDefs::DATA_PORT,port)); + qDefs::checkErrorMessage(myDet); + connect(spinTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int))); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabAdvanced::SetRxrUDPPort(int port){ +#ifdef VERBOSE + cout << "Setting Receiver UDP Port:" << port << endl; +#endif + char sNumber[100]; + sprintf(sNumber,"%d",port); + + disconnect(spinUDPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrUDPPort(int))); + spinUDPPort->setValue(atoi(myDet->setNetworkParameter(slsDetectorDefs::RECEIVER_UDP_PORT,sNumber))); + qDefs::checkErrorMessage(myDet); + connect(spinUDPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrUDPPort(int))); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabAdvanced::SetReceiverOnline(int index){ +#ifdef VERBOSE + cout << "Setting Reciever Online to :" << index << endl; +#endif + disconnect(comboRxrOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetReceiverOnline(int))); + comboRxrOnline->setCurrentIndex(myDet->setReceiverOnline(index)); + qDefs::checkErrorMessage(myDet); + connect(comboRxrOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetReceiverOnline(int))); + //highlight in red if offline + if(!comboRxrOnline->currentIndex()){ + comboRxrOnline->setToolTip(rxrOnlineTip + errOnlineTip); + lblRxrOnline->setToolTip(rxrOnlineTip + errOnlineTip); + lblRxrOnline->setPalette(red); + lblRxrOnline->setText("Online:*"); + }else{ + comboRxrOnline->setToolTip(rxrOnlineTip); + lblRxrOnline->setToolTip(rxrOnlineTip); + lblRxrOnline->setPalette(lblHostname->palette()); + lblRxrOnline->setText("Online:"); + } +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabAdvanced::SetOnline(int index){ +#ifdef VERBOSE + cout << "Setting Detector Online to " << index << endl; +#endif + disconnect(comboOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetOnline(int))); + comboOnline->setCurrentIndex(myDet->setOnline(index)); + qDefs::checkErrorMessage(myDet); + connect(comboOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetOnline(int))); + //highlight in red if offline + if(!comboOnline->currentIndex()){ + comboOnline->setToolTip(detOnlineTip + errOnlineTip); + lblOnline->setToolTip(detOnlineTip + errOnlineTip); + lblOnline->setPalette(red); + lblOnline->setText("Online:*"); + }else{ + comboOnline->setToolTip(detOnlineTip); + lblOnline->setToolTip(detOnlineTip); + lblOnline->setPalette(lblHostname->palette()); + lblOnline->setText("Online:"); + } + +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabAdvanced::SetNetworkParameters(){ +#ifdef VERBOSE + cout << "Setting Network Parametrs" << endl; +#endif + disconnect(dispIP, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters())); + disconnect(dispMAC, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters())); + disconnect(dispUDPIP, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters())); + disconnect(dispUDPMAC, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters())); + + dispIP->setText(QString(myDet->setNetworkParameter(slsDetectorDefs::DETECTOR_IP,dispIP->text().toAscii().constData()))); + dispMAC->setText(QString(myDet->setNetworkParameter(slsDetectorDefs::DETECTOR_MAC,dispMAC->text().toAscii().constData()))); + dispUDPIP->setText(QString(myDet->setNetworkParameter(slsDetectorDefs::RECEIVER_UDP_IP,dispUDPIP->text().toAscii().constData()))); + dispUDPMAC->setText(QString(myDet->setNetworkParameter(slsDetectorDefs::RECEIVER_UDP_MAC,dispUDPMAC->text().toAscii().constData()))); + qDefs::checkErrorMessage(myDet); + + connect(dispIP, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters())); + connect(dispMAC, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters())); + connect(dispUDPIP, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters())); + connect(dispUDPMAC, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters())); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabAdvanced::SetReceiver(){ +#ifdef VERBOSE + cout << "Setting Receiver" << endl; +#endif + dispRxrHostname->setText(QString(myDet->setNetworkParameter(slsDetectorDefs::RECEIVER_HOSTNAME,dispRxrHostname->text().toAscii().constData()))); + qDefs::checkErrorMessage(myDet); + Refresh(); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabAdvanced::Configuremac(){ +#ifdef VERBOSE + cout << "Configuring Mac:" << endl; +#endif + int adc = comboADC->currentIndex(); + if(adc==5) adc=-1; + myDet->configureMAC(adc); + // qDefs::Message(qDefs::WARNING,"Could not configure mac","Advanced"); + //else + // qDefs::Message(qDefs::WARNING,"ADC Readout successfully set up","Advanced"); + qDefs::checkErrorMessage(myDet); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + void qTabAdvanced::Refresh(){ #ifdef VERBOSE cout << endl << "**Updating Advanced Tab" << endl; #endif + //setting color of tab + //void setTabBar ( QTabBar * tb ) + //QTabBar * tabBar () const + /* + for(int i=0;itabBar()->setTabTextColor(i,defaultTabColor); + tabAdvancedSettings->tabBar()->setTabTextColor(index,QColor(0,0,200,255)); + */ if(isAngular){ #ifdef VERBOSE @@ -466,6 +722,96 @@ void qTabAdvanced::Refresh(){ connect(spinThreshold, SIGNAL(valueChanged(double)), this, SLOT(SetThreshold())); } + + //network + //so that updated status + myDet->checkOnline(); + dispHostname->setText(QString(myDet->getHostname().c_str())); + //disconnect + disconnect(spinControlPort, SIGNAL(valueChanged(int)), this, SLOT(SetControlPort(int))); + disconnect(spinStopPort, SIGNAL(valueChanged(int)), this, SLOT(SetStopPort(int))); + disconnect(comboOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetOnline(int))); + + spinControlPort->setValue(myDet->setPort(slsDetectorDefs::CONTROL_PORT,-1)); + spinStopPort->setValue(myDet->setPort(slsDetectorDefs::STOP_PORT,-1)); + comboOnline->setCurrentIndex(myDet->setOnline()); + //connect + connect(spinControlPort, SIGNAL(valueChanged(int)), this, SLOT(SetControlPort(int))); + connect(spinStopPort, SIGNAL(valueChanged(int)), this, SLOT(SetStopPort(int))); + connect(comboOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetOnline(int))); + + + + if(detType==slsDetectorDefs::GOTTHARD){ + //disconnect + disconnect(comboADC, SIGNAL(currentIndexChanged(int)), this, SLOT(SetADCReadout(int))); + disconnect(spinTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int))); + disconnect(spinUDPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrUDPPort(int))); + disconnect(comboRxrOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetReceiverOnline(int))); + disconnect(dispIP, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters())); + disconnect(dispMAC, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters())); + disconnect(dispUDPIP, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters())); + disconnect(dispUDPMAC, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters())); + disconnect(btnRxr, SIGNAL(clicked()), this, SLOT(SetReceiver())); + disconnect(btnConfigure, SIGNAL(clicked()), this, SLOT(Configuremac())); + + //so that updated status + myDet->checkReceiverOnline(); + dispRxrHostname->setText(QString(myDet->getNetworkParameter(slsDetectorDefs::RECEIVER_HOSTNAME))); + + spinTCPPort->setValue(myDet->setPort(slsDetectorDefs::DATA_PORT,-1)); + spinUDPPort->setValue(atoi(myDet->getNetworkParameter(slsDetectorDefs::RECEIVER_UDP_PORT))); + + dispIP->setText(QString(myDet->getNetworkParameter(slsDetectorDefs::DETECTOR_IP))); + dispMAC->setText(QString(myDet->getNetworkParameter(slsDetectorDefs::DETECTOR_MAC))); + + comboRxrOnline->setCurrentIndex(myDet->setReceiverOnline()); + dispUDPIP->setText(QString(myDet->getNetworkParameter(slsDetectorDefs::RECEIVER_UDP_IP))); + dispUDPMAC->setText(QString(myDet->getNetworkParameter(slsDetectorDefs::RECEIVER_UDP_MAC))); + + //connect + connect(comboADC, SIGNAL(currentIndexChanged(int)), this, SLOT(SetADCReadout(int))); + connect(spinTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int))); + connect(spinUDPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrUDPPort(int))); + connect(comboRxrOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetReceiverOnline(int))); + connect(dispIP, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters())); + connect(dispMAC, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters())); + connect(dispUDPIP, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters())); + connect(dispUDPMAC, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters())); + connect(btnRxr, SIGNAL(clicked()), this, SLOT(SetReceiver())); + connect(btnConfigure, SIGNAL(clicked()), this, SLOT(Configuremac())); + + } + + //highlight in red if detector or receiver is offline + if(!comboOnline->currentIndex()){ + comboOnline->setToolTip(detOnlineTip + errOnlineTip); + lblOnline->setToolTip(detOnlineTip + errOnlineTip); + lblOnline->setPalette(red); + lblOnline->setText("Online:*"); + }else{ + comboOnline->setToolTip(detOnlineTip); + lblOnline->setToolTip(detOnlineTip); + lblOnline->setPalette(lblHostname->palette()); + lblOnline->setText("Online:"); + } + if(comboRxrOnline->isEnabled()){ + if(!comboRxrOnline->currentIndex()){ + comboRxrOnline->setToolTip(rxrOnlineTip + errOnlineTip); + lblRxrOnline->setToolTip(rxrOnlineTip + errOnlineTip); + lblRxrOnline->setPalette(red); + lblRxrOnline->setText("Online:*"); + }else{ + comboRxrOnline->setToolTip(rxrOnlineTip); + lblRxrOnline->setToolTip(rxrOnlineTip); + lblRxrOnline->setPalette(lblHostname->palette()); + lblRxrOnline->setText("Online:"); + } + } + + + + #ifdef VERBOSE cout << "**Updated Advanced Tab" << endl << endl; #endif diff --git a/slsDetectorGui/src/qTabMessages.cpp b/slsDetectorGui/src/qTabMessages.cpp index f826ba3b5..3bbe0db9f 100644 --- a/slsDetectorGui/src/qTabMessages.cpp +++ b/slsDetectorGui/src/qTabMessages.cpp @@ -67,8 +67,8 @@ void qTabMessages::SetupWidgetWindow(){ gridLayout->addWidget(dispLog,3,0,1,5); errMsg = " Please check Messages Tab. Following message was caught:

"; - qout=new qDebugStream(std::cout,this); - qerr=new qDebugStream(std::cerr,this); + //qout=new qDebugStream(std::cout,this); + //qerr=new qDebugStream(std::cerr,this); } From 481496234732720ff32bfca1f54f30af6369ff94 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Thu, 21 Feb 2013 16:00:44 +0000 Subject: [PATCH 145/332] included setroi for multidet git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@145 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_advanced.ui | 291 +++++++++++++--------- slsDetectorGui/include/icons.qrc | 1 + slsDetectorGui/include/qTabAdvanced.h | 51 +++- slsDetectorGui/src/qDetectorMain.cpp | 4 +- slsDetectorGui/src/qTabAdvanced.cpp | 263 +++++++++++++++++-- slsDetectorGui/src/qTabSettings.cpp | 15 +- 6 files changed, 473 insertions(+), 152 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_advanced.ui b/slsDetectorGui/forms/form_tab_advanced.ui index 60384eccb..7de324bdb 100644 --- a/slsDetectorGui/forms/form_tab_advanced.ui +++ b/slsDetectorGui/forms/form_tab_advanced.ui @@ -51,11 +51,70 @@ QTabWidget::North
- 3 + 2 Qt::ElideLeft + + + Logs + + + + + 5 + 10 + 746 + 66 + + + + Calibration Logs + + + + + 25 + 20 + 313 + 31 + + + + + 42 + + + + + + 0 + 0 + + + + Energy Calibration + + + + + + + + 0 + 0 + + + + Angular Calibration + + + + + + + Trimming @@ -682,130 +741,129 @@ An extension given by the modules serial number will be attached. - - - Logs - - - - - 5 - 10 - 746 - 66 - - - - Calibration Logs - - - - - 25 - 20 - 313 - 31 - - - - - 42 - - - - - - 0 - 0 - - - - Energy Calibration - - - - - - - - 0 - 0 - - - - Angular Calibration - - - - - - - - Readout + Region of Interest - + 10 - 10 - 136 - 31 + 50 + 736 + 246 - - - 42 + + QFrame::NoFrame + + + true + + + + + 0 + 0 + 736 + 246 + + + + 1 + + + 15 + + + + + + + + 10 + 5 + 736 + 41 + + + - - - ADC: - - - - - + - + 0 0 - - 5 + + Get ROI + + + + :/icons/images/download.png:/icons/images/download.png + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + Set ROI + + + + :/icons/images/upload.png:/icons/images/upload.png + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + Clear ROI + + + + :/icons/images/close.png:/icons/images/close.png - - - 0 - - - - - 1 - - - - - 2 - - - - - 3 - - - - - 4 - - - - - All - - @@ -962,9 +1020,6 @@ An extension given by the modules serial number will be attached.
- gridLayoutWidget_5 - dispFileName - gridLayoutWidget_7 @@ -1470,7 +1525,11 @@ An extension given by the modules serial number will be attached. - Set Receiver + Set Receiver + + + + :/icons/images/start.png:/icons/images/start.png @@ -1483,7 +1542,11 @@ An extension given by the modules serial number will be attached. - Configure MAC + Configure MAC + + + + :/icons/images/start.png:/icons/images/start.png diff --git a/slsDetectorGui/include/icons.qrc b/slsDetectorGui/include/icons.qrc index abb13ecf9..3b912dce3 100644 --- a/slsDetectorGui/include/icons.qrc +++ b/slsDetectorGui/include/icons.qrc @@ -15,5 +15,6 @@ ../images/stop.png ../images/leftArrow.png ../images/rightArrow.png + ../images/upload.png diff --git a/slsDetectorGui/include/qTabAdvanced.h b/slsDetectorGui/include/qTabAdvanced.h index b0961e192..896f9f53f 100644 --- a/slsDetectorGui/include/qTabAdvanced.h +++ b/slsDetectorGui/include/qTabAdvanced.h @@ -9,17 +9,18 @@ #define QTABADVANCED_H_ #include "qDefs.h" - +#include "sls_detector_defs.h" /** Form Header */ #include "ui_form_tab_advanced.h" /** Project Class Headers */ class multiSlsDetector; +class slsDetector; /** Qt Project Class Headers */ class qDrawPlot; /** Qt Include Header */ #include - +#include /** *@short sets up the advanced parameters */ @@ -52,14 +53,13 @@ private: */ void Initialization(); - + /** Add ROI Input + * @param num number of inputs to add + */ + void AddROIInput(int num); private slots: - /** Set ADC Readout - */ - void SetADCReadout(int i); - /** Enable/Disable Energy and Calibration Logs */ void SetLogs(); @@ -146,6 +146,26 @@ private slots: */ void Configuremac(); + /** Add ROI Input if the value changed in the last slot + */ + void AddROIInputSlot(){AddROIInput(1);}; + + /** Clears all the ROI inputs + */ + void clearROI(); + + /** Gets ROIs from detector and updates it + */ + void updateROIList(); + + /** Sets ROI in detector + */ + void setROI(); + + /** Clears ROI in detector + */ + void clearROIinDetector(); + private: /** The sls detector object */ multiSlsDetector *myDet; @@ -172,6 +192,23 @@ private: bool isEnergy; bool isAngular; + /**sls detector obejct*/ + slsDetector *det; + + + /** ROI */ + vector lblFromX; + vector spinFromX; + vector lblFromY; + vector spinFromY; + vector lblToX; + vector spinToX; + vector lblToY; + vector spinToY; + int numRois; + + + }; diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index afde69957..4c4a5cd1f 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -101,13 +101,15 @@ void qDetectorMain::SetUpWidgetWindow(){ tabs = new MyTabWidget(this); layoutTabs->addWidget(tabs); + int numDet = myDet->getNumberOfDetectors(); + // creating all the other tab widgets tab_measurement = new qTabMeasurement (this, myDet,myPlot); cout<<"Measurement ready"<setEnabled(false); - comboADC->setEnabled(false); //Network lblIP->setEnabled(false); lblMAC->setEnabled(false); @@ -75,8 +72,6 @@ void qTabAdvanced::SetupWidgetWindow(){ case slsDetectorDefs::GOTTHARD: isEnergy = false; isAngular = true; - lblADC->setEnabled(true); - comboADC->setEnabled(true); lblIP->setEnabled(true); lblMAC->setEnabled(true); dispIP->setEnabled(true); @@ -142,6 +137,9 @@ void qTabAdvanced::SetupWidgetWindow(){ } + //updates roi + updateROIList(); + Initialization(); } @@ -194,8 +192,6 @@ void qTabAdvanced::Initialization(){ connect(comboOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetOnline(int))); if(detType==slsDetectorDefs::GOTTHARD){ - //readout - connect(comboADC, SIGNAL(currentIndexChanged(int)), this, SLOT(SetADCReadout(int))); //network connect(spinTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int))); @@ -212,18 +208,11 @@ void qTabAdvanced::Initialization(){ } -} -//------------------------------------------------------------------------------------------------------------------------------------------------- - - -void qTabAdvanced::SetADCReadout(int i){ - - if(i==5) i=-1; - if(myDet->configureMAC(i)==slsDetectorDefs::FAIL) - qDefs::Message(qDefs::WARNING,"Could not configure mac","Advanced"); - else - qDefs::Message(qDefs::WARNING,"ADC Readout successfully set up","Advanced"); + //roi + connect(btnClearRoi, SIGNAL(clicked()), this, SLOT(clearROIinDetector())); + connect(btnGetRoi, SIGNAL(clicked()), this, SLOT(updateROIList())); + connect(btnSetRoi, SIGNAL(clicked()), this, SLOT(setROI())); } @@ -643,12 +632,7 @@ void qTabAdvanced::Configuremac(){ #ifdef VERBOSE cout << "Configuring Mac:" << endl; #endif - int adc = comboADC->currentIndex(); - if(adc==5) adc=-1; - myDet->configureMAC(adc); - // qDefs::Message(qDefs::WARNING,"Could not configure mac","Advanced"); - //else - // qDefs::Message(qDefs::WARNING,"ADC Readout successfully set up","Advanced"); + myDet->configureMAC(); qDefs::checkErrorMessage(myDet); } @@ -656,7 +640,234 @@ void qTabAdvanced::Configuremac(){ //------------------------------------------------------------------------------------------------------------------------------------------------- +void qTabAdvanced::updateROIList(){ +#ifdef VERYVERBOSE + cout<<"in updateROIList() " << endl; +#endif + clearROI(); + + int n,i; + slsDetectorDefs::ROI* temp = myDet->getROI(n); + + if((temp!=NULL)&&(n>0)){ + //assign into array, else it loses values cuz of memory + slsDetectorDefs::ROI allroi[n]; + for(i=0;isetValue(allroi[i].xmin); + spinFromY[i]->setValue(allroi[i].ymin); + spinToX[i]->setValue(allroi[i].xmax); + spinToY[i]->setValue(allroi[i].ymax); + } + cout << "ROIs populated: " << n << endl; + } +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabAdvanced::AddROIInput(int num){ +#ifdef VERVERBOSE + cout<<"in AddROIInput() " << num << endl; +#endif + if((int)lblFromX.size()){ + disconnect(spinFromX[numRois], SIGNAL(valueChanged(int)), this, SLOT(AddROIInputSlot())); + disconnect(spinFromY[numRois], SIGNAL(valueChanged(int)), this, SLOT(AddROIInputSlot())); + disconnect(spinToX[numRois], SIGNAL(valueChanged(int)), this, SLOT(AddROIInputSlot())); + disconnect(spinToY[numRois], SIGNAL(valueChanged(int)), this, SLOT(AddROIInputSlot())); + } + + int exists = numRois+1; + int total = exists+num; + //if cleared, addding just one + if ((num==0) && (numRois==0)){ + exists = 0; + total = 1; + }/*else{ + gridRoi->removeWidget + }*/ + + for (int i=exists;i= ((int)lblFromX.size())){ + lblFromX.resize(i+1); spinFromX.resize(i+1); + lblFromY.resize(i+1); spinFromY.resize(i+1); + lblToX.resize(i+1); spinToX.resize(i+1); + lblToY.resize(i+1); spinToY.resize(i+1); + + lblFromX[i] = new QLabel("x min:"); + lblFromY[i] = new QLabel("y min:"); + lblToX[i] = new QLabel("x max:"); + lblToY[i] = new QLabel("y max:"); + spinFromX[i] = new QSpinBox(); + spinFromY[i] = new QSpinBox(); + spinToX[i] = new QSpinBox(); + spinToY[i] = new QSpinBox(); + + + lblFromX[i]->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); lblFromX[i]->setFixedWidth(50); + lblFromY[i]->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); lblFromY[i]->setFixedWidth(50); + lblToX[i]->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); lblToX[i]->setFixedWidth(50); + lblToY[i]->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); lblToY[i]->setFixedWidth(50); + spinFromX[i]->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); spinFromX[i]->setFixedWidth(80); + spinFromY[i]->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); spinFromY[i]->setFixedWidth(80); + spinToX[i]->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); spinToX[i]->setFixedWidth(80); + spinToY[i]->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); spinToY[i]->setFixedWidth(80); + spinFromX[i]->setFixedHeight(19); + spinFromY[i]->setFixedHeight(19); + spinToX[i]->setFixedHeight(19); + spinToY[i]->setFixedHeight(19); + + spinFromX[i]->setMaximum(myDet->getMaxNumberOfChannels(slsDetectorDefs::X)-1); + spinToX[i]->setMaximum(myDet->getMaxNumberOfChannels(slsDetectorDefs::X)-1); + spinFromY[i]->setMaximum(myDet->getMaxNumberOfChannels(slsDetectorDefs::Y)-1); + spinToY[i]->setMaximum(myDet->getMaxNumberOfChannels(slsDetectorDefs::Y)-1); + spinFromX[i]->setMinimum(-1); + spinToX[i]->setMinimum(-1); + spinFromY[i]->setMinimum(-1); + spinToY[i]->setMinimum(-1); + spinFromX[i]->setValue(-1); + spinFromY[i]->setValue(-1); + spinToX[i]->setValue(-1); + spinToY[i]->setValue(-1); + } + + gridRoi->addWidget(lblFromX[i], i,0,Qt::AlignTop); + gridRoi->addWidget(spinFromX[i],i,1,Qt::AlignTop); + gridRoi->addItem(new QSpacerItem(40,20,QSizePolicy::Expanding,QSizePolicy::Fixed), i,2,Qt::AlignTop); + gridRoi->addWidget(lblToX[i], i,3,Qt::AlignTop); + gridRoi->addWidget(spinToX[i], i,4,Qt::AlignTop); + gridRoi->addItem(new QSpacerItem(40,20,QSizePolicy::Expanding,QSizePolicy::Fixed), i,5,Qt::AlignTop); + gridRoi->addWidget(lblFromY[i], i,6,Qt::AlignTop); + gridRoi->addWidget(spinFromY[i],i,7,Qt::AlignTop); + gridRoi->addItem(new QSpacerItem(40,20,QSizePolicy::Expanding,QSizePolicy::Fixed), i,8,Qt::AlignTop); + gridRoi->addWidget(lblToY[i], i,9,Qt::AlignTop); + gridRoi->addWidget(spinToY[i], i,10,Qt::AlignTop); + + lblFromX[i]->show(); + spinFromX[i]->show(); + lblToX[i]->show(); + spinToX[i]->show(); + lblFromY[i]->show(); + spinFromY[i]->show(); + lblToY[i]->show(); + spinToY[i]->show(); + } + + numRois += num; + + connect(spinFromX[numRois], SIGNAL(valueChanged(int)), this, SLOT(AddROIInputSlot())); + connect(spinFromY[numRois], SIGNAL(valueChanged(int)), this, SLOT(AddROIInputSlot())); + connect(spinToX[numRois], SIGNAL(valueChanged(int)), this, SLOT(AddROIInputSlot())); + connect(spinToY[numRois], SIGNAL(valueChanged(int)), this, SLOT(AddROIInputSlot())); + +#ifdef VERYVERBOSE + cout<<"ROI Inputs added " << num << endl; +#endif +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabAdvanced::clearROI(){ +#ifdef VERYVERBOSE + cout<<"in clearROI() " << endl; +#endif + if((int)lblFromX.size()){ + disconnect(spinFromX[numRois], SIGNAL(valueChanged(int)), this, SLOT(AddROIInputSlot())); + disconnect(spinFromY[numRois], SIGNAL(valueChanged(int)), this, SLOT(AddROIInputSlot())); + disconnect(spinToX[numRois], SIGNAL(valueChanged(int)), this, SLOT(AddROIInputSlot())); + disconnect(spinToY[numRois], SIGNAL(valueChanged(int)), this, SLOT(AddROIInputSlot())); + + } + + + for (int i=0;isetValue(-1); + spinFromY[i]->setValue(-1); + spinToX[i]->setValue(-1); + spinToY[i]->setValue(-1); + } + + + //hide widget because they are still visible even when removed and layout deleted + QLayoutItem *item; + while((item = gridRoi->takeAt(0))) { + if (item->widget()){ + item->widget()->hide(); + gridRoi->removeWidget(item->widget()); + } + //if (item->spacerItem()) + } + + numRois = 0; + AddROIInput(0); + +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabAdvanced::setROI(){ +#ifdef VERYVERBOSE + cout<<"in setROI() " << endl; +#endif + + slsDetectorDefs::ROI allroi[MAX_ROIS]; + + for (int i=0;ivalue(); + allroi[i].ymin = spinFromY[i]->value(); + allroi[i].xmax = spinToX[i]->value(); + allroi[i].ymax = spinToY[i]->value(); + } + + myDet->setROI(numRois,allroi); + //qDefs::checkErrorMessage(myDet); + cout<<"ROIs set" << endl; + //get the correct list back + updateROIList(); + //configuremac + myDet->configureMAC(); + qDefs::checkErrorMessage(myDet); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabAdvanced::clearROIinDetector(){ +#ifdef VERYVERBOSE + cout<<"in clearROIinDetector() " << endl; +#endif + + if (QMessageBox::warning(this, "Clear ROI", + "Are you sure you want to clear all the ROI in detector?", + QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes){ + + clearROI(); + setROI(); +#ifdef VERBOSE + cout << "ROIs cleared" << endl; +#endif + } +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + void qTabAdvanced::Refresh(){ + + #ifdef VERBOSE cout << endl << "**Updating Advanced Tab" << endl; #endif @@ -744,7 +955,6 @@ void qTabAdvanced::Refresh(){ if(detType==slsDetectorDefs::GOTTHARD){ //disconnect - disconnect(comboADC, SIGNAL(currentIndexChanged(int)), this, SLOT(SetADCReadout(int))); disconnect(spinTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int))); disconnect(spinUDPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrUDPPort(int))); disconnect(comboRxrOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetReceiverOnline(int))); @@ -770,7 +980,6 @@ void qTabAdvanced::Refresh(){ dispUDPMAC->setText(QString(myDet->getNetworkParameter(slsDetectorDefs::RECEIVER_UDP_MAC))); //connect - connect(comboADC, SIGNAL(currentIndexChanged(int)), this, SLOT(SetADCReadout(int))); connect(spinTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int))); connect(spinUDPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrUDPPort(int))); connect(comboRxrOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetReceiverOnline(int))); @@ -810,6 +1019,8 @@ void qTabAdvanced::Refresh(){ } + //roi + updateROIList(); #ifdef VERBOSE diff --git a/slsDetectorGui/src/qTabSettings.cpp b/slsDetectorGui/src/qTabSettings.cpp index 1ce307e04..961a42de5 100644 --- a/slsDetectorGui/src/qTabSettings.cpp +++ b/slsDetectorGui/src/qTabSettings.cpp @@ -39,7 +39,9 @@ void qTabSettings::SetupWidgetWindow(){ // Settings SetupDetectorSettings(); - comboSettings->setCurrentIndex(myDet->getSettings()); + int sett = (int)myDet->getSettings(); + if(sett==-1) sett = slsDetectorDefs::UNDEFINED; + comboSettings->setCurrentIndex(sett); //threshold spinThreshold->setValue(myDet->getThresholdEnergy()); @@ -69,6 +71,7 @@ void qTabSettings::SetupWidgetWindow(){ void qTabSettings::SetupDetectorSettings(){ // Get detector settings from detector slsDetectorDefs::detectorSettings sett = myDet->getSettings(); + if(sett==-1) sett = slsDetectorDefs::UNDEFINED; // To be able to index items on a combo box model = qobject_cast(comboSettings->model()); if (model) { @@ -145,7 +148,9 @@ void qTabSettings::setSettings(int index){ if((index==Undefined)||(index==Uninitialized)){ qDefs::Message(qDefs::WARNING,"Cannot change settings to Undefined or Uninitialized.","Settings"); disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int))); - comboSettings->setCurrentIndex((int)myDet->getSettings()); + int sett = (int)myDet->getSettings(); + if(sett==-1) sett = slsDetectorDefs::UNDEFINED; + comboSettings->setCurrentIndex(sett); connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int))); } @@ -268,12 +273,14 @@ void qTabSettings::Refresh(){ cout << "Getting settings" << endl; #endif disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int))); - comboSettings->setCurrentIndex((int)myDet->getSettings()); + int sett = (int)myDet->getSettings(); + if(sett==-1) sett = slsDetectorDefs::UNDEFINED; + comboSettings->setCurrentIndex(sett); connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int))); //threshold - int sett = comboSettings->currentIndex(); + sett = comboSettings->currentIndex(); if((detType==slsDetectorDefs::MYTHEN)||(detType==slsDetectorDefs::EIGER)){ if((sett==Undefined)||(sett==Uninitialized)){ lblThreshold->setEnabled(false); From 642d7d8c74e9e37774e943bba9b325ef24e47137 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 22 Feb 2013 09:54:06 +0000 Subject: [PATCH 146/332] previous checkin is not a working version git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@146 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_advanced.ui | 22 +++++++++++----------- slsDetectorGui/images/upload.png | Bin 0 -> 721 bytes slsDetectorGui/src/qDetectorMain.cpp | 3 +-- 3 files changed, 12 insertions(+), 13 deletions(-) create mode 100644 slsDetectorGui/images/upload.png diff --git a/slsDetectorGui/forms/form_tab_advanced.ui b/slsDetectorGui/forms/form_tab_advanced.ui index 7de324bdb..6f4fbd717 100644 --- a/slsDetectorGui/forms/form_tab_advanced.ui +++ b/slsDetectorGui/forms/form_tab_advanced.ui @@ -32,7 +32,7 @@ Form - + :/icons/images/refresh.png:/icons/images/refresh.png @@ -51,7 +51,7 @@ QTabWidget::North - 2 + 0 Qt::ElideLeft @@ -164,7 +164,7 @@ Updates plot with Trimbits from Shared Memory, not from Detector. Refresh - + :/icons/images/refresh.png:/icons/images/refresh.png @@ -186,7 +186,7 @@ Plots Trimbits from Detector. This will take time. Get Trimbits - + :/icons/images/download.png:/icons/images/download.png @@ -495,7 +495,7 @@ An extension given by the modules serial number will be attached. Browse - + :/icons/images/browse.png:/icons/images/browse.png @@ -519,7 +519,7 @@ An extension given by the modules serial number will be attached. Start Trimming - + :/icons/images/start.png:/icons/images/start.png @@ -801,7 +801,7 @@ An extension given by the modules serial number will be attached. Get ROI - + :/icons/images/download.png:/icons/images/download.png @@ -831,7 +831,7 @@ An extension given by the modules serial number will be attached. Set ROI - + :/icons/images/upload.png:/icons/images/upload.png @@ -861,7 +861,7 @@ An extension given by the modules serial number will be attached. Clear ROI - + :/icons/images/close.png:/icons/images/close.png @@ -1528,7 +1528,7 @@ An extension given by the modules serial number will be attached. Set Receiver - + :/icons/images/start.png:/icons/images/start.png @@ -1545,7 +1545,7 @@ An extension given by the modules serial number will be attached. Configure MAC - + :/icons/images/start.png:/icons/images/start.png diff --git a/slsDetectorGui/images/upload.png b/slsDetectorGui/images/upload.png new file mode 100644 index 0000000000000000000000000000000000000000..d493327dbc234cbcd9f1808bd2f843d0dea6c6ba GIT binary patch literal 721 zcmV;?0xtcDP)eJtQV^6SpoN8sQIhQJ?Cj3F7PAI57Ct!d@i>?B&b^!`09?7{NSZ0?h5uQ` zDBGKxEMFf9SMRu);q;@iA1`2`=q#a_>mOs2ETcIm<^A7H1oO)aazOT0ke8Dofoa z_l~8Md7pm2#whQze7wctY;&j1%P#=|58ypZb1jz7bQukDuD@C*&j)<(=iGd~jvp4R zob7VqKnmXDe|O+jn2ikg&mBTXB{yEY=ZW6~C`N?G+UE9J4^xdO5fr_CeB^afrDZPQxX~5@X05aHPQ5jjEV8>2tCJjNVX%vfBZu+ot(eNY(9-(b0Wchvs4@TK;>aPz*jtl?zBM(a z*_7M$k)D10ii(hBom~Q*EKw<)x31h8y3^g&cVGHTBd@i{PU6~i6F;=RPiEr+qn#7` zSM9@BLjjn+`#>a0LbFr#*ED}S08~_~{#Lnt?Xvy^SRm^&4QXnm00000NkvXXu0mjf DZfZrA literal 0 HcmV?d00001 diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 4c4a5cd1f..2e9c2fa2d 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -101,7 +101,6 @@ void qDetectorMain::SetUpWidgetWindow(){ tabs = new MyTabWidget(this); layoutTabs->addWidget(tabs); - int numDet = myDet->getNumberOfDetectors(); // creating all the other tab widgets tab_measurement = new qTabMeasurement (this, myDet,myPlot); cout<<"Measurement ready"< Date: Tue, 26 Feb 2013 08:34:47 +0000 Subject: [PATCH 147/332] made advanced tab detector dependent. each set mac adress etc is done via slsdetector and not multi git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@147 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_advanced.ui | 872 +++++++++++----------- slsDetectorGui/forms/form_tab_plot.ui | 6 +- slsDetectorGui/images/calculate.png | Bin 0 -> 833 bytes slsDetectorGui/images/setup.png | Bin 0 -> 605 bytes slsDetectorGui/include/icons.qrc | 2 + slsDetectorGui/include/qDefs.h | 38 + slsDetectorGui/include/qTabAdvanced.h | 18 +- slsDetectorGui/include/svnInfoGui.h | 6 +- slsDetectorGui/src/qTabAdvanced.cpp | 187 +++-- 9 files changed, 589 insertions(+), 540 deletions(-) create mode 100644 slsDetectorGui/images/calculate.png create mode 100644 slsDetectorGui/images/setup.png diff --git a/slsDetectorGui/forms/form_tab_advanced.ui b/slsDetectorGui/forms/form_tab_advanced.ui index 6f4fbd717..3e9b1164c 100644 --- a/slsDetectorGui/forms/form_tab_advanced.ui +++ b/slsDetectorGui/forms/form_tab_advanced.ui @@ -32,7 +32,7 @@ Form - + :/icons/images/refresh.png:/icons/images/refresh.png @@ -51,7 +51,7 @@ QTabWidget::North - 0 + 3 Qt::ElideLeft @@ -164,7 +164,7 @@ Updates plot with Trimbits from Shared Memory, not from Detector. Refresh - + :/icons/images/refresh.png:/icons/images/refresh.png @@ -186,7 +186,7 @@ Plots Trimbits from Detector. This will take time. Get Trimbits - + :/icons/images/download.png:/icons/images/download.png @@ -495,7 +495,7 @@ An extension given by the modules serial number will be attached. Browse - + :/icons/images/browse.png:/icons/images/browse.png @@ -519,7 +519,7 @@ An extension given by the modules serial number will be attached. Start Trimming - + :/icons/images/start.png:/icons/images/start.png @@ -792,16 +792,22 @@ An extension given by the modules serial number will be attached. - + 0 0 + + + 150 + 0 + + Get ROI - + :/icons/images/download.png:/icons/images/download.png @@ -822,16 +828,22 @@ An extension given by the modules serial number will be attached. - + 0 0 + + + 150 + 0 + + Set ROI - + :/icons/images/upload.png:/icons/images/upload.png @@ -852,17 +864,23 @@ An extension given by the modules serial number will be attached. - + 0 0 + + + 150 + 0 + + Clear ROI - - :/icons/images/close.png:/icons/images/close.png + + :/icons/images/erase.png:/icons/images/erase.png @@ -873,193 +891,49 @@ An extension given by the modules serial number will be attached. Network - + 10 - 10 - 336 - 96 + 135 + 736 + 171 - Detector Ports + Receiver Parameters - + - 20 - 25 - 296 - 56 + 25 + 135 + 291 + 25 - - - -1 - - - - - - 0 - 0 - - - - - 180 - 0 - - - - - 127 - 16777215 - - - - Sets Control Port -#port# - - - - - - - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - false - - - - - - 0 - - - 2000000000 - - - 0 - - - - - - - - 0 - 0 - - - - Control Port: - - - - - - - - 0 - 0 - - - - Stop Port: - - - - - - - - 0 - 0 - - - - - 180 - 0 - - - - Sets Stop Port -#stopport# - - - - - - - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - false - - - - - - 0 - - - 2000000000 - - - 0 - - - - + + Setup Receiver + + + + :/icons/images/setup.png:/icons/images/setup.png + - - - - - 410 - 10 - 336 - 96 - - - - Receiver Ports - - + - 20 + 25 25 - 296 - 56 + 686 + 96 - + -1 - - - - 0 - 0 - - - - UDP Port: - - - - @@ -1072,8 +946,8 @@ An extension given by the modules serial number will be attached. - - + + 0 @@ -1082,41 +956,33 @@ An extension given by the modules serial number will be attached. - 127 + 180 0 - Sets Receiver TCP Port -#rx_tcpport# + Sets the Receiver UDP IP +#rx_udpip# - - - - - - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - false - - - - - - 0 - - - 2000000000 - - - 0 + + none - + + + + Qt::Horizontal + + + + 40 + 20 + + + + + @@ -1160,94 +1026,7 @@ An extension given by the modules serial number will be attached. - - - - - - - 410 - 120 - 336 - 156 - - - - Receiver Parameters - - - - - 20 - 25 - 296 - 116 - - - - - -1 - - - - - - 0 - 0 - - - - - 180 - 0 - - - - Sets the Receiver Hostname, connects to it and gets the receiver mac address and eth. Sets some receiver parameters like file name, file dir, file index in receiver. -#rx_hostname# - - - none - - - - - - - - 0 - 0 - - - - UDP MAC: - - - - - - - - 0 - 0 - - - - - 180 - 0 - - - - Sets the Receiver UDP MAC -#rx_udpmac# - - - none - - - - + @@ -1260,19 +1039,6 @@ An extension given by the modules serial number will be attached. - - - - - 0 - 0 - - - - Online: - - - @@ -1286,30 +1052,7 @@ An extension given by the modules serial number will be attached. - - - - - 0 - 0 - - - - - 180 - 0 - - - - Sets the Receiver UDP IP -#rx_udpip# - - - none - - - - + @@ -1332,49 +1075,8 @@ An extension given by the modules serial number will be attached. - - - - - - - 10 - 120 - 336 - 156 - - - - Detector Parameters - - - - - 20 - 25 - 296 - 116 - - - - - -1 - - - - - - 0 - 0 - - - - Hostname / IP: - - - - - + + 0 @@ -1388,29 +1090,16 @@ An extension given by the modules serial number will be attached. - Sets the detector MAC to send packets to receiver -#detectormac# + Sets the Receiver UDP MAC +#rx_udpmac# - + none - - - - - 0 - 0 - - - - MAC: - - - - - + + 0 @@ -1419,29 +1108,42 @@ An extension given by the modules serial number will be attached. - 180 + 127 0 - Detector Hostname #hostname# + Sets Receiver TCP Port +#rx_tcpport# - + - + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + false - + + + + 0 - - true + + 2000000000 + + + 0 - - + + 0 @@ -1454,7 +1156,7 @@ An extension given by the modules serial number will be attached. - + 0 @@ -1462,12 +1164,12 @@ An extension given by the modules serial number will be attached. - IP: + UDP Port: - - + + 0 @@ -1481,74 +1183,336 @@ An extension given by the modules serial number will be attached. - Sets the detector IP to send packets to receiver -#detectorip# + Sets the Receiver Hostname, connects to it and gets the receiver mac address and eth. Sets some receiver parameters like file name, file dir, file index in receiver. +#rx_hostname# - + none - - + + - + 0 0 - - <nobr>If the detector is online<br>#online#</nobr>< + + UDP MAC: - - - Offline - - - - - Online - - - + - 410 - 285 - 336 - 25 + 35 + 15 + 686 + 101 - - Set Receiver - - - - :/icons/images/start.png:/icons/images/start.png - - - - - - 10 - 285 - 336 - 25 - - - - Configure MAC - - - - :/icons/images/start.png:/icons/images/start.png - + + + -1 + + + + + + 0 + 0 + + + + + 180 + 0 + + + + <nobr>If the detector is online<br>#online#</nobr>< + + + + Offline + + + + + Online + + + + + + + + + 0 + 0 + + + + Stop Port: + + + + + + + + 0 + 0 + + + + Control Port: + + + + + + + + 0 + 0 + + + + + 180 + 0 + + + + Sets the detector IP to send packets to receiver +#detectorip# + + + + + + + + + + + 0 + 0 + + + + + 180 + 0 + + + + Sets the detector MAC to send packets to receiver +#detectormac# + + + + + + + + + + + 0 + 0 + + + + MAC: + + + + + + + + 0 + 0 + + + + + 108 + 0 + + + + Online: + + + + + + + + 0 + 0 + + + + + 108 + 0 + + + + Detector: + + + + + + + + 0 + 0 + + + + IP: + + + + + + + + 0 + 0 + + + + + 180 + 0 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 180 + 0 + + + + + 16777215 + 16777215 + + + + Sets Control Port +#port# + + + + + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + false + + + + + + 0 + + + 2000000000 + + + 0 + + + + + + + + 0 + 0 + + + + + 180 + 0 + + + + Sets Stop Port +#stopport# + + + + + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + false + + + + + + 0 + + + 2000000000 + + + 0 + + + + + boxRxr + gridLayoutWidget_7 + label_9 diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index 72063f919..44b5ad4fb 100644 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -510,7 +510,7 @@ - :/icons/images/remove.png:/icons/images/remove.png + :/icons/images/erase.png:/icons/images/erase.png @@ -585,7 +585,7 @@ - :/icons/images/add.png:/icons/images/add.png + :/icons/images/calculate.png:/icons/images/calculate.png @@ -780,7 +780,7 @@ 10 20 - 348 + 341 26 diff --git a/slsDetectorGui/images/calculate.png b/slsDetectorGui/images/calculate.png new file mode 100644 index 0000000000000000000000000000000000000000..49ac1f4b1edde0c731dc60fac54531ac07a1c358 GIT binary patch literal 833 zcmV-H1HSx;P)6XjpoM=gFqLihS!lFNL2J0duWH*_OLE;~Ycec{X&8caVx)2O9@FGOl zg3vC?l%$kFqGXt9n~GE0oC=l`%(>}0=c|pp2zue=`@Zv?_j#Y^dCy@oGBVUEl`0!R zkYN}ENo;OzLL?Hg-*kOvXNP^~a5zEyj$mtR>!Y=`wH2ngxVYM6GSxUdvxwU(g=9}O z+-^7Iayh$`7W#ZXT8xN@2!tX%J^jf1{JfnhDJe13*47$*+kOl?$8a_&6LWKONJ&Xy zi)n6bY=Fn(K`0dB4=bdmrXD2#lN7*MS664~n(T)%F%A2pWNOC*vos6wGgBLH8R{QP`V zSy|a#T1d>o_VzZ&4@waNfq*Tf9uQL@l}ZsA8ObJLkWTiEQwg;V4GniDTvOol_(+bE zV`yjyYPA|~J`dvJ2^BmZ4=W)yHa2V`G5I(F7^497jg5^}?)4QoR-8~JDKRiGfSjBh zyq)?0_2Dycxm+xOOePBhXtmmt9UUFROlfK9J;I=J%;P|`NDRfk1L*7PgGQr)bJYcf zG!Y963#^=H@4C_QybWB2gOr0wwvPJND@(%%gf6coEm}k z<7@O*x3lXN&4w3W*XNU{g!?4)bR*5Jtu0usRumKzg!MX|PE0ILqts%+%)|HKb9uOI zzW!d3jXl`n1x)B1PBkSz!L{U-EE&xG<09C!s7+;)1q9h*Pb+2pH=M7K>O=h#X z;%@+p#R77`b^%Z?5)u;d?Z*-VI{`fIe)@7cxFlhSyNAdbj|ttfe?65-B{%I{=IMB0 zjN2ax#S>3YWlO%HhQWV^&1MsHt=QVEqdga*1frkiS=x48=B4^yOP5X0&{!;d00000 LNkvXXu0mjfiE@6Y literal 0 HcmV?d00001 diff --git a/slsDetectorGui/images/setup.png b/slsDetectorGui/images/setup.png new file mode 100644 index 0000000000000000000000000000000000000000..f0323e56dde91bc0207e192f218fe708c8079213 GIT binary patch literal 605 zcmV-j0;2tiP)Y`goF)^44yMGF&=&L`0-p;Wy`OI1P5uodG(6n$H z7cO0z_2R|zth&0ozXT1)NY9YY&dI*X&c?{QLKBxp)l- z3JhXQPfgp-#m(uoY4euY?w;gwuDii(OmR8&-5wY9Y(@fxsh&AMzu1N|v`_U`FT zO;0a@iCbD)^7HcYhV0t4Yc5U$PRx_c6)|1b{^-S@drOxuH=R3g-cM}muo|$Toi)M1 zTw>n4_um<}U)G7pZaAvU$dFINS7i;$aSDU+);WJSNr1&rh zWCrn^QB@RFe(>ly!^XpZ5^Lu$EWj5|ClX zL>aKShB3k2MtnZQzuydJuD<)VYtfe;Js7@=Q>5|DgCU5Q7Z<38nvly)dne-&vIR^PE|m{_Wm< rnqf6i=nD{oqV5|Me@D{v7uf{>CyUmhTzF(#00000NkvXXu0mjfGm$YO literal 0 HcmV?d00001 diff --git a/slsDetectorGui/include/icons.qrc b/slsDetectorGui/include/icons.qrc index 3b912dce3..26f0b5da7 100644 --- a/slsDetectorGui/include/icons.qrc +++ b/slsDetectorGui/include/icons.qrc @@ -16,5 +16,7 @@ ../images/leftArrow.png ../images/rightArrow.png ../images/upload.png + ../images/setup.png + ../images/calculate.png diff --git a/slsDetectorGui/include/qDefs.h b/slsDetectorGui/include/qDefs.h index f8836e63a..919ca26f7 100644 --- a/slsDetectorGui/include/qDefs.h +++ b/slsDetectorGui/include/qDefs.h @@ -213,6 +213,44 @@ static const int64_t GUI_VERSION=0x20121213; }; +//------------------------------------------------------------------------------------------------------------------------------------------------- + + /**gets error mask and displays the message if it exists + * @param myDet is the slsdetector object + /returns error message else an empty string + * */ + static string checkErrorMessage(slsDetector*& myDet){ + + + int errorLevel= (int)WARNING; + string retval=""; + size_t pos; + + + retval = myDet->getErrorMessage(errorLevel); + + if(!retval.empty()){ + + //replace all \n with
+ pos = 0; + while((pos = retval.find("\n", pos)) != string::npos){ + retval.replace(pos, 1, "
"); + pos += 1; + } + + retval.insert(0,""); + retval.append("
"); + + //display message + qDefs::Message((MessageIndex)errorLevel,retval,"Main"); + } + + myDet->clearErrorMask(); + + return retval; + }; + + //------------------------------------------------------------------------------------------------------------------------------------------------- }; diff --git a/slsDetectorGui/include/qTabAdvanced.h b/slsDetectorGui/include/qTabAdvanced.h index 896f9f53f..05e5f6f3a 100644 --- a/slsDetectorGui/include/qTabAdvanced.h +++ b/slsDetectorGui/include/qTabAdvanced.h @@ -58,6 +58,7 @@ private: */ void AddROIInput(int num); + private slots: /** Enable/Disable Energy and Calibration Logs @@ -142,10 +143,6 @@ private slots: */ void SetReceiver(); - /** Configures mac - */ - void Configuremac(); - /** Add ROI Input if the value changed in the last slot */ void AddROIInputSlot(){AddROIInput(1);}; @@ -166,10 +163,17 @@ private slots: */ void clearROIinDetector(); + /** Clears ROI in detector + */ + void SetDetector(int index); + private: - /** The sls detector object */ + /** The multi detector object */ multiSlsDetector *myDet; + /** The sls detector object */ + slsDetector *det; + /** detector type */ slsDetectorDefs::detectorType detType; @@ -192,10 +196,6 @@ private: bool isEnergy; bool isAngular; - /**sls detector obejct*/ - slsDetector *det; - - /** ROI */ vector lblFromX; vector spinFromX; diff --git a/slsDetectorGui/include/svnInfoGui.h b/slsDetectorGui/include/svnInfoGui.h index 13a7dc1f5..a30ebce42 100644 --- a/slsDetectorGui/include/svnInfoGui.h +++ b/slsDetectorGui/include/svnInfoGui.h @@ -2,10 +2,10 @@ #define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui" //#define SVNREPPATH "" #define SVNREPUUID "af1100a4-978c-4157-bff7-07162d2ba061" -//#define SVNREV 0x137 +//#define SVNREV 0x146 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "l_maliakal_d" -#define SVNREV 0x137 -#define SVNDATE 0x20130116 +#define SVNREV 0x146 +#define SVNDATE 0x20130222 // diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp index 8a8e658dd..6a4428edd 100644 --- a/slsDetectorGui/src/qTabAdvanced.cpp +++ b/slsDetectorGui/src/qTabAdvanced.cpp @@ -47,10 +47,7 @@ void qTabAdvanced::SetupWidgetWindow(){ lblMAC->setEnabled(false); dispIP->setEnabled(false); dispMAC->setEnabled(false); - boxRxrPorts->setEnabled(false); boxRxr->setEnabled(false); - btnRxr->setEnabled(false); - btnConfigure->setEnabled(false); red = QPalette(); @@ -76,10 +73,7 @@ void qTabAdvanced::SetupWidgetWindow(){ lblMAC->setEnabled(true); dispIP->setEnabled(true); dispMAC->setEnabled(true); - boxRxrPorts->setEnabled(true); boxRxr->setEnabled(true); - btnRxr->setEnabled(true); - btnConfigure->setEnabled(true); break; default: break; } @@ -105,24 +99,32 @@ void qTabAdvanced::SetupWidgetWindow(){ //network - spinControlPort->setValue(myDet->setPort(slsDetectorDefs::CONTROL_PORT,-1)); - spinStopPort->setValue(myDet->setPort(slsDetectorDefs::STOP_PORT,-1)); - spinTCPPort->setValue(myDet->setPort(slsDetectorDefs::DATA_PORT,-1)); - spinUDPPort->setValue(atoi(myDet->getNetworkParameter(slsDetectorDefs::RECEIVER_UDP_PORT))); - dispHostname->setText(QString(myDet->getHostname().c_str())); - dispIP->setText(QString(myDet->getNetworkParameter(slsDetectorDefs::DETECTOR_IP))); - dispMAC->setText(QString(myDet->getNetworkParameter(slsDetectorDefs::DETECTOR_MAC))); - dispRxrHostname->setText(QString(myDet->getNetworkParameter(slsDetectorDefs::RECEIVER_HOSTNAME))); - dispUDPIP->setText(QString(myDet->getNetworkParameter(slsDetectorDefs::RECEIVER_UDP_IP))); - dispUDPMAC->setText(QString(myDet->getNetworkParameter(slsDetectorDefs::RECEIVER_UDP_MAC))); + //add detectors + for(int i=0;igetNumberOfDetectors();i++) + comboDetector->addItem(QString(myDet->getHostname(i).c_str())); + + comboDetector->setCurrentIndex(0); + det = myDet->getSlsDetector(comboDetector->currentIndex()); + + + spinControlPort->setValue(det->getControlPort()); + spinStopPort->setValue(det->getStopPort()); + spinTCPPort->setValue(det->getReceiverPort()); + spinUDPPort->setValue(atoi(det->getReceiverUDPPort())); + + dispIP->setText(det->getDetectorIP()); + dispMAC->setText(det->getDetectorMAC()); + dispRxrHostname->setText(det->getReceiver()); + dispUDPIP->setText(det->getReceiverUDPIP()); + dispUDPMAC->setText(det->getReceiverUDPMAC()); //check if its online and set it to red if offline - myDet->checkOnline(); - myDet->checkReceiverOnline(); - comboOnline->setCurrentIndex(myDet->setOnline()); - comboRxrOnline->setCurrentIndex(myDet->setReceiverOnline()); + det->checkOnline(); + det->checkReceiverOnline(); + comboOnline->setCurrentIndex(det->setOnline()); + comboRxrOnline->setCurrentIndex(det->setReceiverOnline()); if(!comboOnline->currentIndex()){ comboOnline->setToolTip(detOnlineTip + errOnlineTip); lblOnline->setToolTip(detOnlineTip + errOnlineTip); @@ -137,6 +139,7 @@ void qTabAdvanced::SetupWidgetWindow(){ } + //updates roi updateROIList(); @@ -187,6 +190,7 @@ void qTabAdvanced::Initialization(){ } //network + connect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(SetDetector(int))); connect(spinControlPort, SIGNAL(valueChanged(int)), this, SLOT(SetControlPort(int))); connect(spinStopPort, SIGNAL(valueChanged(int)), this, SLOT(SetStopPort(int))); connect(comboOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetOnline(int))); @@ -204,7 +208,6 @@ void qTabAdvanced::Initialization(){ connect(dispUDPMAC, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters())); connect(btnRxr, SIGNAL(clicked()), this, SLOT(SetReceiver())); - connect(btnConfigure, SIGNAL(clicked()), this, SLOT(Configuremac())); } @@ -482,8 +485,8 @@ void qTabAdvanced::SetControlPort(int port){ cout << "Setting Control Port:" << port << endl; #endif disconnect(spinControlPort, SIGNAL(valueChanged(int)), this, SLOT(SetControlPort(int))); - spinStopPort->setValue(myDet->setPort(slsDetectorDefs::CONTROL_PORT,port)); - qDefs::checkErrorMessage(myDet); + spinStopPort->setValue(det->setPort(slsDetectorDefs::CONTROL_PORT,port)); + qDefs::checkErrorMessage(det); connect(spinControlPort, SIGNAL(valueChanged(int)), this, SLOT(SetControlPort(int))); } @@ -496,8 +499,8 @@ void qTabAdvanced::SetStopPort(int port){ cout << "Setting Stop Port:" << port << endl; #endif disconnect(spinStopPort, SIGNAL(valueChanged(int)), this, SLOT(SetStopPort(int))); - spinControlPort->setValue(myDet->setPort(slsDetectorDefs::STOP_PORT,port)); - qDefs::checkErrorMessage(myDet); + spinControlPort->setValue(det->setPort(slsDetectorDefs::STOP_PORT,port)); + qDefs::checkErrorMessage(det); connect(spinStopPort, SIGNAL(valueChanged(int)), this, SLOT(SetStopPort(int))); } @@ -511,8 +514,8 @@ void qTabAdvanced::SetRxrTCPPort(int port){ cout << "Setting Receiver TCP Port:" << port << endl; #endif disconnect(spinTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int))); - spinTCPPort->setValue(myDet->setPort(slsDetectorDefs::DATA_PORT,port)); - qDefs::checkErrorMessage(myDet); + spinTCPPort->setValue(det->setPort(slsDetectorDefs::DATA_PORT,port)); + qDefs::checkErrorMessage(det); connect(spinTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int))); } @@ -524,12 +527,10 @@ void qTabAdvanced::SetRxrUDPPort(int port){ #ifdef VERBOSE cout << "Setting Receiver UDP Port:" << port << endl; #endif - char sNumber[100]; - sprintf(sNumber,"%d",port); disconnect(spinUDPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrUDPPort(int))); - spinUDPPort->setValue(atoi(myDet->setNetworkParameter(slsDetectorDefs::RECEIVER_UDP_PORT,sNumber))); - qDefs::checkErrorMessage(myDet); + spinUDPPort->setValue(det->setReceiverUDPPort(port)); + qDefs::checkErrorMessage(det); connect(spinUDPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrUDPPort(int))); } @@ -542,8 +543,8 @@ void qTabAdvanced::SetReceiverOnline(int index){ cout << "Setting Reciever Online to :" << index << endl; #endif disconnect(comboRxrOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetReceiverOnline(int))); - comboRxrOnline->setCurrentIndex(myDet->setReceiverOnline(index)); - qDefs::checkErrorMessage(myDet); + comboRxrOnline->setCurrentIndex(det->setReceiverOnline(index)); + qDefs::checkErrorMessage(det); connect(comboRxrOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetReceiverOnline(int))); //highlight in red if offline if(!comboRxrOnline->currentIndex()){ @@ -568,8 +569,8 @@ void qTabAdvanced::SetOnline(int index){ cout << "Setting Detector Online to " << index << endl; #endif disconnect(comboOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetOnline(int))); - comboOnline->setCurrentIndex(myDet->setOnline(index)); - qDefs::checkErrorMessage(myDet); + comboOnline->setCurrentIndex(det->setOnline(index)); + qDefs::checkErrorMessage(det); connect(comboOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetOnline(int))); //highlight in red if offline if(!comboOnline->currentIndex()){ @@ -599,11 +600,11 @@ void qTabAdvanced::SetNetworkParameters(){ disconnect(dispUDPIP, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters())); disconnect(dispUDPMAC, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters())); - dispIP->setText(QString(myDet->setNetworkParameter(slsDetectorDefs::DETECTOR_IP,dispIP->text().toAscii().constData()))); - dispMAC->setText(QString(myDet->setNetworkParameter(slsDetectorDefs::DETECTOR_MAC,dispMAC->text().toAscii().constData()))); - dispUDPIP->setText(QString(myDet->setNetworkParameter(slsDetectorDefs::RECEIVER_UDP_IP,dispUDPIP->text().toAscii().constData()))); - dispUDPMAC->setText(QString(myDet->setNetworkParameter(slsDetectorDefs::RECEIVER_UDP_MAC,dispUDPMAC->text().toAscii().constData()))); - qDefs::checkErrorMessage(myDet); + dispIP->setText(QString(det->setDetectorIP(dispIP->text().toAscii().constData()))); + dispMAC->setText(QString(det->setDetectorMAC(dispMAC->text().toAscii().constData()))); + dispUDPIP->setText(QString(det->setReceiverUDPIP(dispUDPIP->text().toAscii().constData()))); + dispUDPMAC->setText(QString(det->setReceiverUDPMAC(dispUDPMAC->text().toAscii().constData()))); + qDefs::checkErrorMessage(det); connect(dispIP, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters())); connect(dispMAC, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters())); @@ -619,23 +620,12 @@ void qTabAdvanced::SetReceiver(){ #ifdef VERBOSE cout << "Setting Receiver" << endl; #endif - dispRxrHostname->setText(QString(myDet->setNetworkParameter(slsDetectorDefs::RECEIVER_HOSTNAME,dispRxrHostname->text().toAscii().constData()))); - qDefs::checkErrorMessage(myDet); + dispRxrHostname->setText(QString(det->setReceiver(dispRxrHostname->text().toAscii().constData()))); + qDefs::checkErrorMessage(det); Refresh(); } -//------------------------------------------------------------------------------------------------------------------------------------------------- - - -void qTabAdvanced::Configuremac(){ -#ifdef VERBOSE - cout << "Configuring Mac:" << endl; -#endif - myDet->configureMAC(); - qDefs::checkErrorMessage(myDet); -} - //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -865,6 +855,61 @@ void qTabAdvanced::clearROIinDetector(){ //------------------------------------------------------------------------------------------------------------------------------------------------- +void qTabAdvanced::SetDetector(int index){ +#ifdef VERYVERBOSE + cout<<"in SetDetector: " << index << endl; +#endif + det = myDet->getSlsDetector(comboDetector->currentIndex()); + + + spinControlPort->setValue(det->getControlPort()); + spinStopPort->setValue(det->getStopPort()); + spinTCPPort->setValue(det->getReceiverPort()); + spinUDPPort->setValue(atoi(det->getReceiverUDPPort())); + + dispIP->setText(det->getDetectorIP()); + dispMAC->setText(det->getDetectorMAC()); + dispRxrHostname->setText(det->getReceiver()); + dispUDPIP->setText(det->getReceiverUDPIP()); + dispUDPMAC->setText(det->getReceiverUDPMAC()); + + + //check if its online and set it to red if offline + det->checkOnline(); + det->checkReceiverOnline(); + comboOnline->setCurrentIndex(det->setOnline()); + comboRxrOnline->setCurrentIndex(det->setReceiverOnline()); + //highlight in red if detector or receiver is offline + if(!comboOnline->currentIndex()){ + comboOnline->setToolTip(detOnlineTip + errOnlineTip); + lblOnline->setToolTip(detOnlineTip + errOnlineTip); + lblOnline->setPalette(red); + lblOnline->setText("Online:*"); + }else{ + comboOnline->setToolTip(detOnlineTip); + lblOnline->setToolTip(detOnlineTip); + lblOnline->setPalette(lblHostname->palette()); + lblOnline->setText("Online:"); + } + if(comboRxrOnline->isEnabled()){ + if(!comboRxrOnline->currentIndex()){ + comboRxrOnline->setToolTip(rxrOnlineTip + errOnlineTip); + lblRxrOnline->setToolTip(rxrOnlineTip + errOnlineTip); + lblRxrOnline->setPalette(red); + lblRxrOnline->setText("Online:*"); + }else{ + comboRxrOnline->setToolTip(rxrOnlineTip); + lblRxrOnline->setToolTip(rxrOnlineTip); + lblRxrOnline->setPalette(lblHostname->palette()); + lblRxrOnline->setText("Online:"); + } + } +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + void qTabAdvanced::Refresh(){ @@ -935,17 +980,19 @@ void qTabAdvanced::Refresh(){ //network - //so that updated status - myDet->checkOnline(); - dispHostname->setText(QString(myDet->getHostname().c_str())); + det = myDet->getSlsDetector(comboDetector->currentIndex()); + //disconnect disconnect(spinControlPort, SIGNAL(valueChanged(int)), this, SLOT(SetControlPort(int))); disconnect(spinStopPort, SIGNAL(valueChanged(int)), this, SLOT(SetStopPort(int))); disconnect(comboOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetOnline(int))); - spinControlPort->setValue(myDet->setPort(slsDetectorDefs::CONTROL_PORT,-1)); - spinStopPort->setValue(myDet->setPort(slsDetectorDefs::STOP_PORT,-1)); - comboOnline->setCurrentIndex(myDet->setOnline()); + //so that updated status + det->checkOnline(); + comboOnline->setCurrentIndex(det->setOnline()); + spinControlPort->setValue(det->getControlPort()); + spinStopPort->setValue(det->getStopPort()); + //connect connect(spinControlPort, SIGNAL(valueChanged(int)), this, SLOT(SetControlPort(int))); connect(spinStopPort, SIGNAL(valueChanged(int)), this, SLOT(SetStopPort(int))); @@ -963,21 +1010,20 @@ void qTabAdvanced::Refresh(){ disconnect(dispUDPIP, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters())); disconnect(dispUDPMAC, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters())); disconnect(btnRxr, SIGNAL(clicked()), this, SLOT(SetReceiver())); - disconnect(btnConfigure, SIGNAL(clicked()), this, SLOT(Configuremac())); + + dispIP->setText(det->getDetectorIP()); + dispMAC->setText(det->getDetectorMAC()); //so that updated status - myDet->checkReceiverOnline(); - dispRxrHostname->setText(QString(myDet->getNetworkParameter(slsDetectorDefs::RECEIVER_HOSTNAME))); + det->checkReceiverOnline(); + comboRxrOnline->setCurrentIndex(det->setReceiverOnline()); - spinTCPPort->setValue(myDet->setPort(slsDetectorDefs::DATA_PORT,-1)); - spinUDPPort->setValue(atoi(myDet->getNetworkParameter(slsDetectorDefs::RECEIVER_UDP_PORT))); + dispRxrHostname->setText(det->getReceiver()); + spinTCPPort->setValue(det->getReceiverPort()); + spinUDPPort->setValue(atoi(det->getReceiverUDPPort())); - dispIP->setText(QString(myDet->getNetworkParameter(slsDetectorDefs::DETECTOR_IP))); - dispMAC->setText(QString(myDet->getNetworkParameter(slsDetectorDefs::DETECTOR_MAC))); - - comboRxrOnline->setCurrentIndex(myDet->setReceiverOnline()); - dispUDPIP->setText(QString(myDet->getNetworkParameter(slsDetectorDefs::RECEIVER_UDP_IP))); - dispUDPMAC->setText(QString(myDet->getNetworkParameter(slsDetectorDefs::RECEIVER_UDP_MAC))); + dispUDPIP->setText(det->getReceiverUDPIP()); + dispUDPMAC->setText(det->getReceiverUDPMAC()); //connect connect(spinTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int))); @@ -988,7 +1034,6 @@ void qTabAdvanced::Refresh(){ connect(dispUDPIP, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters())); connect(dispUDPMAC, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters())); connect(btnRxr, SIGNAL(clicked()), this, SLOT(SetReceiver())); - connect(btnConfigure, SIGNAL(clicked()), this, SLOT(Configuremac())); } From 2fc324ab4baf7372c4d8565881b18535e0dfab26 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 26 Feb 2013 08:35:20 +0000 Subject: [PATCH 148/332] made advanced tab detector dependent. each set mac adress etc is done via slsdetector and not multi git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@148 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/svnInfoGui.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/slsDetectorGui/include/svnInfoGui.h b/slsDetectorGui/include/svnInfoGui.h index a30ebce42..ee580d7ef 100644 --- a/slsDetectorGui/include/svnInfoGui.h +++ b/slsDetectorGui/include/svnInfoGui.h @@ -2,10 +2,10 @@ #define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui" //#define SVNREPPATH "" #define SVNREPUUID "af1100a4-978c-4157-bff7-07162d2ba061" -//#define SVNREV 0x146 +//#define SVNREV 0x147 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "l_maliakal_d" -#define SVNREV 0x146 -#define SVNDATE 0x20130222 +#define SVNREV 0x147 +#define SVNDATE 0x20130226 // From 863b662c6b5d7590fbc465fabf1babb9c977b7bf Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 1 Mar 2013 13:21:07 +0000 Subject: [PATCH 149/332] gui client works for just getting status git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@149 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/Makefile | 3 +- slsDetectorGui/client/qClient.cpp | 103 +++++++++ slsDetectorGui/client/qClient.h | 46 ++++ slsDetectorGui/forms/form_detectormain.ui | 9 + slsDetectorGui/include/qDefs.h | 1 + slsDetectorGui/include/qDetectorMain.h | 4 + slsDetectorGui/include/qDrawPlot.h | 4 +- slsDetectorGui/include/qServer.h | 106 +++++++++ slsDetectorGui/include/qTabMeasurement.h | 2 - slsDetectorGui/include/svnInfoGui.h | 4 +- slsDetectorGui/slsDetectorGui.pro | 6 +- slsDetectorGui/src/qDetectorMain.cpp | 11 +- slsDetectorGui/src/qDrawPlot.cpp | 6 +- slsDetectorGui/src/qServer.cpp | 256 ++++++++++++++++++++++ slsDetectorGui/src/qTabMeasurement.cpp | 20 ++ 15 files changed, 564 insertions(+), 17 deletions(-) create mode 100644 slsDetectorGui/client/qClient.cpp create mode 100644 slsDetectorGui/client/qClient.h create mode 100644 slsDetectorGui/include/qServer.h create mode 100644 slsDetectorGui/src/qServer.cpp diff --git a/slsDetectorGui/Makefile b/slsDetectorGui/Makefile index 08268dd93..d1ff906aa 100644 --- a/slsDetectorGui/Makefile +++ b/slsDetectorGui/Makefile @@ -6,14 +6,13 @@ DOCDIR?=docs LIBDIR?=../slsDetectorSoftware -all: $(PROG) Makefile.gui +all: $(PROG) Makefile.gui client clean: if test -e Makefile.gui; then make -f Makefile.gui clean; make -f Makefile.gui mocclean; rm Makefile.gui; else make Makefile.gui; make -f Makefile.gui clean; make -f Makefile.gui mocclean; fi # cd manual && make clean - Makefile.gui: mm mm: diff --git a/slsDetectorGui/client/qClient.cpp b/slsDetectorGui/client/qClient.cpp new file mode 100644 index 000000000..ba6bce2e2 --- /dev/null +++ b/slsDetectorGui/client/qClient.cpp @@ -0,0 +1,103 @@ +/* + * qClient.cpp + * + * Created on: Feb 27, 2013 + * Author: Dhanya Maliakal + */ +// Qt Project Class Headers +#include "qClient.h" +// Project Class Headers +#include "MySocketTCP.h" +#include "slsDetectorBase.h" +// C++ Include Headers +#include +using namespace std; + + + + +int main(int argc, char *argv[]) + +{ + qClient *cl =new qClient(argv[1]); + cl->executeLine(argc-2, argv+2); + + delete cl; +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +qClient::qClient(char* hostname){ + //create socket + mySocket = new MySocketTCP(hostname, DEFAULT_GUI_PORTNO); + if (mySocket->getErrorStatus()){ + cout << "Error: could not connect to host:" << hostname << " with port " << DEFAULT_GUI_PORTNO << endl; + delete mySocket; + exit(-1); + } +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + +int qClient::executeLine(int narg, char *args[]){ + + char arg[MAX_STR_LENGTH] = ""; + int iarg = -1; + char answer[100]; + string retval = ""; + string cmd = args[0]; + + + //validate command structure + if(narg<1){ + cout << "Error: no command parsed" << endl; + return slsDetectorDefs::FAIL; + } + + + //file name + if (cmd == "status"){ + retval = getStatus(); + } + + + //unrecognized command + else{ + cout << "Error: unrecognized command" << endl; + return slsDetectorDefs::FAIL; + } + + + //print result + cout << cmd << ": " << retval << endl; + + return slsDetectorDefs::OK; +} + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +string qClient::getStatus(){ + int fnum = slsDetectorDefs::F_GET_RUN_STATUS; + int ret = slsDetectorDefs::FAIL; + int retval = -1; + slsDetectorDefs::runStatus s=slsDetectorDefs::ERROR; + + if (mySocket->Connect() >= 0) { + mySocket->SendDataOnly(&fnum,sizeof(fnum)); + mySocket->ReceiveDataOnly(&ret,sizeof(ret)); + mySocket->ReceiveDataOnly(&retval,sizeof(retval)); + } + mySocket->Disconnect(); + + if(retval==-1) + retval=slsDetectorDefs::ERROR; + + return slsDetectorBase::runStatusType((slsDetectorDefs::runStatus)retval); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/slsDetectorGui/client/qClient.h b/slsDetectorGui/client/qClient.h new file mode 100644 index 000000000..8e91b0c34 --- /dev/null +++ b/slsDetectorGui/client/qClient.h @@ -0,0 +1,46 @@ +/* + * qClient.h + * + * Created on: Feb 27, 2013 + * Author: Dhanya Maliakal + */ +#ifndef QCLIENT_H +#define QCLIENT_H + + +/** Qt Project Class Headers */ +//#include "qDefs.h" +/** Project Class Headers */ +class MySocketTCP; +#include "sls_detector_defs.h" +/** C++ Include Headers */ +#include +#include +using namespace std; + +/** + *@short Sets up the gui server + */ +class qClient: public virtual slsDetectorDefs{ + + +public: + /** \short The constructor*/ + qClient(char* hostname); + /** Destructor */ + virtual ~qClient(){}; + + /**Execute command*/ + int executeLine(int narg, char *args[]); + +private: + /** Gets run status */ + string getStatus(); + + /** client socket */ + MySocketTCP *mySocket; +}; + + + +#endif /* QCLIENT_H */ diff --git a/slsDetectorGui/forms/form_detectormain.ui b/slsDetectorGui/forms/form_detectormain.ui index 60a1a4afe..4874af640 100644 --- a/slsDetectorGui/forms/form_detectormain.ui +++ b/slsDetectorGui/forms/form_detectormain.ui @@ -243,6 +243,7 @@ + @@ -503,6 +504,14 @@ p, li { white-space: pre-wrap; } Save C&alibration + + + true + + + Listen to Gui Client + + diff --git a/slsDetectorGui/include/qDefs.h b/slsDetectorGui/include/qDefs.h index 919ca26f7..1ed8ff2a4 100644 --- a/slsDetectorGui/include/qDefs.h +++ b/slsDetectorGui/include/qDefs.h @@ -28,6 +28,7 @@ public: static const int64_t GUI_VERSION=0x20121213; +#define GOODBYE -200 //------------------------------------------------------------------------------------------------------------------------------------------------- enum{ diff --git a/slsDetectorGui/include/qDetectorMain.h b/slsDetectorGui/include/qDetectorMain.h index cd0060775..a948b4b33 100644 --- a/slsDetectorGui/include/qDetectorMain.h +++ b/slsDetectorGui/include/qDetectorMain.h @@ -22,6 +22,7 @@ class qTabSettings; class qTabDebugging; class qTabDeveloper; class qTabMessages; +class qServer; /** Project Class Headers */ class multiSlsDetector; /** Qt Include Headers */ @@ -110,6 +111,9 @@ private: /**Messages tab */ qTabMessages *tab_messages; + /** server object*/ + qServer *myServer; + /**if the developer tab should be enabled,known from command line */ int isDeveloper; diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index c0dd76368..5206cebc4 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -2,7 +2,7 @@ * qDrawPlot.h * * Created on: May 7, 2012 - * Author: Ian Johnson + * Author: Dhanya Maliakal */ #ifndef QDRAWPLOT_H #define QDRAWPLOT_H @@ -117,8 +117,6 @@ public: int UpdateTrimbitPlot(bool fromDetector,bool Histogram); - - public slots: /** To select 1D or 2D plot @param i is 1 for 1D, else 2D plot */ diff --git a/slsDetectorGui/include/qServer.h b/slsDetectorGui/include/qServer.h new file mode 100644 index 000000000..fbace4321 --- /dev/null +++ b/slsDetectorGui/include/qServer.h @@ -0,0 +1,106 @@ +/* + * qServer.h.h + * + * Created on: Feb 27, 2013 + * Author: Dhanya Maliakal + */ +#ifndef QSERVER_H +#define QSERVER_H + + +/** Qt Project Class Headers */ +#include "sls_detector_defs.h" +#include "qDefs.h" +class qDrawPlot; +class qTabMeasurement; + +/** Project Class Headers */ +class multiSlsDetector; +class MySocketTCP; +/** C++ Include Headers */ + + +/** + *@short Sets up the gui server + */ +class qServer: public virtual slsDetectorDefs{ + + +public: + /** \short The constructor */ + qServer(multiSlsDetector*& detector, qTabMeasurement* m, qDrawPlot *d); + /** Destructor */ + ~qServer(); + + /** Start or Stop Gui Server + * @param start is 1 to start and 0 to stop + */ + int StartStopServer(int start); + +private: + /** assigns functions to the fnum enum */ + int function_table(); + + /** Decodes Function */ + int decode_function(); + + /** Unrecognized Function */ + int M_nofunc(); + + + /** + * Static function - Thread started which listens to client gui. + * Called by StartStopServer() + * @param this_pointer pointer to this object + */ + static void* StartServerThread(void *this_pointer); + + /** + * Thread started which listens to client gui. + * Called by startServerThread() + * + */ + int StartServer(); + + /** Get Detector Status */ + int get_status(); + + + + + /** The multi detector object */ + multiSlsDetector *myDet; + /**The measurement tab object*/ + qTabMeasurement *tab_measurement; + /**The plot widget object*/ + qDrawPlot *myPlot; + + + /** tcp socket to gui client */ + MySocketTCP *mySocket; + /** server port number*/ + int port_no; + /** Lock Status if server locked to a client */ + int lockStatus; + + /** Function List */ + static const int NUMBER_OF_FUNCTIONS = 256; + int (qServer::*flist[NUMBER_OF_FUNCTIONS])(); + + + /** if the gui server thread is running*/ + static int gui_server_thread_running; + /** thread listening to gui client*/ + pthread_t gui_server_thread; + + /** server started */ + int checkStarted; + + /** Message */ + char mess[MAX_STR_LENGTH]; + +}; + + + +#endif /* QSERVER_H */ diff --git a/slsDetectorGui/include/qTabMeasurement.h b/slsDetectorGui/include/qTabMeasurement.h index bd55b9baf..627b71df2 100644 --- a/slsDetectorGui/include/qTabMeasurement.h +++ b/slsDetectorGui/include/qTabMeasurement.h @@ -91,7 +91,6 @@ private: void Enable(bool enable); - private slots: /** Sets the timing mode * @ param mode cane be None, Auto, Gated, Trigger Exposure Series, @@ -156,7 +155,6 @@ private slots: void EnableFileWrite(bool enable); - private: /** The sls detector object */ multiSlsDetector *myDet; diff --git a/slsDetectorGui/include/svnInfoGui.h b/slsDetectorGui/include/svnInfoGui.h index ee580d7ef..deff612b6 100644 --- a/slsDetectorGui/include/svnInfoGui.h +++ b/slsDetectorGui/include/svnInfoGui.h @@ -2,10 +2,10 @@ #define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui" //#define SVNREPPATH "" #define SVNREPUUID "af1100a4-978c-4157-bff7-07162d2ba061" -//#define SVNREV 0x147 +//#define SVNREV 0x148 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "l_maliakal_d" -#define SVNREV 0x147 +#define SVNREV 0x148 #define SVNDATE 0x20130226 // diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index 8fdd6b43f..6aafb84ad 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -82,7 +82,8 @@ SOURCES = \ src/qTabSettings.cpp\ src/qTabDebugging.cpp\ src/qTabDeveloper.cpp\ - src/qTabMessages.cpp + src/qTabMessages.cpp\ + src/qServer.cpp HEADERS = \ slsDetectorPlotting/include/SlsQt1DPlot.h\ @@ -110,7 +111,8 @@ HEADERS = \ include/qTabDeveloper.h\ include/qTabMessages.h\ include/svnInfoGui.h\ - ../slsDetectorSoftware/commonFiles/sls_detector_defs.h + ../slsDetectorSoftware/commonFiles/sls_detector_defs.h\ + include/qServer.h FORMS = \ diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 2e9c2fa2d..25c42adf0 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -14,6 +14,7 @@ #include "qTabDebugging.h" #include "qTabDeveloper.h" #include "qTabMessages.h" +#include "qServer.h" // Project Class Headers #include "slsDetector.h" #include "multiSlsDetector.h" @@ -112,6 +113,8 @@ void qDetectorMain::SetUpWidgetWindow(){ tab_debugging = new qTabDebugging (this, myDet); cout<<"Debugging ready"<setChecked(myServer->StartStopServer(actionListenGuiClient->isChecked())); + connect(menuModes, SIGNAL(triggered(QAction*)), this,SLOT(EnableModes(QAction*))); + } //Set DebugMode - if(action==actionDebug){ + else if(action==actionDebug){ enable = actionDebug->isChecked(); tabs->setTabEnabled(Debugging,enable); #ifdef VERBOSE diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 7158cf61d..f8bbf2da9 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -2,7 +2,7 @@ * qDrawPlot.cpp * * Created on: May 7, 2012 - * Author: Ian Johnson + * Author: Dhanya Maliakal */ // Qt Project Class Headers #include "qDrawPlot.h" @@ -174,9 +174,6 @@ void qDrawPlot::SetupWidgetWindow(){ pedestalCount = 0; - - - //widget related initialization // clone @@ -578,7 +575,6 @@ void qDrawPlot::SetupMeasurement(){ void* qDrawPlot::DataStartAcquireThread(void *this_pointer){ ((qDrawPlot*)this_pointer)->myDet->acquire(1); - return this_pointer; } diff --git a/slsDetectorGui/src/qServer.cpp b/slsDetectorGui/src/qServer.cpp new file mode 100644 index 000000000..18914db65 --- /dev/null +++ b/slsDetectorGui/src/qServer.cpp @@ -0,0 +1,256 @@ +/* + * qServer.cpp + * + * Created on: Feb 27, 2013 + * Author: Dhanya Maliakal + */ +// Qt Project Class Headers +#include "qServer.h" +#include "qTabMeasurement.h" +#include "qDrawPlot.h" +// Project Class Headers +#include "slsDetector.h" +#include "multiSlsDetector.h" +#include "MySocketTCP.h" +// C++ Include Headers +#include +#include +using namespace std; + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +int qServer::gui_server_thread_running(0); + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +qServer::qServer(multiSlsDetector*& detector, qTabMeasurement* m, qDrawPlot *d): + myDet(detector),tab_measurement(m),myPlot(d),mySocket(NULL),port_no(DEFAULT_GUI_PORTNO),lockStatus(0){ + + function_table(); + +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +qServer::~qServer(){ + delete myDet; + delete tab_measurement; + delete myPlot; + if(mySocket) delete mySocket; +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +int qServer::function_table(){ + + for (int i=0;iReceiveDataOnly(&fnum,sizeof(fnum)); + if (n <= 0) { +#ifdef VERYVERBOSE + cout << "ERROR reading from socket " << n << ", " << fnum << endl; +#endif + return qDefs::FAIL; + } +#ifdef VERYVERBOSE + else + cout << "size of data received " << n <NUMBER_OF_FUNCTIONS-1) + fnum = NUMBER_OF_FUNCTIONS-1; + //calling function + (this->*flist[fnum])(); + if (ret==qDefs::FAIL) + cout << "Error executing the function = " << fnum << endl; + + return ret; +} + + +//------------------------------------------------------------------------------------------------------------------------------------------ + + +int qServer::M_nofunc(){ + + int ret = qDefs::FAIL; + sprintf(mess,"Unrecognized Function\n"); + cout << mess << endl; + + mySocket->SendDataOnly(&ret,sizeof(ret)); + mySocket->SendDataOnly(mess,sizeof(mess)); + + return GOODBYE; +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +int qServer::StartStopServer(int start){ + + //start server + if(start){ +#ifdef VERBOSE + cout << endl << "Starting Gui Server" << endl; +#endif + + if(!gui_server_thread_running){ +#ifdef VERBOSE + cout << "Starting gui server thread ...." << endl; +#endif + gui_server_thread_running=1; + checkStarted=1; + //error creating thread + if (pthread_create(&gui_server_thread, NULL,StartServerThread, (void*) this)){ + gui_server_thread_running=0; + qDefs::Message(qDefs::WARNING,"Can't create gui server thread", "Server"); + return 0; + } + while(checkStarted); + checkStarted=0; +#ifdef VERBOSE + if(gui_server_thread_running) + cout << "Server thread created successfully." << endl; +#endif + } + } + + //stop server + else{ +#ifdef VERBOSE + cout << "Stopping Gui Server" << endl; +#endif + + if(gui_server_thread_running){ +#ifdef VERBOSE + cout << "Stopping gui server thread ...." << endl; +#endif + gui_server_thread_running=0; + mySocket->Disconnect(); + mySocket->ShutDownSocket(); + pthread_join(gui_server_thread,NULL); + delete mySocket; + mySocket = NULL; + } +#ifdef VERBOSE + cout << "Server stopped successfully." << endl; +#endif + } + + + return gui_server_thread_running; +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void* qServer::StartServerThread(void* this_pointer){ + ((qServer*)this_pointer)->StartServer(); + return this_pointer; +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + + +int qServer::StartServer(){ +#ifdef VERYVERBOSE + cout << "In StartServer()\n"); +#endif + int ret = qDefs::OK; + + mySocket = new MySocketTCP(port_no); + if (mySocket->getErrorStatus()){ + gui_server_thread_running = 0; + qDefs::Message(qDefs::WARNING,"Could not start gui server socket","Server"); + } + checkStarted = 0; + + while ((gui_server_thread_running) && (ret!=GOODBYE)) { +#ifdef VERBOSE + cout<< endl; +#endif +#ifdef VERYVERBOSE + cout << "Waiting for client call" << endl; +#endif + if(mySocket->Connect()>=0){ +#ifdef VERYVERBOSE + cout << "Conenction accepted" << endl; +#endif + ret = decode_function(); +#ifdef VERYVERBOSE + cout << "function executed" << endl; +#endif + mySocket->Disconnect(); +#ifdef VERYVERBOSE + cout << "connection closed" << endl; +#endif + } + } +#ifdef VERBOSE + cout << "Stopped gui server thread" << endl; +#endif + gui_server_thread_running = 0; + return qDefs::OK; +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +int qServer::get_status(){ + + int ret = qDefs::OK; + enum slsDetectorDefs::runStatus retval; + + // execute action if the arguments correctly arrived + if(myPlot->isRunning()) + retval = slsDetectorDefs::RUNNING; + else + retval = slsDetectorDefs::IDLE; + + // send answer + mySocket->SendDataOnly(&ret,sizeof(ret)); + mySocket->SendDataOnly(&retval,sizeof(retval)); + //return ok/fail + return ret; +} + + +//------------------------------------------------------------------------------------------------------------------------------------------ + diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index fcb07e505..effab7cca 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -83,6 +83,7 @@ void qTabMeasurement::SetupWidgetWindow(){ iconStart = new QIcon(":/icons/images/start.png"); iconStop = new QIcon(":/icons/images/stop.png"); + } @@ -323,6 +324,25 @@ void qTabMeasurement::startStopAcquisition(){ } +//------------------------------------------------------------------------------------------------------------------------------------------------- + +/* +int qTabMeasurement::GetAcquisitionStarted(){ + + cout<<" acquisition started call back"<isChecked()){cout<<" hasnt started, so from client"<SetAcqFromClient(); + btnStartStop->click(); + //wait till the gui is ready to execute the acquire(), but doesnt execute it + //acqFromClient is reset when it is ready + while(myPlot->GetAcqFromClient()); + }else + cout<<" has started, so from gui"< Date: Mon, 4 Mar 2013 15:27:57 +0000 Subject: [PATCH 150/332] client connecting to gui serveR done git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@150 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/client/qClient.cpp | 101 ++++++++++++++++--- slsDetectorGui/client/qClient.h | 7 +- slsDetectorGui/include/qDetectorMain.h | 20 +++- slsDetectorGui/include/qServer.h | 29 ++++-- slsDetectorGui/include/qTabMeasurement.h | 11 ++ slsDetectorGui/src/qDetectorMain.cpp | 31 +++++- slsDetectorGui/src/qServer.cpp | 122 +++++++++++++++++++---- slsDetectorGui/src/qTabMeasurement.cpp | 19 ---- 8 files changed, 269 insertions(+), 71 deletions(-) diff --git a/slsDetectorGui/client/qClient.cpp b/slsDetectorGui/client/qClient.cpp index ba6bce2e2..5ad21e679 100644 --- a/slsDetectorGui/client/qClient.cpp +++ b/slsDetectorGui/client/qClient.cpp @@ -11,6 +11,7 @@ #include "slsDetectorBase.h" // C++ Include Headers #include +#include using namespace std; @@ -49,55 +50,129 @@ int qClient::executeLine(int narg, char *args[]){ char answer[100]; string retval = ""; string cmd = args[0]; + string argument; //validate command structure if(narg<1){ cout << "Error: no command parsed" << endl; - return slsDetectorDefs::FAIL; + return FAIL; } + //help + if (cmd == "help"){ + retval = printCommands(); + } + //file name - if (cmd == "status"){ + else if (cmd == "status"){ + + if(narg>1){ + argument = args[1]; + //start acquisition + if(argument == "start") + sendToGuiServer(F_START_ACQUISITION); + else if (argument == "stop") + sendToGuiServer(F_STOP_ACQUISITION); + else{ + cout << "Error: could not parse arguments: " << argument << endl; + printCommands(); + return FAIL; + } + } retval = getStatus(); } + else if (cmd == "acquire"){ + sendToGuiServer(F_START_AND_READ_ALL); + retval = getStatus(); + } + + + else if (cmd == "exit"){ + if (sendToGuiServer(F_EXIT_SERVER) == OK) + retval = "Gui Server Exited successfully."; + else + retval = "Gui Server could not exit successfully"; + } + + //unrecognized command else{ cout << "Error: unrecognized command" << endl; - return slsDetectorDefs::FAIL; + return FAIL; } //print result cout << cmd << ": " << retval << endl; - return slsDetectorDefs::OK; + return OK; } //------------------------------------------------------------------------------------------------------------------------------------------------- +string qClient::printCommands(){ + ostringstream os; + os << "\nexit \t exits server in gui" << std::endl; + os << "status \t gets status of acquisition in gui. - can be running or idle" << std::endl; + os << "status i starts/stops acquistion in gui-non blocking. i is start or stop" << std::endl; + os << "acquire starts acquistion in gui-blocking" << std::endl; + return os.str(); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + string qClient::getStatus(){ - int fnum = slsDetectorDefs::F_GET_RUN_STATUS; - int ret = slsDetectorDefs::FAIL; - int retval = -1; - slsDetectorDefs::runStatus s=slsDetectorDefs::ERROR; + int fnum = F_GET_RUN_STATUS; + int ret = FAIL; + runStatus retval=ERROR; + int progress = 0; + char answer[100]; if (mySocket->Connect() >= 0) { mySocket->SendDataOnly(&fnum,sizeof(fnum)); mySocket->ReceiveDataOnly(&ret,sizeof(ret)); mySocket->ReceiveDataOnly(&retval,sizeof(retval)); - } - mySocket->Disconnect(); + mySocket->ReceiveDataOnly(&progress,sizeof(progress)); + mySocket->Disconnect(); + }else + exit(-1); - if(retval==-1) - retval=slsDetectorDefs::ERROR; - return slsDetectorBase::runStatusType((slsDetectorDefs::runStatus)retval); + sprintf(answer,"%d%% ",progress); + strcat(answer,slsDetectorBase::runStatusType((runStatus)retval).c_str()); + + return string(answer); } //------------------------------------------------------------------------------------------------------------------------------------------------- + + +int qClient::sendToGuiServer(int fnum){ + int ret = FAIL; + char mess[100] = ""; + + if (mySocket->Connect() >= 0) { + mySocket->SendDataOnly(&fnum,sizeof(fnum)); + mySocket->ReceiveDataOnly(&ret,sizeof(ret)); + if (ret == FAIL){ + mySocket->ReceiveDataOnly(mess,sizeof(mess)); + std::cout<< "Gui returned error: " << mess << std::endl; + } + mySocket->Disconnect(); + }else + exit(-1); + + return ret; +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + diff --git a/slsDetectorGui/client/qClient.h b/slsDetectorGui/client/qClient.h index 8e91b0c34..f68dddfde 100644 --- a/slsDetectorGui/client/qClient.h +++ b/slsDetectorGui/client/qClient.h @@ -9,7 +9,6 @@ /** Qt Project Class Headers */ -//#include "qDefs.h" /** Project Class Headers */ class MySocketTCP; #include "sls_detector_defs.h" @@ -34,6 +33,12 @@ public: int executeLine(int narg, char *args[]); private: + /** Print list of commands */ + string printCommands(); + + /** Send to Gui Server */ + int sendToGuiServer(int fnum); + /** Gets run status */ string getStatus(); diff --git a/slsDetectorGui/include/qDetectorMain.h b/slsDetectorGui/include/qDetectorMain.h index a948b4b33..7b0723e7e 100644 --- a/slsDetectorGui/include/qDetectorMain.h +++ b/slsDetectorGui/include/qDetectorMain.h @@ -12,8 +12,8 @@ /** Form Header */ #include "ui_form_detectormain.h" /** Qt Project Class Headers */ -class qDrawPlot; -class qTabMeasurement; +#include "qDrawPlot.h" +#include "qTabMeasurement.h" class qTabDataOutput; class qTabPlot; class qTabActions; @@ -64,6 +64,22 @@ public: * */ ~qDetectorMain(); + /** Starts or stops Acquisition From gui client + * @param start 1 for start and 0 to stop + /returns success or fail + */ + int StartStopAcquisitionFromClient(bool start); + + /** Returns if plot is running + */ + bool isPlotRunning(){return myPlot->isRunning();}; + + /** Returns progress bar value */ + int GetProgress(){return tab_measurement->GetProgress();}; + + /** Uncheck the Listen to Gui Client mode when server has exited using exit command */ + void GuiServerExited(){actionListenGuiClient->setChecked(false);}; + private: /** The Qt Application */ QApplication *theApp; diff --git a/slsDetectorGui/include/qServer.h b/slsDetectorGui/include/qServer.h index fbace4321..63044f6eb 100644 --- a/slsDetectorGui/include/qServer.h +++ b/slsDetectorGui/include/qServer.h @@ -11,8 +11,7 @@ /** Qt Project Class Headers */ #include "sls_detector_defs.h" #include "qDefs.h" -class qDrawPlot; -class qTabMeasurement; +class qDetectorMain; /** Project Class Headers */ class multiSlsDetector; @@ -28,7 +27,7 @@ class qServer: public virtual slsDetectorDefs{ public: /** \short The constructor */ - qServer(multiSlsDetector*& detector, qTabMeasurement* m, qDrawPlot *d); + qServer(multiSlsDetector*& detector, qDetectorMain *t); /** Destructor */ ~qServer(); @@ -39,10 +38,10 @@ public: private: /** assigns functions to the fnum enum */ - int function_table(); + int FunctionTable(); /** Decodes Function */ - int decode_function(); + int DecodeFunction(); /** Unrecognized Function */ int M_nofunc(); @@ -62,19 +61,27 @@ private: */ int StartServer(); - /** Get Detector Status */ - int get_status(); + /** Exit Server */ + int ExitServer(); + /** Get Detector Status */ + int GetStatus(); + + /** Starts Acquisition */ + int StartAcquisition(); + + /** Stops Acquisition */ + int StopsAcquisition(); + + /** Acquire - blocking */ + int Acquire(); /** The multi detector object */ multiSlsDetector *myDet; /**The measurement tab object*/ - qTabMeasurement *tab_measurement; - /**The plot widget object*/ - qDrawPlot *myPlot; - + qDetectorMain *myMainTab; /** tcp socket to gui client */ MySocketTCP *mySocket; diff --git a/slsDetectorGui/include/qTabMeasurement.h b/slsDetectorGui/include/qTabMeasurement.h index 627b71df2..34abeb458 100644 --- a/slsDetectorGui/include/qTabMeasurement.h +++ b/slsDetectorGui/include/qTabMeasurement.h @@ -48,6 +48,17 @@ public: */ void SetExpertMode(bool enable); + /** Returns the status of the Start/Stop Acquisition button + */ + bool GetStartStatus(){return btnStartStop->isChecked();}; + + /** Click the Start/Stop Acquisition button + * This is used if this command came from gui client + */ + void ClickStartStop(){btnStartStop->click();}; + + /** Returns progress bar value */ + int GetProgress(){return progressBar->value();}; public slots: diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 25c42adf0..6784007a0 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -4,8 +4,6 @@ * ********************************************************************/ // Qt Project Class Headers #include "qDetectorMain.h" -#include "qDrawPlot.h" -#include "qTabMeasurement.h" #include "qTabDataOutput.h" #include "qTabPlot.h" #include "qTabActions.h" @@ -113,7 +111,7 @@ void qDetectorMain::SetUpWidgetWindow(){ tab_debugging = new qTabDebugging (this, myDet); cout<<"Debugging ready"<GetStartStatus() != start){ + if(start){ + //refresh all the required tabs + tab_actions->Refresh(); + tab_measurement->Refresh(); + tab_plot->Refresh(); + } + //click start/stop + tab_measurement->ClickStartStop(); + } + + if (myPlot->isRunning() == start) + ret = slsDetectorDefs::OK; + + return ret; +} + + //------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/slsDetectorGui/src/qServer.cpp b/slsDetectorGui/src/qServer.cpp index 18914db65..d9dfc89d5 100644 --- a/slsDetectorGui/src/qServer.cpp +++ b/slsDetectorGui/src/qServer.cpp @@ -6,8 +6,7 @@ */ // Qt Project Class Headers #include "qServer.h" -#include "qTabMeasurement.h" -#include "qDrawPlot.h" +#include "qDetectorMain.h" // Project Class Headers #include "slsDetector.h" #include "multiSlsDetector.h" @@ -27,10 +26,10 @@ int qServer::gui_server_thread_running(0); //------------------------------------------------------------------------------------------------------------------------------------------------- -qServer::qServer(multiSlsDetector*& detector, qTabMeasurement* m, qDrawPlot *d): - myDet(detector),tab_measurement(m),myPlot(d),mySocket(NULL),port_no(DEFAULT_GUI_PORTNO),lockStatus(0){ +qServer::qServer(multiSlsDetector*& detector, qDetectorMain *t): + myDet(detector), myMainTab(t), mySocket(NULL),port_no(DEFAULT_GUI_PORTNO),lockStatus(0){ - function_table(); + FunctionTable(); } @@ -40,8 +39,7 @@ qServer::qServer(multiSlsDetector*& detector, qTabMeasurement* m, qDrawPlot *d): qServer::~qServer(){ delete myDet; - delete tab_measurement; - delete myPlot; + delete myMainTab; if(mySocket) delete mySocket; } @@ -49,16 +47,16 @@ qServer::~qServer(){ //------------------------------------------------------------------------------------------------------------------------------------------------- -int qServer::function_table(){ +int qServer::FunctionTable(){ for (int i=0;iNUMBER_OF_FUNCTIONS-1) fnum = NUMBER_OF_FUNCTIONS-1; //calling function - (this->*flist[fnum])(); + ret = (this->*flist[fnum])(); if (ret==qDefs::FAIL) cout << "Error executing the function = " << fnum << endl; @@ -159,11 +157,13 @@ int qServer::StartStopServer(int start){ cout << "Stopping gui server thread ...." << endl; #endif gui_server_thread_running=0; - mySocket->Disconnect(); - mySocket->ShutDownSocket(); + if(mySocket) + mySocket->ShutDownSocket(); pthread_join(gui_server_thread,NULL); - delete mySocket; - mySocket = NULL; + if(mySocket){ + delete mySocket; + mySocket = NULL; + } } #ifdef VERBOSE cout << "Server stopped successfully." << endl; @@ -212,7 +212,7 @@ int qServer::StartServer(){ #ifdef VERYVERBOSE cout << "Conenction accepted" << endl; #endif - ret = decode_function(); + ret = DecodeFunction(); #ifdef VERYVERBOSE cout << "function executed" << endl; #endif @@ -226,6 +226,13 @@ int qServer::StartServer(){ cout << "Stopped gui server thread" << endl; #endif gui_server_thread_running = 0; + //delete socket(via exit server) + if(mySocket){ + delete mySocket; + mySocket = NULL; + } + //uncheck the server in modes(via exit server) + myMainTab->GuiServerExited(); return qDefs::OK; } @@ -233,20 +240,24 @@ int qServer::StartServer(){ //------------------------------------------------------------------------------------------------------------------------------------------------- -int qServer::get_status(){ +int qServer::GetStatus(){ int ret = qDefs::OK; enum slsDetectorDefs::runStatus retval; + int progress = 0; // execute action if the arguments correctly arrived - if(myPlot->isRunning()) + if(myMainTab->isPlotRunning()) retval = slsDetectorDefs::RUNNING; else retval = slsDetectorDefs::IDLE; + progress = myMainTab->GetProgress(); + // send answer mySocket->SendDataOnly(&ret,sizeof(ret)); mySocket->SendDataOnly(&retval,sizeof(retval)); + mySocket->SendDataOnly(&progress,sizeof(progress)); //return ok/fail return ret; } @@ -254,3 +265,70 @@ int qServer::get_status(){ //------------------------------------------------------------------------------------------------------------------------------------------ + +int qServer::StartAcquisition(){ + + strcpy(mess,"Could not start acquisition in gui. \n"); + + int ret = myMainTab->StartStopAcquisitionFromClient(true); + mySocket->SendDataOnly(&ret,sizeof(ret)); + if(ret==FAIL) + mySocket->SendDataOnly(mess,sizeof(mess)); + + return ret; +} + + +//------------------------------------------------------------------------------------------------------------------------------------------ + + +int qServer::StopsAcquisition(){ + + strcpy(mess,"Could not stop acquisition in gui. \n"); + + int ret = myMainTab->StartStopAcquisitionFromClient(false); + mySocket->SendDataOnly(&ret,sizeof(ret)); + if(ret==FAIL) + mySocket->SendDataOnly(mess,sizeof(mess)); + + return ret; +} + + +//------------------------------------------------------------------------------------------------------------------------------------------ + + +int qServer::Acquire(){ + + strcpy(mess,"Could not start blocking acquisition in gui. \n"); + + int ret = myMainTab->StartStopAcquisitionFromClient(true); + + if(ret == OK) + while(myMainTab->isPlotRunning()); + + mySocket->SendDataOnly(&ret,sizeof(ret)); + if(ret==FAIL) + mySocket->SendDataOnly(mess,sizeof(mess)); + + return ret; +} + + +//------------------------------------------------------------------------------------------------------------------------------------------ + + +int qServer::ExitServer(){ + + int ret = OK; + strcpy(mess,"closing gui server"); + + mySocket->SendDataOnly(&ret,sizeof(ret)); + mySocket->SendDataOnly(mess,sizeof(mess)); + cout << mess << endl; + + return GOODBYE; +} + + +//------------------------------------------------------------------------------------------------------------------------------------------ diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index effab7cca..cecc5db7e 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -324,25 +324,6 @@ void qTabMeasurement::startStopAcquisition(){ } -//------------------------------------------------------------------------------------------------------------------------------------------------- - -/* -int qTabMeasurement::GetAcquisitionStarted(){ - - cout<<" acquisition started call back"<isChecked()){cout<<" hasnt started, so from client"<SetAcqFromClient(); - btnStartStop->click(); - //wait till the gui is ready to execute the acquire(), but doesnt execute it - //acqFromClient is reset when it is ready - while(myPlot->GetAcqFromClient()); - }else - cout<<" has started, so from gui"< Date: Wed, 6 Mar 2013 09:18:46 +0000 Subject: [PATCH 151/332] included makefile changes for gui client git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@151 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/Makefile | 6 +++++- slsDetectorGui/include/svnInfoGui.h | 11 ----------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/slsDetectorGui/Makefile b/slsDetectorGui/Makefile index d1ff906aa..96742c268 100644 --- a/slsDetectorGui/Makefile +++ b/slsDetectorGui/Makefile @@ -9,7 +9,8 @@ LIBDIR?=../slsDetectorSoftware all: $(PROG) Makefile.gui client clean: - if test -e Makefile.gui; then make -f Makefile.gui clean; make -f Makefile.gui mocclean; rm Makefile.gui; else make Makefile.gui; make -f Makefile.gui clean; make -f Makefile.gui mocclean; fi + if test -e Makefile.gui; then make -f Makefile.gui clean; make -f Makefile.gui mocclean; rm Makefile.gui; else make Makefile.gui; make -f Makefile.gui clean; make -f Makefile.gui mocclean; fi + cd client && $(MAKE) clean # cd manual && make clean @@ -28,3 +29,6 @@ $(PROG): Makefile.gui $(DIR) echo $(LDFLAG) make -f Makefile.gui SLSDETLIB=$(LIBDIR) DESTDIR=$(DESTDIR) SUBLIBS='$(LDFLAG)' INCLUDES='$(INCLUDES)' + +client: + cd slsDetectorGui/client && $(MAKE) DESTDIR=$(DESTDIR) diff --git a/slsDetectorGui/include/svnInfoGui.h b/slsDetectorGui/include/svnInfoGui.h index deff612b6..e69de29bb 100644 --- a/slsDetectorGui/include/svnInfoGui.h +++ b/slsDetectorGui/include/svnInfoGui.h @@ -1,11 +0,0 @@ -//#define SVNPATH "" -#define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui" -//#define SVNREPPATH "" -#define SVNREPUUID "af1100a4-978c-4157-bff7-07162d2ba061" -//#define SVNREV 0x148 -//#define SVNKIND "" -//#define SVNSCHED "" -#define SVNAUTH "l_maliakal_d" -#define SVNREV 0x148 -#define SVNDATE 0x20130226 -// From 499cf4db5660637f41d601c244cb641c4c74990b Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 6 Mar 2013 09:21:15 +0000 Subject: [PATCH 152/332] forgot client makefile for gui git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@152 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/client/Makefile | 36 +++++++++++++++++++++++++++++ slsDetectorGui/include/svnInfoGui.h | 11 +++++++++ 2 files changed, 47 insertions(+) create mode 100644 slsDetectorGui/client/Makefile diff --git a/slsDetectorGui/client/Makefile b/slsDetectorGui/client/Makefile new file mode 100644 index 000000000..39bbc2d79 --- /dev/null +++ b/slsDetectorGui/client/Makefile @@ -0,0 +1,36 @@ +CC = g++ +CLAGS += -DVERBOSE #VERYBOSE +LDLIBS += -lm -lstdc++ -lpthread + +LDIR = ../../slsDetectorSoftware +INCLUDES = -I ../../slsDetectorSoftware/commonFiles -I ../../slsDetectorSoftware/MySocketTCP -I ../../slsDetectorSoftware/slsDetector -I ../include +SRC_CLNT = qClient.cpp ../../slsDetectorSoftware/MySocketTCP/MySocketTCP.cpp + +PROGS = gui_client +DESTDIR ?= bin +INSTMODE = 0777 + +FINALDIR = ../../bin + +OBJS = $(SRC_CLNT:.cpp=.o) + + +all: clean $(PROGS) + +boot: $(OBJS) + +$(PROGS): + echo $(OBJS) + mkdir -p $(DESTDIR) + gcc $(SRC_CLNT) $(INCLUDES) $(FLAGS) $(LDLIBS) -o $@ + #mv $(PROGS) $(DESTDIR) + mv $(PROGS) $(FINALDIR) + +clean: + rm -rf $(DESTDIR)/$(PROGS) *.o + rm -rf $(FINALDIR)/$(PROGS) + + + + + diff --git a/slsDetectorGui/include/svnInfoGui.h b/slsDetectorGui/include/svnInfoGui.h index e69de29bb..63f231c6c 100644 --- a/slsDetectorGui/include/svnInfoGui.h +++ b/slsDetectorGui/include/svnInfoGui.h @@ -0,0 +1,11 @@ +//#define SVNPATH "" +#define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui" +//#define SVNREPPATH "" +#define SVNREPUUID "af1100a4-978c-4157-bff7-07162d2ba061" +//#define SVNREV 0x151 +//#define SVNKIND "" +//#define SVNSCHED "" +#define SVNAUTH "l_maliakal_d" +#define SVNREV 0x151 +#define SVNDATE 0x20130306 +// From 448f333b1ec304e2510adb99ca32cc42d505eb0e Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 6 Mar 2013 09:41:21 +0000 Subject: [PATCH 153/332] changed the makefiles a bit to be included in slsDetectorsPAckage make git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@153 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/Makefile | 7 ++++--- slsDetectorGui/client/Makefile | 1 - slsDetectorGui/include/svnInfoGui.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/slsDetectorGui/Makefile b/slsDetectorGui/Makefile index 96742c268..5088393d4 100644 --- a/slsDetectorGui/Makefile +++ b/slsDetectorGui/Makefile @@ -6,7 +6,7 @@ DOCDIR?=docs LIBDIR?=../slsDetectorSoftware -all: $(PROG) Makefile.gui client +all: $(PROG) Makefile.gui guiclient clean: if test -e Makefile.gui; then make -f Makefile.gui clean; make -f Makefile.gui mocclean; rm Makefile.gui; else make Makefile.gui; make -f Makefile.gui clean; make -f Makefile.gui mocclean; fi @@ -30,5 +30,6 @@ $(PROG): Makefile.gui $(DIR) make -f Makefile.gui SLSDETLIB=$(LIBDIR) DESTDIR=$(DESTDIR) SUBLIBS='$(LDFLAG)' INCLUDES='$(INCLUDES)' -client: - cd slsDetectorGui/client && $(MAKE) DESTDIR=$(DESTDIR) +guiclient: + echo $(WD) + cd client && $(MAKE) DESTDIR=$(DESTDIR) diff --git a/slsDetectorGui/client/Makefile b/slsDetectorGui/client/Makefile index 39bbc2d79..a889e74c7 100644 --- a/slsDetectorGui/client/Makefile +++ b/slsDetectorGui/client/Makefile @@ -23,7 +23,6 @@ $(PROGS): echo $(OBJS) mkdir -p $(DESTDIR) gcc $(SRC_CLNT) $(INCLUDES) $(FLAGS) $(LDLIBS) -o $@ - #mv $(PROGS) $(DESTDIR) mv $(PROGS) $(FINALDIR) clean: diff --git a/slsDetectorGui/include/svnInfoGui.h b/slsDetectorGui/include/svnInfoGui.h index 63f231c6c..8652c3c70 100644 --- a/slsDetectorGui/include/svnInfoGui.h +++ b/slsDetectorGui/include/svnInfoGui.h @@ -2,10 +2,10 @@ #define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui" //#define SVNREPPATH "" #define SVNREPUUID "af1100a4-978c-4157-bff7-07162d2ba061" -//#define SVNREV 0x151 +//#define SVNREV 0x152 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "l_maliakal_d" -#define SVNREV 0x151 +#define SVNREV 0x152 #define SVNDATE 0x20130306 // From ab41ffb6bf991d5048b43dc368ccffa4dfc80f64 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 6 Mar 2013 10:16:48 +0000 Subject: [PATCH 154/332] there was a gap between start and get status git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@154 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qDrawPlot.h | 13 +++++++++++++ slsDetectorGui/include/qTabMeasurement.h | 4 ++-- slsDetectorGui/src/qDetectorMain.cpp | 7 ++----- slsDetectorGui/src/qDrawPlot.cpp | 4 ++++ slsDetectorGui/src/qServer.cpp | 4 ++-- slsDetectorGui/src/qTabMeasurement.cpp | 1 - 6 files changed, 23 insertions(+), 10 deletions(-) diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index 5206cebc4..e1ac9536b 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -116,6 +116,15 @@ public: * */ int UpdateTrimbitPlot(bool fromDetector,bool Histogram); + /** This is set once client initiates start/stop acquisition + * and this is reset when the gui really starts/stops- to know when to return + */ + void SetClientInitiated(){clientInitiated = true;}; + + /** Get client intiated variable. This is set once client initiates start/stop acquisition + * and this is reset when the gui really starts/stops- to know when to return + */ + bool GetClientInitiated(){return clientInitiated;}; public slots: /** To select 1D or 2D plot @@ -480,6 +489,10 @@ double* pedestalVals; /** count for 20 frames to calculate the pedestal */ int pedestalCount; +/** this is set when client starts/stops acquisition + * and is reset once the gui really starts/stops */ +bool clientInitiated; + signals: void UpdatingPlotFinished(); diff --git a/slsDetectorGui/include/qTabMeasurement.h b/slsDetectorGui/include/qTabMeasurement.h index 34abeb458..fc6a0c375 100644 --- a/slsDetectorGui/include/qTabMeasurement.h +++ b/slsDetectorGui/include/qTabMeasurement.h @@ -15,7 +15,7 @@ /** Project Class Headers */ class multiSlsDetector; /** Qt Project Class Headers */ -class qDrawPlot; +#include "qDrawPlot.h" /** *@short sets up the measurement parameters @@ -55,7 +55,7 @@ public: /** Click the Start/Stop Acquisition button * This is used if this command came from gui client */ - void ClickStartStop(){btnStartStop->click();}; + void ClickStartStop(){btnStartStop->click();myPlot->SetClientInitiated();}; /** Returns progress bar value */ int GetProgress(){return progressBar->value();}; diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 6784007a0..15abdb331 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -724,7 +724,6 @@ int qDetectorMain::StartStopAcquisitionFromClient(bool start){ #ifdef VERBOSE cout << "Start/Stop Acquisition From Client:" << start << endl; #endif - int ret = slsDetectorDefs::FAIL; if (tab_measurement->GetStartStatus() != start){ if(start){ @@ -735,12 +734,10 @@ int qDetectorMain::StartStopAcquisitionFromClient(bool start){ } //click start/stop tab_measurement->ClickStartStop(); + while(myPlot->GetClientInitiated()); } - if (myPlot->isRunning() == start) - ret = slsDetectorDefs::OK; - - return ret; + return slsDetectorDefs::OK; } diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index f8bbf2da9..7b920a07a 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -173,6 +173,7 @@ void qDrawPlot::SetupWidgetWindow(){ if(myDet->getDetectorsType()==slsDetectorDefs::GOTTHARD) pedestalCount = 0; + clientInitiated = false; //widget related initialization @@ -349,6 +350,9 @@ void qDrawPlot::StartStopDaqToggle(bool stop_if_running){ StartDaq(true); running=!running; } + + /** if this is set during client initation */ + clientInitiated = false; } diff --git a/slsDetectorGui/src/qServer.cpp b/slsDetectorGui/src/qServer.cpp index d9dfc89d5..39a7b0b09 100644 --- a/slsDetectorGui/src/qServer.cpp +++ b/slsDetectorGui/src/qServer.cpp @@ -304,8 +304,8 @@ int qServer::Acquire(){ int ret = myMainTab->StartStopAcquisitionFromClient(true); - if(ret == OK) - while(myMainTab->isPlotRunning()); + usleep(5000); + while(myMainTab->isPlotRunning()); mySocket->SendDataOnly(&ret,sizeof(ret)); if(ret==FAIL) diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index cecc5db7e..6967e51a6 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -7,7 +7,6 @@ //Qt Project Class Headers #include "qTabMeasurement.h" -#include "qDrawPlot.h" //Project Class Headers #include "slsDetector.h" #include "multiSlsDetector.h" From 3e4f76ed077eac082bd79ab0bec203c63ab4e867 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 13 Mar 2013 15:36:37 +0000 Subject: [PATCH 155/332] slsdet clear errormask fixed, qmessage not printing and displog fixed git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@155 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qDebugStream.h | 4 +++- slsDetectorGui/include/qDefs.h | 5 +++-- slsDetectorGui/include/qServer.h | 4 +--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/slsDetectorGui/include/qDebugStream.h b/slsDetectorGui/include/qDebugStream.h index bfbdf0524..93f32acc8 100644 --- a/slsDetectorGui/include/qDebugStream.h +++ b/slsDetectorGui/include/qDebugStream.h @@ -29,7 +29,9 @@ using namespace std; class qStreamEvent:public QEvent{ public: - qStreamEvent(QString s):QEvent(static_cast(STREAMEVENT)),str(s){} + qStreamEvent(QString s):QEvent(static_cast(STREAMEVENT)),str(s){ + printf("%s\n",str.toAscii().constData()); + } /** \returns the progress index */ QString getString() {return str;} private: diff --git a/slsDetectorGui/include/qDefs.h b/slsDetectorGui/include/qDefs.h index 1ed8ff2a4..610488bf6 100644 --- a/slsDetectorGui/include/qDefs.h +++ b/slsDetectorGui/include/qDefs.h @@ -226,9 +226,10 @@ static const int64_t GUI_VERSION=0x20121213; int errorLevel= (int)WARNING; string retval=""; size_t pos; + int64_t emask=0; - - retval = myDet->getErrorMessage(errorLevel); + emask = myDet->getErrorMask(); + retval = myDet->getErrorMessage(emask); if(!retval.empty()){ diff --git a/slsDetectorGui/include/qServer.h b/slsDetectorGui/include/qServer.h index 63044f6eb..ed2b38fa5 100644 --- a/slsDetectorGui/include/qServer.h +++ b/slsDetectorGui/include/qServer.h @@ -27,7 +27,7 @@ class qServer: public virtual slsDetectorDefs{ public: /** \short The constructor */ - qServer(multiSlsDetector*& detector, qDetectorMain *t); + qServer(qDetectorMain *t); /** Destructor */ ~qServer(); @@ -78,8 +78,6 @@ private: - /** The multi detector object */ - multiSlsDetector *myDet; /**The measurement tab object*/ qDetectorMain *myMainTab; From 7675b474740c58a1c823069a8e8b8b7abb36dc0f Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 13 Mar 2013 15:38:33 +0000 Subject: [PATCH 156/332] check error message in between implemented in gui git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@156 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qDetectorMain.cpp | 61 ++++++++++++++++++++++------ 1 file changed, 48 insertions(+), 13 deletions(-) diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 15abdb331..106ff3e81 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -111,7 +111,7 @@ void qDetectorMain::SetUpWidgetWindow(){ tab_debugging = new qTabDebugging (this, myDet); cout<<"Debugging ready"<getHostname(); + qDefs::checkErrorMessage(myDet); //if hostname doesnt exist even in shared memory if(!host.length()){ @@ -213,6 +214,8 @@ void qDetectorMain::SetUpDetector(const string fName){ //check if the detector is not even connected string offline = myDet->checkOnline(); + qDefs::checkErrorMessage(myDet); + if(!offline.empty()){ qDefs::Message(qDefs::CRITICAL,string("The detector(s) ")+offline+string(" is/are not connected. Exiting GUI."),"Main"); cout << "The detector(s) " << host << " is/are not connected. Exiting GUI." << endl; @@ -221,6 +224,8 @@ void qDetectorMain::SetUpDetector(const string fName){ // Check if type valid. If not, exit slsDetectorDefs::detectorType detType = myDet->getDetectorsType(); + qDefs::checkErrorMessage(myDet); + switch(detType){ case slsDetectorDefs::MYTHEN: break; case slsDetectorDefs::EIGER: break; @@ -228,6 +233,7 @@ void qDetectorMain::SetUpDetector(const string fName){ case slsDetectorDefs::AGIPD: actionLoadTrimbits->setText("Load Settings"); actionSaveTrimbits->setText("Save Settings"); break; default: string detName = myDet->slsDetectorBase::getDetectorType(detType); + qDefs::checkErrorMessage(myDet); string errorMess = host+string(" has unknown detector type \"")+ detName+string("\". Exiting GUI."); qDefs::Message(qDefs::CRITICAL,errorMess,"Main"); @@ -239,7 +245,7 @@ void qDetectorMain::SetUpDetector(const string fName){ cout << endl << "Type : " << slsDetectorBase::getDetectorType(detType) << "\nDetector : " << host << endl; //#endif myDet->setOnline(slsDetectorDefs::ONLINE_FLAG); - + qDefs::checkErrorMessage(myDet); } @@ -378,6 +384,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ cout << "Loading Setup" << endl; #endif QString fName = QString(myDet->getFilePath().c_str()); + qDefs::checkErrorMessage(myDet); fName = QFileDialog::getOpenFileName(this, tr("Load Detector Setup"),fName, tr("Detector Setup files (*.det)")); @@ -387,6 +394,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ qDefs::Message(qDefs::INFORMATION,"The Setup Parameters have been loaded successfully.","Main"); refreshTabs=true; }else qDefs::Message(qDefs::WARNING,string("Could not load the Setup Parameters from file:\n")+fName.toAscii().constData(),"Main"); + qDefs::checkErrorMessage(myDet); } } else if(action==actionSaveSetup){ @@ -394,6 +402,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ cout << "Saving Setup" << endl; #endif QString fName = QString(myDet->getFilePath().c_str()); + qDefs::checkErrorMessage(myDet); fName = QFileDialog::getSaveFileName(this, tr("Save Current Detector Setup"),fName, tr("Detector Setup files (*.det) ")); @@ -402,6 +411,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ if(myDet->dumpDetectorSetup(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL) qDefs::Message(qDefs::INFORMATION,"The Setup Parameters have been saved successfully.","Main"); else qDefs::Message(qDefs::WARNING,string("Could not save the Setup Parameters from file:\n")+fName.toAscii().constData(),"Main"); + qDefs::checkErrorMessage(myDet); } } else if(action==actionOpenConfiguration){ @@ -409,6 +419,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ cout << "Loading Configuration" << endl; #endif QString fName = QString(myDet->getFilePath().c_str()); + qDefs::checkErrorMessage(myDet); fName = QFileDialog::getOpenFileName(this, tr("Load Detector Configuration"),fName, tr("Configuration files (*.config)")); @@ -418,6 +429,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ qDefs::Message(qDefs::INFORMATION,"The Configuration Parameters have been configured successfully.","Main"); refreshTabs=true; }else qDefs::Message(qDefs::WARNING,string("Could not load the Configuration Parameters from file:\n")+fName.toAscii().constData(),"Main"); + qDefs::checkErrorMessage(myDet); } } else if(action==actionSaveConfiguration){ @@ -425,6 +437,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ cout << "Saving Configuration" << endl; #endif QString fName = QString(myDet->getFilePath().c_str()); + qDefs::checkErrorMessage(myDet); fName = QFileDialog::getSaveFileName(this, tr("Save Current Detector Configuration"),fName, tr("Configuration files (*.config) ")); @@ -433,10 +446,12 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ if(myDet->writeConfigurationFile(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL) qDefs::Message(qDefs::INFORMATION,"The Configuration Parameters have been saved successfully.","Main"); else qDefs::Message(qDefs::WARNING,string("Could not save the Configuration Parameters from file:\n")+fName.toAscii().constData(),"Main"); + qDefs::checkErrorMessage(myDet); } } else if(action==actionLoadTrimbits){ QString fName = QString(myDet->getSettingsDir()); + qDefs::checkErrorMessage(myDet); //gotthard if(actionLoadTrimbits->text().contains("Settings")){ #ifdef VERBOSE @@ -450,6 +465,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ if(myDet->loadSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) qDefs::Message(qDefs::INFORMATION,"The Settings have been loaded successfully.","Main"); else qDefs::Message(qDefs::WARNING,string("Could not load the Settings from file:\n")+fName.toAscii().constData(),"Main"); + qDefs::checkErrorMessage(myDet); } }//mythen and eiger @@ -466,6 +482,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ if(myDet->loadSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) qDefs::Message(qDefs::INFORMATION,"The Trimbits have been loaded successfully.","Main"); else qDefs::Message(qDefs::WARNING,string("Could not load the Trimbits from file:\n")+fName.toAscii().constData(),"Main"); + qDefs::checkErrorMessage(myDet); } } } @@ -477,6 +494,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ #endif //different output directory so as not to overwrite QString fName = QString(myDet->getSettingsDir()); + qDefs::checkErrorMessage(myDet); fName = QFileDialog::getSaveFileName(this, tr("Save Current Detector Settings"),fName, tr("Settings files (*.settings settings.sn*) ")); @@ -485,6 +503,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ if(myDet->saveSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) qDefs::Message(qDefs::INFORMATION,"The Settings have been saved successfully.","Main"); else qDefs::Message(qDefs::WARNING,string("Could not save the Settings to file:\n")+fName.toAscii().constData(),"Main"); + qDefs::checkErrorMessage(myDet); } }//mythen and eiger else{ @@ -492,6 +511,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ cout << "Saving Trimbits" << endl; #endif//different output directory so as not to overwrite QString fName = QString(myDet->getSettingsDir()); + qDefs::checkErrorMessage(myDet); fName = QFileDialog::getSaveFileName(this, tr("Save Current Detector Trimbits"),fName, tr("Trimbit files (*.trim noise.sn*) ")); @@ -500,6 +520,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ if(myDet->saveSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) qDefs::Message(qDefs::INFORMATION,"The Trimbits have been saved successfully.","Main"); else qDefs::Message(qDefs::WARNING,string("Could not save the Trimbits to file:\n")+fName.toAscii().constData(),"Main"); + qDefs::checkErrorMessage(myDet); } } } @@ -508,6 +529,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ cout << "Loading Calibration Data" << endl; #endif QString fName = QString(myDet->getCalDir()); + qDefs::checkErrorMessage(myDet); fName = QFileDialog::getOpenFileName(this, tr("Load Detector Calibration Data"),fName, tr("Calibration files (*.cal calibration.sn*)")); @@ -516,6 +538,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ if(myDet->loadCalibrationFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) qDefs::Message(qDefs::INFORMATION,"The Calibration Data have been loaded successfully.","Main"); else qDefs::Message(qDefs::WARNING,string("Could not load the Calibration data from file:\n")+ fName.toAscii().constData(),"Main"); + qDefs::checkErrorMessage(myDet); } } else if(action==actionSaveCalibration){ @@ -523,6 +546,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ cout << "Saving Calibration Data" << endl; #endif//different output directory so as not to overwrite QString fName = QString(myDet->getCalDir()); + qDefs::checkErrorMessage(myDet); fName = QFileDialog::getSaveFileName(this, tr("Save Current Detector Calibration Data"),fName, tr("Calibration files (*.cal calibration.sn*) ")); @@ -531,7 +555,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ if(myDet->saveCalibrationFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) qDefs::Message(qDefs::INFORMATION,"The Calibration Data have been saved successfully.","Main"); else qDefs::Message(qDefs::WARNING,string("Could not save the Calibration data to file:\n")+fName.toAscii().constData(),"Main"); - + qDefs::checkErrorMessage(myDet); } } @@ -539,14 +563,15 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ if(refreshTabs){ tab_actions->Refresh(); tab_measurement->Refresh(); - //tab_settings->Refresh(); - //tab_dataoutput->Refresh(); - //tab_advanced->Refresh(); - //tab_debugging->Refresh(); - //tab_developer->Refresh(); + + tab_settings->Refresh(); + tab_dataoutput->Refresh(); + if(tab_advanced->isEnabled()) tab_advanced->Refresh(); + if(tab_debugging->isEnabled()) tab_debugging->Refresh(); + if(tab_developer->isEnabled()) tab_developer->Refresh(); + tab_plot->Refresh(); } - qDefs::checkErrorMessage(myDet); } @@ -565,6 +590,7 @@ void qDetectorMain::ExecuteHelp(QAction *action){ string thisGUIVersion = string(version); sprintf(version,"%llx",myDet->getId(slsDetectorDefs::THIS_SOFTWARE_VERSION)); + qDefs::checkErrorMessage(myDet); string thisClientVersion = string(version); //

A heading

@@ -727,10 +753,19 @@ int qDetectorMain::StartStopAcquisitionFromClient(bool start){ if (tab_measurement->GetStartStatus() != start){ if(start){ - //refresh all the required tabs - tab_actions->Refresh(); - tab_measurement->Refresh(); - tab_plot->Refresh(); + if(!myPlot->isRunning()){ + //refresh all the required tabs + tab_actions->Refresh(); + tab_measurement->Refresh(); + + tab_settings->Refresh(); + tab_dataoutput->Refresh(); + if(tab_advanced->isEnabled()) tab_advanced->Refresh(); + if(tab_debugging->isEnabled()) tab_debugging->Refresh(); + if(tab_developer->isEnabled()) tab_developer->Refresh(); + + tab_plot->Refresh(); + } } //click start/stop tab_measurement->ClickStartStop(); From 5c78f148b6d121cc256f97a5fdd5a64cd41a82b9 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 13 Mar 2013 15:38:57 +0000 Subject: [PATCH 157/332] check error message in between implemented in gui git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@157 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qServer.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/slsDetectorGui/src/qServer.cpp b/slsDetectorGui/src/qServer.cpp index 39a7b0b09..98879d01e 100644 --- a/slsDetectorGui/src/qServer.cpp +++ b/slsDetectorGui/src/qServer.cpp @@ -26,8 +26,8 @@ int qServer::gui_server_thread_running(0); //------------------------------------------------------------------------------------------------------------------------------------------------- -qServer::qServer(multiSlsDetector*& detector, qDetectorMain *t): - myDet(detector), myMainTab(t), mySocket(NULL),port_no(DEFAULT_GUI_PORTNO),lockStatus(0){ +qServer::qServer(qDetectorMain *t): + myMainTab(t), mySocket(NULL),port_no(DEFAULT_GUI_PORTNO),lockStatus(0){ FunctionTable(); @@ -38,7 +38,6 @@ qServer::qServer(multiSlsDetector*& detector, qDetectorMain *t): qServer::~qServer(){ - delete myDet; delete myMainTab; if(mySocket) delete mySocket; } From bef374569341e9aefbd9f97fd2aaeb6856530436 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 13 Mar 2013 15:39:21 +0000 Subject: [PATCH 158/332] check error message in between implemented in gui git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@158 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qTabActions.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/slsDetectorGui/src/qTabActions.cpp b/slsDetectorGui/src/qTabActions.cpp index 85e8665a3..0a6772c89 100644 --- a/slsDetectorGui/src/qTabActions.cpp +++ b/slsDetectorGui/src/qTabActions.cpp @@ -200,6 +200,7 @@ void qTabActions::SetupWidgetWindow(){ } + qDefs::checkErrorMessage(myDet); } @@ -342,6 +343,8 @@ void qTabActions::Expand(QAbstractButton *button ){ setFixedHeight(height()+30); } } + + qDefs::checkErrorMessage(myDet); } @@ -391,6 +394,7 @@ void qTabActions::SetPosition(){ qDefs::Message(qDefs::WARNING,"The positions list was not set for some reason.","Actions"); + qDefs::checkErrorMessage(myDet); } @@ -442,6 +446,7 @@ void qTabActions::EnablePositions(bool enable){ btnExpand[NumPositions]->setEnabled(false); } + qDefs::checkErrorMessage(myDet); } @@ -499,6 +504,7 @@ void qTabActions::Refresh(){ #ifdef VERBOSE cout << "**Updated all action widgets: " << endl << endl; #endif + qDefs::checkErrorMessage(myDet); } From f809657ec498b1e303da74c42133048f2485d82f Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 13 Mar 2013 15:45:49 +0000 Subject: [PATCH 159/332] check error message in between implemented in gui git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@159 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qTabSettings.cpp | 90 ++++++++++++++++------------- 1 file changed, 51 insertions(+), 39 deletions(-) diff --git a/slsDetectorGui/src/qTabSettings.cpp b/slsDetectorGui/src/qTabSettings.cpp index 961a42de5..b89dbe718 100644 --- a/slsDetectorGui/src/qTabSettings.cpp +++ b/slsDetectorGui/src/qTabSettings.cpp @@ -64,6 +64,7 @@ void qTabSettings::SetupWidgetWindow(){ default: comboDynamicRange->setCurrentIndex(0); break; } + qDefs::checkErrorMessage(myDet); } //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -71,6 +72,7 @@ void qTabSettings::SetupWidgetWindow(){ void qTabSettings::SetupDetectorSettings(){ // Get detector settings from detector slsDetectorDefs::detectorSettings sett = myDet->getSettings(); + qDefs::checkErrorMessage(myDet); if(sett==-1) sett = slsDetectorDefs::UNDEFINED; // To be able to index items on a combo box model = qobject_cast(comboSettings->model()); @@ -169,55 +171,61 @@ void qTabSettings::setSettings(int index){ if(expertMode) emit UpdateTrimbitSignal(0); } } + + qDefs::checkErrorMessage(myDet); } //------------------------------------------------------------------------------------------------------------------------------------------------- void qTabSettings::SetNumberOfModules(int index){ #ifdef VERBOSE - cout << "Setting number of modules to "<< index << endl; + cout << "Setting number of modules to "<< index << endl; #endif - int i = myDet->setNumberOfModules(index); - if(index!=i) - qDefs::Message(qDefs::WARNING,"Number of modules cannot be set for this value.","Settings"); + int i = myDet->setNumberOfModules(index); + if(index!=i) + qDefs::Message(qDefs::WARNING,"Number of modules cannot be set for this value.","Settings"); #ifdef VERBOSE - cout << "ERROR: Setting number of modules to "<< i << endl; + cout << "ERROR: Setting number of modules to "<< i << endl; #endif - spinNumModules->setValue(i); + spinNumModules->setValue(i); + + qDefs::checkErrorMessage(myDet); } //------------------------------------------------------------------------------------------------------------------------------------------------- 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; - } - ret=myDet->setDynamicRange(dr); - if((ret==24)&&(dr==32)) dr = ret; + 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; + } + ret=myDet->setDynamicRange(dr); + if((ret==24)&&(dr==32)) dr = ret; #ifdef VERBOSE - cout << "Setting dynamic range to "<< dr << endl; + cout << "Setting dynamic range to "<< dr << endl; #endif - if(ret!=dr){ - qDefs::Message(qDefs::WARNING,"Dynamic Range cannot be set to this value.","Settings"); + if(ret!=dr){ + qDefs::Message(qDefs::WARNING,"Dynamic Range cannot be set to this value.","Settings"); #ifdef VERBOSE - cout << "ERROR: Setting dynamic range to "<< ret << endl; + cout << "ERROR: Setting dynamic range to "<< ret << endl; #endif - switch(ret){ - case 32: comboDynamicRange->setCurrentIndex(0); break; - case 24: 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; - } - } -}; + switch(ret){ + case 32: comboDynamicRange->setCurrentIndex(0); break; + case 24: 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; + } + } + + qDefs::checkErrorMessage(myDet); +} //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -226,16 +234,18 @@ void qTabSettings::SetDynamicRange(int index){ void qTabSettings::SetEnergy(){ int index = spinThreshold->value(); #ifdef VERBOSE - cout << "Settings threshold energy to "<< index << endl; + cout << "Settings threshold energy to "<< index << endl; #endif - myDet->setThresholdEnergy(index); - int ret = (int)myDet->getThresholdEnergy(); - if((ret-index)>200){ - qDefs::Message(qDefs::WARNING,"Threshold energy could not be set. The difference is greater than 200.","Settings"); - } - disconnect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy())); - spinThreshold->setValue(ret); - connect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy())); + myDet->setThresholdEnergy(index); + int ret = (int)myDet->getThresholdEnergy(); + if((ret-index)>200){ + qDefs::Message(qDefs::WARNING,"Threshold energy could not be set. The difference is greater than 200.","Settings"); + } + disconnect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy())); + spinThreshold->setValue(ret); + connect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy())); + + qDefs::checkErrorMessage(myDet); } @@ -299,6 +309,8 @@ void qTabSettings::Refresh(){ #ifdef VERBOSE cout << "**Updated Settings Tab" << endl << endl; #endif + + qDefs::checkErrorMessage(myDet); } From 4ac843920209abf030754d1a228de2091b562d2b Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 13 Mar 2013 15:46:35 +0000 Subject: [PATCH 160/332] check error message in between implemented in gui git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@160 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qScanWidget.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/slsDetectorGui/src/qScanWidget.cpp b/slsDetectorGui/src/qScanWidget.cpp index cff11affd..7e307625c 100644 --- a/slsDetectorGui/src/qScanWidget.cpp +++ b/slsDetectorGui/src/qScanWidget.cpp @@ -411,6 +411,8 @@ int qScanWidget::SetScan(int mode){ emit EnableScanBox(); + qDefs::checkErrorMessage(myDet); + return qDefs::OK; } @@ -500,6 +502,8 @@ void qScanWidget::SetScriptFile(){ for(int i=1;isetText(""); + + qDefs::checkErrorMessage(myDet); } @@ -524,6 +528,8 @@ void qScanWidget::SetParameter(){ for(int i=1;isetText(""); + + qDefs::checkErrorMessage(myDet); } @@ -540,6 +546,8 @@ void qScanWidget::SetPrecision(int value){ myDet->setScanPrecision(id,value); if(myDet->getScanPrecision(id)!=value) qDefs::Message(qDefs::WARNING,"The precision was not set for an unknown reason.","ScanWidget");; + + qDefs::checkErrorMessage(myDet); } @@ -844,6 +852,8 @@ void qScanWidget::SetRangeSteps(){ #endif } } + + qDefs::checkErrorMessage(myDet); } //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -910,6 +920,7 @@ int qScanWidget::SetCustomSteps(){ qDefs::Message(qDefs::WARNING,"The positions list was not set for an unknown reason.","ScanWidget"); LoadPositions(); comboScript->setCurrentIndex(myDet->getScanMode(id)); + qDefs::checkErrorMessage(myDet); return qDefs::FAIL; } //else success is checked in enabledsizewidgets , else it does this for every add, delete etc @@ -1095,6 +1106,8 @@ void qScanWidget::SetFileSteps(){ spinSteps->setValue(actualNumSteps); connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps())); } + + qDefs::checkErrorMessage(myDet); } @@ -1184,7 +1197,7 @@ void qScanWidget::LoadPositions(){ connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps())); connect(btnGroup, SIGNAL(buttonClicked(QAbstractButton*)),this,SLOT(EnableSizeWidgets())); - + qDefs::checkErrorMessage(myDet); //do not set the range variables because if the stepsize is by any chance 0.. //then the number of steps should change to 1. so only set custom steps } @@ -1225,6 +1238,8 @@ void qScanWidget::Refresh(){ "parameter:" << parameter << "\t" "precision:" << precision << "\t***" << endl; #endif + + qDefs::checkErrorMessage(myDet); } From db1aaf041aadcb25fbef1f73313c342fe794cfbe Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 13 Mar 2013 15:47:19 +0000 Subject: [PATCH 161/332] check error message in between implemented in gui git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@161 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qDrawPlot.cpp | 39 +++++++++++++++++++------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 7b920a07a..a81f54d0d 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -232,21 +232,11 @@ void qDrawPlot::SetupWidgetWindow(){ boxPlot->setFlat(true); boxPlot->setContentsMargins(0,15,0,0); - //plot1D_hists = NULL; - plotLayout = new QGridLayout(boxPlot); plotLayout->addWidget(plot1D,1,1,1,1); plotLayout->addWidget(plot2D,1,1,1,1); - /* - //clear eveything again - nHists=0; - histXAxis=0; - histYAxis[0]=0; - Clear1DPlot(); - for(QVector::iterator h = plot1D_hists.begin();h!=plot1D_hists.end();h++) delete *h; - plot1D_hists.clear(); -*/ + //callbacks // Setting the callback function to get data from detector class @@ -257,6 +247,8 @@ void qDrawPlot::SetupWidgetWindow(){ myDet->registerMeasurementFinishedCallback(&(GetMeasurementFinishedCallBack),this); //Setting the callback function to get progress from detector class(using receivers) myDet->registerProgressCallback(&(GetProgressCallBack),this); + + qDefs::checkErrorMessage(myDet); } @@ -349,10 +341,13 @@ void qDrawPlot::StartStopDaqToggle(bool stop_if_running){ StartDaq(true); running=!running; + + qDefs::checkErrorMessage(myDet); } /** if this is set during client initation */ clientInitiated = false; + } @@ -491,10 +486,10 @@ void qDrawPlot::SetScanArgument(int scanArg){ lastImageArray[py*nPixelsX+px] = 0; - - UnlockLastImageArray(); + qDefs::checkErrorMessage(myDet); + } @@ -1136,7 +1131,10 @@ void qDrawPlot::ClonePlot(){ string sFilePath; if(running) sFilePath = filePath.toAscii().constData(); - else sFilePath = myDet->getFilePath(); + else { + sFilePath = myDet->getFilePath(); + qDefs::checkErrorMessage(myDet); + } @@ -1254,7 +1252,10 @@ void qDrawPlot::SavePlot(){ QString fName; if(running) fName = filePath; - else fName = QString(myDet->getFilePath().c_str()); + else { + fName = QString(myDet->getFilePath().c_str()); + qDefs::checkErrorMessage(myDet); + } if(boxPlot->title().contains('.')){ fName.append(QString('/')+boxPlot->title()); @@ -1282,7 +1283,10 @@ void qDrawPlot::SavePlotAutomatic(){ QString qFilePath; if(running) qFilePath = filePath; - else qFilePath = QString(myDet->getFilePath().c_str()); + else { + qFilePath = QString(myDet->getFilePath().c_str()); + qDefs::checkErrorMessage(myDet); + } lastSavedFrame = currentFrame; @@ -1385,6 +1389,9 @@ int qDrawPlot::UpdateTrimbitPlot(bool fromDetector,bool Histogram){ #ifdef VERBOSE cout << "Got Trimbits" << endl; #endif + + qDefs::checkErrorMessage(myDet); + //defining axes if(Histogram) nPixelsX = TRIM_HISTOGRAM_XMAX+1; else nPixelsX = actualPixelsX; From 9e1029185f858d4b4f4199325d4cda059e41d455 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 13 Mar 2013 15:48:30 +0000 Subject: [PATCH 162/332] check error message in between implemented in gui, also fixed wrong ports being set:control:stop git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@162 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qTabAdvanced.cpp | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp index 6a4428edd..adff77ce9 100644 --- a/slsDetectorGui/src/qTabAdvanced.cpp +++ b/slsDetectorGui/src/qTabAdvanced.cpp @@ -107,6 +107,7 @@ void qTabAdvanced::SetupWidgetWindow(){ comboDetector->setCurrentIndex(0); det = myDet->getSlsDetector(comboDetector->currentIndex()); + qDefs::checkErrorMessage(myDet); spinControlPort->setValue(det->getControlPort()); spinStopPort->setValue(det->getStopPort()); @@ -145,6 +146,8 @@ void qTabAdvanced::SetupWidgetWindow(){ Initialization(); + qDefs::checkErrorMessage(det); + } @@ -243,6 +246,7 @@ void qTabAdvanced::SetLogs(){ checkedBox->setChecked(!enable); } + qDefs::checkErrorMessage(myDet); } @@ -257,6 +261,7 @@ void qTabAdvanced::SetExposureTime(){ #endif myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,(int64_t)exptimeNS); + qDefs::checkErrorMessage(myDet); } @@ -268,6 +273,7 @@ void qTabAdvanced::SetThreshold(){ cout << "Setting Threshold DACu:" << spinThreshold->value() << endl; #endif spinThreshold->setValue((double)myDet->setDAC((dacs_t)spinThreshold->value(),slsDetectorDefs::THRESHOLD)); + qDefs::checkErrorMessage(myDet); } @@ -323,6 +329,8 @@ void qTabAdvanced::SetOutputFile(){ lblFile->setText("Output Trim File:*"); btnStart->setEnabled(false); } + + qDefs::checkErrorMessage(myDet); } @@ -461,6 +469,8 @@ void qTabAdvanced::StartTrimming(){ myPlot->UpdateTrimbitPlot(false,radioHistogram->isChecked()); } else qDefs::Message(qDefs::WARNING,string("Could not Save the Trimbits to file:\n")+dispFile->text().toAscii().constData(),"Advanced"); + + qDefs::checkErrorMessage(myDet); } @@ -485,7 +495,7 @@ void qTabAdvanced::SetControlPort(int port){ cout << "Setting Control Port:" << port << endl; #endif disconnect(spinControlPort, SIGNAL(valueChanged(int)), this, SLOT(SetControlPort(int))); - spinStopPort->setValue(det->setPort(slsDetectorDefs::CONTROL_PORT,port)); + spinControlPort->setValue(det->setPort(slsDetectorDefs::CONTROL_PORT,port)); qDefs::checkErrorMessage(det); connect(spinControlPort, SIGNAL(valueChanged(int)), this, SLOT(SetControlPort(int))); } @@ -499,7 +509,7 @@ void qTabAdvanced::SetStopPort(int port){ cout << "Setting Stop Port:" << port << endl; #endif disconnect(spinStopPort, SIGNAL(valueChanged(int)), this, SLOT(SetStopPort(int))); - spinControlPort->setValue(det->setPort(slsDetectorDefs::STOP_PORT,port)); + spinStopPort->setValue(det->setPort(slsDetectorDefs::STOP_PORT,port)); qDefs::checkErrorMessage(det); connect(spinStopPort, SIGNAL(valueChanged(int)), this, SLOT(SetStopPort(int))); @@ -638,6 +648,7 @@ void qTabAdvanced::updateROIList(){ int n,i; slsDetectorDefs::ROI* temp = myDet->getROI(n); + qDefs::checkErrorMessage(myDet); if((temp!=NULL)&&(n>0)){ //assign into array, else it loses values cuz of memory @@ -656,6 +667,8 @@ void qTabAdvanced::updateROIList(){ } cout << "ROIs populated: " << n << endl; } + + } @@ -760,6 +773,8 @@ void qTabAdvanced::AddROIInput(int num){ #ifdef VERYVERBOSE cout<<"ROI Inputs added " << num << endl; #endif + + qDefs::checkErrorMessage(myDet); } @@ -827,6 +842,7 @@ void qTabAdvanced::setROI(){ updateROIList(); //configuremac myDet->configureMAC(); + qDefs::checkErrorMessage(myDet); } @@ -904,6 +920,8 @@ void qTabAdvanced::SetDetector(int index){ lblRxrOnline->setText("Online:"); } } + + qDefs::checkErrorMessage(det); } @@ -982,6 +1000,8 @@ void qTabAdvanced::Refresh(){ //network det = myDet->getSlsDetector(comboDetector->currentIndex()); + qDefs::checkErrorMessage(myDet); + //disconnect disconnect(spinControlPort, SIGNAL(valueChanged(int)), this, SLOT(SetControlPort(int))); disconnect(spinStopPort, SIGNAL(valueChanged(int)), this, SLOT(SetStopPort(int))); @@ -1063,7 +1083,6 @@ void qTabAdvanced::Refresh(){ } } - //roi updateROIList(); @@ -1071,6 +1090,8 @@ void qTabAdvanced::Refresh(){ #ifdef VERBOSE cout << "**Updated Advanced Tab" << endl << endl; #endif + + qDefs::checkErrorMessage(det); } From 3e81c16f3843acb39d2f5ff279e1ec34e7ac8328 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 13 Mar 2013 15:50:41 +0000 Subject: [PATCH 163/332] check error message in between implemented in gui git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@163 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qTabDeveloper.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/slsDetectorGui/src/qTabDeveloper.cpp b/slsDetectorGui/src/qTabDeveloper.cpp index a80b9383b..f0978b05c 100644 --- a/slsDetectorGui/src/qTabDeveloper.cpp +++ b/slsDetectorGui/src/qTabDeveloper.cpp @@ -146,7 +146,7 @@ void qTabDeveloper::SetupWidgetWindow(){ adcTimer = new QTimer(this); } - + qDefs::checkErrorMessage(myDet); } //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -214,6 +214,8 @@ void qTabDeveloper::SetDacValues(int id){ cout << "Setting dac:" << dacNames[id] << " : " << spinDacs[id]->value() << endl; #endif spinDacs[id]->setValue((double)myDet->setDAC((dacs_t)spinDacs[id]->value(),getSLSIndex(id))); + + qDefs::checkErrorMessage(myDet); } @@ -226,6 +228,7 @@ void qTabDeveloper::SetHighVoltage(){ #endif int highvoltage = comboHV->currentText().toInt(); int ret = myDet->setDAC(highvoltage,slsDetectorDefs::HV_POT); + qDefs::checkErrorMessage(myDet); //error if(ret != highvoltage){ qDefs::Message(qDefs::CRITICAL,"High Voltage could not be set to this value.","Developer"); @@ -287,6 +290,7 @@ slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(int index){ break; default: qDefs::Message(qDefs::CRITICAL,string("Unknown detector type:")+myDet->slsDetectorBase::getDetectorType(detType),"Developer"); + qDefs::checkErrorMessage(myDet); exit(-1); break; } @@ -305,6 +309,7 @@ void qTabDeveloper::RefreshAdcs(){ for(int i=0;isetValue((double)myDet->getADC(getSLSIndex(i+NUM_DAC_WIDGETS))); adcTimer->start(ADC_TIMEOUT); + qDefs::checkErrorMessage(myDet); } @@ -360,6 +365,8 @@ void qTabDeveloper::Refresh(){ #ifdef VERBOSE cout << "**Updated Developer Tab" << endl << endl; #endif + + qDefs::checkErrorMessage(myDet); } From 7352407968ec0e155509b82679aaa4c52e3884ab Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 13 Mar 2013 15:50:49 +0000 Subject: [PATCH 164/332] check error message in between implemented in gui git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@164 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qTabMeasurement.cpp | 31 ++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 6967e51a6..9f27ac847 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -82,6 +82,7 @@ void qTabMeasurement::SetupWidgetWindow(){ iconStart = new QIcon(":/icons/images/start.png"); iconStop = new QIcon(":/icons/images/stop.png"); + qDefs::checkErrorMessage(myDet); } @@ -101,6 +102,7 @@ void qTabMeasurement::SetExpertMode(bool enable){ cout << "Getting number of probes : " << val << endl; #endif } + qDefs::checkErrorMessage(myDet); } @@ -177,6 +179,16 @@ void qTabMeasurement::SetupTimingMode(){ // This should not happen -only if the server and gui has a mismatch // on which all modes are allowed in detectors else{ + //check if the detector is not even connected + string offline = myDet->checkOnline(); + qDefs::checkErrorMessage(myDet); + + if(!offline.empty()){ + qDefs::Message(qDefs::CRITICAL,string("The detector(s) ")+offline+string(" is/are not connected. Exiting GUI."),"Main"); + cout << "The detector(s) " << offline << " is/are not connected. Exiting GUI." << endl; + exit(-1); + } + qDefs::Message(qDefs::WARNING,"Unknown Timing Mode detected from detector." "\n\nSetting the following defaults:\nTiming Mode \t: None\n" "Number of Frames \t: 1\nNumber of Triggers \t: 1","Measurement"); @@ -184,6 +196,7 @@ void qTabMeasurement::SetupTimingMode(){ SetTimingMode((int)None); } } + qDefs::checkErrorMessage(myDet); } @@ -272,6 +285,7 @@ void qTabMeasurement::setFileName(const QString& fName){ #ifdef VERBOSE cout << "Setting File name to " << myDet->getFileName() << endl; #endif + qDefs::checkErrorMessage(myDet); } @@ -282,6 +296,7 @@ void qTabMeasurement::setRunIndex(int index){ #ifdef VERBOSE cout << "Setting File Index to " << myDet->getFileIndex() << endl; #endif + qDefs::checkErrorMessage(myDet); } //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -320,6 +335,7 @@ void qTabMeasurement::startStopAcquisition(){ btnStartStop->setChecked(false); Enable(1); } + qDefs::checkErrorMessage(myDet); } @@ -344,6 +360,7 @@ void qTabMeasurement::UpdateFinished(){ } + qDefs::checkErrorMessage(myDet); } @@ -374,6 +391,7 @@ void qTabMeasurement::setNumMeasurements(int val){ #ifdef VERBOSE cout << "Setting Number of Measurements to " << (int)myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,-1) << endl; #endif + qDefs::checkErrorMessage(myDet); } @@ -385,6 +403,7 @@ void qTabMeasurement::setNumFrames(int val){ #ifdef VERBOSE cout << "Setting number of frames to " << (int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1) << endl; #endif + qDefs::checkErrorMessage(myDet); } @@ -416,6 +435,7 @@ void qTabMeasurement::setExposureTime(){ lblPeriod->setText("Acquisition Period:"); } } + qDefs::checkErrorMessage(myDet); } @@ -446,6 +466,7 @@ void qTabMeasurement::setAcquisitionPeriod(){ lblPeriod->setText("Acquisition Period:"); } + qDefs::checkErrorMessage(myDet); //Check if the interval between plots is ok emit CheckPlotIntervalSignal(); } @@ -459,6 +480,7 @@ void qTabMeasurement::setNumTriggers(int val){ #ifdef VERBOSE cout << "Setting number of triggers to " << (int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1) << endl; #endif + qDefs::checkErrorMessage(myDet); } @@ -473,6 +495,7 @@ void qTabMeasurement::setDelay(){ cout << "Setting delay after trigger to " << exptimeNS << " clocks" << "/" << spinDelay->value() << qDefs::getUnitString((qDefs::timeUnit)comboDelayUnit->currentIndex()) << endl; #endif myDet->setTimer(slsDetectorDefs::DELAY_AFTER_TRIGGER,(int64_t)exptimeNS); + qDefs::checkErrorMessage(myDet); } @@ -484,6 +507,7 @@ void qTabMeasurement::setNumGates(int val){ #ifdef VERBOSE cout << "Setting number of gates to " << (int)myDet->setTimer(slsDetectorDefs::GATES_NUMBER,-1) << endl; #endif + qDefs::checkErrorMessage(myDet); } @@ -495,6 +519,7 @@ void qTabMeasurement::setNumProbes(int val){ #ifdef VERBOSE cout << "Setting number of frames to " << (int)myDet->setTimer(slsDetectorDefs::PROBES_NUMBER,-1) << endl; #endif + qDefs::checkErrorMessage(myDet); } @@ -581,8 +606,10 @@ void qTabMeasurement::SetTimingMode(int mode){ default: //This should never happen qDefs::Message(qDefs::CRITICAL,"Timing mode unknown to GUI","Measurement"); + qDefs::checkErrorMessage(myDet); exit(-1); } + qDefs::checkErrorMessage(myDet); if(!success){ qDefs::Message(qDefs::WARNING,"The detector timing mode could not be set.\n" "Please check the external flags." @@ -703,6 +730,7 @@ void qTabMeasurement::SetTimingMode(int mode){ myPlot->setFrameEnabled(lblNumFrames->isEnabled()); myPlot->setTriggerEnabled(lblNumTriggers->isEnabled()); + qDefs::checkErrorMessage(myDet); emit CheckPlotIntervalSignal(); @@ -721,6 +749,7 @@ void qTabMeasurement::EnableFileWrite(bool enable){ dispFileName->setEnabled(enable); if(enable) setFileName(dispFileName->text()); myPlot->SetEnableFileWrite(enable); + qDefs::checkErrorMessage(myDet); }; //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -764,6 +793,8 @@ void qTabMeasurement::Refresh(){ // to let qdrawplot know that triggers or frames are used myPlot->setFrameEnabled(lblNumFrames->isEnabled()); myPlot->setTriggerEnabled(lblNumTriggers->isEnabled()); + + qDefs::checkErrorMessage(myDet); } #ifdef VERBOSE From b0534f194adcdd95eb6ba5ad330456d0d3b2e8a2 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 13 Mar 2013 15:51:10 +0000 Subject: [PATCH 165/332] check error message in between implemented in gui, uncommented the displaying messages part git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@165 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qTabMessages.cpp | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/slsDetectorGui/src/qTabMessages.cpp b/slsDetectorGui/src/qTabMessages.cpp index 3bbe0db9f..e3bbc4b79 100644 --- a/slsDetectorGui/src/qTabMessages.cpp +++ b/slsDetectorGui/src/qTabMessages.cpp @@ -50,6 +50,7 @@ void qTabMessages::SetupWidgetWindow(){ dispLog->setFocusPolicy(Qt::NoFocus); dispLog->setTextColor(Qt::darkBlue); + btnSave = new QPushButton("Save Log ",this); btnSave->setFocusPolicy(Qt::NoFocus); btnSave->setFixedWidth(100); @@ -67,8 +68,8 @@ void qTabMessages::SetupWidgetWindow(){ gridLayout->addWidget(dispLog,3,0,1,5); errMsg = " Please check Messages Tab. Following message was caught:

"; - //qout=new qDebugStream(std::cout,this); - //qerr=new qDebugStream(std::cerr,this); + qout=new qDebugStream(std::cout,this); + qerr=new qDebugStream(std::cerr,this); } @@ -82,17 +83,11 @@ void qTabMessages::Initialization(){ //------------------------------------------------------------------------------------------------------------------------------------------------- void qTabMessages::customEvent(QEvent *e) { - if (e->type() == (STREAMEVENT)) - dispLog->append(((qStreamEvent*)e)->getString()); - -/* QString temp = ((qStreamEvent*)e)->getString(); + if (e->type() == (STREAMEVENT)){ + QString temp = ((qStreamEvent*)e)->getString(); dispLog->append(temp); - string t=string(temp.toAscii().constData()); - if(t.find("not connect")!=string::npos) - qDefs::Message(qDefs::WARNING,errMsg+t+string(""),"Messages"); - else if(t.find("ould not")!=string::npos) - qDefs::Message(qDefs::WARNING,errMsg+t+string("
"),"Messages"); -*/ + } + } //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -114,6 +109,8 @@ void qTabMessages::SaveLog() { } else qDefs::Message(qDefs::WARNING,"Attempt to save log file failed.","Messages"); } + + qDefs::checkErrorMessage(myDet); } From ebd6a9131be14391708987740733dd33c335dc14 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 13 Mar 2013 15:53:24 +0000 Subject: [PATCH 166/332] check error message in between implemented in gui git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@166 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qActionsWidget.cpp | 8 +++++++- slsDetectorGui/src/qTabDataOutput.cpp | 26 ++++++++++++++++++++++++-- slsDetectorGui/src/qTabDebugging.cpp | 22 +++++++++++++++++++++- slsDetectorGui/src/qTabPlot.cpp | 9 +++++++++ 4 files changed, 61 insertions(+), 4 deletions(-) diff --git a/slsDetectorGui/src/qActionsWidget.cpp b/slsDetectorGui/src/qActionsWidget.cpp index 465fed646..6781128c1 100644 --- a/slsDetectorGui/src/qActionsWidget.cpp +++ b/slsDetectorGui/src/qActionsWidget.cpp @@ -96,7 +96,7 @@ void qActionsWidget::SetMode(int mode){ } } } - + qDefs::checkErrorMessage(myDet); } @@ -167,6 +167,8 @@ void qActionsWidget::SetScriptFile(){ //dont display if theres a none if(!dispScript->text().compare("none")) dispScript->setText(""); + qDefs::checkErrorMessage(myDet); + } @@ -181,6 +183,8 @@ void qActionsWidget::SetParameter(){ myDet->setActionParameter(id,parameter.toAscii().constData()); //dont display if theres a none if(!dispParameter->text().compare("none")) dispParameter->setText(""); + + qDefs::checkErrorMessage(myDet); } @@ -207,6 +211,8 @@ void qActionsWidget::Refresh(){ "script:" << script << "\t" "parameter:" << parameter << "\t***" << endl; #endif + + qDefs::checkErrorMessage(myDet); } diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index 1e8be365a..edede74c3 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -110,6 +110,7 @@ void qTabDataOutput::SetupWidgetWindow(){ if(myDet->getBadChannelCorrection()) chkDiscardBad->setChecked(true); + qDefs::checkErrorMessage(myDet); } @@ -152,9 +153,12 @@ void qTabDataOutput::setOutputDir(){ if(myDet->setReceiverOnline()==slsDetectorDefs::ONLINE_FLAG){ for(int i=0;igetNumberOfDetectors();i++){ slsDetector *det = myDet->getSlsDetector(i); + qDefs::checkErrorMessage(myDet); det->setFilePath(string(path.toAscii().constData())); + qDefs::checkErrorMessage(det); if(det->getFilePath()!=(string(path.toAscii().constData()))){ error=true; + qDefs::checkErrorMessage(det); break; } } @@ -162,7 +166,9 @@ void qTabDataOutput::setOutputDir(){ //set it back for the ones which got set for(int i=0;igetNumberOfDetectors();i++){ slsDetector *det = myDet->getSlsDetector(i); + qDefs::checkErrorMessage(myDet); det->setFilePath(oldPath); + qDefs::checkErrorMessage(det); } }//set it in multi as well if it worked so that they reflect the same else @@ -199,6 +205,8 @@ void qTabDataOutput::setOutputDir(){ } connect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(setOutputDir())); + + qDefs::checkErrorMessage(myDet); } @@ -286,6 +294,8 @@ void qTabDataOutput::SetFlatField(){ } connect(dispFlatField,SIGNAL(editingFinished()),this,SLOT(SetFlatField())); + + qDefs::checkErrorMessage(myDet); } //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -314,12 +324,13 @@ void qTabDataOutput::UpdateFlatFieldFromServer(){ chkFlatField->setText("Flat Field File:"); connect(dispFlatField, SIGNAL(editingFinished()), this, SLOT(SetFlatField())); + + qDefs::checkErrorMessage(myDet); } //------------------------------------------------------------------------------------------------------------------------------------------------- -void qTabDataOutput::BrowseFlatFieldPath() -{ +void qTabDataOutput::BrowseFlatFieldPath(){ QString fName = dispFlatField->text(); QString dir = fName.section('/',0,-2,QString::SectionIncludeLeadingSep); if(dir.isEmpty()) dir = QString(myDet->getFlatFieldCorrectionDir().c_str());/*"/home/";*/ @@ -330,6 +341,8 @@ void qTabDataOutput::BrowseFlatFieldPath() dispFlatField->setText(fName); SetFlatField(); } + + qDefs::checkErrorMessage(myDet); } @@ -381,6 +394,8 @@ void qTabDataOutput::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())); + + qDefs::checkErrorMessage(myDet); } @@ -395,6 +410,7 @@ void qTabDataOutput::UpdateRateCorrectionFromServer(){ double rate; rate = (double)myDet->getRateCorrectionTau(); + qDefs::checkErrorMessage(myDet); #ifdef VERBOSE cout << "Getting rate correction from server:" << rate << " : "; #endif @@ -461,6 +477,8 @@ void qTabDataOutput::SetAngularCorrection(){ } emit AngularConversionSignal(chkAngular->isChecked()); + + qDefs::checkErrorMessage(myDet); } @@ -482,6 +500,8 @@ void qTabDataOutput::DiscardBadChannels(){ cout << "Unsetting bad channel correction" << endl; #endif } + + qDefs::checkErrorMessage(myDet); } @@ -552,6 +572,8 @@ void qTabDataOutput::Refresh(){ #ifdef VERBOSE cout << "**Updated DataOutput Tab" << endl << endl; #endif + + qDefs::checkErrorMessage(myDet); } diff --git a/slsDetectorGui/src/qTabDebugging.cpp b/slsDetectorGui/src/qTabDebugging.cpp index 2aec64dc1..efb72a83a 100644 --- a/slsDetectorGui/src/qTabDebugging.cpp +++ b/slsDetectorGui/src/qTabDebugging.cpp @@ -91,6 +91,7 @@ void qTabDebugging::SetupWidgetWindow(){ if(detType==slsDetectorDefs::MYTHEN) UpdateModuleList(); UpdateStatus(); + qDefs::checkErrorMessage(myDet); } //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -115,6 +116,7 @@ void qTabDebugging::UpdateModuleList(){ cout << "Getting Module List" << endl; #endif det = myDet->getSlsDetector(comboDetector->currentIndex()); + qDefs::checkErrorMessage(myDet); //deletes all modules except "all modules" for(int i=0;icount()-1;i++) comboModule->removeItem(i); @@ -122,6 +124,7 @@ void qTabDebugging::UpdateModuleList(){ comboModule->addItem(QString("Module %1").arg(i)); } + qDefs::checkErrorMessage(det); } @@ -133,11 +136,12 @@ void qTabDebugging::UpdateStatus(){ cout << "Getting Status" << endl; #endif det = myDet->getSlsDetector(comboDetector->currentIndex()); + qDefs::checkErrorMessage(myDet); int detStatus = (int)det->getRunStatus(); string status = slsDetectorBase::runStatusType(slsDetectorDefs::runStatus(detStatus)); lblStatus->setText(QString(status.c_str()).toUpper()); - + qDefs::checkErrorMessage(det); } @@ -204,9 +208,11 @@ void qTabDebugging::GetInfo(){ for (int i=0;icount();i++){ QList childItems; det = myDet->getSlsDetector(i); + qDefs::checkErrorMessage(myDet); for(int j=0;jgetNMods();j++) childItems.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString("Module %1").arg(j)))); treeDet->topLevelItem(i)->insertChildren(0,childItems); + qDefs::checkErrorMessage(det); } break; @@ -305,6 +311,7 @@ void qTabDebugging::SetParameters(QTreeWidgetItem *item){ break; det = myDet->getSlsDetector(i); + qDefs::checkErrorMessage(myDet); lblDetectorId->setText(comboDetector->itemText(i)); sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SERIAL_NUMBER)); lblDetectorSerial->setText(QString(value)); @@ -312,6 +319,7 @@ void qTabDebugging::SetParameters(QTreeWidgetItem *item){ lblDetectorFirmware ->setText(QString(value)); sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SOFTWARE_VERSION)); lblDetectorSoftware->setText(QString(value)); + qDefs::checkErrorMessage(det); lblModuleId->setText(""); lblModuleSerial->setText(""); @@ -324,6 +332,7 @@ void qTabDebugging::SetParameters(QTreeWidgetItem *item){ int im = item->parent()->indexOfChild(item); det = myDet->getSlsDetector(i); + qDefs::checkErrorMessage(myDet); lblDetectorId->setText(comboDetector->itemText(i)); sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SERIAL_NUMBER)); lblDetectorSerial->setText(QString(value)); @@ -337,6 +346,8 @@ void qTabDebugging::SetParameters(QTreeWidgetItem *item){ lblModuleSerial->setText(QString(value)); sprintf(value,"%llx",det->getId(slsDetectorDefs::MODULE_FIRMWARE_VERSION,im)); lblModuleFirmware->setText(QString(value)); + + qDefs::checkErrorMessage(det); } break; } @@ -353,6 +364,7 @@ void qTabDebugging::SetParameters(QTreeWidgetItem *item){ break; det = myDet->getSlsDetector(i); + qDefs::checkErrorMessage(myDet); lblDetectorId->setText(comboDetector->itemText(i)); sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SERIAL_NUMBER)); lblDetectorSerial->setText(QString(value)); @@ -360,6 +372,8 @@ void qTabDebugging::SetParameters(QTreeWidgetItem *item){ lblDetectorFirmware ->setText(QString(value)); sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SOFTWARE_VERSION)); lblDetectorSoftware->setText(QString(value)); + + qDefs::checkErrorMessage(det); } break; } @@ -374,6 +388,7 @@ void qTabDebugging::SetParameters(QTreeWidgetItem *item){ break; det = myDet->getSlsDetector(i); + qDefs::checkErrorMessage(myDet); lblDetectorId->setText(comboDetector->itemText(i)); sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SERIAL_NUMBER)); lblDetectorSerial->setText(QString(value)); @@ -381,6 +396,8 @@ void qTabDebugging::SetParameters(QTreeWidgetItem *item){ lblDetectorFirmware ->setText(QString(value)); sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SOFTWARE_VERSION)); lblDetectorSoftware->setText(QString(value)); + + qDefs::checkErrorMessage(det); break; } @@ -421,6 +438,7 @@ void qTabDebugging::TestDetector(){ //get sls det object det = myDet->getSlsDetector(comboDetector->currentIndex()); + qDefs::checkErrorMessage(myDet); //detector firmware if(chkDetectorFirmware->isChecked()){ @@ -478,6 +496,8 @@ void qTabDebugging::TestDetector(){ } //display message qDefs::Message(qDefs::INFORMATION,message.toAscii().constData(),"Debugging"); + + qDefs::checkErrorMessage(det); } diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index f6e050747..2b5a19c43 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -153,6 +153,7 @@ void qTabPlot::SetupWidgetWindow(){ btnResetPedestal->setEnabled(false); } + qDefs::checkErrorMessage(myDet); } @@ -482,6 +483,7 @@ void qTabPlot::SetFrequency(){ //if period is 0, check exptime, if that is also 0, give warning and set to min timer if(acqPeriodMS==0){ acqPeriodMS = (myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-6)); + if(acqPeriodMS==0){ qDefs::Message(qDefs::WARNING,"Interval between Plots:
" "Every Nth Image: Period betwen Frames and Exposure Time cannot both be 0 ms.
" @@ -500,6 +502,7 @@ void qTabPlot::SetFrequency(){ connect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetFrequency())); connect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency())); connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency())); + qDefs::checkErrorMessage(myDet); return; } } @@ -594,6 +597,8 @@ void qTabPlot::SetFrequency(){ connect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetFrequency())); connect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency())); connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency())); + + qDefs::checkErrorMessage(myDet); } @@ -614,6 +619,8 @@ void qTabPlot::EnableScanBox(){ //none of these scan plotting options make sense if positions exists bool positionsExist = myDet->getAngularConversion(ang);//myDet->getPositions(); + qDefs::checkErrorMessage(myDet); + //only now enable/disable boxScan->setEnabled((mode0||mode1)&&(!positionsExist)); @@ -801,6 +808,8 @@ void qTabPlot::SetScanArgument(){ }else //done here so that it isnt set by default each time myPlot->SetScanArgument(0); + qDefs::checkErrorMessage(myDet); + } From b7629f6c67ae4f9c443faa0d8d8d8823c57c0bfe Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 15 Mar 2013 08:11:52 +0000 Subject: [PATCH 167/332] included a flag to print log or not git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@167 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qDebugStream.h | 2 ++ slsDetectorGui/slsDetectorGui.pro | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/slsDetectorGui/include/qDebugStream.h b/slsDetectorGui/include/qDebugStream.h index 93f32acc8..816fcd78d 100644 --- a/slsDetectorGui/include/qDebugStream.h +++ b/slsDetectorGui/include/qDebugStream.h @@ -30,7 +30,9 @@ using namespace std; class qStreamEvent:public QEvent{ public: qStreamEvent(QString s):QEvent(static_cast(STREAMEVENT)),str(s){ +#ifdef PRINT_LOG printf("%s\n",str.toAscii().constData()); +#endif } /** \returns the progress index */ QString getString() {return str;} diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index 6aafb84ad..465f7e448 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -22,7 +22,7 @@ CONFIG += debug no_include_pwd QMAKE_CXXFLAGS_WARN_ON = -w QMAKE_CFLAGS_WARN_ON = -w -DEFINES += VERBOSE DACS_INT THIS_PATH=\\\"$$PWD\\\" #VERYVERBOSE +DEFINES += VERBOSE DACS_INT PRINT_LOG THIS_PATH=\\\"$$PWD\\\" #VERYVERBOSE target.path += $(DESTDIR) From 303d84b24a09045711bf356605a665c4f4bc589d Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 19 Mar 2013 16:00:38 +0000 Subject: [PATCH 168/332] reduced gui_client crashes git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@168 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/client/qClient.cpp | 16 +++++++++++++--- slsDetectorGui/client/qClient.h | 3 ++- slsDetectorGui/include/qTabDeveloper.h | 4 ++++ slsDetectorGui/include/svnInfoGui.h | 6 +++--- slsDetectorGui/src/qDetectorMain.cpp | 10 ++++++++-- slsDetectorGui/src/qDrawPlot.cpp | 8 ++++---- slsDetectorGui/src/qTabSettings.cpp | 5 +++-- 7 files changed, 37 insertions(+), 15 deletions(-) diff --git a/slsDetectorGui/client/qClient.cpp b/slsDetectorGui/client/qClient.cpp index 5ad21e679..08bf87ff2 100644 --- a/slsDetectorGui/client/qClient.cpp +++ b/slsDetectorGui/client/qClient.cpp @@ -9,6 +9,7 @@ // Project Class Headers #include "MySocketTCP.h" #include "slsDetectorBase.h" + // C++ Include Headers #include #include @@ -16,14 +17,15 @@ using namespace std; +//------------------------------------------------------------------------------------------------------------------------------------------------- -int main(int argc, char *argv[]) -{ +int main(int argc, char *argv[]){ + qClient *cl =new qClient(argv[1]); cl->executeLine(argc-2, argv+2); - delete cl; + delete cl; } @@ -43,6 +45,14 @@ qClient::qClient(char* hostname){ //------------------------------------------------------------------------------------------------------------------------------------------------- +qClient::~qClient() { + if(mySocket) delete mySocket; +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + int qClient::executeLine(int narg, char *args[]){ char arg[MAX_STR_LENGTH] = ""; diff --git a/slsDetectorGui/client/qClient.h b/slsDetectorGui/client/qClient.h index f68dddfde..05413cbc1 100644 --- a/slsDetectorGui/client/qClient.h +++ b/slsDetectorGui/client/qClient.h @@ -27,7 +27,7 @@ public: /** \short The constructor*/ qClient(char* hostname); /** Destructor */ - virtual ~qClient(){}; + virtual ~qClient(); /**Execute command*/ int executeLine(int narg, char *args[]); @@ -44,6 +44,7 @@ private: /** client socket */ MySocketTCP *mySocket; + }; diff --git a/slsDetectorGui/include/qTabDeveloper.h b/slsDetectorGui/include/qTabDeveloper.h index 8acf84a78..def0a0670 100644 --- a/slsDetectorGui/include/qTabDeveloper.h +++ b/slsDetectorGui/include/qTabDeveloper.h @@ -72,6 +72,10 @@ public: */ void Refresh(); + /** To stop ADC Timer when starting acquisition + */ + void StopADCTimer(){adcTimer->stop();}; + private: /** The sls detector object */ multiSlsDetector *myDet; diff --git a/slsDetectorGui/include/svnInfoGui.h b/slsDetectorGui/include/svnInfoGui.h index 8652c3c70..7e9721f55 100644 --- a/slsDetectorGui/include/svnInfoGui.h +++ b/slsDetectorGui/include/svnInfoGui.h @@ -2,10 +2,10 @@ #define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui" //#define SVNREPPATH "" #define SVNREPUUID "af1100a4-978c-4157-bff7-07162d2ba061" -//#define SVNREV 0x152 +//#define SVNREV 0x167 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "l_maliakal_d" -#define SVNREV 0x152 -#define SVNDATE 0x20130306 +#define SVNREV 0x167 +#define SVNDATE 0x20130315 // diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 106ff3e81..7ab0af43f 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -721,14 +721,20 @@ void qDetectorMain::EnableTabs(){ //moved to here, so that its all in order, instead of signals and different threads if(!enable) { + //stop the adc timer in gotthard + if(tab_developer->isEnabled()) + tab_developer->StopADCTimer(); //set the plot type first(acccss shared memory) tab_plot->SetScanArgument(); //sets running to true myPlot->StartStopDaqToggle(); } - else//to enable scan box + else{//to enable scan box tab_plot->Refresh(); - + //to start adc timer + if(tab_developer->isEnabled()) + tab_developer->Refresh(); + } } diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index a81f54d0d..b872d9112 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -46,10 +46,10 @@ qDrawPlot::~qDrawPlot(){ Clear1DPlot(); for(QVector::iterator h = plot1D_hists.begin();h!=plot1D_hists.end();h++) delete *h; plot1D_hists.clear(); - delete[] lastImageArray; lastImageArray=0; + if(lastImageArray) delete[] lastImageArray; lastImageArray=0; StartOrStopThread(0); delete myDet; - for(int i=0;isetNumberOfModules(); #ifdef VERBOSE - cout << "Getting number of modules" << endl; + cout << "Getting number of modules:" << numMod << endl; #endif - spinNumModules->setValue(myDet->setNumberOfModules()); + spinNumModules->setValue(numMod); // Dynamic Range #ifdef VERBOSE From 10e47581e03d8a3d31a7e4512590575e3cb604e7 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Thu, 21 Mar 2013 09:27:16 +0000 Subject: [PATCH 169/332] gui_client more stable with 2 servers for stop and acquire git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@169 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/client/qClient.cpp | 78 ++++++++-- slsDetectorGui/client/qClient.h | 17 ++- slsDetectorGui/include/qDetectorMain.h | 6 +- slsDetectorGui/include/qServer.h | 40 ++++- slsDetectorGui/src/qDetectorMain.cpp | 26 +++- slsDetectorGui/src/qServer.cpp | 194 ++++++++++++++++++------- 6 files changed, 281 insertions(+), 80 deletions(-) diff --git a/slsDetectorGui/client/qClient.cpp b/slsDetectorGui/client/qClient.cpp index 08bf87ff2..1583bae52 100644 --- a/slsDetectorGui/client/qClient.cpp +++ b/slsDetectorGui/client/qClient.cpp @@ -40,6 +40,15 @@ qClient::qClient(char* hostname){ delete mySocket; exit(-1); } + + //create socket to connect to stop server + myStopSocket = new MySocketTCP(hostname, DEFAULT_GUI_PORTNO+1); + if (myStopSocket->getErrorStatus()){ + cout << "Error: could not connect to host:" << hostname << " with port " << DEFAULT_GUI_PORTNO + 1 << endl; + delete myStopSocket; + exit(-1); + } + } @@ -47,6 +56,7 @@ qClient::qClient(char* hostname){ qClient::~qClient() { if(mySocket) delete mySocket; + if(myStopSocket) delete myStopSocket; } @@ -82,9 +92,9 @@ int qClient::executeLine(int narg, char *args[]){ argument = args[1]; //start acquisition if(argument == "start") - sendToGuiServer(F_START_ACQUISITION); + startAcquisition(); else if (argument == "stop") - sendToGuiServer(F_STOP_ACQUISITION); + stopAcquisition(); else{ cout << "Error: could not parse arguments: " << argument << endl; printCommands(); @@ -96,16 +106,13 @@ int qClient::executeLine(int narg, char *args[]){ else if (cmd == "acquire"){ - sendToGuiServer(F_START_AND_READ_ALL); + startAcquisition(true); retval = getStatus(); } else if (cmd == "exit"){ - if (sendToGuiServer(F_EXIT_SERVER) == OK) - retval = "Gui Server Exited successfully."; - else - retval = "Gui Server could not exit successfully"; + return exitServer(); } @@ -127,7 +134,7 @@ int qClient::executeLine(int narg, char *args[]){ string qClient::printCommands(){ ostringstream os; - os << "\nexit \t exits server in gui" << std::endl; + os << "\nexit \t exits servers in gui" << std::endl; os << "status \t gets status of acquisition in gui. - can be running or idle" << std::endl; os << "status i starts/stops acquistion in gui-non blocking. i is start or stop" << std::endl; os << "acquire starts acquistion in gui-blocking" << std::endl; @@ -145,12 +152,12 @@ string qClient::getStatus(){ int progress = 0; char answer[100]; - if (mySocket->Connect() >= 0) { - mySocket->SendDataOnly(&fnum,sizeof(fnum)); - mySocket->ReceiveDataOnly(&ret,sizeof(ret)); - mySocket->ReceiveDataOnly(&retval,sizeof(retval)); - mySocket->ReceiveDataOnly(&progress,sizeof(progress)); - mySocket->Disconnect(); + if (myStopSocket->Connect() >= 0) { + myStopSocket->SendDataOnly(&fnum,sizeof(fnum)); + myStopSocket->ReceiveDataOnly(&ret,sizeof(ret)); + myStopSocket->ReceiveDataOnly(&retval,sizeof(retval)); + myStopSocket->ReceiveDataOnly(&progress,sizeof(progress)); + myStopSocket->Disconnect(); }else exit(-1); @@ -165,9 +172,10 @@ string qClient::getStatus(){ //------------------------------------------------------------------------------------------------------------------------------------------------- -int qClient::sendToGuiServer(int fnum){ +int qClient::startAcquisition(bool blocking){ + int fnum = F_START_ACQUISITION; + if(blocking) fnum = F_START_AND_READ_ALL; int ret = FAIL; - char mess[100] = ""; if (mySocket->Connect() >= 0) { mySocket->SendDataOnly(&fnum,sizeof(fnum)); @@ -186,3 +194,41 @@ int qClient::sendToGuiServer(int fnum){ //------------------------------------------------------------------------------------------------------------------------------------------------- + +int qClient::stopAcquisition(){ + int fnum = F_STOP_ACQUISITION; + int ret = FAIL; + + if (myStopSocket->Connect() >= 0) { + myStopSocket->SendDataOnly(&fnum,sizeof(fnum)); + myStopSocket->ReceiveDataOnly(&ret,sizeof(ret)); + if (ret == FAIL){ + myStopSocket->ReceiveDataOnly(mess,sizeof(mess)); + std::cout<< "Gui returned error: " << mess << std::endl; + } + myStopSocket->Disconnect(); + }else + exit(-1); + + return ret; +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +int qClient::exitServer(){ + int fnum = F_EXIT_SERVER; + int ret = FAIL; + + if (myStopSocket->Connect() >= 0) { + myStopSocket->SendDataOnly(&fnum,sizeof(fnum)); + myStopSocket->ReceiveDataOnly(&ret,sizeof(ret)); + myStopSocket->ReceiveDataOnly(mess,sizeof(mess)); + cout << mess << endl; + myStopSocket->Disconnect(); + }else + exit(-1); + + return ret; +} diff --git a/slsDetectorGui/client/qClient.h b/slsDetectorGui/client/qClient.h index 05413cbc1..fbec87a95 100644 --- a/slsDetectorGui/client/qClient.h +++ b/slsDetectorGui/client/qClient.h @@ -36,15 +36,28 @@ private: /** Print list of commands */ string printCommands(); - /** Send to Gui Server */ - int sendToGuiServer(int fnum); + /** Start Acquisition + * @param blocking true if its a blocking acquistion + */ + int startAcquisition(bool blocking = false); + + /** Stops Acquisition */ + int stopAcquisition(); /** Gets run status */ string getStatus(); + /** Exits Server */ + int exitServer(); + /** client socket */ MySocketTCP *mySocket; + /** client socket */ + MySocketTCP *myStopSocket; + + char mess[MAX_STR_LENGTH]; + }; diff --git a/slsDetectorGui/include/qDetectorMain.h b/slsDetectorGui/include/qDetectorMain.h index 7b0723e7e..751aaec47 100644 --- a/slsDetectorGui/include/qDetectorMain.h +++ b/slsDetectorGui/include/qDetectorMain.h @@ -77,8 +77,6 @@ public: /** Returns progress bar value */ int GetProgress(){return tab_measurement->GetProgress();}; - /** Uncheck the Listen to Gui Client mode when server has exited using exit command */ - void GuiServerExited(){actionListenGuiClient->setChecked(false);}; private: /** The Qt Application */ @@ -181,6 +179,10 @@ void EnableTabs(); * */ void SetZoomToolTip(bool disable); +/** Uncheck the Listen to gui client mode when the server has exited + */ +void UncheckServer(); + protected: /** Adjust the resizing to resize plot, except for actions tab * */ diff --git a/slsDetectorGui/include/qServer.h b/slsDetectorGui/include/qServer.h index ed2b38fa5..bd26080c6 100644 --- a/slsDetectorGui/include/qServer.h +++ b/slsDetectorGui/include/qServer.h @@ -12,17 +12,19 @@ #include "sls_detector_defs.h" #include "qDefs.h" class qDetectorMain; - /** Project Class Headers */ class multiSlsDetector; class MySocketTCP; +/** Qt Include Headers */ +#include /** C++ Include Headers */ /** *@short Sets up the gui server */ -class qServer: public virtual slsDetectorDefs{ +class qServer: public QWidget, public virtual slsDetectorDefs{ + Q_OBJECT public: @@ -41,10 +43,10 @@ private: int FunctionTable(); /** Decodes Function */ - int DecodeFunction(); + int DecodeFunction(MySocketTCP* sock); - /** Unrecognized Function */ - int M_nofunc(); + /** Exit Server */ + int ExitServer(); /** @@ -61,8 +63,21 @@ private: */ int StartServer(); - /** Exit Server */ - int ExitServer(); + /** + * Static function - Thread started which listens to client gui to stop acquisition + * Called by StartStopServer() + * @param this_pointer pointer to this object + */ + static void* StopServerThread(void *this_pointer); + + /** + * Thread started which listens to client gui to stop acquisition. + * Called by startServerThread() + * + */ + int StopServer(); + + /** Get Detector Status */ int GetStatus(); @@ -83,8 +98,12 @@ private: /** tcp socket to gui client */ MySocketTCP *mySocket; + /** tcp socket to gui client to stop or get status */ + MySocketTCP *myStopSocket; + /** server port number*/ int port_no; + /** Lock Status if server locked to a client */ int lockStatus; @@ -97,13 +116,20 @@ private: static int gui_server_thread_running; /** thread listening to gui client*/ pthread_t gui_server_thread; + /** thread also listening to gui client to stop acquisition*/ + pthread_t gui_stop_server_thread; /** server started */ int checkStarted; + int checkStopStarted; /** Message */ char mess[MAX_STR_LENGTH]; + +signals: + void ServerStoppedSignal(); + }; diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 7ab0af43f..c293bf83e 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -285,6 +285,10 @@ void qDetectorMain::Initialization(){ connect(menuUtilities, SIGNAL(triggered(QAction*)), this,SLOT(ExecuteUtilities(QAction*))); // Help Menu connect(menuHelp, SIGNAL(triggered(QAction*)), this,SLOT(ExecuteHelp(QAction*))); + + +//server + connect(myServer, SIGNAL(ServerStoppedSignal()), this,SLOT(UncheckServer())); } @@ -329,9 +333,12 @@ void qDetectorMain::EnableModes(QAction *action){ //listen to gui client if(action==actionListenGuiClient){ - disconnect(menuModes, SIGNAL(triggered(QAction*)), this,SLOT(EnableModes(QAction*))); - actionListenGuiClient->setChecked(myServer->StartStopServer(actionListenGuiClient->isChecked())); - connect(menuModes, SIGNAL(triggered(QAction*)), this,SLOT(EnableModes(QAction*))); + + myServer->StartStopServer(actionListenGuiClient->isChecked()); + + //disconnect(menuModes, SIGNAL(triggered(QAction*)), this,SLOT(EnableModes(QAction*))); + //actionListenGuiClient->setChecked(myServer->StartStopServer(actionListenGuiClient->isChecked())); + //connect(menuModes, SIGNAL(triggered(QAction*)), this,SLOT(EnableModes(QAction*))); } //Set DebugMode else if(action==actionDebug){ @@ -782,4 +789,17 @@ int qDetectorMain::StartStopAcquisitionFromClient(bool start){ } +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qDetectorMain::UncheckServer(){ +#ifdef VERBOSE + cout << "Unchecking Mode : Listen to Gui Client" << endl; +#endif + disconnect(menuModes, SIGNAL(triggered(QAction*)), this,SLOT(EnableModes(QAction*))); + actionListenGuiClient->setChecked(false); + connect(menuModes, SIGNAL(triggered(QAction*)), this,SLOT(EnableModes(QAction*))); +} + + //------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/slsDetectorGui/src/qServer.cpp b/slsDetectorGui/src/qServer.cpp index 98879d01e..5a25e686d 100644 --- a/slsDetectorGui/src/qServer.cpp +++ b/slsDetectorGui/src/qServer.cpp @@ -27,7 +27,7 @@ int qServer::gui_server_thread_running(0); qServer::qServer(qDetectorMain *t): - myMainTab(t), mySocket(NULL),port_no(DEFAULT_GUI_PORTNO),lockStatus(0){ + myMainTab(t), mySocket(NULL),myStopSocket(NULL),port_no(DEFAULT_GUI_PORTNO),lockStatus(0){ FunctionTable(); @@ -40,6 +40,7 @@ qServer::qServer(qDetectorMain *t): qServer::~qServer(){ delete myMainTab; if(mySocket) delete mySocket; + if(myStopSocket) delete myStopSocket; } @@ -48,9 +49,6 @@ qServer::~qServer(){ int qServer::FunctionTable(){ - for (int i=0;iReceiveDataOnly(&fnum,sizeof(fnum)); + n = sock->ReceiveDataOnly(&fnum,sizeof(fnum)); if (n <= 0) { #ifdef VERYVERBOSE cout << "ERROR reading from socket " << n << ", " << fnum << endl; @@ -86,8 +84,26 @@ int qServer::DecodeFunction(){ cout << "calling function fnum = "<< fnum << hex << ":"<< flist[fnum] << endl; #endif - if (fnum<0 || fnum>NUMBER_OF_FUNCTIONS-1) - fnum = NUMBER_OF_FUNCTIONS-1; + + + if (((sock == myStopSocket) && ((fnum == F_GET_RUN_STATUS) || (fnum == F_STOP_ACQUISITION) || (fnum == F_EXIT_SERVER))) || + ((sock == mySocket) && ((fnum == F_START_ACQUISITION) || (fnum == F_START_AND_READ_ALL)))) + ; + //unrecognized functions exit guis + else{ + ret = qDefs::FAIL; + sprintf(mess,"Unrecognized Function\n"); + cout << mess << endl; + + if (mySocket) + mySocket->ShutDownSocket(); + + myStopSocket->SendDataOnly(&ret,sizeof(ret)); + myStopSocket->SendDataOnly(mess,sizeof(mess)); + return GOODBYE; + } + + //calling function ret = (this->*flist[fnum])(); if (ret==qDefs::FAIL) @@ -100,20 +116,24 @@ int qServer::DecodeFunction(){ //------------------------------------------------------------------------------------------------------------------------------------------ -int qServer::M_nofunc(){ +int qServer::ExitServer(){ - int ret = qDefs::FAIL; - sprintf(mess,"Unrecognized Function\n"); + int ret = OK; + strcpy(mess," Gui Server closed successfully\n"); + + if(mySocket) + mySocket->ShutDownSocket(); + + myStopSocket->SendDataOnly(&ret,sizeof(ret)); + myStopSocket->SendDataOnly(mess,sizeof(mess)); cout << mess << endl; - mySocket->SendDataOnly(&ret,sizeof(ret)); - mySocket->SendDataOnly(mess,sizeof(mess)); - return GOODBYE; } -//------------------------------------------------------------------------------------------------------------------------------------------------- +//------------------------------------------------------------------------------------------------------------------------------------------ + int qServer::StartStopServer(int start){ @@ -125,26 +145,43 @@ int qServer::StartStopServer(int start){ #endif if(!gui_server_thread_running){ -#ifdef VERBOSE - cout << "Starting gui server thread ...." << endl; -#endif gui_server_thread_running=1; - checkStarted=1; + + //error creating thread + checkStarted=1; if (pthread_create(&gui_server_thread, NULL,StartServerThread, (void*) this)){ gui_server_thread_running=0; qDefs::Message(qDefs::WARNING,"Can't create gui server thread", "Server"); - return 0; + cout << "ERROR: Can't create gui server thread" << endl; + return FAIL; } while(checkStarted); - checkStarted=0; + checkStarted = 0; #ifdef VERBOSE if(gui_server_thread_running) cout << "Server thread created successfully." << endl; #endif + + + //error creating thread + checkStopStarted=1; + if (pthread_create(&gui_stop_server_thread, NULL,StopServerThread, (void*) this)){ + gui_server_thread_running=0; + qDefs::Message(qDefs::WARNING,"Can't create gui stop server thread", "Server"); + cout << "ERROR: Can't create gui stop server thread" << endl; + return FAIL; + } + while(checkStopStarted); + checkStopStarted=0; +#ifdef VERBOSE + if(gui_server_thread_running) + cout << "Server Stop thread created successfully." << endl; +#endif } } + //stop server else{ #ifdef VERBOSE @@ -152,10 +189,8 @@ int qServer::StartStopServer(int start){ #endif if(gui_server_thread_running){ -#ifdef VERBOSE - cout << "Stopping gui server thread ...." << endl; -#endif gui_server_thread_running=0; + if(mySocket) mySocket->ShutDownSocket(); pthread_join(gui_server_thread,NULL); @@ -163,13 +198,20 @@ int qServer::StartStopServer(int start){ delete mySocket; mySocket = NULL; } + + if(myStopSocket) + myStopSocket->ShutDownSocket(); + pthread_join(gui_stop_server_thread,NULL); + if(myStopSocket){ + delete myStopSocket; + myStopSocket = NULL; + } } #ifdef VERBOSE - cout << "Server stopped successfully." << endl; + cout << "Server threads stopped successfully." << endl; #endif } - return gui_server_thread_running; } @@ -177,6 +219,71 @@ int qServer::StartStopServer(int start){ //------------------------------------------------------------------------------------------------------------------------------------------------- +void* qServer::StopServerThread(void* this_pointer){ + ((qServer*)this_pointer)->StopServer(); + return this_pointer; +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + + +int qServer::StopServer(){ +#ifdef VERYVERBOSE + cout << "In StopServer()" << endl; +#endif + int ret = qDefs::OK; + + myStopSocket = new MySocketTCP(port_no+1); + if (myStopSocket->getErrorStatus()){ + gui_server_thread_running = 0; + qDefs::Message(qDefs::WARNING,"Could not start gui stop server socket","Server"); + } + checkStopStarted = 0; + + while ((gui_server_thread_running) && (ret!=GOODBYE)) { +#ifdef VERBOSE + cout<< endl; +#endif +#ifdef VERYVERBOSE + cout << "Waiting for client call" << endl; +#endif + if(myStopSocket->Connect()>=0){ +#ifdef VERYVERBOSE + cout << "Conenction accepted" << endl; +#endif + ret = DecodeFunction(myStopSocket); +#ifdef VERYVERBOSE + cout << "function executed" << endl; +#endif + myStopSocket->Disconnect(); +#ifdef VERYVERBOSE + cout << "connection closed" << endl; +#endif + } + } +#ifdef VERBOSE + cout << "Stopped gui stop server thread" << endl; +#endif + gui_server_thread_running = 0; + //delete socket(via exit server) + if(myStopSocket){ + delete myStopSocket; + myStopSocket = NULL; + } + + if(!gui_server_thread_running) + emit ServerStoppedSignal(); + + return qDefs::OK; +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + + void* qServer::StartServerThread(void* this_pointer){ ((qServer*)this_pointer)->StartServer(); return this_pointer; @@ -189,7 +296,7 @@ void* qServer::StartServerThread(void* this_pointer){ int qServer::StartServer(){ #ifdef VERYVERBOSE - cout << "In StartServer()\n"); + cout << "In StartServer()" << endl; #endif int ret = qDefs::OK; @@ -211,7 +318,7 @@ int qServer::StartServer(){ #ifdef VERYVERBOSE cout << "Conenction accepted" << endl; #endif - ret = DecodeFunction(); + ret = DecodeFunction(mySocket); #ifdef VERYVERBOSE cout << "function executed" << endl; #endif @@ -230,8 +337,10 @@ int qServer::StartServer(){ delete mySocket; mySocket = NULL; } - //uncheck the server in modes(via exit server) - myMainTab->GuiServerExited(); + + if(!gui_server_thread_running) + emit ServerStoppedSignal(); + return qDefs::OK; } @@ -254,9 +363,9 @@ int qServer::GetStatus(){ progress = myMainTab->GetProgress(); // send answer - mySocket->SendDataOnly(&ret,sizeof(ret)); - mySocket->SendDataOnly(&retval,sizeof(retval)); - mySocket->SendDataOnly(&progress,sizeof(progress)); + myStopSocket->SendDataOnly(&ret,sizeof(ret)); + myStopSocket->SendDataOnly(&retval,sizeof(retval)); + myStopSocket->SendDataOnly(&progress,sizeof(progress)); //return ok/fail return ret; } @@ -286,9 +395,9 @@ int qServer::StopsAcquisition(){ strcpy(mess,"Could not stop acquisition in gui. \n"); int ret = myMainTab->StartStopAcquisitionFromClient(false); - mySocket->SendDataOnly(&ret,sizeof(ret)); + myStopSocket->SendDataOnly(&ret,sizeof(ret)); if(ret==FAIL) - mySocket->SendDataOnly(mess,sizeof(mess)); + myStopSocket->SendDataOnly(mess,sizeof(mess)); return ret; } @@ -316,18 +425,3 @@ int qServer::Acquire(){ //------------------------------------------------------------------------------------------------------------------------------------------ - -int qServer::ExitServer(){ - - int ret = OK; - strcpy(mess,"closing gui server"); - - mySocket->SendDataOnly(&ret,sizeof(ret)); - mySocket->SendDataOnly(mess,sizeof(mess)); - cout << mess << endl; - - return GOODBYE; -} - - -//------------------------------------------------------------------------------------------------------------------------------------------ From d56b2b480b4f234a9962a19d5da66383b3ec204b Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Thu, 4 Apr 2013 07:23:19 +0000 Subject: [PATCH 170/332] edited the gui makefile to be able to compile withot errors from this directory git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@170 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/Makefile | 6 ++++-- slsDetectorGui/slsDetectorGui.pro | 8 ++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/slsDetectorGui/Makefile b/slsDetectorGui/Makefile index 5088393d4..475caa294 100644 --- a/slsDetectorGui/Makefile +++ b/slsDetectorGui/Makefile @@ -1,10 +1,12 @@ PROG= $(DESTDIR)/slsDetectorGui -#DIR= $(shell ls src/* slsDetectorPlotting/include/* slsDetectorPlotting/src/* include/ forms/*) DESTDIR?=bin DOCDIR?=docs -LIBDIR?=../slsDetectorSoftware +LIBDIR?=../bin +LIBRARYDIR?=../slsDetectorSoftware +INCLUDES?= $(LIBRARYDIR)/commonFiles -I$(LIBRARYDIR)/MySocketTCP -I$(LIBRARYDIR)/slsReceiverInterface -I$(LIBRARYDIR)/slsDetector -I$(LIBRARYDIR)/slsDetectorAnalysis -I$(LIBRARYDIR)/multiSlsDetector -I$(LIBRARYDIR)/usersFunctions +LDFLAG?=-L$(LIBRARYDIR)/bin -lSlsDetector all: $(PROG) Makefile.gui guiclient diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index 465f7e448..d0c3ca3f1 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -46,14 +46,14 @@ DEPENDPATH += \ INCLUDEPATH = \ $(QWTDIR)/include\ $(QWTDIR) \ - $(QWTDIR)/src\ - $(QWT3D)/include\ + $(QWTDIR)/src\ + $(QWT3D)/include\ slsDetectorPlotting/include\ include\ forms/include\ - $(INCLUDES) + $(INCLUDES) -# $(shell echo "/lib/modules/`uname -r`/build/include") \ +# $(shell echo "/lib/modules/`uname -r`/build/include") \ # ../slsDetectorSoftware/commonFiles\ # ../slsDetectorSoftware/MySocketTCP\ # ../slsDetectorSoftware/slsReceiverInterface\ From 050bec703d21c257ab2ac3770bb7018ed7ac2087 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 10 Apr 2013 13:34:52 +0000 Subject: [PATCH 171/332] defining everything to reduce null pointer errors, fixed zooming problem for scans git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@171 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qCloneWidget.h | 9 -------- slsDetectorGui/include/qDetectorMain.h | 2 ++ slsDetectorGui/include/qDrawPlot.h | 3 +++ slsDetectorGui/include/qTabMessages.h | 11 +++++----- slsDetectorGui/src/qCloneWidget.cpp | 6 +----- slsDetectorGui/src/qDetectorMain.cpp | 6 +++--- slsDetectorGui/src/qDrawPlot.cpp | 29 +++++++++++++++++++++++--- slsDetectorGui/src/qScanWidget.cpp | 1 + slsDetectorGui/src/qServer.cpp | 4 ++-- slsDetectorGui/src/qTabActions.cpp | 22 ++++++++++++++++++- slsDetectorGui/src/qTabAdvanced.cpp | 12 ++++++++++- slsDetectorGui/src/qTabDebugging.cpp | 14 ++++++++++++- slsDetectorGui/src/qTabDeveloper.cpp | 17 +++++++++++++-- slsDetectorGui/src/qTabMessages.cpp | 12 ++++------- slsDetectorGui/src/qTabPlot.cpp | 13 +++++++++++- slsDetectorGui/src/qTabSettings.cpp | 2 ++ 16 files changed, 121 insertions(+), 42 deletions(-) diff --git a/slsDetectorGui/include/qCloneWidget.h b/slsDetectorGui/include/qCloneWidget.h index d83f38e0f..65ae2e550 100644 --- a/slsDetectorGui/include/qCloneWidget.h +++ b/slsDetectorGui/include/qCloneWidget.h @@ -119,15 +119,6 @@ private: QGridLayout *mainLayout; QGroupBox *cloneBox; QGridLayout *gridClone; - QGroupBox *boxSave; - QHBoxLayout *layoutSave; - QLabel *lblFName; - QHBoxLayout *hLayoutSave; - QLineEdit *dispFName; - QComboBox *comboFormat; - QPushButton *btnSave; - QCheckBox *chkAutoFName; - QCheckBox *chkSaveAll; QLabel *lblHistTitle; diff --git a/slsDetectorGui/include/qDetectorMain.h b/slsDetectorGui/include/qDetectorMain.h index 751aaec47..9d9848f7d 100644 --- a/slsDetectorGui/include/qDetectorMain.h +++ b/slsDetectorGui/include/qDetectorMain.h @@ -77,6 +77,8 @@ public: /** Returns progress bar value */ int GetProgress(){return tab_measurement->GetProgress();}; + /** Returns file path */ + QString GetFilePath(){QString s = QString(myDet->getFilePath().c_str());qDefs::checkErrorMessage(myDet); return s;}; private: /** The Qt Application */ diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index e1ac9536b..1f3b8ad61 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -125,6 +125,8 @@ public: * and this is reset when the gui really starts/stops- to know when to return */ bool GetClientInitiated(){return clientInitiated;}; + /** Unzoom plot 2d as it will affect scans */ + void plot2DUnzoom(); public slots: /** To select 1D or 2D plot @@ -157,6 +159,7 @@ void SetScanArgument(int scanArg); /** sets stop_signal to true */ void StopAcquisition(){ stop_signal = true; }; + //pedestal /** reset pedestal */ void ResetPedestal(); diff --git a/slsDetectorGui/include/qTabMessages.h b/slsDetectorGui/include/qTabMessages.h index 6524f2a52..8dd7f611b 100644 --- a/slsDetectorGui/include/qTabMessages.h +++ b/slsDetectorGui/include/qTabMessages.h @@ -14,7 +14,7 @@ /** Project Class Headers */ -class multiSlsDetector; +class qDetectorMain; /** Qt Include Headers */ #include #include @@ -30,10 +30,9 @@ class qTabMessages:public QWidget{ public: /** \short The constructor - * @param parent is the parent tab widget - * @param det the detector reference + * @param det the qDetectorMain class reference */ - qTabMessages(QWidget *parent,multiSlsDetector* detector); + qTabMessages(qDetectorMain* m); /** Destructor */ @@ -41,8 +40,8 @@ public: private: - /** The sls detector object */ - multiSlsDetector *myDet; + /** The qDetectorMain object */ + qDetectorMain *myMainTab; /** Log of executed commands */ QTextEdit *dispLog; diff --git a/slsDetectorGui/src/qCloneWidget.cpp b/slsDetectorGui/src/qCloneWidget.cpp index 0b4110168..736b6052b 100644 --- a/slsDetectorGui/src/qCloneWidget.cpp +++ b/slsDetectorGui/src/qCloneWidget.cpp @@ -19,7 +19,7 @@ //------------------------------------------------------------------------------------------------------------------------------------------------- qCloneWidget::qCloneWidget(QWidget *parent,int id,QString title,int numDim,SlsQt1DPlot*& plot1D,SlsQt2DPlotLayout*& plot2D,string FilePath): - QMainWindow(parent),id(id),filePath(FilePath){ + QMainWindow(parent),id(id),cloneplot2D(0),cloneplot1D(0),filePath(FilePath){ /** Window title*/ char winTitle[300],currTime[50]; strcpy(currTime,GetCurrentTimeStamp()); @@ -36,7 +36,6 @@ qCloneWidget::~qCloneWidget(){ delete cloneplot1D; delete cloneplot2D; delete cloneBox; - delete boxSave; } //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -82,13 +81,11 @@ void qCloneWidget::SetupWidgetWindow(QString title,int numDim,SlsQt1DPlot*& plot } /** main window widgets */ - //mainLayout->addWidget(boxSave,0,0); mainLayout->addWidget(cloneBox,1,0); setCentralWidget(centralWidget); /** Save */ connect(actionSave,SIGNAL(triggered()),this,SLOT(SavePlot())); - //connect(btnSave, SIGNAL(clicked()), this, SLOT(SavePlot())); setMinimumHeight(300); resize(500,350); @@ -218,7 +215,6 @@ char* qCloneWidget::GetCurrentTimeStamp(){ //------------------------------------------------------------------------------------------------------------------------------------------------- void qCloneWidget::SavePlot(){ - //QString fName = QString(filePath.c_str())+'/'+dispFName->text()+comboFormat->currentText(); char cID[10]; sprintf(cID,"%d",id); //title diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index c293bf83e..d22eaaacb 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -47,7 +47,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){ + QMainWindow(parent), theApp(app),myDet(0),detID(0),myPlot(0),tabs(0),isDeveloper(0){ string configFName = ""; // Getting all the command line arguments @@ -77,7 +77,7 @@ qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app, QWidget * qDetectorMain::~qDetectorMain(){ - delete myDet; + if(myDet) delete myDet; if (menubar) delete menubar; if (centralwidget) delete centralwidget; } @@ -194,7 +194,7 @@ void qDetectorMain::SetUpDetector(const string fName){ myDet = new multiSlsDetector(detID); //create messages tab to capture config file loading logs - tab_messages = new qTabMessages (this,myDet); cout<<"Messages ready"<GetPlot()->SetZoom(-0.5,startPixel,nPixelsX,endPixel-startPixel); + cout << "Starting new acquisition threadddd ...." << endl; // Start acquiring data from server @@ -434,6 +438,7 @@ void qDrawPlot::SetScanArgument(int scanArg){ if(plot_in_scope==1) Clear1DPlot(); + LockLastImageArray(); @@ -557,14 +562,14 @@ void qDrawPlot::SetupMeasurement(){ endPixel = maxPixelsY + (pixelWidth/2); } } -/* + cout<<"nPixelsX:"<progressIndex; currentFrameIndex = fileIOStatic::getIndicesFromFileName(string(data->fileName),currentFileIndex); + //happens if receiver sends a null and empty file name + if(string(data->fileName).empty()){ + cout << "Received empty file name. Exiting function without updating data for plot." << endl; + return -1; + } #ifdef VERYVERBOSE cout << "progress:" << progress << endl; #endif @@ -1075,6 +1085,7 @@ void qDrawPlot::UpdatePlot(){ XYRangeChanged = false; } if(saveAll) SavePlotAutomatic(); + cout<<"updated 2d plot: ymin:"<GetPlot()->GetYMinimum()<< "\tymax:"<GetPlot()->GetYMaximum()<GetPlot()->SetXMinMax(plot2D->GetPlot()->GetXMinimum(),plot2D->GetPlot()->GetXMaximum()); + plot2D->GetPlot()->SetYMinMax(plot2D->GetPlot()->GetYMinimum(),plot2D->GetPlot()->GetYMaximum()); + + //if(scanArgument!=None)/*if(plot_in_scope==2)*/ + // plot2D->GetPlot()->UnZoom(); +} + + //------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/slsDetectorGui/src/qScanWidget.cpp b/slsDetectorGui/src/qScanWidget.cpp index 7e307625c..48f281a2c 100644 --- a/slsDetectorGui/src/qScanWidget.cpp +++ b/slsDetectorGui/src/qScanWidget.cpp @@ -31,6 +31,7 @@ const string qScanWidget::modeNames[NumModes]={"","energy","threshold","trimbits qScanWidget::qScanWidget(QWidget *parent,multiSlsDetector*& detector): QWidget(parent),myDet(detector),actualNumSteps(0){ setupUi(this); + positions.resize(0); SetupWidgetWindow(); Initialization(); LoadPositions(); diff --git a/slsDetectorGui/src/qServer.cpp b/slsDetectorGui/src/qServer.cpp index 5a25e686d..47fd52ffb 100644 --- a/slsDetectorGui/src/qServer.cpp +++ b/slsDetectorGui/src/qServer.cpp @@ -27,8 +27,8 @@ int qServer::gui_server_thread_running(0); qServer::qServer(qDetectorMain *t): - myMainTab(t), mySocket(NULL),myStopSocket(NULL),port_no(DEFAULT_GUI_PORTNO),lockStatus(0){ - + myMainTab(t), mySocket(NULL),myStopSocket(NULL),port_no(DEFAULT_GUI_PORTNO),lockStatus(0),checkStarted(0),checkStopStarted(0){ + strcpy(mess,""); FunctionTable(); } diff --git a/slsDetectorGui/src/qTabActions.cpp b/slsDetectorGui/src/qTabActions.cpp index 0a6772c89..ff0553f31 100644 --- a/slsDetectorGui/src/qTabActions.cpp +++ b/slsDetectorGui/src/qTabActions.cpp @@ -20,7 +20,27 @@ using namespace std; qTabActions::qTabActions(QWidget *parent,multiSlsDetector*& detector): - QWidget(parent),myDet(detector),positions(NULL){ + QWidget(parent),myDet(detector), + positionWidget(0), + lblNumPos(0), + lblPosList(0), + spinNumPos(0), + comboPos(0), + btnDelete(0), + chkInvert(0), + chkSeparate(0), + chkReturn(0), + positions(0), + iconPlus(0), + iconMinus(0){ + for(int i=0;i<6;i++) + actionWidget[i]=0; + for(int i=0;i<2;i++) + scanWidget[i]=0; + for(int i=0;i #include @@ -24,8 +23,7 @@ using namespace std; //------------------------------------------------------------------------------------------------------------------------------------------------- -qTabMessages::qTabMessages(QWidget *parent,multiSlsDetector* detector):QWidget(parent),qout(0),qerr(0){//myDet(detector), - myDet=detector; +qTabMessages::qTabMessages(qDetectorMain* m):myMainTab(m),qout(0),qerr(0){ SetupWidgetWindow(); Initialization(); } @@ -33,7 +31,7 @@ qTabMessages::qTabMessages(QWidget *parent,multiSlsDetector* detector):QWidget(p //------------------------------------------------------------------------------------------------------------------------------------------------- qTabMessages::~qTabMessages(){ - // delete myDet; + delete myMainTab; delete dispLog; delete qout; delete qerr; @@ -94,7 +92,7 @@ void qTabMessages::customEvent(QEvent *e) { void qTabMessages::SaveLog() { //cerr<getFilePath().c_str()); + QString fName = QString(myMainTab->GetFilePath()); fName = fName+"/LogFile.txt"; fName = QFileDialog::getSaveFileName(this,tr("Save Snapshot "), fName,tr("Text files (*.txt)")); @@ -109,8 +107,6 @@ void qTabMessages::SaveLog() { } else qDefs::Message(qDefs::WARNING,"Attempt to save log file failed.","Messages"); } - - qDefs::checkErrorMessage(myDet); } diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index 2b5a19c43..fc7d7a9d5 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -33,7 +33,18 @@ QString qTabPlot::defaultImageZAxisTitle("Intensity"); //------------------------------------------------------------------------------------------------------------------------------------------------- -qTabPlot::qTabPlot(QWidget *parent,multiSlsDetector*& detector, qDrawPlot*& plot):QWidget(parent),myDet(detector),myPlot(plot){ +qTabPlot::qTabPlot(QWidget *parent,multiSlsDetector*& detector, qDrawPlot*& plot): + QWidget(parent), + myDet(detector), + myPlot(plot), + isOneD(false), + isOriginallyOneD(false), + wrongInterval(0), + stackedLayout(0), + spinNthFrame(0), + spinTimeGap(0), + comboTimeGapUnit(0), + btnGroupScan(0){ setupUi(this); SetupWidgetWindow(); Initialization(); diff --git a/slsDetectorGui/src/qTabSettings.cpp b/slsDetectorGui/src/qTabSettings.cpp index 67672e097..4047daf0b 100644 --- a/slsDetectorGui/src/qTabSettings.cpp +++ b/slsDetectorGui/src/qTabSettings.cpp @@ -19,6 +19,8 @@ using namespace std; qTabSettings::qTabSettings(QWidget *parent,multiSlsDetector*& detector): QWidget(parent),myDet(detector),expertMode(false){ + for(int i=0;i Date: Tue, 16 Apr 2013 13:43:28 +0000 Subject: [PATCH 172/332] adjusted gui for moench and proper 2d plots, which are not scans for 1ds git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@172 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qDefs.h | 14 ++ slsDetectorGui/include/qDrawPlot.h | 8 +- slsDetectorGui/include/svnInfoGui.h | 6 +- .../slsDetectorPlotting/src/SlsQt2DPlot.cxx | 5 +- slsDetectorGui/src/qDetectorMain.cpp | 1 + slsDetectorGui/src/qDrawPlot.cpp | 211 +++++++++--------- slsDetectorGui/src/qTabActions.cpp | 2 +- slsDetectorGui/src/qTabAdvanced.cpp | 14 +- slsDetectorGui/src/qTabDebugging.cpp | 59 ++++- slsDetectorGui/src/qTabDeveloper.cpp | 25 ++- slsDetectorGui/src/qTabMeasurement.cpp | 1 + slsDetectorGui/src/qTabPlot.cpp | 7 +- slsDetectorGui/src/qTabSettings.cpp | 1 + 13 files changed, 224 insertions(+), 130 deletions(-) diff --git a/slsDetectorGui/include/qDefs.h b/slsDetectorGui/include/qDefs.h index 610488bf6..448fd11b6 100644 --- a/slsDetectorGui/include/qDefs.h +++ b/slsDetectorGui/include/qDefs.h @@ -255,6 +255,20 @@ static const int64_t GUI_VERSION=0x20121213; //------------------------------------------------------------------------------------------------------------------------------------------------- + + /** scan arguments*/ + enum scanArgumentList{ + None, + Level0, + Level1, + FileIndex, + AllFrames + }; + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + }; diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index 1f3b8ad61..ebb9485c3 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -125,8 +125,7 @@ public: * and this is reset when the gui really starts/stops- to know when to return */ bool GetClientInitiated(){return clientInitiated;}; - /** Unzoom plot 2d as it will affect scans */ - void plot2DUnzoom(); + public slots: /** To select 1D or 2D plot @@ -460,7 +459,6 @@ bool isFrameEnabled; bool isTriggerEnabled; /** scan arguments*/ -enum scanArgumentList{None,Level0,Level1,FileIndex,AllFrames}; int scanArgument; /** enable angle plot */ @@ -482,6 +480,10 @@ bool backwardScanPlot; bool fileSaveEnable; +/** true of originally 2d */ +bool originally2D; + + //pedstal /** Number of pedestal frames*/ static const int NUM_PEDESTAL_FRAMES = 20; diff --git a/slsDetectorGui/include/svnInfoGui.h b/slsDetectorGui/include/svnInfoGui.h index 7e9721f55..bd0ff4dba 100644 --- a/slsDetectorGui/include/svnInfoGui.h +++ b/slsDetectorGui/include/svnInfoGui.h @@ -2,10 +2,10 @@ #define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui" //#define SVNREPPATH "" #define SVNREPUUID "af1100a4-978c-4157-bff7-07162d2ba061" -//#define SVNREV 0x167 +//#define SVNREV 0x171 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "l_maliakal_d" -#define SVNREV 0x167 -#define SVNDATE 0x20130315 +#define SVNREV 0x171 +#define SVNDATE 0x20130410 // diff --git a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx index 3eebbd4a7..edd496627 100644 --- a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx +++ b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx @@ -255,11 +255,14 @@ void SlsQt2DPlot::Update(){ setAxisScale(QwtPlot::yRight,zInterval.minValue(), zInterval.maxValue()); +#ifdef VERYVERBOSE cout << "axis scale set" << endl; - +#endif plotLayout()->setAlignCanvasToScales(true); +#ifdef VERYVERBOSE cout << "layout" << endl; #endif +#endif #ifdef VERYVERBOSE cout << "going to replot" << endl; #endif diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index d22eaaacb..f4f0ff63d 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -231,6 +231,7 @@ void qDetectorMain::SetUpDetector(const string fName){ case slsDetectorDefs::EIGER: break; case slsDetectorDefs::GOTTHARD: actionLoadTrimbits->setText("Load Settings"); actionSaveTrimbits->setText("Save Settings"); break; case slsDetectorDefs::AGIPD: actionLoadTrimbits->setText("Load Settings"); actionSaveTrimbits->setText("Save Settings"); break; + case slsDetectorDefs::MOENCH: actionLoadTrimbits->setText("Load Settings"); actionSaveTrimbits->setText("Save Settings"); break; default: string detName = myDet->slsDetectorBase::getDetectorType(detType); qDefs::checkErrorMessage(myDet); diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index fb0dab67d..ede539f9a 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -60,6 +60,19 @@ void qDrawPlot::SetupWidgetWindow(){ #ifdef VERBOSE cout << "Setting up plot variables" << endl; #endif + + // Depending on whether the detector is 1d or 2d + switch(myDet->getDetectorsType()){ + case slsDetectorDefs::MYTHEN: originally2D = false; break; + case slsDetectorDefs::EIGER: originally2D = true; break; + case slsDetectorDefs::GOTTHARD: originally2D = false; break; + case slsDetectorDefs::MOENCH: originally2D = true; break; + default: + cout << "ERROR: Detector Type is Generic" << endl; + exit(-1); + } + + data_pause_over = true;//to get the first image currentMeasurement = 0; @@ -95,8 +108,8 @@ void qDrawPlot::SetupWidgetWindow(){ plotTitle = ""; plotTitle_prefix = ""; plot_in_scope = 0; - nPixelsX = myDet->getTotalNumberOfChannels(); - nPixelsY = 100; + nPixelsX = myDet->getTotalNumberOfChannels(slsDetectorDefs::X); cout<<"nPixelsX:"<getTotalNumberOfChannels(slsDetectorDefs::Y); cout<<"nPixelsY:"<GetPlot()->SetZoom(-0.5,startPixel,nPixelsX,endPixel-startPixel); @@ -432,7 +446,7 @@ bool qDrawPlot::StartOrStopThread(bool start){ void qDrawPlot::SetScanArgument(int scanArg){ #ifdef VERBOSE - cout << "SetScanArgument function:" << running << endl; + cout << "SetScanArgument function:" << scanArg << " running:" << running << endl; #endif scanArgument = scanArg; @@ -442,11 +456,11 @@ void qDrawPlot::SetScanArgument(int scanArg){ LockLastImageArray(); - nPixelsX = myDet->getTotalNumberOfChannels(); - nPixelsY = 100;//if number of exposures, this should be checked before acquisition + nPixelsX = myDet->getTotalNumberOfChannels(slsDetectorDefs::X); + nPixelsY = myDet->getTotalNumberOfChannels(slsDetectorDefs::Y); //cannot do this in between measurements , so update instantly - if(scanArgument==Level0){ + if(scanArgument==qDefs::Level0){ //no need to check if numsteps=0,cuz otherwise this mode wont be set in plot tab int numSteps = myDet->getScanSteps(0); double *values = new double[numSteps]; @@ -455,7 +469,7 @@ void qDrawPlot::SetScanArgument(int scanArg){ maxPixelsY = values[numSteps-1]; minPixelsY = values[0]; nPixelsY = numSteps; - }else if(scanArgument==Level1) { + }else if(scanArgument==qDefs::Level1) { //no need to check if numsteps=0,cuz otherwise this mode wont be set in plot tab int numSteps = myDet->getScanSteps(1); double *values = new double[numSteps]; @@ -522,9 +536,8 @@ void qDrawPlot::SetupMeasurement(){ for(int px=0;px<(int)nPixelsX;px++) lastImageArray[py*nPixelsX+px] = 0; - - //no scan - if(scanArgument==None){ + //1d with no scan + if ((!originally2D) && (scanArgument==qDefs::None)){ if(!running){ maxPixelsY = 100; minPixelsY = 0; @@ -532,13 +545,20 @@ void qDrawPlot::SetupMeasurement(){ endPixel = nPixelsY-0.5; } } - else {//all frames - if(scanArgument==AllFrames){ + else { + //2d with no scan + if ((originally2D) && (scanArgument==qDefs::None)){ + maxPixelsY = nPixelsY; + minPixelsY = 0; + } + + //all frames + else if(scanArgument==qDefs::AllFrames){ maxPixelsY = number_of_exposures - 1; minPixelsY = 0; if(!running) nPixelsY = number_of_exposures; }//file index - else if(scanArgument==FileIndex){ + else if(scanArgument==qDefs::FileIndex){ maxPixelsY = number_of_frames - 1; minPixelsY = 0; if(!running) nPixelsY = number_of_frames; @@ -563,13 +583,14 @@ void qDrawPlot::SetupMeasurement(){ } } +/* cout<<"nPixelsX:"<fileName).section('/',-1); - //variables - lastImageNumber= currentFrame+1; - //title - imageTitle = temp_title; - //copy data - memcpy(lastImageArray+(currentScanDivLevel*nPixelsX),data->values,nPixelsX*sizeof(double)); - pthread_mutex_unlock(&(last_image_complete_mutex)); - break; - } +//if scan + //alframes + if(scanArgument==qDefs::AllFrames){ + while(1){ + if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ + //set title + plotTitle=QString(plotTitle_prefix)+QString(data->fileName).section('/',-1); + //variables + lastImageNumber= currentFrame+1; + //title + imageTitle = temp_title; + //copy data + memcpy(lastImageArray+(currentScanDivLevel*nPixelsX),data->values,nPixelsX*sizeof(double)); + pthread_mutex_unlock(&(last_image_complete_mutex)); + break; } - currentFrame++; - currentScanDivLevel++; - return 0; } - //file index - if(scanArgument==FileIndex){ - while(1){ - if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ - //set title - plotTitle=QString(plotTitle_prefix)+QString(data->fileName).section('/',-1); - //variables - if(currentFrameIndex == 0) currentScanDivLevel = 0; - lastImageNumber= currentFrame+1; - //title - imageTitle = temp_title; - //copy data - for(unsigned int px=0;pxvalues[px]; - pthread_mutex_unlock(&(last_image_complete_mutex)); - break; - } + currentFrame++; + currentScanDivLevel++; + return 0; + } + //file index + if(scanArgument==qDefs::FileIndex){ + while(1){ + if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ + //set title + plotTitle=QString(plotTitle_prefix)+QString(data->fileName).section('/',-1); + //variables + if(currentFrameIndex == 0) currentScanDivLevel = 0; + lastImageNumber= currentFrame+1; + //title + imageTitle = temp_title; + //copy data + for(unsigned int px=0;pxvalues[px]; + pthread_mutex_unlock(&(last_image_complete_mutex)); + break; } - currentFrame++; - currentScanDivLevel++; - return 0; } - //level0 - if(scanArgument==Level0){ - while(1){ - if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ - //set title - plotTitle=QString(plotTitle_prefix)+QString(data->fileName).section('/',-1); - //get scanvariable0 - int ci = 0, fi = 0, p = 0, di = 0; double cs0 = 0 , cs1 = 0; - fileIOStatic::getVariablesFromFileName(string(data->fileName), ci, fi, p, cs0, cs1, di); - //variables - if(cs0!=currentScanValue) { - if(backwardScanPlot) currentScanDivLevel--; - else currentScanDivLevel++; - } - currentScanValue = cs0; - lastImageNumber= currentFrame+1; - //title - imageTitle = temp_title; - //copy data - for(unsigned int px=0;pxvalues[px]; - pthread_mutex_unlock(&(last_image_complete_mutex)); - break; + currentFrame++; + currentScanDivLevel++; + return 0; + } + //level0 + if(scanArgument==qDefs::Level0){ + while(1){ + if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ + //set title + plotTitle=QString(plotTitle_prefix)+QString(data->fileName).section('/',-1); + //get scanvariable0 + int ci = 0, fi = 0, p = 0, di = 0; double cs0 = 0 , cs1 = 0; + fileIOStatic::getVariablesFromFileName(string(data->fileName), ci, fi, p, cs0, cs1, di); + //variables + if(cs0!=currentScanValue) { + if(backwardScanPlot) currentScanDivLevel--; + else currentScanDivLevel++; } + currentScanValue = cs0; + lastImageNumber= currentFrame+1; + //title + imageTitle = temp_title; + //copy data + for(unsigned int px=0;pxvalues[px]; + pthread_mutex_unlock(&(last_image_complete_mutex)); + break; } - currentFrame++; - return 0; } - //level1 + currentFrame++; + return 0; + } + //level1 + if(scanArgument==qDefs::Level1){ while(1){ if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ //set title @@ -794,9 +815,10 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){ } currentFrame++; return 0; - } + + //normal measurement or 1d scans if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ //set title @@ -846,15 +868,17 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){ } //2d - else{cout<values,nPixelsX*nPixelsY*sizeof(double)); + memcpy(lastImageArray,data->values,nPixelsX*nPixelsY*sizeof(double)); } pthread_mutex_unlock(&(last_image_complete_mutex)); } @@ -1085,7 +1109,6 @@ void qDrawPlot::UpdatePlot(){ XYRangeChanged = false; } if(saveAll) SavePlotAutomatic(); - cout<<"updated 2d plot: ymin:"<GetPlot()->GetYMinimum()<< "\tymax:"<GetPlot()->GetYMaximum()<getTotalNumberOfChannels(); + actualPixelsX = myDet->getTotalNumberOfChannels(slsDetectorDefs::X); if(histTrimbits) delete [] histTrimbits; histTrimbits = new double[actualPixelsX]; ret = myDet->getChanRegs(histTrimbits,fromDetector); if(!ret){ @@ -1551,16 +1574,4 @@ void qDrawPlot::CalculatePedestal(){ } -//------------------------------------------------------------------------------------------------------------------------------------------------- - - -void qDrawPlot::plot2DUnzoom(){ - plot2D->GetPlot()->SetXMinMax(plot2D->GetPlot()->GetXMinimum(),plot2D->GetPlot()->GetXMaximum()); - plot2D->GetPlot()->SetYMinMax(plot2D->GetPlot()->GetYMinimum(),plot2D->GetPlot()->GetYMaximum()); - - //if(scanArgument!=None)/*if(plot_in_scope==2)*/ - // plot2D->GetPlot()->UnZoom(); -} - - //------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/slsDetectorGui/src/qTabActions.cpp b/slsDetectorGui/src/qTabActions.cpp index ff0553f31..ad30a377e 100644 --- a/slsDetectorGui/src/qTabActions.cpp +++ b/slsDetectorGui/src/qTabActions.cpp @@ -181,7 +181,7 @@ void qTabActions::SetupWidgetWindow(){ //Number of positions is only for mythen or gotthard detType = myDet->getDetectorsType(); - if((detType == slsDetectorDefs::EIGER) || (detType == slsDetectorDefs::AGIPD)) { + if((detType == slsDetectorDefs::EIGER) || (detType == slsDetectorDefs::AGIPD) || (detType == slsDetectorDefs::MOENCH)) { lblName[NumPositions]->setEnabled(false); btnExpand[NumPositions]->setEnabled(false); }else{ diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp index 9b7c63a2e..6819e7c16 100644 --- a/slsDetectorGui/src/qTabAdvanced.cpp +++ b/slsDetectorGui/src/qTabAdvanced.cpp @@ -75,7 +75,15 @@ void qTabAdvanced::SetupWidgetWindow(){ switch(detType){ case slsDetectorDefs::MYTHEN: isEnergy = true; isAngular = true; break; case slsDetectorDefs::EIGER: isEnergy = true; isAngular = false; break; - + case slsDetectorDefs::MOENCH: + isEnergy = false; + isAngular = false; + lblIP->setEnabled(true); + lblMAC->setEnabled(true); + dispIP->setEnabled(true); + dispMAC->setEnabled(true); + boxRxr->setEnabled(true); + break; case slsDetectorDefs::GOTTHARD: isEnergy = false; isAngular = true; @@ -208,7 +216,7 @@ void qTabAdvanced::Initialization(){ connect(spinStopPort, SIGNAL(valueChanged(int)), this, SLOT(SetStopPort(int))); connect(comboOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetOnline(int))); - if(detType==slsDetectorDefs::GOTTHARD){ + if((detType==slsDetectorDefs::GOTTHARD) || (detType==slsDetectorDefs::MOENCH)){ //network connect(spinTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int))); @@ -1030,7 +1038,7 @@ void qTabAdvanced::Refresh(){ - if(detType==slsDetectorDefs::GOTTHARD){ + if ((detType==slsDetectorDefs::GOTTHARD) || (detType==slsDetectorDefs::MOENCH)){ //disconnect disconnect(spinTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int))); disconnect(spinUDPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrUDPPort(int))); diff --git a/slsDetectorGui/src/qTabDebugging.cpp b/slsDetectorGui/src/qTabDebugging.cpp index a4d834e0e..f0f77af62 100644 --- a/slsDetectorGui/src/qTabDebugging.cpp +++ b/slsDetectorGui/src/qTabDebugging.cpp @@ -85,6 +85,18 @@ void qTabDebugging::SetupWidgetWindow(){ chkChip->setEnabled(false); chkModuleFirmware->setEnabled(false); break; + case slsDetectorDefs::MOENCH: + lblDetector->setText("Module:"); + chkDetectorFirmware->setText("Module Firmware:"); + chkDetectorSoftware->setText("Module Software:"); + chkDetectorMemory->setText("Module Memory:"); + chkDetectorBus->setText("Module Bus:"); + lblModule->hide(); + comboModule->hide(); + chkModuleFirmware->hide(); + chkChip->setEnabled(false); + chkModuleFirmware->setEnabled(false); + break; case slsDetectorDefs::MYTHEN: break; default: @@ -191,7 +203,7 @@ void qTabDebugging::GetInfo(){ switch(detType){ - case slsDetectorDefs::MYTHEN:{ + case slsDetectorDefs::MYTHEN: //display widget formLayout->addWidget(new QLabel("Readout:"),0,0); formLayout->addItem(new QSpacerItem(15,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,1); @@ -228,11 +240,11 @@ void qTabDebugging::GetInfo(){ } break; - } - case slsDetectorDefs::EIGER:{ + + case slsDetectorDefs::EIGER: //display widget formLayout->addWidget(new QLabel("Half Module:"),0,0); formLayout->addItem(new QSpacerItem(15,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,1); @@ -257,11 +269,33 @@ void qTabDebugging::GetInfo(){ treeDet->topLevelItem(i*2)->insertChildren(0,childItems); } break; - } - case slsDetectorDefs::GOTTHARD:{ + case slsDetectorDefs::MOENCH: + + //display widget + formLayout->addWidget(new QLabel("Module:"),0,0); + formLayout->addItem(new QSpacerItem(15,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,1); + formLayout->addWidget(lblDetectorId,0,2); + formLayout->addWidget(new QLabel("Module MAC Address:"),1,0); + formLayout->addWidget(lblDetectorSerial,1,2); + formLayout->addWidget(new QLabel("Module Firmware Version:"),2,0); + formLayout->addWidget(lblDetectorFirmware,2,2); + formLayout->addWidget(new QLabel("Module Software Version:"),3,0); + formLayout->addWidget(lblDetectorSoftware,3,2); + //tree widget + treeDet->setHeaderLabel("Moench Detector"); + //gets det names + for (int i=0;icount();i++) + items.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString("Module (%1)").arg(comboDetector->itemText(i))))); + treeDet->insertTopLevelItems(0, items); + + break; + + + + case slsDetectorDefs::GOTTHARD: //display widget formLayout->addWidget(new QLabel("Module:"),0,0); @@ -281,7 +315,7 @@ void qTabDebugging::GetInfo(){ treeDet->insertTopLevelItems(0, items); break; - } + @@ -315,7 +349,7 @@ void qTabDebugging::SetParameters(QTreeWidgetItem *item){ switch(detType){ - case slsDetectorDefs::MYTHEN:{ + case slsDetectorDefs::MYTHEN: if(item->text(0).contains("Readout")){ //find index for(i=0;icount();i++) @@ -362,12 +396,12 @@ void qTabDebugging::SetParameters(QTreeWidgetItem *item){ qDefs::checkErrorMessage(det); } break; - } - case slsDetectorDefs::EIGER:{ + + case slsDetectorDefs::EIGER: //only if half module clicked if(item->text(0).contains("Half Module")){ //find index @@ -388,12 +422,12 @@ void qTabDebugging::SetParameters(QTreeWidgetItem *item){ qDefs::checkErrorMessage(det); } break; - } - case slsDetectorDefs::GOTTHARD:{ + case slsDetectorDefs::MOENCH: + case slsDetectorDefs::GOTTHARD: //find index for(i=0;icount();i++) if(item== treeDet->topLevelItem(i)) @@ -411,7 +445,7 @@ void qTabDebugging::SetParameters(QTreeWidgetItem *item){ qDefs::checkErrorMessage(det); break; - } + @@ -439,6 +473,7 @@ void qTabDebugging::TestDetector(){ message = QString("Test Results for %1 and %2:

").arg(comboDetector->currentText(),comboModule->currentText()); break; case slsDetectorDefs::EIGER: Detector = "Half Module"; break; + case slsDetectorDefs::MOENCH: case slsDetectorDefs::GOTTHARD: Detector = "Module"; break; default: break; } diff --git a/slsDetectorGui/src/qTabDeveloper.cpp b/slsDetectorGui/src/qTabDeveloper.cpp index 6a62adcbc..5a272a209 100644 --- a/slsDetectorGui/src/qTabDeveloper.cpp +++ b/slsDetectorGui/src/qTabDeveloper.cpp @@ -95,6 +95,22 @@ void qTabDeveloper::SetupWidgetWindow(){ adcNames.push_back("Temperature ADC:"); adcNames.push_back("Temperature FPGA:"); + break; + case slsDetectorDefs::MOENCH: + NUM_DAC_WIDGETS = 8; + NUM_ADC_WIDGETS = 2; + dacNames.push_back("v Reference:"); + dacNames.push_back("v Cascode n:"); + dacNames.push_back("v Cascode p:"); + dacNames.push_back("v Comp. Output:"); + dacNames.push_back("v Cascode out"); + dacNames.push_back("v Comp. Input:"); + dacNames.push_back("v Comp. Ref:"); + dacNames.push_back("i Base Test:"); + + adcNames.push_back("Temperature ADC:"); + adcNames.push_back("Temperature FPGA:"); + break; default: qDefs::Message(qDefs::CRITICAL,string("Unknown detector type:")+myDet->slsDetectorBase::getDetectorType(detType),"Developer"); @@ -122,7 +138,7 @@ void qTabDeveloper::SetupWidgetWindow(){ CreateDACWidgets(); //HV for gotthard - if(detType==slsDetectorDefs::GOTTHARD){ + if ((detType==slsDetectorDefs::GOTTHARD) || (detType==slsDetectorDefs::MOENCH)){ boxDacs->setFixedHeight(boxDacs->height()+35); lblHV = new QLabel("High Voltage",boxDacs); @@ -145,7 +161,7 @@ void qTabDeveloper::SetupWidgetWindow(){ //adcs - if((detType==slsDetectorDefs::GOTTHARD)||(detType==slsDetectorDefs::AGIPD)){ + if((detType==slsDetectorDefs::GOTTHARD) || (detType==slsDetectorDefs::MOENCH)){ setFixedHeight((50+(NUM_DAC_WIDGETS/2)*35)+(50+(NUM_ADC_WIDGETS/2)*35)); boxAdcs = new QGroupBox("ADCs",this); boxAdcs->setFixedHeight(25+(NUM_ADC_WIDGETS/2)*35); @@ -206,7 +222,7 @@ void qTabDeveloper::CreateADCWidgets(){ lblAdcs[i] = new QLabel(QString(adcNames[i].c_str()),boxAdcs); spinAdcs[i] = new QDoubleSpinBox(boxAdcs); spinAdcs[i]->setMaximum(10000); - if(detType==slsDetectorDefs::GOTTHARD) spinAdcs[i]->setSuffix(0x00b0+QString("C")); + if((detType==slsDetectorDefs::GOTTHARD) || (detType==slsDetectorDefs::MOENCH)) spinAdcs[i]->setSuffix(0x00b0+QString("C")); adcLayout->addWidget(lblAdcs[i],(int)(i/2),((i%2)==0)?1:4); adcLayout->addWidget(spinAdcs[i],(int)(i/2),((i%2)==0)?2:5); @@ -283,6 +299,7 @@ slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(int index){ return slsDetectorDefs::HUMIDITY; /**fill in here*/ break; + case slsDetectorDefs::MOENCH: case slsDetectorDefs::GOTTHARD: switch(index){ case 0: return slsDetectorDefs::G_VREF_DS; @@ -344,7 +361,7 @@ void qTabDeveloper::Refresh(){ if(NUM_ADC_WIDGETS) RefreshAdcs(); //gotthard -high voltage - if(detType == slsDetectorDefs::GOTTHARD){ + if((detType == slsDetectorDefs::GOTTHARD) || (detType == slsDetectorDefs::MOENCH)){ disconnect(comboHV, SIGNAL(currentIndexChanged(int)), this, SLOT(SetHighVoltage())); //default should be correct diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 9f27ac847..c301c5f45 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -140,6 +140,7 @@ void qTabMeasurement::SetupTimingMode(){ item[(int)Gated_Start]->setEnabled(false); item[(int)Trigger_Window]->setEnabled(true); break; + case slsDetectorDefs::MOENCH: case slsDetectorDefs::GOTTHARD: item[(int)Trigger_Exp_Series]->setEnabled(true); item[(int)Trigger_Frame]->setEnabled(false); diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index fc7d7a9d5..d2c269b8a 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -142,9 +142,10 @@ void qTabPlot::SetupWidgetWindow(){ // Depending on whether the detector is 1d or 2d switch(myDet->getDetectorsType()){ - case slsDetectorDefs::MYTHEN: isOriginallyOneD = true; break; + case slsDetectorDefs::MYTHEN: isOriginallyOneD = true; break; case slsDetectorDefs::EIGER: isOriginallyOneD = false; break; case slsDetectorDefs::GOTTHARD: isOriginallyOneD = true; break; + case slsDetectorDefs::MOENCH: isOriginallyOneD = false; break; default: cout << "ERROR: Detector Type is Generic" << endl; exit(-1); @@ -765,7 +766,7 @@ void qTabPlot::SetScanArgument(){ //histogram if(histogram){ //allFrames - myPlot->SetScanArgument(4); + myPlot->SetScanArgument(qDefs::AllFrames); //default titles for 2d scan dispXAxis->setText("Channel Number"); @@ -817,7 +818,7 @@ void qTabPlot::SetScanArgument(){ myPlot->Select2DPlot(); }else //done here so that it isnt set by default each time - myPlot->SetScanArgument(0); + myPlot->SetScanArgument(qDefs::None); qDefs::checkErrorMessage(myDet); diff --git a/slsDetectorGui/src/qTabSettings.cpp b/slsDetectorGui/src/qTabSettings.cpp index 4047daf0b..5bb25be11 100644 --- a/slsDetectorGui/src/qTabSettings.cpp +++ b/slsDetectorGui/src/qTabSettings.cpp @@ -103,6 +103,7 @@ void qTabSettings::SetupDetectorSettings(){ item[(int)MediumGain]->setEnabled(false); item[(int)VeryHighGain]->setEnabled(false); break; + case slsDetectorDefs::MOENCH: case slsDetectorDefs::GOTTHARD: item[(int)Standard]->setEnabled(false); item[(int)Fast]->setEnabled(false); From 4719fff09a2eaf80d4060383c80f229b2aa000fb Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 16 Apr 2013 14:52:27 +0000 Subject: [PATCH 173/332] sample 2d plot git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@173 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qDrawPlot.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index ede539f9a..272f09b11 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -204,7 +204,7 @@ void qDrawPlot::SetupWidgetWindow(){ layout->addWidget(boxPlot,1,1); boxPlot->setAlignment(Qt::AlignHCenter); boxPlot->setFont(QFont("Sans Serif",11,QFont::Normal)); - + boxPlot->setTitle("Sample Plot"); plot_update_timer = new QTimer(this); connect(plot_update_timer, SIGNAL(timeout()), this, SLOT(UpdatePlot())); data_pause_timer = new QTimer(this); @@ -235,6 +235,11 @@ void qDrawPlot::SetupWidgetWindow(){ Clear1DPlot(); plot2D = new SlsQt2DPlotLayout(boxPlot); + //default plot + lastImageArray = new double[nPixelsY*nPixelsX]; + for(unsigned int px=0;pxsetFont(QFont("Sans Serif",9,QFont::Normal)); plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,startPixel,endPixel,lastImageArray); plot2D->setTitle(GetImageTitle()); From 35f151775ec27e9afebb0f8bb319ab43cc4ef40d Mon Sep 17 00:00:00 2001 From: x04sa Date: Tue, 30 Apr 2013 11:26:22 +0000 Subject: [PATCH 174/332] some debugging at the beamline, still crashing sl6 64bit, angular conversion etc. git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@174 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/slsDetectorGui.pro | 10 ++++------ slsDetectorGui/src/qDrawPlot.cpp | 10 +++++++++- slsDetectorGui/src/qTabDataOutput.cpp | 28 ++++++++++++++++++++++----- 3 files changed, 36 insertions(+), 12 deletions(-) diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index d0c3ca3f1..16a456639 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -8,8 +8,6 @@ QMAKE_INCDIR_QT = $(QTDIR)/include/ QMAKE_LIBS_QT = -L$(QTDIR)/lib QMAKE_LIBS = -L$(QTDIR)/lib - - DESTDIR ?= bin MOC_DIR = mocs OBJECTS_DIR = objs @@ -22,7 +20,7 @@ CONFIG += debug no_include_pwd QMAKE_CXXFLAGS_WARN_ON = -w QMAKE_CFLAGS_WARN_ON = -w -DEFINES += VERBOSE DACS_INT PRINT_LOG THIS_PATH=\\\"$$PWD\\\" #VERYVERBOSE +DEFINES += EPICS VERBOSE DACS_INT PRINT_LOG THIS_PATH=\\\"$$PWD\\\" #VERYVERBOSE target.path += $(DESTDIR) @@ -36,7 +34,8 @@ QMAKE_CLEAN += docs/*/* #LIBS += -Wl,-Bstatic -L../slsDetectorSoftware -lSlsDetector -Wl,-Bdynamic\ # -L$(QWTDIR)/lib -lqwt -L$(QWT3D)/lib -LIBS = -L$(QWTDIR)/lib -lqwt -L$(QWT3D)/lib +LIBS = -L$(QWTDIR)/lib -lqwt -L$(QWT3D)/lib -Wl,-R$(QWTDIR)/lib -L /usr/local/epics/base/lib/$(EPICS_HOST_ARCH)/ -Wl,-R/usr/local/epics/base/lib/$(EPICS_HOST_ARCH) -lca -lCom + DEPENDPATH += \ slsDetectorPlotting/include\ @@ -51,8 +50,7 @@ INCLUDEPATH = \ slsDetectorPlotting/include\ include\ forms/include\ - $(INCLUDES) - + $(INCLUDES) /usr/local/epics/base/include/ -I /usr/local/epics/base/include/os/Linux/ # $(shell echo "/lib/modules/`uname -r`/build/include") \ # ../slsDetectorSoftware/commonFiles\ # ../slsDetectorSoftware/MySocketTCP\ diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 272f09b11..fd03df578 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -622,8 +622,16 @@ int qDrawPlot::GetDataCallBack(detectorData *data, int fIndex, void *this_pointe int qDrawPlot::GetData(detectorData *data,int fIndex){ -#ifdef VERYVERBOSE +#ifdef VERBOSE cout << "******Entering GetDatafunction********" << endl; + cout << "fname " << data->fileName << endl; + cout << "npoints " << data->npoints << endl; + cout << "npy " << data->npy << endl; + cout << "npy " << data->progressIndex << endl; + cout << "values " << data->values << endl; + cout << "errors " << data->errors << endl; + cout << "angle " << data->angles << endl; + #endif if(!stop_signal){ diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index edede74c3..c5821e1ea 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -106,10 +106,22 @@ void qTabDataOutput::SetupWidgetWindow(){ //discard bad channels from server #ifdef VERBOSE cout << "Getting bad channel correction" << endl; + cout << "func " << myDet->getBadChannelCorrection() << endl; #endif - if(myDet->getBadChannelCorrection()) chkDiscardBad->setChecked(true); + int nb=myDet->getBadChannelCorrection(); + disconnect(chkDiscardBad, SIGNAL(toggled(bool))); + + if(nb) chkDiscardBad->setChecked(true); + + + connect(chkDiscardBad, SIGNAL(toggled(bool)), this, SLOT(DiscardBadChannels())); + +#ifdef VERBOSE + cout << "done" << endl; +#endif + qDefs::checkErrorMessage(myDet); } @@ -486,19 +498,19 @@ void qTabDataOutput::SetAngularCorrection(){ void qTabDataOutput::DiscardBadChannels(){ -#ifdef VERYVERBOSE + //#ifdef VERYVERBOSE cout << "Entering Discard bad channels function" << endl; -#endif + //#endif if(chkDiscardBad->isChecked()){ - myDet->setBadChannelCorrection("default"); #ifdef VERBOSE cout << "Setting bad channel correction to default" << endl; #endif + myDet->setBadChannelCorrection("default"); }else{ - myDet->setBadChannelCorrection(""); #ifdef VERBOSE cout << "Unsetting bad channel correction" << endl; #endif + myDet->setBadChannelCorrection(""); } qDefs::checkErrorMessage(myDet); @@ -556,10 +568,16 @@ void qTabDataOutput::Refresh(){ //discard bad channels from server #ifdef VERBOSE cout << "Getting bad channel correction" << endl; + // cout << "ff " << myDet->getBadChannelCorrection() << endl; #endif + + // disconnect(chkDiscardBad, SIGNAL(toggled(bool))); + if(myDet->getBadChannelCorrection()) chkDiscardBad->setChecked(true); + // connect(chkDiscardBad, SIGNAL(toggled(bool)), this, SLOT(DiscardBadChannels())); + if(myDet->setReceiverOnline()==slsDetectorDefs::ONLINE_FLAG){ btnOutputBrowse->setEnabled(false); btnOutputBrowse->setToolTip("This button is disabled as receiver PC is different from " From 675ab8cecad3f6b1dc6084193ae6fde9d166efeb Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 30 Apr 2013 15:05:21 +0000 Subject: [PATCH 175/332] bad channel not read on refresh or start up, makefile reverted to compile git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@175 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/slsDetectorGui.pro | 20 +++++++++----------- slsDetectorGui/src/qTabDataOutput.cpp | 21 +++++++++++---------- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index 16a456639..ccb73aaec 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -20,7 +20,8 @@ CONFIG += debug no_include_pwd QMAKE_CXXFLAGS_WARN_ON = -w QMAKE_CFLAGS_WARN_ON = -w -DEFINES += EPICS VERBOSE DACS_INT PRINT_LOG THIS_PATH=\\\"$$PWD\\\" #VERYVERBOSE +DEFINES += VERBOSE DACS_INT PRINT_LOG THIS_PATH=\\\"$$PWD\\\" #VERYVERBOSE +#DEFINES += EPICS VERBOSE DACS_INT PRINT_LOG THIS_PATH=\\\"$$PWD\\\" #VERYVERBOSE target.path += $(DESTDIR) @@ -31,10 +32,13 @@ INSTALLS += documentation QMAKE_CLEAN += docs/*/* + #LIBS += -Wl,-Bstatic -L../slsDetectorSoftware -lSlsDetector -Wl,-Bdynamic\ # -L$(QWTDIR)/lib -lqwt -L$(QWT3D)/lib -LIBS = -L$(QWTDIR)/lib -lqwt -L$(QWT3D)/lib -Wl,-R$(QWTDIR)/lib -L /usr/local/epics/base/lib/$(EPICS_HOST_ARCH)/ -Wl,-R/usr/local/epics/base/lib/$(EPICS_HOST_ARCH) -lca -lCom + +LIBS = -L$(QWTDIR)/lib -lqwt -L$(QWT3D)/lib +#LIBS = -L$(QWTDIR)/lib -lqwt -L$(QWT3D)/lib -Wl,-R$(QWTDIR)/lib -L /usr/local/epics/base/lib/$(EPICS_HOST_ARCH)/ -Wl,-R/usr/local/epics/base/lib/$(EPICS_HOST_ARCH) -lca -lCom DEPENDPATH += \ @@ -50,15 +54,9 @@ INCLUDEPATH = \ slsDetectorPlotting/include\ include\ forms/include\ - $(INCLUDES) /usr/local/epics/base/include/ -I /usr/local/epics/base/include/os/Linux/ -# $(shell echo "/lib/modules/`uname -r`/build/include") \ -# ../slsDetectorSoftware/commonFiles\ -# ../slsDetectorSoftware/MySocketTCP\ -# ../slsDetectorSoftware/slsReceiverInterface\ -# ../slsDetectorSoftware/slsDetector\ -# ../slsDetectorSoftware/slsDetectorAnalysis\ -# ../slsDetectorSoftware/multiSlsDetector\ -# ../slsDetectorSoftware/usersFunctions + $(INCLUDES) +# $(INCLUDES) /usr/local/epics/base/include/ -I /usr/local/epics/base/include/os/Linux/ + SOURCES = \ slsDetectorPlotting/src/SlsQt1DPlot.cxx\ diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index c5821e1ea..d9b16e699 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -110,12 +110,12 @@ void qTabDataOutput::SetupWidgetWindow(){ #endif - int nb=myDet->getBadChannelCorrection(); + disconnect(chkDiscardBad, SIGNAL(toggled(bool))); - - if(nb) chkDiscardBad->setChecked(true); - - + if(myDet->getBadChannelCorrection()) + chkDiscardBad->setChecked(true); + else + chkDiscardBad->setChecked(false); connect(chkDiscardBad, SIGNAL(toggled(bool)), this, SLOT(DiscardBadChannels())); #ifdef VERBOSE @@ -571,12 +571,13 @@ void qTabDataOutput::Refresh(){ // cout << "ff " << myDet->getBadChannelCorrection() << endl; #endif - // disconnect(chkDiscardBad, SIGNAL(toggled(bool))); - if(myDet->getBadChannelCorrection()) chkDiscardBad->setChecked(true); - - - // connect(chkDiscardBad, SIGNAL(toggled(bool)), this, SLOT(DiscardBadChannels())); + disconnect(chkDiscardBad, SIGNAL(toggled(bool))); + if(myDet->getBadChannelCorrection()) + chkDiscardBad->setChecked(true); + else + chkDiscardBad->setChecked(false); + connect(chkDiscardBad, SIGNAL(toggled(bool)), this, SLOT(DiscardBadChannels())); if(myDet->setReceiverOnline()==slsDetectorDefs::ONLINE_FLAG){ btnOutputBrowse->setEnabled(false); From 8e19beb4106ea2891d05a5b02c484c6a26dc2107 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Mon, 6 May 2013 15:04:24 +0000 Subject: [PATCH 176/332] changed to trackertextF for qwt6 to show z value for 2d plots git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@176 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/slsDetectorPlotting/include/SlsQt2DZoomer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DZoomer.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DZoomer.h index 2acd34dc6..497dc7971 100644 --- a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DZoomer.h +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DZoomer.h @@ -42,7 +42,7 @@ class SlsQt2DZoomer:public QwtPlotZoomer{ #if QWT_VERSION<0x060000 virtual QwtText trackerText(const QwtDoublePoint &pos) const{ #else - virtual QwtText trackerText(const QPointF &pos) const{ + virtual QwtText trackerTextF(const QPointF &pos) const{ #endif QColor bg(Qt::white); #if QT_VERSION >= 0x040300 From 7701531ff3db1bafb3c42a520bbc260ea785ed13 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 7 May 2013 14:20:43 +0000 Subject: [PATCH 177/332] fixed the undefined state of gui when acquisition stopped git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@177 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qDrawPlot.cpp | 6 +++--- slsDetectorGui/src/qTabMeasurement.cpp | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index fd03df578..ab783fcea 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -323,10 +323,10 @@ void qDrawPlot::StartStopDaqToggle(bool stop_if_running){ //get #scansets for level 0 and level 1 int numScan0 = myDet->getScanSteps(0); numScan0 = ((numScan0==0)?1:numScan0); int numScan1 = myDet->getScanSteps(1); numScan1 = ((numScan1==0)?1:numScan1); - + int numPos=myDet->getPositions(); number_of_exposures = number_of_frames * numScan0 * numScan1; - if(anglePlot) number_of_exposures = numScan0 * numScan1; + if(anglePlot) number_of_exposures = numScan0 * numScan1;// * numPos; cout << "\tNumber of Exposures Per Measurement:" << number_of_exposures << endl; @@ -622,7 +622,7 @@ int qDrawPlot::GetDataCallBack(detectorData *data, int fIndex, void *this_pointe int qDrawPlot::GetData(detectorData *data,int fIndex){ -#ifdef VERBOSE +#ifdef VERYVERBOSE cout << "******Entering GetDatafunction********" << endl; cout << "fname " << data->fileName << endl; cout << "npoints " << data->npoints << endl; diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index c301c5f45..6fe050669 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -323,6 +323,7 @@ void qTabMeasurement::startStopAcquisition(){ #endif emit StopSignal(); myDet->stopAcquisition(); + myDet->waitForReceiverReadToFinish(); UpdateProgress(); //spin index From e153c6fd58de6c27c31f9bc6d34e01cbc7e3a0cc Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 8 May 2013 17:32:38 +0000 Subject: [PATCH 178/332] fixed zmin zmax bug, automatically online when refreshing advanced tab bug, outdir not checking properly git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@178 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qDrawPlot.h | 2 +- slsDetectorGui/include/qTabPlot.h | 2 +- .../include/SlsQt2DPlotLayout.h | 3 ++ .../src/SlsQt2DPlotLayout.cxx | 36 +++++++++++++++++-- slsDetectorGui/src/qDrawPlot.cpp | 2 +- slsDetectorGui/src/qTabAdvanced.cpp | 26 ++++++++++---- slsDetectorGui/src/qTabDataOutput.cpp | 16 +++++++-- slsDetectorGui/src/qTabPlot.cpp | 7 ++-- 8 files changed, 77 insertions(+), 17 deletions(-) diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index ebb9485c3..f590cf29a 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -506,7 +506,7 @@ void ContourSignal(bool); void LogzSignal(bool); void LogySignal(bool); void SetZRangeSignal(double,double); -void EnableZRangeSignal(bool); +void ResetZMinZMaxSignal(bool,bool,double,double); void SetCurrentMeasurementSignal(int); void saveErrorSignal(QString); void AcquisitionErrorSignal(QString); diff --git a/slsDetectorGui/include/qTabPlot.h b/slsDetectorGui/include/qTabPlot.h index 0705d0ec4..6d822cf15 100644 --- a/slsDetectorGui/include/qTabPlot.h +++ b/slsDetectorGui/include/qTabPlot.h @@ -151,7 +151,7 @@ private slots: signals: void DisableZoomSignal(bool); void SetZRangeSignal(double,double); - void EnableZRangeSignal(bool); + void ResetZMinZMaxSignal(bool,bool,double,double); }; diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlotLayout.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlotLayout.h index 5948b2fb3..2d2315f77 100644 --- a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlotLayout.h +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlotLayout.h @@ -5,6 +5,7 @@ * 19.06.2012 All modifications with the Ian flag has been made since * z_range_ne and the buttons are defined in another class. * Logz button and z_range_ne have wrappers to connect them + * 05.05.2013 Added ResetZMinZMax */ @@ -67,6 +68,8 @@ void ResetRange(); #ifndef IAN void SetZRange(double,double); void EnableZRange(bool enable); +void ResetZMinZMax(bool zmin, bool zmax, double min, double max); + #endif signals: diff --git a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx index c27f46c9f..eb722b1cd 100644 --- a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx +++ b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx @@ -99,12 +99,12 @@ void SlsQt2DPlotLayout::ConnectSignalsAndSlots(){ void SlsQt2DPlotLayout::UpdateNKeepSetRangeIfSet(){ #ifdef IAN if(z_range_ne->CheckBoxState()){ -#else - if(zRangeChecked){ #endif //just reset histogram range before update the_plot->SetZMinMax(z_range_ne->GetValue(0),z_range_ne->GetValue(1)); +#ifdef IAN } +#endif the_plot->Update(); } @@ -131,6 +131,37 @@ void SlsQt2DPlotLayout::ResetRange(){ } +void SlsQt2DPlotLayout::ResetZMinZMax(bool zmin, bool zmax, double min, double max){ + z_range_ne->SetNumber(min,0); + z_range_ne->SetNumber(max,1); + + //refind z limits + the_plot->SetZMinMax(); + if(btnLogz->isChecked()) the_plot->SetZMinimumToFirstGreaterThanZero(); + + //first time check validity + if(zmax) z_range_ne->SetValue(max,0); + else z_range_ne->SetValue(the_plot->GetZMaximum(),1); + + if(zmin) z_range_ne->SetValue(min,0); + else z_range_ne->SetValue(the_plot->GetZMinimum(),0); + + if(zmin && zmax){ + bool same = (z_range_ne->GetValue(0)==z_range_ne->GetValue(1)) ? 1:0; + if(!z_range_ne->IsValueOk(0)||same) z_range_ne->SetValue(the_plot->GetZMinimum(),0); + if(!z_range_ne->IsValueOk(1)||same) z_range_ne->SetValue(the_plot->GetZMaximum(),1); + } + + z_range_ne->SetRange(the_plot->GetZMinimum(),z_range_ne->GetValue(1),0); + z_range_ne->SetRange(z_range_ne->GetValue(0),the_plot->GetZMaximum(),1); + + //set histogram range + the_plot->SetZMinMax(z_range_ne->GetValue(0),z_range_ne->GetValue(1)); + + the_plot->Update(); +} + + void SlsQt2DPlotLayout::SetZScaleToLog(bool yes){ #ifndef IAN #ifdef VERBOSE @@ -190,5 +221,6 @@ void SlsQt2DPlotLayout::EnableZRange(bool enable){ #endif zRangeChecked = enable; ResetRange(); + } #endif diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index ab783fcea..91eed1436 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -278,7 +278,7 @@ void qDrawPlot::Initialization(){ connect(this, SIGNAL(ContourSignal(bool)), plot2D, SIGNAL(ContourSignal(bool))); connect(this, SIGNAL(LogzSignal(bool)), plot2D, SLOT(SetZScaleToLog(bool))); connect(this, SIGNAL(LogySignal(bool)), plot1D, SLOT(SetLogY(bool))); - connect(this, SIGNAL(EnableZRangeSignal(bool)),plot2D, SLOT(EnableZRange(bool))); + connect(this, SIGNAL(ResetZMinZMaxSignal(bool,bool,double,double)),plot2D, SLOT(ResetZMinZMax(bool,bool,double,double))); connect(this, SIGNAL(SetZRangeSignal(double,double)), plot2D, SLOT(SetZRange(double,double))); diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp index 6819e7c16..741f493f2 100644 --- a/slsDetectorGui/src/qTabAdvanced.cpp +++ b/slsDetectorGui/src/qTabAdvanced.cpp @@ -140,8 +140,10 @@ void qTabAdvanced::SetupWidgetWindow(){ //check if its online and set it to red if offline - det->checkOnline(); - det->checkReceiverOnline(); + if(det->setOnline()==slsDetectorDefs::ONLINE_FLAG) + det->checkOnline(); + if(det->setReceiverOnline()==slsDetectorDefs::ONLINE_FLAG) + det->checkReceiverOnline(); comboOnline->setCurrentIndex(det->setOnline()); comboRxrOnline->setCurrentIndex(det->setReceiverOnline()); if(!comboOnline->currentIndex()){ @@ -571,7 +573,10 @@ void qTabAdvanced::SetReceiverOnline(int index){ cout << "Setting Reciever Online to :" << index << endl; #endif disconnect(comboRxrOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetReceiverOnline(int))); - comboRxrOnline->setCurrentIndex(det->setReceiverOnline(index)); + if(index) + SetReceiver(); + else + comboRxrOnline->setCurrentIndex(det->setReceiverOnline(index)); qDefs::checkErrorMessage(det); connect(comboRxrOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetReceiverOnline(int))); //highlight in red if offline @@ -648,8 +653,11 @@ void qTabAdvanced::SetReceiver(){ #ifdef VERBOSE cout << "Setting Receiver" << endl; #endif + string outdir = myDet->getFilePath(); dispRxrHostname->setText(QString(det->setReceiver(dispRxrHostname->text().toAscii().constData()))); qDefs::checkErrorMessage(det); + det->setFilePath(outdir); + qDefs::checkErrorMessage(det); Refresh(); } @@ -909,8 +917,10 @@ void qTabAdvanced::SetDetector(int index){ //check if its online and set it to red if offline - det->checkOnline(); - det->checkReceiverOnline(); + if(det->setOnline()==slsDetectorDefs::ONLINE_FLAG) + det->checkOnline(); + if(det->setReceiverOnline()==slsDetectorDefs::ONLINE_FLAG) + det->checkReceiverOnline(); comboOnline->setCurrentIndex(det->setOnline()); comboRxrOnline->setCurrentIndex(det->setReceiverOnline()); //highlight in red if detector or receiver is offline @@ -1026,7 +1036,8 @@ void qTabAdvanced::Refresh(){ disconnect(comboOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetOnline(int))); //so that updated status - det->checkOnline(); + if(det->setOnline()==slsDetectorDefs::ONLINE_FLAG) + det->checkOnline(); comboOnline->setCurrentIndex(det->setOnline()); spinControlPort->setValue(det->getControlPort()); spinStopPort->setValue(det->getStopPort()); @@ -1053,7 +1064,8 @@ void qTabAdvanced::Refresh(){ dispMAC->setText(det->getDetectorMAC()); //so that updated status - det->checkReceiverOnline(); + if(det->setReceiverOnline()==slsDetectorDefs::ONLINE_FLAG) + det->checkReceiverOnline(); comboRxrOnline->setCurrentIndex(det->setReceiverOnline()); dispRxrHostname->setText(det->getReceiver()); diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index d9b16e699..097859ddd 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -166,6 +166,7 @@ void qTabDataOutput::setOutputDir(){ for(int i=0;igetNumberOfDetectors();i++){ slsDetector *det = myDet->getSlsDetector(i); qDefs::checkErrorMessage(myDet); + oldPath = det->getFilePath(); det->setFilePath(string(path.toAscii().constData())); qDefs::checkErrorMessage(det); if(det->getFilePath()!=(string(path.toAscii().constData()))){ @@ -187,9 +188,20 @@ void qTabDataOutput::setOutputDir(){ myDet->setFilePath(string(path.toAscii().constData())); } else { - myDet->setFilePath(string(path.toAscii().constData())); + for(int i=0;igetNumberOfDetectors();i++){ + slsDetector *det = myDet->getSlsDetector(i); + qDefs::checkErrorMessage(myDet); + det->setFilePath(string(path.toAscii().constData())); + qDefs::checkErrorMessage(det); + if(det->getFilePath()!=(string(path.toAscii().constData()))){ + error=true; + qDefs::checkErrorMessage(det); + break; + } + } + /* myDet->setFilePath(string(path.toAscii().constData())); if(myDet->getFilePath()!=(string(path.toAscii().constData()))) - error=true; + error=true;*/ } if(!error){ diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index d2c269b8a..507fd9f5a 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -261,7 +261,7 @@ void qTabPlot::Initialization(){ connect(chkYMax, SIGNAL(toggled(bool)), this, SLOT(EnableRange())); connect(chkZMin, SIGNAL(toggled(bool)), this, SLOT(EnableZRange())); connect(chkZMax, SIGNAL(toggled(bool)), this, SLOT(EnableZRange())); - connect(this, SIGNAL(EnableZRangeSignal(bool)), myPlot, SIGNAL(EnableZRangeSignal(bool))); + connect(this, SIGNAL(ResetZMinZMaxSignal(bool,bool,double,double)), myPlot, SIGNAL(ResetZMinZMaxSignal(bool,bool,double,double))); connect(dispXMin, SIGNAL(editingFinished()), this, SLOT(SetAxesRange())); connect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetAxesRange())); @@ -418,7 +418,8 @@ void qTabPlot::SetAxesRange(){ void qTabPlot::SetZRange(){ - emit SetZRangeSignal(dispZMin->text().toDouble(),dispZMax->text().toDouble()); +// emit SetZRangeSignal(dispZMin->text().toDouble(),dispZMax->text().toDouble()); + emit ResetZMinZMaxSignal(chkZMin->isChecked(),chkZMax->isChecked(),dispZMin->text().toDouble(),dispZMax->text().toDouble()); } @@ -428,7 +429,7 @@ void qTabPlot::SetZRange(){ void qTabPlot::EnableZRange(){ dispZMin->setEnabled(chkZMin->isChecked()); dispZMax->setEnabled(chkZMax->isChecked()); - emit EnableZRangeSignal((chkZMin->isChecked())||(chkZMax->isChecked())); + emit ResetZMinZMaxSignal(chkZMin->isChecked(),chkZMax->isChecked(),dispZMin->text().toDouble(),dispZMax->text().toDouble()); } From 4fdacefdbe8e2e9321d4a1731d5388c167bc038b Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Mon, 13 May 2013 13:47:05 +0000 Subject: [PATCH 179/332] getting rid of undefined state in gui git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@179 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qDrawPlot.h | 1 + slsDetectorGui/src/qTabMeasurement.cpp | 16 ++++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index f590cf29a..798883912 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -499,6 +499,7 @@ int pedestalCount; bool clientInitiated; + signals: void UpdatingPlotFinished(); void InterpolateSignal(bool); diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 6fe050669..1a3b82dfc 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -272,9 +272,12 @@ void qTabMeasurement::DeInitialization(){ void qTabMeasurement::Enable(bool enable){ frameTimeResolved->setEnabled(enable); frameNotTimeResolved->setEnabled(enable); + //Enable this always - if(!enable) btnStartStop->setEnabled(true); - btnStartStop->setShortcut(QApplication::translate("TabMeasurementObject", "Shift+Space", 0, QApplication::UnicodeUTF8)); + //if(!enable) btnStartStop->setEnabled(true); + + //shortcut each time, else it doesnt work a second time + btnStartStop->setShortcut(QApplication::translate("TabMeasurementObject", "Shift+Space", 0, QApplication::UnicodeUTF8)); } @@ -321,8 +324,9 @@ void qTabMeasurement::startStopAcquisition(){ #ifdef VERBOSE cout << "Stopping Acquisition" << endl<< endl; #endif - emit StopSignal(); + //emit StopSignal(); commented out to prevent undefined state myDet->stopAcquisition(); + /* commented out to prevent undefined state myDet->waitForReceiverReadToFinish(); UpdateProgress(); @@ -335,7 +339,7 @@ void qTabMeasurement::startStopAcquisition(){ btnStartStop->setText("Start"); btnStartStop->setIcon(*iconStart); btnStartStop->setChecked(false); - Enable(1); + Enable(1);*/ } qDefs::checkErrorMessage(myDet); } @@ -345,7 +349,7 @@ void qTabMeasurement::startStopAcquisition(){ void qTabMeasurement::UpdateFinished(){ - if(btnStartStop->isChecked()){ + //if(btnStartStop->isChecked()){ UpdateProgress(); disconnect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int))); @@ -361,7 +365,7 @@ void qTabMeasurement::UpdateFinished(){ connect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); - } + //} qDefs::checkErrorMessage(myDet); } From 287a4519040c14a18a6e5208991075f602ad1f82 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 15 May 2013 12:50:11 +0000 Subject: [PATCH 180/332] optimized the plot a bit git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@180 af1100a4-978c-4157-bff7-07162d2ba061 --- .../slsDetectorPlotting/src/SlsQt1DPlot.cxx | 4 ++++ .../slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx | 7 ++++--- slsDetectorGui/src/qDrawPlot.cpp | 15 ++++++++++----- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cxx b/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cxx index 6fbcfefc6..7942628c8 100644 --- a/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cxx +++ b/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cxx @@ -276,7 +276,11 @@ SlsQt1DPlot::SlsQt1DPlot(QWidget *parent):QwtPlot(parent){ SetupZoom(); // Assign a title +#ifndef IAN + insertLegend(new QwtLegend(), QwtPlot::BottomLegend); +#else insertLegend(new QwtLegend(), QwtPlot::RightLegend); +#endif axisScaleEngine(QwtPlot::yLeft)->setAttribute(QwtScaleEngine::Floating); axisScaleEngine(QwtPlot::xBottom)->setAttribute(QwtScaleEngine::Floating); diff --git a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx index eb722b1cd..74769e76e 100644 --- a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx +++ b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx @@ -72,11 +72,12 @@ void SlsQt2DPlotLayout::Layout(){ the_layout->addWidget(btnInterpolate,1,1); the_layout->addWidget(btnContour,1,2); the_layout->addWidget(btnLogz,1,3); -#endif the_layout->addWidget(the_plot,2,1,3,3); the_layout->addWidget(z_range_ne,5,1,1,3); -#ifdef IAN - the_layout->setMargin(12); + the_layout->setMargin(12); +#else + the_layout->addWidget(the_plot,2,0,3,3); + the_layout->addWidget(z_range_ne,5,0,1,3); #endif } diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 91eed1436..a9d8715eb 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -201,7 +201,7 @@ void qDrawPlot::SetupWidgetWindow(){ histFrameIndexTitle= histFrameIndexTitle = new QLabel(""); boxPlot = new QGroupBox(""); - layout->addWidget(boxPlot,1,1); + layout->addWidget(boxPlot,1,0); boxPlot->setAlignment(Qt::AlignHCenter); boxPlot->setFont(QFont("Sans Serif",11,QFont::Normal)); boxPlot->setTitle("Sample Plot"); @@ -251,8 +251,9 @@ void qDrawPlot::SetupWidgetWindow(){ boxPlot->setContentsMargins(0,15,0,0); plotLayout = new QGridLayout(boxPlot); - plotLayout->addWidget(plot1D,1,1,1,1); - plotLayout->addWidget(plot2D,1,1,1,1); + plotLayout->setContentsMargins(0,0,0,0); + plotLayout->addWidget(plot1D,0,0,1,1); + plotLayout->addWidget(plot2D,0,0,1,1); //callbacks @@ -1017,6 +1018,7 @@ void qDrawPlot::SelectPlot(int i){ //1 for 1D otherwise 2D boxPlot->setFlat(false); plot_in_scope=1; layout->addWidget(histFrameIndexTitle,0,0); + plotLayout->setContentsMargins(10,10,10,10); }else{ plot2D->SetXTitle(imageXAxisTitle); plot2D->SetYTitle(imageYAxisTitle); @@ -1027,6 +1029,7 @@ void qDrawPlot::SelectPlot(int i){ //1 for 1D otherwise 2D plot_in_scope=2; histFrameIndexTitle->setText(""); layout->removeWidget(histFrameIndexTitle); + plotLayout->setContentsMargins(0,0,0,0); } } @@ -1194,7 +1197,8 @@ void qDrawPlot::ClonePlot(){ plot1D->setFont(QFont("Sans Serif",9,QFont::Normal)); plot1D->SetXTitle(histXAxisTitle.toAscii().constData()); plot1D->SetYTitle(histYAxisTitle.toAscii().constData()); - plotLayout->addWidget(plot1D,1,1,1,1); + plotLayout->addWidget(plot1D,0,0,1,1); + plotLayout->setContentsMargins(10,10,10,10); if(running){ // update range bool found =false; @@ -1222,7 +1226,8 @@ void qDrawPlot::ClonePlot(){ plot2D->SetXTitle(imageXAxisTitle); plot2D->SetYTitle(imageYAxisTitle); plot2D->SetZTitle(imageZAxisTitle); - plotLayout->addWidget(plot2D,1,1,1,1); + plotLayout->addWidget(plot2D,0,0,1,1); + plotLayout->setContentsMargins(0,0,0,0); } UnlockLastImageArray(); From 4214ef6be0c52c253110dce6179687837a8dec8b Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 15 May 2013 13:07:07 +0000 Subject: [PATCH 181/332] changed the tab order for the forms git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@181 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_scan.ui | 11 +++++ slsDetectorGui/forms/form_tab_advanced.ui | 41 +++++++++++++++++-- slsDetectorGui/forms/form_tab_dataoutput.ui | 13 ++++++ slsDetectorGui/forms/form_tab_debugging.ui | 6 +++ slsDetectorGui/forms/form_tab_measurement.ui | 17 ++++++++ slsDetectorGui/forms/form_tab_plot.ui | 42 +++++++++++++++++++- slsDetectorGui/forms/form_tab_settings.ui | 6 +++ 7 files changed, 132 insertions(+), 4 deletions(-) diff --git a/slsDetectorGui/forms/form_scan.ui b/slsDetectorGui/forms/form_scan.ui index e5790c978..bd00b8c6e 100644 --- a/slsDetectorGui/forms/form_scan.ui +++ b/slsDetectorGui/forms/form_scan.ui @@ -470,6 +470,17 @@ Defines scan range for a <b>Constant Step Size</b> with the followin
+ + comboScript + dispScript + btnBrowse + dispParameter + spinSteps + spinPrecision + radioRange + radioCustom + radioFile + diff --git a/slsDetectorGui/forms/form_tab_advanced.ui b/slsDetectorGui/forms/form_tab_advanced.ui index 3e9b1164c..1de156a38 100644 --- a/slsDetectorGui/forms/form_tab_advanced.ui +++ b/slsDetectorGui/forms/form_tab_advanced.ui @@ -1510,12 +1510,47 @@ An extension given by the modules serial number will be attached.
- boxRxr - gridLayoutWidget_7 - label_9 + + tabAdvancedSettings + chkEnergyLog + chkAngularLog + boxPlot + radioDataGraph + radioHistogram + btnRefresh + btnGetTrimbits + boxTrimming + comboMethod + chkOptimize + spinResolution + spinCounts + spinExpTime + comboExpUnit + spinThreshold + dispFile + btnFile + btnStart + btnGetRoi + btnSetRoi + btnClearRoi + scrollArea + comboDetector + comboOnline + spinControlPort + dispIP + spinStopPort + dispMAC + dispRxrHostname + comboRxrOnline + spinTCPPort + dispUDPIP + spinUDPPort + dispUDPMAC + btnRxr + diff --git a/slsDetectorGui/forms/form_tab_dataoutput.ui b/slsDetectorGui/forms/form_tab_dataoutput.ui index e2ad9d6d6..3d56a55f3 100644 --- a/slsDetectorGui/forms/form_tab_dataoutput.ui +++ b/slsDetectorGui/forms/form_tab_dataoutput.ui @@ -354,6 +354,19 @@ Directory where one saves the data. + + dispOutputDir + btnOutputBrowse + chkFlatField + dispFlatField + btnFlatField + chkRate + radioAuto + radioDeadTime + spinDeadTime + chkAngular + chkDiscardBad + diff --git a/slsDetectorGui/forms/form_tab_debugging.ui b/slsDetectorGui/forms/form_tab_debugging.ui index 5f17ee00d..e8ebcd632 100644 --- a/slsDetectorGui/forms/form_tab_debugging.ui +++ b/slsDetectorGui/forms/form_tab_debugging.ui @@ -458,6 +458,12 @@ + + btnGetInfo + comboDetector + comboModule + btnTest + diff --git a/slsDetectorGui/forms/form_tab_measurement.ui b/slsDetectorGui/forms/form_tab_measurement.ui index 24f6556c1..cf5327d4c 100644 --- a/slsDetectorGui/forms/form_tab_measurement.ui +++ b/slsDetectorGui/forms/form_tab_measurement.ui @@ -975,6 +975,23 @@ Frame period between exposures. + + spinNumMeasurements + chkFile + dispFileName + spinIndex + comboTimingMode + spinNumFrames + spinExpTime + comboExpUnit + spinPeriod + comboPeriodUnit + spinNumTriggers + spinDelay + comboDelayUnit + spinNumGates + spinNumProbes + diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index 44b5ad4fb..f12d41bbb 100644 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -780,7 +780,7 @@ 10 20 - 341 + 348 26 @@ -1806,6 +1806,46 @@ Interval between plots has 2 modes. A condition to be satisfied, in order to avo + + radioNoPlot + radioHistogram + radioDataGraph + boxScan + radioLevel0 + radioLevel1 + radioFileIndex + radioAllFrames + chkInterpolate + chkContour + chkLogz + chkSaveAll + comboFrequency + chkTitle + dispTitle + chkXAxis + dispXAxis + chkXMin + dispXMin + chkXMax + dispXMax + chkYAxis + dispYAxis + chkYMin + dispYMin + chkYMax + dispYMax + chkZAxis + dispZAxis + chkZMin + dispZMin + chkZMax + dispZMax + spinPersistency + chk1DLog + chkPoints + chkLines + chkSuperimpose + diff --git a/slsDetectorGui/forms/form_tab_settings.ui b/slsDetectorGui/forms/form_tab_settings.ui index e6419b58a..a9dcf980c 100644 --- a/slsDetectorGui/forms/form_tab_settings.ui +++ b/slsDetectorGui/forms/form_tab_settings.ui @@ -200,6 +200,12 @@ + + comboSettings + spinThreshold + spinNumModules + comboDynamicRange + From a843661d1b17dc22eac7197cf8bf624ebef9a211 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 15 May 2013 13:27:00 +0000 Subject: [PATCH 182/332] updated svn git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@182 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/svnInfoGui.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/slsDetectorGui/include/svnInfoGui.h b/slsDetectorGui/include/svnInfoGui.h index bd0ff4dba..b6cda4b25 100644 --- a/slsDetectorGui/include/svnInfoGui.h +++ b/slsDetectorGui/include/svnInfoGui.h @@ -2,10 +2,10 @@ #define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui" //#define SVNREPPATH "" #define SVNREPUUID "af1100a4-978c-4157-bff7-07162d2ba061" -//#define SVNREV 0x171 +//#define SVNREV 0x181 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "l_maliakal_d" -#define SVNREV 0x171 -#define SVNDATE 0x20130410 +#define SVNREV 0x181 +#define SVNDATE 0x20130515 // From acbb4774fc0da9f9dd753d9608f3b2287603c583 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 15 May 2013 13:28:01 +0000 Subject: [PATCH 183/332] updated svn git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@183 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/svnInfoGui.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/slsDetectorGui/include/svnInfoGui.h b/slsDetectorGui/include/svnInfoGui.h index b6cda4b25..6fb7f1790 100644 --- a/slsDetectorGui/include/svnInfoGui.h +++ b/slsDetectorGui/include/svnInfoGui.h @@ -2,10 +2,10 @@ #define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui" //#define SVNREPPATH "" #define SVNREPUUID "af1100a4-978c-4157-bff7-07162d2ba061" -//#define SVNREV 0x181 +//#define SVNREV 0x182 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "l_maliakal_d" -#define SVNREV 0x181 +#define SVNREV 0x182 #define SVNDATE 0x20130515 // From 0e22e9c03c9bafd6ee9ce8664c7d6d7f47c7bbb7 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 15 May 2013 15:09:02 +0000 Subject: [PATCH 184/332] updated version git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@184 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/svnInfoGui.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/slsDetectorGui/include/svnInfoGui.h b/slsDetectorGui/include/svnInfoGui.h index 6fb7f1790..cdb801097 100644 --- a/slsDetectorGui/include/svnInfoGui.h +++ b/slsDetectorGui/include/svnInfoGui.h @@ -2,10 +2,10 @@ #define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui" //#define SVNREPPATH "" #define SVNREPUUID "af1100a4-978c-4157-bff7-07162d2ba061" -//#define SVNREV 0x182 +//#define SVNREV 0x183 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "l_maliakal_d" -#define SVNREV 0x182 +#define SVNREV 0x183 #define SVNDATE 0x20130515 // From 7624d301a49be6e5c616cac0da0d5f980c951171 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Thu, 16 May 2013 12:12:51 +0000 Subject: [PATCH 185/332] changed dac names for monech git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@185 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/svnInfoGui.h | 4 ++-- slsDetectorGui/src/qTabDeveloper.cpp | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/slsDetectorGui/include/svnInfoGui.h b/slsDetectorGui/include/svnInfoGui.h index cdb801097..7b8f76de3 100644 --- a/slsDetectorGui/include/svnInfoGui.h +++ b/slsDetectorGui/include/svnInfoGui.h @@ -2,10 +2,10 @@ #define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui" //#define SVNREPPATH "" #define SVNREPUUID "af1100a4-978c-4157-bff7-07162d2ba061" -//#define SVNREV 0x183 +//#define SVNREV 0x184 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "l_maliakal_d" -#define SVNREV 0x183 +#define SVNREV 0x184 #define SVNDATE 0x20130515 // diff --git a/slsDetectorGui/src/qTabDeveloper.cpp b/slsDetectorGui/src/qTabDeveloper.cpp index 5a272a209..a5b8253ff 100644 --- a/slsDetectorGui/src/qTabDeveloper.cpp +++ b/slsDetectorGui/src/qTabDeveloper.cpp @@ -99,14 +99,14 @@ void qTabDeveloper::SetupWidgetWindow(){ case slsDetectorDefs::MOENCH: NUM_DAC_WIDGETS = 8; NUM_ADC_WIDGETS = 2; - dacNames.push_back("v Reference:"); - dacNames.push_back("v Cascode n:"); - dacNames.push_back("v Cascode p:"); - dacNames.push_back("v Comp. Output:"); - dacNames.push_back("v Cascode out"); - dacNames.push_back("v Comp. Input:"); - dacNames.push_back("v Comp. Ref:"); - dacNames.push_back("i Base Test:"); + dacNames.push_back("v Dac 0:"); + dacNames.push_back("v Dac 1:"); + dacNames.push_back("v Dac 2:"); + dacNames.push_back("v Dac 3:"); + dacNames.push_back("v Dac 4:"); + dacNames.push_back("v Dac 5:"); + dacNames.push_back("v Dac 6:"); + dacNames.push_back("i Dac 7:"); adcNames.push_back("Temperature ADC:"); adcNames.push_back("Temperature FPGA:"); From bf77cc10b20b2d463fcdcd8f7d035edc1daf7ffb Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 17 May 2013 10:20:19 +0000 Subject: [PATCH 186/332] small change git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@186 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qDrawPlot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index a9d8715eb..95171cca3 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -431,7 +431,7 @@ bool qDrawPlot::StartOrStopThread(bool start){ plot2D->GetPlot()->SetZoom(-0.5,startPixel,nPixelsX,endPixel-startPixel); - cout << "Starting new acquisition threadddd ...." << endl; + cout << "Starting new acquisition thread ...." << endl; // Start acquiring data from server if(!firstTime) pthread_join(gui_acquisition_thread,NULL);//wait until he's finished, ie. exits pthread_create(&gui_acquisition_thread, NULL,DataStartAcquireThread, (void*) this); From b0d873943981b7bea20e02a1d833cd411285be0f Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 17 May 2013 10:20:45 +0000 Subject: [PATCH 187/332] update svn git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@187 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/svnInfoGui.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/slsDetectorGui/include/svnInfoGui.h b/slsDetectorGui/include/svnInfoGui.h index 7b8f76de3..1a9c6343b 100644 --- a/slsDetectorGui/include/svnInfoGui.h +++ b/slsDetectorGui/include/svnInfoGui.h @@ -2,10 +2,10 @@ #define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui" //#define SVNREPPATH "" #define SVNREPUUID "af1100a4-978c-4157-bff7-07162d2ba061" -//#define SVNREV 0x184 +//#define SVNREV 0x186 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "l_maliakal_d" -#define SVNREV 0x184 -#define SVNDATE 0x20130515 +#define SVNREV 0x186 +#define SVNDATE 0x20130517 // From 014dfd7eeda61c0e8486285e6cbb17bae064035b Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 21 May 2013 13:43:30 +0000 Subject: [PATCH 188/332] receiver read frequency from gui can be set now git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@188 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qDrawPlot.h | 4 ++-- slsDetectorGui/src/qDrawPlot.cpp | 13 +++++++++++++ slsDetectorGui/src/qTabPlot.cpp | 1 + 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index 798883912..8341d6a01 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -94,8 +94,8 @@ public: double GetMinimumPlotTimer(){return PLOT_TIMER_MS;}; /** Set Plot timer - between plots in ms*/ void SetPlotTimer(double time){timerValue = time;}; - /** Set Plot frame factor - between plots */ - void SetFrameFactor(int frame){frameFactor = frame;}; + /** Set Plot frame factor - between plots, also for receiver if exists */ + void SetFrameFactor(int frame); /** Starts or stop acquisition * Calls startDaq() function diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 95171cca3..a2f211813 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -1593,3 +1593,16 @@ void qDrawPlot::CalculatePedestal(){ //------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qDrawPlot::SetFrameFactor(int frame){ + frameFactor = frame; + if(myDet->setReceiverOnline()==slsDetectorDefs::ONLINE_FLAG){ + frame = myDet->setReadReceiverFrequency(1,frame); +#ifdef VERBOSE + cout << "Receiver read frequency set to : " << frame << endl; +#endif + } +} + +//------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index 507fd9f5a..55cd5900e 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -600,6 +600,7 @@ void qTabPlot::SetFrequency(){ // Setting the timer value (nth frames) between plots myPlot->SetFrameFactor(spinNthFrame->value()); + #ifdef VERBOSE cout << "Plotting Frequency: Nth Frame - " << spinNthFrame->value() << endl; #endif From 6aeacf7b13edb8f4486dc0880b94ddc9257bb63e Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Thu, 23 May 2013 12:26:08 +0000 Subject: [PATCH 189/332] ordered the makefile a bit, needs more revising git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@189 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/Makefile | 3 +- slsDetectorGui/slsDetectorGui.pro | 59 +++++++++++++++++++------------ 2 files changed, 39 insertions(+), 23 deletions(-) diff --git a/slsDetectorGui/Makefile b/slsDetectorGui/Makefile index 475caa294..dd5c0c467 100644 --- a/slsDetectorGui/Makefile +++ b/slsDetectorGui/Makefile @@ -8,6 +8,7 @@ LIBRARYDIR?=../slsDetectorSoftware INCLUDES?= $(LIBRARYDIR)/commonFiles -I$(LIBRARYDIR)/MySocketTCP -I$(LIBRARYDIR)/slsReceiverInterface -I$(LIBRARYDIR)/slsDetector -I$(LIBRARYDIR)/slsDetectorAnalysis -I$(LIBRARYDIR)/multiSlsDetector -I$(LIBRARYDIR)/usersFunctions LDFLAG?=-L$(LIBRARYDIR)/bin -lSlsDetector + all: $(PROG) Makefile.gui guiclient clean: @@ -19,7 +20,7 @@ clean: Makefile.gui: mm mm: - qmake -set QT_INSTALL_PREFIX $(QTDIR) && qmake -o Makefile.gui INCLUDES='$(INCLUDES)' DESTDIR=$(DESTDIR) SLSDETLIB=$(LIBDIR) SUBLIBS='$(LDFLAG)' INCLUDES='$(INCLUDES)' + qmake -set QT_INSTALL_PREFIX $(QTDIR) && qmake -o Makefile.gui INCLUDES='$(INCLUDES)' DESTDIR=$(DESTDIR) SLSDETLIB=$(LIBDIR) SUBLIBS='$(LDFLAG)' doc: cd manual && make DESTDIR=$(DOCDIR) diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index ccb73aaec..bb96a4ebe 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -1,28 +1,44 @@ +#When using yum for qt, comment out all lines with $(QTDIR) or $(QWTDIR), but export QWTDIR = /usr/include/qwt/ +#and leave "$(QWTDIR) \"uncommented in the INCLUDEPATH -QT_INSTALL_PREFIX=$(QTDIR) -QMAKE_UIC = $(QTDIR)/bin/uic -QMAKE_MOC = $(QTDIR)/bin/moc -QMAKE_RCC = $(QTDIR)/bin/rcc -QMAKE_INCDIR_QT = $(QTDIR)/include/ +#When using epics, uncomment epics defines, libs and a line in INCLUDEPATH + + +QT_INSTALL_PREFIX = $(QTDIR) +QMAKE_UIC = $(QTDIR)/bin/uic +QMAKE_MOC = $(QTDIR)/bin/moc +QMAKE_RCC = $(QTDIR)/bin/rcc +QMAKE_INCDIR_QT = $(QTDIR)/include/ +QMAKE_LIBS_QT = -L$(QTDIR)/lib +QMAKE_LIBS = -L$(QTDIR)/lib + + + + +#epics +#DEFINES += EPICS VERBOSE DACS_INT PRINT_LOG THIS_PATH=\\\"$$PWD\\\" #VERYVERBOSE +#LIBS = -L$(QWTDIR)/lib -lqwt -L$(QWT3D)/lib -Wl,-R$(QWTDIR)/lib -L /usr/local/epics/base/lib/$(EPICS_HOST_ARCH)/ -Wl,-R/usr/local/epics/base/lib/$(EPICS_HOST_ARCH) -lca -lCom + +#default +DEFINES += VERBOSE DACS_INT PRINT_LOG THIS_PATH=\\\"$$PWD\\\" #VERYVERBOSE +LIBS = -L$(QWTDIR)/lib -lqwt -L$(QWT3D)/lib + + + + +QMAKE_CXXFLAGS_WARN_ON = -w +QMAKE_CFLAGS_WARN_ON = -w -QMAKE_LIBS_QT = -L$(QTDIR)/lib -QMAKE_LIBS = -L$(QTDIR)/lib DESTDIR ?= bin MOC_DIR = mocs OBJECTS_DIR = objs UI_HEADERS_DIR = forms/include -SLSDETLIB ?=../slsDetectorSoftware +SLSDETLIB ?= ../slsDetectorSoftware RESOURCES += icons.qrc - CONFIG += debug no_include_pwd -QMAKE_CXXFLAGS_WARN_ON = -w -QMAKE_CFLAGS_WARN_ON = -w - -DEFINES += VERBOSE DACS_INT PRINT_LOG THIS_PATH=\\\"$$PWD\\\" #VERYVERBOSE -#DEFINES += EPICS VERBOSE DACS_INT PRINT_LOG THIS_PATH=\\\"$$PWD\\\" #VERYVERBOSE - + target.path += $(DESTDIR) documentation.path = /$(DOCPATH) @@ -33,19 +49,13 @@ QMAKE_CLEAN += docs/*/* -#LIBS += -Wl,-Bstatic -L../slsDetectorSoftware -lSlsDetector -Wl,-Bdynamic\ -# -L$(QWTDIR)/lib -lqwt -L$(QWT3D)/lib - - -LIBS = -L$(QWTDIR)/lib -lqwt -L$(QWT3D)/lib -#LIBS = -L$(QWTDIR)/lib -lqwt -L$(QWT3D)/lib -Wl,-R$(QWTDIR)/lib -L /usr/local/epics/base/lib/$(EPICS_HOST_ARCH)/ -Wl,-R/usr/local/epics/base/lib/$(EPICS_HOST_ARCH) -lca -lCom - DEPENDPATH += \ slsDetectorPlotting/include\ include\ forms/include + INCLUDEPATH = \ $(QWTDIR)/include\ $(QWTDIR) \ @@ -55,9 +65,14 @@ INCLUDEPATH = \ include\ forms/include\ $(INCLUDES) +#epics # $(INCLUDES) /usr/local/epics/base/include/ -I /usr/local/epics/base/include/os/Linux/ + + + + SOURCES = \ slsDetectorPlotting/src/SlsQt1DPlot.cxx\ slsDetectorPlotting/src/SlsQt1DZoomer.cxx\ From 141a98287802e8769ecad428d00c730b66131982 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Mon, 27 May 2013 09:11:45 +0000 Subject: [PATCH 190/332] update svn rev git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@190 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/svnInfoGui.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/slsDetectorGui/include/svnInfoGui.h b/slsDetectorGui/include/svnInfoGui.h index 1a9c6343b..e9be22751 100644 --- a/slsDetectorGui/include/svnInfoGui.h +++ b/slsDetectorGui/include/svnInfoGui.h @@ -2,10 +2,10 @@ #define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui" //#define SVNREPPATH "" #define SVNREPUUID "af1100a4-978c-4157-bff7-07162d2ba061" -//#define SVNREV 0x186 +//#define SVNREV 0x189 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "l_maliakal_d" -#define SVNREV 0x186 -#define SVNDATE 0x20130517 +#define SVNREV 0x189 +#define SVNDATE 0x20130523 // From 11297027388548b1129d2cd9798d6e613c83bee5 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Mon, 27 May 2013 09:34:39 +0000 Subject: [PATCH 191/332] changed the receiver to be te one deicing frame factor, not gui git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@191 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/svnInfoGui.h | 6 +++--- slsDetectorGui/src/qDrawPlot.cpp | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/slsDetectorGui/include/svnInfoGui.h b/slsDetectorGui/include/svnInfoGui.h index e9be22751..6a14932a7 100644 --- a/slsDetectorGui/include/svnInfoGui.h +++ b/slsDetectorGui/include/svnInfoGui.h @@ -2,10 +2,10 @@ #define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui" //#define SVNREPPATH "" #define SVNREPUUID "af1100a4-978c-4157-bff7-07162d2ba061" -//#define SVNREV 0x189 +//#define SVNREV 0x190 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "l_maliakal_d" -#define SVNREV 0x189 -#define SVNDATE 0x20130523 +#define SVNREV 0x190 +#define SVNDATE 0x20130527 // diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index a2f211813..91853366d 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -1599,6 +1599,7 @@ void qDrawPlot::SetFrameFactor(int frame){ frameFactor = frame; if(myDet->setReceiverOnline()==slsDetectorDefs::ONLINE_FLAG){ frame = myDet->setReadReceiverFrequency(1,frame); + if(frame > 0) frameFactor = 1; #ifdef VERBOSE cout << "Receiver read frequency set to : " << frame << endl; #endif From 4f1dfe8b87ec34874b12a76e3b8280541b3ce155 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 28 May 2013 06:45:56 +0000 Subject: [PATCH 192/332] 2d pedestal implemented git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@192 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_plot.ui | 404 ++++++++++++++++++++------ slsDetectorGui/include/qTabPlot.h | 3 + slsDetectorGui/src/qDrawPlot.cpp | 50 +++- slsDetectorGui/src/qTabPlot.cpp | 30 +- 4 files changed, 400 insertions(+), 87 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index f12d41bbb..dc515bac4 100644 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -81,7 +81,7 @@ - 2D Plot Options + 2D Plot Options 1 Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter @@ -89,88 +89,325 @@ false - + - 8 - 20 - 358 - 26 + 5 + 15 + 361 + 31 - - - - - - 0 - 0 - - - - Interpolate - - - - - - - - 0 - 0 - - - - Contour - - - - - - - - 0 - 0 - - - - Log Scale (Z) - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 33 - 20 - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 33 - 20 - - - - - + + 0 + + + + + + 345 + 0 + 16 + 16 + + + + + 0 + 0 + + + + Qt::NoFocus + + + + + + + :/icons/images/rightArrow.png:/icons/images/rightArrow.png + + + + 16 + 16 + + + + true + + + + + + 5 + 5 + 341 + 26 + + + + + + + + 0 + 0 + + + + Interpolate + + + + + + + + 0 + 0 + + + + Contour + + + + + + + + 0 + 0 + + + + Log Scale (Z) + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 29 + 20 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 29 + 20 + + + + + + + + + + + + 345 + 0 + 16 + 16 + + + + + 0 + 0 + + + + Qt::NoFocus + + + + + + + :/icons/images/rightArrow.png:/icons/images/rightArrow.png + + + + 16 + 16 + + + + true + + + + + + 5 + 4 + 141 + 25 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + + + + + + 20 + 20 + 20 + + + + + + + + + 20 + 20 + 20 + + + + + + + + + 20 + 20 + 20 + + + + + + + + Qt::NoFocus + + + Reset Pedestal + + + + :/icons/images/erase.png:/icons/images/erase.png + + + + 16 + 16 + + + + + + + 200 + 4 + 141 + 25 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + + + + + + 20 + 20 + 20 + + + + + + + + + 20 + 20 + 20 + + + + + + + + + 20 + 20 + 20 + + + + + + + + Qt::NoFocus + + + Calculate Pedestal + + + + :/icons/images/calculate.png:/icons/images/calculate.png + + + + 16 + 16 + + + + @@ -201,7 +438,7 @@ - 2 + 0 @@ -756,6 +993,9 @@ + horizontalLayoutWidget + btnSave + gridLayoutWidget_5 @@ -1386,7 +1626,7 @@ 15 - 137 + 135 371 49 @@ -1804,6 +2044,8 @@ Interval between plots has 2 modes. A condition to be satisfied, in order to avo
+ gridLayoutWidget_4 + gridLayoutWidget_5 diff --git a/slsDetectorGui/include/qTabPlot.h b/slsDetectorGui/include/qTabPlot.h index 6d822cf15..4ebfed61b 100644 --- a/slsDetectorGui/include/qTabPlot.h +++ b/slsDetectorGui/include/qTabPlot.h @@ -147,6 +147,9 @@ private slots: /** Change pages in 1D box*/ void Set1DPage(); + /** Change pages in 2D box*/ + void Set2DPage(); + signals: void DisableZoomSignal(bool); diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 91853366d..cba1bf8a8 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -892,7 +892,51 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){ lastImageArray[py*nPixelsX+px] = sqrt(pow(currentFrame+1,2)*pow(double(px)-nPixelsX/2,2)/pow(nPixelsX/2,2)/pow(number_of_exposures+1,2) + pow(double(py)-nPixelsY/2,2)/pow(nPixelsY/2,2))/sqrt(2); */ // copy data - memcpy(lastImageArray,data->values,nPixelsX*nPixelsY*sizeof(double)); + /*memcpy(lastImageArray,data->values,nPixelsX*nPixelsY*sizeof(double));*/ + + + + //normal data + if(resetPedestal){ + memcpy(lastImageArray,data->values,nPixelsX*nPixelsY*sizeof(double)); + }else{ + //start adding frames to get to the pedestal value + if(pedestalCountvalues[px]; + memcpy(lastImageArray,data->values,nPixelsX*nPixelsY*sizeof(double)); + } + //calculate the pedestal value + else if(pedestalCount==NUM_PEDESTAL_FRAMES){ + cout << "Pedestal Calculated" << endl; + for(unsigned int px=0;px<(nPixelsX*nPixelsY);px++) + pedestalVals[px] = pedestalVals[px]/(double)NUM_PEDESTAL_FRAMES; + memcpy(lastImageArray,data->values,nPixelsX*nPixelsY*sizeof(double)); + } + //use this pedestal value henceforth + else{ + for(unsigned int px=0;px<(nPixelsX*nPixelsY);px++) + lastImageArray[px] = data->values[px] - (pedestalVals[px]); + } + pedestalCount++; + + } + + + + + + + + + + + + + + + + } pthread_mutex_unlock(&(last_image_complete_mutex)); } @@ -1578,9 +1622,9 @@ void qDrawPlot::CalculatePedestal(){ while(1){ if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ //create array - if(pedestalVals) delete [] pedestalVals; pedestalVals = new double[nPixelsX]; + if(pedestalVals) delete [] pedestalVals; pedestalVals = new double[nPixelsX*nPixelsY]; //reset all values - for(unsigned int px=0;pxsetCurrentIndex(0); - + stackedWidget_2->setCurrentIndex(0); if(myDet->getDetectorsType()!=slsDetectorDefs::GOTTHARD){ btnCalPedestal->setEnabled(false); btnResetPedestal->setEnabled(false); } + if(myDet->getDetectorsType()!=slsDetectorDefs::MOENCH){ + btnCalPedestal_2->setEnabled(false); + btnResetPedestal_2->setEnabled(false); + } qDefs::checkErrorMessage(myDet); } @@ -172,8 +176,24 @@ void qTabPlot::SetupWidgetWindow(){ //------------------------------------------------------------------------------------------------------------------------------------------------- +void qTabPlot::Set2DPage(){ + //QPushButton *clickedButton = qobject_cast(sender()); + if(stackedWidget_2->currentIndex()==0){ + stackedWidget_2->setCurrentIndex(1); + box2D->setTitle("2D Plot Options 2"); + } + else{ + stackedWidget_2->setCurrentIndex(0); + box2D->setTitle("2D Plot Options 1"); + } +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + void qTabPlot::Set1DPage(){ - QPushButton *clickedButton = qobject_cast(sender()); + //QPushButton *clickedButton = qobject_cast(sender()); if(stackedWidget->currentIndex()==0){ //if(clickedButton->icon().pixmap(QSize(16,16)).toImage()==btnLeft->icon().pixmap(QSize(16,16)).toImage()) stackedWidget->setCurrentIndex(1); @@ -240,6 +260,9 @@ void qTabPlot::Initialization(){ connect(chkInterpolate, SIGNAL(toggled(bool)),myPlot, SIGNAL(InterpolateSignal(bool))); connect(chkContour, SIGNAL(toggled(bool)),myPlot, SIGNAL(ContourSignal(bool))); connect(chkLogz, SIGNAL(toggled(bool)),myPlot, SIGNAL(LogzSignal(bool))); + //to change pages + connect(btn2DRight, SIGNAL(clicked()), this, SLOT(Set2DPage())); + connect(btn2DRight2, SIGNAL(clicked()), this, SLOT(Set2DPage())); // Plotting frequency box connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency())); connect(comboTimeGapUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency())); @@ -278,7 +301,8 @@ void qTabPlot::Initialization(){ //pedstal connect(btnResetPedestal, SIGNAL(clicked()),myPlot, SLOT(ResetPedestal())); connect(btnCalPedestal, SIGNAL(clicked()),myPlot, SLOT(CalculatePedestal())); - + connect(btnResetPedestal_2, SIGNAL(clicked()),myPlot, SLOT(ResetPedestal())); + connect(btnCalPedestal_2, SIGNAL(clicked()),myPlot, SLOT(CalculatePedestal())); } From b915844822c623859f2d3be76ba9d3b07e32fbcc Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 28 May 2013 07:04:53 +0000 Subject: [PATCH 193/332] 2d pedestal implemented git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@193 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qDrawPlot.cpp | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index cba1bf8a8..14ca7a43d 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -886,16 +886,13 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){ // Titles imageTitle = temp_title; // manufacture data for now - /* + /* default data for(unsigned int px=0;pxvalues,nPixelsX*nPixelsY*sizeof(double));*/ - - - //normal data if(resetPedestal){ memcpy(lastImageArray,data->values,nPixelsX*nPixelsY*sizeof(double)); @@ -921,22 +918,6 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){ pedestalCount++; } - - - - - - - - - - - - - - - - } pthread_mutex_unlock(&(last_image_complete_mutex)); } From 378f7715b9cba691be76e22003c1a70fafb4f5b8 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Mon, 3 Jun 2013 08:18:34 +0000 Subject: [PATCH 194/332] update svn number git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@194 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/svnInfoGui.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/slsDetectorGui/include/svnInfoGui.h b/slsDetectorGui/include/svnInfoGui.h index 6a14932a7..39cf7f80f 100644 --- a/slsDetectorGui/include/svnInfoGui.h +++ b/slsDetectorGui/include/svnInfoGui.h @@ -2,10 +2,10 @@ #define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui" //#define SVNREPPATH "" #define SVNREPUUID "af1100a4-978c-4157-bff7-07162d2ba061" -//#define SVNREV 0x190 +//#define SVNREV 0x193 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "l_maliakal_d" -#define SVNREV 0x190 -#define SVNDATE 0x20130527 +#define SVNREV 0x193 +#define SVNDATE 0x20130528 // From d49a5cd7b4f9ed4f063e22b90eeee070c8a71fc3 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 7 Jun 2013 11:16:53 +0000 Subject: [PATCH 195/332] bug fix: after cloning, signals still ocnnected git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@195 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qDetectorMain.h | 1 - slsDetectorGui/include/qDrawPlot.h | 5 ++++ slsDetectorGui/include/qTabPlot.h | 4 ++- slsDetectorGui/include/svnInfoGui.h | 11 ------- slsDetectorGui/src/qDetectorMain.cpp | 3 ++ slsDetectorGui/src/qDrawPlot.cpp | 40 ++++++++++++++++++++++++++ slsDetectorGui/src/qTabPlot.cpp | 26 +++++++++++++++++ 7 files changed, 77 insertions(+), 13 deletions(-) diff --git a/slsDetectorGui/include/qDetectorMain.h b/slsDetectorGui/include/qDetectorMain.h index 9d9848f7d..181ab9cde 100644 --- a/slsDetectorGui/include/qDetectorMain.h +++ b/slsDetectorGui/include/qDetectorMain.h @@ -190,7 +190,6 @@ protected: * */ void resizeEvent(QResizeEvent* event); -signals: }; diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index 8341d6a01..09894f69a 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -126,6 +126,10 @@ public: */ bool GetClientInitiated(){return clientInitiated;}; + /** Update all ranges, interpolate etc after cloning + * parameters are if they are checked or not + */ + void UpdateAfterCloning(bool points, bool logy, bool interpolate, bool contour, bool logz); public slots: /** To select 1D or 2D plot @@ -511,6 +515,7 @@ void ResetZMinZMaxSignal(bool,bool,double,double); void SetCurrentMeasurementSignal(int); void saveErrorSignal(QString); void AcquisitionErrorSignal(QString); +void UpdateAfterCloningSignal(); }; diff --git a/slsDetectorGui/include/qTabPlot.h b/slsDetectorGui/include/qTabPlot.h index 4ebfed61b..57a964942 100644 --- a/slsDetectorGui/include/qTabPlot.h +++ b/slsDetectorGui/include/qTabPlot.h @@ -112,7 +112,9 @@ public slots: */ void EnableScanBox(); - + /** Update all ranges, interpolate etc after cloning + */ + void UpdateAfterCloning(); private slots: /** Selects the plot to display, enables/disables widgets diff --git a/slsDetectorGui/include/svnInfoGui.h b/slsDetectorGui/include/svnInfoGui.h index 39cf7f80f..e69de29bb 100644 --- a/slsDetectorGui/include/svnInfoGui.h +++ b/slsDetectorGui/include/svnInfoGui.h @@ -1,11 +0,0 @@ -//#define SVNPATH "" -#define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui" -//#define SVNREPPATH "" -#define SVNREPUUID "af1100a4-978c-4157-bff7-07162d2ba061" -//#define SVNREV 0x193 -//#define SVNKIND "" -//#define SVNSCHED "" -#define SVNAUTH "l_maliakal_d" -#define SVNREV 0x193 -#define SVNDATE 0x20130528 -// diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index f4f0ff63d..cda172f75 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -279,6 +279,9 @@ void qDetectorMain::Initialization(){ //This should not be called as it will change file name to measurement when run finished //connect(myPlot, SIGNAL(UpdatingPlotFinished()), tab_plot, SLOT(Refresh())); connect(myPlot, SIGNAL(SetCurrentMeasurementSignal(int)), tab_measurement, SLOT(SetCurrentMeasurement(int))); + //to update all ranges when a clone has been made + connect(myPlot, SIGNAL(UpdateAfterCloningSignal()), tab_plot,SLOT(UpdateAfterCloning())); + // menubar // Modes Menu connect(menuModes, SIGNAL(triggered(QAction*)), this,SLOT(EnableModes(QAction*))); diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 14ca7a43d..99b6626e9 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -1215,6 +1215,14 @@ void qDrawPlot::ClonePlot(){ LockLastImageArray(); + //disconnect + disconnect(this, SIGNAL(InterpolateSignal(bool)), plot2D, SIGNAL(InterpolateSignal(bool))); + disconnect(this, SIGNAL(ContourSignal(bool)), plot2D, SIGNAL(ContourSignal(bool))); + disconnect(this, SIGNAL(LogzSignal(bool)), plot2D, SLOT(SetZScaleToLog(bool))); + disconnect(this, SIGNAL(LogySignal(bool)), plot1D, SLOT(SetLogY(bool))); + disconnect(this, SIGNAL(ResetZMinZMaxSignal(bool,bool,double,double)),plot2D, SLOT(ResetZMinZMax(bool,bool,double,double))); + disconnect(this, SIGNAL(SetZRangeSignal(double,double)), plot2D, SLOT(SetZRange(double,double))); + // create clone winClone[i] = new qCloneWidget(this,i,boxPlot->title(),(int)plot_in_scope,plot1D,plot2D,sFilePath); if(plot_in_scope==1){ @@ -1267,6 +1275,12 @@ void qDrawPlot::ClonePlot(){ connect(this, SIGNAL(ContourSignal(bool)), plot2D, SIGNAL(ContourSignal(bool))); connect(this, SIGNAL(LogzSignal(bool)), plot2D, SLOT(SetZScaleToLog(bool))); connect(this, SIGNAL(LogySignal(bool)), plot1D, SLOT(SetLogY(bool))); + connect(this, SIGNAL(ResetZMinZMaxSignal(bool,bool,double,double)),plot2D, SLOT(ResetZMinZMax(bool,bool,double,double))); + connect(this, SIGNAL(SetZRangeSignal(double,double)), plot2D, SLOT(SetZRange(double,double))); + + //update ranges on current plot + emit UpdateAfterCloningSignal(); + winClone[i]->show(); // to remember which all clone widgets were closed @@ -1632,3 +1646,29 @@ void qDrawPlot::SetFrameFactor(int frame){ } //------------------------------------------------------------------------------------------------------------------------------------------------- + + + +void qDrawPlot::UpdateAfterCloning(bool points, bool logy, bool interpolate, bool contour, bool logz){ +#ifdef VERBOSE + cout << endl << "**Updating Plot After Cloning" << endl; +#endif + + //1d + if(plot_in_scope == 1){ + SetMarkers(points); + emit LogySignal(logy); + } + //2d + else{ + emit InterpolateSignal(interpolate); + emit ContourSignal(contour); + emit LogzSignal(logz); + } + +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index d34575243..b68e92acf 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -877,4 +877,30 @@ void qTabPlot::Refresh(){ } +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabPlot::UpdateAfterCloning(){ +#ifdef VERBOSE + cout << endl << "**Updating Plot After Cloning" << endl; +#endif + EnableRange(); + EnableTitles(); + myPlot->UpdateAfterCloning( + chkPoints->isChecked(), + chk1DLog->isChecked(), + chkInterpolate->isChecked(), + chkContour->isChecked(), + chkLogz->isChecked()); + + //1d + if(isOneD) + EnablePersistency(chkSuperimpose->isChecked()); + //2d + else + EnableZRange(); + +} + + //------------------------------------------------------------------------------------------------------------------------------------------------- From 6dfa75430c7625eca04b8bb1add690d1f00536aa Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 12 Jun 2013 10:24:55 +0000 Subject: [PATCH 196/332] svn info git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@196 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/svnInfoGui.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/slsDetectorGui/include/svnInfoGui.h b/slsDetectorGui/include/svnInfoGui.h index e69de29bb..6a1e612ae 100644 --- a/slsDetectorGui/include/svnInfoGui.h +++ b/slsDetectorGui/include/svnInfoGui.h @@ -0,0 +1,11 @@ +//#define SVNPATH "" +#define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui" +//#define SVNREPPATH "" +#define SVNREPUUID "af1100a4-978c-4157-bff7-07162d2ba061" +//#define SVNREV 0x195 +//#define SVNKIND "" +//#define SVNSCHED "" +#define SVNAUTH "l_maliakal_d" +#define SVNREV 0x195 +#define SVNDATE 0x20130607 +// From 019b231a8c7666232dd49c32af32fd41b5204ad7 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 19 Jun 2013 09:34:58 +0000 Subject: [PATCH 197/332] update svn git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@197 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/svnInfoGui.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/slsDetectorGui/include/svnInfoGui.h b/slsDetectorGui/include/svnInfoGui.h index 6a1e612ae..4d39eac7e 100644 --- a/slsDetectorGui/include/svnInfoGui.h +++ b/slsDetectorGui/include/svnInfoGui.h @@ -2,10 +2,10 @@ #define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui" //#define SVNREPPATH "" #define SVNREPUUID "af1100a4-978c-4157-bff7-07162d2ba061" -//#define SVNREV 0x195 +//#define SVNREV 0x196 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "l_maliakal_d" -#define SVNREV 0x195 -#define SVNDATE 0x20130607 +#define SVNREV 0x196 +#define SVNDATE 0x20130612 // From c0e735c0b9144a201fd77bc13de017377f8af77b Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 21 Jun 2013 14:28:45 +0000 Subject: [PATCH 198/332] updated svn git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@198 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/svnInfoGui.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/slsDetectorGui/include/svnInfoGui.h b/slsDetectorGui/include/svnInfoGui.h index 4d39eac7e..99175567f 100644 --- a/slsDetectorGui/include/svnInfoGui.h +++ b/slsDetectorGui/include/svnInfoGui.h @@ -2,10 +2,10 @@ #define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui" //#define SVNREPPATH "" #define SVNREPUUID "af1100a4-978c-4157-bff7-07162d2ba061" -//#define SVNREV 0x196 +//#define SVNREV 0x197 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "l_maliakal_d" -#define SVNREV 0x196 -#define SVNDATE 0x20130612 +#define SVNREV 0x197 +#define SVNDATE 0x20130619 // From 390ca761307a01a04f7c5c6ff16abd46f893fb0d Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 25 Jun 2013 11:30:54 +0000 Subject: [PATCH 199/332] small change in config file err msg git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@199 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/svnInfoGui.h | 6 +++--- slsDetectorGui/src/qDetectorMain.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/slsDetectorGui/include/svnInfoGui.h b/slsDetectorGui/include/svnInfoGui.h index 99175567f..9127cca45 100644 --- a/slsDetectorGui/include/svnInfoGui.h +++ b/slsDetectorGui/include/svnInfoGui.h @@ -2,10 +2,10 @@ #define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui" //#define SVNREPPATH "" #define SVNREPUUID "af1100a4-978c-4157-bff7-07162d2ba061" -//#define SVNREV 0x197 +//#define SVNREV 0x198 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "l_maliakal_d" -#define SVNREV 0x197 -#define SVNDATE 0x20130619 +#define SVNREV 0x198 +#define SVNDATE 0x20130621 // diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index cda172f75..daa1a2c68 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -318,7 +318,7 @@ void qDetectorMain::LoadConfigFile(const string fName){ else{ //could not load config file if(myDet->readConfigurationFile(fName)==slsDetectorDefs::FAIL) - qDefs::Message(qDefs::WARNING,string("Could not load the Configuration Parameters from file:\n")+fName,"Main"); + qDefs::Message(qDefs::WARNING,string("Could not load all the Configuration Parameters from file:\n")+fName,"Main"); //successful else qDefs::Message(qDefs::INFORMATION,"The Configuration Parameters have been loaded successfully at start up.","Main"); @@ -439,7 +439,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ if(myDet->readConfigurationFile(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL){ qDefs::Message(qDefs::INFORMATION,"The Configuration Parameters have been configured successfully.","Main"); refreshTabs=true; - }else qDefs::Message(qDefs::WARNING,string("Could not load the Configuration Parameters from file:\n")+fName.toAscii().constData(),"Main"); + }else qDefs::Message(qDefs::WARNING,string("Could not load all the Configuration Parameters from file:\n")+fName.toAscii().constData(),"Main"); qDefs::checkErrorMessage(myDet); } } From f618ed439d6acb50c67b650471634d6d8f6ad9e2 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Thu, 11 Jul 2013 09:07:14 +0000 Subject: [PATCH 200/332] svn updated git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@200 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/svnInfoGui.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/slsDetectorGui/include/svnInfoGui.h b/slsDetectorGui/include/svnInfoGui.h index 9127cca45..ab61cb35d 100644 --- a/slsDetectorGui/include/svnInfoGui.h +++ b/slsDetectorGui/include/svnInfoGui.h @@ -2,10 +2,10 @@ #define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui" //#define SVNREPPATH "" #define SVNREPUUID "af1100a4-978c-4157-bff7-07162d2ba061" -//#define SVNREV 0x198 +//#define SVNREV 0x199 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "l_maliakal_d" -#define SVNREV 0x198 -#define SVNDATE 0x20130621 +#define SVNREV 0x199 +#define SVNDATE 0x20130625 // From 0aef2f3b81b868484f24c9f17224cb02458759cd Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 12 Jul 2013 09:25:05 +0000 Subject: [PATCH 201/332] updated svn git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@201 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/svnInfoGui.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/slsDetectorGui/include/svnInfoGui.h b/slsDetectorGui/include/svnInfoGui.h index ab61cb35d..d1d10ecaf 100644 --- a/slsDetectorGui/include/svnInfoGui.h +++ b/slsDetectorGui/include/svnInfoGui.h @@ -2,10 +2,10 @@ #define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui" //#define SVNREPPATH "" #define SVNREPUUID "af1100a4-978c-4157-bff7-07162d2ba061" -//#define SVNREV 0x199 +//#define SVNREV 0x200 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "l_maliakal_d" -#define SVNREV 0x199 -#define SVNDATE 0x20130625 +#define SVNREV 0x200 +#define SVNDATE 0x20130711 // From bca0799b8441196dff21d95c8b5f8758a0f212d3 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 12 Jul 2013 10:27:16 +0000 Subject: [PATCH 202/332] fixed gui bug: time interval must be set before acquisition git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@202 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qTabPlot.h | 1 + slsDetectorGui/src/qTabPlot.cpp | 3 +++ 2 files changed, 4 insertions(+) diff --git a/slsDetectorGui/include/qTabPlot.h b/slsDetectorGui/include/qTabPlot.h index 57a964942..0dbda9cd0 100644 --- a/slsDetectorGui/include/qTabPlot.h +++ b/slsDetectorGui/include/qTabPlot.h @@ -116,6 +116,7 @@ public slots: */ void UpdateAfterCloning(); + private slots: /** Selects the plot to display, enables/disables widgets * @param b true to select plot dimension 1, else false to select 2D diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index b68e92acf..2592be6cb 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -858,11 +858,14 @@ void qTabPlot::Refresh(){ cout << endl << "**Updating Plot Tab" << endl; #endif if(!myPlot->isRunning()){ + if (!radioNoPlot->isChecked()) + boxFrequency->setEnabled(true); connect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox())); EnableScanBox(); SetFrequency(); }else{ + boxFrequency->setEnabled(false); disconnect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox())); boxScan->setEnabled(false); //to toggle between no plot and the plot mode chosen while pltting From 12f48fb0d23082ed64b1a7c99b7bf8b39e61db94 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 12 Jul 2013 12:44:23 +0000 Subject: [PATCH 203/332] form used ampersand git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@203 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_detectormain.ui | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/slsDetectorGui/forms/form_detectormain.ui b/slsDetectorGui/forms/form_detectormain.ui index 4874af640..1cdc2001b 100644 --- a/slsDetectorGui/forms/form_detectormain.ui +++ b/slsDetectorGui/forms/form_detectormain.ui @@ -209,6 +209,9 @@ 9 + + Qt::StrongFocus + false @@ -383,7 +386,7 @@ p, li { white-space: pre-wrap; } - Load &Setup + &Load &Setup @@ -391,7 +394,7 @@ p, li { white-space: pre-wrap; } - Save &Setup + &Save &Setup @@ -404,12 +407,12 @@ p, li { white-space: pre-wrap; } - Load &Configuration + &Load &Configuration - Save &Configuration + &Save &Configuration @@ -481,27 +484,27 @@ p, li { white-space: pre-wrap; } true - &Dockable Windows + D&ockable Windows - Load &Trimbits + &Load &Trimbits - Save &Trimbits + &Save &Trimbits - Load C&alibration + &Load C&alibration - Save C&alibration + &Save C&alibration @@ -509,7 +512,7 @@ p, li { white-space: pre-wrap; } true - Listen to Gui Client + &Listen to Gui Client From d84f95456b30e4a6ed753ab80fa9db29d3673776 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 17 Jul 2013 14:54:42 +0000 Subject: [PATCH 204/332] included accumulate, pedestal and binary git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@204 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_plot.ui | 939 +++++++++++++++++--------- slsDetectorGui/include/qDrawPlot.h | 38 +- slsDetectorGui/include/qTabPlot.h | 10 +- slsDetectorGui/src/qDrawPlot.cpp | 186 +++-- slsDetectorGui/src/qTabPlot.cpp | 185 +++-- 5 files changed, 922 insertions(+), 436 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index dc515bac4..3c0bb4aae 100644 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -99,50 +99,15 @@ - 0 + 3 - - - - 345 - 0 - 16 - 16 - - - - - 0 - 0 - - - - Qt::NoFocus - - - - - - - :/icons/images/rightArrow.png:/icons/images/rightArrow.png - - - - 16 - 16 - - - - true - - - 5 + 20 5 - 341 + 327 26 @@ -196,7 +161,7 @@ - 29 + 15 20 @@ -212,7 +177,7 @@ - 29 + 20 20 @@ -221,49 +186,45 @@ - - + + - 345 - 0 - 16 - 16 + 25 + 5 + 95 + 26 - - - 0 - 0 - - - - Qt::NoFocus - - - - - - - :/icons/images/rightArrow.png:/icons/images/rightArrow.png - - - - 16 - 16 - - - - true - + + + 0 + + + + + true + + + + 0 + 0 + + + + Accumulate + + + + - + - 5 - 4 - 141 - 25 + 175 + 3 + 156 + 26 @@ -319,82 +280,7 @@ Qt::NoFocus - Reset Pedestal - - - - :/icons/images/erase.png:/icons/images/erase.png - - - - 16 - 16 - - - - - - - 200 - 4 - 141 - 25 - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - - - - - 20 - 20 - 20 - - - - - - - - - 20 - 20 - 20 - - - - - - - - - 20 - 20 - 20 - - - - - - - - Qt::NoFocus - - - Calculate Pedestal + Reset Accumulation @@ -408,6 +294,257 @@ + + + + + 20 + 5 + 76 + 26 + + + + + 0 + + + + + true + + + + 0 + 0 + + + + Pedestal + + + + + + + + + 160 + 3 + 171 + 26 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + + + + + + 20 + 20 + 20 + + + + + + + + + 20 + 20 + 20 + + + + + + + + + 20 + 20 + 20 + + + + + + + + Qt::NoFocus + + + Recalculate Pedestal + + + + :/icons/images/calculate.png:/icons/images/calculate.png + + + + 16 + 16 + + + + horizontalLayoutWidget_5 + btnSave_2 + btnRecalPedestal_2 + + + + + + 25 + 5 + 311 + 26 + + + + + 1 + + + + + + 0 + 0 + + + + Binary + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + false + + + + 0 + 0 + + + + from + + + + + + + false + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + 0 + + + 16777215 + + + 0 + + + + + + + false + + + + 0 + 0 + + + + to + + + + + + + false + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + 0 + + + 16777215 + + + 0 + + + + + + @@ -438,13 +575,13 @@ - 0 + 4 - 5 + 25 5 107 26 @@ -531,49 +668,14 @@
- - - - 345 - 0 - 16 - 16 - - - - - 0 - 0 - - - - Qt::NoFocus - - - - - - - :/icons/images/rightArrow.png:/icons/images/rightArrow.png - - - - 16 - 16 - - - - true - - - 5 + 25 5 - 336 + 321 26 @@ -644,50 +746,15 @@
- - - - 345 - 0 - 16 - 16 - - - - - 0 - 0 - - - - Qt::NoFocus - - - - - - - :/icons/images/rightArrow.png:/icons/images/rightArrow.png - - - - 16 - 16 - - - - true - - - - + + - 5 - 5 - 141 - 25 + 175 + 3 + 161 + 26 @@ -743,82 +810,7 @@ Qt::NoFocus - Reset Pedestal - - - - :/icons/images/erase.png:/icons/images/erase.png - - - - 16 - 16 - - - - - - - 200 - 5 - 141 - 25 - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - - - - - 20 - 20 - 20 - - - - - - - - - 20 - 20 - 20 - - - - - - - - - 20 - 20 - 20 - - - - - - - - Qt::NoFocus - - - Calculate Pedestal + Reset Accumulation @@ -831,13 +823,77 @@ - + - 345 - 0 - 16 - 16 + 25 + 5 + 95 + 26 + + + + + 0 + + + + + true + + + + 0 + 0 + + + + Accumulate + + + + + + + + + + + 25 + 5 + 76 + 26 + + + + + 0 + + + + + true + + + + 0 + 0 + + + + Pedestal + + + + + + + + + 165 + 3 + 171 + 26 @@ -846,15 +902,58 @@ 0 + + + 16777215 + 16777215 + + + + + + + + + 20 + 20 + 20 + + + + + + + + + 20 + 20 + 20 + + + + + + + + + 20 + 20 + 20 + + + + + + Qt::NoFocus - + Recalculate Pedestal - :/icons/images/rightArrow.png:/icons/images/rightArrow.png + :/icons/images/calculate.png:/icons/images/calculate.png @@ -862,9 +961,140 @@ 16 - - true + + + + + + + 25 + 5 + 311 + 26 + + + + 1 + + + + + Binary + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + false + + + + 0 + 0 + + + + from + + + + + + + false + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + 0 + + + 16777215 + + + 0 + + + + + + + false + + + + 0 + 0 + + + + to + + + + + + + false + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + 0 + + + 16777215 + + + 0 + + + + @@ -993,9 +1223,6 @@ - horizontalLayoutWidget - btnSave - gridLayoutWidget_5 @@ -2044,8 +2271,76 @@ Interval between plots has 2 modes. A condition to be satisfied, in order to avo
- gridLayoutWidget_4 - gridLayoutWidget_5 + + + + + 362 + 95 + 16 + 16 + + + + + 0 + 0 + + + + Qt::NoFocus + + + + + + + :/icons/images/rightArrow.png:/icons/images/rightArrow.png + + + + 16 + 16 + + + + true + + + + + + 23 + 94 + 16 + 16 + + + + + 0 + 0 + + + + Qt::NoFocus + + + + + + + :/icons/images/leftArrow.png:/icons/images/leftArrow.png + + + + 16 + 16 + + + + true + diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index 09894f69a..448d4bdca 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -131,6 +131,9 @@ public: */ void UpdateAfterCloning(bool points, bool logy, bool interpolate, bool contour, bool logz); + /** set binary range */ + void SetBinary(bool enable, int from=0, int to=0); + public slots: /** To select 1D or 2D plot @param i is 1 for 1D, else 2D plot */ @@ -161,14 +164,14 @@ void SetMarkers(bool enable){markers = enable;}; void SetScanArgument(int scanArg); /** sets stop_signal to true */ void StopAcquisition(){ stop_signal = true; }; - - -//pedestal -/** reset pedestal */ -void ResetPedestal(); -/** Calculate Pedestal */ -void CalculatePedestal(); - +/** Set/unset pedestal */ +void SetPedestal(bool enable); +/** Recalculate Pedestal */ +void RecalculatePedestal(); +/** Set/unset accumulate */ +void SetAccumulate(bool enable); +/** Reset accumulation */ +void ResetAccumulate(); private: @@ -491,12 +494,27 @@ bool originally2D; //pedstal /** Number of pedestal frames*/ static const int NUM_PEDESTAL_FRAMES = 20; -/**reset pedestal*/ -bool resetPedestal; +/** set/unset pedestal*/ +bool pedestal; /** pedestal values */ double* pedestalVals; +/** temporary pedestal values to hide while recalculating*/ +double* tempPedestalVals; /** count for 20 frames to calculate the pedestal */ int pedestalCount; +/** start pedestal calculation */ +bool startPedestalCal; + +//accumulation +/** set/unset accumulation */ +bool accumulate; +/** to reset accumulation */ +bool resetAccumulate; + +/** range for binary plot output */ +bool binary; +int binaryFrom; +int binaryTo; /** this is set when client starts/stops acquisition * and is reset once the gui really starts/stops */ diff --git a/slsDetectorGui/include/qTabPlot.h b/slsDetectorGui/include/qTabPlot.h index 0dbda9cd0..08390742f 100644 --- a/slsDetectorGui/include/qTabPlot.h +++ b/slsDetectorGui/include/qTabPlot.h @@ -147,12 +147,14 @@ private slots: /** Set Plot to none, data graph, histogram*/ void SetPlot(); - /** Change pages in 1D box*/ - void Set1DPage(); + /** Change pages in plot options box to the right*/ + void SetPlotOptionsRightPage(); - /** Change pages in 2D box*/ - void Set2DPage(); + /** Change pages in plot options box to the left*/ + void SetPlotOptionsLeftPage(); + /** Plot binary plot */ + void SetBinary(); signals: void DisableZoomSignal(bool); diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 99b6626e9..1f0f1af2c 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -179,15 +179,23 @@ void qDrawPlot::SetupWidgetWindow(){ fileSaveEnable= myDet->enableWriteToFile(); //pedestal - resetPedestal = true; + pedestal = false; pedestalVals = 0; - pedestalCount = -1; + tempPedestalVals = 0; + pedestalCount = 0; + startPedestalCal = false; - if(myDet->getDetectorsType()==slsDetectorDefs::GOTTHARD) - pedestalCount = 0; + //accumulate + accumulate = false; + resetAccumulate = false; clientInitiated = false; + //binary plot output + binary = false; + binaryFrom = 0; + binaryTo = 0; + //widget related initialization // clone @@ -854,70 +862,95 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){ for(int i=currentPersistency;i>0;i--) memcpy(histYAxis[i],histYAxis[i-1],nPixelsX*sizeof(double)); - //normal data - if(resetPedestal){ - memcpy(histYAxis[0],data->values,nPixelsX*sizeof(double)); - }else{ + //recalculating pedestal + if(startPedestalCal){ + pedestalCount++; //start adding frames to get to the pedestal value if(pedestalCountvalues[px]; + tempPedestalVals[px] += data->values[px]; memcpy(histYAxis[0],data->values,nPixelsX*sizeof(double)); } //calculate the pedestal value else if(pedestalCount==NUM_PEDESTAL_FRAMES){ cout << "Pedestal Calculated" << endl; for(unsigned int px=0;pxvalues,nPixelsX*sizeof(double)); + tempPedestalVals[px] = tempPedestalVals[px]/(double)NUM_PEDESTAL_FRAMES; + memcpy(pedestalVals,tempPedestalVals,nPixelsX*sizeof(double)); + startPedestalCal = 0; } - //use this pedestal value henceforth - else{ - for(unsigned int px=0;pxvalues[px] - (pedestalVals[px]); - } - pedestalCount++; - } + //normal data + if(((!pedestal)&(!accumulate)) || (resetAccumulate)){ + memcpy(histYAxis[0],data->values,nPixelsX*sizeof(double)); + resetAccumulate = false; + } + //pedestal or accumulate + else{ + for(unsigned int px=0;px<(nPixelsX*nPixelsY);px++){ + if(accumulate) + histYAxis[0][px] += data->values[px]; + else + histYAxis[0][px] = data->values[px]; + if(pedestal) + histYAxis[0][px] = histYAxis[0][px] - (pedestalVals[px]); + if(binary) { + if ((histYAxis[0][px] >= binaryFrom) && (histYAxis[0][px] <= binaryTo)) + histYAxis[0][px] = 1; + else + histYAxis[0][px] = 0; + } + } + } } //2d else{ // Titles imageTitle = temp_title; - // manufacture data for now - /* default data - for(unsigned int px=0;pxvalues,nPixelsX*nPixelsY*sizeof(double));*/ - //normal data - if(resetPedestal){ - memcpy(lastImageArray,data->values,nPixelsX*nPixelsY*sizeof(double)); - }else{ + //recalculating pedestal + if(startPedestalCal){ + pedestalCount++; //start adding frames to get to the pedestal value if(pedestalCountvalues[px]; + tempPedestalVals[px] += data->values[px]; memcpy(lastImageArray,data->values,nPixelsX*nPixelsY*sizeof(double)); } //calculate the pedestal value else if(pedestalCount==NUM_PEDESTAL_FRAMES){ cout << "Pedestal Calculated" << endl; for(unsigned int px=0;px<(nPixelsX*nPixelsY);px++) - pedestalVals[px] = pedestalVals[px]/(double)NUM_PEDESTAL_FRAMES; - memcpy(lastImageArray,data->values,nPixelsX*nPixelsY*sizeof(double)); - } - //use this pedestal value henceforth - else{ - for(unsigned int px=0;px<(nPixelsX*nPixelsY);px++) - lastImageArray[px] = data->values[px] - (pedestalVals[px]); - } - pedestalCount++; + tempPedestalVals[px] = tempPedestalVals[px]/(double)NUM_PEDESTAL_FRAMES; + memcpy(pedestalVals,tempPedestalVals,nPixelsX*nPixelsY*sizeof(double)); + startPedestalCal = 0; + } } + + //normal data + if(((!pedestal)&(!accumulate)) || (resetAccumulate)){ + memcpy(lastImageArray,data->values,nPixelsX*nPixelsY*sizeof(double)); + resetAccumulate = false; + } + //pedestal or accumulate or binary + else{ + for(unsigned int px=0;px<(nPixelsX*nPixelsY);px++){ + if(accumulate) + lastImageArray[px] += data->values[px]; + else + lastImageArray[px] = data->values[px]; + if(pedestal) + lastImageArray[px] = lastImageArray[px] - (pedestalVals[px]); + if(binary) { + if ((lastImageArray[px] >= binaryFrom) && (lastImageArray[px] <= binaryTo)) + lastImageArray[px] = 1; + else + lastImageArray[px] = 0; + } + } + } + } pthread_mutex_unlock(&(last_image_complete_mutex)); } @@ -1591,15 +1624,41 @@ int qDrawPlot::UpdateTrimbitPlot(bool fromDetector,bool Histogram){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void qDrawPlot::ResetPedestal(){ +void qDrawPlot::SetPedestal(bool enable){ #ifdef VERBOSE - cout << "Resetting Pedestal" << endl; + cout << "Setting Pedestal to " << enable << endl; +#endif + if(enable){ + pedestal = true; + if(pedestalVals == 0) + RecalculatePedestal(); + }else{ + pedestal = false; + } +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qDrawPlot::RecalculatePedestal(){ +#ifdef VERBOSE + cout << "Recalculating Pedestal" << endl; #endif while(1){ if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ - pedestalVals = 0; + startPedestalCal = 1; pedestalCount = 0; - resetPedestal = true; + + //create array + if(pedestalVals) delete [] pedestalVals; pedestalVals = new double[nPixelsX*nPixelsY]; + if(tempPedestalVals) delete [] tempPedestalVals; tempPedestalVals = new double[nPixelsX*nPixelsY]; + //reset all values + for(unsigned int px=0;px<(nPixelsX*nPixelsY);px++) + pedestalVals[px] = 0; + for(unsigned int px=0;px<(nPixelsX*nPixelsY);px++) + tempPedestalVals[px] = 0; + pthread_mutex_unlock(&(last_image_complete_mutex)); break; } @@ -1610,20 +1669,23 @@ void qDrawPlot::ResetPedestal(){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void qDrawPlot::CalculatePedestal(){ +void qDrawPlot::SetAccumulate(bool enable){ #ifdef VERBOSE - cout << "Calculating Pedestal" << endl; + cout << "Setting Accumulate to " << enable << endl; +#endif + accumulate = enable; +} + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qDrawPlot::ResetAccumulate(){ +#ifdef VERBOSE + cout << "Resetting Accumulation" << endl; #endif while(1){ if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ - //create array - if(pedestalVals) delete [] pedestalVals; pedestalVals = new double[nPixelsX*nPixelsY]; - //reset all values - for(unsigned int px=0;px<(nPixelsX*nPixelsY);px++) - pedestalVals[px] = 0; - - pedestalCount = 0; - resetPedestal = false; + resetAccumulate = true; pthread_mutex_unlock(&(last_image_complete_mutex)); break; } @@ -1672,3 +1734,19 @@ void qDrawPlot::UpdateAfterCloning(bool points, bool logy, bool interpolate, boo //------------------------------------------------------------------------------------------------------------------------------------------------- +void qDrawPlot::SetBinary(bool enable, int from, int to){ +#ifdef VERBOSE + if(!enable) + cout << "Disabling Binary output " << endl; + else + cout << "Enabling Binary output from " << from << " to " << to << endl; +#endif + binary = enable; + binaryFrom = from; + binaryTo = to; +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index 2592be6cb..e8343d9d4 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -139,13 +139,37 @@ void qTabPlot::SetupWidgetWindow(){ stackedLayout->addWidget(spinNthFrame); stackWidget->setLayout(stackedLayout); + stackedWidget->setCurrentIndex(0); + stackedWidget_2->setCurrentIndex(0); // Depending on whether the detector is 1d or 2d switch(myDet->getDetectorsType()){ - case slsDetectorDefs::MYTHEN: isOriginallyOneD = true; break; - case slsDetectorDefs::EIGER: isOriginallyOneD = false; break; - case slsDetectorDefs::GOTTHARD: isOriginallyOneD = true; break; - case slsDetectorDefs::MOENCH: isOriginallyOneD = false; break; + case slsDetectorDefs::MYTHEN: + isOriginallyOneD = true; + chkPedestal->setEnabled(false); + btnRecalPedestal->setEnabled(false); + layoutThreshold->setEnabled(false); + chkPedestal_2->setEnabled(false); + btnRecalPedestal_2->setEnabled(false); + chkBinary->setEnabled(false); + chkBinary_2->setEnabled(false); + break; + case slsDetectorDefs::EIGER: + isOriginallyOneD = false; + chkPedestal->setEnabled(false); + btnRecalPedestal->setEnabled(false); + layoutThreshold->setEnabled(false); + chkPedestal_2->setEnabled(false); + btnRecalPedestal_2->setEnabled(false); + chkBinary->setEnabled(false); + chkBinary_2->setEnabled(false); + break; + case slsDetectorDefs::GOTTHARD: + isOriginallyOneD = true; + break; + case slsDetectorDefs::MOENCH: + isOriginallyOneD = false; + break; default: cout << "ERROR: Detector Type is Generic" << endl; exit(-1); @@ -158,17 +182,6 @@ void qTabPlot::SetupWidgetWindow(){ //to check if this should be enabled EnableScanBox(); - stackedWidget->setCurrentIndex(0); - stackedWidget_2->setCurrentIndex(0); - if(myDet->getDetectorsType()!=slsDetectorDefs::GOTTHARD){ - btnCalPedestal->setEnabled(false); - btnResetPedestal->setEnabled(false); - } - if(myDet->getDetectorsType()!=slsDetectorDefs::MOENCH){ - btnCalPedestal_2->setEnabled(false); - btnResetPedestal_2->setEnabled(false); - } - qDefs::checkErrorMessage(myDet); } @@ -176,36 +189,44 @@ void qTabPlot::SetupWidgetWindow(){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void qTabPlot::Set2DPage(){ - //QPushButton *clickedButton = qobject_cast(sender()); - if(stackedWidget_2->currentIndex()==0){ - stackedWidget_2->setCurrentIndex(1); - box2D->setTitle("2D Plot Options 2"); +void qTabPlot::SetPlotOptionsRightPage(){ + if(isOneD){ + int i = stackedWidget->currentIndex(); + if(i == (stackedWidget->count()-1)) + stackedWidget->setCurrentIndex(0); + else + stackedWidget->setCurrentIndex(i+1); + box1D->setTitle(QString("1D Plot Options %1").arg(stackedWidget->currentIndex()+1)); } else{ - stackedWidget_2->setCurrentIndex(0); - box2D->setTitle("2D Plot Options 1"); + int i = stackedWidget_2->currentIndex(); + if(i == (stackedWidget_2->count()-1)) + stackedWidget_2->setCurrentIndex(0); + else + stackedWidget_2->setCurrentIndex(i+1); + box2D->setTitle(QString("2D Plot Options %1").arg(stackedWidget_2->currentIndex()+1)); } } - //------------------------------------------------------------------------------------------------------------------------------------------------- -void qTabPlot::Set1DPage(){ - //QPushButton *clickedButton = qobject_cast(sender()); - if(stackedWidget->currentIndex()==0){ - //if(clickedButton->icon().pixmap(QSize(16,16)).toImage()==btnLeft->icon().pixmap(QSize(16,16)).toImage()) - stackedWidget->setCurrentIndex(1); - box1D->setTitle("1D Plot Options 2"); - } - else if(stackedWidget->currentIndex()==1){ - stackedWidget->setCurrentIndex(2); - box1D->setTitle("1D Plot Options 3"); +void qTabPlot::SetPlotOptionsLeftPage(){ + if(isOneD){ + int i = stackedWidget->currentIndex(); + if(i == 0) + stackedWidget->setCurrentIndex(stackedWidget->count()-1); + else + stackedWidget->setCurrentIndex(i-1); + box1D->setTitle(QString("1D Plot Options %1").arg(stackedWidget->currentIndex()+1)); } else{ - stackedWidget->setCurrentIndex(0); - box1D->setTitle("1D Plot Options 1"); + int i = stackedWidget_2->currentIndex(); + if(i == 0) + stackedWidget_2->setCurrentIndex(stackedWidget_2->count()-1); + else + stackedWidget_2->setCurrentIndex(i-1); + box2D->setTitle(QString("2D Plot Options %1").arg(stackedWidget_2->currentIndex()+1)); } } @@ -215,6 +236,14 @@ void qTabPlot::Set1DPage(){ void qTabPlot::Select1DPlot(bool b){ isOneD = b; + lblFrom->setEnabled(false); + lblTo->setEnabled(false); + lblFrom_2->setEnabled(false); + lblTo_2->setEnabled(false); + spinFrom->setEnabled(false); + spinFrom_2->setEnabled(false); + spinTo->setEnabled(false); + spinTo_2->setEnabled(false); if(b){ box1D->show(); box2D->hide(); @@ -247,22 +276,20 @@ void qTabPlot::Initialization(){ connect(btnCloseClones, SIGNAL(clicked()),myPlot, SLOT(CloseClones())); connect(btnSaveClones, SIGNAL(clicked()),myPlot, SLOT(SaveClones())); // 1D Plot box + //to change pages + connect(btnRight, SIGNAL(clicked()), this, SLOT(SetPlotOptionsRightPage())); + connect(btnLeft, SIGNAL(clicked()), this, SLOT(SetPlotOptionsLeftPage())); + connect(chkSuperimpose, SIGNAL(toggled(bool)), this, SLOT(EnablePersistency(bool))); connect(spinPersistency,SIGNAL(valueChanged(int)), myPlot,SLOT(SetPersistency(int))); connect(chkPoints, SIGNAL(toggled(bool)), myPlot, SLOT(SetMarkers(bool))); connect(chkLines, SIGNAL(toggled(bool)), myPlot, SLOT(SetLines(bool))); connect(chk1DLog, SIGNAL(toggled(bool)), myPlot, SIGNAL(LogySignal(bool))); - //to change pages - connect(btnRight, SIGNAL(clicked()), this, SLOT(Set1DPage())); - connect(btnRight2, SIGNAL(clicked()), this, SLOT(Set1DPage())); - connect(btnRight3, SIGNAL(clicked()), this, SLOT(Set1DPage())); + // 2D Plot box connect(chkInterpolate, SIGNAL(toggled(bool)),myPlot, SIGNAL(InterpolateSignal(bool))); connect(chkContour, SIGNAL(toggled(bool)),myPlot, SIGNAL(ContourSignal(bool))); connect(chkLogz, SIGNAL(toggled(bool)),myPlot, SIGNAL(LogzSignal(bool))); - //to change pages - connect(btn2DRight, SIGNAL(clicked()), this, SLOT(Set2DPage())); - connect(btn2DRight2, SIGNAL(clicked()), this, SLOT(Set2DPage())); // Plotting frequency box connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency())); connect(comboTimeGapUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency())); @@ -299,11 +326,24 @@ void qTabPlot::Initialization(){ connect(this,SIGNAL(SetZRangeSignal(double,double)),myPlot, SIGNAL(SetZRangeSignal(double,double))); //pedstal - connect(btnResetPedestal, SIGNAL(clicked()),myPlot, SLOT(ResetPedestal())); - connect(btnCalPedestal, SIGNAL(clicked()),myPlot, SLOT(CalculatePedestal())); - connect(btnResetPedestal_2, SIGNAL(clicked()),myPlot, SLOT(ResetPedestal())); - connect(btnCalPedestal_2, SIGNAL(clicked()),myPlot, SLOT(CalculatePedestal())); + connect(chkPedestal, SIGNAL(toggled(bool)), myPlot, SLOT(SetPedestal(bool))); + connect(btnRecalPedestal, SIGNAL(clicked()), myPlot, SLOT(RecalculatePedestal())); + connect(chkPedestal_2, SIGNAL(toggled(bool)), myPlot, SLOT(SetPedestal(bool))); + connect(btnRecalPedestal_2, SIGNAL(clicked()), myPlot, SLOT(RecalculatePedestal())); +//accumulate + connect(chkAccumulate, SIGNAL(toggled(bool)), myPlot, SLOT(SetAccumulate(bool))); + connect(btnResetAccumulate, SIGNAL(clicked()), myPlot, SLOT(ResetAccumulate())); + connect(chkAccumulate_2, SIGNAL(toggled(bool)), myPlot, SLOT(SetAccumulate(bool))); + connect(btnResetAccumulate_2, SIGNAL(clicked()), myPlot, SLOT(ResetAccumulate())); + + //binary + connect(chkBinary, SIGNAL(toggled(bool)), this, SLOT(SetBinary())); + connect(chkBinary_2, SIGNAL(toggled(bool)), this, SLOT(SetBinary())); + connect(spinFrom, SIGNAL(valueChanged(int)), this, SLOT(SetBinary())); + connect(spinFrom_2, SIGNAL(valueChanged(int)), this, SLOT(SetBinary())); + connect(spinTo, SIGNAL(valueChanged(int)), this, SLOT(SetBinary())); + connect(spinTo_2, SIGNAL(valueChanged(int)), this, SLOT(SetBinary())); } @@ -906,4 +946,57 @@ void qTabPlot::UpdateAfterCloning(){ } +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabPlot::SetBinary(){ + //1d + if(isOneD){ + if(chkBinary->isChecked()){ +#ifdef VERBOSE + cout << endl << "Enabling Binary" << endl; +#endif + lblFrom->setEnabled(true); + lblTo->setEnabled(true); + spinFrom->setEnabled(true); + spinTo->setEnabled(true); + myPlot->SetBinary(true,spinFrom->value(),spinTo->value()); + }else{ +#ifdef VERBOSE + cout << endl << "Disabling Binary" << endl; +#endif + lblFrom->setEnabled(false); + lblTo->setEnabled(false); + spinFrom->setEnabled(false); + spinTo->setEnabled(false); + myPlot->SetBinary(false); + } + } + //2d + else{ + if(chkBinary_2->isChecked()){ +#ifdef VERBOSE + cout << endl << "Enabling Binary" << endl; +#endif + lblFrom_2->setEnabled(true); + lblTo_2->setEnabled(true); + spinFrom_2->setEnabled(true); + spinTo_2->setEnabled(true); + myPlot->SetBinary(true,spinFrom_2->value(),spinTo_2->value()); + + }else{ +#ifdef VERBOSE + cout << endl << "Disabling Binary" << endl; +#endif + + lblFrom_2->setEnabled(false); + lblTo_2->setEnabled(false); + spinFrom_2->setEnabled(false); + spinTo_2->setEnabled(false); + myPlot->SetBinary(false); + } + } +} + + //------------------------------------------------------------------------------------------------------------------------------------------------- From b6145510ad0c1a059fdb0ccbd0e4133dc610b748 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 19 Jul 2013 10:10:11 +0000 Subject: [PATCH 205/332] refresh output dir requires output dir to be set to really check if it exists git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@205 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qTabDataOutput.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index 097859ddd..bc8615ff1 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -548,6 +548,8 @@ void qTabDataOutput::Refresh(){ lblOutputDir->setToolTip(outDirTip); dispOutputDir->setToolTip(outDirTip); btnOutputBrowse->setToolTip(outDirTip); + //making sure it is set + setOutputDir(); //flat field correction from server #ifdef VERBOSE From 6ea6f4482402bb3a707ea123d61ff8c0e7472a3b Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 23 Jul 2013 08:39:15 +0000 Subject: [PATCH 206/332] verifying output directory works for receiver based detectors.. before acquisition git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@206 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_dataoutput.ui | 252 +++++++++++++++----- slsDetectorGui/include/qDetectorMain.h | 5 +- slsDetectorGui/include/qTabDataOutput.h | 20 +- slsDetectorGui/include/qTabMeasurement.h | 5 +- slsDetectorGui/src/qTabDataOutput.cpp | 252 ++++++++++++++++++-- slsDetectorGui/src/qTabMeasurement.cpp | 14 +- 6 files changed, 457 insertions(+), 91 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_dataoutput.ui b/slsDetectorGui/forms/form_tab_dataoutput.ui index 3d56a55f3..50b838b2c 100644 --- a/slsDetectorGui/forms/form_tab_dataoutput.ui +++ b/slsDetectorGui/forms/form_tab_dataoutput.ui @@ -35,9 +35,9 @@ 20 - 110 + 160 731 - 206 + 166 @@ -47,12 +47,15 @@ 15 - 20 + 25 701 - 176 + 126 + + 3 + @@ -85,6 +88,9 @@ false + + Qt::ClickFocus + Flat field corrections. #flatfield# filename @@ -270,93 +276,217 @@ - + - 19 - 20 - 746 - 41 + 20 + 25 + 731 + 116 - - QFrame::NoFrame + + <nobr> +Directory where one saves the data. +</nobr><br> + #outdir# +<br> + - - QFrame::Plain + + Output Directory - + - 10 - 6 - 706 - 28 + 5 + 10 + 721 + 96 - - - -1 + + <nobr> +Directory where one saves the data. +</nobr><br> + #outdir# +<br> + + + + QFrame::NoFrame + + + QFrame::Plain + + + + + 10 + 10 + 701 + 86 + - - - - - 0 - 0 - - - - <nobr> + + + 4 + + + + + <nobr> Directory where one saves the data. </nobr><br> #outdir# <br> - - - Output Directory : - - - - - - - <nobr> + + + Browse + + + + :/icons/images/browse.png:/icons/images/browse.png + + + + + + + Qt::NoFocus + + + <nobr> Directory where one saves the data. </nobr><br> #outdir# <br> - - - - - - - <nobr> + + + false + + + QLineEdit::Normal + + + true + + + + + + + Qt::StrongFocus + + + <nobr> Directory where one saves the data. </nobr><br> #outdir# <br> - - - Browse - - - - :/icons/images/browse.png:/icons/images/browse.png - - - - + + + + + + + + 0 + 0 + + + + + + + + + 2 + 2 + 2 + + + + + + + + + 0 + 0 + 0 + + + + + + + + + 119 + 119 + 119 + + + + + + + + <nobr> +Directory where one saves the data. +</nobr><br> + #outdir# +<br> + + + + Readout: + + + + + + + + 0 + 0 + + + + + 180 + 0 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + - dispOutputDir - btnOutputBrowse + dispReadOutputDir chkFlatField dispFlatField btnFlatField diff --git a/slsDetectorGui/include/qDetectorMain.h b/slsDetectorGui/include/qDetectorMain.h index 181ab9cde..8833836f4 100644 --- a/slsDetectorGui/include/qDetectorMain.h +++ b/slsDetectorGui/include/qDetectorMain.h @@ -14,7 +14,7 @@ /** Qt Project Class Headers */ #include "qDrawPlot.h" #include "qTabMeasurement.h" -class qTabDataOutput; +#include "qTabDataOutput.h" class qTabPlot; class qTabActions; class qTabAdvanced; @@ -80,6 +80,9 @@ public: /** Returns file path */ QString GetFilePath(){QString s = QString(myDet->getFilePath().c_str());qDefs::checkErrorMessage(myDet); return s;}; + /** Verifies if output directories for all the receivers exist */ + int DoesOutputDirExist(){return tab_dataoutput->VerifyOutputDirectory();}; + private: /** The Qt Application */ QApplication *theApp; diff --git a/slsDetectorGui/include/qTabDataOutput.h b/slsDetectorGui/include/qTabDataOutput.h index 437afce4f..57aaaad88 100644 --- a/slsDetectorGui/include/qTabDataOutput.h +++ b/slsDetectorGui/include/qTabDataOutput.h @@ -40,6 +40,10 @@ public: */ void Refresh(); + /** verify output directories + * /returns success or fail + */ + int VerifyOutputDirectory(); private: @@ -53,6 +57,9 @@ private: QString errFlatFieldTip; QString outDirTip; QPalette red; + QPalette black; + QPalette *red1; + QPalette *black1; /** methods */ /** Sets up the widget */ @@ -61,11 +68,12 @@ private: /** Sets up all the slots and signals */ void Initialization(); + /** Populate the readouts + */ + void PopulateDetectors(); + private slots: -/** Sets the output directory - */ -void setOutputDir(); /** Open dialog to choose the output directory */ void browseOutputDir(); @@ -91,6 +99,12 @@ void SetAngularCorrection(); /**discard bad channels*/ void DiscardBadChannels(); +/** set output directory*/ +void SetOutputDir(); + +/** set output directory*/ +void GetOutputDir(); + signals: /**signal to enable/disable positions in Actions*/ void AngularConversionSignal(bool); diff --git a/slsDetectorGui/include/qTabMeasurement.h b/slsDetectorGui/include/qTabMeasurement.h index fc6a0c375..4788fbb5d 100644 --- a/slsDetectorGui/include/qTabMeasurement.h +++ b/slsDetectorGui/include/qTabMeasurement.h @@ -16,6 +16,7 @@ class multiSlsDetector; /** Qt Project Class Headers */ #include "qDrawPlot.h" +class qDetectorMain; /** *@short sets up the measurement parameters @@ -33,7 +34,7 @@ public: * @param detector is the detector returned from the detector tab * @param plot plot object reference */ - qTabMeasurement(QWidget *parent,multiSlsDetector*& detector, qDrawPlot*& plot); + qTabMeasurement(qDetectorMain *parent,multiSlsDetector*& detector, qDrawPlot*& plot); /** Destructor */ @@ -167,6 +168,8 @@ private slots: private: + /** parent widget */ + qDetectorMain *thisParent; /** The sls detector object */ multiSlsDetector *myDet; /** The Plot widget */ diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index bc8615ff1..2586c92c9 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -57,23 +57,28 @@ void qTabDataOutput::SetupWidgetWindow(){ /** error message **/ red = QPalette(); red.setColor(QPalette::Active,QPalette::WindowText,Qt::red); + black = QPalette(); + black.setColor(QPalette::Active,QPalette::WindowText,Qt::black); + + red1 = new QPalette(); + red1->setColor(QPalette::Text,Qt::red); + black1 = new QPalette(); + black1->setColor(QPalette::Text,Qt::black); + flatFieldTip = dispFlatField->toolTip(); errFlatFieldTip = QString("Flat field corrections.
" " #flatfield# filename

")+ QString("" "Enter a valid file to enable Flat Field."); + outDirTip = boxOutDir->toolTip(); + - outDirTip = dispOutputDir->toolTip(); Initialization(); - - // output dir -#ifdef VERBOSE - cout << "Getting output directory" << endl; -#endif - dispOutputDir->setText(QString(myDet->getFilePath().c_str())); - + disconnect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(GetOutputDir())); + PopulateDetectors(); + connect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(GetOutputDir())); //flat field correction from server #ifdef VERBOSE @@ -131,7 +136,10 @@ void qTabDataOutput::SetupWidgetWindow(){ void qTabDataOutput::Initialization(){ //output dir - connect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(setOutputDir())); + connect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(GetOutputDir())); + connect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(SetOutputDir())); + + connect(btnOutputBrowse, SIGNAL(clicked()), this, SLOT(browseOutputDir())); //flat field correction connect(chkFlatField, SIGNAL(toggled(bool)), this, SLOT(SetFlatField())); @@ -149,7 +157,7 @@ void qTabDataOutput::Initialization(){ } //------------------------------------------------------------------------------------------------------------------------------------------------- - +/* void qTabDataOutput::setOutputDir(){ disconnect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(setOutputDir())); @@ -199,9 +207,6 @@ void qTabDataOutput::setOutputDir(){ break; } } - /* myDet->setFilePath(string(path.toAscii().constData())); - if(myDet->getFilePath()!=(string(path.toAscii().constData()))) - error=true;*/ } if(!error){ @@ -233,7 +238,7 @@ void qTabDataOutput::setOutputDir(){ qDefs::checkErrorMessage(myDet); } - +*/ //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -242,7 +247,7 @@ void qTabDataOutput::browseOutputDir() QString directory = QFileDialog::getExistingDirectory(this,tr("Choose Output Directory "),dispOutputDir->text()); if (!directory.isEmpty()) dispOutputDir->setText(directory); - setOutputDir(); + SetOutputDir(); } @@ -542,14 +547,10 @@ void qTabDataOutput::Refresh(){ #ifdef VERBOSE cout << "Getting output directory" << endl; #endif - dispOutputDir->setText(QString(myDet->getFilePath().c_str())); - lblOutputDir->setText("Output Directory: "); - lblOutputDir->setPalette(chkRate->palette()); - lblOutputDir->setToolTip(outDirTip); - dispOutputDir->setToolTip(outDirTip); - btnOutputBrowse->setToolTip(outDirTip); - //making sure it is set - setOutputDir(); + disconnect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(GetOutputDir())); + PopulateDetectors(); + connect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(GetOutputDir())); + //flat field correction from server #ifdef VERBOSE @@ -611,3 +612,208 @@ void qTabDataOutput::Refresh(){ //------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabDataOutput::PopulateDetectors(){ +#ifdef VERBOSE + cout << "Populating detectors" << endl; +#endif + comboDetector->clear(); + if(myDet->setReceiverOnline() == slsDetectorDefs::OFFLINE_FLAG){ + boxOutDir->setTitle("Output Directory"); + comboDetector->addItem("All"); + } + + //if receiver, add detectors + else{ + boxOutDir->setTitle("Receiver Output Directory"); + for(int i=0;igetNumberOfDetectors();i++) + comboDetector->addItem(QString(myDet->getHostname(i).c_str())); + } + GetOutputDir(); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabDataOutput::GetOutputDir(){ +#ifdef VERBOSE + cout << "Getting output directory" << endl; +#endif + + if(!comboDetector->itemText(0).compare("All")){ + dispReadOutputDir->setText(QString(myDet->getFilePath().c_str())); + }else{ + slsDetector *det = myDet->getSlsDetector(comboDetector->currentIndex()); + qDefs::checkErrorMessage(myDet); + dispReadOutputDir->setText(QString(det->getFilePath().c_str())); + } + + + VerifyOutputDirectory(); + + //clear field to write + disconnect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(SetOutputDir())); + dispOutputDir->setText(""); + dispOutputDir->setPalette(*black1); + connect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(SetOutputDir())); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +int qTabDataOutput::VerifyOutputDirectory(){ +#ifdef VERBOSE + cout << "Verifying output directory" << endl; +#endif + bool error = false; + QString path = ""; + QString errTip = outDirTip; + QString detName = ""; + + path = dispReadOutputDir->text(); + + //no receiver + if(!comboDetector->itemText(0).compare("All")){ + if(myDet->setFilePath(string(path.toAscii().constData())).empty()){ + qDefs::Message(qDefs::WARNING,string("Enter a valid output directory"),"Data Output"); + error = true; + dispReadOutputDir->setText(QString(myDet->getFilePath().c_str())); + boxOutDir->setTitle("Receiver Output Directory*"); + }else if(!qDefs::checkErrorMessage(myDet).empty()){ + error = true; + dispReadOutputDir->setText(QString(myDet->getFilePath().c_str())); + dispReadOutputDir->setPalette(*red1); + boxOutDir->setPalette(red); + boxOutDir->setTitle("Output Directory*"); + errTip = outDirTip + + QString("" + "Enter a valid path to change Output Directory."); + boxOutDir->setToolTip(errTip); + } + } + + //receiver + else{ + for(int i=0;igetNumberOfDetectors();i++){ + detName = comboDetector->itemText(i); + slsDetector *det = myDet->getSlsDetector(i); + qDefs::checkErrorMessage(myDet); + if(det->setFilePath(det->getFilePath()).empty()){ + qDefs::Message(qDefs::WARNING,string("Enter a valid output directory for ") + + string(detName.toAscii().constData()) + string(" readout"),"Data Output"); + error = true; + dispReadOutputDir->setText(QString(det->getFilePath().c_str())); + boxOutDir->setTitle("Receiver Output Directory*"); + }else if(!qDefs::checkErrorMessage(det).empty()){ + error = true; + dispReadOutputDir->setText(QString(det->getFilePath().c_str())); + boxOutDir->setTitle("Receiver Output Directory*"); + } + } + } + + //if error, display in red + if(error){ +#ifdef VERBOSE + cout << "The output path doesnt exist anymore" << endl; +#endif + dispReadOutputDir->setPalette(*red1); + boxOutDir->setPalette(red); + errTip = errTip + + QString("
" + "Enter a valid path for ") + detName + + QString( " readout to change Output Directory."); + boxOutDir->setToolTip(errTip); + + return slsDetectorDefs::FAIL; + } + + //no error + else{ +#ifdef VERBOSE + cout << "The output path has been verified" << endl; +#endif + dispReadOutputDir->setPalette(*black1); + boxOutDir->setPalette(black); + if(!comboDetector->itemText(0).compare("All")) + boxOutDir->setTitle("Output Directory"); + else + boxOutDir->setTitle("Receiver Output Directory"); + boxOutDir->setToolTip(outDirTip); + } + + return slsDetectorDefs::OK; +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabDataOutput::SetOutputDir(){ + +#ifdef VERBOSE + cout << "Setting output directory" << endl; +#endif + + bool error = false; + QString path = dispOutputDir->text(); + + if(path.isEmpty()) + return; + + disconnect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(SetOutputDir())); + + //gets rid of the end '/'s + while(path.endsWith('/')) path.chop(1); + dispOutputDir->setText(path); + + if(!comboDetector->itemText(0).compare("All")){ + myDet->setFilePath(string(dispOutputDir->text().toAscii().constData())); + if(!qDefs::checkErrorMessage(myDet).empty()){ +#ifdef VERBOSE + cout << "The output path could not be set" << endl; +#endif + myDet->setFilePath(string(dispReadOutputDir->text().toAscii().constData())); + error = true; + dispOutputDir->setPalette(*red1); + } + } + + else{ + slsDetector *det = myDet->getSlsDetector(comboDetector->currentIndex()); + qDefs::checkErrorMessage(myDet); + det->setFilePath(string(dispOutputDir->text().toAscii().constData())); + if(!qDefs::checkErrorMessage(det).empty()){ +#ifdef VERBOSE + cout << "The output path could not be set" << endl; +#endif + det->setFilePath(string(dispReadOutputDir->text().toAscii().constData())); + error = true; + dispOutputDir->setPalette(*red1); + } + + cout<<"filepath:"<getFilePath()<setPalette(*black1); + dispReadOutputDir->setText(dispOutputDir->text()); + dispOutputDir->setText(""); + VerifyOutputDirectory(); + } + + connect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(SetOutputDir())); + +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 1a3b82dfc..c96d22398 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -7,6 +7,7 @@ //Qt Project Class Headers #include "qTabMeasurement.h" +#include "qDetectorMain.h" //Project Class Headers #include "slsDetector.h" #include "multiSlsDetector.h" @@ -23,8 +24,8 @@ using namespace std; //------------------------------------------------------------------------------------------------------------------------------------------------- -qTabMeasurement::qTabMeasurement(QWidget *parent,multiSlsDetector*& detector, qDrawPlot*& plot): - QWidget(parent),myDet(detector),myPlot(plot),expertMode(false){ +qTabMeasurement::qTabMeasurement(qDetectorMain *parent,multiSlsDetector*& detector, qDrawPlot*& plot): + thisParent(parent),myDet(detector),myPlot(plot),expertMode(false){ setupUi(this); SetupWidgetWindow(); Initialization(); @@ -38,6 +39,7 @@ qTabMeasurement::qTabMeasurement(QWidget *parent,multiSlsDetector*& detector, qD qTabMeasurement::~qTabMeasurement(){ delete myDet; delete myPlot; + delete thisParent; } @@ -308,6 +310,14 @@ void qTabMeasurement::setRunIndex(int index){ void qTabMeasurement::startStopAcquisition(){ if(btnStartStop->isChecked()){ + + if(thisParent->DoesOutputDirExist() == slsDetectorDefs::FAIL){ + disconnect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); + btnStartStop->click(); + connect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); + return; + } + #ifdef VERBOSE cout << endl << endl << "Starting Acquisition" << endl; #endif From 27a21cc2586c9d61818025fa8d6e56f00f7dacd6 Mon Sep 17 00:00:00 2001 From: l_msdetect Date: Wed, 24 Jul 2013 08:31:30 +0000 Subject: [PATCH 207/332] change outdir for non receivers in gui git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@207 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qTabDataOutput.cpp | 148 +++++++++++++++----------- 1 file changed, 85 insertions(+), 63 deletions(-) diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index 2586c92c9..6d6bbc3f0 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -669,83 +669,81 @@ int qTabDataOutput::VerifyOutputDirectory(){ cout << "Verifying output directory" << endl; #endif bool error = false; - QString path = ""; QString errTip = outDirTip; - QString detName = ""; + bool receiver = (!comboDetector->itemText(0).compare("All")); + string path = string(dispReadOutputDir->text().toAscii().constData()); + string detName = ""; - path = dispReadOutputDir->text(); - - //no receiver - if(!comboDetector->itemText(0).compare("All")){ - if(myDet->setFilePath(string(path.toAscii().constData())).empty()){ - qDefs::Message(qDefs::WARNING,string("Enter a valid output directory"),"Data Output"); - error = true; - dispReadOutputDir->setText(QString(myDet->getFilePath().c_str())); - boxOutDir->setTitle("Receiver Output Directory*"); - }else if(!qDefs::checkErrorMessage(myDet).empty()){ - error = true; - dispReadOutputDir->setText(QString(myDet->getFilePath().c_str())); - dispReadOutputDir->setPalette(*red1); - boxOutDir->setPalette(red); - boxOutDir->setTitle("Output Directory*"); - errTip = outDirTip + - QString("" - "Enter a valid path to change Output Directory."); - boxOutDir->setToolTip(errTip); + //for each detector + for(int i=0;igetNumberOfDetectors();i++){ + slsDetector *det = myDet->getSlsDetector(i); + qDefs::checkErrorMessage(myDet); + if(receiver){ + detName = string(" for ") + string(comboDetector->itemText(i).toAscii().constData()) + string(" readout"); + path = det->getFilePath(); } + + if(det->setFilePath(path).empty()){ + qDefs::Message(qDefs::WARNING,string("Enter a valid output directory ") + detName,"Data Output"); + error = true; + }else if(!qDefs::checkErrorMessage(det).empty()){ + error = true; + } + //verify all paths are the same for no receiver + if ((!receiver) && (path != det->getFilePath())){ + error = true; + qDefs::Message(qDefs::WARNING,string("Enter a valid output directory ") + detName,"Data Output"); + } + myDet->setFilePath(det->getFilePath()); } - //receiver - else{ - for(int i=0;igetNumberOfDetectors();i++){ - detName = comboDetector->itemText(i); - slsDetector *det = myDet->getSlsDetector(i); - qDefs::checkErrorMessage(myDet); - if(det->setFilePath(det->getFilePath()).empty()){ - qDefs::Message(qDefs::WARNING,string("Enter a valid output directory for ") + - string(detName.toAscii().constData()) + string(" readout"),"Data Output"); - error = true; - dispReadOutputDir->setText(QString(det->getFilePath().c_str())); - boxOutDir->setTitle("Receiver Output Directory*"); - }else if(!qDefs::checkErrorMessage(det).empty()){ - error = true; - dispReadOutputDir->setText(QString(det->getFilePath().c_str())); - boxOutDir->setTitle("Receiver Output Directory*"); - } - } - } + + //set the read output dir anyway + if(receiver) + path = myDet->getSlsDetector(comboDetector->currentIndex())->getFilePath(); + else + path = myDet->getFilePath(); + dispReadOutputDir->setText(QString(path.c_str())); + //if error, display in red if(error){ #ifdef VERBOSE - cout << "The output path doesnt exist anymore" << endl; + cout << "The output path doesnt exist anymore" << endl; #endif dispReadOutputDir->setPalette(*red1); boxOutDir->setPalette(red); errTip = errTip + QString("
" - "Enter a valid path for ") + detName + + "Enter a valid path for ") + QString(detName.c_str()) + QString( " readout to change Output Directory."); boxOutDir->setToolTip(errTip); + if(receiver) + boxOutDir->setTitle("Receiver Output Directory*"); + else + boxOutDir->setTitle("Output Directory*"); + return slsDetectorDefs::FAIL; } //no error else{ #ifdef VERBOSE - cout << "The output path has been verified" << endl; + cout << "The output path has been verified" << endl; #endif dispReadOutputDir->setPalette(*black1); boxOutDir->setPalette(black); - if(!comboDetector->itemText(0).compare("All")) - boxOutDir->setTitle("Output Directory"); - else - boxOutDir->setTitle("Receiver Output Directory"); boxOutDir->setToolTip(outDirTip); + + if(receiver) + boxOutDir->setTitle("Receiver Output Directory"); + else + boxOutDir->setTitle("Output Directory"); } return slsDetectorDefs::OK; + } @@ -759,6 +757,7 @@ void qTabDataOutput::SetOutputDir(){ #endif bool error = false; + bool receiver = (!comboDetector->itemText(0).compare("All")); QString path = dispOutputDir->text(); if(path.isEmpty()) @@ -766,42 +765,64 @@ void qTabDataOutput::SetOutputDir(){ disconnect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(SetOutputDir())); + //gets rid of the end '/'s while(path.endsWith('/')) path.chop(1); dispOutputDir->setText(path); - if(!comboDetector->itemText(0).compare("All")){ - myDet->setFilePath(string(dispOutputDir->text().toAscii().constData())); - if(!qDefs::checkErrorMessage(myDet).empty()){ + + if(receiver){ + slsDetector *det = myDet->getSlsDetector(comboDetector->currentIndex()); + qDefs::checkErrorMessage(myDet); + det->setFilePath(string(dispOutputDir->text().toAscii().constData())); + if(!qDefs::checkErrorMessage(det).empty()){ #ifdef VERBOSE - cout << "The output path could not be set" << endl; + cout << "The output path could not be set" << endl; #endif - myDet->setFilePath(string(dispReadOutputDir->text().toAscii().constData())); + det->setFilePath(string(dispReadOutputDir->text().toAscii().constData())); error = true; dispOutputDir->setPalette(*red1); } + myDet->setFilePath(det->getFilePath()); } + else{ - slsDetector *det = myDet->getSlsDetector(comboDetector->currentIndex()); + //for each detector + for(int i=0;igetNumberOfDetectors();i++){ + slsDetector *det = myDet->getSlsDetector(i); qDefs::checkErrorMessage(myDet); - det->setFilePath(string(dispOutputDir->text().toAscii().constData())); - if(!qDefs::checkErrorMessage(det).empty()){ -#ifdef VERBOSE - cout << "The output path could not be set" << endl; -#endif - det->setFilePath(string(dispReadOutputDir->text().toAscii().constData())); + if(det->setFilePath(string(path.toAscii().constData())).empty()){ + qDefs::Message(qDefs::WARNING,string("Enter a valid output directory "),"Data Output"); + error = true; + }else if(!qDefs::checkErrorMessage(det).empty()){ error = true; - dispOutputDir->setPalette(*red1); } + myDet->setFilePath(det->getFilePath()); + } - cout<<"filepath:"<getFilePath()<getNumberOfDetectors();i++){ + slsDetector *det = myDet->getSlsDetector(i); + qDefs::checkErrorMessage(myDet); + det->setFilePath(string(dispReadOutputDir->text().toAscii().constData())); + } + } + dispReadOutputDir->setText(QString(myDet->getFilePath().c_str())); } - if(!error){ + + if(error){ #ifdef VERBOSE - cout << "The output path has been modified" << endl; + cout << "The output path could not be set" << endl; +#endif + dispOutputDir->setPalette(*red1); + } + else{ +#ifdef VERBOSE + cout << "The output path has been modified" << endl; #endif dispOutputDir->setPalette(*black1); dispReadOutputDir->setText(dispOutputDir->text()); @@ -809,6 +830,7 @@ void qTabDataOutput::SetOutputDir(){ VerifyOutputDirectory(); } + connect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(SetOutputDir())); } From 68f360e3955427c6f8b795b7c46e9af8b1fd86c8 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 24 Jul 2013 09:38:55 +0000 Subject: [PATCH 208/332] change outdir for all receivers in gui git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@208 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qDefs.h | 6 +++-- slsDetectorGui/src/qTabDataOutput.cpp | 32 ++++++++++++++++++--------- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/slsDetectorGui/include/qDefs.h b/slsDetectorGui/include/qDefs.h index 448fd11b6..e843d037c 100644 --- a/slsDetectorGui/include/qDefs.h +++ b/slsDetectorGui/include/qDefs.h @@ -218,9 +218,10 @@ static const int64_t GUI_VERSION=0x20121213; /**gets error mask and displays the message if it exists * @param myDet is the slsdetector object + * @param show to display the error message /returns error message else an empty string * */ - static string checkErrorMessage(slsDetector*& myDet){ + static string checkErrorMessage(slsDetector*& myDet,bool show = true){ int errorLevel= (int)WARNING; @@ -244,7 +245,8 @@ static const int64_t GUI_VERSION=0x20121213; retval.append("
"); //display message - qDefs::Message((MessageIndex)errorLevel,retval,"Main"); + if(show) + qDefs::Message((MessageIndex)errorLevel,retval,"Main"); } myDet->clearErrorMask(); diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index 6d6bbc3f0..d3fe18575 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -670,30 +670,33 @@ int qTabDataOutput::VerifyOutputDirectory(){ #endif bool error = false; QString errTip = outDirTip; - bool receiver = (!comboDetector->itemText(0).compare("All")); + bool receiver = (comboDetector->itemText(0).compare("All")); string path = string(dispReadOutputDir->text().toAscii().constData()); string detName = ""; + string mess = ""; //for each detector for(int i=0;igetNumberOfDetectors();i++){ slsDetector *det = myDet->getSlsDetector(i); qDefs::checkErrorMessage(myDet); if(receiver){ - detName = string(" for ") + string(comboDetector->itemText(i).toAscii().constData()) + string(" readout"); + detName = string("\n - ") + string(comboDetector->itemText(i).toAscii().constData()) ; path = det->getFilePath(); } if(det->setFilePath(path).empty()){ - qDefs::Message(qDefs::WARNING,string("Enter a valid output directory ") + detName,"Data Output"); + mess. append(detName); error = true; - }else if(!qDefs::checkErrorMessage(det).empty()){ + }else if(!qDefs::checkErrorMessage(det,false).empty()){ + mess. append(detName); error = true; } + /* //verify all paths are the same for no receiver if ((!receiver) && (path != det->getFilePath())){ error = true; - qDefs::Message(qDefs::WARNING,string("Enter a valid output directory ") + detName,"Data Output"); - } + qDefs::Message(qDefs::WARNING,string("Enter a valid output directory ") + detName,"Data Output Verify"); + }*/ myDet->setFilePath(det->getFilePath()); } @@ -711,12 +714,19 @@ int qTabDataOutput::VerifyOutputDirectory(){ #ifdef VERBOSE cout << "The output path doesnt exist anymore" << endl; #endif + //replace all \n with
+ pos = 0; + while((pos = mess.find("\n", pos)) != string::npos){ + mess.replace(pos, 1, "
"); + pos += 1; + } + qDefs::Message(qDefs::WARNING,string("Invalid Output Directory ")+ mess,"Data Output"); dispReadOutputDir->setPalette(*red1); boxOutDir->setPalette(red); errTip = errTip + QString("
" - "Enter a valid path for ") + QString(detName.c_str()) + - QString( " readout to change Output Directory."); + "Invalid Output Directory") + QString(mess.c_str()) + + QString( ".
"); boxOutDir->setToolTip(errTip); if(receiver) @@ -757,7 +767,7 @@ void qTabDataOutput::SetOutputDir(){ #endif bool error = false; - bool receiver = (!comboDetector->itemText(0).compare("All")); + bool receiver = (comboDetector->itemText(0).compare("All")); QString path = dispOutputDir->text(); if(path.isEmpty()) @@ -793,9 +803,8 @@ void qTabDataOutput::SetOutputDir(){ slsDetector *det = myDet->getSlsDetector(i); qDefs::checkErrorMessage(myDet); if(det->setFilePath(string(path.toAscii().constData())).empty()){ - qDefs::Message(qDefs::WARNING,string("Enter a valid output directory "),"Data Output"); error = true; - }else if(!qDefs::checkErrorMessage(det).empty()){ + }else if(!qDefs::checkErrorMessage(det,false).empty()){ error = true; } myDet->setFilePath(det->getFilePath()); @@ -803,6 +812,7 @@ void qTabDataOutput::SetOutputDir(){ if(error){ + qDefs::Message(qDefs::WARNING,string("Invalid output directory "),"Data Output set"); for(int i=0;igetNumberOfDetectors();i++){ slsDetector *det = myDet->getSlsDetector(i); qDefs::checkErrorMessage(myDet); From 77aec59da96a16a63cdfd6ab605012357a2e19f6 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 24 Jul 2013 09:39:30 +0000 Subject: [PATCH 209/332] change outdir for all receivers in gui git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@209 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qTabDataOutput.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index d3fe18575..f10546f9e 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -715,7 +715,7 @@ int qTabDataOutput::VerifyOutputDirectory(){ cout << "The output path doesnt exist anymore" << endl; #endif //replace all \n with
- pos = 0; + size_t pos = 0; while((pos = mess.find("\n", pos)) != string::npos){ mess.replace(pos, 1, "
"); pos += 1; From 57e801e5ea65ec1f95e91418a584da689f5211d0 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 24 Jul 2013 09:43:09 +0000 Subject: [PATCH 210/332] change outdir for all receivers in gui git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@210 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qTabDataOutput.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index f10546f9e..d50ec11b9 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -720,6 +720,9 @@ int qTabDataOutput::VerifyOutputDirectory(){ mess.replace(pos, 1, "
"); pos += 1; } + mess.insert(0,""); + mess.append(""); + qDefs::Message(qDefs::WARNING,string("Invalid Output Directory ")+ mess,"Data Output"); dispReadOutputDir->setPalette(*red1); boxOutDir->setPalette(red); From 676fe91e57c080e6f651760d58d81130099d0c4a Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 24 Jul 2013 13:17:47 +0000 Subject: [PATCH 211/332] change outdir for all receivers in gui git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@211 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qTabDataOutput.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index d50ec11b9..37f7b93e3 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -714,18 +714,16 @@ int qTabDataOutput::VerifyOutputDirectory(){ #ifdef VERBOSE cout << "The output path doesnt exist anymore" << endl; #endif + qDefs::Message(qDefs::WARNING,string("Invalid Output Directory ")+ mess ,"Data Output"); + dispReadOutputDir->setPalette(*red1); + boxOutDir->setPalette(red); + //replace all \n with
size_t pos = 0; while((pos = mess.find("\n", pos)) != string::npos){ mess.replace(pos, 1, "
"); pos += 1; } - mess.insert(0,""); - mess.append(""); - - qDefs::Message(qDefs::WARNING,string("Invalid Output Directory ")+ mess,"Data Output"); - dispReadOutputDir->setPalette(*red1); - boxOutDir->setPalette(red); errTip = errTip + QString("
" "Invalid Output Directory") + QString(mess.c_str()) + From 16b8bb967c377fe4380c47e34d0b298a657c8ec3 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Thu, 25 Jul 2013 09:23:38 +0000 Subject: [PATCH 212/332] proceed anyway if outdir doesnt exist implmented in gui git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@212 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qTabMeasurement.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index c96d22398..2527e8d2d 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -312,10 +312,20 @@ void qTabMeasurement::startStopAcquisition(){ if(btnStartStop->isChecked()){ if(thisParent->DoesOutputDirExist() == slsDetectorDefs::FAIL){ - disconnect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); - btnStartStop->click(); - connect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); - return; + if(qDefs::Message(qDefs::QUESTION, + "Your data will not be saved. Proceed with acquisition anyway?", + "Measurement") == slsDetectorDefs::FAIL){ + disconnect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); + btnStartStop->click(); + connect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); + return; + }else{ + //done because for receiver it cant save a file with blank file path and returns without acquiring even to the gui + disconnect(chkFile, SIGNAL(toggled(bool)), this, SLOT(EnableFileWrite(bool))); + chkFile->setChecked(false); + EnableFileWrite(false); + connect(chkFile, SIGNAL(toggled(bool)), this, SLOT(EnableFileWrite(bool))); + } } #ifdef VERBOSE From 9cdbd7447149d161d5451872608b32d8fd9eb932 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 30 Jul 2013 14:50:01 +0000 Subject: [PATCH 213/332] changed the start and stop receiver error messages to be displayed to the client and not jsus recever git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@213 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qDefs.h | 8 +- slsDetectorGui/src/qActionsWidget.cpp | 18 ++-- slsDetectorGui/src/qCloneWidget.cpp | 4 +- slsDetectorGui/src/qDetectorMain.cpp | 104 ++++++++++---------- slsDetectorGui/src/qDrawPlot.cpp | 28 +++--- slsDetectorGui/src/qScanWidget.cpp | 56 +++++------ slsDetectorGui/src/qServer.cpp | 8 +- slsDetectorGui/src/qTabActions.cpp | 12 +-- slsDetectorGui/src/qTabAdvanced.cpp | 54 +++++------ slsDetectorGui/src/qTabDataOutput.cpp | 129 +++++-------------------- slsDetectorGui/src/qTabDebugging.cpp | 36 +++---- slsDetectorGui/src/qTabDeveloper.cpp | 22 ++--- slsDetectorGui/src/qTabMeasurement.cpp | 53 +++++----- slsDetectorGui/src/qTabMessages.cpp | 4 +- slsDetectorGui/src/qTabPlot.cpp | 16 +-- slsDetectorGui/src/qTabSettings.cpp | 26 ++--- 16 files changed, 248 insertions(+), 330 deletions(-) diff --git a/slsDetectorGui/include/qDefs.h b/slsDetectorGui/include/qDefs.h index e843d037c..40abeb58b 100644 --- a/slsDetectorGui/include/qDefs.h +++ b/slsDetectorGui/include/qDefs.h @@ -183,7 +183,7 @@ static const int64_t GUI_VERSION=0x20121213; * @param myDet is the multidetector object /returns error message else an empty string * */ - static string checkErrorMessage(multiSlsDetector*& myDet){ + static string checkErrorMessage(multiSlsDetector*& myDet, string title = "Main"){ int errorLevel= (int)WARNING; @@ -206,7 +206,7 @@ static const int64_t GUI_VERSION=0x20121213; retval.append(""); //display message - qDefs::Message((MessageIndex)errorLevel,retval,"Main"); + qDefs::Message((MessageIndex)errorLevel,retval,title); } myDet->clearAllErrorMask(); @@ -221,7 +221,7 @@ static const int64_t GUI_VERSION=0x20121213; * @param show to display the error message /returns error message else an empty string * */ - static string checkErrorMessage(slsDetector*& myDet,bool show = true){ + static string checkErrorMessage(slsDetector*& myDet, string title = "Main", bool show = true){ int errorLevel= (int)WARNING; @@ -246,7 +246,7 @@ static const int64_t GUI_VERSION=0x20121213; //display message if(show) - qDefs::Message((MessageIndex)errorLevel,retval,"Main"); + qDefs::Message((MessageIndex)errorLevel,retval,title); } myDet->clearErrorMask(); diff --git a/slsDetectorGui/src/qActionsWidget.cpp b/slsDetectorGui/src/qActionsWidget.cpp index 6781128c1..f86fd795f 100644 --- a/slsDetectorGui/src/qActionsWidget.cpp +++ b/slsDetectorGui/src/qActionsWidget.cpp @@ -84,19 +84,19 @@ void qActionsWidget::SetMode(int mode){ if(!fName.isEmpty()){ //check if mode didnt get set if(mode!=myDet->getActionMode(id)){ - qDefs::Message(qDefs::WARNING,"The mode could not be changed.","ActionsWidget"); + qDefs::Message(qDefs::WARNING,"The mode could not be changed.","qActionsWidget::SetMode"); comboScript->setCurrentIndex(myDet->getActionMode(id)); }//if mode got set and its custom script else if(mode){ //when the file name did not get set correctly if(fName.compare(QString(myDet->getActionScript(id).c_str()))){ - qDefs::Message(qDefs::WARNING,"The file path could not be set.","ActionsWidget"); + qDefs::Message(qDefs::WARNING,"The file path could not be set.","qActionsWidget::SetMode"); dispScript->setText(QString(myDet->getActionScript(id).c_str())); SetScriptFile(); } } } - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qActionsWidget::SetMode"); } @@ -139,12 +139,12 @@ void qActionsWidget::SetScriptFile(){ else{ //path doesnt exist if(stat(fName.toAscii().constData(),&st_buf)){ - qDefs::Message(qDefs::WARNING,"The script file entered does not exist","ActionsWidget"); + qDefs::Message(qDefs::WARNING,"The script file entered does not exist","qActionsWidget::SetScriptFile"); dispScript->setText(QString(myDet->getActionScript(id).c_str())); } //if its not a file else if (!S_ISREG (st_buf.st_mode)) { - qDefs::Message(qDefs::WARNING,"The script file path entered is not a file","ActionsWidget"); + qDefs::Message(qDefs::WARNING,"The script file path entered is not a file","qActionsWidget::SetScriptFile"); dispScript->setText(QString(myDet->getActionScript(id).c_str())); } else @@ -159,7 +159,7 @@ void qActionsWidget::SetScriptFile(){ if(fName.compare(QString(myDet->getActionScript(id).c_str()))){ //did not get set, write what is was before if(!fName.isEmpty()) - qDefs::Message(qDefs::WARNING,"The script file could not be set. Reverting to previous file.","ActionsWidget"); + qDefs::Message(qDefs::WARNING,"The script file could not be set. Reverting to previous file.","qActionsWidget::SetScriptFile"); dispScript->setText(QString(myDet->getActionScript(id).c_str())); } } @@ -167,7 +167,7 @@ void qActionsWidget::SetScriptFile(){ //dont display if theres a none if(!dispScript->text().compare("none")) dispScript->setText(""); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qActionsWidget::SetScriptFile"); } @@ -184,7 +184,7 @@ void qActionsWidget::SetParameter(){ //dont display if theres a none if(!dispParameter->text().compare("none")) dispParameter->setText(""); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qActionsWidget::SetParameter"); } @@ -212,7 +212,7 @@ void qActionsWidget::Refresh(){ "parameter:" << parameter << "\t***" << endl; #endif - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qActionsWidget::Refresh"); } diff --git a/slsDetectorGui/src/qCloneWidget.cpp b/slsDetectorGui/src/qCloneWidget.cpp index 736b6052b..aabbb287e 100644 --- a/slsDetectorGui/src/qCloneWidget.cpp +++ b/slsDetectorGui/src/qCloneWidget.cpp @@ -232,10 +232,10 @@ void qCloneWidget::SavePlot(){ fName = QFileDialog::getSaveFileName(this,tr("Save Snapshot "),fName,tr("PNG Files (*.png);;XPM Files(*.xpm);;JPEG Files(*.jpg)"),0,QFileDialog::ShowDirsOnly); if (!fName.isEmpty()) if((img.save(fName))) - qDefs::Message(qDefs::INFORMATION,"The SnapShot has been successfully saved","Snapshot"); + qDefs::Message(qDefs::INFORMATION,"The SnapShot has been successfully saved","qCloneWidget::SavePlot"); else qDefs::Message(qDefs::WARNING,"Attempt to save snapshot failed.\n" - "Formats: .png, .jpg, .xpm.","Snapshot"); + "Formats: .png, .jpg, .xpm.","qCloneWidget::SavePlot"); } diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index daa1a2c68..1ebcf5ce7 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -201,30 +201,30 @@ void qDetectorMain::SetUpDetector(const string fName){ //gets the hostname if it worked string host = myDet->getHostname(); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qDetectorMain::SetUpDetector"); //if hostname doesnt exist even in shared memory if(!host.length()){ #ifdef VERBOSE cout << endl << "No Detector Connected." << endl; #endif - qDefs::Message(qDefs::CRITICAL,"No Detectors Connected. ","Main"); + qDefs::Message(qDefs::CRITICAL,"No Detectors Connected. ","qDetectorMain::SetUpDetector"); exit(-1); } //check if the detector is not even connected string offline = myDet->checkOnline(); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qDetectorMain::SetUpDetector"); if(!offline.empty()){ - qDefs::Message(qDefs::CRITICAL,string("The detector(s) ")+offline+string(" is/are not connected. Exiting GUI."),"Main"); + qDefs::Message(qDefs::CRITICAL,string("The detector(s) ")+offline+string(" is/are not connected. Exiting GUI."),"qDetectorMain::SetUpDetector"); cout << "The detector(s) " << host << " is/are not connected. Exiting GUI." << endl; exit(-1); } // Check if type valid. If not, exit slsDetectorDefs::detectorType detType = myDet->getDetectorsType(); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qDetectorMain::SetUpDetector"); switch(detType){ case slsDetectorDefs::MYTHEN: break; @@ -234,10 +234,10 @@ void qDetectorMain::SetUpDetector(const string fName){ case slsDetectorDefs::MOENCH: actionLoadTrimbits->setText("Load Settings"); actionSaveTrimbits->setText("Save Settings"); break; default: string detName = myDet->slsDetectorBase::getDetectorType(detType); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qDetectorMain::SetUpDetector"); string errorMess = host+string(" has unknown detector type \"")+ detName+string("\". Exiting GUI."); - qDefs::Message(qDefs::CRITICAL,errorMess,"Main"); + qDefs::Message(qDefs::CRITICAL,errorMess,"qDetectorMain::SetUpDetector"); exit(-1); } setWindowTitle("SLS Detector GUI : "+ @@ -246,7 +246,7 @@ void qDetectorMain::SetUpDetector(const string fName){ cout << endl << "Type : " << slsDetectorBase::getDetectorType(detType) << "\nDetector : " << host << endl; //#endif myDet->setOnline(slsDetectorDefs::ONLINE_FLAG); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qDetectorMain::SetUpDetector"); } @@ -309,21 +309,21 @@ void qDetectorMain::LoadConfigFile(const string fName){ //path doesnt exist if(stat(fName.c_str(),&st_buf)) - qDefs::Message(qDefs::WARNING,string("Start up configuration failed to load. The following file does not exist:
")+fName,"Main"); + qDefs::Message(qDefs::WARNING,string("Start up configuration failed to load. The following file does not exist:
")+fName,"qDetectorMain::LoadConfigFile"); //not a file else if (!S_ISREG (st_buf.st_mode)) - qDefs::Message(qDefs::WARNING,string("Start up configuration failed to load. The following file is not a recognized file format:
")+fName,"Main"); + qDefs::Message(qDefs::WARNING,string("Start up configuration failed to load. The following file is not a recognized file format:
")+fName,"qDetectorMain::LoadConfigFile"); else{ //could not load config file if(myDet->readConfigurationFile(fName)==slsDetectorDefs::FAIL) - qDefs::Message(qDefs::WARNING,string("Could not load all the Configuration Parameters from file:\n")+fName,"Main"); + qDefs::Message(qDefs::WARNING,string("Could not load all the Configuration Parameters from file:\n")+fName,"qDetectorMain::LoadConfigFile"); //successful else - qDefs::Message(qDefs::INFORMATION,"The Configuration Parameters have been loaded successfully at start up.","Main"); + qDefs::Message(qDefs::INFORMATION,"The Configuration Parameters have been loaded successfully at start up.","qDetectorMain::LoadConfigFile"); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qDetectorMain::LoadConfigFile"); } } @@ -395,17 +395,17 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ cout << "Loading Setup" << endl; #endif QString fName = QString(myDet->getFilePath().c_str()); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities"); fName = QFileDialog::getOpenFileName(this, tr("Load Detector Setup"),fName, tr("Detector Setup files (*.det)")); // Gets called when cancelled as well if (!fName.isEmpty()){ if(myDet->retrieveDetectorSetup(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL){ - qDefs::Message(qDefs::INFORMATION,"The Setup Parameters have been loaded successfully.","Main"); + qDefs::Message(qDefs::INFORMATION,"The Setup Parameters have been loaded successfully.","qDetectorMain::ExecuteUtilities"); refreshTabs=true; - }else qDefs::Message(qDefs::WARNING,string("Could not load the Setup Parameters from file:\n")+fName.toAscii().constData(),"Main"); - qDefs::checkErrorMessage(myDet); + }else qDefs::Message(qDefs::WARNING,string("Could not load the Setup Parameters from file:\n")+fName.toAscii().constData(),"qDetectorMain::ExecuteUtilities"); + qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities"); } } else if(action==actionSaveSetup){ @@ -413,16 +413,16 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ cout << "Saving Setup" << endl; #endif QString fName = QString(myDet->getFilePath().c_str()); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities"); fName = QFileDialog::getSaveFileName(this, tr("Save Current Detector Setup"),fName, tr("Detector Setup files (*.det) ")); // Gets called when cancelled as well if (!fName.isEmpty()){ if(myDet->dumpDetectorSetup(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL) - qDefs::Message(qDefs::INFORMATION,"The Setup Parameters have been saved successfully.","Main"); - else qDefs::Message(qDefs::WARNING,string("Could not save the Setup Parameters from file:\n")+fName.toAscii().constData(),"Main"); - qDefs::checkErrorMessage(myDet); + qDefs::Message(qDefs::INFORMATION,"The Setup Parameters have been saved successfully.","qDetectorMain::ExecuteUtilities"); + else qDefs::Message(qDefs::WARNING,string("Could not save the Setup Parameters from file:\n")+fName.toAscii().constData(),"qDetectorMain::ExecuteUtilities"); + qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities"); } } else if(action==actionOpenConfiguration){ @@ -430,17 +430,17 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ cout << "Loading Configuration" << endl; #endif QString fName = QString(myDet->getFilePath().c_str()); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities"); fName = QFileDialog::getOpenFileName(this, tr("Load Detector Configuration"),fName, tr("Configuration files (*.config)")); // Gets called when cancelled as well if (!fName.isEmpty()){ if(myDet->readConfigurationFile(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL){ - qDefs::Message(qDefs::INFORMATION,"The Configuration Parameters have been configured successfully.","Main"); + qDefs::Message(qDefs::INFORMATION,"The Configuration Parameters have been configured successfully.","qDetectorMain::ExecuteUtilities"); refreshTabs=true; - }else qDefs::Message(qDefs::WARNING,string("Could not load all the Configuration Parameters from file:\n")+fName.toAscii().constData(),"Main"); - qDefs::checkErrorMessage(myDet); + }else qDefs::Message(qDefs::WARNING,string("Could not load all the Configuration Parameters from file:\n")+fName.toAscii().constData(),"qDetectorMain::ExecuteUtilities"); + qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities"); } } else if(action==actionSaveConfiguration){ @@ -448,21 +448,21 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ cout << "Saving Configuration" << endl; #endif QString fName = QString(myDet->getFilePath().c_str()); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities"); fName = QFileDialog::getSaveFileName(this, tr("Save Current Detector Configuration"),fName, tr("Configuration files (*.config) ")); // Gets called when cancelled as well if (!fName.isEmpty()){ if(myDet->writeConfigurationFile(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL) - qDefs::Message(qDefs::INFORMATION,"The Configuration Parameters have been saved successfully.","Main"); - else qDefs::Message(qDefs::WARNING,string("Could not save the Configuration Parameters from file:\n")+fName.toAscii().constData(),"Main"); - qDefs::checkErrorMessage(myDet); + qDefs::Message(qDefs::INFORMATION,"The Configuration Parameters have been saved successfully.","qDetectorMain::ExecuteUtilities"); + else qDefs::Message(qDefs::WARNING,string("Could not save the Configuration Parameters from file:\n")+fName.toAscii().constData(),"qDetectorMain::ExecuteUtilities"); + qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities"); } } else if(action==actionLoadTrimbits){ QString fName = QString(myDet->getSettingsDir()); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities"); //gotthard if(actionLoadTrimbits->text().contains("Settings")){ #ifdef VERBOSE @@ -474,9 +474,9 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ // Gets called when cancelled as well if (!fName.isEmpty()){ if(myDet->loadSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) - qDefs::Message(qDefs::INFORMATION,"The Settings have been loaded successfully.","Main"); - else qDefs::Message(qDefs::WARNING,string("Could not load the Settings from file:\n")+fName.toAscii().constData(),"Main"); - qDefs::checkErrorMessage(myDet); + qDefs::Message(qDefs::INFORMATION,"The Settings have been loaded successfully.","qDetectorMain::ExecuteUtilities"); + else qDefs::Message(qDefs::WARNING,string("Could not load the Settings from file:\n")+fName.toAscii().constData(),"qDetectorMain::ExecuteUtilities"); + qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities"); } }//mythen and eiger @@ -491,9 +491,9 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ // Gets called when cancelled as well if (!fName.isEmpty()){ if(myDet->loadSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) - qDefs::Message(qDefs::INFORMATION,"The Trimbits have been loaded successfully.","Main"); - else qDefs::Message(qDefs::WARNING,string("Could not load the Trimbits from file:\n")+fName.toAscii().constData(),"Main"); - qDefs::checkErrorMessage(myDet); + qDefs::Message(qDefs::INFORMATION,"The Trimbits have been loaded successfully.","qDetectorMain::ExecuteUtilities"); + else qDefs::Message(qDefs::WARNING,string("Could not load the Trimbits from file:\n")+fName.toAscii().constData(),"qDetectorMain::ExecuteUtilities"); + qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities"); } } } @@ -505,16 +505,16 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ #endif //different output directory so as not to overwrite QString fName = QString(myDet->getSettingsDir()); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities"); fName = QFileDialog::getSaveFileName(this, tr("Save Current Detector Settings"),fName, tr("Settings files (*.settings settings.sn*) ")); // Gets called when cancelled as well if (!fName.isEmpty()){ if(myDet->saveSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) - qDefs::Message(qDefs::INFORMATION,"The Settings have been saved successfully.","Main"); - else qDefs::Message(qDefs::WARNING,string("Could not save the Settings to file:\n")+fName.toAscii().constData(),"Main"); - qDefs::checkErrorMessage(myDet); + qDefs::Message(qDefs::INFORMATION,"The Settings have been saved successfully.","qDetectorMain::ExecuteUtilities"); + else qDefs::Message(qDefs::WARNING,string("Could not save the Settings to file:\n")+fName.toAscii().constData(),"qDetectorMain::ExecuteUtilities"); + qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities"); } }//mythen and eiger else{ @@ -522,16 +522,16 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ cout << "Saving Trimbits" << endl; #endif//different output directory so as not to overwrite QString fName = QString(myDet->getSettingsDir()); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities"); fName = QFileDialog::getSaveFileName(this, tr("Save Current Detector Trimbits"),fName, tr("Trimbit files (*.trim noise.sn*) ")); // Gets called when cancelled as well if (!fName.isEmpty()){ if(myDet->saveSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) - qDefs::Message(qDefs::INFORMATION,"The Trimbits have been saved successfully.","Main"); - else qDefs::Message(qDefs::WARNING,string("Could not save the Trimbits to file:\n")+fName.toAscii().constData(),"Main"); - qDefs::checkErrorMessage(myDet); + qDefs::Message(qDefs::INFORMATION,"The Trimbits have been saved successfully.","qDetectorMain::ExecuteUtilities"); + else qDefs::Message(qDefs::WARNING,string("Could not save the Trimbits to file:\n")+fName.toAscii().constData(),"qDetectorMain::ExecuteUtilities"); + qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities"); } } } @@ -547,9 +547,9 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ // Gets called when cancelled as well if (!fName.isEmpty()){ if(myDet->loadCalibrationFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) - qDefs::Message(qDefs::INFORMATION,"The Calibration Data have been loaded successfully.","Main"); - else qDefs::Message(qDefs::WARNING,string("Could not load the Calibration data from file:\n")+ fName.toAscii().constData(),"Main"); - qDefs::checkErrorMessage(myDet); + qDefs::Message(qDefs::INFORMATION,"The Calibration Data have been loaded successfully.","qDetectorMain::ExecuteUtilities"); + else qDefs::Message(qDefs::WARNING,string("Could not load the Calibration data from file:\n")+ fName.toAscii().constData(),"qDetectorMain::ExecuteUtilities"); + qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities"); } } else if(action==actionSaveCalibration){ @@ -564,9 +564,9 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ // Gets called when cancelled as well if (!fName.isEmpty()){ if(myDet->saveCalibrationFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) - qDefs::Message(qDefs::INFORMATION,"The Calibration Data have been saved successfully.","Main"); - else qDefs::Message(qDefs::WARNING,string("Could not save the Calibration data to file:\n")+fName.toAscii().constData(),"Main"); - qDefs::checkErrorMessage(myDet); + qDefs::Message(qDefs::INFORMATION,"The Calibration Data have been saved successfully.","qDetectorMain::ExecuteUtilities"); + else qDefs::Message(qDefs::WARNING,string("Could not save the Calibration data to file:\n")+fName.toAscii().constData(),"qDetectorMain::ExecuteUtilities"); + qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities"); } } @@ -601,7 +601,7 @@ void qDetectorMain::ExecuteHelp(QAction *action){ string thisGUIVersion = string(version); sprintf(version,"%llx",myDet->getId(slsDetectorDefs::THIS_SOFTWARE_VERSION)); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteHelp"); string thisClientVersion = string(version); //

A heading

@@ -613,7 +613,7 @@ void qDetectorMain::ExecuteHelp(QAction *action){ "It can be operated in parallel with the command line interface:
" "sls_detector_put,
sls_detector_get,
sls_detector_acquire and
sls_detector_help.

" "The GUI Software is still in progress. " - "Please report bugs to dhanya.maliakal@psi.ch or anna.bergamaschi@psi.ch.<\\p>","About SLS Detector GUI"); + "Please report bugs to dhanya.maliakal@psi.ch or anna.bergamaschi@psi.ch.<\\p>","qDetectorMain::ExecuteHelp"); } } diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 1f0f1af2c..b1d0c27b2 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -275,7 +275,7 @@ void qDrawPlot::SetupWidgetWindow(){ //Setting the callback function to get progress from detector class(using receivers) myDet->registerProgressCallback(&(GetProgressCallBack),this); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qDrawPlot::SetupWidgetWindow"); } @@ -369,7 +369,7 @@ void qDrawPlot::StartStopDaqToggle(bool stop_if_running){ StartDaq(true); running=!running; - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qDrawPlot::StartStopDaqToggle"); } /** if this is set during client initation */ @@ -521,7 +521,7 @@ void qDrawPlot::SetScanArgument(int scanArg){ UnlockLastImageArray(); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qDrawPlot::SetScanArgument"); } @@ -1027,7 +1027,7 @@ void qDrawPlot::ShowAcquisitionErrorMessage(QString status){ alreadyDisplayed = true; qDefs::Message(qDefs::WARNING,string("The acquisiton has ended abruptly. " "Current Detector Status: ")+status.toAscii().constData()+ - string("."),"Dock"); + string("."),"qDrawPlot::ShowAcquisitionErrorMessage"); } } @@ -1241,7 +1241,7 @@ void qDrawPlot::ClonePlot(){ if(running) sFilePath = filePath.toAscii().constData(); else { sFilePath = myDet->getFilePath(); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qDrawPlot::ClonePlot"); } @@ -1339,7 +1339,7 @@ void qDrawPlot::SaveClones(){ if(success) qDefs::Message(qDefs::INFORMATION,"The Snapshots have all been saved successfully in .png.","Dock"); else - qDefs::Message(qDefs::WARNING,errMessage + string("were not saved."),"Dock"); + qDefs::Message(qDefs::WARNING,errMessage + string("were not saved."),"qDrawPlot::SaveClones"); } @@ -1378,7 +1378,7 @@ void qDrawPlot::SavePlot(){ if(running) fName = filePath; else { fName = QString(myDet->getFilePath().c_str()); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qDrawPlot::SavePlot"); } if(boxPlot->title().contains('.')){ @@ -1391,10 +1391,10 @@ void qDrawPlot::SavePlot(){ if (!fName.isEmpty()) if(savedImage.save(fName)) - qDefs::Message(qDefs::INFORMATION,"The Image has been successfully saved","Dock"); + qDefs::Message(qDefs::INFORMATION,"The Image has been successfully saved","qDrawPlot::SavePlot"); else qDefs::Message(qDefs::WARNING,"Attempt to save image failed.\n" - "Formats: .png, .jpg, .xpm.","Dock"); + "Formats: .png, .jpg, .xpm.","qDrawPlot::SavePlot"); } @@ -1409,7 +1409,7 @@ void qDrawPlot::SavePlotAutomatic(){ if(running) qFilePath = filePath; else { qFilePath = QString(myDet->getFilePath().c_str()); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qDrawPlot::SavePlotAutomatic"); } @@ -1447,7 +1447,7 @@ void qDrawPlot::SavePlotAutomatic(){ void qDrawPlot::ShowSaveErrorMessage(QString fileName){ qDefs::Message(qDefs::WARNING,string("Automatic Saving: Could not save the first file:\n")+ - string(fileName.toAscii().constData()) + string("\n\nNote: Will not show future file save errors for this acquisition."),"Dock"); + string(fileName.toAscii().constData()) + string("\n\nNote: Will not show future file save errors for this acquisition."),"qDrawPlot::ShowSaveErrorMessage"); } @@ -1507,14 +1507,14 @@ int qDrawPlot::UpdateTrimbitPlot(bool fromDetector,bool Histogram){ if(histTrimbits) delete [] histTrimbits; histTrimbits = new double[actualPixelsX]; ret = myDet->getChanRegs(histTrimbits,fromDetector); if(!ret){ - qDefs::Message(qDefs::WARNING,"No Trimbit data found in shared memory.","Dock"); + qDefs::Message(qDefs::WARNING,"No Trimbit data found in shared memory.","qDrawPlot::UpdateTrimbitPlot"); return qDefs::FAIL; } #ifdef VERBOSE cout << "Got Trimbits" << endl; #endif - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qDrawPlot::UpdateTrimbitPlot"); //defining axes if(Histogram) nPixelsX = TRIM_HISTOGRAM_XMAX+1; @@ -1599,7 +1599,7 @@ int qDrawPlot::UpdateTrimbitPlot(bool fromDetector,bool Histogram){ //get trimbits ret = 1;/*myDet->getChanRegs(lastImageArray,fromDetector);*/ if(!ret){ - qDefs::Message(qDefs::WARNING,"No Trimbit data found in shared memory.","Dock"); + qDefs::Message(qDefs::WARNING,"No Trimbit data found in shared memory.","qDrawPlot::UpdateTrimbitPlot"); return qDefs::FAIL; } //clear/select plot and set titles diff --git a/slsDetectorGui/src/qScanWidget.cpp b/slsDetectorGui/src/qScanWidget.cpp index 48f281a2c..0c7b73dea 100644 --- a/slsDetectorGui/src/qScanWidget.cpp +++ b/slsDetectorGui/src/qScanWidget.cpp @@ -296,7 +296,7 @@ void qScanWidget::EnableSizeWidgets(){ char cId[5];sprintf(cId,"%d",id); qDefs::Message(qDefs::INFORMATION,string("Scan Level ")+string(cId)+ string(": Specific Values

Number of positions added: ")+ - string(cNum)+string(""),"ScanWidget"); + string(cNum)+string(""),"qScanWidget::EnableSizeWidgets"); #endif } } @@ -404,7 +404,7 @@ int qScanWidget::SetScan(int mode){ return qDefs::OK; }else{//mode NOT set if((mode!=actualMode)&&(actualNumSteps)){ - qDefs::Message(qDefs::WARNING,"The mode could not be changed for an unknown reason.","ScanWidget"); + qDefs::Message(qDefs::WARNING,"The mode could not be changed for an unknown reason.","qScanWidget::SetScan"); comboScript->setCurrentIndex(actualMode); return qDefs::FAIL; } @@ -412,7 +412,7 @@ int qScanWidget::SetScan(int mode){ emit EnableScanBox(); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qScanWidget::SetScan"); return qDefs::OK; } @@ -471,12 +471,12 @@ void qScanWidget::SetScriptFile(){ if(!set){ //path doesnt exist if(stat(fName.toAscii().constData(),&st_buf)){ - qDefs::Message(qDefs::WARNING,"The script file entered does not exist","ScanWidget"); + qDefs::Message(qDefs::WARNING,"The script file entered does not exist","qScanWidget::SetScriptFile"); dispScript->setText(QString(myDet->getScanScript(id).c_str())); } //if its not a file else if (!S_ISREG (st_buf.st_mode)) { - qDefs::Message(qDefs::WARNING,"The script file path entered is not a file","ScanWidget"); + qDefs::Message(qDefs::WARNING,"The script file path entered is not a file","qScanWidget::SetScriptFile"); dispScript->setText(QString(myDet->getScanScript(id).c_str())); } else @@ -489,7 +489,7 @@ void qScanWidget::SetScriptFile(){ if(fName.compare(QString(myDet->getScanScript(id).c_str()))){ //did not get set, write what is was before if(!fName.isEmpty()) - qDefs::Message(qDefs::WARNING,"The script file could not be set. Reverting to previous file.","ScanWidget"); + qDefs::Message(qDefs::WARNING,"The script file could not be set. Reverting to previous file.","qScanWidget::SetScriptFile"); dispScript->setText(QString(myDet->getScanScript(id).c_str())); } @@ -504,7 +504,7 @@ void qScanWidget::SetScriptFile(){ if(!fName.compare(QString(modeNames[i].c_str()))) dispScript->setText(""); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qScanWidget::SetScriptFile"); } @@ -530,7 +530,7 @@ void qScanWidget::SetParameter(){ if(!parameter.compare(QString(modeNames[i].c_str()))) dispParameter->setText(""); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qScanWidget::SetParameter"); } @@ -546,9 +546,9 @@ void qScanWidget::SetPrecision(int value){ #endif myDet->setScanPrecision(id,value); if(myDet->getScanPrecision(id)!=value) - qDefs::Message(qDefs::WARNING,"The precision was not set for an unknown reason.","ScanWidget");; + qDefs::Message(qDefs::WARNING,"The precision was not set for an unknown reason.","qScanWidget::SetPrecision");; - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qScanWidget::SetPrecision"); } @@ -661,7 +661,7 @@ void qScanWidget::RangeFromChanged(){ //check size validity else if(RangeCheckNumValid(numSteps)==qDefs::FAIL) qDefs::Message(qDefs::WARNING,"Number of Steps = 1 + ( To - From ) / Size.
" - "Number of Steps must be >= 2. Changing From back to previous value.","Scan"); + "Number of Steps must be >= 2. Changing From back to previous value.","qScanWidget::RangeFromChanged"); else change = true; //change it back from = to - size*num + size @@ -708,11 +708,11 @@ void qScanWidget::RangeToChanged(){ //check size validity if(RangeCheckSizeZero()==qDefs::FAIL) - qDefs::Message(qDefs::WARNING,"From cannot be equal to To. Changing To back to previous value.","Scan"); + qDefs::Message(qDefs::WARNING,"From cannot be equal to To. Changing To back to previous value.","qScanWidget::RangeToChanged"); //check size validity else if(RangeCheckNumValid(numSteps)==qDefs::FAIL) qDefs::Message(qDefs::WARNING,"Number of Steps = 1 + ( To - From ) / Size.
" - "Number of Steps must be >= 2. Changing To back to previous value.","Scan"); + "Number of Steps must be >= 2. Changing To back to previous value.","qScanWidget::RangeToChanged"); else change = true; //change it back to = size*num - size + from @@ -760,11 +760,11 @@ void qScanWidget::RangeSizeChanged(){ //check size validity if(!spinSize->value()) - qDefs::Message(qDefs::WARNING,"Size cannot be 0. Changing Size back to previous value.","Scan"); + qDefs::Message(qDefs::WARNING,"Size cannot be 0. Changing Size back to previous value.","qScanWidget::RangeSizeChanged"); //check size validity else if(RangeCheckNumValid(numSteps)==qDefs::FAIL) qDefs::Message(qDefs::WARNING,"Number of Steps = 1 + ( To - From ) / Size.
" - "Number of Steps must be >= 2. Changing Size back to previous value.","Scan"); + "Number of Steps must be >= 2. Changing Size back to previous value.","qScanWidget::RangeSizeChanged"); else change = true; //change it back size = (to-from)/(num-1) @@ -833,13 +833,13 @@ void qScanWidget::SetRangeSteps(){ if((comboScript->currentIndex()==CustomScript)&&((script=="")||(script=="none"))){ qDefs::Message(qDefs::INFORMATION,string("Scan Level ")+string(cId)+ string(": Constant Step Size

" - "Positions could not be loaded as the script file path is empty."),"ScanWidget"); + "Positions could not be loaded as the script file path is empty."),"qScanWidget::SetRangeSteps"); }else{ //error loading positions if(myDet->getScanSteps(id)!=actualNumSteps){ qDefs::Message(qDefs::WARNING,string("Scan Level ")+string(cId)+ string(": Values From File

" - "The positions list was not set for an unknown reason."),"ScanWidget"); + "The positions list was not set for an unknown reason."),"qScanWidget::SetRangeSteps"); /*LoadPositions(); comboScript->setCurrentIndex(myDet->getScanMode(id))*/ } @@ -848,13 +848,13 @@ void qScanWidget::SetRangeSteps(){ char cNum[200];sprintf(cNum,"%d",actualNumSteps); qDefs::Message(qDefs::INFORMATION,string("Scan Level ")+string(cId)+ string(": Constant Step Size

Number of positions added: ")+ - string(cNum)+string(""),"ScanWidget"); + string(cNum)+string(""),"qScanWidget::SetRangeSteps"); } #endif } } - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qScanWidget::SetRangeSteps"); } //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -914,14 +914,14 @@ int qScanWidget::SetCustomSteps(){ if((comboScript->currentIndex()==CustomScript)&&((script=="")||(script=="none"))){ qDefs::Message(qDefs::INFORMATION,string("Scan Level ")+string(cId)+ string(": Values From File

" - "Positions could not be loaded as the script file path is empty."),"ScanWidget"); + "Positions could not be loaded as the script file path is empty."),"qScanWidget::SetCustomSteps"); return qDefs::FAIL; }else{ if(myDet->getScanSteps(id)!=actualNumSteps){ - qDefs::Message(qDefs::WARNING,"The positions list was not set for an unknown reason.","ScanWidget"); + qDefs::Message(qDefs::WARNING,"The positions list was not set for an unknown reason.","qScanWidget::SetCustomSteps"); LoadPositions(); comboScript->setCurrentIndex(myDet->getScanMode(id)); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qScanWidget::qScanWidget::SetCustomSteps"); return qDefs::FAIL; } //else success is checked in enabledsizewidgets , else it does this for every add, delete etc @@ -1079,20 +1079,20 @@ void qScanWidget::SetFileSteps(){ if((comboScript->currentIndex()==CustomScript)&&((script=="")||(script=="none"))){ qDefs::Message(qDefs::INFORMATION,string("Scan Level ")+string(cId)+ string(": Values From File

" - "Positions could not be loaded as the script file path is empty."),"ScanWidget"); + "Positions could not be loaded as the script file path is empty."),"qScanWidget::SetFileSteps"); }else{ //error loading positions if(myDet->getScanSteps(id)!=actualNumSteps){ qDefs::Message(qDefs::WARNING,string("Scan Level ")+string(cId)+ string(": Values From File

" - "The positions list was not set for an unknown reason."),"ScanWidget"); + "The positions list was not set for an unknown reason."),"qScanWidget::SetFileSteps"); } #ifdef VERYVERBOSE else{//SUCCESS char cNum[200];sprintf(cNum,"%d",actualNumSteps); qDefs::Message(qDefs::INFORMATION,string("Scan Level ")+string(cId)+ string(": Values From File

Number of positions added: ")+ - string(cNum)+string(""),"ScanWidget"); + string(cNum)+string(""),"qScanWidget::SetFileSteps"); } #endif } @@ -1108,7 +1108,7 @@ void qScanWidget::SetFileSteps(){ connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps())); } - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qScanWidget::SetFileSteps"); } @@ -1198,7 +1198,7 @@ void qScanWidget::LoadPositions(){ connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps())); connect(btnGroup, SIGNAL(buttonClicked(QAbstractButton*)),this,SLOT(EnableSizeWidgets())); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qScanWidget::LoadPositions"); //do not set the range variables because if the stepsize is by any chance 0.. //then the number of steps should change to 1. so only set custom steps } @@ -1240,7 +1240,7 @@ void qScanWidget::Refresh(){ "precision:" << precision << "\t***" << endl; #endif - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qScanWidget::Refresh"); } diff --git a/slsDetectorGui/src/qServer.cpp b/slsDetectorGui/src/qServer.cpp index 47fd52ffb..d818b88f8 100644 --- a/slsDetectorGui/src/qServer.cpp +++ b/slsDetectorGui/src/qServer.cpp @@ -152,7 +152,7 @@ int qServer::StartStopServer(int start){ checkStarted=1; if (pthread_create(&gui_server_thread, NULL,StartServerThread, (void*) this)){ gui_server_thread_running=0; - qDefs::Message(qDefs::WARNING,"Can't create gui server thread", "Server"); + qDefs::Message(qDefs::WARNING,"Can't create gui server thread", "qServer::StartStopServer"); cout << "ERROR: Can't create gui server thread" << endl; return FAIL; } @@ -168,7 +168,7 @@ int qServer::StartStopServer(int start){ checkStopStarted=1; if (pthread_create(&gui_stop_server_thread, NULL,StopServerThread, (void*) this)){ gui_server_thread_running=0; - qDefs::Message(qDefs::WARNING,"Can't create gui stop server thread", "Server"); + qDefs::Message(qDefs::WARNING,"Can't create gui stop server thread", "qServer::StartStopServer"); cout << "ERROR: Can't create gui stop server thread" << endl; return FAIL; } @@ -238,7 +238,7 @@ int qServer::StopServer(){ myStopSocket = new MySocketTCP(port_no+1); if (myStopSocket->getErrorStatus()){ gui_server_thread_running = 0; - qDefs::Message(qDefs::WARNING,"Could not start gui stop server socket","Server"); + qDefs::Message(qDefs::WARNING,"Could not start gui stop server socket","qServer::StopServer"); } checkStopStarted = 0; @@ -303,7 +303,7 @@ int qServer::StartServer(){ mySocket = new MySocketTCP(port_no); if (mySocket->getErrorStatus()){ gui_server_thread_running = 0; - qDefs::Message(qDefs::WARNING,"Could not start gui server socket","Server"); + qDefs::Message(qDefs::WARNING,"Could not start gui server socket","qServer::StartServer"); } checkStarted = 0; diff --git a/slsDetectorGui/src/qTabActions.cpp b/slsDetectorGui/src/qTabActions.cpp index ad30a377e..80dea2508 100644 --- a/slsDetectorGui/src/qTabActions.cpp +++ b/slsDetectorGui/src/qTabActions.cpp @@ -220,7 +220,7 @@ void qTabActions::SetupWidgetWindow(){ } - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabActions::SetupWidgetWindow"); } @@ -364,7 +364,7 @@ void qTabActions::Expand(QAbstractButton *button ){ } } - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabActions::Expand"); } @@ -411,10 +411,10 @@ void qTabActions::SetPosition(){ positions[i] = comboPos->itemText(i).toDouble(); //setting the list and catching error if(myDet->setPositions(comboPos->count(),positions)!=comboPos->count()) - qDefs::Message(qDefs::WARNING,"The positions list was not set for some reason.","Actions"); + qDefs::Message(qDefs::WARNING,"The positions list was not set for some reason.","qTabActions::SetPosition"); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabActions::SetPosition"); } @@ -466,7 +466,7 @@ void qTabActions::EnablePositions(bool enable){ btnExpand[NumPositions]->setEnabled(false); } - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabActions::EnablePositions"); } @@ -524,7 +524,7 @@ void qTabActions::Refresh(){ #ifdef VERBOSE cout << "**Updated all action widgets: " << endl << endl; #endif - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabActions::Refresh"); } diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp index 741f493f2..f76f262aa 100644 --- a/slsDetectorGui/src/qTabAdvanced.cpp +++ b/slsDetectorGui/src/qTabAdvanced.cpp @@ -125,7 +125,7 @@ void qTabAdvanced::SetupWidgetWindow(){ comboDetector->setCurrentIndex(0); det = myDet->getSlsDetector(comboDetector->currentIndex()); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabAdvanced::SetupWidgetWindow"); spinControlPort->setValue(det->getControlPort()); spinStopPort->setValue(det->getStopPort()); @@ -166,7 +166,7 @@ void qTabAdvanced::SetupWidgetWindow(){ Initialization(); - qDefs::checkErrorMessage(det); + qDefs::checkErrorMessage(det,"qTabAdvanced::SetupWidgetWindow"); } @@ -262,11 +262,11 @@ void qTabAdvanced::SetLogs(){ #ifdef VERBOSE cout << "Could not set/reset Log." << endl; #endif - qDefs::Message(qDefs::WARNING,"Could not set/reset Log.","Advanced"); + qDefs::Message(qDefs::WARNING,"Could not set/reset Log.","qTabAdvanced::SetLogs"); checkedBox->setChecked(!enable); } - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabAdvanced::SetLogs"); } @@ -281,7 +281,7 @@ void qTabAdvanced::SetExposureTime(){ #endif myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,(int64_t)exptimeNS); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabAdvanced::SetExposureTime"); } @@ -293,7 +293,7 @@ void qTabAdvanced::SetThreshold(){ cout << "Setting Threshold DACu:" << spinThreshold->value() << endl; #endif spinThreshold->setValue((double)myDet->setDAC((dacs_t)spinThreshold->value(),slsDetectorDefs::THRESHOLD)); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabAdvanced::SetThreshold"); } @@ -329,7 +329,7 @@ void qTabAdvanced::SetOutputFile(){ if(!dirPath.compare(trimdir)){ int ret = qDefs::Message(qDefs::QUESTION,string("This will possibly overwrite your original trimbits.
" "Proposed file path:") + string(dirPath.toAscii().constData())+ - string("
Do you still want to continue?"),"Advanced"); + string("
Do you still want to continue?"),"qTabAdvanced::SetOutputFile"); if(ret==qDefs::FAIL){ dispFile->setText(""); dispFile->setToolTip(outputDirTip + errOutputTip); @@ -350,7 +350,7 @@ void qTabAdvanced::SetOutputFile(){ btnStart->setEnabled(false); } - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabAdvanced::SetOutputFile"); } @@ -480,17 +480,17 @@ void qTabAdvanced::StartTrimming(){ int ret = myDet->executeTrimming(trimmingMode,parameter1,parameter2,-1); if((ret!=slsDetectorDefs::FAIL)&&(ret!=-1)); else - qDefs::Message(qDefs::WARNING,"Atleast 1 channel could not be trimmed.","Advanced"); + qDefs::Message(qDefs::WARNING,"Atleast 1 channel could not be trimmed.","qTabAdvanced::StartTrimming"); //save trim file ret = myDet->saveSettingsFile(string(dispFile->text().toAscii().constData()),-1); if((ret!=slsDetectorDefs::FAIL)&&(ret!=-1)){ - qDefs::Message(qDefs::INFORMATION,"The Trimbits have been saved successfully.","Advanced"); + qDefs::Message(qDefs::INFORMATION,"The Trimbits have been saved successfully.","qTabAdvanced::StartTrimming"); //updates plots myPlot->UpdateTrimbitPlot(false,radioHistogram->isChecked()); } - else qDefs::Message(qDefs::WARNING,string("Could not Save the Trimbits to file:\n")+dispFile->text().toAscii().constData(),"Advanced"); + else qDefs::Message(qDefs::WARNING,string("Could not Save the Trimbits to file:\n")+dispFile->text().toAscii().constData(),"qTabAdvanced::StartTrimming"); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabAdvanced::StartTrimming"); } @@ -516,7 +516,7 @@ void qTabAdvanced::SetControlPort(int port){ #endif disconnect(spinControlPort, SIGNAL(valueChanged(int)), this, SLOT(SetControlPort(int))); spinControlPort->setValue(det->setPort(slsDetectorDefs::CONTROL_PORT,port)); - qDefs::checkErrorMessage(det); + qDefs::checkErrorMessage(det,"qTabAdvanced::SetControlPort"); connect(spinControlPort, SIGNAL(valueChanged(int)), this, SLOT(SetControlPort(int))); } @@ -530,7 +530,7 @@ void qTabAdvanced::SetStopPort(int port){ #endif disconnect(spinStopPort, SIGNAL(valueChanged(int)), this, SLOT(SetStopPort(int))); spinStopPort->setValue(det->setPort(slsDetectorDefs::STOP_PORT,port)); - qDefs::checkErrorMessage(det); + qDefs::checkErrorMessage(det,"qTabAdvanced::SetStopPort"); connect(spinStopPort, SIGNAL(valueChanged(int)), this, SLOT(SetStopPort(int))); } @@ -545,7 +545,7 @@ void qTabAdvanced::SetRxrTCPPort(int port){ #endif disconnect(spinTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int))); spinTCPPort->setValue(det->setPort(slsDetectorDefs::DATA_PORT,port)); - qDefs::checkErrorMessage(det); + qDefs::checkErrorMessage(det,"qTabAdvanced::SetRxrTCPPort"); connect(spinTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int))); } @@ -560,7 +560,7 @@ void qTabAdvanced::SetRxrUDPPort(int port){ disconnect(spinUDPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrUDPPort(int))); spinUDPPort->setValue(det->setReceiverUDPPort(port)); - qDefs::checkErrorMessage(det); + qDefs::checkErrorMessage(det,"qTabAdvanced::SetRxrUDPPort"); connect(spinUDPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrUDPPort(int))); } @@ -577,7 +577,7 @@ void qTabAdvanced::SetReceiverOnline(int index){ SetReceiver(); else comboRxrOnline->setCurrentIndex(det->setReceiverOnline(index)); - qDefs::checkErrorMessage(det); + qDefs::checkErrorMessage(det,"qTabAdvanced::SetReceiverOnline"); connect(comboRxrOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetReceiverOnline(int))); //highlight in red if offline if(!comboRxrOnline->currentIndex()){ @@ -603,7 +603,7 @@ void qTabAdvanced::SetOnline(int index){ #endif disconnect(comboOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetOnline(int))); comboOnline->setCurrentIndex(det->setOnline(index)); - qDefs::checkErrorMessage(det); + qDefs::checkErrorMessage(det,"qTabAdvanced::SetOnline"); connect(comboOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetOnline(int))); //highlight in red if offline if(!comboOnline->currentIndex()){ @@ -637,7 +637,7 @@ void qTabAdvanced::SetNetworkParameters(){ dispMAC->setText(QString(det->setDetectorMAC(dispMAC->text().toAscii().constData()))); dispUDPIP->setText(QString(det->setReceiverUDPIP(dispUDPIP->text().toAscii().constData()))); dispUDPMAC->setText(QString(det->setReceiverUDPMAC(dispUDPMAC->text().toAscii().constData()))); - qDefs::checkErrorMessage(det); + qDefs::checkErrorMessage(det,"qTabAdvanced::SetNetworkParameters"); connect(dispIP, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters())); connect(dispMAC, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters())); @@ -655,9 +655,9 @@ void qTabAdvanced::SetReceiver(){ #endif string outdir = myDet->getFilePath(); dispRxrHostname->setText(QString(det->setReceiver(dispRxrHostname->text().toAscii().constData()))); - qDefs::checkErrorMessage(det); + qDefs::checkErrorMessage(det,"qTabAdvanced::SetReceiver"); det->setFilePath(outdir); - qDefs::checkErrorMessage(det); + qDefs::checkErrorMessage(det,"qTabAdvanced::SetReceiver"); Refresh(); } @@ -674,7 +674,7 @@ void qTabAdvanced::updateROIList(){ int n,i; slsDetectorDefs::ROI* temp = myDet->getROI(n); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabAdvanced::updateROIList"); if((temp!=NULL)&&(n>0)){ //assign into array, else it loses values cuz of memory @@ -800,7 +800,7 @@ void qTabAdvanced::AddROIInput(int num){ cout<<"ROI Inputs added " << num << endl; #endif - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabAdvanced::AddROIInput"); } @@ -869,7 +869,7 @@ void qTabAdvanced::setROI(){ //configuremac myDet->configureMAC(); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabAdvanced::setROI"); } @@ -949,7 +949,7 @@ void qTabAdvanced::SetDetector(int index){ } } - qDefs::checkErrorMessage(det); + qDefs::checkErrorMessage(det,"qTabAdvanced::SetDetector"); } @@ -1028,7 +1028,7 @@ void qTabAdvanced::Refresh(){ //network det = myDet->getSlsDetector(comboDetector->currentIndex()); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabAdvanced::Refresh"); //disconnect disconnect(spinControlPort, SIGNAL(valueChanged(int)), this, SLOT(SetControlPort(int))); @@ -1121,7 +1121,7 @@ void qTabAdvanced::Refresh(){ cout << "**Updated Advanced Tab" << endl << endl; #endif - qDefs::checkErrorMessage(det); + qDefs::checkErrorMessage(det,"qTabAdvanced::Refresh"); } diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index 37f7b93e3..5c4beff33 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -127,7 +127,7 @@ void qTabDataOutput::SetupWidgetWindow(){ cout << "done" << endl; #endif - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabDataOutput::SetupWidgetWindow"); } @@ -155,90 +155,8 @@ void qTabDataOutput::Initialization(){ connect(chkDiscardBad, SIGNAL(toggled(bool)), this, SLOT(DiscardBadChannels())); } -//------------------------------------------------------------------------------------------------------------------------------------------------- -/* -void qTabDataOutput::setOutputDir(){ - disconnect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(setOutputDir())); - QString path = dispOutputDir->text(); - - string oldPath = myDet->getFilePath(); - bool error=false; - - //gets rid of the end '/'s - while(path.endsWith('/')) path.chop(1); - dispOutputDir->setText(path); - - if(myDet->setReceiverOnline()==slsDetectorDefs::ONLINE_FLAG){ - for(int i=0;igetNumberOfDetectors();i++){ - slsDetector *det = myDet->getSlsDetector(i); - qDefs::checkErrorMessage(myDet); - oldPath = det->getFilePath(); - det->setFilePath(string(path.toAscii().constData())); - qDefs::checkErrorMessage(det); - if(det->getFilePath()!=(string(path.toAscii().constData()))){ - error=true; - qDefs::checkErrorMessage(det); - break; - } - } - if(error){ - //set it back for the ones which got set - for(int i=0;igetNumberOfDetectors();i++){ - slsDetector *det = myDet->getSlsDetector(i); - qDefs::checkErrorMessage(myDet); - det->setFilePath(oldPath); - qDefs::checkErrorMessage(det); - } - }//set it in multi as well if it worked so that they reflect the same - else - myDet->setFilePath(string(path.toAscii().constData())); - } - else { - for(int i=0;igetNumberOfDetectors();i++){ - slsDetector *det = myDet->getSlsDetector(i); - qDefs::checkErrorMessage(myDet); - det->setFilePath(string(path.toAscii().constData())); - qDefs::checkErrorMessage(det); - if(det->getFilePath()!=(string(path.toAscii().constData()))){ - error=true; - qDefs::checkErrorMessage(det); - break; - } - } - } - - if(!error){ - //if(QFile::exists(path)){ - lblOutputDir->setText("Output Directory: "); - lblOutputDir->setPalette(chkRate->palette()); - lblOutputDir->setToolTip(outDirTip); - dispOutputDir->setToolTip(outDirTip); - btnOutputBrowse->setToolTip(outDirTip); - - myDet->setFilePath(string(path.toAscii().constData())); - #ifdef VERBOSE - cout << "Output Directory changed to :"<getFilePath() << endl; - #endif - } - else{ - lblOutputDir->setText("Output Directory:*"); - lblOutputDir->setPalette(red); - QString errTip = outDirTip + - QString("" - "Enter a valid path to change Output Directory."); - lblOutputDir->setToolTip(errTip); - dispOutputDir->setToolTip(errTip); - btnOutputBrowse->setToolTip(errTip); - } - - connect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(setOutputDir())); - - qDefs::checkErrorMessage(myDet); -} - -*/ //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -290,7 +208,7 @@ void qTabDataOutput::SetFlatField(){ string sDir = dir.toAscii().constData(),sFile = file.toAscii().constData(); if(sDir.length()<1) {sDir = string(QDir::current().absolutePath().toAscii().constData()); /*"/home/";*/} qDefs::Message(qDefs::WARNING,"Invalid Flat Field file: "+sDir+"/"+sFile+ - ".\nUnsetting Flat Field.","Data Output"); + ".\nUnsetting Flat Field.","qTabDataOutput::SetFlatField"); //Unsetting flat field myDet->setFlatFieldCorrectionFile(""); @@ -324,7 +242,7 @@ void qTabDataOutput::SetFlatField(){ connect(dispFlatField,SIGNAL(editingFinished()),this,SLOT(SetFlatField())); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabDataOutput::SetFlatField"); } //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -354,7 +272,7 @@ void qTabDataOutput::UpdateFlatFieldFromServer(){ connect(dispFlatField, SIGNAL(editingFinished()), this, SLOT(SetFlatField())); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabDataOutput::UpdateFlatFieldFromServer"); } //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -371,7 +289,8 @@ void qTabDataOutput::BrowseFlatFieldPath(){ SetFlatField(); } - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabDataOutput::BrowseFlatFieldPath"); + } @@ -424,7 +343,7 @@ void qTabDataOutput::SetRateCorrection(){ connect(radioDeadTime, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); connect(spinDeadTime, SIGNAL(valueChanged(double)), this, SLOT(SetRateCorrection())); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabDataOutput::SetRateCorrection"); } @@ -439,7 +358,7 @@ void qTabDataOutput::UpdateRateCorrectionFromServer(){ double rate; rate = (double)myDet->getRateCorrectionTau(); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabDataOutput::UpdateRateCorrectionFromServer"); #ifdef VERBOSE cout << "Getting rate correction from server:" << rate << " : "; #endif @@ -495,7 +414,7 @@ void qTabDataOutput::SetAngularCorrection(){ cout << "Setting angular conversion to default" << endl; #endif }else{ - qDefs::Message(qDefs::WARNING,"Angular Conversion could not be set. Please set the default file name using the command line, if you haven't already.","Data Output"); + qDefs::Message(qDefs::WARNING,"Angular Conversion could not be set. Please set the default file name using the command line, if you haven't already.","qTabDataOutput::SetAngularCorrection"); chkAngular->setChecked(false); } }else{ @@ -507,7 +426,7 @@ void qTabDataOutput::SetAngularCorrection(){ emit AngularConversionSignal(chkAngular->isChecked()); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabDataOutput::SetAngularCorrection"); } @@ -515,9 +434,9 @@ void qTabDataOutput::SetAngularCorrection(){ void qTabDataOutput::DiscardBadChannels(){ - //#ifdef VERYVERBOSE +#ifdef VERBOSE cout << "Entering Discard bad channels function" << endl; - //#endif +#endif if(chkDiscardBad->isChecked()){ #ifdef VERBOSE cout << "Setting bad channel correction to default" << endl; @@ -530,7 +449,7 @@ void qTabDataOutput::DiscardBadChannels(){ myDet->setBadChannelCorrection(""); } - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabDataOutput::DiscardBadChannels"); } @@ -607,7 +526,7 @@ void qTabDataOutput::Refresh(){ cout << "**Updated DataOutput Tab" << endl << endl; #endif - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabDataOutput::Refresh"); } @@ -646,7 +565,7 @@ void qTabDataOutput::GetOutputDir(){ dispReadOutputDir->setText(QString(myDet->getFilePath().c_str())); }else{ slsDetector *det = myDet->getSlsDetector(comboDetector->currentIndex()); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabDataOutput::GetOutputDir"); dispReadOutputDir->setText(QString(det->getFilePath().c_str())); } @@ -678,7 +597,7 @@ int qTabDataOutput::VerifyOutputDirectory(){ //for each detector for(int i=0;igetNumberOfDetectors();i++){ slsDetector *det = myDet->getSlsDetector(i); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabDataOutput::VerifyOutputDirectory"); if(receiver){ detName = string("\n - ") + string(comboDetector->itemText(i).toAscii().constData()) ; path = det->getFilePath(); @@ -687,7 +606,7 @@ int qTabDataOutput::VerifyOutputDirectory(){ if(det->setFilePath(path).empty()){ mess. append(detName); error = true; - }else if(!qDefs::checkErrorMessage(det,false).empty()){ + }else if(!qDefs::checkErrorMessage(det,"qTabDataOutput::VerifyOutputDirectory",false).empty()){ mess. append(detName); error = true; } @@ -714,7 +633,7 @@ int qTabDataOutput::VerifyOutputDirectory(){ #ifdef VERBOSE cout << "The output path doesnt exist anymore" << endl; #endif - qDefs::Message(qDefs::WARNING,string("Invalid Output Directory ")+ mess ,"Data Output"); + qDefs::Message(qDefs::WARNING,string("Invalid Output Directory ")+ mess ,"qTabDataOutput::SetAngularCorrection"); dispReadOutputDir->setPalette(*red1); boxOutDir->setPalette(red); @@ -784,9 +703,9 @@ void qTabDataOutput::SetOutputDir(){ if(receiver){ slsDetector *det = myDet->getSlsDetector(comboDetector->currentIndex()); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabDataOutput::SetOutputDir"); det->setFilePath(string(dispOutputDir->text().toAscii().constData())); - if(!qDefs::checkErrorMessage(det).empty()){ + if(!qDefs::checkErrorMessage(det,"qTabDataOutput::SetOutputDir").empty()){ #ifdef VERBOSE cout << "The output path could not be set" << endl; #endif @@ -802,10 +721,10 @@ void qTabDataOutput::SetOutputDir(){ //for each detector for(int i=0;igetNumberOfDetectors();i++){ slsDetector *det = myDet->getSlsDetector(i); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabDataOutput::SetOutputDir"); if(det->setFilePath(string(path.toAscii().constData())).empty()){ error = true; - }else if(!qDefs::checkErrorMessage(det,false).empty()){ + }else if(!qDefs::checkErrorMessage(det,"qTabDataOutput::SetOutputDir",false).empty()){ error = true; } myDet->setFilePath(det->getFilePath()); @@ -813,10 +732,10 @@ void qTabDataOutput::SetOutputDir(){ if(error){ - qDefs::Message(qDefs::WARNING,string("Invalid output directory "),"Data Output set"); + qDefs::Message(qDefs::WARNING,string("Invalid output directory "),"qTabDataOutput::SetOutputDir"); for(int i=0;igetNumberOfDetectors();i++){ slsDetector *det = myDet->getSlsDetector(i); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabDataOutput::SetOutputDir"); det->setFilePath(string(dispReadOutputDir->text().toAscii().constData())); } } diff --git a/slsDetectorGui/src/qTabDebugging.cpp b/slsDetectorGui/src/qTabDebugging.cpp index f0f77af62..6b3beee2d 100644 --- a/slsDetectorGui/src/qTabDebugging.cpp +++ b/slsDetectorGui/src/qTabDebugging.cpp @@ -115,7 +115,7 @@ void qTabDebugging::SetupWidgetWindow(){ if(detType==slsDetectorDefs::MYTHEN) UpdateModuleList(); UpdateStatus(); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabDebugging::SetupWidgetWindow"); } //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -140,7 +140,7 @@ void qTabDebugging::UpdateModuleList(){ cout << "Getting Module List" << endl; #endif det = myDet->getSlsDetector(comboDetector->currentIndex()); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabDebugging::UpdateModuleList"); //deletes all modules except "all modules" for(int i=0;icount()-1;i++) comboModule->removeItem(i); @@ -148,7 +148,7 @@ void qTabDebugging::UpdateModuleList(){ comboModule->addItem(QString("Module %1").arg(i)); } - qDefs::checkErrorMessage(det); + qDefs::checkErrorMessage(det,"qTabDebugging::UpdateModuleList"); } @@ -160,12 +160,12 @@ void qTabDebugging::UpdateStatus(){ cout << "Getting Status" << endl; #endif det = myDet->getSlsDetector(comboDetector->currentIndex()); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabDebugging::UpdateStatus"); int detStatus = (int)det->getRunStatus(); string status = slsDetectorBase::runStatusType(slsDetectorDefs::runStatus(detStatus)); lblStatus->setText(QString(status.c_str()).toUpper()); - qDefs::checkErrorMessage(det); + qDefs::checkErrorMessage(det,"qTabDebugging::UpdateStatus"); } @@ -232,11 +232,11 @@ void qTabDebugging::GetInfo(){ for (int i=0;icount();i++){ QList childItems; det = myDet->getSlsDetector(i); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabDebugging::GetInfo"); for(int j=0;jgetNMods();j++) childItems.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString("Module %1").arg(j)))); treeDet->topLevelItem(i)->insertChildren(0,childItems); - qDefs::checkErrorMessage(det); + qDefs::checkErrorMessage(det,"qTabDebugging::GetInfo"); } break; @@ -357,7 +357,7 @@ void qTabDebugging::SetParameters(QTreeWidgetItem *item){ break; det = myDet->getSlsDetector(i); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabDebugging::SetParameters"); lblDetectorId->setText(comboDetector->itemText(i)); sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SERIAL_NUMBER)); lblDetectorSerial->setText(QString(value)); @@ -365,7 +365,7 @@ void qTabDebugging::SetParameters(QTreeWidgetItem *item){ lblDetectorFirmware ->setText(QString(value)); sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SOFTWARE_VERSION)); lblDetectorSoftware->setText(QString(value)); - qDefs::checkErrorMessage(det); + qDefs::checkErrorMessage(det,"qTabDebugging::SetParameters"); lblModuleId->setText(""); lblModuleSerial->setText(""); @@ -378,7 +378,7 @@ void qTabDebugging::SetParameters(QTreeWidgetItem *item){ int im = item->parent()->indexOfChild(item); det = myDet->getSlsDetector(i); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabDebugging::SetParameters"); lblDetectorId->setText(comboDetector->itemText(i)); sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SERIAL_NUMBER)); lblDetectorSerial->setText(QString(value)); @@ -393,7 +393,7 @@ void qTabDebugging::SetParameters(QTreeWidgetItem *item){ sprintf(value,"%llx",det->getId(slsDetectorDefs::MODULE_FIRMWARE_VERSION,im)); lblModuleFirmware->setText(QString(value)); - qDefs::checkErrorMessage(det); + qDefs::checkErrorMessage(det,"qTabDebugging::SetParameters"); } break; @@ -410,7 +410,7 @@ void qTabDebugging::SetParameters(QTreeWidgetItem *item){ break; det = myDet->getSlsDetector(i); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabDebugging::SetParameters"); lblDetectorId->setText(comboDetector->itemText(i)); sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SERIAL_NUMBER)); lblDetectorSerial->setText(QString(value)); @@ -419,7 +419,7 @@ void qTabDebugging::SetParameters(QTreeWidgetItem *item){ sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SOFTWARE_VERSION)); lblDetectorSoftware->setText(QString(value)); - qDefs::checkErrorMessage(det); + qDefs::checkErrorMessage(det,"qTabDebugging::SetParameters"); } break; @@ -434,7 +434,7 @@ void qTabDebugging::SetParameters(QTreeWidgetItem *item){ break; det = myDet->getSlsDetector(i); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabDebugging::SetParameters"); lblDetectorId->setText(comboDetector->itemText(i)); sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SERIAL_NUMBER)); lblDetectorSerial->setText(QString(value)); @@ -443,7 +443,7 @@ void qTabDebugging::SetParameters(QTreeWidgetItem *item){ sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SOFTWARE_VERSION)); lblDetectorSoftware->setText(QString(value)); - qDefs::checkErrorMessage(det); + qDefs::checkErrorMessage(det,"qTabDebugging::SetParameters"); break; @@ -485,7 +485,7 @@ void qTabDebugging::TestDetector(){ //get sls det object det = myDet->getSlsDetector(comboDetector->currentIndex()); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabDebugging::TestDetector"); //detector firmware if(chkDetectorFirmware->isChecked()){ @@ -542,9 +542,9 @@ void qTabDebugging::TestDetector(){ #endif } //display message - qDefs::Message(qDefs::INFORMATION,message.toAscii().constData(),"Debugging"); + qDefs::Message(qDefs::INFORMATION,message.toAscii().constData(),"qTabDebugging::TestDetector"); - qDefs::checkErrorMessage(det); + qDefs::checkErrorMessage(det,"qTabDebugging::TestDetector"); } diff --git a/slsDetectorGui/src/qTabDeveloper.cpp b/slsDetectorGui/src/qTabDeveloper.cpp index a5b8253ff..45cb171e8 100644 --- a/slsDetectorGui/src/qTabDeveloper.cpp +++ b/slsDetectorGui/src/qTabDeveloper.cpp @@ -113,7 +113,7 @@ void qTabDeveloper::SetupWidgetWindow(){ break; default: - qDefs::Message(qDefs::CRITICAL,string("Unknown detector type:")+myDet->slsDetectorBase::getDetectorType(detType),"Developer"); + qDefs::Message(qDefs::CRITICAL,string("Unknown detector type:")+myDet->slsDetectorBase::getDetectorType(detType),"qTabDeveloper::SetupWidgetWindow"); exit(-1); break; } @@ -175,7 +175,7 @@ void qTabDeveloper::SetupWidgetWindow(){ adcTimer = new QTimer(this); } - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabDeveloper::SetupWidgetWindow"); } //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -244,7 +244,7 @@ void qTabDeveloper::SetDacValues(int id){ #endif spinDacs[id]->setValue((double)myDet->setDAC((dacs_t)spinDacs[id]->value(),getSLSIndex(id))); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabDeveloper::SetDacValues"); } @@ -257,10 +257,10 @@ void qTabDeveloper::SetHighVoltage(){ #endif int highvoltage = comboHV->currentText().toInt(); int ret = myDet->setDAC(highvoltage,slsDetectorDefs::HV_POT); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabDeveloper::SetHighVoltage"); //error if(ret != highvoltage){ - qDefs::Message(qDefs::CRITICAL,"High Voltage could not be set to this value.","Developer"); + qDefs::Message(qDefs::CRITICAL,"High Voltage could not be set to this value.","qTabDeveloper::SetHighVoltage"); lblHV->setPalette(red); lblHV->setText("High Voltage:*"); QString errTip = tipHV+QString("

High Voltage could not be set. The return value is ")+ @@ -290,7 +290,7 @@ slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(int index){ case 4: return slsDetectorDefs::CALIBRATION_PULSE; case 5: return slsDetectorDefs::PREAMP; default: - qDefs::Message(qDefs::CRITICAL,"Unknown DAC/ADC Index. Weird Error","Developer"); + qDefs::Message(qDefs::CRITICAL,"Unknown DAC/ADC Index. Weird Error","qTabDeveloper::getSLSIndex"); Refresh(); break; } @@ -313,14 +313,14 @@ slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(int index){ case 8: return slsDetectorDefs::TEMPERATURE_ADC; case 9:return slsDetectorDefs::TEMPERATURE_FPGA; default: - qDefs::Message(qDefs::CRITICAL,"Unknown DAC/ADC Index. Weird Error","Developer"); + qDefs::Message(qDefs::CRITICAL,"Unknown DAC/ADC Index. Weird Error","qTabDeveloper::getSLSIndex"); Refresh(); break; } break; default: - qDefs::Message(qDefs::CRITICAL,string("Unknown detector type:")+myDet->slsDetectorBase::getDetectorType(detType),"Developer"); - qDefs::checkErrorMessage(myDet); + qDefs::Message(qDefs::CRITICAL,string("Unknown detector type:")+myDet->slsDetectorBase::getDetectorType(detType),"qTabDeveloper::getSLSIndex"); + qDefs::checkErrorMessage(myDet,"qTabDeveloper::getSLSIndex"); exit(-1); break; } @@ -339,7 +339,7 @@ void qTabDeveloper::RefreshAdcs(){ for(int i=0;isetValue((double)myDet->getADC(getSLSIndex(i+NUM_DAC_WIDGETS))); adcTimer->start(ADC_TIMEOUT); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabDeveloper::RefreshAdcs"); } @@ -396,7 +396,7 @@ void qTabDeveloper::Refresh(){ cout << "**Updated Developer Tab" << endl << endl; #endif - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabDeveloper::Refresh"); } diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 2527e8d2d..50effb59a 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -84,7 +84,7 @@ void qTabMeasurement::SetupWidgetWindow(){ iconStart = new QIcon(":/icons/images/start.png"); iconStop = new QIcon(":/icons/images/stop.png"); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabMeasurement::SetupWidgetWindow"); } @@ -104,7 +104,7 @@ void qTabMeasurement::SetExpertMode(bool enable){ cout << "Getting number of probes : " << val << endl; #endif } - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabMeasurement::SetExpertMode"); } @@ -152,7 +152,7 @@ void qTabMeasurement::SetupTimingMode(){ item[(int)Trigger_Window]->setEnabled(false); break; default: - qDefs::Message(qDefs::CRITICAL,"Unknown detector type.","Measurement"); + qDefs::Message(qDefs::CRITICAL,"Unknown detector type.","qTabMeasurement::SetupTimingMode"); exit(-1); break; } @@ -184,7 +184,7 @@ void qTabMeasurement::SetupTimingMode(){ else{ //check if the detector is not even connected string offline = myDet->checkOnline(); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabMeasurement::SetupTimingMode"); if(!offline.empty()){ qDefs::Message(qDefs::CRITICAL,string("The detector(s) ")+offline+string(" is/are not connected. Exiting GUI."),"Main"); @@ -194,12 +194,12 @@ void qTabMeasurement::SetupTimingMode(){ qDefs::Message(qDefs::WARNING,"Unknown Timing Mode detected from detector." "\n\nSetting the following defaults:\nTiming Mode \t: None\n" - "Number of Frames \t: 1\nNumber of Triggers \t: 1","Measurement"); + "Number of Frames \t: 1\nNumber of Triggers \t: 1","qTabMeasurement::SetupTimingMode"); comboTimingMode->setCurrentIndex((int)None); SetTimingMode((int)None); } } - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabMeasurement::SetupTimingMode"); } @@ -291,7 +291,7 @@ void qTabMeasurement::setFileName(const QString& fName){ #ifdef VERBOSE cout << "Setting File name to " << myDet->getFileName() << endl; #endif - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabMeasurement::setFileName"); } @@ -302,7 +302,7 @@ void qTabMeasurement::setRunIndex(int index){ #ifdef VERBOSE cout << "Setting File Index to " << myDet->getFileIndex() << endl; #endif - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabMeasurement::setRunIndex"); } //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -310,11 +310,10 @@ void qTabMeasurement::setRunIndex(int index){ void qTabMeasurement::startStopAcquisition(){ if(btnStartStop->isChecked()){ - if(thisParent->DoesOutputDirExist() == slsDetectorDefs::FAIL){ if(qDefs::Message(qDefs::QUESTION, "Your data will not be saved. Proceed with acquisition anyway?", - "Measurement") == slsDetectorDefs::FAIL){ + "qTabMeasurement::startStopAcquisition") == slsDetectorDefs::FAIL){ disconnect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); btnStartStop->click(); connect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); @@ -361,7 +360,7 @@ void qTabMeasurement::startStopAcquisition(){ btnStartStop->setChecked(false); Enable(1);*/ } - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabMeasurement::startStopAcquisition"); } @@ -386,7 +385,7 @@ void qTabMeasurement::UpdateFinished(){ //} - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabMeasurement::UpdateFinished"); } @@ -417,7 +416,7 @@ void qTabMeasurement::setNumMeasurements(int val){ #ifdef VERBOSE cout << "Setting Number of Measurements to " << (int)myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,-1) << endl; #endif - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabMeasurement::setNumMeasurements"); } @@ -429,7 +428,7 @@ void qTabMeasurement::setNumFrames(int val){ #ifdef VERBOSE cout << "Setting number of frames to " << (int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1) << endl; #endif - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabMeasurement::setNumFrames"); } @@ -461,7 +460,7 @@ void qTabMeasurement::setExposureTime(){ lblPeriod->setText("Acquisition Period:"); } } - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabMeasurement::setExposureTime"); } @@ -492,7 +491,7 @@ void qTabMeasurement::setAcquisitionPeriod(){ lblPeriod->setText("Acquisition Period:"); } - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabMeasurement::setAcquisitionPeriod"); //Check if the interval between plots is ok emit CheckPlotIntervalSignal(); } @@ -506,7 +505,7 @@ void qTabMeasurement::setNumTriggers(int val){ #ifdef VERBOSE cout << "Setting number of triggers to " << (int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1) << endl; #endif - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabMeasurement::setNumTriggers"); } @@ -521,7 +520,7 @@ void qTabMeasurement::setDelay(){ cout << "Setting delay after trigger to " << exptimeNS << " clocks" << "/" << spinDelay->value() << qDefs::getUnitString((qDefs::timeUnit)comboDelayUnit->currentIndex()) << endl; #endif myDet->setTimer(slsDetectorDefs::DELAY_AFTER_TRIGGER,(int64_t)exptimeNS); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabMeasurement::setDelay"); } @@ -533,7 +532,7 @@ void qTabMeasurement::setNumGates(int val){ #ifdef VERBOSE cout << "Setting number of gates to " << (int)myDet->setTimer(slsDetectorDefs::GATES_NUMBER,-1) << endl; #endif - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabMeasurement::setNumGates"); } @@ -545,7 +544,7 @@ void qTabMeasurement::setNumProbes(int val){ #ifdef VERBOSE cout << "Setting number of frames to " << (int)myDet->setTimer(slsDetectorDefs::PROBES_NUMBER,-1) << endl; #endif - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabMeasurement::setNumProbes"); } @@ -631,16 +630,16 @@ void qTabMeasurement::SetTimingMode(int mode){ break; default: //This should never happen - qDefs::Message(qDefs::CRITICAL,"Timing mode unknown to GUI","Measurement"); - qDefs::checkErrorMessage(myDet); + qDefs::Message(qDefs::CRITICAL,"Timing mode unknown to GUI","qTabMeasurement::SetTimingMode"); + qDefs::checkErrorMessage(myDet,"qTabMeasurement::SetTimingMode"); exit(-1); } - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabMeasurement::SetTimingMode"); if(!success){ qDefs::Message(qDefs::WARNING,"The detector timing mode could not be set.\n" "Please check the external flags." "\n\nSetting the following defaults:\nTiming Mode \t: None\n" - "Number of Frames \t: 1\nNumber of Triggers \t: 1","Measurement"); + "Number of Frames \t: 1\nNumber of Triggers \t: 1","qTabMeasurement::SetTimingMode"); comboTimingMode->setCurrentIndex((int)None); return; } @@ -756,7 +755,7 @@ void qTabMeasurement::SetTimingMode(int mode){ myPlot->setFrameEnabled(lblNumFrames->isEnabled()); myPlot->setTriggerEnabled(lblNumTriggers->isEnabled()); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabMeasurement::SetTimingMode"); emit CheckPlotIntervalSignal(); @@ -775,7 +774,7 @@ void qTabMeasurement::EnableFileWrite(bool enable){ dispFileName->setEnabled(enable); if(enable) setFileName(dispFileName->text()); myPlot->SetEnableFileWrite(enable); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabMeasurement::EnableFileWrite"); }; //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -820,7 +819,7 @@ void qTabMeasurement::Refresh(){ myPlot->setFrameEnabled(lblNumFrames->isEnabled()); myPlot->setTriggerEnabled(lblNumTriggers->isEnabled()); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabMeasurement::Refresh"); } #ifdef VERBOSE diff --git a/slsDetectorGui/src/qTabMessages.cpp b/slsDetectorGui/src/qTabMessages.cpp index ce13a24b2..9ac96237d 100644 --- a/slsDetectorGui/src/qTabMessages.cpp +++ b/slsDetectorGui/src/qTabMessages.cpp @@ -103,9 +103,9 @@ void qTabMessages::SaveLog() { QTextStream out(&outfile); out<toPlainText() << endl; qDefs::Message(qDefs::INFORMATION,string("The Log has been successfully saved to " - "")+fName.toAscii().constData(),"Messages"); + "")+fName.toAscii().constData(),"qTabMessages::SaveLog"); } - else qDefs::Message(qDefs::WARNING,"Attempt to save log file failed.","Messages"); + else qDefs::Message(qDefs::WARNING,"Attempt to save log file failed.","qTabMessages::SaveLog"); } } diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index e8343d9d4..076b96327 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -182,7 +182,7 @@ void qTabPlot::SetupWidgetWindow(){ //to check if this should be enabled EnableScanBox(); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabPlot::SetupWidgetWindow"); } @@ -564,7 +564,7 @@ void qTabPlot::SetFrequency(){ if(acqPeriodMS==0){ qDefs::Message(qDefs::WARNING,"Interval between Plots:
" "Every Nth Image: Period betwen Frames and Exposure Time cannot both be 0 ms.
" - "Resetting to minimum plotting time interval","Plot"); + "Resetting to minimum plotting time interval","qTabPlot::SetFrequency"); comboFrequency->setCurrentIndex(0); stackedLayout->setCurrentIndex(comboFrequency->currentIndex()); spinTimeGap->setValue(minPlotTimer); @@ -579,7 +579,7 @@ void qTabPlot::SetFrequency(){ connect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetFrequency())); connect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency())); connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency())); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabPlot::SetFrequency"); return; } } @@ -593,7 +593,7 @@ void qTabPlot::SetFrequency(){ if((int)timeMS==0){ qDefs::Message(qDefs::WARNING,"Interval between Plots:
" - "Time Interval must be atleast >= 1 ms. Resetting to minimum plotting time interval.","Plot"); + "Time Interval must be atleast >= 1 ms. Resetting to minimum plotting time interval.","qTabPlot::SetFrequency"); spinTimeGap->setValue(minPlotTimer); comboTimeGapUnit->setCurrentIndex(qDefs::MILLISECONDS); timeMS=minPlotTimer; @@ -676,7 +676,7 @@ void qTabPlot::SetFrequency(){ connect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency())); connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency())); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabPlot::SetFrequency"); } @@ -697,7 +697,7 @@ void qTabPlot::EnableScanBox(){ //none of these scan plotting options make sense if positions exists bool positionsExist = myDet->getAngularConversion(ang);//myDet->getPositions(); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabPlot::EnableScanBox"); //only now enable/disable boxScan->setEnabled((mode0||mode1)&&(!positionsExist)); @@ -789,7 +789,7 @@ void qTabPlot::EnablingNthFrameFunction(bool enable){ } //------------------------------------------------------------------------------------------------------------------------------------------------- -/** What happens for 2d????*/ + void qTabPlot::SetScanArgument(){ bool histogram = radioHistogram->isChecked(); @@ -886,7 +886,7 @@ void qTabPlot::SetScanArgument(){ }else //done here so that it isnt set by default each time myPlot->SetScanArgument(qDefs::None); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabPlot::SetScanArgument"); } diff --git a/slsDetectorGui/src/qTabSettings.cpp b/slsDetectorGui/src/qTabSettings.cpp index 5bb25be11..2989be257 100644 --- a/slsDetectorGui/src/qTabSettings.cpp +++ b/slsDetectorGui/src/qTabSettings.cpp @@ -66,7 +66,7 @@ void qTabSettings::SetupWidgetWindow(){ default: comboDynamicRange->setCurrentIndex(0); break; } - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabSettings::SetupWidgetWindow"); } //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -74,7 +74,7 @@ void qTabSettings::SetupWidgetWindow(){ void qTabSettings::SetupDetectorSettings(){ // Get detector settings from detector slsDetectorDefs::detectorSettings sett = myDet->getSettings(); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabSettings::SetupDetectorSettings"); if(sett==-1) sett = slsDetectorDefs::UNDEFINED; // To be able to index items on a combo box model = qobject_cast(comboSettings->model()); @@ -114,7 +114,7 @@ void qTabSettings::SetupDetectorSettings(){ item[(int)VeryHighGain]->setEnabled(true); break; default: - qDefs::Message(qDefs::CRITICAL,"Unknown detector type. Exiting GUI.","Settings"); + qDefs::Message(qDefs::CRITICAL,"Unknown detector type. Exiting GUI.","qTabSettings::SetupDetectorSettings"); exit(-1); break; } @@ -122,7 +122,7 @@ void qTabSettings::SetupDetectorSettings(){ // This should not happen -only if the server and gui has a mismatch // on which all modes are allowed in detectors if(!(item[(int)sett]->isEnabled())){ - qDefs::Message(qDefs::CRITICAL,"Unknown Detector Settings retrieved from detector. Exiting GUI.","Settings"); + qDefs::Message(qDefs::CRITICAL,"Unknown Detector Settings retrieved from detector. Exiting GUI.","qTabSettings::SetupDetectorSettings"); #ifdef VERBOSE cout << "ERROR: Unknown Detector Settings retrieved from detector." << endl; #endif @@ -151,7 +151,7 @@ void qTabSettings::Initialization(){ void qTabSettings::setSettings(int index){ //dont set it if settings is set to undefined or uninitialized if((index==Undefined)||(index==Uninitialized)){ - qDefs::Message(qDefs::WARNING,"Cannot change settings to Undefined or Uninitialized.","Settings"); + qDefs::Message(qDefs::WARNING,"Cannot change settings to Undefined or Uninitialized.","qTabSettings::setSettings"); disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int))); int sett = (int)myDet->getSettings(); if(sett==-1) sett = slsDetectorDefs::UNDEFINED; @@ -175,7 +175,7 @@ void qTabSettings::setSettings(int index){ } } - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabSettings::setSettings"); } //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -186,13 +186,13 @@ void qTabSettings::SetNumberOfModules(int index){ #endif int i = myDet->setNumberOfModules(index); if(index!=i) - qDefs::Message(qDefs::WARNING,"Number of modules cannot be set for this value.","Settings"); + qDefs::Message(qDefs::WARNING,"Number of modules cannot be set for this value.","qTabSettings::SetNumberOfModules"); #ifdef VERBOSE cout << "ERROR: Setting number of modules to "<< i << endl; #endif spinNumModules->setValue(i); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabSettings::SetNumberOfModules"); } //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -213,7 +213,7 @@ void qTabSettings::SetDynamicRange(int index){ cout << "Setting dynamic range to "<< dr << endl; #endif if(ret!=dr){ - qDefs::Message(qDefs::WARNING,"Dynamic Range cannot be set to this value.","Settings"); + qDefs::Message(qDefs::WARNING,"Dynamic Range cannot be set to this value.","qTabSettings::SetDynamicRange"); #ifdef VERBOSE cout << "ERROR: Setting dynamic range to "<< ret << endl; #endif @@ -227,7 +227,7 @@ void qTabSettings::SetDynamicRange(int index){ } } - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabSettings::SetDynamicRange"); } @@ -242,13 +242,13 @@ void qTabSettings::SetEnergy(){ myDet->setThresholdEnergy(index); int ret = (int)myDet->getThresholdEnergy(); if((ret-index)>200){ - qDefs::Message(qDefs::WARNING,"Threshold energy could not be set. The difference is greater than 200.","Settings"); + qDefs::Message(qDefs::WARNING,"Threshold energy could not be set. The difference is greater than 200.","qTabSettings::SetEnergy"); } disconnect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy())); spinThreshold->setValue(ret); connect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy())); - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabSettings::SetEnergy"); } @@ -314,7 +314,7 @@ void qTabSettings::Refresh(){ cout << "**Updated Settings Tab" << endl << endl; #endif - qDefs::checkErrorMessage(myDet); + qDefs::checkErrorMessage(myDet,"qTabSettings::Refresh"); } From 4f2f7639afb4030ca12d60d9eaf74851e2ae4316 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 30 Jul 2013 14:55:17 +0000 Subject: [PATCH 214/332] changed the start and stop receiver error messages to be displayed to the client and not jsus recever git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@214 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qDefs.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/slsDetectorGui/include/qDefs.h b/slsDetectorGui/include/qDefs.h index 40abeb58b..befee43db 100644 --- a/slsDetectorGui/include/qDefs.h +++ b/slsDetectorGui/include/qDefs.h @@ -146,19 +146,19 @@ static const int64_t GUI_VERSION=0x20121213; static QMessageBox* msgBox; switch(index){ case WARNING: - source.append(": WARNING"); + source.insert(0,"WARNING: #"); msgBox= new QMessageBox(QMessageBox::Warning,source.c_str(),tr(message.c_str()),QMessageBox::Ok, msgBox); break; case CRITICAL: - source.append(": CRITICAL"); + source.insert(0,"CRITICAL: #"); msgBox= new QMessageBox(QMessageBox::Critical,source.c_str(),tr(message.c_str()),QMessageBox::Ok, msgBox); break; case INFORMATION: - source.append(": INFORMATION"); + source.insert(0,"INFORMATION: #"); msgBox= new QMessageBox(QMessageBox::Information,source.c_str(),tr(message.c_str()),QMessageBox::Ok, msgBox); break; default: - source.append(": QUESTION"); + source.insert(0,"QUESTION: #"); msgBox= new QMessageBox(QMessageBox::Question,source.c_str(),tr(message.c_str()),QMessageBox::Ok| QMessageBox::Cancel, msgBox); break; } From 2c8df98bf89186fbbef5a9ae0471ed8ecb85ad5a Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Mon, 5 Aug 2013 14:57:40 +0000 Subject: [PATCH 215/332] included the error message source to debug errors because of too many slots and signals git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@215 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qDefs.h | 28 +++++++++++++++++----------- slsDetectorGui/src/qDetectorMain.cpp | 2 +- slsDetectorGui/src/qTabMessages.cpp | 1 - 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/slsDetectorGui/include/qDefs.h b/slsDetectorGui/include/qDefs.h index befee43db..84801f912 100644 --- a/slsDetectorGui/include/qDefs.h +++ b/slsDetectorGui/include/qDefs.h @@ -15,6 +15,7 @@ #include #include #include +#include using namespace std; class qDefs:public QWidget{ @@ -144,28 +145,27 @@ static const int64_t GUI_VERSION=0x20121213; static int Message(MessageIndex index, string message,string source) { static QMessageBox* msgBox; + + message.append(string("

Source:   ") + source + string("

")); + switch(index){ case WARNING: - source.insert(0,"WARNING: #"); - msgBox= new QMessageBox(QMessageBox::Warning,source.c_str(),tr(message.c_str()),QMessageBox::Ok, msgBox); + msgBox= new QMessageBox(QMessageBox::Warning,"WARNING",tr(message.c_str()),QMessageBox::Ok, msgBox); break; case CRITICAL: - source.insert(0,"CRITICAL: #"); - msgBox= new QMessageBox(QMessageBox::Critical,source.c_str(),tr(message.c_str()),QMessageBox::Ok, msgBox); + msgBox= new QMessageBox(QMessageBox::Critical,"CRITICAL",tr(message.c_str()),QMessageBox::Ok, msgBox); break; case INFORMATION: - source.insert(0,"INFORMATION: #"); - msgBox= new QMessageBox(QMessageBox::Information,source.c_str(),tr(message.c_str()),QMessageBox::Ok, msgBox); + msgBox= new QMessageBox(QMessageBox::Information,"INFORMATION",tr(message.c_str()),QMessageBox::Ok, msgBox); break; default: - source.insert(0,"QUESTION: #"); - msgBox= new QMessageBox(QMessageBox::Question,source.c_str(),tr(message.c_str()),QMessageBox::Ok| QMessageBox::Cancel, msgBox); + msgBox= new QMessageBox(QMessageBox::Question,"QUESTION",tr(message.c_str()),QMessageBox::Ok| QMessageBox::Cancel, msgBox); break; } + //msgBox->setDetailedText(QString(source.c_str())); //close button doesnt work with this static function and this if(msgBox->exec()==QMessageBox::Ok) return OK; else return FAIL; } - //------------------------------------------------------------------------------------------------------------------------------------------------- /** range of x and y axes @@ -194,7 +194,6 @@ static const int64_t GUI_VERSION=0x20121213; retval = myDet->getErrorMessage(errorLevel); if(!retval.empty()){ - //replace all \n with
pos = 0; while((pos = retval.find("\n", pos)) != string::npos){ @@ -202,6 +201,10 @@ static const int64_t GUI_VERSION=0x20121213; pos += 1; } + //get rid of the last \n + if(retval.find_last_of("
")==retval.length()-1) + retval.erase((int)retval.find_last_of("
")-3,4); + retval.insert(0,""); retval.append("
"); @@ -233,7 +236,6 @@ static const int64_t GUI_VERSION=0x20121213; retval = myDet->getErrorMessage(emask); if(!retval.empty()){ - //replace all \n with
pos = 0; while((pos = retval.find("\n", pos)) != string::npos){ @@ -241,6 +243,10 @@ static const int64_t GUI_VERSION=0x20121213; pos += 1; } + //get rid of the last \n + if(retval.find_last_of("
")==retval.length()-1) + retval.erase((int)retval.find_last_of("
")-3,4); + retval.insert(0,""); retval.append(""); diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 1ebcf5ce7..fd9bc11c3 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -318,7 +318,7 @@ void qDetectorMain::LoadConfigFile(const string fName){ else{ //could not load config file if(myDet->readConfigurationFile(fName)==slsDetectorDefs::FAIL) - qDefs::Message(qDefs::WARNING,string("Could not load all the Configuration Parameters from file:\n")+fName,"qDetectorMain::LoadConfigFile"); + qDefs::Message(qDefs::WARNING,string("Could not load all the Configuration Parameters from file:
")+fName,"qDetectorMain::LoadConfigFile"); //successful else qDefs::Message(qDefs::INFORMATION,"
The Configuration Parameters have been loaded successfully at start up.","qDetectorMain::LoadConfigFile"); diff --git a/slsDetectorGui/src/qTabMessages.cpp b/slsDetectorGui/src/qTabMessages.cpp index 9ac96237d..9287cacf2 100644 --- a/slsDetectorGui/src/qTabMessages.cpp +++ b/slsDetectorGui/src/qTabMessages.cpp @@ -91,7 +91,6 @@ void qTabMessages::customEvent(QEvent *e) { //------------------------------------------------------------------------------------------------------------------------------------------------- void qTabMessages::SaveLog() { - //cerr<GetFilePath()); fName = fName+"/LogFile.txt"; fName = QFileDialog::getSaveFileName(this,tr("Save Snapshot "), From ae35542193718edc72e07f215ea90acbdf5df53c Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Mon, 5 Aug 2013 15:36:36 +0000 Subject: [PATCH 216/332] ask before disabling file write and fixed the ccorrect source for it git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@216 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qTabDataOutput.cpp | 2 +- slsDetectorGui/src/qTabMeasurement.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index 5c4beff33..758887a60 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -633,7 +633,7 @@ int qTabDataOutput::VerifyOutputDirectory(){ #ifdef VERBOSE cout << "The output path doesnt exist anymore" << endl; #endif - qDefs::Message(qDefs::WARNING,string("Invalid Output Directory ")+ mess ,"qTabDataOutput::SetAngularCorrection"); + qDefs::Message(qDefs::WARNING,string("Invalid Output Directory ")+ mess ,"qTabDataOutput::VerifyOutputDirectory"); dispReadOutputDir->setPalette(*red1); boxOutDir->setPalette(red); diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 50effb59a..085959aee 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -310,9 +310,11 @@ void qTabMeasurement::setRunIndex(int index){ void qTabMeasurement::startStopAcquisition(){ if(btnStartStop->isChecked()){ - if(thisParent->DoesOutputDirExist() == slsDetectorDefs::FAIL){ + + //if file write enabled and output dir doesnt exist + if((chkFile->isChecked())&&(thisParent->DoesOutputDirExist() == slsDetectorDefs::FAIL)){ if(qDefs::Message(qDefs::QUESTION, - "Your data will not be saved. Proceed with acquisition anyway?", + "Your data will not be saved.
Disable File write and Proceed with acquisition anyway?", "qTabMeasurement::startStopAcquisition") == slsDetectorDefs::FAIL){ disconnect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); btnStartStop->click(); From 35d7359403d9554bda77356380a36b45fae8c4e9 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 6 Aug 2013 07:22:50 +0000 Subject: [PATCH 217/332] qdefs message changed everything from \n to
, helps for gray source as html git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@217 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qDefs.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/slsDetectorGui/include/qDefs.h b/slsDetectorGui/include/qDefs.h index 84801f912..02710c710 100644 --- a/slsDetectorGui/include/qDefs.h +++ b/slsDetectorGui/include/qDefs.h @@ -145,7 +145,14 @@ static const int64_t GUI_VERSION=0x20121213; static int Message(MessageIndex index, string message,string source) { static QMessageBox* msgBox; + size_t pos; + //replace all \n with
+ pos = 0; + while((pos = message.find("\n", pos)) != string::npos){ + message.replace(pos, 1, "
"); + pos += 1; + } message.append(string("

Source:   ") + source + string("

")); switch(index){ From d6dccef65c4a02dbb91817878bfea12bcfc90724 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 7 Aug 2013 09:36:42 +0000 Subject: [PATCH 218/332] added the tip that probes are enabled only in expert mode git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@218 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_measurement.ui | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_measurement.ui b/slsDetectorGui/forms/form_tab_measurement.ui index cf5327d4c..fc31c2344 100644 --- a/slsDetectorGui/forms/form_tab_measurement.ui +++ b/slsDetectorGui/forms/form_tab_measurement.ui @@ -423,8 +423,7 @@ - The data are accumulated over several (frames) pump-cycles. Set cycles to 1. -#probes# + <nobr>The data are accumulated over several (frames) pump-cycles. Set cycles to 1.</nobr><br> <b>Available only in Expert Mode.</b><br>#probes# Number of Probes: @@ -443,8 +442,8 @@ - The data are accumulated over several (frames) pump-cycles. Set cycles to 1. -#probes# + <nobr>The data are accumulated over several (frames) pump-cycles. Set cycles to 1.</nobr><br> <b>Available only in Expert Mode.</b><br>#probes# + From daae091945453a7970d22695b485aa00e62eed5d Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Thu, 8 Aug 2013 09:53:28 +0000 Subject: [PATCH 219/332] a HUGE number of changes in measurement tab, and changes probes to be still disabled until #frames>1 and set cycles to 1 if probes >1 git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@219 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_measurement.ui | 27 +- slsDetectorGui/include/qTabMeasurement.h | 13 +- slsDetectorGui/include/svnInfoGui.h | 6 +- slsDetectorGui/src/qTabMeasurement.cpp | 529 +++++++++++-------- 4 files changed, 329 insertions(+), 246 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_measurement.ui b/slsDetectorGui/forms/form_tab_measurement.ui index fc31c2344..425bfdfc8 100644 --- a/slsDetectorGui/forms/form_tab_measurement.ui +++ b/slsDetectorGui/forms/form_tab_measurement.ui @@ -423,7 +423,19 @@ - <nobr>The data are accumulated over several (frames) pump-cycles. Set cycles to 1.</nobr><br> <b>Available only in Expert Mode.</b><br>#probes# + <nobr> +The data are accumulated over several (frames) pump cycles. +</nobr> +<br> +<nobr> <b> +Enabled only in Expert Mode and if Number of Frames > 1. +</b></nobr> +<br> +<nobr>Setting Number of Probes will reset Number of Triggers to 1. +</nobr> +<br> +#probes# + Number of Probes: @@ -442,7 +454,18 @@ - <nobr>The data are accumulated over several (frames) pump-cycles. Set cycles to 1.</nobr><br> <b>Available only in Expert Mode.</b><br>#probes# + <nobr> +The data are accumulated over several (frames) pump cycles. +</nobr> +<br> +<nobr> <b> +Enabled only in Expert Mode and if Number of Frames > 1. +</b></nobr> +<br> +<nobr>Setting Number of Probes will reset Number of Triggers to 1. +</nobr> +<br> +#probes# diff --git a/slsDetectorGui/include/qTabMeasurement.h b/slsDetectorGui/include/qTabMeasurement.h index 4788fbb5d..23717717d 100644 --- a/slsDetectorGui/include/qTabMeasurement.h +++ b/slsDetectorGui/include/qTabMeasurement.h @@ -87,21 +87,16 @@ private: void SetupTimingMode(); /** Sets up all the slots and signals - * @param timingChange only some of the signals are disconnected when timing mode is changed - * This method is to reconnect them again. */ - void Initialization(int timingChange=0); - - /** Disconnects all the slots and signals (which depend on timing mode) - * to retrieve all the parameters from client. - * This is done only when Timing mode is changed - */ - void DeInitialization(); + void Initialization(); /** Enables/Disables all the widgets */ void Enable(bool enable); + /** Validates before enabling or disabling probes */ + void EnableProbes(); + private slots: /** Sets the timing mode diff --git a/slsDetectorGui/include/svnInfoGui.h b/slsDetectorGui/include/svnInfoGui.h index d1d10ecaf..066d56873 100644 --- a/slsDetectorGui/include/svnInfoGui.h +++ b/slsDetectorGui/include/svnInfoGui.h @@ -2,10 +2,10 @@ #define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui" //#define SVNREPPATH "" #define SVNREPUUID "af1100a4-978c-4157-bff7-07162d2ba061" -//#define SVNREV 0x200 +//#define SVNREV 0x218 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "l_maliakal_d" -#define SVNREV 0x200 -#define SVNDATE 0x20130711 +#define SVNREV 0x218 +#define SVNDATE 0x20130807 // diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 085959aee..dab5f6e11 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -49,15 +49,48 @@ qTabMeasurement::~qTabMeasurement(){ void qTabMeasurement::SetupWidgetWindow(){ //Number of measurements spinNumMeasurements->setValue((int)myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,-1)); - - //Timer to update the progress bar - progressTimer = new QTimer(this); - //btnStartStop->setStyleSheet("color:green"); + //Number of frames + spinNumFrames->setValue((int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1)); //Exp Time qDefs::timeUnit unit; double time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-9)))); spinExpTime->setValue(time); comboExpUnit->setCurrentIndex((int)unit); + //period + time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,-1)*(1E-9)))); + spinPeriod->setValue(time); + comboPeriodUnit->setCurrentIndex((int)unit); + //Number of Triggers + spinNumTriggers->setValue((int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1)); + //delay + time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::DELAY_AFTER_TRIGGER,-1)*(1E-9)))); + spinDelay->setValue(time); + comboDelayUnit->setCurrentIndex((int)unit); + //gates + spinNumGates->setValue((int)myDet->setTimer(slsDetectorDefs::GATES_NUMBER,-1)); + //probes + spinNumProbes->setValue((int)myDet->setTimer(slsDetectorDefs::PROBES_NUMBER,-1)); + //File Name + dispFileName->setText(QString(myDet->getFileName().c_str())); + //File Index + spinIndex->setValue(myDet->getFileIndex()); + //only initially + lblProgressIndex->setText(QString::number(0)); + //ly initially + progressBar->setValue(0); + //file write enabled/disabled + chkFile->setChecked(myDet->enableWriteToFile()); + dispFileName->setEnabled(myDet->enableWriteToFile()); + + + //creating the icons for the buttons + iconStart = new QIcon(":/icons/images/start.png"); + iconStop = new QIcon(":/icons/images/stop.png"); + + + //Timer to update the progress bar + progressTimer = new QTimer(this); + //Hide the error message red = QPalette(); red.setColor(QPalette::Active,QPalette::WindowText,Qt::red); @@ -67,25 +100,7 @@ void qTabMeasurement::SetupWidgetWindow(){ QString("Acquisition Period should be" " greater than or equal to Exposure Time."); - //File Name - dispFileName->setText(QString(myDet->getFileName().c_str())); - //File Index - spinIndex->setValue(myDet->getFileIndex()); - //only initially - lblProgressIndex->setText(QString::number(0)); - //ly initially - progressBar->setValue(0); - - //file write enabled/disabled - chkFile->setChecked(myDet->enableWriteToFile()); - dispFileName->setEnabled(myDet->enableWriteToFile()); - - //creating the icons for the buttons - iconStart = new QIcon(":/icons/images/start.png"); - iconStop = new QIcon(":/icons/images/stop.png"); - qDefs::checkErrorMessage(myDet,"qTabMeasurement::SetupWidgetWindow"); - } @@ -94,17 +109,9 @@ void qTabMeasurement::SetupWidgetWindow(){ void qTabMeasurement::SetExpertMode(bool enable){ expertMode = enable; - lblNumProbes->setEnabled(enable); - spinNumProbes->setEnabled(enable); - //Number of Probes - if((enable)&&(myDet->getDetectorsType()==slsDetectorDefs::MYTHEN)){ - int val = (int)myDet->setTimer(slsDetectorDefs::PROBES_NUMBER,-1); - spinNumProbes->setValue(val); -#ifdef VERBOSE - cout << "Getting number of probes : " << val << endl; -#endif - } qDefs::checkErrorMessage(myDet,"qTabMeasurement::SetExpertMode"); + + EnableProbes(); } @@ -163,8 +170,8 @@ void qTabMeasurement::SetupTimingMode(){ // then the timing mode is 'None'. // This is for the inexperienced user if(mode==slsDetectorDefs::AUTO_TIMING){ - int frames = (int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1); - int triggers = (int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1); + int frames = spinNumFrames->value(); + int triggers = spinNumTriggers->value(); if((frames==1)&&(triggers==1)){ comboTimingMode->setCurrentIndex((int)None); SetTimingMode((int)None); @@ -206,24 +213,21 @@ void qTabMeasurement::SetupTimingMode(){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void qTabMeasurement::Initialization(int timingChange){ - //These signals are connected only at start up. The others are reinitialized when changing timing mode - if(!timingChange){ - //Number of Measurements - connect(spinNumMeasurements,SIGNAL(valueChanged(int)), this, SLOT(setNumMeasurements(int))); - //File Name - connect(dispFileName, SIGNAL(textChanged(const QString&)),this, SLOT(setFileName(const QString&))); - //File Index - connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int))); - //Start/Stop Acquisition - connect(btnStartStop, SIGNAL(clicked()), this, SLOT(startStopAcquisition())); - //Timing Mode - connect(comboTimingMode, SIGNAL(currentIndexChanged(int)), this, SLOT(SetTimingMode(int)));// - //progress bar - connect(progressTimer, SIGNAL(timeout()), this, SLOT(UpdateProgress())); - //enable write to file - connect(chkFile, SIGNAL(toggled(bool)), this, SLOT(EnableFileWrite(bool))); - } +void qTabMeasurement::Initialization(){ + //Number of Measurements + connect(spinNumMeasurements,SIGNAL(valueChanged(int)), this, SLOT(setNumMeasurements(int))); + //File Name + connect(dispFileName, SIGNAL(textChanged(const QString&)),this, SLOT(setFileName(const QString&))); + //File Index + connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int))); + //Start/Stop Acquisition + connect(btnStartStop, SIGNAL(clicked()), this, SLOT(startStopAcquisition())); + //Timing Mode + connect(comboTimingMode, SIGNAL(currentIndexChanged(int)), this, SLOT(SetTimingMode(int)));// + //progress bar + connect(progressTimer, SIGNAL(timeout()), this, SLOT(UpdateProgress())); + //enable write to file + connect(chkFile, SIGNAL(toggled(bool)), this, SLOT(EnableFileWrite(bool))); //Number of Frames connect(spinNumFrames,SIGNAL(valueChanged(int)), this, SLOT(setNumFrames(int))); //Exposure Time @@ -247,37 +251,10 @@ void qTabMeasurement::Initialization(int timingChange){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void qTabMeasurement::DeInitialization(){ - //Number of Frames - disconnect(spinNumFrames,SIGNAL(valueChanged(int)), this, SLOT(setNumFrames(int))); - //Exposure Time - disconnect(spinExpTime,SIGNAL(valueChanged(double)), this, SLOT(setExposureTime()));//..myplot - disconnect(comboExpUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setExposureTime())); - //Frame Period between exposures - disconnect(spinPeriod,SIGNAL(valueChanged(double)), this, SLOT(setAcquisitionPeriod()));//..myplot - disconnect(comboPeriodUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setAcquisitionPeriod())); - //Number of Triggers - disconnect(spinNumTriggers,SIGNAL(valueChanged(int)), this, SLOT(setNumTriggers(int))); - //Delay After Trigger - disconnect(spinDelay,SIGNAL(valueChanged(double)), this, SLOT(setDelay())); - disconnect(comboDelayUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setDelay())); - //Number of Gates - disconnect(spinNumGates,SIGNAL(valueChanged(int)), this, SLOT(setNumGates(int))); - //Number of Probes - disconnect(spinNumProbes,SIGNAL(valueChanged(int)), this, SLOT(setNumProbes(int))); -} - - -//------------------------------------------------------------------------------------------------------------------------------------------------- - - void qTabMeasurement::Enable(bool enable){ frameTimeResolved->setEnabled(enable); frameNotTimeResolved->setEnabled(enable); - //Enable this always - //if(!enable) btnStartStop->setEnabled(true); - //shortcut each time, else it doesnt work a second time btnStartStop->setShortcut(QApplication::translate("TabMeasurementObject", "Shift+Space", 0, QApplication::UnicodeUTF8)); } @@ -286,28 +263,6 @@ void qTabMeasurement::Enable(bool enable){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void qTabMeasurement::setFileName(const QString& fName){ - myDet->setFileName(fName.toAscii().data()); -#ifdef VERBOSE - cout << "Setting File name to " << myDet->getFileName() << endl; -#endif - qDefs::checkErrorMessage(myDet,"qTabMeasurement::setFileName"); -} - - -//------------------------------------------------------------------------------------------------------------------------------------------------- - -void qTabMeasurement::setRunIndex(int index){ - myDet->setFileIndex(index); -#ifdef VERBOSE - cout << "Setting File Index to " << myDet->getFileIndex() << endl; -#endif - qDefs::checkErrorMessage(myDet,"qTabMeasurement::setRunIndex"); -} - -//------------------------------------------------------------------------------------------------------------------------------------------------- - - void qTabMeasurement::startStopAcquisition(){ if(btnStartStop->isChecked()){ @@ -349,14 +304,12 @@ void qTabMeasurement::startStopAcquisition(){ myDet->stopAcquisition(); /* commented out to prevent undefined state myDet->waitForReceiverReadToFinish(); - UpdateProgress(); //spin index disconnect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int))); spinIndex->setValue(myDet->getFileIndex()); connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int))); progressTimer->stop(); - btnStartStop->setText("Start"); btnStartStop->setIcon(*iconStart); btnStartStop->setChecked(false); @@ -370,23 +323,18 @@ void qTabMeasurement::startStopAcquisition(){ void qTabMeasurement::UpdateFinished(){ - //if(btnStartStop->isChecked()){ + UpdateProgress(); + disconnect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int))); + spinIndex->setValue(myDet->getFileIndex()); + connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int))); + progressTimer->stop(); - UpdateProgress(); - disconnect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int))); - spinIndex->setValue(myDet->getFileIndex()); - connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int))); - progressTimer->stop(); - - disconnect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); - btnStartStop->setText("Start"); - btnStartStop->setIcon(*iconStart); - btnStartStop->setChecked(false); - Enable(1); - connect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); - - - //} + disconnect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); + btnStartStop->setText("Start"); + btnStartStop->setIcon(*iconStart); + btnStartStop->setChecked(false); + Enable(1); + connect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); qDefs::checkErrorMessage(myDet,"qTabMeasurement::UpdateFinished"); } @@ -413,11 +361,48 @@ void qTabMeasurement::UpdateProgress(){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void qTabMeasurement::setNumMeasurements(int val){ - myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,val); +void qTabMeasurement::setFileName(const QString& fName){ #ifdef VERBOSE - cout << "Setting Number of Measurements to " << (int)myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,-1) << endl; + cout << "Setting File name to " << fName.toAscii().constData() << endl; #endif + myDet->setFileName(fName.toAscii().data()); + + disconnect(dispFileName, SIGNAL(textChanged(const QString&)),this, SLOT(setFileName(const QString&))); + dispFileName->setText(QString(myDet->getFileName().c_str())); + connect(dispFileName, SIGNAL(textChanged(const QString&)),this, SLOT(setFileName(const QString&))); + + qDefs::checkErrorMessage(myDet,"qTabMeasurement::setFileName"); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + +void qTabMeasurement::setRunIndex(int index){ +#ifdef VERBOSE + cout << "Setting File Index to " << index << endl; +#endif + myDet->setFileIndex(index); + + disconnect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int))); + spinIndex->setValue(myDet->getFileIndex()); + connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int))); + + qDefs::checkErrorMessage(myDet,"qTabMeasurement::setRunIndex"); +} + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabMeasurement::setNumMeasurements(int val){ +#ifdef VERBOSE + cout << "Setting Number of Measurements to " << val << endl; +#endif + myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,val); + + disconnect(spinNumMeasurements,SIGNAL(valueChanged(int)), this, SLOT(setNumMeasurements(int))); + spinNumMeasurements->setValue((int)myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,-1)); + connect(spinNumMeasurements,SIGNAL(valueChanged(int)), this, SLOT(setNumMeasurements(int))); + qDefs::checkErrorMessage(myDet,"qTabMeasurement::setNumMeasurements"); } @@ -426,11 +411,18 @@ void qTabMeasurement::setNumMeasurements(int val){ void qTabMeasurement::setNumFrames(int val){ - myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,val); #ifdef VERBOSE - cout << "Setting number of frames to " << (int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1) << endl; + cout << "Setting number of frames to " << val << endl; #endif + myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,val); + + disconnect(spinNumFrames,SIGNAL(valueChanged(int)), this, SLOT(setNumFrames(int))); + spinNumFrames->setValue((int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1)); + connect(spinNumFrames,SIGNAL(valueChanged(int)), this, SLOT(setNumFrames(int))); + qDefs::checkErrorMessage(myDet,"qTabMeasurement::setNumFrames"); + + EnableProbes(); } @@ -438,17 +430,28 @@ void qTabMeasurement::setNumFrames(int val){ void qTabMeasurement::setExposureTime(){ - double exptimeNS; //Get the value of timer in ns - exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value()); + double exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value()); #ifdef VERBOSE cout << "Setting acquisition time to " << exptimeNS << " clocks" << "/" << spinExpTime->value() << qDefs::getUnitString((qDefs::timeUnit)comboExpUnit->currentIndex()) << endl; #endif myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,(int64_t)exptimeNS); + //updating value set + disconnect(spinExpTime,SIGNAL(valueChanged(double)), this, SLOT(setExposureTime())); + disconnect(comboExpUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setExposureTime())); + qDefs::timeUnit unit; + double time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-9)))); + spinExpTime->setValue(time); + comboExpUnit->setCurrentIndex((int)unit); + connect(spinExpTime,SIGNAL(valueChanged(double)), this, SLOT(setExposureTime())); + connect(comboExpUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setExposureTime())); + + //could be different if it didnt work + exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value()); + if(lblPeriod->isEnabled()){ - double acqtimeNS; - acqtimeNS = qDefs::getNSTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value()); + double acqtimeNS = qDefs::getNSTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value()); if(exptimeNS>acqtimeNS) { spinPeriod->setToolTip(errPeriodTip); lblPeriod->setToolTip(errPeriodTip); @@ -470,16 +473,27 @@ void qTabMeasurement::setExposureTime(){ void qTabMeasurement::setAcquisitionPeriod(){ - double acqtimeNS; //Get the value of timer in ns - acqtimeNS = qDefs::getNSTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value()); + double acqtimeNS = qDefs::getNSTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value()); #ifdef VERBOSE cout << "Setting frame period between exposures to " << acqtimeNS << " clocks"<< "/" << spinPeriod->value() << qDefs::getUnitString((qDefs::timeUnit)comboPeriodUnit->currentIndex()) << endl; #endif myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,(int64_t)acqtimeNS); - double exptimeNS; - exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value()); + //updating value set + disconnect(spinPeriod,SIGNAL(valueChanged(double)), this, SLOT(setAcquisitionPeriod())); + disconnect(comboPeriodUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setAcquisitionPeriod())); + qDefs::timeUnit unit; + double time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,-1)*(1E-9)))); + spinPeriod->setValue(time); + comboPeriodUnit->setCurrentIndex((int)unit); + connect(spinPeriod,SIGNAL(valueChanged(double)), this, SLOT(setAcquisitionPeriod())); + connect(comboPeriodUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setAcquisitionPeriod())); + + //could be different if it didnt work + acqtimeNS = qDefs::getNSTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value()); + + double exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value()); if(exptimeNS>acqtimeNS){ spinPeriod->setToolTip(errPeriodTip); lblPeriod->setToolTip(errPeriodTip); @@ -503,10 +517,15 @@ void qTabMeasurement::setAcquisitionPeriod(){ void qTabMeasurement::setNumTriggers(int val){ - myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,val); #ifdef VERBOSE - cout << "Setting number of triggers to " << (int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1) << endl; + cout << "Setting number of triggers to " << val << endl; #endif + myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,val); + + disconnect(spinNumTriggers,SIGNAL(valueChanged(int)), this, SLOT(setNumTriggers(int))); + spinNumTriggers->setValue((int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1)); + connect(spinNumTriggers,SIGNAL(valueChanged(int)), this, SLOT(setNumTriggers(int))); + qDefs::checkErrorMessage(myDet,"qTabMeasurement::setNumTriggers"); } @@ -515,13 +534,24 @@ void qTabMeasurement::setNumTriggers(int val){ void qTabMeasurement::setDelay(){ - double exptimeNS; //Get the value of timer in ns - exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboDelayUnit->currentIndex(),spinDelay->value()); + double exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboDelayUnit->currentIndex(),spinDelay->value()); #ifdef VERBOSE cout << "Setting delay after trigger to " << exptimeNS << " clocks" << "/" << spinDelay->value() << qDefs::getUnitString((qDefs::timeUnit)comboDelayUnit->currentIndex()) << endl; #endif myDet->setTimer(slsDetectorDefs::DELAY_AFTER_TRIGGER,(int64_t)exptimeNS); + + //updating value set + disconnect(spinDelay,SIGNAL(valueChanged(double)), this, SLOT(setDelay())); + disconnect(comboDelayUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setDelay())); + qDefs::timeUnit unit; + double time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::DELAY_AFTER_TRIGGER,-1)*(1E-9)))); + spinDelay->setValue(time); + comboDelayUnit->setCurrentIndex((int)unit); + connect(spinDelay,SIGNAL(valueChanged(double)), this, SLOT(setDelay())); + connect(comboDelayUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setDelay())); + + qDefs::checkErrorMessage(myDet,"qTabMeasurement::setDelay"); } @@ -530,10 +560,15 @@ void qTabMeasurement::setDelay(){ void qTabMeasurement::setNumGates(int val){ - myDet->setTimer(slsDetectorDefs::GATES_NUMBER,val); #ifdef VERBOSE - cout << "Setting number of gates to " << (int)myDet->setTimer(slsDetectorDefs::GATES_NUMBER,-1) << endl; + cout << "Setting number of gates to " << val << endl; #endif + myDet->setTimer(slsDetectorDefs::GATES_NUMBER,val); + + disconnect(spinNumGates,SIGNAL(valueChanged(int)), this, SLOT(setNumGates(int))); + spinNumGates->setValue((int)myDet->setTimer(slsDetectorDefs::GATES_NUMBER,-1)); + connect(spinNumGates,SIGNAL(valueChanged(int)), this, SLOT(setNumGates(int))); + qDefs::checkErrorMessage(myDet,"qTabMeasurement::setNumGates"); } @@ -542,10 +577,24 @@ void qTabMeasurement::setNumGates(int val){ void qTabMeasurement::setNumProbes(int val){ - myDet->setTimer(slsDetectorDefs::PROBES_NUMBER,val); #ifdef VERBOSE - cout << "Setting number of frames to " << (int)myDet->setTimer(slsDetectorDefs::PROBES_NUMBER,-1) << endl; + cout << "Setting number of probes to " << val << endl; #endif + myDet->setTimer(slsDetectorDefs::PROBES_NUMBER,val); + + disconnect(spinNumProbes,SIGNAL(valueChanged(int)), this, SLOT(setNumProbes(int))); + spinNumProbes->setValue((int)myDet->setTimer(slsDetectorDefs::PROBES_NUMBER,-1)); + connect(spinNumProbes,SIGNAL(valueChanged(int)), this, SLOT(setNumProbes(int))); + + qDefs::checkErrorMessage(myDet,"qTabMeasurement::setNumProbes"); + + //Setting number of probes should reset number of triggers to 1, need to check if enabled, cuz its updated when refresh + if((spinNumProbes->isEnabled()) && (val > 0) && (spinNumTriggers->value() != 1)){ + qDefs::Message(qDefs::INFORMATION,"Number of Triggers has been reset to 1.
" + "This is mandatory to use probes.","qTabMeasurement::setNumProbes"); + cout << "Resetting Number of triggers to 1" << endl; + spinNumTriggers->setValue(1); + } qDefs::checkErrorMessage(myDet,"qTabMeasurement::setNumProbes"); } @@ -570,13 +619,13 @@ void qTabMeasurement::SetTimingMode(int mode){ switch(mode){ case None://Exposure Time lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true); - setNumFrames(1); - setNumTriggers(1); + spinNumTriggers->setValue(1); + spinNumFrames->setValue(1); if(myDet->setExternalCommunicationMode(slsDetectorDefs::AUTO_TIMING)==slsDetectorDefs::AUTO_TIMING) success = true; break; case Auto://#Frames, ExpTime, Period - setNumTriggers(1); + spinNumTriggers->setValue(1); lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true); lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true); @@ -593,14 +642,14 @@ void qTabMeasurement::SetTimingMode(int mode){ success = true; break; case Trigger_Frame://ExpTime, #Triggers - setNumFrames(1); + spinNumFrames->setValue(1); lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true); lblNumTriggers->setEnabled(true); spinNumTriggers->setEnabled(true); if(myDet->setExternalCommunicationMode(slsDetectorDefs::TRIGGER_FRAME)==slsDetectorDefs::TRIGGER_FRAME) success = true; break; case Trigger_Readout://#Frames, ExpTime, Period, Delay - setNumTriggers(1); + spinNumTriggers->setValue(1); lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true); lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true); @@ -609,7 +658,7 @@ void qTabMeasurement::SetTimingMode(int mode){ success = true; break; case Gated://#Frames, #Gates - setNumTriggers(1); + spinNumTriggers->setValue(1); lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); lblNumGates->setEnabled(true); spinNumGates->setEnabled(true); if(myDet->setExternalCommunicationMode(slsDetectorDefs::GATE_FIX_NUMBER)==slsDetectorDefs::GATE_FIX_NUMBER) @@ -625,7 +674,7 @@ void qTabMeasurement::SetTimingMode(int mode){ success = true; break; case Trigger_Window://#Triggers - setNumFrames(1); + spinNumFrames->setValue(1); lblNumTriggers->setEnabled(true); spinNumTriggers->setEnabled(true); if(myDet->setExternalCommunicationMode(slsDetectorDefs::TRIGGER_WINDOW)==slsDetectorDefs::TRIGGER_WINDOW) success = true; @@ -642,53 +691,18 @@ void qTabMeasurement::SetTimingMode(int mode){ "Please check the external flags." "\n\nSetting the following defaults:\nTiming Mode \t: None\n" "Number of Frames \t: 1\nNumber of Triggers \t: 1","qTabMeasurement::SetTimingMode"); + spinNumFrames->setValue(1); + spinNumTriggers->setValue(1); comboTimingMode->setCurrentIndex((int)None); return; } - //Number of Probes - if((expertMode)&&(myDet->getDetectorsType()==slsDetectorDefs::MYTHEN)){ - lblNumProbes->setEnabled(true); spinNumProbes->setEnabled(true); - } - - - //To disconnect all the signals before changing their values - DeInitialization(); - - - double time; - int val; - qDefs::timeUnit unit; - //Number of Frames - if(lblNumFrames->isEnabled()){ - val = (int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1); - spinNumFrames->setValue(val); -#ifdef VERBOSE - cout << "Getting number of frames : " << val <isEnabled()){ - time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-9)))); -#ifdef VERBOSE - cout << "Getting acquisition time : " << time << qDefs::getUnitString(unit) << endl; -#endif - spinExpTime->setValue(time); - comboExpUnit->setCurrentIndex((int)unit); - } - //Frame Period between exposures + double exptimeNS,acqtimeNS; + double time; + qDefs::timeUnit unit; if(lblPeriod->isEnabled()){ - time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,-1)*(1E-9)))); -#ifdef VERBOSE - cout << "Getting frame period between exposures : " << time << qDefs::getUnitString(unit) << endl; -#endif - spinPeriod->setValue(time); - comboPeriodUnit->setCurrentIndex((int)unit); - - double exptimeNS,acqtimeNS; exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value()); acqtimeNS = qDefs::getNSTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value()); if(exptimeNS>acqtimeNS) { @@ -712,46 +726,9 @@ void qTabMeasurement::SetTimingMode(int mode){ lblPeriod->setText("Acquisition Period:"); } - //Number of Triggers - if(lblNumTriggers->isEnabled()){ - val = (int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1); - spinNumTriggers->setValue(val); -#ifdef VERBOSE - cout << "Getting number of triggers : " << val <isEnabled()){ - time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::DELAY_AFTER_TRIGGER,-1)*(1E-9)))); -#ifdef VERBOSE - cout << "Getting delay after trigger : " << time << qDefs::getUnitString(unit) << endl; -#endif - spinDelay->setValue(time); - comboDelayUnit->setCurrentIndex((int)unit); - } - - //Number of Gates - if(lblNumGates->isEnabled()){ - val = (int)myDet->setTimer(slsDetectorDefs::GATES_NUMBER,-1); - spinNumGates->setValue(val); -#ifdef VERBOSE - cout << "Getting number of gates : " << val << endl; -#endif - } - - // Number of Probes - if(lblNumProbes->isEnabled()){ - val = (int)myDet->setTimer(slsDetectorDefs::PROBES_NUMBER,-1); - spinNumProbes->setValue(val); -#ifdef VERBOSE - cout << "Getting number of probes : " << val << endl; -#endif - } - - //To reconnect all the signals after changing their values - Initialization(1); + //Check if Number of Probes should be enabled + EnableProbes(); // to let qdrawplot know that triggers or frames are used myPlot->setFrameEnabled(lblNumFrames->isEnabled()); @@ -776,6 +753,11 @@ void qTabMeasurement::EnableFileWrite(bool enable){ dispFileName->setEnabled(enable); if(enable) setFileName(dispFileName->text()); myPlot->SetEnableFileWrite(enable); + + disconnect(chkFile, SIGNAL(toggled(bool)), this, SLOT(EnableFileWrite(bool))); + chkFile->setChecked(myDet->enableWriteToFile()); + connect(chkFile, SIGNAL(toggled(bool)), this, SLOT(EnableFileWrite(bool))); + qDefs::checkErrorMessage(myDet,"qTabMeasurement::EnableFileWrite"); }; @@ -790,23 +772,76 @@ void qTabMeasurement::Refresh(){ if(!myPlot->isRunning()){ //Number of measurements + spinNumMeasurements->setValue((int)myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,-1)); #ifdef VERBOSE cout << "Getting number of measurements" << endl; #endif - spinNumMeasurements->setValue((int)myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,-1)); + //Number of frames + spinNumFrames->setValue((int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1)); +#ifdef VERBOSE + cout << "Getting number of frames" << endl; +#endif + //Exp Time + qDefs::timeUnit unit; + double time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-9)))); + spinExpTime->setValue(time); + comboExpUnit->setCurrentIndex((int)unit); +#ifdef VERBOSE + cout << "Getting Exposure time" << endl; +#endif + + //period + time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,-1)*(1E-9)))); + spinPeriod->setValue(time); + comboPeriodUnit->setCurrentIndex((int)unit); +#ifdef VERBOSE + cout << "Getting Acquisition Period" << endl; +#endif + + //Number of Triggers + spinNumTriggers->setValue((int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1)); +#ifdef VERBOSE + cout << "Getting number of triggers" << endl; +#endif + + //delay + time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::DELAY_AFTER_TRIGGER,-1)*(1E-9)))); + spinDelay->setValue(time); + comboDelayUnit->setCurrentIndex((int)unit); +#ifdef VERBOSE + cout << "Getting delay after trigger" << endl; +#endif + + //gates + spinNumGates->setValue((int)myDet->setTimer(slsDetectorDefs::GATES_NUMBER,-1)); +#ifdef VERBOSE + cout << "Getting number of gates" << endl; +#endif + + //probes + spinNumProbes->setValue((int)myDet->setTimer(slsDetectorDefs::PROBES_NUMBER,-1)); +#ifdef VERBOSE + cout << "Getting number of probes" << endl; +#endif //File Name -#ifdef VERBOSE - cout << "Getting file name" << endl; -#endif dispFileName->setText(QString(myDet->getFileName().c_str())); +#ifdef VERBOSE + cout << "Getting file name prefix" << endl; +#endif //File Index + spinIndex->setValue(myDet->getFileIndex()); #ifdef VERBOSE cout << "Getting file index" << endl; #endif - spinIndex->setValue(myDet->getFileIndex()); + + //file write enabled/disabled + chkFile->setChecked(myDet->enableWriteToFile()); +#ifdef VERBOSE + cout << "Getting file write enable" << endl; +#endif //progress label index if(myDet->getFrameIndex()==-1) @@ -814,7 +849,7 @@ void qTabMeasurement::Refresh(){ else lblProgressIndex->setText(QString::number(myDet->getFrameIndex())); - //Timing mode + //Timing mode - will also check if exptime>acq period and also enableprobes() SetupTimingMode(); // to let qdrawplot know that triggers or frames are used @@ -830,4 +865,34 @@ void qTabMeasurement::Refresh(){ } +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabMeasurement::EnableProbes(){ +#ifdef VERBOSE + cout << "Validating if probes should be enabled" << endl; +#endif + //enabled only in expert mode and if #Frames > 1 + if((expertMode)&&(myDet->getDetectorsType()==slsDetectorDefs::MYTHEN)&&(spinNumFrames->value()>1)){ + lblNumProbes->setEnabled(true); + spinNumProbes->setEnabled(true); + disconnect(spinNumProbes,SIGNAL(valueChanged(int)), this, SLOT(setNumProbes(int))); + spinNumProbes->setValue((int)myDet->setTimer(slsDetectorDefs::PROBES_NUMBER,-1)); + connect(spinNumProbes,SIGNAL(valueChanged(int)), this, SLOT(setNumProbes(int))); +#ifdef VERBOSE + cout << "Getting number of probes : " << spinNumProbes->value() << endl; +#endif + //ensure that #triggers is reset + setNumProbes(spinNumProbes->value()); + + qDefs::checkErrorMessage(myDet,"qTabMeasurement::EnableProbes"); + return; + } + cout << "Probes not enabled" << endl; + spinNumProbes->setValue(0); + lblNumProbes->setEnabled(false); + spinNumProbes->setEnabled(false); +} + + //------------------------------------------------------------------------------------------------------------------------------------------------- From 1274b5532c7de50146364dd24c367f4a86e719fa Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Thu, 8 Aug 2013 09:54:29 +0000 Subject: [PATCH 220/332] set maximum number for probes in gui as 3 git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@220 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_measurement.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slsDetectorGui/forms/form_tab_measurement.ui b/slsDetectorGui/forms/form_tab_measurement.ui index 425bfdfc8..c3b681317 100644 --- a/slsDetectorGui/forms/form_tab_measurement.ui +++ b/slsDetectorGui/forms/form_tab_measurement.ui @@ -487,7 +487,7 @@ Enabled only in Expert Mode and if Number of Frames > 1. 0
- 2000000000 + 3 1 From 038d3c11dfd084eb723bc1be925c0bc6509a6709 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Thu, 8 Aug 2013 09:56:15 +0000 Subject: [PATCH 221/332] set maximum number for probes in gui as 3 git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@221 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_measurement.ui | 22 +++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_measurement.ui b/slsDetectorGui/forms/form_tab_measurement.ui index c3b681317..b7cad8434 100644 --- a/slsDetectorGui/forms/form_tab_measurement.ui +++ b/slsDetectorGui/forms/form_tab_measurement.ui @@ -427,13 +427,14 @@ The data are accumulated over several (frames) pump cycles. </nobr> <br> -<nobr> <b> -Enabled only in Expert Mode and if Number of Frames > 1. -</b></nobr> -<br> -<nobr>Setting Number of Probes will reset Number of Triggers to 1. +<nobr> +Enabled only in <b>Expert Mode</b> and if<b> Number of Frames</b> > 1. </nobr> <br> +<nobr>Setting <b>Number of Probes</b> will reset <b>Number of Triggers</b> to 1. +</nobr> +<br> +Maximum value is 3. <br> #probes#
@@ -458,13 +459,14 @@ Enabled only in Expert Mode and if Number of Frames > 1. The data are accumulated over several (frames) pump cycles. </nobr> <br> -<nobr> <b> -Enabled only in Expert Mode and if Number of Frames > 1. -</b></nobr> -<br> -<nobr>Setting Number of Probes will reset Number of Triggers to 1. +<nobr> +Enabled only in <b>Expert Mode</b> and if<b> Number of Frames</b> > 1. </nobr> <br> +<nobr>Setting <b>Number of Probes</b> will reset <b>Number of Triggers</b> to 1. +</nobr> +<br> +Maximum value is 3. <br> #probes# From 113ee269d4515b85c8f058c8a65eeb01a37df2ce Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Thu, 8 Aug 2013 13:39:36 +0000 Subject: [PATCH 222/332] added trimming checks git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@222 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qTabAdvanced.h | 9 +++ slsDetectorGui/slsDetectorGui.pro | 2 +- slsDetectorGui/src/qTabAdvanced.cpp | 95 ++++++++++++++++++++++++++- 3 files changed, 104 insertions(+), 2 deletions(-) diff --git a/slsDetectorGui/include/qTabAdvanced.h b/slsDetectorGui/include/qTabAdvanced.h index 05e5f6f3a..5a15e6339 100644 --- a/slsDetectorGui/include/qTabAdvanced.h +++ b/slsDetectorGui/include/qTabAdvanced.h @@ -58,6 +58,11 @@ private: */ void AddROIInput(int num); + /** Checks for a few conditions before trimming + /returns OK or FAIL + */ + int validateBeforeTrimming(); + private slots: @@ -192,6 +197,10 @@ private: /** Trimming mode */ slsDetectorDefs::trimMode trimmingMode; + static const int TRIMMING_DYNAMIC_RANGE = 24; + static const int TRIMMING_FRAME_NUMBER = 1; + static const int TRIMMING_TRIGGER_NUMBER = 1; + static const int TRIMMING_PROBE_NUMBER = 0; bool isEnergy; bool isAngular; diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index bb96a4ebe..ff694965e 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -20,7 +20,7 @@ QMAKE_LIBS = -L$(QTDIR)/lib #LIBS = -L$(QWTDIR)/lib -lqwt -L$(QWT3D)/lib -Wl,-R$(QWTDIR)/lib -L /usr/local/epics/base/lib/$(EPICS_HOST_ARCH)/ -Wl,-R/usr/local/epics/base/lib/$(EPICS_HOST_ARCH) -lca -lCom #default -DEFINES += VERBOSE DACS_INT PRINT_LOG THIS_PATH=\\\"$$PWD\\\" #VERYVERBOSE +DEFINES += VERBOSE DACS_INT PRINT_LOG THIS_PATH=\\\"$$PWD\\\" #VERYVERBOSE LIBS = -L$(QWTDIR)/lib -lqwt -L$(QWT3D)/lib diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp index f76f262aa..71bb545d9 100644 --- a/slsDetectorGui/src/qTabAdvanced.cpp +++ b/slsDetectorGui/src/qTabAdvanced.cpp @@ -436,8 +436,101 @@ void qTabAdvanced::SetTrimmingMethod(int mode){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void qTabAdvanced::StartTrimming(){ +int qTabAdvanced::validateBeforeTrimming(){ +#ifdef VERBOSE + cout << "Validating conditions before Trimming" << endl; +#endif + char temp[100]; + switch(detType){ + case slsDetectorDefs::MYTHEN: + //dynamic range + if(myDet->setDynamicRange(-1) != TRIMMING_DYNAMIC_RANGE){ + sprintf(temp,"%d",TRIMMING_DYNAMIC_RANGE); + if(myDet->setDynamicRange(TRIMMING_DYNAMIC_RANGE) != TRIMMING_DYNAMIC_RANGE){ + qDefs::Message(qDefs::WARNING, + string("Trimming Pre-condition not satisfied:
" + "Could not set dynamic range to ") + string(temp)+string(".
" + "Trimming Aborted."),"qTabAdvanced::validateBeforeTrimming"); + return slsDetectorDefs::FAIL; + } + } + //frames + if((int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1) != TRIMMING_FRAME_NUMBER){ + if((int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,TRIMMING_FRAME_NUMBER) != TRIMMING_FRAME_NUMBER){ + sprintf(temp,"%d",TRIMMING_FRAME_NUMBER); + qDefs::Message(qDefs::WARNING, + string("Trimming Pre-condition not satisfied:
" + "Could not set Number of Frames to ") + string(temp)+string(".
" + "Trimming Aborted."),"qTabAdvanced::validateBeforeTrimming"); + return slsDetectorDefs::FAIL; + } + } + //trigger + if((int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1) != TRIMMING_TRIGGER_NUMBER){ + if((int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,TRIMMING_TRIGGER_NUMBER) != TRIMMING_TRIGGER_NUMBER){ + sprintf(temp,"%d",TRIMMING_TRIGGER_NUMBER); + qDefs::Message(qDefs::WARNING, + string("Trimming Pre-condition not satisfied:
" + "Could not set Number of Triggers to ") + string(temp)+string(".
" + "Trimming Aborted."),"qTabAdvanced::validateBeforeTrimming"); + return slsDetectorDefs::FAIL; + } + } + //probes + if((int)myDet->setTimer(slsDetectorDefs::PROBES_NUMBER,-1) != TRIMMING_PROBE_NUMBER){ + if((int)myDet->setTimer(slsDetectorDefs::PROBES_NUMBER,TRIMMING_PROBE_NUMBER) != TRIMMING_PROBE_NUMBER){ + sprintf(temp,"%d",TRIMMING_PROBE_NUMBER); + qDefs::Message(qDefs::WARNING, + string("Trimming Pre-condition not satisfied:
" + "Could not set Number of Probes to ") + string(temp)+string(".
" + "Trimming Aborted."),"qTabAdvanced::validateBeforeTrimming"); + return slsDetectorDefs::FAIL; + } + } + //Setting + if((int)myDet->getSettings() == slsDetectorDefs::UNINITIALIZED){ + if(qDefs::Message(qDefs::QUESTION, + string("Trimming Pre-condition not satisfied:
")+ + string("Settings cannot be Uninitialized to start Trimming.
" + "Change it to Standard and proceed?"),"qTabAdvanced::validateBeforeTrimming") == slsDetectorDefs::FAIL){ + qDefs::Message(qDefs::INFORMATION, + "Please change the Settings in the Settings tab to your choice.
" + "Aborting Trimming.","qTabAdvanced::validateBeforeTrimming"); + return slsDetectorDefs::FAIL; + } + //user asked to change settings to standard + else{ + if((int)myDet->setSettings(slsDetectorDefs::STANDARD) != slsDetectorDefs::STANDARD){ + qDefs::Message(qDefs::WARNING, + string("Trimming Pre-condition not satisfied:
" + "Could not change Settings to Standard
" + "Trimming Aborted."),"qTabAdvanced::validateBeforeTrimming"); + return slsDetectorDefs::FAIL; + } + } + } + + qDefs::Message(qDefs::INFORMATION,"All conditions satisfied for Trimming.
" + "Initiating Trimming...","qTabAdvanced::validateBeforeTrimming"); + return slsDetectorDefs::OK; + default: + return slsDetectorDefs::FAIL; + } +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabAdvanced::StartTrimming(){ + //check a few conditions before trimming + if(validateBeforeTrimming() == slsDetectorDefs::FAIL) + return; + +#ifdef VERBOSE + cout << "Starting Trimming" << endl; +#endif int parameter1=0, parameter2=0; //optimize bool optimize = chkOptimize->isChecked(); From f2a77be1b25ba7435c618896cef72ec7a480414c Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Thu, 8 Aug 2013 14:30:10 +0000 Subject: [PATCH 223/332] layoutthreshold was disabled for mythen, changed that git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@223 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_plot.ui | 17 ++++++++++------- slsDetectorGui/src/qTabPlot.cpp | 2 -- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index 3c0bb4aae..29893eb4b 100644 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -300,7 +300,7 @@ 20 5 - 76 + 77 26 @@ -401,9 +401,6 @@ - horizontalLayoutWidget_5 - btnSave_2 - btnRecalPedestal_2 @@ -861,7 +858,7 @@ 25 5 - 76 + 77 26 @@ -964,7 +961,7 @@ - + 25 @@ -979,13 +976,19 @@ + + + 0 + 0 + + Binary - + Qt::Horizontal diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index 076b96327..916b93bc9 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -148,7 +148,6 @@ void qTabPlot::SetupWidgetWindow(){ isOriginallyOneD = true; chkPedestal->setEnabled(false); btnRecalPedestal->setEnabled(false); - layoutThreshold->setEnabled(false); chkPedestal_2->setEnabled(false); btnRecalPedestal_2->setEnabled(false); chkBinary->setEnabled(false); @@ -158,7 +157,6 @@ void qTabPlot::SetupWidgetWindow(){ isOriginallyOneD = false; chkPedestal->setEnabled(false); btnRecalPedestal->setEnabled(false); - layoutThreshold->setEnabled(false); chkPedestal_2->setEnabled(false); btnRecalPedestal_2->setEnabled(false); chkBinary->setEnabled(false); From 440b244b6623cf32bbd78a336f9d55fc281a75b8 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Mon, 12 Aug 2013 10:28:42 +0000 Subject: [PATCH 224/332] checking conditions before trimming and settings include low noise now, so a few changes git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@224 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_plot.ui | 8 ++-- slsDetectorGui/forms/form_tab_settings.ui | 5 ++ slsDetectorGui/include/qTabSettings.h | 2 +- slsDetectorGui/src/qTabAdvanced.cpp | 57 +++++++++++++---------- slsDetectorGui/src/qTabSettings.cpp | 7 ++- 5 files changed, 48 insertions(+), 31 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index 29893eb4b..c6848218c 100644 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -1250,7 +1250,7 @@ 10 20 - 348 + 346 26 @@ -1284,7 +1284,7 @@ - 9 + 7 10 @@ -1313,7 +1313,7 @@ - 9 + 7 10 @@ -1342,7 +1342,7 @@ - 9 + 7 10 diff --git a/slsDetectorGui/forms/form_tab_settings.ui b/slsDetectorGui/forms/form_tab_settings.ui index a9dcf980c..404dfcfba 100644 --- a/slsDetectorGui/forms/form_tab_settings.ui +++ b/slsDetectorGui/forms/form_tab_settings.ui @@ -95,6 +95,11 @@ Very High Gain + + + Low Noise + + Undefined diff --git a/slsDetectorGui/include/qTabSettings.h b/slsDetectorGui/include/qTabSettings.h index 90c901910..e397c606f 100644 --- a/slsDetectorGui/include/qTabSettings.h +++ b/slsDetectorGui/include/qTabSettings.h @@ -57,7 +57,7 @@ private: /** expert mode */ bool expertMode; - enum{Standard,Fast,HighGain,DynamicGain,LowGain,MediumGain,VeryHighGain,Undefined,Uninitialized,NumSettings}; + enum{Standard,Fast,HighGain,DynamicGain,LowGain,MediumGain,VeryHighGain,LowNoise,Undefined,Uninitialized,NumSettings}; /** To be able to index items on a combo box */ QStandardItemModel* model; diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp index 71bb545d9..16231733d 100644 --- a/slsDetectorGui/src/qTabAdvanced.cpp +++ b/slsDetectorGui/src/qTabAdvanced.cpp @@ -97,7 +97,7 @@ void qTabAdvanced::SetupWidgetWindow(){ } - //logs + //logs and trimming if(!isAngular && !isEnergy) boxLogs->setEnabled(false); else{ if(!isAngular) chkAngularLog->setEnabled(false); @@ -114,7 +114,7 @@ void qTabAdvanced::SetupWidgetWindow(){ btnGroup->addButton(btnGetTrimbits,1); } } - + trimmingMode = slsDetectorDefs::NOISE_TRIMMING; //network @@ -302,12 +302,12 @@ void qTabAdvanced::SetThreshold(){ void qTabAdvanced::SetOutputFile(){ #ifdef VERBOSE - cout << "Setting Output File for Trimming" << endl; + cout << "Setting Output File for Trimming:" << endl; #endif QString dirPath = dispFile->text().section('/',0,-2,QString::SectionIncludeLeadingSep); - cout<<"directory:"<text().section('/',-1); - cout<<"file name:"<text(); //dialog @@ -441,6 +441,7 @@ int qTabAdvanced::validateBeforeTrimming(){ cout << "Validating conditions before Trimming" << endl; #endif char temp[100]; + string message = "All conditions satisfied for Trimming.
"; switch(detType){ case slsDetectorDefs::MYTHEN: @@ -451,45 +452,49 @@ int qTabAdvanced::validateBeforeTrimming(){ qDefs::Message(qDefs::WARNING, string("Trimming Pre-condition not satisfied:
" "Could not set dynamic range to ") + string(temp)+string(".
" - "Trimming Aborted."),"qTabAdvanced::validateBeforeTrimming"); + "Trimming Aborted."),"qTabAdvanced::validateBeforeTrimming"); return slsDetectorDefs::FAIL; - } + }else + message.append(string("Dynamic Range has been changed to ") + string(temp) + string(".
")); } //frames if((int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1) != TRIMMING_FRAME_NUMBER){ + sprintf(temp,"%d",TRIMMING_FRAME_NUMBER); if((int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,TRIMMING_FRAME_NUMBER) != TRIMMING_FRAME_NUMBER){ - sprintf(temp,"%d",TRIMMING_FRAME_NUMBER); qDefs::Message(qDefs::WARNING, string("
Trimming Pre-condition not satisfied:
" "Could not set Number of Frames to ") + string(temp)+string(".
" - "Trimming Aborted."),"qTabAdvanced::validateBeforeTrimming"); + "Trimming Aborted."),"qTabAdvanced::validateBeforeTrimming"); return slsDetectorDefs::FAIL; - } + }else + message.append(string("Number of Frames has been changed to ") + string(temp) + string(".
")); } //trigger if((int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1) != TRIMMING_TRIGGER_NUMBER){ + sprintf(temp,"%d",TRIMMING_TRIGGER_NUMBER); if((int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,TRIMMING_TRIGGER_NUMBER) != TRIMMING_TRIGGER_NUMBER){ - sprintf(temp,"%d",TRIMMING_TRIGGER_NUMBER); qDefs::Message(qDefs::WARNING, string("
Trimming Pre-condition not satisfied:
" "Could not set Number of Triggers to ") + string(temp)+string(".
" - "Trimming Aborted."),"qTabAdvanced::validateBeforeTrimming"); + "Trimming Aborted."),"qTabAdvanced::validateBeforeTrimming"); return slsDetectorDefs::FAIL; - } + }else + message.append(string("Number of Triggers has been changed to ") + string(temp) + string(".
")); } //probes if((int)myDet->setTimer(slsDetectorDefs::PROBES_NUMBER,-1) != TRIMMING_PROBE_NUMBER){ + sprintf(temp,"%d",TRIMMING_PROBE_NUMBER); if((int)myDet->setTimer(slsDetectorDefs::PROBES_NUMBER,TRIMMING_PROBE_NUMBER) != TRIMMING_PROBE_NUMBER){ - sprintf(temp,"%d",TRIMMING_PROBE_NUMBER); qDefs::Message(qDefs::WARNING, string("
Trimming Pre-condition not satisfied:
" "Could not set Number of Probes to ") + string(temp)+string(".
" - "Trimming Aborted."),"qTabAdvanced::validateBeforeTrimming"); + "Trimming Aborted."),"qTabAdvanced::validateBeforeTrimming"); return slsDetectorDefs::FAIL; - } + }else + message.append(string("Number of Probes has been changed to ") + string(temp) + string(".
")); } //Setting - if((int)myDet->getSettings() == slsDetectorDefs::UNINITIALIZED){ + if(myDet->getSettings() == slsDetectorDefs::UNINITIALIZED){ if(qDefs::Message(qDefs::QUESTION, string("
Trimming Pre-condition not satisfied:
")+ string("Settings cannot be Uninitialized to start Trimming.
" @@ -507,16 +512,20 @@ int qTabAdvanced::validateBeforeTrimming(){ "Could not change Settings to Standard
" "Trimming Aborted."),"qTabAdvanced::validateBeforeTrimming"); return slsDetectorDefs::FAIL; - } + }else + message.append(string("Settings has been changed to Standard.
")); } } - - qDefs::Message(qDefs::INFORMATION,"
All conditions satisfied for Trimming.
" - "Initiating Trimming...","qTabAdvanced::validateBeforeTrimming"); - return slsDetectorDefs::OK; + break; default: return slsDetectorDefs::FAIL; + } + + message.append("Initiating Trimming..."); + qDefs::Message(qDefs::INFORMATION,message,"qTabAdvanced::validateBeforeTrimming"); + return slsDetectorDefs::OK; + } @@ -565,7 +574,7 @@ void qTabAdvanced::StartTrimming(){ if(!optimize) parameter2 = 0; break; default: - cout << "Should never come here. Start Trimming will have only 2 methods." << endl; + cout << "Should never come here. Start Trimming will have only 2 methods. Trimming Method:" << trimmingMode << endl; break; } diff --git a/slsDetectorGui/src/qTabSettings.cpp b/slsDetectorGui/src/qTabSettings.cpp index 2989be257..4415aa333 100644 --- a/slsDetectorGui/src/qTabSettings.cpp +++ b/slsDetectorGui/src/qTabSettings.cpp @@ -93,15 +93,17 @@ void qTabSettings::SetupDetectorSettings(){ item[(int)LowGain]->setEnabled(false); item[(int)MediumGain]->setEnabled(false); item[(int)VeryHighGain]->setEnabled(false); + item[(int)LowNoise]->setEnabled(false); break; case slsDetectorDefs::EIGER: - item[(int)Standard]->setEnabled(false); + item[(int)Standard]->setEnabled(true); item[(int)Fast]->setEnabled(false); - item[(int)HighGain]->setEnabled(false); + item[(int)HighGain]->setEnabled(true); item[(int)DynamicGain]->setEnabled(false); item[(int)LowGain]->setEnabled(false); item[(int)MediumGain]->setEnabled(false); item[(int)VeryHighGain]->setEnabled(false); + item[(int)LowNoise]->setEnabled(true); break; case slsDetectorDefs::MOENCH: case slsDetectorDefs::GOTTHARD: @@ -112,6 +114,7 @@ void qTabSettings::SetupDetectorSettings(){ item[(int)LowGain]->setEnabled(true); item[(int)MediumGain]->setEnabled(true); item[(int)VeryHighGain]->setEnabled(true); + item[(int)LowNoise]->setEnabled(false); break; default: qDefs::Message(qDefs::CRITICAL,"Unknown detector type. Exiting GUI.","qTabSettings::SetupDetectorSettings"); From eb48b1c492465f735de0f16b7ac81e7fba74aff0 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Mon, 12 Aug 2013 12:21:49 +0000 Subject: [PATCH 225/332] checking if probes or threshold ..shouldnt check if its the wrong detector unnecessary err printouts git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@225 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_plot.ui | 80 +++++++++++++++++++++++++- slsDetectorGui/src/qDetectorMain.cpp | 4 +- slsDetectorGui/src/qDrawPlot.cpp | 10 ++-- slsDetectorGui/src/qTabMeasurement.cpp | 11 ++-- slsDetectorGui/src/qTabSettings.cpp | 3 +- 5 files changed, 94 insertions(+), 14 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index c6848218c..a1a2bb915 100644 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -99,7 +99,7 @@
- 3 + 4 @@ -542,6 +542,44 @@ + + + + + 25 + 5 + 128 + 26 + + + + + 0 + + + + + true + + + + 0 + 0 + + + + <nobr> +Displays minimum, maximum and sum of values for each plot. +<nobr> + + + Display Statistics + + + + + +
@@ -572,7 +610,7 @@ - 4 + 0 @@ -1100,6 +1138,44 @@ + + + + + 25 + 5 + 128 + 26 + + + + + 0 + + + + + true + + + + 0 + 0 + + + + <nobr> +Displays minimum, maximum and sum of values for each plot. +<nobr> + + + Display Statistics + + + + + +
diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index fd9bc11c3..29509def3 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -107,11 +107,11 @@ void qDetectorMain::SetUpWidgetWindow(){ tab_plot = new qTabPlot (this, myDet,myPlot); cout<<"Plot ready"<setLayout(layout); - histFrameIndexTitle= histFrameIndexTitle = new QLabel(""); + histFrameIndexTitle= histFrameIndexTitle = new QLabel(""); boxPlot = new QGroupBox(""); layout->addWidget(boxPlot,1,0); @@ -264,7 +264,7 @@ void qDrawPlot::SetupWidgetWindow(){ plotLayout->addWidget(plot2D,0,0,1,1); - //callbacks +//callbacks // Setting the callback function to get data from detector class myDet->registerDataCallback(&(GetDataCallBack),this); diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index dab5f6e11..6bb6275fc 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -69,7 +69,8 @@ void qTabMeasurement::SetupWidgetWindow(){ //gates spinNumGates->setValue((int)myDet->setTimer(slsDetectorDefs::GATES_NUMBER,-1)); //probes - spinNumProbes->setValue((int)myDet->setTimer(slsDetectorDefs::PROBES_NUMBER,-1)); + if(myDet->getDetectorsType() == slsDetectorDefs::MYTHEN) + spinNumProbes->setValue((int)myDet->setTimer(slsDetectorDefs::PROBES_NUMBER,-1)); //File Name dispFileName->setText(QString(myDet->getFileName().c_str())); //File Index @@ -820,11 +821,12 @@ void qTabMeasurement::Refresh(){ #endif //probes - spinNumProbes->setValue((int)myDet->setTimer(slsDetectorDefs::PROBES_NUMBER,-1)); + if(myDet->getDetectorsType() == slsDetectorDefs::MYTHEN){ + spinNumProbes->setValue((int)myDet->setTimer(slsDetectorDefs::PROBES_NUMBER,-1)); #ifdef VERBOSE cout << "Getting number of probes" << endl; #endif - + } //File Name dispFileName->setText(QString(myDet->getFileName().c_str())); #ifdef VERBOSE @@ -889,7 +891,8 @@ void qTabMeasurement::EnableProbes(){ return; } cout << "Probes not enabled" << endl; - spinNumProbes->setValue(0); + if(myDet->getDetectorsType()==slsDetectorDefs::MYTHEN) + spinNumProbes->setValue(0); lblNumProbes->setEnabled(false); spinNumProbes->setEnabled(false); } diff --git a/slsDetectorGui/src/qTabSettings.cpp b/slsDetectorGui/src/qTabSettings.cpp index 4415aa333..a0d2fb3f7 100644 --- a/slsDetectorGui/src/qTabSettings.cpp +++ b/slsDetectorGui/src/qTabSettings.cpp @@ -46,7 +46,8 @@ void qTabSettings::SetupWidgetWindow(){ comboSettings->setCurrentIndex(sett); //threshold - spinThreshold->setValue(myDet->getThresholdEnergy()); + if((detType == slsDetectorDefs::MYTHEN) || (detType == slsDetectorDefs::EIGER)) + spinThreshold->setValue(myDet->getThresholdEnergy()); //expert mode is not enabled initially lblThreshold->setEnabled(false); From 505328bcaaa1e6c634baddf7a7357776431e0729 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 13 Aug 2013 10:30:13 +0000 Subject: [PATCH 226/332] displaying statistics works now git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@226 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qCloneWidget.h | 9 +- slsDetectorGui/include/qDrawPlot.h | 24 ++++++ slsDetectorGui/include/svnInfoGui.h | 6 +- slsDetectorGui/src/qCloneWidget.cpp | 56 +++++++++++- slsDetectorGui/src/qDrawPlot.cpp | 118 +++++++++++++++++++++++++- slsDetectorGui/src/qTabPlot.cpp | 2 + 6 files changed, 206 insertions(+), 9 deletions(-) diff --git a/slsDetectorGui/include/qCloneWidget.h b/slsDetectorGui/include/qCloneWidget.h index 65ae2e550..760b55e25 100644 --- a/slsDetectorGui/include/qCloneWidget.h +++ b/slsDetectorGui/include/qCloneWidget.h @@ -30,6 +30,9 @@ class SlsQtH1D; #include #include #include +#include +#include +#include /** C++ Include Headers */ #include #include @@ -44,7 +47,8 @@ class qCloneWidget:public QMainWindow{ public: /** \short The constructor */ - qCloneWidget(QWidget *parent,int id,QString title,int numDim,SlsQt1DPlot*& plot1D,SlsQt2DPlotLayout*& plot2D,string FilePath); + qCloneWidget(QWidget *parent,int id,QString title,int numDim,SlsQt1DPlot*& plot1D,SlsQt2DPlotLayout*& plot2D,string FilePath, + bool displayStats, QString min, QString max, QString sum); /** Destructor */ @@ -125,6 +129,9 @@ private: /** Gets the current time stamp for the window title*/ char* GetCurrentTimeStamp(); + /** Display Statistics */ + void DisplayStats(bool enable, QString min, QString max, QString sum); + private slots: /** Save Plot */ diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index 448d4bdca..df010adac 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -172,6 +172,12 @@ void RecalculatePedestal(); void SetAccumulate(bool enable); /** Reset accumulation */ void ResetAccumulate(); +/** Display Statistics */ +void DisplayStatistics(bool enable); + + + + private: @@ -260,6 +266,15 @@ void SetStyle(SlsQtH1D* h){ }; +/** Find Statistics + * @param min is the minimum value + * @param max is the maximum value + * @param sum is the sum of all values + * @param array is the array to get statistics from + * @param size is the size of the array */ +void GetStatistics(double &min, double &max, double &sum, double* array, int size); + + @@ -521,6 +536,15 @@ int binaryTo; bool clientInitiated; +/** display statistics widgets */ +QWidget *widgetStatistics; +QLabel *lblMinDisp; +QLabel *lblMaxDisp; +QLabel *lblSumDisp; + +bool displayStatistics; + + signals: void UpdatingPlotFinished(); diff --git a/slsDetectorGui/include/svnInfoGui.h b/slsDetectorGui/include/svnInfoGui.h index 066d56873..ee3ea724c 100644 --- a/slsDetectorGui/include/svnInfoGui.h +++ b/slsDetectorGui/include/svnInfoGui.h @@ -2,10 +2,10 @@ #define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui" //#define SVNREPPATH "" #define SVNREPUUID "af1100a4-978c-4157-bff7-07162d2ba061" -//#define SVNREV 0x218 +//#define SVNREV 0x225 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "l_maliakal_d" -#define SVNREV 0x218 -#define SVNDATE 0x20130807 +#define SVNREV 0x225 +#define SVNDATE 0x20130812 // diff --git a/slsDetectorGui/src/qCloneWidget.cpp b/slsDetectorGui/src/qCloneWidget.cpp index aabbb287e..ba3c12883 100644 --- a/slsDetectorGui/src/qCloneWidget.cpp +++ b/slsDetectorGui/src/qCloneWidget.cpp @@ -18,8 +18,10 @@ //------------------------------------------------------------------------------------------------------------------------------------------------- -qCloneWidget::qCloneWidget(QWidget *parent,int id,QString title,int numDim,SlsQt1DPlot*& plot1D,SlsQt2DPlotLayout*& plot2D,string FilePath): - QMainWindow(parent),id(id),cloneplot2D(0),cloneplot1D(0),filePath(FilePath){ +qCloneWidget::qCloneWidget(QWidget *parent,int id,QString title,int numDim,SlsQt1DPlot*& plot1D,SlsQt2DPlotLayout*& plot2D,string FilePath, + bool displayStats, QString min, QString max, QString sum): + QMainWindow(parent),id(id),cloneplot2D(0),cloneplot1D(0),filePath(FilePath) + { /** Window title*/ char winTitle[300],currTime[50]; strcpy(currTime,GetCurrentTimeStamp()); @@ -28,6 +30,7 @@ qCloneWidget::qCloneWidget(QWidget *parent,int id,QString title,int numDim,SlsQt /** Set up widget*/ SetupWidgetWindow(title,numDim,plot1D,plot2D); + DisplayStats(displayStats,min,max,sum); } //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -262,11 +265,60 @@ int qCloneWidget::SavePlotAutomatic(){ else return -1; } + + //------------------------------------------------------------------------------------------------------------------------------------------------- + void qCloneWidget::closeEvent(QCloseEvent* event){ emit CloneClosedSignal(id); event->accept(); } + //------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qCloneWidget::DisplayStats(bool enable, QString min, QString max, QString sum){ + if(enable){ + QWidget *widgetStatistics = new QWidget(this); + widgetStatistics->setFixedHeight(15); + QHBoxLayout *hl1 = new QHBoxLayout; + hl1->setSpacing(0); + hl1->setContentsMargins(0, 0, 0, 0); + QLabel *lblMin = new QLabel("Min: "); + lblMin->setFixedWidth(40); + lblMin->setAlignment(Qt::AlignRight); + QLabel *lblMax = new QLabel("Max: "); + lblMax->setFixedWidth(40); + lblMax->setAlignment(Qt::AlignRight); + QLabel *lblSum = new QLabel("Sum: "); + lblSum->setFixedWidth(40); + lblSum->setAlignment(Qt::AlignRight); + QLabel *lblMinDisp = new QLabel(min); + lblMinDisp->setAlignment(Qt::AlignLeft); + QLabel *lblMaxDisp = new QLabel(max); + lblMaxDisp->setAlignment(Qt::AlignLeft); + QLabel *lblSumDisp = new QLabel(sum); + lblSumDisp->setAlignment(Qt::AlignLeft); + hl1->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); + hl1->addWidget(lblMin); + hl1->addWidget(lblMinDisp); + hl1->addItem(new QSpacerItem(20,20,QSizePolicy::Expanding,QSizePolicy::Fixed)); + hl1->addWidget(lblMax); + hl1->addWidget(lblMaxDisp); + hl1->addItem(new QSpacerItem(20,20,QSizePolicy::Expanding,QSizePolicy::Fixed)); + hl1->addWidget(lblSum); + hl1->addWidget(lblSumDisp); + hl1->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); + widgetStatistics->setLayout(hl1); + mainLayout->addWidget(widgetStatistics,2,0); + widgetStatistics->show(); + + } +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 815c17838..b2bba5916 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -219,6 +219,44 @@ void qDrawPlot::SetupWidgetWindow(){ connect(data_pause_timer, SIGNAL(timeout()), this, SLOT(UpdatePause())); + //display statistics + displayStatistics = false; + widgetStatistics = new QWidget(this); + widgetStatistics->setFixedHeight(15); + QHBoxLayout *hl1 = new QHBoxLayout; + hl1->setSpacing(0); + hl1->setContentsMargins(0, 0, 0, 0); + QLabel *lblMin = new QLabel("Min: "); + lblMin->setFixedWidth(40); + lblMin->setAlignment(Qt::AlignRight); + QLabel *lblMax = new QLabel("Max: "); + lblMax->setFixedWidth(40); + lblMax->setAlignment(Qt::AlignRight); + QLabel *lblSum = new QLabel("Sum: "); + lblSum->setFixedWidth(40); + lblSum->setAlignment(Qt::AlignRight); + lblMinDisp = new QLabel("-"); + lblMinDisp->setAlignment(Qt::AlignLeft); + lblMaxDisp = new QLabel("-"); + lblMaxDisp->setAlignment(Qt::AlignLeft); + lblSumDisp = new QLabel("-"); + lblSumDisp->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed); + lblSumDisp->setAlignment(Qt::AlignLeft); + hl1->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); + hl1->addWidget(lblMin); + hl1->addWidget(lblMinDisp); + hl1->addItem(new QSpacerItem(20,20,QSizePolicy::Expanding,QSizePolicy::Fixed)); + hl1->addWidget(lblMax); + hl1->addWidget(lblMaxDisp); + hl1->addItem(new QSpacerItem(20,20,QSizePolicy::Expanding,QSizePolicy::Fixed)); + hl1->addWidget(lblSum); + hl1->addWidget(lblSumDisp); + hl1->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed)); + widgetStatistics->setLayout(hl1); + layout->addWidget(widgetStatistics,2,0); + widgetStatistics->hide(); + + // setting default plot titles and settings plot1D = new SlsQt1DPlot(boxPlot); @@ -1156,7 +1194,19 @@ void qDrawPlot::UpdatePlot(){ plot1D->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]); XYRangeChanged = false; } + //Display Statistics + if(displayStatistics){ + double min=0,max=0,sum=0; + if(anglePlot) + GetStatistics(min,max,sum,histYAngleAxis,histNBins); + else + GetStatistics(min,max,sum,histYAxis[0],histNBins); + lblMinDisp->setText(QString("%1").arg(min)); + lblMaxDisp->setText(QString("%1").arg(max)); + lblSumDisp->setText(QString("%1").arg(sum)); + } if(saveAll) SavePlotAutomatic(); + } } }//2-d plot stuff @@ -1182,6 +1232,14 @@ void qDrawPlot::UpdatePlot(){ plot2D->GetPlot()->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]); XYRangeChanged = false; } + //Display Statistics + if(displayStatistics){ + double min=0,max=0,sum=0; + GetStatistics(min,max,sum,lastImageArray,nPixelsX*nPixelsY); + lblMinDisp->setText(QString("%1").arg(min)); + lblMaxDisp->setText(QString("%1").arg(max)); + lblSumDisp->setText(QString("%1").arg(sum)); + } if(saveAll) SavePlotAutomatic(); } } @@ -1257,7 +1315,8 @@ void qDrawPlot::ClonePlot(){ disconnect(this, SIGNAL(SetZRangeSignal(double,double)), plot2D, SLOT(SetZRange(double,double))); // create clone - winClone[i] = new qCloneWidget(this,i,boxPlot->title(),(int)plot_in_scope,plot1D,plot2D,sFilePath); + winClone[i] = new qCloneWidget(this,i,boxPlot->title(),(int)plot_in_scope,plot1D,plot2D,sFilePath, + displayStatistics,lblMinDisp->text(),lblMaxDisp->text(),lblSumDisp->text()); if(plot_in_scope==1){ plot1D = new SlsQt1DPlot(boxPlot); plot1D->setFont(QFont("Sans Serif",9,QFont::Normal)); @@ -1576,7 +1635,14 @@ int qDrawPlot::UpdateTrimbitPlot(bool fromDetector,bool Histogram){ //attach plot h->Attach(plot1D); } - + //Display Statistics + if(displayStatistics){ + double min=0,max=0,sum=0; + GetStatistics(min,max,sum,histYAxis[0],nPixelsX); + lblMinDisp->setText(QString("%1").arg(min)); + lblMaxDisp->setText(QString("%1").arg(max)); + lblSumDisp->setText(QString("%1").arg(sum)); + } #ifdef VERBOSE @@ -1614,7 +1680,14 @@ int qDrawPlot::UpdateTrimbitPlot(bool fromDetector,bool Histogram){ cout << "Trimbits Plot updated" << endl; #endif } - + //Display Statistics + if(displayStatistics){ + double min=0,max=0,sum=0; + GetStatistics(min,max,sum,lastImageArray,nPixelsX*nPixelsY); + lblMinDisp->setText(QString("%1").arg(min)); + lblMaxDisp->setText(QString("%1").arg(max)); + lblSumDisp->setText(QString("%1").arg(sum)); + } return qDefs::OK; @@ -1750,3 +1823,42 @@ void qDrawPlot::SetBinary(bool enable, int from, int to){ //------------------------------------------------------------------------------------------------------------------------------------------------- +void qDrawPlot::DisplayStatistics(bool enable){ +#ifdef VERBOSE + if(!enable) + cout << "Disabling Statistics Display" << endl; + else + cout << "Enabling Statistics Display" << endl; +#endif + if(enable) widgetStatistics->show(); + else widgetStatistics->hide(); + + displayStatistics = enable; + lblMinDisp->setText("-"); + lblMaxDisp->setText("-"); + lblSumDisp->setText("-"); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qDrawPlot::GetStatistics(double &min, double &max, double &sum, double* array, int size){ +#ifdef VERYVERBOSE + cout << "Calculating Statistics" << endl; +#endif + + for(int i=0; i < size; i++){ + //calculate min + if(array[i] < min) + min = array[i]; + //calculate max + if(array[i] > max) + max = array[i]; + //calculate sum + sum += array[i]; + } +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index 916b93bc9..2a67b666c 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -283,11 +283,13 @@ void qTabPlot::Initialization(){ connect(chkPoints, SIGNAL(toggled(bool)), myPlot, SLOT(SetMarkers(bool))); connect(chkLines, SIGNAL(toggled(bool)), myPlot, SLOT(SetLines(bool))); connect(chk1DLog, SIGNAL(toggled(bool)), myPlot, SIGNAL(LogySignal(bool))); + connect(chkStatistics, SIGNAL(toggled(bool)), myPlot, SLOT(DisplayStatistics(bool))); // 2D Plot box connect(chkInterpolate, SIGNAL(toggled(bool)),myPlot, SIGNAL(InterpolateSignal(bool))); connect(chkContour, SIGNAL(toggled(bool)),myPlot, SIGNAL(ContourSignal(bool))); connect(chkLogz, SIGNAL(toggled(bool)),myPlot, SIGNAL(LogzSignal(bool))); + connect(chkStatistics_2,SIGNAL(toggled(bool)),myPlot, SLOT(DisplayStatistics(bool))); // Plotting frequency box connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency())); connect(comboTimeGapUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency())); From 3c92f26be7fabd1be8ebd73999118008b12f1a65 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 16 Aug 2013 12:59:48 +0000 Subject: [PATCH 227/332] fixed some probelems wuth scans for receiver and also scans for allframes/frameindex git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@227 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_plot.ui | 14 +- slsDetectorGui/include/svnInfoGui.h | 6 +- slsDetectorGui/src/qDrawPlot.cpp | 53 ++++--- slsDetectorGui/src/qTabPlot.cpp | 190 +++++++++++++++++++++----- 4 files changed, 204 insertions(+), 59 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index a1a2bb915..05e5c1283 100644 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -1319,7 +1319,7 @@ Displays minimum, maximum and sum of values for each plot. true - true + false @@ -1342,6 +1342,9 @@ Displays minimum, maximum and sum of values for each plot. 0 + + <nobr>Enabled only when there is a Scan Level 0</nobr> + Level 0 @@ -1374,6 +1377,9 @@ Displays minimum, maximum and sum of values for each plot. 0 + + <nobr>Enabled only when there is a Scan Level 1</nobr> + Level 1 @@ -1403,6 +1409,9 @@ Displays minimum, maximum and sum of values for each plot. 0 + + <nobr>Enabled only when there is a Scan Level 0 or a Scan Level 1, not both</nobr> + Frame Index @@ -1432,6 +1441,9 @@ Displays minimum, maximum and sum of values for each plot. 0 + + <nobr>Disabled only for Angle Plots, Moench and Eiger Detectors</nobr> + All Frames diff --git a/slsDetectorGui/include/svnInfoGui.h b/slsDetectorGui/include/svnInfoGui.h index ee3ea724c..906073b92 100644 --- a/slsDetectorGui/include/svnInfoGui.h +++ b/slsDetectorGui/include/svnInfoGui.h @@ -2,10 +2,10 @@ #define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui" //#define SVNREPPATH "" #define SVNREPUUID "af1100a4-978c-4157-bff7-07162d2ba061" -//#define SVNREV 0x225 +//#define SVNREV 0x226 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "l_maliakal_d" -#define SVNREV 0x225 -#define SVNDATE 0x20130812 +#define SVNREV 0x226 +#define SVNDATE 0x20130813 // diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index b2bba5916..38de07cb1 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -339,34 +339,30 @@ void qDrawPlot::Initialization(){ void qDrawPlot::StartStopDaqToggle(bool stop_if_running){ -//#ifdef VERYVERBOSE +#ifdef VERYVERBOSE cout << "Entering StartStopDaqToggle(" << stop_if_running << ")" <setTimer(slsDetectorDefs::FRAME_NUMBER,-1)); int numTriggers = (isTriggerEnabled)*((int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1)); numFrames = ((numFrames==0)?1:numFrames); numTriggers = ((numTriggers==0)?1:numTriggers); - number_of_frames = numFrames * numTriggers; cout << "\tNumber of Frames per Scan/Measurement:" << number_of_frames << endl; - //get #scansets for level 0 and level 1 int numScan0 = myDet->getScanSteps(0); numScan0 = ((numScan0==0)?1:numScan0); int numScan1 = myDet->getScanSteps(1); numScan1 = ((numScan1==0)?1:numScan1); @@ -374,9 +370,8 @@ void qDrawPlot::StartStopDaqToggle(bool stop_if_running){ number_of_exposures = number_of_frames * numScan0 * numScan1; if(anglePlot) number_of_exposures = numScan0 * numScan1;// * numPos; - - cout << "\tNumber of Exposures Per Measurement:" << number_of_exposures << endl; + */ // ExposureTime exposureTime= ((double)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1))*1E-9); @@ -384,9 +379,7 @@ void qDrawPlot::StartStopDaqToggle(bool stop_if_running){ // Acquisition Period acquisitionPeriod= ((double)(myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,-1))*1E-9); cout << "\tAcquisition Period:" << setprecision (10) << acquisitionPeriod << endl; - cout << "\tFile Index:" << myDet->getFileIndex() << endl; - //to take the first data if frameFactor numFactor = 0; @@ -402,8 +395,6 @@ void qDrawPlot::StartStopDaqToggle(bool stop_if_running){ currentFileIndex = myDet->getFileIndex(); currentFrameIndex = 0; - - StartDaq(true); running=!running; @@ -502,15 +493,32 @@ void qDrawPlot::SetScanArgument(int scanArg){ #endif scanArgument = scanArg; + LockLastImageArray(); + if(plot_in_scope==1) Clear1DPlot(); - LockLastImageArray(); - - + maxPixelsY = 0; + minPixelsY = 0; nPixelsX = myDet->getTotalNumberOfChannels(slsDetectorDefs::X); nPixelsY = myDet->getTotalNumberOfChannels(slsDetectorDefs::Y); + // Number of Exposures - must be calculated here to get npixelsy for allframes/frameindex scans + int numFrames = (isFrameEnabled)*((int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1)); + int numTriggers = (isTriggerEnabled)*((int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1)); + numFrames = ((numFrames==0)?1:numFrames); + numTriggers = ((numTriggers==0)?1:numTriggers); + number_of_frames = numFrames * numTriggers; + cout << "\tNumber of Frames per Scan/Measurement:" << number_of_frames << endl; + //get #scansets for level 0 and level 1 + int numScan0 = myDet->getScanSteps(0); numScan0 = ((numScan0==0)?1:numScan0); + int numScan1 = myDet->getScanSteps(1); numScan1 = ((numScan1==0)?1:numScan1); + int numPos=myDet->getPositions(); + + number_of_exposures = number_of_frames * numScan0 * numScan1; + if(anglePlot) number_of_exposures = numScan0 * numScan1;// * numPos; + cout << "\tNumber of Exposures Per Measurement:" << number_of_exposures << endl; + //cannot do this in between measurements , so update instantly if(scanArgument==qDefs::Level0){ //no need to check if numsteps=0,cuz otherwise this mode wont be set in plot tab @@ -530,7 +538,11 @@ void qDrawPlot::SetScanArgument(int scanArg){ maxPixelsY = values[numSteps-1]; minPixelsY = values[0]; nPixelsY = numSteps; - } + }else if(scanArgument==qDefs::AllFrames) + nPixelsY = number_of_exposures; + else if(scanArgument==qDefs::FileIndex) + nPixelsY = number_of_frames; + if(minPixelsY>maxPixelsY){ double temp = minPixelsY; @@ -609,7 +621,7 @@ void qDrawPlot::SetupMeasurement(){ maxPixelsY = number_of_exposures - 1; minPixelsY = 0; if(!running) nPixelsY = number_of_exposures; - }//file index + }//frame index else if(scanArgument==qDefs::FileIndex){ maxPixelsY = number_of_frames - 1; minPixelsY = 0; @@ -671,6 +683,7 @@ int qDrawPlot::GetDataCallBack(detectorData *data, int fIndex, void *this_pointe int qDrawPlot::GetData(detectorData *data,int fIndex){ #ifdef VERYVERBOSE cout << "******Entering GetDatafunction********" << endl; + cout << "fIndex " << fIndex << endl; cout << "fname " << data->fileName << endl; cout << "npoints " << data->npoints << endl; cout << "npy " << data->npy << endl; @@ -812,6 +825,8 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){ lastImageNumber= currentFrame+1; //title imageTitle = temp_title; + cout<<"lastImageNumber:"<values[px]; pthread_mutex_unlock(&(last_image_complete_mutex)); @@ -1158,7 +1173,7 @@ void qDrawPlot::UpdatePlot(){ if(plot_in_scope==1){ if(lastImageNumber){ #ifdef VERYVERBOSE - cout << "Last Image Number:" << lastImageNumber << endl; + cout << "*Last Image Number:" << lastImageNumber << endl; #endif if(histNBins){ Clear1DPlot(); diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index 2a67b666c..baafa370b 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -174,8 +174,6 @@ void qTabPlot::SetupWidgetWindow(){ } Select1DPlot(isOriginallyOneD); - if(isOriginallyOneD) myPlot->Select1DPlot(); - else myPlot->Select2DPlot(); //to check if this should be enabled EnableScanBox(); @@ -248,12 +246,14 @@ void qTabPlot::Select1DPlot(bool b){ chkZAxis->setEnabled(false); chkZMin->setEnabled(false); chkZMax->setEnabled(false); + myPlot->Select1DPlot(); }else{ box1D->hide(); box2D->show(); chkZAxis->setEnabled(true); chkZMin->setEnabled(true); chkZMax->setEnabled(true); + myPlot->Select2DPlot(); } } @@ -267,7 +267,6 @@ void qTabPlot::Initialization(){ connect(radioHistogram, SIGNAL(toggled(bool)),this, SLOT(SetPlot())); connect(radioDataGraph, SIGNAL(toggled(bool)),this, SLOT(SetPlot())); // Scan box - /*connect(btnGroupScan, SIGNAL(buttonClicked(QAbstractButton *)),this, SLOT(SetScanArgument()));*/ connect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox())); // Snapshot box connect(btnClone, SIGNAL(clicked()),myPlot, SLOT(ClonePlot())); @@ -507,36 +506,27 @@ void qTabPlot::SetPlot(){ if(radioNoPlot->isChecked()){ cout << " - No Plot" << endl; - //Select1DPlot(isOriginallyOneD); - //if(isOriginallyOneD) {box1D->show(); box2D->hide();} - //if(!isOriginallyOneD){box2D->show(); box1D->hide();} myPlot->EnablePlot(false); - //if enable is true, disable everything - boxSnapshot->setEnabled(false); boxSave->setEnabled(false); boxFrequency->setEnabled(false); boxPlotAxis->setEnabled(false); boxScan->setEnabled(false); - }else {//if(radioDataGraph->isChecked()){ - cout << " - DataGraph" << endl; + }else { + if(radioDataGraph->isChecked()) + cout << " - DataGraph" << endl; + else + cout << " - Histogram" << endl; myPlot->EnablePlot(true); - //if enable is true, disable everything - if(isOriginallyOneD) {box1D->show(); box2D->hide();} - if(!isOriginallyOneD) {box2D->show(); box1D->hide();} Select1DPlot(isOriginallyOneD); - if(isOriginallyOneD) myPlot->Select1DPlot(); - else myPlot->Select2DPlot(); boxSnapshot->setEnabled(true); boxSave->setEnabled(true); boxFrequency->setEnabled(true); boxPlotAxis->setEnabled(true); - if(!myPlot->isRunning()) EnableScanBox(); - }/*else{ - cout << " - Histogram" << endl; - //select(2d) will set oneD to false, but originallyoneD will remember - }*/ + if(!myPlot->isRunning()) + EnableScanBox(); + } } @@ -683,10 +673,98 @@ void qTabPlot::SetFrequency(){ //------------------------------------------------------------------------------------------------------------------------------------------------- void qTabPlot::EnableScanBox(){ -#ifdef VERYVERBOSE +#ifdef VERBOSE cout << "Entering Enable Scan Box()" << endl; #endif + disconnect(radioNoPlot, SIGNAL(toggled(bool)),this, SLOT(SetPlot())); + disconnect(radioHistogram, SIGNAL(toggled(bool)),this, SLOT(SetPlot())); + disconnect(radioDataGraph, SIGNAL(toggled(bool)),this, SLOT(SetPlot())); + disconnect(boxScan, SIGNAL(toggled(bool)),this, SLOT(EnableScanBox())); + int mode0 = myDet->getScanMode(0); + int mode1 = myDet->getScanMode(1); + int ang; + bool angConvert = myDet->getAngularConversion(ang); + + //enabling it after it was plotted + radioDataGraph->setEnabled(true); + + + //if angle plot or originally 2d, uncheck and disable scanbox + if ((angConvert) || (!isOriginallyOneD)){ + boxScan->setChecked(false); + boxScan->setEnabled(false); + //disable histogram + radioHistogram->setEnabled(false); + if(radioHistogram->isChecked()) + radioDataGraph->setChecked(true); + //angle only + if((angConvert)&&(chkSuperimpose->isChecked())) + chkSuperimpose->setChecked(false); + chkSuperimpose->setEnabled(!angConvert); + myPlot->EnableAnglePlot(angConvert); + if(angConvert) + boxScan->setToolTip("Only 1D Plots enabled for Angle Plots"); + } + + //originally1d && not angle plot + else{ + boxScan->setToolTip(""); + boxScan->setEnabled(true); + if(mode0 || mode1) + boxScan->setChecked(true); + + //still 1d + if(!boxScan->isChecked()){ + radioHistogram->setEnabled(true); + /*if(radioHistogram->isChecked()) + EnablingNthFrameFunction(false);//just this + else EnablingNthFrameFunction(true); */ + } + + //2d enabled with boxscan + else{ + disconnect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency())); + disconnect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency())); + + comboFrequency->setCurrentIndex(1); + spinNthFrame->setValue(1); + SetFrequency(); + + //disable histogram for 2d + radioHistogram->setEnabled(false); + if(radioHistogram->isChecked()) + radioDataGraph->setChecked(true); + + /*//make sure nth frame frequency plot is disabled + EnablingNthFrameFunction(false); + */ + //enabling options + radioFileIndex->setEnabled(mode0||mode1); + if(mode0 && mode1){ + radioLevel0->setEnabled(false); + radioLevel1->setEnabled(false); + }else{ + radioLevel0->setEnabled(mode0); + radioLevel1->setEnabled(mode1); + } + //default is allframes if checked button is disabled + if(!btnGroupScan->checkedButton()->isEnabled()) + radioAllFrames->setChecked(true); + + connect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency())); + connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency())); + + + } + } + + connect(radioNoPlot, SIGNAL(toggled(bool)),this, SLOT(SetPlot())); + connect(radioHistogram, SIGNAL(toggled(bool)),this, SLOT(SetPlot())); + connect(radioDataGraph, SIGNAL(toggled(bool)),this, SLOT(SetPlot())); + connect(boxScan, SIGNAL(toggled(bool)),this, SLOT(EnableScanBox())); + +/* int mode0 = myDet->getScanMode(0); int mode1 = myDet->getScanMode(1); @@ -759,9 +837,7 @@ void qTabPlot::EnableScanBox(){ //boxFrequency->setEnabled(positionsExist); myPlot->EnableAnglePlot(positionsExist); - - //sets the scan argument - /*SetScanArgument();*/ +*/ } @@ -791,41 +867,85 @@ void qTabPlot::EnablingNthFrameFunction(bool enable){ //------------------------------------------------------------------------------------------------------------------------------------------------- void qTabPlot::SetScanArgument(){ - bool histogram = radioHistogram->isChecked(); +#ifdef VERYVERBOSE + cout << "Entering qTabPlot::SetScanArgument()" << endl; +#endif - //as default from histogram and default titles are set here if scanbox is disabled + //1d if(isOriginallyOneD){ dispXAxis->setText(defaultHistXAxisTitle); dispYAxis->setText(defaultHistYAxisTitle); myPlot->SetHistXAxisTitle(defaultHistXAxisTitle); myPlot->SetHistYAxisTitle(defaultHistYAxisTitle); - }else{ + Select1DPlot(true); + } + //2d + else{ dispXAxis->setText(defaultImageXAxisTitle); dispYAxis->setText(defaultImageYAxisTitle); dispZAxis->setText(defaultImageZAxisTitle); myPlot->SetImageXAxisTitle(defaultImageXAxisTitle); myPlot->SetImageYAxisTitle(defaultImageYAxisTitle); myPlot->SetImageZAxisTitle(defaultImageZAxisTitle); + Select1DPlot(false); } - Select1DPlot(isOriginallyOneD); - if(isOriginallyOneD) myPlot->Select1DPlot(); - else myPlot->Select2DPlot(); + + //angles (1D) + int ang; + if(myDet->getAngularConversion(ang)){ + dispXAxis->setText("Angles"); + myPlot->SetHistXAxisTitle("Angles"); + Select1DPlot(true); + } + + /* bool histogram = radioHistogram->isChecked(); + * else if(histogram)*/ + + //1d with scan + if(boxScan->isChecked()){ + + myPlot->SetScanArgument(btnGroupScan->checkedId()+1); + + switch(btnGroupScan->checkedId()){ + case 0://level0 + dispYAxis->setText("Scan Level 0"); + myPlot->SetImageYAxisTitle("Scan Level 0"); + break; + case 1://level1 + dispYAxis->setText("Scan Level 1"); + myPlot->SetImageYAxisTitle("Scan Level 1"); + break; + break; + case 2://file index + dispYAxis->setText("Frame Index"); + myPlot->SetImageYAxisTitle("Frame Index"); + break; + case 3://all frames + dispYAxis->setText("All Frames"); + myPlot->SetImageYAxisTitle("All Frames"); + break; + } + Select1DPlot(false); + }else + myPlot->SetScanArgument(qDefs::None); + + /* + Select1DPlot(isOriginallyOneD); + int ang; //if scans(1D or 2D) if((boxScan->isEnabled())||(histogram)){ //setting the title according to the scans Select1DPlot(isOriginallyOneD); - if(isOriginallyOneD) myPlot->Select1DPlot(); - else myPlot->Select2DPlot(); + }//angles (1D) else if(myDet->getAngularConversion(ang)){ dispXAxis->setText("Angles"); myPlot->SetHistXAxisTitle("Angles"); Select1DPlot(true); - myPlot->Select1DPlot(); } @@ -844,7 +964,6 @@ void qTabPlot::SetScanArgument(){ //set plot to 2d Select1DPlot(false); - myPlot->Select2DPlot(); } //2d else if((boxScan->isEnabled())&&(boxScan->isChecked())){ @@ -881,11 +1000,10 @@ void qTabPlot::SetScanArgument(){ //set plot to 2d Select1DPlot(false); - myPlot->Select2DPlot(); }else //done here so that it isnt set by default each time myPlot->SetScanArgument(qDefs::None); - +*/ qDefs::checkErrorMessage(myDet,"qTabPlot::SetScanArgument"); } From 061bd4251c04229153e278180ca44a53c9821664 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 16 Aug 2013 13:48:03 +0000 Subject: [PATCH 228/332] pedestalbug fixed, trylock changed to lock, binary has qtip git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@228 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_plot.ui | 12 +- slsDetectorGui/src/qDrawPlot.cpp | 236 ++++++++++++-------------- 2 files changed, 115 insertions(+), 133 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index 05e5c1283..47791aba3 100644 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -999,6 +999,11 @@ Displays minimum, maximum and sum of values for each plot. + + <nobr> +All values between <b>from</b> and <b>to</b> will be reset to 1, others to 0. +</nobr> + @@ -1020,6 +1025,11 @@ Displays minimum, maximum and sum of values for each plot. 0 + + <nobr> +All values between <b>from</b> and <b>to</b> will be reset to 1, others to 0. +</nobr> + Binary @@ -1326,7 +1336,7 @@ Displays minimum, maximum and sum of values for each plot. 10 20 - 346 + 341 26 diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 38de07cb1..bf0e6019d 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -725,40 +725,36 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){ //angle plotting if(anglePlot){ - while(1){ - if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ - //set title - plotTitle=QString(plotTitle_prefix)+QString(data->fileName).section('/',-1); - // Title - histTitle[0] = temp_title; + LockLastImageArray(); + //set title + plotTitle=QString(plotTitle_prefix)+QString(data->fileName).section('/',-1); + // Title + histTitle[0] = temp_title; - if(data->angles==NULL){ - cout<<"\n\nWARNING:RETURNED NULL instead of angles."<values,nAnglePixelsX*sizeof(double)); - SetHistXAxisTitle("Channel Number"); + if(data->angles==NULL){ + cout<<"\n\nWARNING:RETURNED NULL instead of angles."<values,nAnglePixelsX*sizeof(double)); + SetHistXAxisTitle("Channel Number"); - } - else{ - - lastImageNumber= currentFrame+1; - nAnglePixelsX = data->npoints; - histNBins = nAnglePixelsX; - nHists=1; - if(histXAngleAxis) delete [] histXAngleAxis; histXAngleAxis = new double[nAnglePixelsX]; - if(histYAngleAxis) delete [] histYAngleAxis; histYAngleAxis = new double[nAnglePixelsX]; - memcpy(histXAngleAxis,data->angles,nAnglePixelsX*sizeof(double)); - memcpy(histYAngleAxis,data->values,nAnglePixelsX*sizeof(double)); - SetHistXAxisTitle("Angles"); - } - pthread_mutex_unlock(&(last_image_complete_mutex)); - break; - } } + else{ + + lastImageNumber= currentFrame+1; + nAnglePixelsX = data->npoints; + histNBins = nAnglePixelsX; + nHists=1; + if(histXAngleAxis) delete [] histXAngleAxis; histXAngleAxis = new double[nAnglePixelsX]; + if(histYAngleAxis) delete [] histYAngleAxis; histYAngleAxis = new double[nAnglePixelsX]; + memcpy(histXAngleAxis,data->angles,nAnglePixelsX*sizeof(double)); + memcpy(histYAngleAxis,data->values,nAnglePixelsX*sizeof(double)); + SetHistXAxisTitle("Angles"); + } + UnlockLastImageArray(); currentFrame++; return 0; } @@ -796,98 +792,82 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){ //if scan //alframes if(scanArgument==qDefs::AllFrames){ - while(1){ - if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ - //set title - plotTitle=QString(plotTitle_prefix)+QString(data->fileName).section('/',-1); - //variables - lastImageNumber= currentFrame+1; - //title - imageTitle = temp_title; - //copy data - memcpy(lastImageArray+(currentScanDivLevel*nPixelsX),data->values,nPixelsX*sizeof(double)); - pthread_mutex_unlock(&(last_image_complete_mutex)); - break; - } - } + LockLastImageArray(); + //set title + plotTitle=QString(plotTitle_prefix)+QString(data->fileName).section('/',-1); + //variables + lastImageNumber= currentFrame+1; + //title + imageTitle = temp_title; + //copy data + memcpy(lastImageArray+(currentScanDivLevel*nPixelsX),data->values,nPixelsX*sizeof(double)); + UnlockLastImageArray(); currentFrame++; currentScanDivLevel++; return 0; } //file index if(scanArgument==qDefs::FileIndex){ - while(1){ - if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ - //set title - plotTitle=QString(plotTitle_prefix)+QString(data->fileName).section('/',-1); - //variables - if(currentFrameIndex == 0) currentScanDivLevel = 0; - lastImageNumber= currentFrame+1; - //title - imageTitle = temp_title; - cout<<"lastImageNumber:"<values[px]; - pthread_mutex_unlock(&(last_image_complete_mutex)); - break; - } - } + LockLastImageArray(); + //set title + plotTitle=QString(plotTitle_prefix)+QString(data->fileName).section('/',-1); + //variables + if(currentFrameIndex == 0) currentScanDivLevel = 0; + lastImageNumber= currentFrame+1; + //title + imageTitle = temp_title; + cout<<"lastImageNumber:"<values[px]; + UnlockLastImageArray(); currentFrame++; currentScanDivLevel++; return 0; } //level0 if(scanArgument==qDefs::Level0){ - while(1){ - if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ - //set title - plotTitle=QString(plotTitle_prefix)+QString(data->fileName).section('/',-1); - //get scanvariable0 - int ci = 0, fi = 0, p = 0, di = 0; double cs0 = 0 , cs1 = 0; - fileIOStatic::getVariablesFromFileName(string(data->fileName), ci, fi, p, cs0, cs1, di); - //variables - if(cs0!=currentScanValue) { - if(backwardScanPlot) currentScanDivLevel--; - else currentScanDivLevel++; - } - currentScanValue = cs0; - lastImageNumber= currentFrame+1; - //title - imageTitle = temp_title; - //copy data - for(unsigned int px=0;pxvalues[px]; - pthread_mutex_unlock(&(last_image_complete_mutex)); - break; - } + LockLastImageArray(); + //set title + plotTitle=QString(plotTitle_prefix)+QString(data->fileName).section('/',-1); + //get scanvariable0 + int ci = 0, fi = 0, p = 0, di = 0; double cs0 = 0 , cs1 = 0; + fileIOStatic::getVariablesFromFileName(string(data->fileName), ci, fi, p, cs0, cs1, di); + //variables + if(cs0!=currentScanValue) { + if(backwardScanPlot) currentScanDivLevel--; + else currentScanDivLevel++; } + currentScanValue = cs0; + lastImageNumber= currentFrame+1; + //title + imageTitle = temp_title; + //copy data + for(unsigned int px=0;pxvalues[px]; + UnlockLastImageArray(); currentFrame++; return 0; } //level1 if(scanArgument==qDefs::Level1){ - while(1){ - if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ - //set title - plotTitle=QString(plotTitle_prefix)+QString(data->fileName).section('/',-1); - //get scanvariable1 - int ci = 0, fi = 0, p = 0, di = 0; double cs0 = 0 , cs1 = 0; - fileIOStatic::getVariablesFromFileName(string(data->fileName), ci, fi, p, cs0, cs1, di); - //variables - if(cs1!=currentScanValue){ - if(backwardScanPlot) currentScanDivLevel--; - else currentScanDivLevel++; - } - currentScanValue = cs1; - lastImageNumber= currentFrame+1; - //title - imageTitle = temp_title; - //copy data - for(unsigned int px=0;pxvalues[px]; - pthread_mutex_unlock(&(last_image_complete_mutex)); - break; - } + LockLastImageArray(); + //set title + plotTitle=QString(plotTitle_prefix)+QString(data->fileName).section('/',-1); + //get scanvariable1 + int ci = 0, fi = 0, p = 0, di = 0; double cs0 = 0 , cs1 = 0; + fileIOStatic::getVariablesFromFileName(string(data->fileName), ci, fi, p, cs0, cs1, di); + //variables + if(cs1!=currentScanValue){ + if(backwardScanPlot) currentScanDivLevel--; + else currentScanDivLevel++; } + currentScanValue = cs1; + lastImageNumber= currentFrame+1; + //title + imageTitle = temp_title; + //copy data + for(unsigned int px=0;pxvalues[px]; + UnlockLastImageArray(); currentFrame++; return 0; } @@ -917,19 +897,20 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){ //recalculating pedestal if(startPedestalCal){ - pedestalCount++; + //start adding frames to get to the pedestal value if(pedestalCountvalues[px]; + tempPedestalVals[px] += data->values[px];//cout<<"tempPedestalVals[200]:"<values,nPixelsX*sizeof(double)); + pedestalCount++; } //calculate the pedestal value else if(pedestalCount==NUM_PEDESTAL_FRAMES){ cout << "Pedestal Calculated" << endl; for(unsigned int px=0;px Date: Fri, 16 Aug 2013 14:07:46 +0000 Subject: [PATCH 229/332] pedestal correction git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@229 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qDrawPlot.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index bf0e6019d..d071fb1d3 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -897,20 +897,19 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){ //recalculating pedestal if(startPedestalCal){ - //start adding frames to get to the pedestal value if(pedestalCountvalues[px];//cout<<"tempPedestalVals[200]:"<values[px]; memcpy(histYAxis[0],data->values,nPixelsX*sizeof(double)); pedestalCount++; } //calculate the pedestal value - else if(pedestalCount==NUM_PEDESTAL_FRAMES){ + if(pedestalCount==NUM_PEDESTAL_FRAMES){ cout << "Pedestal Calculated" << endl; for(unsigned int px=0;pxvalues[px]; memcpy(lastImageArray,data->values,nPixelsX*nPixelsY*sizeof(double)); + pedestalCount++; } //calculate the pedestal value - else if(pedestalCount==NUM_PEDESTAL_FRAMES){ + if(pedestalCount==NUM_PEDESTAL_FRAMES){ cout << "Pedestal Calculated" << endl; for(unsigned int px=0;px<(nPixelsX*nPixelsY);px++) tempPedestalVals[px] = tempPedestalVals[px]/(double)NUM_PEDESTAL_FRAMES; From 22de76c8b0696cbb53d20657b4f75f1e60229c0a Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 27 Aug 2013 15:47:07 +0000 Subject: [PATCH 230/332] histogram included, improved ready every frame, and other stuff.. a working version git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@230 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_plot.ui | 348 ++++++++++++++++++++++- slsDetectorGui/include/qDrawPlot.h | 22 ++ slsDetectorGui/include/qTabPlot.h | 9 +- slsDetectorGui/include/svnInfoGui.h | 6 +- slsDetectorGui/src/qDrawPlot.cpp | 250 +++++++++++------ slsDetectorGui/src/qTabPlot.cpp | 390 ++++++++++---------------- 6 files changed, 685 insertions(+), 340 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index 47791aba3..6376da9ce 100644 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -99,7 +99,7 @@ - 4 + 5 @@ -186,7 +186,7 @@ - + @@ -294,7 +294,7 @@ - + @@ -580,6 +580,167 @@ Displays minimum, maximum and sum of values for each plot. + + + true + + + + + 25 + 5 + 311 + 26 + + + + + 1 + + + + + true + + + + 0 + 0 + + + + from + + + + + + + true + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + 0 + + + 16777215 + + + 0 + + + + + + + true + + + + 0 + 0 + + + + to + + + + + + + true + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + 0 + + + 16777215 + + + 10000 + + + + + + + true + + + + 0 + 0 + + + + size + + + + + + + true + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + 0 + + + 16777215 + + + 1000 + + + + + + @@ -610,7 +771,7 @@ Displays minimum, maximum and sum of values for each plot. - 0 + 6 @@ -782,7 +943,7 @@ Displays minimum, maximum and sum of values for each plot. - + @@ -890,7 +1051,7 @@ Displays minimum, maximum and sum of values for each plot. - + @@ -1186,6 +1347,167 @@ Displays minimum, maximum and sum of values for each plot. + + + true + + + + + 25 + 5 + 311 + 26 + + + + + 1 + + + + + true + + + + 0 + 0 + + + + from + + + + + + + true + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + 0 + + + 16777215 + + + 0 + + + + + + + true + + + + 0 + 0 + + + + to + + + + + + + true + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + 0 + + + 16777215 + + + 10000 + + + + + + + true + + + + 0 + 0 + + + + size + + + + + + + true + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + 0 + + + 16777215 + + + 1000 + + + + + + @@ -1336,7 +1658,7 @@ Displays minimum, maximum and sum of values for each plot. 10 20 - 341 + 342 26 @@ -1902,7 +2224,7 @@ Displays minimum, maximum and sum of values for each plot. - false + true @@ -2443,6 +2765,16 @@ Interval between plots has 2 modes. A condition to be satisfied, in order to avo true + box1D + box2D + boxSave + boxScan + boxPlotAxis + groupBox_3 + boxFrequency + boxSnapshot + btnRight + btnLeft radioNoPlot diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index df010adac..4f2459f64 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -25,6 +25,14 @@ class qCloneWidget; #include #include "qwt_symbol.h" + +#include +#include +#include +#include +#include +#include + /** C++ Include Headers */ @@ -134,6 +142,9 @@ public: /** set binary range */ void SetBinary(bool enable, int from=0, int to=0); + /** Enable/Disable Histogram */ + void SetHistogram(bool enable,int min=0, int max=0, int size=0){histogram = enable;histFrom=min;histTo=max;histSize=size;}; + public slots: /** To select 1D or 2D plot @param i is 1 for 1D, else 2D plot */ @@ -545,6 +556,17 @@ QLabel *lblSumDisp; bool displayStatistics; +/* histogram */ +bool histogram; +int histFrom; +int histTo; +int histSize; +QwtPlotGrid *grid; +QwtPlotHistogram *plotHistogram; +QVector histogramSamples; + + + signals: void UpdatingPlotFinished(); diff --git a/slsDetectorGui/include/qTabPlot.h b/slsDetectorGui/include/qTabPlot.h index 08390742f..dd4f65e75 100644 --- a/slsDetectorGui/include/qTabPlot.h +++ b/slsDetectorGui/include/qTabPlot.h @@ -70,6 +70,7 @@ private: QDoubleSpinBox *spinTimeGap; QComboBox *comboTimeGapUnit; QButtonGroup *btnGroupScan; + QButtonGroup *btnGroupPlotType; /** some Default Values */ static QString defaultPlotTitle; @@ -97,12 +98,6 @@ private: */ void Initialization(); - /** This enabled/disables the nth frame from frequency plot - * @param enable enable/disable - */ - void EnablingNthFrameFunction(bool enable); - - public slots: /** Set frequency between plots*/ @@ -110,7 +105,7 @@ public slots: /** Enable Scan box */ - void EnableScanBox(); + void EnableScanBox(bool Histo=false); /** Update all ranges, interpolate etc after cloning */ diff --git a/slsDetectorGui/include/svnInfoGui.h b/slsDetectorGui/include/svnInfoGui.h index 906073b92..7d40dd535 100644 --- a/slsDetectorGui/include/svnInfoGui.h +++ b/slsDetectorGui/include/svnInfoGui.h @@ -2,10 +2,10 @@ #define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui" //#define SVNREPPATH "" #define SVNREPUUID "af1100a4-978c-4157-bff7-07162d2ba061" -//#define SVNREV 0x226 +//#define SVNREV 0x229 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "l_maliakal_d" -#define SVNREV 0x226 -#define SVNDATE 0x20130813 +#define SVNREV 0x229 +#define SVNDATE 0x20130816 // diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index d071fb1d3..0cd468372 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -9,7 +9,6 @@ #include "qCloneWidget.h" #include "slsDetector.h" #include"fileIOStatic.h" - // Project Class Headers #include "slsDetector.h" #include "multiSlsDetector.h" @@ -19,6 +18,8 @@ #include #include #include +//#include "qwt_double_interval.h" +#include "qwt_series_data.h" // C++ Include Headers #include #include @@ -195,6 +196,20 @@ void qDrawPlot::SetupWidgetWindow(){ binaryFrom = 0; binaryTo = 0; + //histogram + histogram = false; + histFrom = 0; + histTo = 0; + histSize = 0; + grid = new QwtPlotGrid; + grid->enableXMin(true); + grid->enableYMin(true); + grid->setMajPen(QPen(Qt::black, 0, Qt::DotLine)); + grid->setMinPen(QPen(Qt::gray, 0 , Qt::DotLine)); + plotHistogram = new QwtPlotHistogram(); + plotHistogram->setStyle(QwtPlotHistogram::Columns); + + //widget related initialization @@ -464,9 +479,10 @@ bool qDrawPlot::StartOrStopThread(bool start){ //refixing all the min and max for all scans if (scanArgument == qDefs::None); - else + else{ + plot2D->GetPlot()->UnZoom(); plot2D->GetPlot()->SetZoom(-0.5,startPixel,nPixelsX,endPixel-startPixel); - + } cout << "Starting new acquisition thread ...." << endl; // Start acquiring data from server @@ -498,11 +514,6 @@ void qDrawPlot::SetScanArgument(int scanArg){ if(plot_in_scope==1) Clear1DPlot(); - maxPixelsY = 0; - minPixelsY = 0; - nPixelsX = myDet->getTotalNumberOfChannels(slsDetectorDefs::X); - nPixelsY = myDet->getTotalNumberOfChannels(slsDetectorDefs::Y); - // Number of Exposures - must be calculated here to get npixelsy for allframes/frameindex scans int numFrames = (isFrameEnabled)*((int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1)); int numTriggers = (isTriggerEnabled)*((int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1)); @@ -519,6 +530,12 @@ void qDrawPlot::SetScanArgument(int scanArg){ if(anglePlot) number_of_exposures = numScan0 * numScan1;// * numPos; cout << "\tNumber of Exposures Per Measurement:" << number_of_exposures << endl; + + maxPixelsY = 0; + minPixelsY = 0; + nPixelsX = myDet->getTotalNumberOfChannels(slsDetectorDefs::X); + nPixelsY = myDet->getTotalNumberOfChannels(slsDetectorDefs::Y); + //cannot do this in between measurements , so update instantly if(scanArgument==qDefs::Level0){ //no need to check if numsteps=0,cuz otherwise this mode wont be set in plot tab @@ -569,6 +586,30 @@ void qDrawPlot::SetScanArgument(int scanArg){ lastImageArray[py*nPixelsX+px] = 0; + //histogram + if(histogram){ + histogramSamples.resize(0); + int iloop = 0; + int min = iloop*histSize + histFrom; + int max = (iloop+1)*histSize + histFrom; + while(min < histTo){ + histogramSamples.resize(iloop+1); + histogramSamples[iloop].interval.setInterval(min,max); + histogramSamples[iloop].value = 0; + iloop++; + min = max; + max = (iloop+1)*histSize + histFrom; + if(max>histTo) + max = histTo; + } + //print values + cout << "Histogram Intervals:" << endl; + for(int j=0;jvalues[px]; UnlockLastImageArray(); @@ -885,54 +924,80 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){ if(plot_in_scope==1){ // Titles histTitle[0] = temp_title; - // Persistency - if(currentPersistency < persistency)currentPersistency++; - else currentPersistency=persistency; - nHists = currentPersistency+1; - histNBins = nPixelsX; - // copy data - for(int i=currentPersistency;i>0;i--) - memcpy(histYAxis[i],histYAxis[i-1],nPixelsX*sizeof(double)); - - //recalculating pedestal - if(startPedestalCal){ - //start adding frames to get to the pedestal value - if(pedestalCountvalues[px]; - memcpy(histYAxis[0],data->values,nPixelsX*sizeof(double)); - pedestalCount++; - } - //calculate the pedestal value - if(pedestalCount==NUM_PEDESTAL_FRAMES){ - cout << "Pedestal Calculated" << endl; - for(unsigned int px=0;pxvalues,nPixelsX*sizeof(double)); + //histogram + if(histogram){ resetAccumulate = false; + lastImageNumber= currentFrame+1; + + int numValues = nPixelsX; + if(originally2D) + numValues = nPixelsX*nPixelsY; + + for(int i=0;ivalues[i] <= histFrom) || (data->values[i] >= histTo)) + continue; + //check for intervals, increment if validates + for(int j=0;jvalues[i])) + histogramSamples[j].value += 1; + + } + } + } - //pedestal or accumulate + //not histogram else{ - for(unsigned int px=0;px<(nPixelsX*nPixelsY);px++){ - if(accumulate) - histYAxis[0][px] += data->values[px]; - else - histYAxis[0][px] = data->values[px]; - if(pedestal) - histYAxis[0][px] = histYAxis[0][px] - (pedestalVals[px]); - if(binary) { - if ((histYAxis[0][px] >= binaryFrom) && (histYAxis[0][px] <= binaryTo)) - histYAxis[0][px] = 1; + // Persistency + if(currentPersistency < persistency)currentPersistency++; + else currentPersistency=persistency; + nHists = currentPersistency+1; + histNBins = nPixelsX; + + // copy data + for(int i=currentPersistency;i>0;i--) + memcpy(histYAxis[i],histYAxis[i-1],nPixelsX*sizeof(double)); + + //recalculating pedestal + if(startPedestalCal){ + //start adding frames to get to the pedestal value + if(pedestalCountvalues[px]; + memcpy(histYAxis[0],data->values,nPixelsX*sizeof(double)); + pedestalCount++; + } + //calculate the pedestal value + if(pedestalCount==NUM_PEDESTAL_FRAMES){ + cout << "Pedestal Calculated" << endl; + for(unsigned int px=0;pxvalues,nPixelsX*sizeof(double)); + resetAccumulate = false; + } + //pedestal or accumulate + else{ + for(unsigned int px=0;px<(nPixelsX*nPixelsY);px++){ + if(accumulate) + histYAxis[0][px] += data->values[px]; else - histYAxis[0][px] = 0; + histYAxis[0][px] = data->values[px]; + if(pedestal) + histYAxis[0][px] = histYAxis[0][px] - (pedestalVals[px]); + if(binary) { + if ((histYAxis[0][px] >= binaryFrom) && (histYAxis[0][px] <= binaryTo)) + histYAxis[0][px] = 1; + else + histYAxis[0][px] = 0; + } } } } @@ -955,7 +1020,6 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){ cout << "Pedestal Calculated" << endl; for(unsigned int px=0;px<(nPixelsX*nPixelsY);px++) tempPedestalVals[px] = tempPedestalVals[px]/(double)NUM_PEDESTAL_FRAMES; - memcpy(pedestalVals,tempPedestalVals,nPixelsX*nPixelsY*sizeof(double)); startPedestalCal = 0; } @@ -1012,9 +1076,9 @@ int qDrawPlot::GetAcquisitionFinishedCallBack(double currentProgress,int detecto int qDrawPlot::AcquisitionFinished(double currentProgress, int detectorStatus){ -//#ifdef VERBOSE +#ifdef VERBOSE cout << "\nEntering Acquisition Finished with status " ; -//#endif +#endif QString status = QString(slsDetectorBase::runStatusType(slsDetectorDefs::runStatus(detectorStatus)).c_str()); #ifdef VERBOSE cout << status.toAscii().constData() << " and progress " << currentProgress << endl; @@ -1078,9 +1142,9 @@ int qDrawPlot::GetMeasurementFinishedCallBack(int currentMeasurementIndex, int f int qDrawPlot::MeasurementFinished(int currentMeasurementIndex, int fileIndex){ -//#ifdef VERBOSE +#ifdef VERBOSE cout << "Entering Measurement Finished with currentMeasurement " << currentMeasurementIndex << " and fileIndex " << fileIndex << endl; -//#endif +#endif //to make sure it plots the last frame before setting lastimagearray all to 0 //if(plot_in_scope==2) usleep(500000); @@ -1130,8 +1194,10 @@ void qDrawPlot::SelectPlot(int i){ //1 for 1D otherwise 2D void qDrawPlot::Clear1DPlot(){ - for(QVector::iterator h = plot1D_hists.begin(); - h!=plot1D_hists.end();h++) (*h)->Detach(plot1D); //clear plot + for(QVector::iterator h = plot1D_hists.begin(); h!=plot1D_hists.end();h++) + (*h)->Detach(plot1D); + + plotHistogram->detach(); } @@ -1153,31 +1219,46 @@ void qDrawPlot::UpdatePlot(){ if(plot_in_scope==1){ if(lastImageNumber){ #ifdef VERYVERBOSE - cout << "*Last Image Number:" << lastImageNumber << endl; + cout << "Last Image Number:" << lastImageNumber << endl; #endif if(histNBins){ Clear1DPlot(); plot1D->SetXTitle(histXAxisTitle.toAscii().constData()); plot1D->SetYTitle(histYAxisTitle.toAscii().constData()); - for(int hist_num=0;hist_num<(int)nHists;hist_num++){ - SlsQtH1D* h; - if(hist_num+1>plot1D_hists.size()){ - if(anglePlot) - plot1D_hists.append(h=new SlsQtH1D("",histNBins,histXAngleAxis,histYAngleAxis)); - else - plot1D_hists.append(h=new SlsQtH1D("",histNBins,histXAxis,GetHistYAxis(hist_num))); - h->SetLineColor(hist_num+1); - }else{ - h=plot1D_hists.at(hist_num); - if(anglePlot) - h->SetData(histNBins,histXAngleAxis,histYAngleAxis); - else - h->SetData(histNBins,histXAxis,GetHistYAxis(hist_num)); - } - SetStyle(h); + + //histogram + if(histogram){ + plotHistogram->setData(new QwtIntervalSeriesData(histogramSamples)); + plotHistogram->setPen(QPen(Qt::red)); + plotHistogram->setBrush(QBrush(Qt::red,Qt::Dense4Pattern));//Qt::SolidPattern histFrameIndexTitle->setText(GetHistTitle(0)); - //h->setTitle(GetHistTitle(hist_num)); - h->Attach(plot1D); + plotHistogram->attach(plot1D); + plot1D->SetZoomBase(plotHistogram->boundingRect().left(),0, + plotHistogram->boundingRect().width(),plotHistogram->boundingRect().height()); + } + //not histogram + else{ + for(int hist_num=0;hist_num<(int)nHists;hist_num++){ + SlsQtH1D* h; + if(hist_num+1>plot1D_hists.size()){ + if(anglePlot) + plot1D_hists.append(h=new SlsQtH1D("",histNBins,histXAngleAxis,histYAngleAxis)); + else + plot1D_hists.append(h=new SlsQtH1D("",histNBins,histXAxis,GetHistYAxis(hist_num))); + h->SetLineColor(hist_num+1); + }else{ + h=plot1D_hists.at(hist_num); + if(anglePlot) + h->SetData(histNBins,histXAngleAxis,histYAngleAxis); + else + h->SetData(histNBins,histXAxis,GetHistYAxis(hist_num)); + } + SetStyle(h); + histFrameIndexTitle->setText(GetHistTitle(0)); + //h->setTitle(GetHistTitle(hist_num)); + h->Attach(plot1D); + } + plot1D->Update(); } // update range if required if(XYRangeChanged){ @@ -1209,13 +1290,15 @@ void qDrawPlot::UpdatePlot(){ if(lastImageArray){ if(lastImageNumber&&last_plot_number!=(int)lastImageNumber && //there is a new plot nPixelsX>0&&nPixelsY>0){ - //plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,-0.5,nPixelsY-0.5,lastImageArray); plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,startPixel,endPixel,lastImageArray); plot2D->setTitle(GetImageTitle()); plot2D->SetXTitle(imageXAxisTitle); plot2D->SetYTitle(imageYAxisTitle); plot2D->SetZTitle(imageZAxisTitle); - plot2D->UpdateNKeepSetRangeIfSet(); //this will keep a "set" z range, and call Plot()->Update(); + plot2D->UpdateNKeepSetRangeIfSet(); //keep a "set" z range, and call Update(); + //to solve the problems regarding zooming out and zoom in + + //plot2D->GetPlot()->SetZoom(-0.5,startPixel,nPixelsX,endPixel-startPixel); } // update range if required if(XYRangeChanged){ @@ -1227,6 +1310,7 @@ void qDrawPlot::UpdatePlot(){ plot2D->GetPlot()->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]); XYRangeChanged = false; } + plot2D->GetPlot()->Update(); //Display Statistics if(displayStatistics){ double min=0,max=0,sum=0; @@ -1238,16 +1322,14 @@ void qDrawPlot::UpdatePlot(){ if(saveAll) SavePlotAutomatic(); } } - //} last_plot_number=lastImageNumber; - //set plot title boxPlot->setTitle(plotTitle); } UnlockLastImageArray(); } - //if acqq stopped before this line, it continues from here, shouldnt restart plotting timer + //if acq stopped before this line, it continues from here, shouldnt restart plotting timer if(!stop_signal){ if(!frameFactor) plot_update_timer->start((int)timerValue); diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index baafa370b..e51eee995 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -44,7 +44,8 @@ qTabPlot::qTabPlot(QWidget *parent,multiSlsDetector*& detector, qDrawPlot*& plot spinNthFrame(0), spinTimeGap(0), comboTimeGapUnit(0), - btnGroupScan(0){ + btnGroupScan(0), + btnGroupPlotType(0){ setupUi(this); SetupWidgetWindow(); Initialization(); @@ -77,6 +78,12 @@ void qTabPlot::SetupWidgetWindow(){ btnGroupScan->addButton(radioFileIndex,2); btnGroupScan->addButton(radioAllFrames,3); +//plot type + btnGroupPlotType = new QButtonGroup(this); + btnGroupPlotType->addButton(radioNoPlot,0); + btnGroupPlotType->addButton(radioDataGraph,1); + btnGroupPlotType->addButton(radioHistogram,2); + // Plot Axis dispTitle->setEnabled(false); dispXAxis->setEnabled(false); @@ -146,19 +153,15 @@ void qTabPlot::SetupWidgetWindow(){ switch(myDet->getDetectorsType()){ case slsDetectorDefs::MYTHEN: isOriginallyOneD = true; - chkPedestal->setEnabled(false); - btnRecalPedestal->setEnabled(false); - chkPedestal_2->setEnabled(false); - btnRecalPedestal_2->setEnabled(false); + pagePedestal->setEnabled(false); + pagePedestal_2->setEnabled(false); chkBinary->setEnabled(false); chkBinary_2->setEnabled(false); break; case slsDetectorDefs::EIGER: isOriginallyOneD = false; - chkPedestal->setEnabled(false); - btnRecalPedestal->setEnabled(false); - chkPedestal_2->setEnabled(false); - btnRecalPedestal_2->setEnabled(false); + pagePedestal->setEnabled(false); + pagePedestal_2->setEnabled(false); chkBinary->setEnabled(false); chkBinary_2->setEnabled(false); break; @@ -231,6 +234,12 @@ void qTabPlot::SetPlotOptionsLeftPage(){ void qTabPlot::Select1DPlot(bool b){ +#ifdef VERBOSE + if(b) + cout << "Selecting 1D Plot" << endl; + else + cout << "Selecting 2D Plot" << endl; +#endif isOneD = b; lblFrom->setEnabled(false); lblTo->setEnabled(false); @@ -263,11 +272,9 @@ void qTabPlot::Select1DPlot(bool b){ void qTabPlot::Initialization(){ // Plot arguments box - connect(radioNoPlot, SIGNAL(toggled(bool)),this, SLOT(SetPlot())); - connect(radioHistogram, SIGNAL(toggled(bool)),this, SLOT(SetPlot())); - connect(radioDataGraph, SIGNAL(toggled(bool)),this, SLOT(SetPlot())); + connect(btnGroupPlotType,SIGNAL(buttonClicked(int)),this, SLOT(SetPlot())); // Scan box - connect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox())); + connect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox())); // Snapshot box connect(btnClone, SIGNAL(clicked()),myPlot, SLOT(ClonePlot())); connect(btnCloseClones, SIGNAL(clicked()),myPlot, SLOT(CloseClones())); @@ -350,6 +357,12 @@ void qTabPlot::Initialization(){ void qTabPlot::EnablePersistency(bool enable){ +#ifdef VERBOSE + if(enable) + cout << "Enabling Persistency" << endl; + else + cout << "Disabling Persistency" << endl; +#endif lblPersistency->setEnabled(enable); spinPersistency->setEnabled(enable); if(enable) myPlot->SetPersistency(spinPersistency->value()); @@ -362,6 +375,9 @@ void qTabPlot::EnablePersistency(bool enable){ void qTabPlot::SetTitles(){ +#ifdef VERBOSE + cout << "Setting Plot Titles" << endl; +#endif // Plot Title if(dispTitle->isEnabled()) myPlot->SetPlotTitlePrefix(dispTitle->text()); @@ -512,12 +528,8 @@ void qTabPlot::SetPlot(){ boxFrequency->setEnabled(false); boxPlotAxis->setEnabled(false); boxScan->setEnabled(false); - }else { - if(radioDataGraph->isChecked()) - cout << " - DataGraph" << endl; - else - cout << " - Histogram" << endl; - + }else if(radioDataGraph->isChecked()){ + cout << " - DataGraph" << endl; myPlot->EnablePlot(true); Select1DPlot(isOriginallyOneD); boxSnapshot->setEnabled(true); @@ -527,19 +539,40 @@ void qTabPlot::SetPlot(){ if(!myPlot->isRunning()) EnableScanBox(); } + else{ + //histogram and 2d scans dont work + if(boxScan->isChecked()){ + qDefs::Message(qDefs::WARNING,"Histogram cannot be used together with 2D Scan Plots.
" + "Uncheck 2D Scan plots to plot Histograms", "qTabPlot::SetPlot"); + radioDataGraph->setChecked(true); + return; + } + + cout << " - Histogram" << endl; + myPlot->EnablePlot(true); + Select1DPlot(isOriginallyOneD); + boxSnapshot->setEnabled(true); + boxSave->setEnabled(true); + boxFrequency->setEnabled(true); + boxPlotAxis->setEnabled(true); + if(!myPlot->isRunning()) + EnableScanBox(true); + qDefs::Message(qDefs::INFORMATION,"Please check the Plot Histogram Options below " + "before Starting Acquitision","qTabPlot::SetPlot"); + } } //------------------------------------------------------------------------------------------------------------------------------------------------- void qTabPlot::SetFrequency(){ - +#ifdef VERBOSE + cout << "Setting Plot Interval Frequency" << endl; +#endif disconnect(comboTimeGapUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency())); disconnect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetFrequency())); disconnect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency())); disconnect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency())); - - double timeMS,acqPeriodMS; double minPlotTimer = myPlot->GetMinimumPlotTimer(); char cMin[200]; @@ -665,80 +698,89 @@ void qTabPlot::SetFrequency(){ connect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetFrequency())); connect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency())); connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency())); - qDefs::checkErrorMessage(myDet,"qTabPlot::SetFrequency"); } //------------------------------------------------------------------------------------------------------------------------------------------------- -void qTabPlot::EnableScanBox(){ +void qTabPlot::EnableScanBox(bool Histo){ #ifdef VERBOSE - cout << "Entering Enable Scan Box()" << endl; + cout << "Entering Enable Scan Box, Histo:" << Histo << endl; #endif - disconnect(radioNoPlot, SIGNAL(toggled(bool)),this, SLOT(SetPlot())); - disconnect(radioHistogram, SIGNAL(toggled(bool)),this, SLOT(SetPlot())); - disconnect(radioDataGraph, SIGNAL(toggled(bool)),this, SLOT(SetPlot())); - disconnect(boxScan, SIGNAL(toggled(bool)),this, SLOT(EnableScanBox())); + disconnect(btnGroupPlotType,SIGNAL(buttonClicked(int)),this, SLOT(SetPlot())); + disconnect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox())); int mode0 = myDet->getScanMode(0); int mode1 = myDet->getScanMode(1); int ang; bool angConvert = myDet->getAngularConversion(ang); - //enabling it after it was plotted radioDataGraph->setEnabled(true); - + radioHistogram->setEnabled(true); + chkSuperimpose->setEnabled(true); + pageAccumulate->setEnabled(true); + pageAccumulate_2->setEnabled(true); + if((myDet->getDetectorsType() == slsDetectorDefs::GOTTHARD) || (myDet->getDetectorsType() == slsDetectorDefs::MOENCH)){ + pagePedestal->setEnabled(true); + pagePedestal_2->setEnabled(true); + chkBinary->setEnabled(true); + chkBinary_2->setEnabled(true); + } //if angle plot or originally 2d, uncheck and disable scanbox if ((angConvert) || (!isOriginallyOneD)){ boxScan->setChecked(false); boxScan->setEnabled(false); - //disable histogram - radioHistogram->setEnabled(false); - if(radioHistogram->isChecked()) - radioDataGraph->setChecked(true); - //angle only - if((angConvert)&&(chkSuperimpose->isChecked())) - chkSuperimpose->setChecked(false); - chkSuperimpose->setEnabled(!angConvert); + + //persistency, accumulate, pedestal, binary + if(angConvert){ + if(chkSuperimpose->isChecked()) chkSuperimpose->setChecked(false); + if(chkPedestal->isChecked()) chkPedestal->setChecked(false); + if(chkPedestal_2->isChecked()) chkPedestal_2->setChecked(false); + if(chkAccumulate->isChecked()) chkAccumulate->setChecked(false); + if(chkAccumulate_2->isChecked())chkAccumulate_2->setChecked(false); + if(chkBinary->isChecked()) chkBinary->setChecked(false); + if(chkBinary_2->isChecked()) chkBinary_2->setChecked(false); + pagePedestal->setEnabled(false); + pagePedestal_2->setEnabled(false); + chkBinary->setEnabled(false); + chkBinary_2->setEnabled(false); + pageAccumulate->setEnabled(false); + pageAccumulate_2->setEnabled(false); + } + + + myPlot->EnableAnglePlot(angConvert); - if(angConvert) + if(angConvert){ boxScan->setToolTip("Only 1D Plots enabled for Angle Plots"); + //disable histogram + if(radioHistogram->isChecked()){ + radioDataGraph->setChecked(true); + radioHistogram->setEnabled(false); + } + } } //originally1d && not angle plot else{ boxScan->setToolTip(""); boxScan->setEnabled(true); - if(mode0 || mode1) - boxScan->setChecked(true); - - //still 1d - if(!boxScan->isChecked()){ - radioHistogram->setEnabled(true); - /*if(radioHistogram->isChecked()) - EnablingNthFrameFunction(false);//just this - else EnablingNthFrameFunction(true); */ - } + /*if(mode0 || mode1) + boxScan->setChecked(true);*/ //2d enabled with boxscan - else{ + if(boxScan->isChecked()){ + //read every frame disconnect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency())); disconnect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency())); - comboFrequency->setCurrentIndex(1); spinNthFrame->setValue(1); SetFrequency(); + connect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency())); + connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency())); - //disable histogram for 2d - radioHistogram->setEnabled(false); - if(radioHistogram->isChecked()) - radioDataGraph->setChecked(true); - - /*//make sure nth frame frequency plot is disabled - EnablingNthFrameFunction(false); - */ //enabling options radioFileIndex->setEnabled(mode0||mode1); if(mode0 && mode1){ @@ -751,119 +793,57 @@ void qTabPlot::EnableScanBox(){ //default is allframes if checked button is disabled if(!btnGroupScan->checkedButton()->isEnabled()) radioAllFrames->setChecked(true); - - connect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency())); - connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency())); - - } } - connect(radioNoPlot, SIGNAL(toggled(bool)),this, SLOT(SetPlot())); - connect(radioHistogram, SIGNAL(toggled(bool)),this, SLOT(SetPlot())); - connect(radioDataGraph, SIGNAL(toggled(bool)),this, SLOT(SetPlot())); - connect(boxScan, SIGNAL(toggled(bool)),this, SLOT(EnableScanBox())); -/* - int mode0 = myDet->getScanMode(0); - int mode1 = myDet->getScanMode(1); - - //if it was checked before or disabled before, it remembers to check it again - bool checkedBefore = boxScan->isChecked();//||(!boxScan->isEnabled())); - - int ang; - //none of these scan plotting options make sense if positions exists - bool positionsExist = myDet->getAngularConversion(ang);//myDet->getPositions(); - - qDefs::checkErrorMessage(myDet,"qTabPlot::EnableScanBox"); - - //only now enable/disable - boxScan->setEnabled((mode0||mode1)&&(!positionsExist)); - - //after plotting, enable datagraph if it was disabled while plotting(refresh) - radioDataGraph->setEnabled(true); - - - //if there are scan - if(boxScan->isEnabled()){ - //disable histogram - if(radioHistogram->isChecked()) + //histogram + if(radioHistogram->isChecked()){ + //switch back to datagraph + if(!Histo) radioDataGraph->setChecked(true); - radioHistogram->setEnabled(false); - //make sure nth frame frequency plot is disabled - EnablingNthFrameFunction(false); + pageHistogram->setEnabled(true); + pageHistogram_2->setEnabled(true); + stackedWidget->setCurrentIndex(stackedWidget->count()-1); + stackedWidget_2->setCurrentIndex(stackedWidget_2->count()-1); + box1D->setTitle(QString("1D Plot Options %1 - Histogram").arg(stackedWidget->currentIndex()+1)); + box2D->setTitle(QString("2D Plot Options %1 - Histogram").arg(stackedWidget_2->currentIndex()+1)); - //if 2d is chosen or not for scan - if(boxScan->isChecked()){ + if(chkSuperimpose->isChecked()) chkSuperimpose->setChecked(false); + if(chkPedestal->isChecked()) chkPedestal->setChecked(false); + if(chkPedestal_2->isChecked()) chkPedestal_2->setChecked(false); + if(chkAccumulate->isChecked()) chkAccumulate->setChecked(false); + if(chkAccumulate_2->isChecked())chkAccumulate_2->setChecked(false); + if(chkBinary->isChecked()) chkBinary->setChecked(false); + if(chkBinary_2->isChecked()) chkBinary_2->setChecked(false); + pagePedestal->setEnabled(false); + pagePedestal_2->setEnabled(false); + chkBinary->setEnabled(false); + chkBinary_2->setEnabled(false); + pageAccumulate->setEnabled(false); + pageAccumulate_2->setEnabled(false); - boxScan->setChecked(checkedBefore); - //make sure nth frame frequency plot is disabled - EnablingNthFrameFunction(false); + //read every frame + disconnect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency())); + disconnect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency())); + comboFrequency->setCurrentIndex(1); + spinNthFrame->setValue(1); + SetFrequency(); + connect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency())); + connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency())); - // - if(mode0 && mode1){ - if(!radioFileIndex->isChecked()) radioAllFrames->setChecked(true); - radioLevel0->setEnabled(false); - radioLevel1->setEnabled(false); - }else{ - radioLevel0->setEnabled(mode0); - radioLevel1->setEnabled(mode1); - } - //only if level0 or level1 is checked - if((radioLevel0->isChecked())||(radioLevel1->isChecked())){ - if(mode0) radioLevel0->setChecked(true); - if(mode1) radioLevel1->setChecked(true); - } - } - } - else{ - //histogram for 1d - if(isOriginallyOneD){ - radioHistogram->setEnabled(true); - if(radioHistogram->isChecked()) - EnablingNthFrameFunction(false); - else - EnablingNthFrameFunction(true); - } + }else{ + pageHistogram->setEnabled(false); + pageHistogram_2->setEnabled(false); } - - //positions - if((positionsExist)&&(chkSuperimpose->isChecked())) chkSuperimpose->setChecked(false); - chkSuperimpose->setEnabled(!positionsExist); - //box frequency should be enabled cuz its a normal 1d plot - //boxFrequency->setEnabled(positionsExist); - myPlot->EnableAnglePlot(positionsExist); - -*/ + connect(btnGroupPlotType,SIGNAL(buttonClicked(int)),this, SLOT(SetPlot())); + connect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox())); } -//------------------------------------------------------------------------------------------------------------------------------------------------- - -void qTabPlot::EnablingNthFrameFunction(bool enable){ -#ifdef VERYVERBOSE - cout << "Enabling Nth Frame : " << enable << endl; -#endif - QStandardItemModel* model = qobject_cast(comboFrequency->model()); - QStandardItem* item = model->itemFromIndex(model->index(1, comboFrequency->modelColumn(), comboFrequency->rootModelIndex())); - - //enabling/disabling is easy if it wasnt selected anyway - if(comboFrequency->currentIndex()!=1) - item->setEnabled(enable); - else{ - //only when it was enabled before and now to disable is a problem - if(!enable){ - spinTimeGap->setValue(myPlot->GetMinimumPlotTimer()); - comboFrequency->setCurrentIndex(0); - item->setEnabled(false); - } - } - -} - //------------------------------------------------------------------------------------------------------------------------------------------------- void qTabPlot::SetScanArgument(){ @@ -891,6 +871,15 @@ void qTabPlot::SetScanArgument(){ } + //histogram default - set before setscanargument + myPlot->SetHistogram(radioHistogram->isChecked(),spinHistFrom->value(),spinHistTo->value(),spinHistSize->value()); + if(radioHistogram->isChecked()){ + dispXAxis->setText("Intensity"); + dispYAxis->setText("Frequency"); + myPlot->SetHistXAxisTitle("Intensity"); + myPlot->SetHistYAxisTitle("Frequency"); + Select1DPlot(true); + } //angles (1D) int ang; @@ -900,12 +889,9 @@ void qTabPlot::SetScanArgument(){ Select1DPlot(true); } - /* bool histogram = radioHistogram->isChecked(); - * else if(histogram)*/ //1d with scan if(boxScan->isChecked()){ - myPlot->SetScanArgument(btnGroupScan->checkedId()+1); switch(btnGroupScan->checkedId()){ @@ -931,79 +917,6 @@ void qTabPlot::SetScanArgument(){ }else myPlot->SetScanArgument(qDefs::None); - /* - Select1DPlot(isOriginallyOneD); - - int ang; - //if scans(1D or 2D) - if((boxScan->isEnabled())||(histogram)){ - //setting the title according to the scans - Select1DPlot(isOriginallyOneD); - - - }//angles (1D) - else if(myDet->getAngularConversion(ang)){ - dispXAxis->setText("Angles"); - myPlot->SetHistXAxisTitle("Angles"); - Select1DPlot(true); - - } - - //histogram - if(histogram){ - //allFrames - myPlot->SetScanArgument(qDefs::AllFrames); - - //default titles for 2d scan - dispXAxis->setText("Channel Number"); - myPlot->SetImageXAxisTitle("Channel Number"); - dispZAxis->setText("Counts"); - myPlot->SetImageZAxisTitle("Counts"); - dispYAxis->setText("All Frames"); - myPlot->SetImageYAxisTitle("All Frames"); - - //set plot to 2d - Select1DPlot(false); - } - //2d - else if((boxScan->isEnabled())&&(boxScan->isChecked())){ - - //let qdrawplot know which scan argument - myPlot->SetScanArgument(btnGroupScan->checkedId()+1); - - //default titles for 2d scan - dispXAxis->setText("Channel Number"); - myPlot->SetImageXAxisTitle("Channel Number"); - dispZAxis->setText("Counts"); - myPlot->SetImageZAxisTitle("Counts"); - - //titles for y of 2d scan - switch(btnGroupScan->checkedId()){ - case 0://level0 - dispYAxis->setText("Scan Level 0"); - myPlot->SetImageYAxisTitle("Scan Level 0"); - break; - case 1://level1 - dispYAxis->setText("Scan Level 1"); - myPlot->SetImageYAxisTitle("Scan Level 1"); - break; - break; - case 2://file index - dispYAxis->setText("Frame Index"); - myPlot->SetImageYAxisTitle("Frame Index"); - break; - case 3://all frames - dispYAxis->setText("All Frames"); - myPlot->SetImageYAxisTitle("All Frames"); - break; - } - - //set plot to 2d - Select1DPlot(false); - - }else //done here so that it isnt set by default each time - myPlot->SetScanArgument(qDefs::None); -*/ qDefs::checkErrorMessage(myDet,"qTabPlot::SetScanArgument"); } @@ -1019,18 +932,19 @@ void qTabPlot::Refresh(){ if (!radioNoPlot->isChecked()) boxFrequency->setEnabled(true); connect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox())); - EnableScanBox(); + EnableScanBox(true); SetFrequency(); }else{ boxFrequency->setEnabled(false); disconnect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox())); boxScan->setEnabled(false); - //to toggle between no plot and the plot mode chosen while pltting + pageHistogram->setEnabled(false); + pageHistogram_2->setEnabled(false); if(radioHistogram->isChecked()) radioDataGraph->setEnabled(false); - radioHistogram->setEnabled(false); - + else + radioHistogram->setEnabled(false); } #ifdef VERBOSE cout << "**Updated Plot Tab" << endl << endl; From 3c30ef71cf06fb4d73545ad8f9c8570e603a664f Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 28 Aug 2013 15:02:17 +0000 Subject: [PATCH 231/332] fixed the zooming problems for 2d git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@231 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/svnInfoGui.h | 6 +++--- slsDetectorGui/src/qDrawPlot.cpp | 12 ++++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/slsDetectorGui/include/svnInfoGui.h b/slsDetectorGui/include/svnInfoGui.h index 7d40dd535..af9d1e6c7 100644 --- a/slsDetectorGui/include/svnInfoGui.h +++ b/slsDetectorGui/include/svnInfoGui.h @@ -2,10 +2,10 @@ #define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui" //#define SVNREPPATH "" #define SVNREPUUID "af1100a4-978c-4157-bff7-07162d2ba061" -//#define SVNREV 0x229 +//#define SVNREV 0x230 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "l_maliakal_d" -#define SVNREV 0x229 -#define SVNDATE 0x20130816 +#define SVNREV 0x230 +#define SVNDATE 0x20130827 // diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 0cd468372..854abd57f 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -458,6 +458,9 @@ int qDrawPlot::ResetDaqForGui(){ bool qDrawPlot::StartOrStopThread(bool start){ +#ifdef VERBOSE + cout << "StartOrStopThread:" << start << endl; +#endif static bool firstTime = true; static bool gui_acquisition_thread_running = 0; static pthread_t gui_acquisition_thread; @@ -480,8 +483,12 @@ bool qDrawPlot::StartOrStopThread(bool start){ //refixing all the min and max for all scans if (scanArgument == qDefs::None); else{ - plot2D->GetPlot()->UnZoom(); + //plot2D->GetPlot()->UnZoom(); + + plot2D->GetPlot()->SetXMinMax(-0.5,nPixelsX+0.5); + plot2D->GetPlot()->SetYMinMax(startPixel,endPixel); plot2D->GetPlot()->SetZoom(-0.5,startPixel,nPixelsX,endPixel-startPixel); + plot2D->GetPlot()->UnZoom(); } cout << "Starting new acquisition thread ...." << endl; @@ -1296,9 +1303,6 @@ void qDrawPlot::UpdatePlot(){ plot2D->SetYTitle(imageYAxisTitle); plot2D->SetZTitle(imageZAxisTitle); plot2D->UpdateNKeepSetRangeIfSet(); //keep a "set" z range, and call Update(); - //to solve the problems regarding zooming out and zoom in - - //plot2D->GetPlot()->SetZoom(-0.5,startPixel,nPixelsX,endPixel-startPixel); } // update range if required if(XYRangeChanged){ From 88f0b089b432a3d81b31daa895cf64b6e8f5d992 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 28 Aug 2013 15:17:36 +0000 Subject: [PATCH 232/332] fixed the zooming problems for 2d git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@232 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qDrawPlot.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 854abd57f..c8482dd44 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -483,8 +483,6 @@ bool qDrawPlot::StartOrStopThread(bool start){ //refixing all the min and max for all scans if (scanArgument == qDefs::None); else{ - //plot2D->GetPlot()->UnZoom(); - plot2D->GetPlot()->SetXMinMax(-0.5,nPixelsX+0.5); plot2D->GetPlot()->SetYMinMax(startPixel,endPixel); plot2D->GetPlot()->SetZoom(-0.5,startPixel,nPixelsX,endPixel-startPixel); From e6c94a1d622a8c5720e0322fc42b70e7d8722a98 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Thu, 29 Aug 2013 15:15:24 +0000 Subject: [PATCH 233/332] fixed the zooming problems for 2d git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@233 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qDrawPlot.h | 2 +- slsDetectorGui/src/qDrawPlot.cpp | 160 +++++++++++++++++------------ 2 files changed, 95 insertions(+), 67 deletions(-) diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index 4f2459f64..a5e35316e 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -566,7 +566,7 @@ QwtPlotHistogram *plotHistogram; QVector histogramSamples; - +bool firstPlot; signals: void UpdatingPlotFinished(); diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index c8482dd44..d4b0bb466 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -201,15 +201,18 @@ void qDrawPlot::SetupWidgetWindow(){ histFrom = 0; histTo = 0; histSize = 0; + /* grid = new QwtPlotGrid; grid->enableXMin(true); grid->enableYMin(true); grid->setMajPen(QPen(Qt::black, 0, Qt::DotLine)); grid->setMinPen(QPen(Qt::gray, 0 , Qt::DotLine)); + */ plotHistogram = new QwtPlotHistogram(); plotHistogram->setStyle(QwtPlotHistogram::Columns); + firstPlot = false; //widget related initialization @@ -480,20 +483,18 @@ bool qDrawPlot::StartOrStopThread(bool start){ //sets up the measurement parameters SetupMeasurement(); - //refixing all the min and max for all scans - if (scanArgument == qDefs::None); - else{ - plot2D->GetPlot()->SetXMinMax(-0.5,nPixelsX+0.5); - plot2D->GetPlot()->SetYMinMax(startPixel,endPixel); - plot2D->GetPlot()->SetZoom(-0.5,startPixel,nPixelsX,endPixel-startPixel); - plot2D->GetPlot()->UnZoom(); - } + //refixing all the zooming + plot2D->GetPlot()->SetXMinMax(-0.5,nPixelsX+0.5); + plot2D->GetPlot()->SetYMinMax(startPixel,endPixel); + plot2D->GetPlot()->SetZoom(-0.5,startPixel,nPixelsX,endPixel-startPixel); + plot2D->GetPlot()->UnZoom(); + cout << "Starting new acquisition thread ...." << endl; // Start acquiring data from server if(!firstTime) pthread_join(gui_acquisition_thread,NULL);//wait until he's finished, ie. exits pthread_create(&gui_acquisition_thread, NULL,DataStartAcquireThread, (void*) this); - firstTime = false; + firstPlot = true; // This is set here and later reset to zero when all the plotting is done // This is manually done instead of keeping track of thread because // this thread returns immediately after executing the acquire command @@ -1238,8 +1239,10 @@ void qDrawPlot::UpdatePlot(){ plotHistogram->setBrush(QBrush(Qt::red,Qt::Dense4Pattern));//Qt::SolidPattern histFrameIndexTitle->setText(GetHistTitle(0)); plotHistogram->attach(plot1D); - plot1D->SetZoomBase(plotHistogram->boundingRect().left(),0, - plotHistogram->boundingRect().width(),plotHistogram->boundingRect().height()); + //refixing all the zooming + plot1D->SetXMinMax(histFrom,histTo); + plot1D->SetYMinMax(0,plotHistogram->boundingRect().height()); + plot1D->SetZoomBase(0,0,nPixelsX,plotHistogram->boundingRect().height()); } //not histogram else{ @@ -1262,8 +1265,15 @@ void qDrawPlot::UpdatePlot(){ histFrameIndexTitle->setText(GetHistTitle(0)); //h->setTitle(GetHistTitle(hist_num)); h->Attach(plot1D); + //refixing all the zooming + if(firstPlot){ + plot1D->SetXMinMax(h->minXValue(),h->maxXValue()); + plot1D->SetYMinMax(h->minYValue(),h->maxYValue()); + plot1D->SetZoomBase(h->minXValue(),h->minYValue(), + h->maxXValue()-h->minXValue(),h->maxYValue()-h->minYValue()); + firstPlot = false; + } } - plot1D->Update(); } // update range if required if(XYRangeChanged){ @@ -1273,7 +1283,10 @@ void qDrawPlot::UpdatePlot(){ if(!IsXYRange[qDefs::YMAXIMUM]) XYRangeValues[qDefs::YMAXIMUM]= plot1D->GetYMaximum(); plot1D->SetXMinMax(XYRangeValues[qDefs::XMINIMUM],XYRangeValues[qDefs::XMAXIMUM]); plot1D->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]); - XYRangeChanged = false; + //Should not be reset for histogram, + //that is the only way to zoom in (new plots are zoomed out as its different each time) + if(!histogram) + XYRangeChanged = false; } //Display Statistics if(displayStatistics){ @@ -1631,12 +1644,14 @@ void qDrawPlot::DisableZoom(bool disable){ int qDrawPlot::UpdateTrimbitPlot(bool fromDetector,bool Histogram){ int ret,i,actualPixelsX; - //double *temp=0,*trimXAxis=0,*trimYAxis=0; + double min=0,max=0,sum=0; #ifdef VERBOSE if(fromDetector) cout << "Geting Trimbits from Detector" << endl; else cout << "Getting Trimbits from Shared Memory" << endl; #endif + LockLastImageArray(); + slsDetectorDefs::detectorType detType = myDet->getDetectorsType(); if(detType == slsDetectorDefs::MYTHEN){ @@ -1646,6 +1661,7 @@ int qDrawPlot::UpdateTrimbitPlot(bool fromDetector,bool Histogram){ ret = myDet->getChanRegs(histTrimbits,fromDetector); if(!ret){ qDefs::Message(qDefs::WARNING,"No Trimbit data found in shared memory.","qDrawPlot::UpdateTrimbitPlot"); + UnlockLastImageArray(); return qDefs::FAIL; } #ifdef VERBOSE @@ -1654,23 +1670,30 @@ int qDrawPlot::UpdateTrimbitPlot(bool fromDetector,bool Histogram){ qDefs::checkErrorMessage(myDet,"qDrawPlot::UpdateTrimbitPlot"); - //defining axes - if(Histogram) nPixelsX = TRIM_HISTOGRAM_XMAX+1; - else nPixelsX = actualPixelsX; - - if(histXAxis) delete [] histXAxis; histXAxis = new double [nPixelsX]; - if(histYAxis[0]) delete [] histYAxis[0]; histYAxis[0]= new double [nPixelsX]; - //initializing - for(unsigned int px=0;px<(int)nPixelsX;px++) histXAxis[px] = px; - for(i=0;isetText(QString("%1").arg(min)); + lblMaxDisp->setText(QString("%1").arg(max)); + lblSumDisp->setText(QString("%1").arg(sum)); + } if(!Histogram){ cout << "Data Graph:" << nPixelsX << endl; + + //initialize + nPixelsX = actualPixelsX; + if(histXAxis) delete [] histXAxis; histXAxis = new double [nPixelsX]; + if(histYAxis[0]) delete [] histYAxis[0]; histYAxis[0]= new double [nPixelsX]; + //initializing + for(unsigned int px=0;px<(int)nPixelsX;px++) histXAxis[px] = px; + for(i=0;iSetXTitle("Channel Number"); plot1D->SetYTitle("Trimbits"); //set plot parameters + plot1D->SetXMinMax(0,nPixelsX); + plot1D->SetZoomBase(0,0,nPixelsX,plotHistogram->boundingRect().height()); SlsQtH1D* h; plot1D_hists.append(h=new SlsQtH1D("",nPixelsX,histXAxis,histYAxis[0])); h->SetLineColor(1); - h->setTitle(GetHistTitle(0)); + histFrameIndexTitle->setText(GetHistTitle(0)); //attach plot h->Attach(plot1D); + //refixing all the zooming + plot1D->SetXMinMax(h->minXValue(),h->maxXValue()); + plot1D->SetYMinMax(h->minYValue(),h->maxYValue()); + plot1D->SetZoomBase(h->minXValue(),h->minYValue(), + h->maxXValue()-h->minXValue(),h->maxYValue()-h->minYValue()); } else{ - cout << "Histogram: " << nPixelsX-1 << endl; - //data - int value =0; + cout << "Histogram: " << TRIM_HISTOGRAM_XMAX << endl; + + //create intervals + histogramSamples.resize(TRIM_HISTOGRAM_XMAX+1); + for(i=0; i=0)){ + if( (histTrimbits[i] <= TRIM_HISTOGRAM_XMAX) && (histTrimbits[i] >= 0)){//if(histogramSamples[j].interval.contains(data->values[i])) value = (int) histTrimbits[i]; - histYAxis[0][value]++; + histogramSamples[value].value += 1; } else cout<<"OUT OF BOUNDS:"<0)) - cout<<"HIsty["<setTitle("Trimbits_Plot_Histogram"); plot1D->SetXTitle("Trimbits"); plot1D->SetYTitle("Frequency"); - //set plot parameters - SlsQtH1D* h; - plot1D_hists.append(h=new SlsQtH1D("",nPixelsX,histXAxis,histYAxis[0])); - h->SetLineColor(1); - h->setTitle(GetHistTitle(0)); - //attach plot - h->Attach(plot1D); + plotHistogram->setData(new QwtIntervalSeriesData(histogramSamples)); + plotHistogram->setPen(QPen(Qt::red)); + plotHistogram->setBrush(QBrush(Qt::red,Qt::Dense4Pattern));//Qt::SolidPattern + histFrameIndexTitle->setText(GetHistTitle(0)); + plotHistogram->attach(plot1D); + //refixing all the zooming + plot1D->SetXMinMax(0,TRIM_HISTOGRAM_XMAX+1); + plot1D->SetYMinMax(0,plotHistogram->boundingRect().height()); + plot1D->SetZoomBase(0,0,actualPixelsX,plotHistogram->boundingRect().height()); } - //Display Statistics - if(displayStatistics){ - double min=0,max=0,sum=0; - GetStatistics(min,max,sum,histYAxis[0],nPixelsX); - lblMinDisp->setText(QString("%1").arg(min)); - lblMaxDisp->setText(QString("%1").arg(max)); - lblSumDisp->setText(QString("%1").arg(sum)); - } - - -#ifdef VERBOSE - cout << "Trimbits Plot updated" << endl; -#endif } - + /**needs to be changed */ else if(detType == slsDetectorDefs::EIGER){ //defining axes @@ -1745,6 +1768,7 @@ int qDrawPlot::UpdateTrimbitPlot(bool fromDetector,bool Histogram){ ret = 1;/*myDet->getChanRegs(lastImageArray,fromDetector);*/ if(!ret){ qDefs::Message(qDefs::WARNING,"No Trimbit data found in shared memory.","qDrawPlot::UpdateTrimbitPlot"); + UnlockLastImageArray(); return qDefs::FAIL; } //clear/select plot and set titles @@ -1758,17 +1782,21 @@ int qDrawPlot::UpdateTrimbitPlot(bool fromDetector,bool Histogram){ #ifdef VERBOSE cout << "Trimbits Plot updated" << endl; #endif - } - //Display Statistics - if(displayStatistics){ - double min=0,max=0,sum=0; - GetStatistics(min,max,sum,lastImageArray,nPixelsX*nPixelsY); - lblMinDisp->setText(QString("%1").arg(min)); - lblMaxDisp->setText(QString("%1").arg(max)); - lblSumDisp->setText(QString("%1").arg(sum)); + + //Display Statistics + if(displayStatistics){ + GetStatistics(min,max,sum,lastImageArray,nPixelsX*nPixelsY); + lblMinDisp->setText(QString("%1").arg(min)); + lblMaxDisp->setText(QString("%1").arg(max)); + lblSumDisp->setText(QString("%1").arg(sum)); + } + } - + UnlockLastImageArray(); +#ifdef VERBOSE + cout << "Trimbits Plot updated" << endl; +#endif return qDefs::OK; } From 790966e3dd2508ec6baf172ca0a3d979dad75e63 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 4 Sep 2013 13:10:18 +0000 Subject: [PATCH 234/332] semaphores , no usleep in receiver git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@234 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/svnInfoGui.h | 6 +++--- .../slsDetectorPlotting/include/SlsQt1DPlot.h | 4 ++-- slsDetectorGui/src/qDrawPlot.cpp | 3 ++- slsDetectorGui/src/qTabDataOutput.cpp | 15 +++++++++++++-- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/slsDetectorGui/include/svnInfoGui.h b/slsDetectorGui/include/svnInfoGui.h index af9d1e6c7..4703b2bca 100644 --- a/slsDetectorGui/include/svnInfoGui.h +++ b/slsDetectorGui/include/svnInfoGui.h @@ -2,10 +2,10 @@ #define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui" //#define SVNREPPATH "" #define SVNREPUUID "af1100a4-978c-4157-bff7-07162d2ba061" -//#define SVNREV 0x230 +//#define SVNREV 0x233 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "l_maliakal_d" -#define SVNREV 0x230 -#define SVNDATE 0x20130827 +#define SVNREV 0x233 +#define SVNDATE 0x20130829 // diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h index 0e9de4649..db5141078 100644 --- a/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h @@ -136,7 +136,7 @@ class SlsQt1DPlot:public QwtPlot{ void SetZoom(double xmin,double ymin,double x_width,double y_width); void SetZoomBase(double xmin,double ymin,double x_width, double y_width){ zoomer->SetZoomBase(xmin,ymin,x_width,y_width);} - + void alignScales(); private: SlsQtH1DList* hist_list; @@ -148,7 +148,7 @@ class SlsQt1DPlot:public QwtPlot{ void SetupZoom(); void UnknownStuff(); - void alignScales(); + //void alignScales(); void CalculateNResetZoomBase(); void NewHistogramAttached(SlsQtH1D* h); diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index d4b0bb466..3d182bb9d 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -1266,7 +1266,7 @@ void qDrawPlot::UpdatePlot(){ //h->setTitle(GetHistTitle(hist_num)); h->Attach(plot1D); //refixing all the zooming - if(firstPlot){ + if((firstPlot) || (anglePlot)){ plot1D->SetXMinMax(h->minXValue(),h->maxXValue()); plot1D->SetYMinMax(h->minYValue(),h->maxYValue()); plot1D->SetZoomBase(h->minXValue(),h->minYValue(), @@ -1274,6 +1274,7 @@ void qDrawPlot::UpdatePlot(){ firstPlot = false; } } + } // update range if required if(XYRangeChanged){ diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index 758887a60..213383d21 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -405,6 +405,7 @@ void qTabDataOutput::UpdateRateCorrectionFromServer(){ void qTabDataOutput::SetAngularCorrection(){ + disconnect(chkAngular, SIGNAL(toggled(bool)), this, SLOT(SetAngularCorrection())); #ifdef VERYVERBOSE cout << "Entering Set Angular Correction function" << endl; #endif @@ -414,18 +415,28 @@ void qTabDataOutput::SetAngularCorrection(){ cout << "Setting angular conversion to default" << endl; #endif }else{ +#ifdef VERBOSE + cout << "Could not set angular conversion to default" << endl; +#endif qDefs::Message(qDefs::WARNING,"Angular Conversion could not be set. Please set the default file name using the command line, if you haven't already.","qTabDataOutput::SetAngularCorrection"); chkAngular->setChecked(false); } }else{ - myDet->setAngularConversionFile(""); + if(myDet->setAngularConversionFile("")){ +#ifdef VERBOSE + cout << "Could not reset angular correction" << endl; +#endif + qDefs::Message(qDefs::WARNING,"Angular Conversion could not be reset.","qTabDataOutput::SetAngularCorrection"); + chkAngular->setChecked(true); + }else{; #ifdef VERBOSE cout << "Unsetting angular correction" << endl; #endif + } } emit AngularConversionSignal(chkAngular->isChecked()); - + connect(chkAngular, SIGNAL(toggled(bool)), this, SLOT(SetAngularCorrection())); qDefs::checkErrorMessage(myDet,"qTabDataOutput::SetAngularCorrection"); } From 05d4290ace23d5634a822d6677f9cc924565b33f Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 18 Sep 2013 15:29:21 +0000 Subject: [PATCH 235/332] included stoptimer bug fix and also screwing up period updates in measurement tab git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@235 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qTabDeveloper.h | 2 +- slsDetectorGui/src/qTabMeasurement.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/slsDetectorGui/include/qTabDeveloper.h b/slsDetectorGui/include/qTabDeveloper.h index def0a0670..13e1b3c04 100644 --- a/slsDetectorGui/include/qTabDeveloper.h +++ b/slsDetectorGui/include/qTabDeveloper.h @@ -74,7 +74,7 @@ public: /** To stop ADC Timer when starting acquisition */ - void StopADCTimer(){adcTimer->stop();}; + void StopADCTimer(){if(adcTimer) adcTimer->stop();}; private: /** The sls detector object */ diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 6bb6275fc..971046849 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -437,7 +437,7 @@ void qTabMeasurement::setExposureTime(){ cout << "Setting acquisition time to " << exptimeNS << " clocks" << "/" << spinExpTime->value() << qDefs::getUnitString((qDefs::timeUnit)comboExpUnit->currentIndex()) << endl; #endif myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,(int64_t)exptimeNS); - + /* //updating value set disconnect(spinExpTime,SIGNAL(valueChanged(double)), this, SLOT(setExposureTime())); disconnect(comboExpUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setExposureTime())); @@ -447,7 +447,7 @@ void qTabMeasurement::setExposureTime(){ comboExpUnit->setCurrentIndex((int)unit); connect(spinExpTime,SIGNAL(valueChanged(double)), this, SLOT(setExposureTime())); connect(comboExpUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setExposureTime())); - +*/ //could be different if it didnt work exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value()); @@ -480,7 +480,7 @@ void qTabMeasurement::setAcquisitionPeriod(){ cout << "Setting frame period between exposures to " << acqtimeNS << " clocks"<< "/" << spinPeriod->value() << qDefs::getUnitString((qDefs::timeUnit)comboPeriodUnit->currentIndex()) << endl; #endif myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,(int64_t)acqtimeNS); - +/* //updating value set disconnect(spinPeriod,SIGNAL(valueChanged(double)), this, SLOT(setAcquisitionPeriod())); disconnect(comboPeriodUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setAcquisitionPeriod())); @@ -490,7 +490,7 @@ void qTabMeasurement::setAcquisitionPeriod(){ comboPeriodUnit->setCurrentIndex((int)unit); connect(spinPeriod,SIGNAL(valueChanged(double)), this, SLOT(setAcquisitionPeriod())); connect(comboPeriodUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setAcquisitionPeriod())); - +*/ //could be different if it didnt work acqtimeNS = qDefs::getNSTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value()); @@ -541,7 +541,7 @@ void qTabMeasurement::setDelay(){ cout << "Setting delay after trigger to " << exptimeNS << " clocks" << "/" << spinDelay->value() << qDefs::getUnitString((qDefs::timeUnit)comboDelayUnit->currentIndex()) << endl; #endif myDet->setTimer(slsDetectorDefs::DELAY_AFTER_TRIGGER,(int64_t)exptimeNS); - +/* //updating value set disconnect(spinDelay,SIGNAL(valueChanged(double)), this, SLOT(setDelay())); disconnect(comboDelayUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setDelay())); @@ -551,7 +551,7 @@ void qTabMeasurement::setDelay(){ comboDelayUnit->setCurrentIndex((int)unit); connect(spinDelay,SIGNAL(valueChanged(double)), this, SLOT(setDelay())); connect(comboDelayUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setDelay())); - +*/ qDefs::checkErrorMessage(myDet,"qTabMeasurement::setDelay"); } From e7633f1e045abc088a8cdb51195edb1ac17d9feb Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 20 Sep 2013 10:25:40 +0000 Subject: [PATCH 236/332] let threshold take negative numbers fixed git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@236 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_plot.ui | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index 6376da9ce..8502dcd5b 100644 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -771,7 +771,7 @@ Displays minimum, maximum and sum of values for each plot. - 6 + 4 @@ -1249,7 +1249,7 @@ All values between <b>from</b> and <b>to</b> will be res Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - 0 + -16777215 16777215 @@ -1296,7 +1296,7 @@ All values between <b>from</b> and <b>to</b> will be res Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - 0 + -16777215 16777215 From e3df740901950273a89a678bd0c82444cbbb4d96 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 20 Sep 2013 13:11:57 +0000 Subject: [PATCH 237/332] bug fix filename with an underscore was a problem git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@237 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qTabMeasurement.h | 3 +-- slsDetectorGui/src/qTabMeasurement.cpp | 11 ++++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/slsDetectorGui/include/qTabMeasurement.h b/slsDetectorGui/include/qTabMeasurement.h index 23717717d..309d9c25d 100644 --- a/slsDetectorGui/include/qTabMeasurement.h +++ b/slsDetectorGui/include/qTabMeasurement.h @@ -110,9 +110,8 @@ private slots: void setNumMeasurements(int num); /** Set file name - * @param fName name of file */ - void setFileName(const QString& fName); + void setFileName(); /** Set index of file name * @param index index of selection diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 971046849..c5e37b02d 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -218,7 +218,7 @@ void qTabMeasurement::Initialization(){ //Number of Measurements connect(spinNumMeasurements,SIGNAL(valueChanged(int)), this, SLOT(setNumMeasurements(int))); //File Name - connect(dispFileName, SIGNAL(textChanged(const QString&)),this, SLOT(setFileName(const QString&))); + connect(dispFileName, SIGNAL(editingFinished()),this, SLOT(setFileName())); //File Index connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int))); //Start/Stop Acquisition @@ -362,15 +362,16 @@ void qTabMeasurement::UpdateProgress(){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void qTabMeasurement::setFileName(const QString& fName){ +void qTabMeasurement::setFileName(){ + QString fName = dispFileName->text(); #ifdef VERBOSE cout << "Setting File name to " << fName.toAscii().constData() << endl; #endif myDet->setFileName(fName.toAscii().data()); - disconnect(dispFileName, SIGNAL(textChanged(const QString&)),this, SLOT(setFileName(const QString&))); + disconnect(dispFileName, SIGNAL(editingFinished()),this, SLOT(setFileName())); dispFileName->setText(QString(myDet->getFileName().c_str())); - connect(dispFileName, SIGNAL(textChanged(const QString&)),this, SLOT(setFileName(const QString&))); + connect(dispFileName, SIGNAL(editingFinished()),this, SLOT(setFileName())); qDefs::checkErrorMessage(myDet,"qTabMeasurement::setFileName"); } @@ -752,7 +753,7 @@ void qTabMeasurement::EnableFileWrite(bool enable){ #endif myDet->enableWriteToFile(enable); dispFileName->setEnabled(enable); - if(enable) setFileName(dispFileName->text()); + if(enable) setFileName(); myPlot->SetEnableFileWrite(enable); disconnect(chkFile, SIGNAL(toggled(bool)), this, SLOT(EnableFileWrite(bool))); From 5e4e52936bb6824eccec66e01c8c7e047cdace8e Mon Sep 17 00:00:00 2001 From: cartier_s Date: Tue, 24 Sep 2013 13:29:06 +0000 Subject: [PATCH 238/332] spin poxes can get negative values for binary plotting git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@238 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_plot.ui | 14 +++++++------- slsDetectorGui/src/qTabPlot.cpp | 3 +++ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index 8502dcd5b..fa89c9843 100644 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -482,7 +482,7 @@ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - 0 + -16777215 16777215 @@ -529,7 +529,7 @@ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - 0 + -16777215 16777215 @@ -634,7 +634,7 @@ Displays minimum, maximum and sum of values for each plot. Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - 0 + -16777215 16777215 @@ -681,7 +681,7 @@ Displays minimum, maximum and sum of values for each plot. Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - 0 + -16777215 16777215 @@ -728,7 +728,7 @@ Displays minimum, maximum and sum of values for each plot. Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - 0 + -16777215 16777215 @@ -1401,7 +1401,7 @@ Displays minimum, maximum and sum of values for each plot. Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - 0 + -16777215 16777215 @@ -1448,7 +1448,7 @@ Displays minimum, maximum and sum of values for each plot. Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - 0 + -16777215 16777215 diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index e51eee995..45ba80137 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -992,6 +992,9 @@ void qTabPlot::SetBinary(){ lblTo->setEnabled(true); spinFrom->setEnabled(true); spinTo->setEnabled(true); + spinFrom->setRange(-10000,+10000); + spinTo->setRange(-10000,+10000); + myPlot->SetBinary(true,spinFrom->value(),spinTo->value()); }else{ #ifdef VERBOSE From a06a4ef8d78c7e40e9db3da9464c47f5a0b1c3f6 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 25 Sep 2013 08:50:36 +0000 Subject: [PATCH 239/332] reverted to old version for negative threshold git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@239 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_plot.ui | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index fa89c9843..8502dcd5b 100644 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -482,7 +482,7 @@ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - -16777215 + 0 16777215 @@ -529,7 +529,7 @@ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - -16777215 + 0 16777215 @@ -634,7 +634,7 @@ Displays minimum, maximum and sum of values for each plot. Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - -16777215 + 0 16777215 @@ -681,7 +681,7 @@ Displays minimum, maximum and sum of values for each plot. Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - -16777215 + 0 16777215 @@ -728,7 +728,7 @@ Displays minimum, maximum and sum of values for each plot. Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - -16777215 + 0 16777215 @@ -1401,7 +1401,7 @@ Displays minimum, maximum and sum of values for each plot. Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - -16777215 + 0 16777215 @@ -1448,7 +1448,7 @@ Displays minimum, maximum and sum of values for each plot. Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - -16777215 + 0 16777215 From 38570080b96a3dba08b387d3580b7c8b40f54d60 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 25 Sep 2013 08:52:15 +0000 Subject: [PATCH 240/332] revered changed to old version for negative threshold git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@240 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qTabPlot.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index 45ba80137..e51eee995 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -992,9 +992,6 @@ void qTabPlot::SetBinary(){ lblTo->setEnabled(true); spinFrom->setEnabled(true); spinTo->setEnabled(true); - spinFrom->setRange(-10000,+10000); - spinTo->setRange(-10000,+10000); - myPlot->SetBinary(true,spinFrom->value(),spinTo->value()); }else{ #ifdef VERBOSE From 4c662270cd11808a1114837f3a55c8b0c9c98541 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 2 Oct 2013 16:41:50 +0000 Subject: [PATCH 241/332] fixed zooming problem git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@241 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/slsDetectorGui.pro | 5 +++++ slsDetectorGui/src/qDrawPlot.cpp | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index ff694965e..71cd9d50c 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -64,6 +64,11 @@ INCLUDEPATH = \ slsDetectorPlotting/include\ include\ forms/include\ + /usr/include/qwt\ #these are not included for standard installations, also bin path should include qt4 bin, not qt3 bin + /usr/include/qt4\ + /usr/include/Qt\ + /usr/include/QtCore\ + /usr/include/QtGui\ $(INCLUDES) #epics # $(INCLUDES) /usr/local/epics/base/include/ -I /usr/local/epics/base/include/os/Linux/ diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 3d182bb9d..8c4366e6b 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -488,7 +488,7 @@ bool qDrawPlot::StartOrStopThread(bool start){ plot2D->GetPlot()->SetYMinMax(startPixel,endPixel); plot2D->GetPlot()->SetZoom(-0.5,startPixel,nPixelsX,endPixel-startPixel); plot2D->GetPlot()->UnZoom(); - + XYRangeChanged = true; cout << "Starting new acquisition thread ...." << endl; // Start acquiring data from server From c7bc39709805813853de65783339464548f5964f Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 4 Oct 2013 08:58:10 +0000 Subject: [PATCH 242/332] changed 1d line color to black git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@242 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qDrawPlot.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 8c4366e6b..1b571e1b3 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -293,7 +293,7 @@ void qDrawPlot::SetupWidgetWindow(){ plot1D->SetXTitle("X Axis"); plot1D->SetYTitle("Y Axis"); plot1D_hists.append(h=new SlsQtH1D("",histNBins,histXAxis,histYAxis[0])); - h->SetLineColor(1); + h->SetLineColor(0); SetStyle(h); h->Attach(plot1D); Clear1DPlot(); @@ -1253,7 +1253,7 @@ void qDrawPlot::UpdatePlot(){ plot1D_hists.append(h=new SlsQtH1D("",histNBins,histXAngleAxis,histYAngleAxis)); else plot1D_hists.append(h=new SlsQtH1D("",histNBins,histXAxis,GetHistYAxis(hist_num))); - h->SetLineColor(hist_num+1); + h->SetLineColor(hist_num); }else{ h=plot1D_hists.at(hist_num); if(anglePlot) @@ -1706,7 +1706,7 @@ int qDrawPlot::UpdateTrimbitPlot(bool fromDetector,bool Histogram){ plot1D->SetZoomBase(0,0,nPixelsX,plotHistogram->boundingRect().height()); SlsQtH1D* h; plot1D_hists.append(h=new SlsQtH1D("",nPixelsX,histXAxis,histYAxis[0])); - h->SetLineColor(1); + h->SetLineColor(0); histFrameIndexTitle->setText(GetHistTitle(0)); //attach plot h->Attach(plot1D); From b9fcbf4697d4f3f3136e0b6f9eb200e04f80ef06 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 9 Oct 2013 10:37:49 +0000 Subject: [PATCH 243/332] changed order to pedestal binary then accumulate, also fxed a bug in that git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@243 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qDrawPlot.cpp | 36 ++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 1b571e1b3..c08f1cc65 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -991,19 +991,21 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){ } //pedestal or accumulate else{ + double temp;//cannot overwrite cuz of accumulate for(unsigned int px=0;px<(nPixelsX*nPixelsY);px++){ - if(accumulate) - histYAxis[0][px] += data->values[px]; - else - histYAxis[0][px] = data->values[px]; + temp = data->values[px]; if(pedestal) - histYAxis[0][px] = histYAxis[0][px] - (pedestalVals[px]); + temp = data->values[px] - (pedestalVals[px]); if(binary) { - if ((histYAxis[0][px] >= binaryFrom) && (histYAxis[0][px] <= binaryTo)) - histYAxis[0][px] = 1; + if ((temp >= binaryFrom) && (temp <= binaryTo)) + temp = 1; else - histYAxis[0][px] = 0; + temp = 0; } + if(accumulate) + temp += histYAxis[0][px]; + //after all processing + histYAxis[0][px] = temp; } } } @@ -1038,19 +1040,21 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){ } //pedestal or accumulate or binary else{ + double temp; for(unsigned int px=0;px<(nPixelsX*nPixelsY);px++){ - if(accumulate) - lastImageArray[px] += data->values[px]; - else - lastImageArray[px] = data->values[px]; + temp = data->values[px]; if(pedestal) - lastImageArray[px] = lastImageArray[px] - (pedestalVals[px]); + temp = data->values[px] - (pedestalVals[px]); if(binary) { - if ((lastImageArray[px] >= binaryFrom) && (lastImageArray[px] <= binaryTo)) - lastImageArray[px] = 1; + if ((temp >= binaryFrom) && (temp <= binaryTo)) + temp = 1; else - lastImageArray[px] = 0; + temp = 0; } + if(accumulate) + temp += lastImageArray[px]; + //after all processing + lastImageArray[px] = temp; } } From c32acebc35cebe54dc365248259e5bf2f1d0aa8f Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Thu, 10 Oct 2013 09:09:55 +0000 Subject: [PATCH 244/332] fixed problem of period beign recalculated for each refresh git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@244 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qDefs.h | 4 +-- slsDetectorGui/src/qTabMeasurement.cpp | 44 +++++++++++++++++++++----- 2 files changed, 38 insertions(+), 10 deletions(-) diff --git a/slsDetectorGui/include/qDefs.h b/slsDetectorGui/include/qDefs.h index 02710c710..497a809ba 100644 --- a/slsDetectorGui/include/qDefs.h +++ b/slsDetectorGui/include/qDefs.h @@ -118,7 +118,7 @@ static const int64_t GUI_VERSION=0x20121213; while((newVal>=1)&&(intUnit>=(int)HOURS)){ /** value retains the old value */ value = newVal; - newVal = value/60; + newVal = value/(double)60; intUnit--; } /** returning the previous value*/ @@ -128,7 +128,7 @@ static const int64_t GUI_VERSION=0x20121213; /** ms, us, ns */ else{ while((value<1)&&(intUnit<(int)NANOSECONDS)){ - value = value*1000; + value = value*(double)1000; intUnit++; } unit = (timeUnit)(intUnit); diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index c5e37b02d..48cf18506 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -784,6 +784,13 @@ void qTabMeasurement::Refresh(){ #ifdef VERBOSE cout << "Getting number of frames" << endl; #endif + //to prevent it from recalculating forever + disconnect(spinExpTime,SIGNAL(valueChanged(double)), this, SLOT(setExposureTime())); + disconnect(comboExpUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setExposureTime())); + disconnect(spinPeriod,SIGNAL(valueChanged(double)), this, SLOT(setAcquisitionPeriod())); + disconnect(comboPeriodUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setAcquisitionPeriod())); + disconnect(spinDelay,SIGNAL(valueChanged(double)), this, SLOT(setDelay())); + disconnect(comboDelayUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setDelay())); //Exp Time qDefs::timeUnit unit; double time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-9)))); @@ -792,7 +799,6 @@ void qTabMeasurement::Refresh(){ #ifdef VERBOSE cout << "Getting Exposure time" << endl; #endif - //period time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,-1)*(1E-9)))); spinPeriod->setValue(time); @@ -800,13 +806,22 @@ void qTabMeasurement::Refresh(){ #ifdef VERBOSE cout << "Getting Acquisition Period" << endl; #endif - - //Number of Triggers - spinNumTriggers->setValue((int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1)); -#ifdef VERBOSE - cout << "Getting number of triggers" << endl; -#endif - + double acqtimeNS = qDefs::getNSTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value()); + double exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value()); + if(exptimeNS>acqtimeNS){ + spinPeriod->setToolTip(errPeriodTip); + lblPeriod->setToolTip(errPeriodTip); + lblPeriod->setPalette(red); + lblPeriod->setText("Acquisition Period:*"); + } + else { + spinPeriod->setToolTip(acqPeriodTip); + lblPeriod->setToolTip(acqPeriodTip); + lblPeriod->setPalette(lblTimingMode->palette()); + lblPeriod->setText("Acquisition Period:"); + } + //Check if the interval between plots is ok + emit CheckPlotIntervalSignal(); //delay time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::DELAY_AFTER_TRIGGER,-1)*(1E-9)))); spinDelay->setValue(time); @@ -814,6 +829,19 @@ void qTabMeasurement::Refresh(){ #ifdef VERBOSE cout << "Getting delay after trigger" << endl; #endif + connect(spinExpTime,SIGNAL(valueChanged(double)), this, SLOT(setExposureTime())); + connect(comboExpUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setExposureTime())); + connect(spinPeriod,SIGNAL(valueChanged(double)), this, SLOT(setAcquisitionPeriod())); + connect(comboPeriodUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setAcquisitionPeriod())); + connect(spinDelay,SIGNAL(valueChanged(double)), this, SLOT(setDelay())); + connect(comboDelayUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setDelay())); + + + //Number of Triggers + spinNumTriggers->setValue((int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1)); +#ifdef VERBOSE + cout << "Getting number of triggers" << endl; +#endif //gates spinNumGates->setValue((int)myDet->setTimer(slsDetectorDefs::GATES_NUMBER,-1)); From d421c0c9fed53368b23e78a581e94c5971875a4f Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Mon, 14 Oct 2013 08:33:40 +0000 Subject: [PATCH 245/332] checked in threshold changes to binary git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@245 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_plot.ui | 12 ++++++------ slsDetectorGui/src/qDrawPlot.cpp | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index 8502dcd5b..d15305e55 100644 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -634,7 +634,7 @@ Displays minimum, maximum and sum of values for each plot. Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - 0 + -16777215 16777215 @@ -681,7 +681,7 @@ Displays minimum, maximum and sum of values for each plot. Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - 0 + -16777215 16777215 @@ -728,7 +728,7 @@ Displays minimum, maximum and sum of values for each plot. Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - 0 + -16777215 16777215 @@ -771,7 +771,7 @@ Displays minimum, maximum and sum of values for each plot. - 4 + 6 @@ -1448,7 +1448,7 @@ Displays minimum, maximum and sum of values for each plot. Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - 0 + -16777215 16777215 @@ -1495,7 +1495,7 @@ Displays minimum, maximum and sum of values for each plot. Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - 0 + -16777215 16777215 diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index c08f1cc65..d33a51ce7 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -985,7 +985,7 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){ } //normal data - if(((!pedestal)&(!accumulate)) || (resetAccumulate)){ + if(((!pedestal)&(!accumulate)&(!binary)) || (resetAccumulate)){ memcpy(histYAxis[0],data->values,nPixelsX*sizeof(double)); resetAccumulate = false; } @@ -1034,7 +1034,7 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){ } //normal data - if(((!pedestal)&(!accumulate)) || (resetAccumulate)){ + if(((!pedestal)&(!accumulate)&(!binary)) || (resetAccumulate)){ memcpy(lastImageArray,data->values,nPixelsX*nPixelsY*sizeof(double)); resetAccumulate = false; } From 9f92f5cffaf896d232c604dd2eb0634f4e837b86 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Mon, 25 Nov 2013 15:59:30 +0000 Subject: [PATCH 246/332] getting back to basics in zooming, using a flag to check for angle error git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@246 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/svnInfoGui.h | 6 ++--- slsDetectorGui/slsDetectorGui.pro | 2 +- slsDetectorGui/src/qDetectorMain.cpp | 12 +++++++++ slsDetectorGui/src/qDrawPlot.cpp | 40 +++++++++++++++++++++------- 4 files changed, 47 insertions(+), 13 deletions(-) diff --git a/slsDetectorGui/include/svnInfoGui.h b/slsDetectorGui/include/svnInfoGui.h index 4703b2bca..7c77bbbe6 100644 --- a/slsDetectorGui/include/svnInfoGui.h +++ b/slsDetectorGui/include/svnInfoGui.h @@ -2,10 +2,10 @@ #define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui" //#define SVNREPPATH "" #define SVNREPUUID "af1100a4-978c-4157-bff7-07162d2ba061" -//#define SVNREV 0x233 +//#define SVNREV 0x245 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "l_maliakal_d" -#define SVNREV 0x233 -#define SVNDATE 0x20130829 +#define SVNREV 0x245 +#define SVNDATE 0x20131014 // diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index 71cd9d50c..624eec047 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -20,7 +20,7 @@ QMAKE_LIBS = -L$(QTDIR)/lib #LIBS = -L$(QWTDIR)/lib -lqwt -L$(QWT3D)/lib -Wl,-R$(QWTDIR)/lib -L /usr/local/epics/base/lib/$(EPICS_HOST_ARCH)/ -Wl,-R/usr/local/epics/base/lib/$(EPICS_HOST_ARCH) -lca -lCom #default -DEFINES += VERBOSE DACS_INT PRINT_LOG THIS_PATH=\\\"$$PWD\\\" #VERYVERBOSE +DEFINES += VERBOSE DACS_INT PRINT_LOG CHECKINFERROR THIS_PATH=\\\"$$PWD\\\" #VERYVERBOSE LIBS = -L$(QWTDIR)/lib -lqwt -L$(QWT3D)/lib diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 29509def3..38e65e03c 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -732,6 +732,18 @@ void qDetectorMain::EnableTabs(){ //moved to here, so that its all in order, instead of signals and different threads if(!enable) { + //refresh all the required tabs + tab_actions->Refresh(); + tab_measurement->Refresh(); + + tab_settings->Refresh(); + tab_dataoutput->Refresh(); + if(tab_advanced->isEnabled()) tab_advanced->Refresh(); + if(tab_debugging->isEnabled()) tab_debugging->Refresh(); + if(tab_developer->isEnabled()) tab_developer->Refresh(); + + tab_plot->Refresh(); + //stop the adc timer in gotthard if(tab_developer->isEnabled()) tab_developer->StopADCTimer(); diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index d33a51ce7..fe3635f86 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -488,7 +488,7 @@ bool qDrawPlot::StartOrStopThread(bool start){ plot2D->GetPlot()->SetYMinMax(startPixel,endPixel); plot2D->GetPlot()->SetZoom(-0.5,startPixel,nPixelsX,endPixel-startPixel); plot2D->GetPlot()->UnZoom(); - XYRangeChanged = true; + /*XYRangeChanged = true;*/ cout << "Starting new acquisition thread ...." << endl; // Start acquiring data from server @@ -694,6 +694,7 @@ void qDrawPlot::SetupMeasurement(){ } } + /* cout<<"nPixelsX:"<values << endl; cout << "errors " << data->errors << endl; cout << "angle " << data->angles << endl; - #endif if(!stop_signal){ @@ -790,19 +790,41 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){ } else{ - lastImageNumber= currentFrame+1; nAnglePixelsX = data->npoints; histNBins = nAnglePixelsX; nHists=1; if(histXAngleAxis) delete [] histXAngleAxis; histXAngleAxis = new double[nAnglePixelsX]; if(histYAngleAxis) delete [] histYAngleAxis; histYAngleAxis = new double[nAnglePixelsX]; +#ifdef CHECKINFERROR + int k = 0; + for(int i = 0; i < data->npoints; i++){ + if(isinf(data->values[i])){ + //cout << "*** ERROR: value at " << i << " infinity" << endl; + k++; + data->values[i] = 0; + } + } + cout << "*** ERROR: value at " << k << " places have infinity values!" << endl; + double m1,m2,s1; + GetStatistics(m1,m2,s1,data->angles,nAnglePixelsX); + cout << "angle min:" << m1 << endl; + cout << "angle max:" << m2 << endl; + cout << "angle sum:" << s1 << endl; + GetStatistics(m1,m2,s1,data->values,nAnglePixelsX); + cout << "value min:" << m1 << endl; + cout << "value max:" << m2 << endl; + cout << "value sum:" << s1 << endl; +#endif memcpy(histXAngleAxis,data->angles,nAnglePixelsX*sizeof(double)); memcpy(histYAngleAxis,data->values,nAnglePixelsX*sizeof(double)); SetHistXAxisTitle("Angles"); } UnlockLastImageArray(); currentFrame++; +#ifdef VERYVERBOSE + cout << "Exiting GetData Function " << endl; +#endif return 0; } @@ -1271,10 +1293,10 @@ void qDrawPlot::UpdatePlot(){ h->Attach(plot1D); //refixing all the zooming if((firstPlot) || (anglePlot)){ - plot1D->SetXMinMax(h->minXValue(),h->maxXValue()); + /*plot1D->SetXMinMax(h->minXValue(),h->maxXValue()); plot1D->SetYMinMax(h->minYValue(),h->maxYValue()); plot1D->SetZoomBase(h->minXValue(),h->minYValue(), - h->maxXValue()-h->minXValue(),h->maxYValue()-h->minYValue()); + h->maxXValue()-h->minXValue(),h->maxYValue()-h->minYValue());*/ firstPlot = false; } } @@ -1715,10 +1737,10 @@ int qDrawPlot::UpdateTrimbitPlot(bool fromDetector,bool Histogram){ //attach plot h->Attach(plot1D); //refixing all the zooming - plot1D->SetXMinMax(h->minXValue(),h->maxXValue()); + /*plot1D->SetXMinMax(h->minXValue(),h->maxXValue()); plot1D->SetYMinMax(h->minYValue(),h->maxYValue()); plot1D->SetZoomBase(h->minXValue(),h->minYValue(), - h->maxXValue()-h->minXValue(),h->maxYValue()-h->minYValue()); + h->maxXValue()-h->minXValue(),h->maxYValue()-h->minYValue());*/ } else{ @@ -1751,9 +1773,9 @@ int qDrawPlot::UpdateTrimbitPlot(bool fromDetector,bool Histogram){ histFrameIndexTitle->setText(GetHistTitle(0)); plotHistogram->attach(plot1D); //refixing all the zooming - plot1D->SetXMinMax(0,TRIM_HISTOGRAM_XMAX+1); + /*plot1D->SetXMinMax(0,TRIM_HISTOGRAM_XMAX+1); plot1D->SetYMinMax(0,plotHistogram->boundingRect().height()); - plot1D->SetZoomBase(0,0,actualPixelsX,plotHistogram->boundingRect().height()); + plot1D->SetZoomBase(0,0,actualPixelsX,plotHistogram->boundingRect().height());*/ } } From 6956ee3164f7424c04c88c374561d641f5e46067 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Mon, 25 Nov 2013 16:00:35 +0000 Subject: [PATCH 247/332] getting back to basics in zooming, using a flag to check for angle error git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@247 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qDrawPlot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index fe3635f86..30537a769 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -802,7 +802,7 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){ if(isinf(data->values[i])){ //cout << "*** ERROR: value at " << i << " infinity" << endl; k++; - data->values[i] = 0; + data->values[i] = -1; } } cout << "*** ERROR: value at " << k << " places have infinity values!" << endl; From 5c1574ec903bb96e999e06164d2b4b70457c8efc Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Mon, 25 Nov 2013 16:57:57 +0000 Subject: [PATCH 248/332] updated binary of 2d to be negative an update the label enabling before each acquisition if disabled git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@248 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_plot.ui | 8 ++++---- slsDetectorGui/src/qTabPlot.cpp | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index d15305e55..1a5404f05 100644 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -99,7 +99,7 @@ - 5 + 3 @@ -482,7 +482,7 @@ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - 0 + -16777215 16777215 @@ -529,7 +529,7 @@ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - 0 + -16777215 16777215 @@ -771,7 +771,7 @@ Displays minimum, maximum and sum of values for each plot. - 6 + 4 diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index e51eee995..cef2f6b38 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -841,6 +841,7 @@ void qTabPlot::EnableScanBox(bool Histo){ connect(btnGroupPlotType,SIGNAL(buttonClicked(int)),this, SLOT(SetPlot())); connect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox())); + } @@ -917,6 +918,9 @@ void qTabPlot::SetScanArgument(){ }else myPlot->SetScanArgument(qDefs::None); + //update the from and to labels to be enabled + SetBinary(); + qDefs::checkErrorMessage(myDet,"qTabPlot::SetScanArgument"); } From 3731bfd51e8f0337ab7cbefdc86b909e39181658 Mon Sep 17 00:00:00 2001 From: bergamaschi Date: Tue, 17 Dec 2013 10:31:54 +0000 Subject: [PATCH 249/332] removed checkinfinity flags git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@249 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/slsDetectorGui.pro | 2 +- slsDetectorGui/src/qDrawPlot.cpp | 49 ++++++++++++++++++++------- slsDetectorGui/src/qTabAdvanced.cpp | 11 +++++- slsDetectorGui/src/qTabDataOutput.cpp | 3 +- 4 files changed, 49 insertions(+), 16 deletions(-) diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index 624eec047..72f89a506 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -20,7 +20,7 @@ QMAKE_LIBS = -L$(QTDIR)/lib #LIBS = -L$(QWTDIR)/lib -lqwt -L$(QWT3D)/lib -Wl,-R$(QWTDIR)/lib -L /usr/local/epics/base/lib/$(EPICS_HOST_ARCH)/ -Wl,-R/usr/local/epics/base/lib/$(EPICS_HOST_ARCH) -lca -lCom #default -DEFINES += VERBOSE DACS_INT PRINT_LOG CHECKINFERROR THIS_PATH=\\\"$$PWD\\\" #VERYVERBOSE +DEFINES += VERBOSE DACS_INT PRINT_LOG THIS_PATH=\\\"$$PWD\\\" #VERYVERBOSE CHECKINFERROR LIBS = -L$(QWTDIR)/lib -lqwt -L$(QWT3D)/lib diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 30537a769..2621bf3b6 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -633,6 +633,10 @@ void qDrawPlot::SetupMeasurement(){ LockLastImageArray(); +#ifdef VERBOSE + cout << "locklastimagearray" << endl; + +#endif // Defaults if(!running) stop_signal = 0; @@ -649,6 +653,10 @@ void qDrawPlot::SetupMeasurement(){ //1d with no scan if ((!originally2D) && (scanArgument==qDefs::None)){ +#ifdef VERBOSE + cout << "1D" << endl; + +#endif if(!running){ maxPixelsY = 100; minPixelsY = 0; @@ -657,6 +665,10 @@ void qDrawPlot::SetupMeasurement(){ } } else { +#ifdef VERBOSE + cout << "2D" << endl; + +#endif //2d with no scan if ((originally2D) && (scanArgument==qDefs::None)){ maxPixelsY = nPixelsY; @@ -704,6 +716,12 @@ void qDrawPlot::SetupMeasurement(){ cout<<"endPixel:"<GetData(data,fIndex); + cout << "data ready callback worked ok" << endl; return 0; } @@ -729,7 +748,7 @@ int qDrawPlot::GetDataCallBack(detectorData *data, int fIndex, void *this_pointe int qDrawPlot::GetData(detectorData *data,int fIndex){ -#ifdef VERYVERBOSE + //#ifdef VERYVERBOSE cout << "******Entering GetDatafunction********" << endl; cout << "fIndex " << fIndex << endl; cout << "fname " << data->fileName << endl; @@ -739,7 +758,7 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){ cout << "values " << data->values << endl; cout << "errors " << data->errors << endl; cout << "angle " << data->angles << endl; -#endif + //#endif if(!stop_signal){ //set progress @@ -805,16 +824,18 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){ data->values[i] = -1; } } - cout << "*** ERROR: value at " << k << " places have infinity values!" << endl; - double m1,m2,s1; - GetStatistics(m1,m2,s1,data->angles,nAnglePixelsX); - cout << "angle min:" << m1 << endl; - cout << "angle max:" << m2 << endl; - cout << "angle sum:" << s1 << endl; - GetStatistics(m1,m2,s1,data->values,nAnglePixelsX); - cout << "value min:" << m1 << endl; - cout << "value max:" << m2 << endl; - cout << "value sum:" << s1 << endl; + if (k>0) { + cout << "*** ERROR: value at " << k << " places have infinity values!" << endl; + double m1,m2,s1; + GetStatistics(m1,m2,s1,data->angles,nAnglePixelsX); + cout << "angle min:" << m1 << endl; + cout << "angle max:" << m2 << endl; + cout << "angle sum:" << s1 << endl; + GetStatistics(m1,m2,s1,data->values,nAnglePixelsX); + cout << "value min:" << m1 << endl; + cout << "value max:" << m2 << endl; + cout << "value sum:" << s1 << endl; + } #endif memcpy(histXAngleAxis,data->angles,nAnglePixelsX*sizeof(double)); memcpy(histYAngleAxis,data->values,nAnglePixelsX*sizeof(double)); @@ -1100,6 +1121,7 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){ int qDrawPlot::GetAcquisitionFinishedCallBack(double currentProgress,int detectorStatus, void *this_pointer){ ((qDrawPlot*)this_pointer)->AcquisitionFinished(currentProgress,detectorStatus); + cout << "acquisition finished callback worked ok" << endl; return 0; } @@ -1144,6 +1166,7 @@ int qDrawPlot::AcquisitionFinished(double currentProgress, int detectorStatus){ int qDrawPlot::GetProgressCallBack(double currentProgress, void *this_pointer){ ((qDrawPlot*)this_pointer)->progress= currentProgress; + cout << "progress callback " << endl; return 0; } @@ -1165,7 +1188,9 @@ void qDrawPlot::ShowAcquisitionErrorMessage(QString status){ int qDrawPlot::GetMeasurementFinishedCallBack(int currentMeasurementIndex, int fileIndex, void *this_pointer){ + cout << "measurement finished callback?" << endl; ((qDrawPlot*)this_pointer)->MeasurementFinished(currentMeasurementIndex, fileIndex); + cout << "measurement finished callback worked ok" << endl; return 0; } diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp index 16231733d..08be2056b 100644 --- a/slsDetectorGui/src/qTabAdvanced.cpp +++ b/slsDetectorGui/src/qTabAdvanced.cpp @@ -123,15 +123,17 @@ void qTabAdvanced::SetupWidgetWindow(){ comboDetector->addItem(QString(myDet->getHostname(i).c_str())); comboDetector->setCurrentIndex(0); + det = myDet->getSlsDetector(comboDetector->currentIndex()); qDefs::checkErrorMessage(myDet,"qTabAdvanced::SetupWidgetWindow"); - + cout << "ports" << endl; spinControlPort->setValue(det->getControlPort()); spinStopPort->setValue(det->getStopPort()); spinTCPPort->setValue(det->getReceiverPort()); spinUDPPort->setValue(atoi(det->getReceiverUDPPort())); + cout << "net" << endl; dispIP->setText(det->getDetectorIP()); dispMAC->setText(det->getDetectorMAC()); dispRxrHostname->setText(det->getReceiver()); @@ -140,6 +142,8 @@ void qTabAdvanced::SetupWidgetWindow(){ //check if its online and set it to red if offline + + cout << "online" << endl; if(det->setOnline()==slsDetectorDefs::ONLINE_FLAG) det->checkOnline(); if(det->setReceiverOnline()==slsDetectorDefs::ONLINE_FLAG) @@ -160,12 +164,17 @@ void qTabAdvanced::SetupWidgetWindow(){ } + cout << "ROI" << endl; //updates roi updateROIList(); + cout << "Init" << endl; + Initialization(); + cout << "done" << endl; + qDefs::checkErrorMessage(det,"qTabAdvanced::SetupWidgetWindow"); } diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index 213383d21..eb3e997a7 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -283,7 +283,7 @@ void qTabDataOutput::BrowseFlatFieldPath(){ if(dir.isEmpty()) dir = QString(myDet->getFlatFieldCorrectionDir().c_str());/*"/home/";*/ fName = QFileDialog::getOpenFileName(this, tr("Load Flat Field Correction File"),dir, - tr("Flat Field Correction Files(*.dat)"),0,QFileDialog::ShowDirsOnly); + tr("Data Files(*.raw *.dat);; All Files (*.*)"),0,QFileDialog::ShowDirsOnly); if (!fName.isEmpty()){ dispFlatField->setText(fName); SetFlatField(); @@ -293,7 +293,6 @@ void qTabDataOutput::BrowseFlatFieldPath(){ } - //------------------------------------------------------------------------------------------------------------------------------------------------- From 635a33ea857b898bd56bc07a1c56c54189f776c3 Mon Sep 17 00:00:00 2001 From: x04sa Date: Tue, 28 Jan 2014 12:20:43 +0000 Subject: [PATCH 250/332] fixed bug when trimming git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@250 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qDetectorMain.cpp | 5 +- slsDetectorGui/src/qDrawPlot.cpp | 78 +++++++++++++++------------- slsDetectorGui/src/qTabAdvanced.cpp | 5 +- 3 files changed, 46 insertions(+), 42 deletions(-) diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 38e65e03c..f470bdae1 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -30,10 +30,9 @@ using namespace std; //------------------------------------------------------------------------------------------------------------------------------------------------- - int main (int argc, char **argv) { - - QApplication *theApp = new QApplication(argc, argv); + MyApplication *theApp = new MyApplication(argc, argv); + // QApplication *theApp = new QApplication(argc, argv); theApp->setStyle(new QPlastiqueStyle);//not default when desktop is windows theApp->setWindowIcon(QIcon( ":/icons/images/mountain.png" )); qDetectorMain *det=new qDetectorMain(argc, argv, theApp,0); diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 2621bf3b6..8d9d48f55 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -630,8 +630,9 @@ void qDrawPlot::SetupMeasurement(){ #ifdef VERBOSE cout << "SetupMeasurement function:" << running << endl; #endif - - LockLastImageArray(); + cout<<"begnPixelsX:"<angles << endl; //#endif if(!stop_signal){ - +cout<<"before progress"<progressIndex; currentFrameIndex = fileIOStatic::getIndicesFromFileName(string(data->fileName),currentFileIndex); @@ -769,10 +771,9 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){ cout << "Received empty file name. Exiting function without updating data for plot." << endl; return -1; } -#ifdef VERYVERBOSE + //#ifdef VERYVERBOSE cout << "progress:" << progress << endl; -#endif - + //#endif // secondary title necessary to differentiate between frames when not saving data char temp_title[2000]; //findex is used because in the receiver, you cannot know the frame index as many frames are in 1 file. @@ -788,7 +789,7 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){ //Plot Disabled if(!plotEnable) return 0; - + cout<<"before entering angleplot"<start((int)(PLOT_TIMER_MS/2)); - } + if (scanArgument == qDefs::None) { + //if the time is not over, RETURN + if(!data_pause_over){ + return 0; + } + data_pause_over=false; + data_pause_timer->start((int)(PLOT_TIMER_MS/2)); + } } -//if scan + //if scan //alframes if(scanArgument==qDefs::AllFrames){ LockLastImageArray(); @@ -964,10 +965,10 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){ //normal measurement or 1d scans if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ - //set title - plotTitle=QString(plotTitle_prefix)+QString(data->fileName).section('/',-1); - // only if you got the lock, do u need to remember lastimagenumber to plot - lastImageNumber= currentFrame+1; + //set title + plotTitle=QString(plotTitle_prefix)+QString(data->fileName).section('/',-1); + // only if you got the lock, do u need to remember lastimagenumber to plot + lastImageNumber= currentFrame+1; //1d if(plot_in_scope==1){ @@ -1051,7 +1052,7 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){ histYAxis[0][px] = temp; } } - } + } } //2d else{ @@ -1135,9 +1136,9 @@ int qDrawPlot::AcquisitionFinished(double currentProgress, int detectorStatus){ #endif QString status = QString(slsDetectorBase::runStatusType(slsDetectorDefs::runStatus(detectorStatus)).c_str()); #ifdef VERBOSE - cout << status.toAscii().constData() << " and progress " << currentProgress << endl; + cout << status.toAscii().constData() << " and progress " << currentProgress << endl; #endif - //error or stopped + //error or stopped if((stop_signal)||(detectorStatus==slsDetectorDefs::ERROR)){ #ifdef VERBOSE cout << "Error in Acquisition" << endl << endl; @@ -1325,8 +1326,9 @@ void qDrawPlot::UpdatePlot(){ firstPlot = false; } } - } + + // update range if required if(XYRangeChanged){ if(!IsXYRange[qDefs::XMINIMUM]) XYRangeValues[qDefs::XMINIMUM]= plot1D->GetXMinimum(); @@ -1709,8 +1711,10 @@ int qDrawPlot::UpdateTrimbitPlot(bool fromDetector,bool Histogram){ //get trimbits actualPixelsX = myDet->getTotalNumberOfChannels(slsDetectorDefs::X); - if(histTrimbits) delete [] histTrimbits; histTrimbits = new double[actualPixelsX]; + if(histTrimbits) delete [] histTrimbits; + histTrimbits = new double[actualPixelsX]; ret = myDet->getChanRegs(histTrimbits,fromDetector); + // cout << "got it!" << endl; if(!ret){ qDefs::Message(qDefs::WARNING,"No Trimbit data found in shared memory.","qDrawPlot::UpdateTrimbitPlot"); UnlockLastImageArray(); diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp index 08be2056b..a5b7565e9 100644 --- a/slsDetectorGui/src/qTabAdvanced.cpp +++ b/slsDetectorGui/src/qTabAdvanced.cpp @@ -584,14 +584,15 @@ void qTabAdvanced::StartTrimming(){ break; default: cout << "Should never come here. Start Trimming will have only 2 methods. Trimming Method:" << trimmingMode << endl; - break; + return; } //execute int ret = myDet->executeTrimming(trimmingMode,parameter1,parameter2,-1); + if((ret!=slsDetectorDefs::FAIL)&&(ret!=-1)); else - qDefs::Message(qDefs::WARNING,"Atleast 1 channel could not be trimmed.","qTabAdvanced::StartTrimming"); + qDefs::Message(qDefs::WARNING,"Atleast 1 channel could not be trimmed.","qTabAdvanced::StartTrimming"); //save trim file ret = myDet->saveSettingsFile(string(dispFile->text().toAscii().constData()),-1); if((ret!=slsDetectorDefs::FAIL)&&(ret!=-1)){ From a1c58f152f530c3f0b5050cbf02e8b0dde0f2f1e Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Thu, 30 Jan 2014 17:50:41 +0000 Subject: [PATCH 251/332] got rid of unncessary printouts and MyApplication inqDetectorMain does not work.so bak to original git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@251 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qDetectorMain.cpp | 2 +- slsDetectorGui/src/qDrawPlot.cpp | 28 ++++++++------------------- slsDetectorGui/src/qTabAdvanced.cpp | 14 +++++--------- slsDetectorGui/src/qTabDataOutput.cpp | 6 +----- 4 files changed, 15 insertions(+), 35 deletions(-) diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index f470bdae1..158e09cb8 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -31,7 +31,7 @@ using namespace std; //------------------------------------------------------------------------------------------------------------------------------------------------- int main (int argc, char **argv) { - MyApplication *theApp = new MyApplication(argc, argv); + QApplication *theApp = new QApplication(argc, argv); // QApplication *theApp = new QApplication(argc, argv); theApp->setStyle(new QPlastiqueStyle);//not default when desktop is windows theApp->setWindowIcon(QIcon( ":/icons/images/mountain.png" )); diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 8d9d48f55..018ccf313 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -630,13 +630,9 @@ void qDrawPlot::SetupMeasurement(){ #ifdef VERBOSE cout << "SetupMeasurement function:" << running << endl; #endif - cout<<"begnPixelsX:"<GetData(data,fIndex); - cout << "data ready callback worked ok" << endl; return 0; } @@ -750,7 +742,7 @@ int qDrawPlot::GetDataCallBack(detectorData *data, int fIndex, void *this_pointe int qDrawPlot::GetData(detectorData *data,int fIndex){ - //#ifdef VERYVERBOSE +#ifdef VERYVERBOSE cout << "******Entering GetDatafunction********" << endl; cout << "fIndex " << fIndex << endl; cout << "fname " << data->fileName << endl; @@ -760,9 +752,9 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){ cout << "values " << data->values << endl; cout << "errors " << data->errors << endl; cout << "angle " << data->angles << endl; - //#endif +#endif if(!stop_signal){ -cout<<"before progress"<progressIndex; currentFrameIndex = fileIOStatic::getIndicesFromFileName(string(data->fileName),currentFileIndex); @@ -771,9 +763,9 @@ cout<<"before progress"<progress= currentProgress; - cout << "progress callback " << endl; return 0; } @@ -1189,9 +1179,7 @@ void qDrawPlot::ShowAcquisitionErrorMessage(QString status){ int qDrawPlot::GetMeasurementFinishedCallBack(int currentMeasurementIndex, int fileIndex, void *this_pointer){ - cout << "measurement finished callback?" << endl; ((qDrawPlot*)this_pointer)->MeasurementFinished(currentMeasurementIndex, fileIndex); - cout << "measurement finished callback worked ok" << endl; return 0; } diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp index a5b7565e9..8d85327a8 100644 --- a/slsDetectorGui/src/qTabAdvanced.cpp +++ b/slsDetectorGui/src/qTabAdvanced.cpp @@ -127,13 +127,13 @@ void qTabAdvanced::SetupWidgetWindow(){ det = myDet->getSlsDetector(comboDetector->currentIndex()); qDefs::checkErrorMessage(myDet,"qTabAdvanced::SetupWidgetWindow"); - cout << "ports" << endl; + cout << "Getting ports" << endl; spinControlPort->setValue(det->getControlPort()); spinStopPort->setValue(det->getStopPort()); spinTCPPort->setValue(det->getReceiverPort()); spinUDPPort->setValue(atoi(det->getReceiverUDPPort())); - cout << "net" << endl; + cout << "Getting network information" << endl; dispIP->setText(det->getDetectorIP()); dispMAC->setText(det->getDetectorMAC()); dispRxrHostname->setText(det->getReceiver()); @@ -142,8 +142,9 @@ void qTabAdvanced::SetupWidgetWindow(){ //check if its online and set it to red if offline - +#ifdef VERYVERBOSE cout << "online" << endl; +#endif if(det->setOnline()==slsDetectorDefs::ONLINE_FLAG) det->checkOnline(); if(det->setReceiverOnline()==slsDetectorDefs::ONLINE_FLAG) @@ -164,17 +165,12 @@ void qTabAdvanced::SetupWidgetWindow(){ } - cout << "ROI" << endl; - //updates roi + cout << "Getting ROI" << endl; updateROIList(); - cout << "Init" << endl; - Initialization(); - cout << "done" << endl; - qDefs::checkErrorMessage(det,"qTabAdvanced::SetupWidgetWindow"); } diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index eb3e997a7..776774b02 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -110,8 +110,7 @@ void qTabDataOutput::SetupWidgetWindow(){ //discard bad channels from server #ifdef VERBOSE - cout << "Getting bad channel correction" << endl; - cout << "func " << myDet->getBadChannelCorrection() << endl; + cout << "Getting bad channel correction:" << myDet->getBadChannelCorrection() << endl; #endif @@ -123,9 +122,6 @@ void qTabDataOutput::SetupWidgetWindow(){ chkDiscardBad->setChecked(false); connect(chkDiscardBad, SIGNAL(toggled(bool)), this, SLOT(DiscardBadChannels())); -#ifdef VERBOSE - cout << "done" << endl; -#endif qDefs::checkErrorMessage(myDet,"qTabDataOutput::SetupWidgetWindow"); } From f738b218e1def58e25fd0cab1606d49f6ada2e61 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Thu, 30 Jan 2014 17:52:00 +0000 Subject: [PATCH 252/332] svn rev updates git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@252 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/svnInfoGui.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/slsDetectorGui/include/svnInfoGui.h b/slsDetectorGui/include/svnInfoGui.h index 7c77bbbe6..a305f207f 100644 --- a/slsDetectorGui/include/svnInfoGui.h +++ b/slsDetectorGui/include/svnInfoGui.h @@ -2,10 +2,10 @@ #define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui" //#define SVNREPPATH "" #define SVNREPUUID "af1100a4-978c-4157-bff7-07162d2ba061" -//#define SVNREV 0x245 +//#define SVNREV 0x251 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "l_maliakal_d" -#define SVNREV 0x245 -#define SVNDATE 0x20131014 +#define SVNREV 0x251 +#define SVNDATE 0x20140130 // From 78e6dccf465ef59a9b824b6aa5868cff20cefa88 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 31 Jan 2014 14:12:14 +0000 Subject: [PATCH 253/332] fixed angular conversion crashing problem and got rid of unnecssary prints git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@253 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qDrawPlot.cpp | 15 +++++++------- slsDetectorGui/src/qTabDataOutput.cpp | 28 +++++++++------------------ slsDetectorGui/src/qTabPlot.cpp | 2 +- slsDetectorGui/src/qTabSettings.cpp | 5 ++++- 4 files changed, 21 insertions(+), 29 deletions(-) diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 018ccf313..1d3e4703f 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -461,7 +461,7 @@ int qDrawPlot::ResetDaqForGui(){ bool qDrawPlot::StartOrStopThread(bool start){ -#ifdef VERBOSE +#ifdef VERYVERBOSE cout << "StartOrStopThread:" << start << endl; #endif static bool firstTime = true; @@ -510,7 +510,7 @@ bool qDrawPlot::StartOrStopThread(bool start){ void qDrawPlot::SetScanArgument(int scanArg){ -#ifdef VERBOSE +#ifdef VERYVERBOSE cout << "SetScanArgument function:" << scanArg << " running:" << running << endl; #endif scanArgument = scanArg; @@ -627,11 +627,11 @@ void qDrawPlot::SetScanArgument(int scanArg){ void qDrawPlot::SetupMeasurement(){ -#ifdef VERBOSE +#ifdef VERYVERBOSE cout << "SetupMeasurement function:" << running << endl; #endif LockLastImageArray(); -#ifdef VERBOSE +#ifdef VERYVERBOSE cout << "locklastimagearray" << endl; #endif // Defaults @@ -643,7 +643,6 @@ void qDrawPlot::SetupMeasurement(){ //if(plot_in_scope==2) if(!running) lastImageNumber = 0;/**Just now */ - cout<<"before 2d"<isChecked()){ - if(myDet->setAngularConversionFile("default")){ + bool enabled = chkAngular->isChecked(); + //set + if(myDet->setAngularCorrectionMask(enabled) == enabled){ #ifdef VERBOSE - cout << "Setting angular conversion to default" << endl; + cout << "Angular Conversion mask:" << enabled << endl; #endif - }else{ + } + //error + else{ #ifdef VERBOSE cout << "Could not set angular conversion to default" << endl; #endif - qDefs::Message(qDefs::WARNING,"Angular Conversion could not be set. Please set the default file name using the command line, if you haven't already.","qTabDataOutput::SetAngularCorrection"); - chkAngular->setChecked(false); - } - }else{ - if(myDet->setAngularConversionFile("")){ -#ifdef VERBOSE - cout << "Could not reset angular correction" << endl; -#endif - qDefs::Message(qDefs::WARNING,"Angular Conversion could not be reset.","qTabDataOutput::SetAngularCorrection"); - chkAngular->setChecked(true); - }else{; -#ifdef VERBOSE - cout << "Unsetting angular correction" << endl; -#endif - } + qDefs::Message(qDefs::WARNING,"Angular Conversion could not be set/reset. Please set the default file name using the command line, if you want to set it.","qTabDataOutput::SetAngularCorrection"); + chkAngular->setChecked(!enabled); } emit AngularConversionSignal(chkAngular->isChecked()); diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index cef2f6b38..b072f84a9 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -715,6 +715,7 @@ void qTabPlot::EnableScanBox(bool Histo){ int mode1 = myDet->getScanMode(1); int ang; bool angConvert = myDet->getAngularConversion(ang); + myPlot->EnableAnglePlot(angConvert); radioDataGraph->setEnabled(true); radioHistogram->setEnabled(true); @@ -752,7 +753,6 @@ void qTabPlot::EnableScanBox(bool Histo){ - myPlot->EnableAnglePlot(angConvert); if(angConvert){ boxScan->setToolTip("Only 1D Plots enabled for Angle Plots"); //disable histogram diff --git a/slsDetectorGui/src/qTabSettings.cpp b/slsDetectorGui/src/qTabSettings.cpp index a0d2fb3f7..867f4d3a8 100644 --- a/slsDetectorGui/src/qTabSettings.cpp +++ b/slsDetectorGui/src/qTabSettings.cpp @@ -266,9 +266,12 @@ void qTabSettings::Refresh(){ // Number of Modules +#ifdef VERBOSE + cout << "Getting number of modules:" ; +#endif int numMod = myDet->setNumberOfModules(); #ifdef VERBOSE - cout << "Getting number of modules:" << numMod << endl; + cout << numMod << endl; #endif spinNumModules->setValue(numMod); From 922c7ede9295f77840faa3729237999f722dc064 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 31 Jan 2014 16:32:31 +0000 Subject: [PATCH 254/332] removed an extra settings check git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@254 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qDrawPlot.cpp | 2 +- slsDetectorGui/src/qTabSettings.cpp | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 1d3e4703f..d9439899b 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -658,7 +658,7 @@ void qDrawPlot::SetupMeasurement(){ minPixelsY = 0; startPixel = -0.5; endPixel = nPixelsY-0.5; - }else cout<<"correct palce"<getSettings(); - if(sett==-1) sett = slsDetectorDefs::UNDEFINED; - comboSettings->setCurrentIndex(sett); //threshold if((detType == slsDetectorDefs::MYTHEN) || (detType == slsDetectorDefs::EIGER)) @@ -166,7 +163,7 @@ void qTabSettings::setSettings(int index){ else{ slsDetectorDefs::detectorSettings sett = myDet->setSettings((slsDetectorDefs::detectorSettings)index); #ifdef VERBOSE - cout << "Settings have been set to " << myDet->slsDetectorBase::getDetectorSettings(sett) << endl; + cout << endl << "Settings have been set to " << myDet->slsDetectorBase::getDetectorSettings(sett) << endl; #endif //threshold From 32e4af910d39b23284c4c13c9859f382a6b7260e Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Mon, 3 Feb 2014 13:10:53 +0000 Subject: [PATCH 255/332] to reduce warning in between plotting git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@255 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qTabPlot.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index b072f84a9..2498be00b 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -585,7 +585,10 @@ void qTabPlot::SetFrequency(){ acqPeriodMS = (myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-6)); if(acqPeriodMS==0){ - qDefs::Message(qDefs::WARNING,"Interval between Plots:
" + //to reduce the warnings displayed + if((comboFrequency->currentIndex() == 0) && (spinTimeGap->value() == minPlotTimer)); + else + qDefs::Message(qDefs::WARNING,"Interval between Plots:
" "Every Nth Image: Period betwen Frames and Exposure Time cannot both be 0 ms.
" "Resetting to minimum plotting time interval","qTabPlot::SetFrequency"); comboFrequency->setCurrentIndex(0); From 28e0cae2e2f978ad8f1e9f6729f496a23e8bfb90 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 4 Feb 2014 11:22:58 +0000 Subject: [PATCH 256/332] rescaled histogram plotting git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@256 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qDrawPlot.cpp | 6 ++++-- slsDetectorGui/src/qTabDataOutput.cpp | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index d9439899b..c9b335eb2 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -1745,6 +1745,8 @@ int qDrawPlot::UpdateTrimbitPlot(bool fromDetector,bool Histogram){ plot1D->SetYTitle("Trimbits"); //set plot parameters plot1D->SetXMinMax(0,nPixelsX); + /*plot1D->SetYMinMax(0,plotHistogram->boundingRect().height()); plot1D->SetZoomBase(0,0,nPixelsX,plot1D->GetYMaximum());*/ + //for some reason this plothistogram works as well. plot1D->SetZoomBase(0,0,nPixelsX,plotHistogram->boundingRect().height()); SlsQtH1D* h; plot1D_hists.append(h=new SlsQtH1D("",nPixelsX,histXAxis,histYAxis[0])); @@ -1789,9 +1791,9 @@ int qDrawPlot::UpdateTrimbitPlot(bool fromDetector,bool Histogram){ histFrameIndexTitle->setText(GetHistTitle(0)); plotHistogram->attach(plot1D); //refixing all the zooming - /*plot1D->SetXMinMax(0,TRIM_HISTOGRAM_XMAX+1); + plot1D->SetXMinMax(0,TRIM_HISTOGRAM_XMAX+1); plot1D->SetYMinMax(0,plotHistogram->boundingRect().height()); - plot1D->SetZoomBase(0,0,actualPixelsX,plotHistogram->boundingRect().height());*/ + plot1D->SetZoomBase(0,0,actualPixelsX,plotHistogram->boundingRect().height()); } } diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index cd801392c..7d15b1e01 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -123,6 +123,10 @@ void qTabDataOutput::SetupWidgetWindow(){ connect(chkDiscardBad, SIGNAL(toggled(bool)), this, SLOT(DiscardBadChannels())); + if(detType == slsDetectorDefs::MYTHEN){ + comboDetector->hide(); + } + qDefs::checkErrorMessage(myDet,"qTabDataOutput::SetupWidgetWindow"); } From 534be9f94296dbebff4ac0b9e93bc5ac097c5e20 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 5 Feb 2014 16:37:05 +0000 Subject: [PATCH 257/332] file dialogs now show option to show all files, trimbits is possible to open non existing file, copying clones does not get rid of the old plot git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@257 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qCloneWidget.h | 24 ++++- slsDetectorGui/include/qDrawPlot.h | 1 - slsDetectorGui/include/qTabPlot.h | 4 - slsDetectorGui/src/qCloneWidget.cpp | 140 ++++++++++++++++---------- slsDetectorGui/src/qDetectorMain.cpp | 39 ++++--- slsDetectorGui/src/qDrawPlot.cpp | 92 ++++++----------- slsDetectorGui/src/qTabAdvanced.cpp | 10 +- slsDetectorGui/src/qTabMessages.cpp | 2 +- slsDetectorGui/src/qTabPlot.cpp | 26 ----- 9 files changed, 165 insertions(+), 173 deletions(-) diff --git a/slsDetectorGui/include/qCloneWidget.h b/slsDetectorGui/include/qCloneWidget.h index 760b55e25..8e1312660 100644 --- a/slsDetectorGui/include/qCloneWidget.h +++ b/slsDetectorGui/include/qCloneWidget.h @@ -47,7 +47,7 @@ class qCloneWidget:public QMainWindow{ public: /** \short The constructor */ - qCloneWidget(QWidget *parent,int id,QString title,int numDim,SlsQt1DPlot*& plot1D,SlsQt2DPlotLayout*& plot2D,string FilePath, + qCloneWidget(QWidget *parent,int id,QString title,QString xTitle, QString yTitle, QString zTitle, int numDim,string FilePath, bool displayStats, QString min, QString max, QString sum); /** Destructor @@ -56,11 +56,12 @@ public: /** Sets up the widget window * @param title title of the image with frame number + * @param xTitle title of x axis + * @param yTitle title of y axis + * @param zTitle title of z axis * @param numDim 1D or 2D - * @param plot1D plot1d object reference - * @param plot2D plot2d object reference * */ - void SetupWidgetWindow(QString title,int numDim,SlsQt1DPlot*& plot1D,SlsQt2DPlotLayout*& plot2D); + void SetupWidgetWindow(QString title, QString xTitle, QString yTitle, QString zTitle, int numDim); @@ -86,6 +87,17 @@ public: * */ void SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis,string histTitle[],bool lines,bool markers); + /** Get the 1D hist values to plot for angle plotting + * @param nbinsx number of bins in x axis + * @param xmin minimum in x axis + * @param xmax maximum in x axis + * @param nbinsy number of bins in y axis + * @param ymin minimum in y axis + * @param ymax maximum in y axis + * @param d data + * */ + void SetCloneHists2D(int nbinsx,double xmin,double xmax,int nbinsy, double ymin, double ymax, double *d); + /**Set the range of the 1d plot * @param IsXYRange array of x,y,min,max if these values are set * @param XYRangeValues array of set values of x,y, min, max @@ -115,9 +127,11 @@ private: /** vector of 1D hist values */ QVector cloneplot1D_hists; + /** markers for the plot*/ + QwtSymbol *marker; + QwtSymbol *nomarker; QMenuBar *menubar; - // QMenu *menuFile; QAction *actionSave; QGridLayout *mainLayout; diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index a5e35316e..c2210faed 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -579,7 +579,6 @@ void ResetZMinZMaxSignal(bool,bool,double,double); void SetCurrentMeasurementSignal(int); void saveErrorSignal(QString); void AcquisitionErrorSignal(QString); -void UpdateAfterCloningSignal(); }; diff --git a/slsDetectorGui/include/qTabPlot.h b/slsDetectorGui/include/qTabPlot.h index dd4f65e75..58f23a451 100644 --- a/slsDetectorGui/include/qTabPlot.h +++ b/slsDetectorGui/include/qTabPlot.h @@ -107,10 +107,6 @@ public slots: */ void EnableScanBox(bool Histo=false); - /** Update all ranges, interpolate etc after cloning - */ - void UpdateAfterCloning(); - private slots: /** Selects the plot to display, enables/disables widgets diff --git a/slsDetectorGui/src/qCloneWidget.cpp b/slsDetectorGui/src/qCloneWidget.cpp index ba3c12883..707db9781 100644 --- a/slsDetectorGui/src/qCloneWidget.cpp +++ b/slsDetectorGui/src/qCloneWidget.cpp @@ -18,18 +18,23 @@ //------------------------------------------------------------------------------------------------------------------------------------------------- -qCloneWidget::qCloneWidget(QWidget *parent,int id,QString title,int numDim,SlsQt1DPlot*& plot1D,SlsQt2DPlotLayout*& plot2D,string FilePath, - bool displayStats, QString min, QString max, QString sum): +qCloneWidget::qCloneWidget(QWidget *parent,int id,QString title,QString xTitle, QString yTitle, QString zTitle, + int numDim,string FilePath,bool displayStats, QString min, QString max, QString sum): QMainWindow(parent),id(id),cloneplot2D(0),cloneplot1D(0),filePath(FilePath) { - /** Window title*/ + // Window title char winTitle[300],currTime[50]; strcpy(currTime,GetCurrentTimeStamp()); sprintf(winTitle,"Snapshot:%d - %s",id,currTime); setWindowTitle(QString(winTitle)); - /** Set up widget*/ - SetupWidgetWindow(title,numDim,plot1D,plot2D); + marker = new QwtSymbol(); + nomarker = new QwtSymbol(); + marker->setStyle(QwtSymbol::Cross); + marker->setSize(5,5); + + // Set up widget + SetupWidgetWindow(title,xTitle, yTitle, zTitle, numDim); DisplayStats(displayStats,min,max,sum); } @@ -43,51 +48,61 @@ qCloneWidget::~qCloneWidget(){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void qCloneWidget::SetupWidgetWindow(QString title,int numDim,SlsQt1DPlot*& plot1D,SlsQt2DPlotLayout*& plot2D){ +void qCloneWidget::SetupWidgetWindow(QString title, QString xTitle, QString yTitle, QString zTitle, int numDim){ menubar = new QMenuBar(this); - //menuFile = new QMenu("&File",menubar); actionSave = new QAction("&Save",this); - // menubar->addAction(menuFile->menuAction()); menubar->addAction(actionSave); setMenuBar(menubar); - /** Main Window Layout */ + //Main Window Layout QWidget *centralWidget = new QWidget(this); mainLayout = new QGridLayout(centralWidget); centralWidget->setLayout(mainLayout); - /** plot group box*/ + //plot group box cloneBox = new QGroupBox(this); gridClone = new QGridLayout(cloneBox); cloneBox->setLayout(gridClone); cloneBox->setContentsMargins(0,0,0,0); - cloneBox->setTitle(title); cloneBox->setAlignment(Qt::AlignHCenter); cloneBox->setFont(QFont("Sans Serif",11,QFont::Normal)); - /** According to dimensions, create appropriate 1D or 2Dplot */ + cloneBox->setTitle(title); + // According to dimensions, create appropriate 1D or 2Dplot if(numDim==1){ - cloneplot1D = plot1D; - gridClone->addWidget(cloneplot1D,0,0); + cloneplot1D = new SlsQt1DPlot(cloneBox); + + cloneplot1D->setFont(QFont("Sans Serif",9,QFont::Normal)); + cloneplot1D->SetXTitle(xTitle.toAscii().constData()); + cloneplot1D->SetYTitle(yTitle.toAscii().constData()); + + cloneBox->setFlat(false); cloneBox->setContentsMargins(0,30,0,0); + gridClone->addWidget(cloneplot1D,0,0); + lblHistTitle = new QLabel(""); mainLayout->addWidget(lblHistTitle,0,0); }else{ - cloneplot2D = plot2D; - //cloneplot2D->setContentsMargins(0,0,0,0); - gridClone->addWidget(cloneplot2D,0,0); + cloneplot2D = new SlsQt2DPlotLayout(cloneBox); + cloneplot2D->setFont(QFont("Sans Serif",9,QFont::Normal)); + cloneplot2D->SetXTitle(xTitle); + cloneplot2D->SetYTitle(yTitle); + cloneplot2D->SetZTitle(zTitle); + cloneplot2D->setAlignment(Qt::AlignLeft); + cloneBox->setFlat(true); cloneBox->setContentsMargins(0,20,0,0); + gridClone->addWidget(cloneplot2D,0,0); } - /** main window widgets */ + // main window widgets mainLayout->addWidget(cloneBox,1,0); setCentralWidget(centralWidget); - /** Save */ + // Save connect(actionSave,SIGNAL(triggered()),this,SLOT(SavePlot())); setMinimumHeight(300); @@ -97,43 +112,35 @@ void qCloneWidget::SetupWidgetWindow(QString title,int numDim,SlsQt1DPlot*& plot //------------------------------------------------------------------------------------------------------------------------------------------------- void qCloneWidget::SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis[],string histTitle[],bool lines,bool markers){ - /** for each plot*/ + //for each plot, create hists for(int hist_num=0;hist_numcloneplot1D_hists.size()){ cloneplot1D_hists.append(k=new SlsQtH1D("1d plot",histNBins,histXAxis,histYAxis[hist_num])); - k->SetLineColor(hist_num+1); + k->SetLineColor(0); }else{ k=cloneplot1D_hists.at(hist_num); k->SetData(histNBins,histXAxis,histYAxis[hist_num]); } + + //style of plot - if(lines) k->setStyle(QwtPlotCurve::Lines); - else k->setStyle(QwtPlotCurve::Dots); - if(markers) { - QwtSymbol *marker = new QwtSymbol(); - marker->setStyle(QwtSymbol::Cross); - marker->setSize(5,5); + if(lines) k->setStyle(QwtPlotCurve::Lines); + else k->setStyle(QwtPlotCurve::Dots); #if QWT_VERSION<0x060000 - k->setSymbol(*marker); + if(markers) k->setSymbol(*marker); + else k->setSymbol(*nomarker); #else - k->setSymbol(marker); + if(markers) k->setSymbol(marker); + else k->setSymbol(nomarker); #endif - }else { - QwtSymbol *noMarker = new QwtSymbol(); -#if QWT_VERSION<0x060000 - k->setSymbol(*noMarker); -#else - k->setSymbol(noMarker); -#endif - } + //set title and attach plot lblHistTitle->setText(QString(histTitle[0].c_str())); - //k->setTitle(histTitle[hist_num].c_str()); + k->Attach(cloneplot1D); } - //cloneplot1D->UnZoom(); + } @@ -141,9 +148,8 @@ void qCloneWidget::SetCloneHists(int nHists,int histNBins,double* histXAxis,doub void qCloneWidget::SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis,string histTitle[],bool lines,bool markers){ - /** for each plot*/ + // for each plot create hists for(int hist_num=0;hist_numcloneplot1D_hists.size()){ cloneplot1D_hists.append(k=new SlsQtH1D("1d plot",histNBins,histXAxis,histYAxis)); @@ -174,27 +180,53 @@ void qCloneWidget::SetCloneHists(int nHists,int histNBins,double* histXAxis,doub } //set title and attach plot lblHistTitle->setText(QString(histTitle[0].c_str())); - //k->setTitle(histTitle[hist_num].c_str()); k->Attach(cloneplot1D); } - //cloneplot1D->UnZoom(); } + //------------------------------------------------------------------------------------------------------------------------------------------------- +void qCloneWidget::SetCloneHists2D(int nbinsx,double xmin,double xmax,int nbinsy, double ymin, double ymax, double *d){ + cloneplot2D->GetPlot()->SetData(nbinsx,xmin,xmax,nbinsy,ymin,ymax,d); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + + void qCloneWidget::SetRange(bool IsXYRange[],double XYRangeValues[]){ double XYCloneRangeValues[4]; - if(!IsXYRange[qDefs::XMINIMUM]) XYCloneRangeValues[qDefs::XMINIMUM]= cloneplot1D->GetXMinimum(); - else XYCloneRangeValues[qDefs::XMINIMUM]= XYRangeValues[qDefs::XMINIMUM]; - if(!IsXYRange[qDefs::XMAXIMUM]) XYCloneRangeValues[qDefs::XMAXIMUM]= cloneplot1D->GetXMaximum(); - else XYCloneRangeValues[qDefs::XMAXIMUM]= XYRangeValues[qDefs::XMAXIMUM]; - if(!IsXYRange[qDefs::YMINIMUM]) XYCloneRangeValues[qDefs::YMINIMUM]= cloneplot1D->GetYMinimum(); - else XYCloneRangeValues[qDefs::YMINIMUM]= XYRangeValues[qDefs::YMINIMUM]; - if(!IsXYRange[qDefs::YMAXIMUM]) XYCloneRangeValues[qDefs::YMAXIMUM]= cloneplot1D->GetYMaximum(); - else XYCloneRangeValues[qDefs::YMAXIMUM]= XYRangeValues[qDefs::YMAXIMUM]; - cloneplot1D->SetXMinMax(XYCloneRangeValues[qDefs::XMINIMUM],XYCloneRangeValues[qDefs::XMAXIMUM]); - cloneplot1D->SetYMinMax(XYCloneRangeValues[qDefs::YMINIMUM],XYCloneRangeValues[qDefs::YMAXIMUM]); + + if(!IsXYRange[qDefs::XMINIMUM]){ + if(cloneplot1D) XYCloneRangeValues[qDefs::XMINIMUM]= cloneplot1D->GetXMinimum(); + else XYCloneRangeValues[qDefs::XMINIMUM]= cloneplot2D->GetPlot()->GetXMinimum(); + }else XYCloneRangeValues[qDefs::XMINIMUM]= XYRangeValues[qDefs::XMINIMUM]; + + if(!IsXYRange[qDefs::XMAXIMUM]){ + if(cloneplot1D) XYCloneRangeValues[qDefs::XMAXIMUM]= cloneplot1D->GetXMaximum(); + else XYCloneRangeValues[qDefs::XMINIMUM]= cloneplot2D->GetPlot()->GetXMaximum(); + }else XYCloneRangeValues[qDefs::XMAXIMUM]= XYRangeValues[qDefs::XMAXIMUM]; + + if(!IsXYRange[qDefs::YMINIMUM]){ + if(cloneplot1D) XYCloneRangeValues[qDefs::YMINIMUM]= cloneplot1D->GetYMinimum(); + else XYCloneRangeValues[qDefs::XMINIMUM]= cloneplot2D->GetPlot()->GetYMinimum(); + }else XYCloneRangeValues[qDefs::YMINIMUM]= XYRangeValues[qDefs::YMINIMUM]; + + if(!IsXYRange[qDefs::YMAXIMUM]){ + if(cloneplot1D) XYCloneRangeValues[qDefs::YMAXIMUM]= cloneplot1D->GetYMaximum(); + else XYCloneRangeValues[qDefs::XMINIMUM]= cloneplot2D->GetPlot()->GetYMaximum(); + }else XYCloneRangeValues[qDefs::YMAXIMUM]= XYRangeValues[qDefs::YMAXIMUM]; + + if(cloneplot1D){ + cloneplot1D->SetXMinMax(XYCloneRangeValues[qDefs::XMINIMUM],XYCloneRangeValues[qDefs::XMAXIMUM]); + cloneplot1D->SetYMinMax(XYCloneRangeValues[qDefs::YMINIMUM],XYCloneRangeValues[qDefs::YMAXIMUM]); + }else{ + cloneplot2D->GetPlot()->SetXMinMax(XYRangeValues[qDefs::XMINIMUM],XYRangeValues[qDefs::XMAXIMUM]); + cloneplot2D->GetPlot()->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]); + } } diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 158e09cb8..7f3ecaf6d 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -278,8 +278,7 @@ void qDetectorMain::Initialization(){ //This should not be called as it will change file name to measurement when run finished //connect(myPlot, SIGNAL(UpdatingPlotFinished()), tab_plot, SLOT(Refresh())); connect(myPlot, SIGNAL(SetCurrentMeasurementSignal(int)), tab_measurement, SLOT(SetCurrentMeasurement(int))); - //to update all ranges when a clone has been made - connect(myPlot, SIGNAL(UpdateAfterCloningSignal()), tab_plot,SLOT(UpdateAfterCloning())); + // menubar // Modes Menu @@ -397,7 +396,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities"); fName = QFileDialog::getOpenFileName(this, tr("Load Detector Setup"),fName, - tr("Detector Setup files (*.det)")); + tr("Detector Setup files (*.det);;All Files(*)")); // Gets called when cancelled as well if (!fName.isEmpty()){ if(myDet->retrieveDetectorSetup(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL){ @@ -415,7 +414,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities"); fName = QFileDialog::getSaveFileName(this, tr("Save Current Detector Setup"),fName, - tr("Detector Setup files (*.det) ")); + tr("Detector Setup files (*.det);;All Files(*) ")); // Gets called when cancelled as well if (!fName.isEmpty()){ if(myDet->dumpDetectorSetup(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL) @@ -432,7 +431,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities"); fName = QFileDialog::getOpenFileName(this, tr("Load Detector Configuration"),fName, - tr("Configuration files (*.config)")); + tr("Configuration files (*.config);;All Files(*)")); // Gets called when cancelled as well if (!fName.isEmpty()){ if(myDet->readConfigurationFile(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL){ @@ -450,7 +449,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities"); fName = QFileDialog::getSaveFileName(this, tr("Save Current Detector Configuration"),fName, - tr("Configuration files (*.config) ")); + tr("Configuration files (*.config) ;;All Files(*)")); // Gets called when cancelled as well if (!fName.isEmpty()){ if(myDet->writeConfigurationFile(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL) @@ -469,7 +468,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ #endif fName = QFileDialog::getOpenFileName(this, tr("Load Detector Settings"),fName, - tr("Settings files (*.settings settings.sn*)")); + tr("Settings files (*.settings settings.sn*);;All Files(*)")); // Gets called when cancelled as well if (!fName.isEmpty()){ if(myDet->loadSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) @@ -483,10 +482,14 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ #ifdef VERBOSE cout << "Loading Trimbits" << endl; #endif - - fName = QFileDialog::getOpenFileName(this, + //so that even nonexisting files can be selected + QFileDialog *fileDialog = new QFileDialog(this, tr("Load Detector Trimbits"),fName, - tr("Trimbit files (*.trim noise.sn*)")); + tr("Trimbit files (*.trim noise.sn*);;All Files(*)")); + fileDialog->setFileMode(QFileDialog::AnyFile ); + if ( fileDialog->exec() == QDialog::Accepted ) + fName = fileDialog->selectedFiles()[0]; + // Gets called when cancelled as well if (!fName.isEmpty()){ if(myDet->loadSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) @@ -507,7 +510,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities"); fName = QFileDialog::getSaveFileName(this, tr("Save Current Detector Settings"),fName, - tr("Settings files (*.settings settings.sn*) ")); + tr("Settings files (*.settings settings.sn*);;All Files(*) ")); // Gets called when cancelled as well if (!fName.isEmpty()){ if(myDet->saveSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) @@ -524,7 +527,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities"); fName = QFileDialog::getSaveFileName(this, tr("Save Current Detector Trimbits"),fName, - tr("Trimbit files (*.trim noise.sn*) ")); + tr("Trimbit files (*.trim noise.sn*) ;;All Files(*)")); // Gets called when cancelled as well if (!fName.isEmpty()){ if(myDet->saveSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) @@ -540,9 +543,15 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ #endif QString fName = QString(myDet->getCalDir()); qDefs::checkErrorMessage(myDet); - fName = QFileDialog::getOpenFileName(this, + + //so that even nonexisting files can be selected + QFileDialog *fileDialog = new QFileDialog(this, tr("Load Detector Calibration Data"),fName, - tr("Calibration files (*.cal calibration.sn*)")); + tr("Calibration files (*.cal calibration.sn*);;All Files(*)")); + fileDialog->setFileMode(QFileDialog::AnyFile ); + if ( fileDialog->exec() == QDialog::Accepted ) + fName = fileDialog->selectedFiles()[0]; + // Gets called when cancelled as well if (!fName.isEmpty()){ if(myDet->loadCalibrationFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) @@ -559,7 +568,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ qDefs::checkErrorMessage(myDet); fName = QFileDialog::getSaveFileName(this, tr("Save Current Detector Calibration Data"),fName, - tr("Calibration files (*.cal calibration.sn*) ")); + tr("Calibration files (*.cal calibration.sn*);;All Files(*) ")); // Gets called when cancelled as well if (!fName.isEmpty()){ if(myDet->saveCalibrationFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index c9b335eb2..28ab07d52 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -1413,21 +1413,23 @@ void qDrawPlot::StopUpdatePlot(){ void qDrawPlot::ClonePlot(){ - int i=0; + int i; + + //check for space for more clone widget references bool found = false; for(i=0;ititle(),(int)plot_in_scope,plot1D,plot2D,sFilePath, - displayStatistics,lblMinDisp->text(),lblMaxDisp->text(),lblSumDisp->text()); + // create clone & copy data if(plot_in_scope==1){ - plot1D = new SlsQt1DPlot(boxPlot); - plot1D->setFont(QFont("Sans Serif",9,QFont::Normal)); - plot1D->SetXTitle(histXAxisTitle.toAscii().constData()); - plot1D->SetYTitle(histYAxisTitle.toAscii().constData()); - plotLayout->addWidget(plot1D,0,0,1,1); - plotLayout->setContentsMargins(10,10,10,10); - if(running){ - // update range - bool found =false; - for(int index=0;index<4;index++) - if(IsXYRange[index]){ - found=true; - break; - } - if(found) winClone[i]->SetRange(IsXYRange,XYRangeValues); - //copy data - //LockLastImageArray(); - if(!anglePlot) - winClone[i]->SetCloneHists((int)nHists,histNBins,histXAxis,histYAxis,histTitle,lines,markers); - else - winClone[i]->SetCloneHists((int)nHists,histNBins,histXAngleAxis,histYAngleAxis,histTitle,lines,markers); - //UnlockLastImageArray(); - } - } - else{ + winClone[i] = new qCloneWidget(this,i,boxPlot->title(),histXAxisTitle,histYAxisTitle,"", + (int)plot_in_scope,sFilePath,displayStatistics,lblMinDisp->text(),lblMaxDisp->text(),lblSumDisp->text()); + if(!anglePlot) + winClone[i]->SetCloneHists((int)nHists,histNBins,histXAxis,histYAxis,histTitle,lines,markers); + else + winClone[i]->SetCloneHists((int)nHists,histNBins,histXAngleAxis,histYAngleAxis,histTitle,lines,markers); - plot2D = new SlsQt2DPlotLayout(boxPlot); - plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,startPixel,endPixel,lastImageArray); - plot2D->setFont(QFont("Sans Serif",9,QFont::Normal)); - plot2D->setTitle(GetImageTitle()); - plot2D->SetXTitle(imageXAxisTitle); - plot2D->SetYTitle(imageYAxisTitle); - plot2D->SetZTitle(imageZAxisTitle); - plotLayout->addWidget(plot2D,0,0,1,1); - plotLayout->setContentsMargins(0,0,0,0); + }else{ + winClone[i] = new qCloneWidget(this,i,boxPlot->title(),imageXAxisTitle, imageYAxisTitle, imageZAxisTitle, + (int)plot_in_scope,sFilePath,displayStatistics,lblMinDisp->text(),lblMaxDisp->text(),lblSumDisp->text()); + winClone[i]->SetCloneHists2D(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,startPixel,endPixel,lastImageArray); } + // update range + found =false; + for(int index=0;index<4;index++) + if(IsXYRange[index]){ + found=true; + break; + } + if(found) + winClone[i]->SetRange(IsXYRange,XYRangeValues); + + UnlockLastImageArray(); - - setMinimumHeight(preheight); - resize(width(),preheight); - - // update the actual plot only if running, else it doesnt know when its over - if(running) UpdatePlot(); - connect(this, SIGNAL(InterpolateSignal(bool)), plot2D, SIGNAL(InterpolateSignal(bool))); - connect(this, SIGNAL(ContourSignal(bool)), plot2D, SIGNAL(ContourSignal(bool))); - connect(this, SIGNAL(LogzSignal(bool)), plot2D, SLOT(SetZScaleToLog(bool))); - connect(this, SIGNAL(LogySignal(bool)), plot1D, SLOT(SetLogY(bool))); - connect(this, SIGNAL(ResetZMinZMaxSignal(bool,bool,double,double)),plot2D, SLOT(ResetZMinZMax(bool,bool,double,double))); - connect(this, SIGNAL(SetZRangeSignal(double,double)), plot2D, SLOT(SetZRange(double,double))); - - //update ranges on current plot - emit UpdateAfterCloningSignal(); - winClone[i]->show(); // to remember which all clone widgets were closed diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp index 8d85327a8..9d9518d1b 100644 --- a/slsDetectorGui/src/qTabAdvanced.cpp +++ b/slsDetectorGui/src/qTabAdvanced.cpp @@ -368,9 +368,13 @@ void qTabAdvanced::BrowseOutputFile(){ #endif QString fName = dispFile->text(); //dialog - fName = QFileDialog::getSaveFileName(this, - tr("Choose file to write the trimbits to"),fName, - tr("Trimbit files (*.trim noise.sn*) ")); + QFileDialog *fileDialog = new QFileDialog(this, + tr("Save Trimbits"),fName, + tr("Trimbit files (*.trim noise.sn*);;All Files(*) ")); + fileDialog->setFileMode(QFileDialog::AnyFile ); + if ( fileDialog->exec() == QDialog::Accepted ) + fName = fileDialog->selectedFiles()[0]; + //if empty, set the file name and it calls SetFileSteps, else ignore if (!fName.isEmpty()){ dispFile->setText(fName); diff --git a/slsDetectorGui/src/qTabMessages.cpp b/slsDetectorGui/src/qTabMessages.cpp index 9287cacf2..4c9a65850 100644 --- a/slsDetectorGui/src/qTabMessages.cpp +++ b/slsDetectorGui/src/qTabMessages.cpp @@ -94,7 +94,7 @@ void qTabMessages::SaveLog() { QString fName = QString(myMainTab->GetFilePath()); fName = fName+"/LogFile.txt"; fName = QFileDialog::getSaveFileName(this,tr("Save Snapshot "), - fName,tr("Text files (*.txt)")); + fName,tr("Text files (*.txt);;All Files(*)")); if (!fName.isEmpty()){ QFile outfile; outfile.setFileName(fName); diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index 2498be00b..4eb9ce8e8 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -962,32 +962,6 @@ void qTabPlot::Refresh(){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void qTabPlot::UpdateAfterCloning(){ -#ifdef VERBOSE - cout << endl << "**Updating Plot After Cloning" << endl; -#endif - EnableRange(); - EnableTitles(); - myPlot->UpdateAfterCloning( - chkPoints->isChecked(), - chk1DLog->isChecked(), - chkInterpolate->isChecked(), - chkContour->isChecked(), - chkLogz->isChecked()); - - //1d - if(isOneD) - EnablePersistency(chkSuperimpose->isChecked()); - //2d - else - EnableZRange(); - -} - - -//------------------------------------------------------------------------------------------------------------------------------------------------- - - void qTabPlot::SetBinary(){ //1d if(isOneD){ From f768886308a0c0a052c7fb11373d7e3d42e38c95 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 7 Feb 2014 12:33:07 +0000 Subject: [PATCH 258/332] tried to reduce the time to refresh measurement and settings tab git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@258 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qDetectorMain.cpp | 2 +- slsDetectorGui/src/qTabMeasurement.cpp | 71 +++++++++++--------------- slsDetectorGui/src/qTabSettings.cpp | 14 +++-- 3 files changed, 43 insertions(+), 44 deletions(-) diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 7f3ecaf6d..b8c1f7568 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -741,7 +741,7 @@ void qDetectorMain::EnableTabs(){ //moved to here, so that its all in order, instead of signals and different threads if(!enable) { //refresh all the required tabs - tab_actions->Refresh(); + tab_actions->Refresh();// angular, positions, tab_measurement->Refresh(); tab_settings->Refresh(); diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 48cf18506..0fe4fb36d 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -772,6 +772,21 @@ void qTabMeasurement::Refresh(){ #endif if(!myPlot->isRunning()){ + //to prevent it from recalculating forever + disconnect(spinNumMeasurements, SIGNAL(valueChanged(int)), this, SLOT(setNumMeasurements(int))); + disconnect(dispFileName, SIGNAL(editingFinished()), this, SLOT(setFileName())); + disconnect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int))); + disconnect(progressTimer, SIGNAL(timeout()), this, SLOT(UpdateProgress())); + disconnect(chkFile, SIGNAL(toggled(bool)), this, SLOT(EnableFileWrite(bool))); + disconnect(spinNumFrames, SIGNAL(valueChanged(int)), this, SLOT(setNumFrames(int))); + disconnect(spinExpTime, SIGNAL(valueChanged(double)), this, SLOT(setExposureTime())); + disconnect(comboExpUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(setExposureTime())); + disconnect(spinPeriod, SIGNAL(valueChanged(double)), this, SLOT(setAcquisitionPeriod())); + disconnect(comboPeriodUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(setAcquisitionPeriod())); + disconnect(spinNumTriggers, SIGNAL(valueChanged(int)), this, SLOT(setNumTriggers(int))); + disconnect(spinDelay, SIGNAL(valueChanged(double)), this, SLOT(setDelay())); + disconnect(comboDelayUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(setDelay())); + disconnect(spinNumGates, SIGNAL(valueChanged(int)), this, SLOT(setNumGates(int))); //Number of measurements spinNumMeasurements->setValue((int)myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,-1)); @@ -784,13 +799,7 @@ void qTabMeasurement::Refresh(){ #ifdef VERBOSE cout << "Getting number of frames" << endl; #endif - //to prevent it from recalculating forever - disconnect(spinExpTime,SIGNAL(valueChanged(double)), this, SLOT(setExposureTime())); - disconnect(comboExpUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setExposureTime())); - disconnect(spinPeriod,SIGNAL(valueChanged(double)), this, SLOT(setAcquisitionPeriod())); - disconnect(comboPeriodUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setAcquisitionPeriod())); - disconnect(spinDelay,SIGNAL(valueChanged(double)), this, SLOT(setDelay())); - disconnect(comboDelayUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setDelay())); + //Exp Time qDefs::timeUnit unit; double time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-9)))); @@ -806,22 +815,6 @@ void qTabMeasurement::Refresh(){ #ifdef VERBOSE cout << "Getting Acquisition Period" << endl; #endif - double acqtimeNS = qDefs::getNSTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value()); - double exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value()); - if(exptimeNS>acqtimeNS){ - spinPeriod->setToolTip(errPeriodTip); - lblPeriod->setToolTip(errPeriodTip); - lblPeriod->setPalette(red); - lblPeriod->setText("Acquisition Period:*"); - } - else { - spinPeriod->setToolTip(acqPeriodTip); - lblPeriod->setToolTip(acqPeriodTip); - lblPeriod->setPalette(lblTimingMode->palette()); - lblPeriod->setText("Acquisition Period:"); - } - //Check if the interval between plots is ok - emit CheckPlotIntervalSignal(); //delay time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::DELAY_AFTER_TRIGGER,-1)*(1E-9)))); spinDelay->setValue(time); @@ -829,13 +822,6 @@ void qTabMeasurement::Refresh(){ #ifdef VERBOSE cout << "Getting delay after trigger" << endl; #endif - connect(spinExpTime,SIGNAL(valueChanged(double)), this, SLOT(setExposureTime())); - connect(comboExpUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setExposureTime())); - connect(spinPeriod,SIGNAL(valueChanged(double)), this, SLOT(setAcquisitionPeriod())); - connect(comboPeriodUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setAcquisitionPeriod())); - connect(spinDelay,SIGNAL(valueChanged(double)), this, SLOT(setDelay())); - connect(comboDelayUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setDelay())); - //Number of Triggers spinNumTriggers->setValue((int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1)); @@ -849,13 +835,6 @@ void qTabMeasurement::Refresh(){ cout << "Getting number of gates" << endl; #endif - //probes - if(myDet->getDetectorsType() == slsDetectorDefs::MYTHEN){ - spinNumProbes->setValue((int)myDet->setTimer(slsDetectorDefs::PROBES_NUMBER,-1)); -#ifdef VERBOSE - cout << "Getting number of probes" << endl; -#endif - } //File Name dispFileName->setText(QString(myDet->getFileName().c_str())); #ifdef VERBOSE @@ -880,6 +859,21 @@ void qTabMeasurement::Refresh(){ else lblProgressIndex->setText(QString::number(myDet->getFrameIndex())); + connect(spinNumMeasurements,SIGNAL(valueChanged(int)), this, SLOT(setNumMeasurements(int))); + connect(dispFileName, SIGNAL(editingFinished()), this, SLOT(setFileName())); + connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int))); + connect(progressTimer, SIGNAL(timeout()), this, SLOT(UpdateProgress())); + connect(chkFile, SIGNAL(toggled(bool)), this, SLOT(EnableFileWrite(bool))); + connect(spinNumFrames, SIGNAL(valueChanged(int)), this, SLOT(setNumFrames(int))); + connect(spinExpTime, SIGNAL(valueChanged(double)), this, SLOT(setExposureTime())); + connect(comboExpUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(setExposureTime())); + connect(spinPeriod, SIGNAL(valueChanged(double)), this, SLOT(setAcquisitionPeriod())); + connect(comboPeriodUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(setAcquisitionPeriod())); + connect(spinNumTriggers, SIGNAL(valueChanged(int)), this, SLOT(setNumTriggers(int))); + connect(spinDelay, SIGNAL(valueChanged(double)), this, SLOT(setDelay())); + connect(comboDelayUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(setDelay())); + connect(spinNumGates, SIGNAL(valueChanged(int)), this, SLOT(setNumGates(int))); + //Timing mode - will also check if exptime>acq period and also enableprobes() SetupTimingMode(); @@ -900,9 +894,6 @@ void qTabMeasurement::Refresh(){ void qTabMeasurement::EnableProbes(){ -#ifdef VERBOSE - cout << "Validating if probes should be enabled" << endl; -#endif //enabled only in expert mode and if #Frames > 1 if((expertMode)&&(myDet->getDetectorsType()==slsDetectorDefs::MYTHEN)&&(spinNumFrames->value()>1)){ lblNumProbes->setEnabled(true); diff --git a/slsDetectorGui/src/qTabSettings.cpp b/slsDetectorGui/src/qTabSettings.cpp index 31e447911..b78e6b2cb 100644 --- a/slsDetectorGui/src/qTabSettings.cpp +++ b/slsDetectorGui/src/qTabSettings.cpp @@ -261,6 +261,11 @@ void qTabSettings::Refresh(){ cout << endl << "**Updating Settings Tab" << endl; #endif + disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int))); + disconnect(spinNumModules, SIGNAL(valueChanged(int)), this, SLOT(SetNumberOfModules(int))); + disconnect(comboDynamicRange, SIGNAL(activated(int)), this, SLOT(SetDynamicRange(int))); + disconnect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy())); + // Number of Modules #ifdef VERBOSE @@ -290,11 +295,9 @@ void qTabSettings::Refresh(){ #ifdef VERBOSE cout << "Getting settings" << endl; #endif - disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int))); int sett = (int)myDet->getSettings(); if(sett==-1) sett = slsDetectorDefs::UNDEFINED; comboSettings->setCurrentIndex(sett); - connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int))); //threshold @@ -309,11 +312,16 @@ void qTabSettings::Refresh(){ #ifdef VERBOSE cout << "Getting threshold energy" << endl; #endif - SetEnergy(); + spinThreshold->setValue(myDet->getThresholdEnergy()); } } + connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int))); + connect(spinNumModules, SIGNAL(valueChanged(int)), this, SLOT(SetNumberOfModules(int))); + connect(comboDynamicRange, SIGNAL(activated(int)), this, SLOT(SetDynamicRange(int))); + connect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy())); + #ifdef VERBOSE cout << "**Updated Settings Tab" << endl << endl; #endif From 7ebd1643ee1fe0aa407c88b87fa55c5dba4b122e Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Mon, 10 Feb 2014 16:20:17 +0000 Subject: [PATCH 259/332] made measurement tab faster, not too many checks anymore git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@259 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qTabMeasurement.h | 14 +- slsDetectorGui/src/qTabAdvanced.cpp | 14 +- slsDetectorGui/src/qTabMeasurement.cpp | 326 +++++++++++------------ 3 files changed, 182 insertions(+), 172 deletions(-) diff --git a/slsDetectorGui/include/qTabMeasurement.h b/slsDetectorGui/include/qTabMeasurement.h index 309d9c25d..4e9b42e60 100644 --- a/slsDetectorGui/include/qTabMeasurement.h +++ b/slsDetectorGui/include/qTabMeasurement.h @@ -15,6 +15,7 @@ /** Project Class Headers */ class multiSlsDetector; /** Qt Project Class Headers */ +#include #include "qDrawPlot.h" class qDetectorMain; @@ -97,6 +98,14 @@ private: /** Validates before enabling or disabling probes */ void EnableProbes(); + /** Get timing mode from detector + * @param startup is true when gui has just started up*/ + void GetModeFromDetector(bool startup = false); + + /** Checks if acquisition period is greater than exposure time + * and dsplays in red as a warning */ + void CheckAcqPeriodGreaterThanExp(); + private slots: /** Sets the timing mode @@ -168,6 +177,8 @@ private: multiSlsDetector *myDet; /** The Plot widget */ qDrawPlot *myPlot; + /** detector type */ + slsDetectorDefs::detectorType detType; /** enum for the timing mode */ enum{None, Auto, Trigger_Exp_Series, Trigger_Frame, Trigger_Readout, Gated, Gated_Start, Trigger_Window, NumTimingModes}; /** timer to update the progress*/ @@ -180,7 +191,8 @@ private: bool expertMode; QIcon *iconStart; QIcon *iconStop; - + /** to access items in settings combobox */ + QStandardItemModel* model; signals: void StartSignal(); diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp index 9d9518d1b..3ce79318e 100644 --- a/slsDetectorGui/src/qTabAdvanced.cpp +++ b/slsDetectorGui/src/qTabAdvanced.cpp @@ -1142,9 +1142,14 @@ void qTabAdvanced::Refresh(){ qDefs::checkErrorMessage(myDet,"qTabAdvanced::Refresh"); + + +#ifdef VERBOSE + cout << "Getting Detector Ports" << endl; +#endif //disconnect disconnect(spinControlPort, SIGNAL(valueChanged(int)), this, SLOT(SetControlPort(int))); - disconnect(spinStopPort, SIGNAL(valueChanged(int)), this, SLOT(SetStopPort(int))); + disconnect(spinStopPort, SIGNAL(valueChanged(int)), this, SLOT(SetStopPort(int))); disconnect(comboOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetOnline(int))); //so that updated status @@ -1160,7 +1165,9 @@ void qTabAdvanced::Refresh(){ connect(comboOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetOnline(int))); - +#ifdef VERBOSE + cout << "Getting Receiver Network Information" << endl; +#endif if ((detType==slsDetectorDefs::GOTTHARD) || (detType==slsDetectorDefs::MOENCH)){ //disconnect disconnect(spinTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int))); @@ -1226,6 +1233,9 @@ void qTabAdvanced::Refresh(){ } //roi +#ifdef VERBOSE + cout << "Getting ROI" << endl; +#endif updateROIList(); diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 0fe4fb36d..50d90b766 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -11,8 +11,6 @@ //Project Class Headers #include "slsDetector.h" #include "multiSlsDetector.h" -//Qt Include Headers -#include //C++ Include Headers #include using namespace std; @@ -47,6 +45,9 @@ qTabMeasurement::~qTabMeasurement(){ void qTabMeasurement::SetupWidgetWindow(){ + + detType = myDet->getDetectorsType(); + //Number of measurements spinNumMeasurements->setValue((int)myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,-1)); //Number of frames @@ -69,7 +70,7 @@ void qTabMeasurement::SetupWidgetWindow(){ //gates spinNumGates->setValue((int)myDet->setTimer(slsDetectorDefs::GATES_NUMBER,-1)); //probes - if(myDet->getDetectorsType() == slsDetectorDefs::MYTHEN) + if(detType == slsDetectorDefs::MYTHEN) spinNumProbes->setValue((int)myDet->setTimer(slsDetectorDefs::PROBES_NUMBER,-1)); //File Name dispFileName->setText(QString(myDet->getFileName().c_str())); @@ -120,11 +121,8 @@ void qTabMeasurement::SetExpertMode(bool enable){ void qTabMeasurement::SetupTimingMode(){ - //Get timing mode from detector - slsDetectorDefs::externalCommunicationMode mode = myDet->setExternalCommunicationMode(); - //To be able to index items on a combo box - QStandardItemModel* model = qobject_cast(comboTimingMode->model()); + model = qobject_cast(comboTimingMode->model()); QModelIndex index[NumTimingModes]; QStandardItem* item[NumTimingModes]; if (model) { @@ -133,7 +131,7 @@ void qTabMeasurement::SetupTimingMode(){ item[i] = model->itemFromIndex(index[i]); } //Enabling/Disabling depending on the detector type - switch(myDet->getDetectorsType()){ + switch(detType){ case slsDetectorDefs::MYTHEN: item[(int)Trigger_Exp_Series]->setEnabled(true); item[(int)Trigger_Frame]->setEnabled(false); @@ -164,56 +162,93 @@ void qTabMeasurement::SetupTimingMode(){ exit(-1); break; } - //Setting the timing mode - if(item[mode]->isEnabled()){ - //if the timing mode is Auto and - // number of Frames and number of triggers is 1, - // then the timing mode is 'None'. - // This is for the inexperienced user - if(mode==slsDetectorDefs::AUTO_TIMING){ - int frames = spinNumFrames->value(); - int triggers = spinNumTriggers->value(); - if((frames==1)&&(triggers==1)){ - comboTimingMode->setCurrentIndex((int)None); - SetTimingMode((int)None); - }else{ - comboTimingMode->setCurrentIndex((int)Auto); - SetTimingMode((int)Auto); - } - }else{ - //mode +1 since the detector class has no timingmode as "None" - comboTimingMode->setCurrentIndex((int)mode+1); - SetTimingMode((int)mode+1); + } + + GetModeFromDetector(true); +} + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabMeasurement::GetModeFromDetector(bool startup){ +#ifdef VERBOSE + cout << "Getting timing mode" << endl; +#endif + //Get timing mode from detector + slsDetectorDefs::externalCommunicationMode mode = myDet->setExternalCommunicationMode(); + + //Setting the timing mode in gui + if(model && model->itemFromIndex(model->index(mode,comboTimingMode->modelColumn(), comboTimingMode->rootModelIndex()))->isEnabled()){ + + //these are things checked in setuptimingmode + + // to let qdrawplot know that triggers or frames are used + myPlot->setFrameEnabled(lblNumFrames->isEnabled()); + myPlot->setTriggerEnabled(lblNumTriggers->isEnabled()); + if((!startup) && (comboTimingMode->currentIndex() == mode)){ + if(lblPeriod->isEnabled()) + CheckAcqPeriodGreaterThanExp(); + else{ + spinPeriod->setToolTip(acqPeriodTip); + lblPeriod->setToolTip(acqPeriodTip); + lblPeriod->setPalette(lblTimingMode->palette()); + lblPeriod->setText("Acquisition Period:"); } + EnableProbes(); + emit CheckPlotIntervalSignal(); + return; } - // Mode NOT ENABLED. - // This should not happen -only if the server and gui has a mismatch - // on which all modes are allowed in detectors - else{ - //check if the detector is not even connected - string offline = myDet->checkOnline(); - qDefs::checkErrorMessage(myDet,"qTabMeasurement::SetupTimingMode"); - if(!offline.empty()){ - qDefs::Message(qDefs::CRITICAL,string("The detector(s) ")+offline+string(" is/are not connected. Exiting GUI."),"Main"); - cout << "The detector(s) " << offline << " is/are not connected. Exiting GUI." << endl; - exit(-1); + //if the timing mode is Auto and + // number of Frames and number of triggers is 1, + // then the timing mode is 'None'. + // This is for the inexperienced user + if(mode==slsDetectorDefs::AUTO_TIMING){ + int frames = spinNumFrames->value(); + int triggers = spinNumTriggers->value(); + if((frames==1)&&(triggers==1)){ + comboTimingMode->setCurrentIndex((int)None); + SetTimingMode((int)None); + }else{ + comboTimingMode->setCurrentIndex((int)Auto); + SetTimingMode((int)Auto); } - - qDefs::Message(qDefs::WARNING,"Unknown Timing Mode detected from detector." - "\n\nSetting the following defaults:\nTiming Mode \t: None\n" - "Number of Frames \t: 1\nNumber of Triggers \t: 1","qTabMeasurement::SetupTimingMode"); - comboTimingMode->setCurrentIndex((int)None); - SetTimingMode((int)None); + }else{ + //mode +1 since the detector class has no timingmode as "None" + comboTimingMode->setCurrentIndex((int)mode+1); + SetTimingMode((int)mode+1); } } - qDefs::checkErrorMessage(myDet,"qTabMeasurement::SetupTimingMode"); + // Mode NOT ENABLED. + // This should not happen -only if the server and gui has a mismatch + // on which all modes are allowed in detectors + else{ + //check if the detector is not even connected + string offline = myDet->checkOnline(); + qDefs::checkErrorMessage(myDet,"qTabMeasurement::GetModeFromDetector"); + + if(!offline.empty()){ + qDefs::Message(qDefs::CRITICAL,string("The detector(s) ")+offline+string(" is/are not connected. Exiting GUI."),"Main"); + cout << "The detector(s) " << offline << " is/are not connected. Exiting GUI." << endl; + exit(-1); + } + + qDefs::Message(qDefs::WARNING,"Unknown Timing Mode detected from detector." + "\n\nSetting the following defaults:\nTiming Mode \t: None\n" + "Number of Frames \t: 1\nNumber of Triggers \t: 1","qTabMeasurement::GetModeFromDetector"); + comboTimingMode->setCurrentIndex((int)None); + SetTimingMode((int)None); + } + + qDefs::checkErrorMessage(myDet,"qTabMeasurement::GetModeFromDetector"); + } //------------------------------------------------------------------------------------------------------------------------------------------------- + void qTabMeasurement::Initialization(){ //Number of Measurements connect(spinNumMeasurements,SIGNAL(valueChanged(int)), this, SLOT(setNumMeasurements(int))); @@ -431,6 +466,27 @@ void qTabMeasurement::setNumFrames(int val){ //------------------------------------------------------------------------------------------------------------------------------------------------- +void qTabMeasurement::CheckAcqPeriodGreaterThanExp(){ + double exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value()); + double acqtimeNS = qDefs::getNSTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value()); + if(exptimeNS>acqtimeNS) { + spinPeriod->setToolTip(errPeriodTip); + lblPeriod->setToolTip(errPeriodTip); + lblPeriod->setPalette(red); + lblPeriod->setText("Acquisition Period:*"); + } + else { + spinPeriod->setToolTip(acqPeriodTip); + lblPeriod->setToolTip(acqPeriodTip); + lblPeriod->setPalette(lblTimingMode->palette()); + lblPeriod->setText("Acquisition Period:"); + } +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + void qTabMeasurement::setExposureTime(){ //Get the value of timer in ns double exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value()); @@ -438,36 +494,10 @@ void qTabMeasurement::setExposureTime(){ cout << "Setting acquisition time to " << exptimeNS << " clocks" << "/" << spinExpTime->value() << qDefs::getUnitString((qDefs::timeUnit)comboExpUnit->currentIndex()) << endl; #endif myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,(int64_t)exptimeNS); - /* - //updating value set - disconnect(spinExpTime,SIGNAL(valueChanged(double)), this, SLOT(setExposureTime())); - disconnect(comboExpUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setExposureTime())); - qDefs::timeUnit unit; - double time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-9)))); - spinExpTime->setValue(time); - comboExpUnit->setCurrentIndex((int)unit); - connect(spinExpTime,SIGNAL(valueChanged(double)), this, SLOT(setExposureTime())); - connect(comboExpUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setExposureTime())); -*/ - //could be different if it didnt work - exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value()); - - if(lblPeriod->isEnabled()){ - double acqtimeNS = qDefs::getNSTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value()); - if(exptimeNS>acqtimeNS) { - spinPeriod->setToolTip(errPeriodTip); - lblPeriod->setToolTip(errPeriodTip); - lblPeriod->setPalette(red); - lblPeriod->setText("Acquisition Period:*"); - } - else { - spinPeriod->setToolTip(acqPeriodTip); - lblPeriod->setToolTip(acqPeriodTip); - lblPeriod->setPalette(lblTimingMode->palette()); - lblPeriod->setText("Acquisition Period:"); - } - } qDefs::checkErrorMessage(myDet,"qTabMeasurement::setExposureTime"); + + if(lblPeriod->isEnabled()) + CheckAcqPeriodGreaterThanExp(); } @@ -481,35 +511,9 @@ void qTabMeasurement::setAcquisitionPeriod(){ cout << "Setting frame period between exposures to " << acqtimeNS << " clocks"<< "/" << spinPeriod->value() << qDefs::getUnitString((qDefs::timeUnit)comboPeriodUnit->currentIndex()) << endl; #endif myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,(int64_t)acqtimeNS); -/* - //updating value set - disconnect(spinPeriod,SIGNAL(valueChanged(double)), this, SLOT(setAcquisitionPeriod())); - disconnect(comboPeriodUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setAcquisitionPeriod())); - qDefs::timeUnit unit; - double time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,-1)*(1E-9)))); - spinPeriod->setValue(time); - comboPeriodUnit->setCurrentIndex((int)unit); - connect(spinPeriod,SIGNAL(valueChanged(double)), this, SLOT(setAcquisitionPeriod())); - connect(comboPeriodUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setAcquisitionPeriod())); -*/ - //could be different if it didnt work - acqtimeNS = qDefs::getNSTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value()); - - double exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value()); - if(exptimeNS>acqtimeNS){ - spinPeriod->setToolTip(errPeriodTip); - lblPeriod->setToolTip(errPeriodTip); - lblPeriod->setPalette(red); - lblPeriod->setText("Acquisition Period:*"); - } - else { - spinPeriod->setToolTip(acqPeriodTip); - lblPeriod->setToolTip(acqPeriodTip); - lblPeriod->setPalette(lblTimingMode->palette()); - lblPeriod->setText("Acquisition Period:"); - } - qDefs::checkErrorMessage(myDet,"qTabMeasurement::setAcquisitionPeriod"); + + CheckAcqPeriodGreaterThanExp(); //Check if the interval between plots is ok emit CheckPlotIntervalSignal(); } @@ -582,22 +586,28 @@ void qTabMeasurement::setNumProbes(int val){ #ifdef VERBOSE cout << "Setting number of probes to " << val << endl; #endif - myDet->setTimer(slsDetectorDefs::PROBES_NUMBER,val); - + disconnect(spinNumTriggers,SIGNAL(valueChanged(int)), this, SLOT(setNumTriggers(int))); disconnect(spinNumProbes,SIGNAL(valueChanged(int)), this, SLOT(setNumProbes(int))); - spinNumProbes->setValue((int)myDet->setTimer(slsDetectorDefs::PROBES_NUMBER,-1)); - connect(spinNumProbes,SIGNAL(valueChanged(int)), this, SLOT(setNumProbes(int))); + //set probes + int ret = myDet->setTimer(slsDetectorDefs::PROBES_NUMBER,val); + if(ret != val) + ret = myDet->setTimer(slsDetectorDefs::PROBES_NUMBER,-1); + spinNumProbes->setValue(ret); qDefs::checkErrorMessage(myDet,"qTabMeasurement::setNumProbes"); + //Setting number of probes should reset number of triggers to 1, need to check if enabled, cuz its updated when refresh - if((spinNumProbes->isEnabled()) && (val > 0) && (spinNumTriggers->value() != 1)){ + if((spinNumProbes->isEnabled()) && (ret > 0) && (spinNumTriggers->value() != 1)){ qDefs::Message(qDefs::INFORMATION,"Number of Triggers has been reset to 1.
" "This is mandatory to use probes.","qTabMeasurement::setNumProbes"); cout << "Resetting Number of triggers to 1" << endl; spinNumTriggers->setValue(1); } qDefs::checkErrorMessage(myDet,"qTabMeasurement::setNumProbes"); + + connect(spinNumTriggers,SIGNAL(valueChanged(int)), this, SLOT(setNumTriggers(int))); + connect(spinNumProbes,SIGNAL(valueChanged(int)), this, SLOT(setNumProbes(int))); } @@ -701,27 +711,10 @@ void qTabMeasurement::SetTimingMode(int mode){ //Frame Period between exposures - double exptimeNS,acqtimeNS; - double time; qDefs::timeUnit unit; - if(lblPeriod->isEnabled()){ - exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value()); - acqtimeNS = qDefs::getNSTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value()); - if(exptimeNS>acqtimeNS) { - - spinPeriod->setToolTip(errPeriodTip); - lblPeriod->setToolTip(errPeriodTip); - lblPeriod->setPalette(red); - lblPeriod->setText("Acquisition Period:*"); - } - else { - - spinPeriod->setToolTip(acqPeriodTip); - lblPeriod->setToolTip(acqPeriodTip); - lblPeriod->setPalette(lblTimingMode->palette()); - lblPeriod->setText("Acquisition Period:"); - } - }else { + if(lblPeriod->isEnabled()) + CheckAcqPeriodGreaterThanExp(); + else{ spinPeriod->setToolTip(acqPeriodTip); lblPeriod->setToolTip(acqPeriodTip); lblPeriod->setPalette(lblTimingMode->palette()); @@ -788,70 +781,51 @@ void qTabMeasurement::Refresh(){ disconnect(comboDelayUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(setDelay())); disconnect(spinNumGates, SIGNAL(valueChanged(int)), this, SLOT(setNumGates(int))); +#ifdef VERBOSE + cout << "Getting number of measurements & frames" << endl; +#endif //Number of measurements spinNumMeasurements->setValue((int)myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,-1)); -#ifdef VERBOSE - cout << "Getting number of measurements" << endl; -#endif - //Number of frames spinNumFrames->setValue((int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1)); -#ifdef VERBOSE - cout << "Getting number of frames" << endl; -#endif + +#ifdef VERBOSE + cout << "Getting Exposure time and Acquisition Period" << endl; +#endif //Exp Time qDefs::timeUnit unit; double time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-9)))); spinExpTime->setValue(time); comboExpUnit->setCurrentIndex((int)unit); -#ifdef VERBOSE - cout << "Getting Exposure time" << endl; -#endif //period time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,-1)*(1E-9)))); spinPeriod->setValue(time); comboPeriodUnit->setCurrentIndex((int)unit); + + #ifdef VERBOSE - cout << "Getting Acquisition Period" << endl; + cout << "Getting delay after trigger, number of triggers and number of gates" << endl; #endif //delay time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::DELAY_AFTER_TRIGGER,-1)*(1E-9)))); spinDelay->setValue(time); comboDelayUnit->setCurrentIndex((int)unit); -#ifdef VERBOSE - cout << "Getting delay after trigger" << endl; -#endif - //Number of Triggers spinNumTriggers->setValue((int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1)); -#ifdef VERBOSE - cout << "Getting number of triggers" << endl; -#endif - //gates spinNumGates->setValue((int)myDet->setTimer(slsDetectorDefs::GATES_NUMBER,-1)); -#ifdef VERBOSE - cout << "Getting number of gates" << endl; -#endif + +#ifdef VERBOSE + cout << "Getting file name prefix, file index, file write enable and progress index" << endl; +#endif //File Name dispFileName->setText(QString(myDet->getFileName().c_str())); -#ifdef VERBOSE - cout << "Getting file name prefix" << endl; -#endif - //File Index spinIndex->setValue(myDet->getFileIndex()); -#ifdef VERBOSE - cout << "Getting file index" << endl; -#endif - //file write enabled/disabled chkFile->setChecked(myDet->enableWriteToFile()); -#ifdef VERBOSE - cout << "Getting file write enable" << endl; -#endif //progress label index if(myDet->getFrameIndex()==-1) @@ -874,8 +848,8 @@ void qTabMeasurement::Refresh(){ connect(comboDelayUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(setDelay())); connect(spinNumGates, SIGNAL(valueChanged(int)), this, SLOT(setNumGates(int))); - //Timing mode - will also check if exptime>acq period and also enableprobes() - SetupTimingMode(); + //timing mode - will also check if exptime>acq period and also enableprobes() + GetModeFromDetector(); // to let qdrawplot know that triggers or frames are used myPlot->setFrameEnabled(lblNumFrames->isEnabled()); @@ -894,27 +868,41 @@ void qTabMeasurement::Refresh(){ void qTabMeasurement::EnableProbes(){ + + disconnect(spinNumProbes,SIGNAL(valueChanged(int)), this, SLOT(setNumProbes(int))); + disconnect(spinNumTriggers,SIGNAL(valueChanged(int)), this, SLOT(setNumTriggers(int))); + + //enabled only in expert mode and if #Frames > 1 - if((expertMode)&&(myDet->getDetectorsType()==slsDetectorDefs::MYTHEN)&&(spinNumFrames->value()>1)){ + if((expertMode)&&(detType==slsDetectorDefs::MYTHEN)&&(spinNumFrames->value()>1)){ lblNumProbes->setEnabled(true); spinNumProbes->setEnabled(true); - disconnect(spinNumProbes,SIGNAL(valueChanged(int)), this, SLOT(setNumProbes(int))); spinNumProbes->setValue((int)myDet->setTimer(slsDetectorDefs::PROBES_NUMBER,-1)); - connect(spinNumProbes,SIGNAL(valueChanged(int)), this, SLOT(setNumProbes(int))); #ifdef VERBOSE cout << "Getting number of probes : " << spinNumProbes->value() << endl; #endif - //ensure that #triggers is reset - setNumProbes(spinNumProbes->value()); + //Setting number of probes should reset number of triggers to 1, need to check if enabled, cuz its updated when refresh + if((spinNumProbes->isEnabled()) && (spinNumProbes->value() > 0) && (spinNumTriggers->value() != 1)){ + qDefs::Message(qDefs::INFORMATION,"Number of Triggers has been reset to 1.
" + "This is mandatory to use probes.","qTabMeasurement::EnableProbes"); + cout << "Resetting Number of triggers to 1" << endl; + spinNumTriggers->setValue(1); + } qDefs::checkErrorMessage(myDet,"qTabMeasurement::EnableProbes"); + + connect(spinNumProbes, SIGNAL(valueChanged(int)), this, SLOT(setNumProbes(int))); + connect(spinNumTriggers, SIGNAL(valueChanged(int)), this, SLOT(setNumTriggers(int))); return; } cout << "Probes not enabled" << endl; - if(myDet->getDetectorsType()==slsDetectorDefs::MYTHEN) + if(detType==slsDetectorDefs::MYTHEN) spinNumProbes->setValue(0); lblNumProbes->setEnabled(false); spinNumProbes->setEnabled(false); + + connect(spinNumProbes,SIGNAL(valueChanged(int)), this, SLOT(setNumProbes(int))); + connect(spinNumTriggers,SIGNAL(valueChanged(int)), this, SLOT(setNumTriggers(int))); } From 69524e61f4d0dd72f3a13c262869cac9fc57a479 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Mon, 10 Feb 2014 17:01:34 +0000 Subject: [PATCH 260/332] does not refresh measurement tab upon clicking start git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@260 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qDetectorMain.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index b8c1f7568..c61237d84 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -742,7 +742,9 @@ void qDetectorMain::EnableTabs(){ if(!enable) { //refresh all the required tabs tab_actions->Refresh();// angular, positions, - tab_measurement->Refresh(); + + //too slow to refresh + /*tab_measurement->Refresh();*/ tab_settings->Refresh(); tab_dataoutput->Refresh(); @@ -791,17 +793,17 @@ int qDetectorMain::StartStopAcquisitionFromClient(bool start){ if (tab_measurement->GetStartStatus() != start){ if(start){ if(!myPlot->isRunning()){ - //refresh all the required tabs - tab_actions->Refresh(); - tab_measurement->Refresh(); - + //refresh all the required tabs - all these are done in button click anyway + /* tab_actions->Refresh(); + //too slow to refresh + //tab_measurement->Refresh(); tab_settings->Refresh(); tab_dataoutput->Refresh(); if(tab_advanced->isEnabled()) tab_advanced->Refresh(); if(tab_debugging->isEnabled()) tab_debugging->Refresh(); if(tab_developer->isEnabled()) tab_developer->Refresh(); - tab_plot->Refresh(); + tab_plot->Refresh();*/ } } //click start/stop From d0b12f41973b19281fc3a4dc3e15a6199fbcf142 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 12 Feb 2014 09:23:56 +0000 Subject: [PATCH 261/332] fixed a bug in measurement tab git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@261 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qDetectorMain.cpp | 1 - slsDetectorGui/src/qTabMeasurement.cpp | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index c61237d84..620e1952f 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -582,7 +582,6 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ if(refreshTabs){ tab_actions->Refresh(); tab_measurement->Refresh(); - tab_settings->Refresh(); tab_dataoutput->Refresh(); if(tab_advanced->isEnabled()) tab_advanced->Refresh(); diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 50d90b766..b4dae68f0 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -185,7 +185,7 @@ void qTabMeasurement::GetModeFromDetector(bool startup){ // to let qdrawplot know that triggers or frames are used myPlot->setFrameEnabled(lblNumFrames->isEnabled()); myPlot->setTriggerEnabled(lblNumTriggers->isEnabled()); - if((!startup) && (comboTimingMode->currentIndex() == mode)){ + if((!startup) && (comboTimingMode->currentIndex() == (mode+1))){ if(lblPeriod->isEnabled()) CheckAcqPeriodGreaterThanExp(); else{ From e7d22b1b393e3013f590d6449ef4f92541f220ea Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Thu, 27 Feb 2014 10:53:27 +0000 Subject: [PATCH 262/332] compression enabled in gui git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@262 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_dataoutput.ui | 212 +++++++++++--------- slsDetectorGui/include/qTabDataOutput.h | 12 ++ slsDetectorGui/src/qDetectorMain.cpp | 1 + slsDetectorGui/src/qTabDataOutput.cpp | 205 ++++++++++++------- 4 files changed, 254 insertions(+), 176 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_dataoutput.ui b/slsDetectorGui/forms/form_tab_dataoutput.ui index 50b838b2c..6e3dbd168 100644 --- a/slsDetectorGui/forms/form_tab_dataoutput.ui +++ b/slsDetectorGui/forms/form_tab_dataoutput.ui @@ -37,11 +37,11 @@ 20 160 731 - 166 + 171 - Correction + Options @@ -49,13 +49,23 @@ 15 25 701 - 126 + 141 3 + + + + false + + + Angular Conversion + + + @@ -63,7 +73,7 @@ #flatfield# filename
- Flat Field File: + Flat Field Correction File:
@@ -97,51 +107,6 @@
- - - - false - - - Rate Correction: - - - - - - - false - - - Auto - - - - - - - false - - - - 0 - 0 - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - ns - - - 6 - - - 2000000000.000000000000000 - - - @@ -158,21 +123,22 @@ - - - - Qt::Horizontal + + + + Discard Bad Channels - - QSizePolicy::Fixed + + + + + + false - - - 40 - 20 - + + Auto - +
@@ -190,38 +156,6 @@ - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 40 - 20 - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 40 - 20 - - - - @@ -256,20 +190,100 @@ - - + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + + + + + false + + + + 0 + 0 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + ns + + + 6 + + + 2000000000.000000000000000 + + + + + false - Angular Conversion + Rate Correction: - - + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + + + + + <nobr> +Compression using Root. Available only for Gotthard in Expert Mode. +</nobr><br><nobr> + #r_compression# +</nobr> + - Discard Bad Channels + Compression diff --git a/slsDetectorGui/include/qTabDataOutput.h b/slsDetectorGui/include/qTabDataOutput.h index 57aaaad88..86cfe431b 100644 --- a/slsDetectorGui/include/qTabDataOutput.h +++ b/slsDetectorGui/include/qTabDataOutput.h @@ -45,6 +45,11 @@ public: */ int VerifyOutputDirectory(); + /** To enable expert mode + * @param enable to enable if true + */ + void SetExpertMode(bool enable); + private: /** The sls detector object */ @@ -53,6 +58,7 @@ private: /** detector type */ slsDetectorDefs::detectorType detType; + QString flatFieldTip; QString errFlatFieldTip; QString outDirTip; @@ -72,6 +78,9 @@ private: */ void PopulateDetectors(); + /** Get Compression */ + void GetCompression(); + private slots: @@ -105,6 +114,9 @@ void SetOutputDir(); /** set output directory*/ void GetOutputDir(); +/** set compression */ +void SetCompression(bool enable); + signals: /**signal to enable/disable positions in Actions*/ void AngularConversionSignal(bool); diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 620e1952f..fcd191340 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -362,6 +362,7 @@ void qDetectorMain::EnableModes(QAction *action){ actionSaveCalibration->setVisible(enable); tab_measurement->SetExpertMode(enable); tab_settings->SetExpertMode(enable); + tab_dataoutput->SetExpertMode(enable); #ifdef VERBOSE cout << "Setting Expert Mode to " << enable << endl; #endif diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index 7d15b1e01..63d2bff2a 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -73,6 +73,8 @@ void qTabDataOutput::SetupWidgetWindow(){ outDirTip = boxOutDir->toolTip(); + //expert mode is not enabled initially + chkCompression->setEnabled(false); Initialization(); @@ -153,6 +155,19 @@ void qTabDataOutput::Initialization(){ connect(chkAngular, SIGNAL(toggled(bool)), this, SLOT(SetAngularCorrection())); //discard bad channels connect(chkDiscardBad, SIGNAL(toggled(bool)), this, SLOT(DiscardBadChannels())); + //compression + connect(chkCompression, SIGNAL(toggled(bool)), this, SLOT(SetCompression(bool))); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabDataOutput::SetExpertMode(bool enable){ + if((detType == slsDetectorDefs::GOTTHARD) || (detType == slsDetectorDefs::MOENCH)){ + chkCompression->setEnabled(enable); + GetCompression(); + } } @@ -456,83 +471,6 @@ void qTabDataOutput::DiscardBadChannels(){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void qTabDataOutput::Refresh(){ -#ifdef VERBOSE - cout << endl << "**Updating DataOutput Tab" << endl; -#endif - - - // output dir -#ifdef VERBOSE - cout << "Getting output directory" << endl; -#endif - disconnect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(GetOutputDir())); - PopulateDetectors(); - connect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(GetOutputDir())); - - - //flat field correction from server -#ifdef VERBOSE - cout << "Getting flat field" << endl; -#endif - UpdateFlatFieldFromServer(); - - - //rate correction - not for charge integrating detectors - if((detType == slsDetectorDefs::MYTHEN)||(detType == slsDetectorDefs::EIGER)){ -#ifdef VERBOSE - cout << "Getting rate correction" << endl; -#endif - UpdateRateCorrectionFromServer(); - } - - - //update angular conversion from server - if((detType == slsDetectorDefs::MYTHEN)||(detType == slsDetectorDefs::GOTTHARD)){ -#ifdef VERBOSE - cout << "Getting angular conversion" << endl; -#endif - int ang; - if(myDet->getAngularConversion(ang)) - chkAngular->setChecked(true); - emit AngularConversionSignal(chkAngular->isChecked()); - } - - - //discard bad channels from server -#ifdef VERBOSE - cout << "Getting bad channel correction" << endl; - // cout << "ff " << myDet->getBadChannelCorrection() << endl; -#endif - - - disconnect(chkDiscardBad, SIGNAL(toggled(bool))); - if(myDet->getBadChannelCorrection()) - chkDiscardBad->setChecked(true); - else - chkDiscardBad->setChecked(false); - connect(chkDiscardBad, SIGNAL(toggled(bool)), this, SLOT(DiscardBadChannels())); - - if(myDet->setReceiverOnline()==slsDetectorDefs::ONLINE_FLAG){ - btnOutputBrowse->setEnabled(false); - btnOutputBrowse->setToolTip("This button is disabled as receiver PC is different from " - "client PC and hence different directory structures.

" + dispOutputDir->toolTip()); - }else{ - btnOutputBrowse->setEnabled(true); - btnOutputBrowse->setToolTip(dispOutputDir->toolTip()); - } - -#ifdef VERBOSE - cout << "**Updated DataOutput Tab" << endl << endl; -#endif - - qDefs::checkErrorMessage(myDet,"qTabDataOutput::Refresh"); -} - - -//------------------------------------------------------------------------------------------------------------------------------------------------- - - void qTabDataOutput::PopulateDetectors(){ #ifdef VERBOSE cout << "Populating detectors" << endl; @@ -769,3 +707,116 @@ void qTabDataOutput::SetOutputDir(){ //------------------------------------------------------------------------------------------------------------------------------------------------- +void qTabDataOutput::GetCompression(){ + disconnect(chkCompression, SIGNAL(toggled(bool)), this, SLOT(SetCompression(bool))); + int ret = myDet->enableReceiverCompression(); + if(ret > 0) chkCompression->setChecked(true); + else chkCompression->setChecked(false); + connect(chkCompression, SIGNAL(toggled(bool)), this, SLOT(SetCompression(bool))); + + qDefs::checkErrorMessage(myDet,"qTabDataOutput::GetCompression"); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabDataOutput::SetCompression(bool enable){ + disconnect(chkCompression, SIGNAL(toggled(bool)), this, SLOT(SetCompression(bool))); + int ret = myDet->enableReceiverCompression(enable); + if(ret > 0) chkCompression->setChecked(true); + else chkCompression->setChecked(false); + connect(chkCompression, SIGNAL(toggled(bool)), this, SLOT(SetCompression(bool))); + + qDefs::checkErrorMessage(myDet,"qTabDataOutput::SetCompression"); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabDataOutput::Refresh(){ +#ifdef VERBOSE + cout << endl << "**Updating DataOutput Tab" << endl; +#endif + + + // output dir +#ifdef VERBOSE + cout << "Getting output directory" << endl; +#endif + disconnect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(GetOutputDir())); + PopulateDetectors(); + connect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(GetOutputDir())); + + + //flat field correction from server +#ifdef VERBOSE + cout << "Getting flat field" << endl; +#endif + UpdateFlatFieldFromServer(); + + + //rate correction - not for charge integrating detectors + if((detType == slsDetectorDefs::MYTHEN)||(detType == slsDetectorDefs::EIGER)){ +#ifdef VERBOSE + cout << "Getting rate correction" << endl; +#endif + UpdateRateCorrectionFromServer(); + } + + + //update angular conversion from server + if((detType == slsDetectorDefs::MYTHEN)||(detType == slsDetectorDefs::GOTTHARD)){ +#ifdef VERBOSE + cout << "Getting angular conversion" << endl; +#endif + int ang; + if(myDet->getAngularConversion(ang)) + chkAngular->setChecked(true); + emit AngularConversionSignal(chkAngular->isChecked()); + } + + + //discard bad channels from server +#ifdef VERBOSE + cout << "Getting bad channel correction" << endl;//cout << "ff " << myDet->getBadChannelCorrection() << endl; +#endif + + + disconnect(chkDiscardBad, SIGNAL(toggled(bool))); + if(myDet->getBadChannelCorrection()) + chkDiscardBad->setChecked(true); + else + chkDiscardBad->setChecked(false); + connect(chkDiscardBad, SIGNAL(toggled(bool)), this, SLOT(DiscardBadChannels())); + + if(myDet->setReceiverOnline()==slsDetectorDefs::ONLINE_FLAG){ + btnOutputBrowse->setEnabled(false); + btnOutputBrowse->setToolTip("This button is disabled as receiver PC is different from " + "client PC and hence different directory structures.

" + dispOutputDir->toolTip()); + }else{ + btnOutputBrowse->setEnabled(true); + btnOutputBrowse->setToolTip(dispOutputDir->toolTip()); + } + + //getting compression + if(chkCompression->isEnabled()){ +#ifdef VERBOSE + cout << "Getting compression" << endl; +#endif + GetCompression(); + } + + +#ifdef VERBOSE + cout << "**Updated DataOutput Tab" << endl << endl; +#endif + + qDefs::checkErrorMessage(myDet,"qTabDataOutput::Refresh"); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + From c338de941d65654e3b0b0739fcc0f6acad4072ba Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 4 Mar 2014 14:18:07 +0000 Subject: [PATCH 263/332] bug fix changing prbes did not change other items as planned, signal lost git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@263 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/svnInfoGui.h | 6 +++--- slsDetectorGui/src/qTabMeasurement.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/slsDetectorGui/include/svnInfoGui.h b/slsDetectorGui/include/svnInfoGui.h index a305f207f..0814f613f 100644 --- a/slsDetectorGui/include/svnInfoGui.h +++ b/slsDetectorGui/include/svnInfoGui.h @@ -2,10 +2,10 @@ #define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui" //#define SVNREPPATH "" #define SVNREPUUID "af1100a4-978c-4157-bff7-07162d2ba061" -//#define SVNREV 0x251 +//#define SVNREV 0x262 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "l_maliakal_d" -#define SVNREV 0x251 -#define SVNDATE 0x20140130 +#define SVNREV 0x262 +#define SVNDATE 0x20140227 // diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index b4dae68f0..001f5e062 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -869,7 +869,7 @@ void qTabMeasurement::Refresh(){ void qTabMeasurement::EnableProbes(){ - disconnect(spinNumProbes,SIGNAL(valueChanged(int)), this, SLOT(setNumProbes(int))); + //disconnect(spinNumProbes,SIGNAL(valueChanged(int)), this, SLOT(setNumProbes(int))); disconnect(spinNumTriggers,SIGNAL(valueChanged(int)), this, SLOT(setNumTriggers(int))); @@ -901,7 +901,7 @@ void qTabMeasurement::EnableProbes(){ lblNumProbes->setEnabled(false); spinNumProbes->setEnabled(false); - connect(spinNumProbes,SIGNAL(valueChanged(int)), this, SLOT(setNumProbes(int))); + //connect(spinNumProbes,SIGNAL(valueChanged(int)), this, SLOT(setNumProbes(int))); connect(spinNumTriggers,SIGNAL(valueChanged(int)), this, SLOT(setNumTriggers(int))); } From 6d708e620ad9d5176221042f1cc3da20ef239822 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Thu, 13 Mar 2014 14:13:58 +0000 Subject: [PATCH 264/332] changed #triggers to #frames for trigger frame and trigger window for eiger git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@264 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qTabMeasurement.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 001f5e062..af9ee1eaf 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -653,10 +653,10 @@ void qTabMeasurement::SetTimingMode(int mode){ if(myDet->setExternalCommunicationMode(slsDetectorDefs::TRIGGER_EXPOSURE)==slsDetectorDefs::TRIGGER_EXPOSURE) success = true; break; - case Trigger_Frame://ExpTime, #Triggers - spinNumFrames->setValue(1); + case Trigger_Frame://ExpTime, #Frames + lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true); - lblNumTriggers->setEnabled(true); spinNumTriggers->setEnabled(true); + lblNumTriggers->setEnabled(false); spinNumTriggers->setEnabled(false); if(myDet->setExternalCommunicationMode(slsDetectorDefs::TRIGGER_FRAME)==slsDetectorDefs::TRIGGER_FRAME) success = true; break; @@ -685,9 +685,8 @@ void qTabMeasurement::SetTimingMode(int mode){ if(myDet->setExternalCommunicationMode(slsDetectorDefs::GATE_WITH_START_TRIGGER)==slsDetectorDefs::GATE_WITH_START_TRIGGER) success = true; break; - case Trigger_Window://#Triggers - spinNumFrames->setValue(1); - lblNumTriggers->setEnabled(true); spinNumTriggers->setEnabled(true); + case Trigger_Window://#Frames + lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); if(myDet->setExternalCommunicationMode(slsDetectorDefs::TRIGGER_WINDOW)==slsDetectorDefs::TRIGGER_WINDOW) success = true; break; From 36171dc5a06c73566c5b9dc0642ae261176c63e2 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Thu, 13 Mar 2014 14:19:43 +0000 Subject: [PATCH 265/332] changed #triggers to #frames for trigger frame and trigger window for eiger git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@265 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/src/qTabMeasurement.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index af9ee1eaf..d02182106 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -141,7 +141,7 @@ void qTabMeasurement::SetupTimingMode(){ item[(int)Trigger_Window]->setEnabled(false); break; case slsDetectorDefs::EIGER: - item[(int)Trigger_Exp_Series]->setEnabled(true); + item[(int)Trigger_Exp_Series]->setEnabled(false);/**not implemented yet*/ item[(int)Trigger_Frame]->setEnabled(true); item[(int)Trigger_Readout]->setEnabled(false); item[(int)Gated]->setEnabled(false); From ef983c151fbc08597b66ab8c642927b8f5233790 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 26 Mar 2014 10:07:27 +0000 Subject: [PATCH 266/332] small variation git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@266 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qDefs.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/slsDetectorGui/include/qDefs.h b/slsDetectorGui/include/qDefs.h index 497a809ba..61e276e3f 100644 --- a/slsDetectorGui/include/qDefs.h +++ b/slsDetectorGui/include/qDefs.h @@ -217,6 +217,10 @@ static const int64_t GUI_VERSION=0x20121213; //display message qDefs::Message((MessageIndex)errorLevel,retval,title); + + if(retval.find("CAKE")!=string::npos){ + qDefs::Message((MessageIndex)errorLevel,"So You will get a cake tomorrow right?",title); + } } myDet->clearAllErrorMask(); From bf2d8937f4b4d1b78e7ba74689287588be15e242 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 26 Mar 2014 14:06:59 +0000 Subject: [PATCH 267/332] got rid of trigger frame and trigger window to merge with other timing modes git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@267 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_measurement.ui | 10 ------- slsDetectorGui/include/qTabMeasurement.h | 2 +- slsDetectorGui/src/qTabMeasurement.cpp | 30 +++++++------------- 3 files changed, 11 insertions(+), 31 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_measurement.ui b/slsDetectorGui/forms/form_tab_measurement.ui index b7cad8434..cf912b679 100644 --- a/slsDetectorGui/forms/form_tab_measurement.ui +++ b/slsDetectorGui/forms/form_tab_measurement.ui @@ -523,11 +523,6 @@ Maximum value is 3. <br> Trigger Exposure Series
- - - Trigger Frame - - Trigger Readout @@ -543,11 +538,6 @@ Maximum value is 3. <br> Gated with Start Trigger - - - External Trigger Window - -
diff --git a/slsDetectorGui/include/qTabMeasurement.h b/slsDetectorGui/include/qTabMeasurement.h index 4e9b42e60..5f34f978a 100644 --- a/slsDetectorGui/include/qTabMeasurement.h +++ b/slsDetectorGui/include/qTabMeasurement.h @@ -180,7 +180,7 @@ private: /** detector type */ slsDetectorDefs::detectorType detType; /** enum for the timing mode */ - enum{None, Auto, Trigger_Exp_Series, Trigger_Frame, Trigger_Readout, Gated, Gated_Start, Trigger_Window, NumTimingModes}; + enum{None, Auto, Trigger_Exp_Series, Trigger_Readout, Gated, Gated_Start, NumTimingModes}; /** timer to update the progress*/ QTimer *progressTimer; /** tool tip variables*/ diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index d02182106..0b3858326 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -134,28 +134,22 @@ void qTabMeasurement::SetupTimingMode(){ switch(detType){ case slsDetectorDefs::MYTHEN: item[(int)Trigger_Exp_Series]->setEnabled(true); - item[(int)Trigger_Frame]->setEnabled(false); item[(int)Trigger_Readout]->setEnabled(true); item[(int)Gated]->setEnabled(true); item[(int)Gated_Start]->setEnabled(true); - item[(int)Trigger_Window]->setEnabled(false); break; case slsDetectorDefs::EIGER: item[(int)Trigger_Exp_Series]->setEnabled(false);/**not implemented yet*/ - item[(int)Trigger_Frame]->setEnabled(true); item[(int)Trigger_Readout]->setEnabled(false); - item[(int)Gated]->setEnabled(false); + item[(int)Gated]->setEnabled(true); item[(int)Gated_Start]->setEnabled(false); - item[(int)Trigger_Window]->setEnabled(true); break; case slsDetectorDefs::MOENCH: case slsDetectorDefs::GOTTHARD: item[(int)Trigger_Exp_Series]->setEnabled(true); - item[(int)Trigger_Frame]->setEnabled(false); item[(int)Trigger_Readout]->setEnabled(false); item[(int)Gated]->setEnabled(false); item[(int)Gated_Start]->setEnabled(false); - item[(int)Trigger_Window]->setEnabled(false); break; default: qDefs::Message(qDefs::CRITICAL,"Unknown detector type.","qTabMeasurement::SetupTimingMode"); @@ -645,7 +639,11 @@ void qTabMeasurement::SetTimingMode(int mode){ success = true; break; case Trigger_Exp_Series://#Frames, #Triggers, ExpTime, Period, Delay + if(detType == slsDetectorDefs::EIGER)//more than 1 frame per trigger yet to be implemented + spinNumFrames->setValue(1); + else{ lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); + } lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true); lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true); lblNumTriggers->setEnabled(true); spinNumTriggers->setEnabled(true); @@ -653,13 +651,6 @@ void qTabMeasurement::SetTimingMode(int mode){ if(myDet->setExternalCommunicationMode(slsDetectorDefs::TRIGGER_EXPOSURE)==slsDetectorDefs::TRIGGER_EXPOSURE) success = true; break; - case Trigger_Frame://ExpTime, #Frames - lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); - lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true); - lblNumTriggers->setEnabled(false); spinNumTriggers->setEnabled(false); - if(myDet->setExternalCommunicationMode(slsDetectorDefs::TRIGGER_FRAME)==slsDetectorDefs::TRIGGER_FRAME) - success = true; - break; case Trigger_Readout://#Frames, ExpTime, Period, Delay spinNumTriggers->setValue(1); lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); @@ -671,8 +662,12 @@ void qTabMeasurement::SetTimingMode(int mode){ break; case Gated://#Frames, #Gates spinNumTriggers->setValue(1); - lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); + if(detType == slsDetectorDefs::EIGER)//more than 1 frame per trigger yet to be implemented + spinNumGates->setValue(1); + else{ lblNumGates->setEnabled(true); spinNumGates->setEnabled(true); + } + lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); if(myDet->setExternalCommunicationMode(slsDetectorDefs::GATE_FIX_NUMBER)==slsDetectorDefs::GATE_FIX_NUMBER) success = true; break; @@ -685,11 +680,6 @@ void qTabMeasurement::SetTimingMode(int mode){ if(myDet->setExternalCommunicationMode(slsDetectorDefs::GATE_WITH_START_TRIGGER)==slsDetectorDefs::GATE_WITH_START_TRIGGER) success = true; break; - case Trigger_Window://#Frames - lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); - if(myDet->setExternalCommunicationMode(slsDetectorDefs::TRIGGER_WINDOW)==slsDetectorDefs::TRIGGER_WINDOW) - success = true; - break; default: //This should never happen qDefs::Message(qDefs::CRITICAL,"Timing mode unknown to GUI","qTabMeasurement::SetTimingMode"); From 02c4a5e18e0538d80be346bfae353b57820fe214 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Mon, 7 Apr 2014 15:50:23 +0000 Subject: [PATCH 268/332] Makefile sala refined git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@268 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/Makefile | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/slsDetectorGui/Makefile b/slsDetectorGui/Makefile index dd5c0c467..b9cccd7a7 100644 --- a/slsDetectorGui/Makefile +++ b/slsDetectorGui/Makefile @@ -1,15 +1,27 @@ +# LEO: Won't compile without libSlsDetector -PROG= $(DESTDIR)/slsDetectorGui -DESTDIR?=bin -DOCDIR?=docs +include ../Makefile.include -LIBDIR?=../bin -LIBRARYDIR?=../slsDetectorSoftware -INCLUDES?= $(LIBRARYDIR)/commonFiles -I$(LIBRARYDIR)/MySocketTCP -I$(LIBRARYDIR)/slsReceiverInterface -I$(LIBRARYDIR)/slsDetector -I$(LIBRARYDIR)/slsDetectorAnalysis -I$(LIBRARYDIR)/multiSlsDetector -I$(LIBRARYDIR)/usersFunctions -LDFLAG?=-L$(LIBRARYDIR)/bin -lSlsDetector +PROG = $(DESTDIR)/slsDetectorGui + +DESTDIR ?= ../bin +LIBDIR ?= $(DESTDIR) +DOCDIR ?= docs + +LIBRARYDIR ?= ../slsDetectorSoftware +INCLUDES ?= $(LIBRARYDIR)/commonFiles -I$(LIBRARYDIR)/MySocketTCP -I$(LIBRARYDIR)/slsReceiverInterface -I$(LIBRARYDIR)/slsDetector -I$(LIBRARYDIR)/slsDetectorAnalysis -I$(LIBRARYDIR)/multiSlsDetector -I$(LIBRARYDIR)/usersFunctions + +ifeq ( $(EIGERSLS), yes) + LDFLAG += $(EIGERFLAGS) +endif + +.PHONY: all lib clean mm doc htmldoc guiclient -all: $(PROG) Makefile.gui guiclient +all: lib $(PROG) Makefile.gui guiclient + +lib: + cd ../ && make lib clean: if test -e Makefile.gui; then make -f Makefile.gui clean; make -f Makefile.gui mocclean; rm Makefile.gui; else make Makefile.gui; make -f Makefile.gui clean; make -f Makefile.gui mocclean; fi @@ -29,10 +41,8 @@ htmldoc: cd manual && make html DESTDIR=$(DOCDIR) $(PROG): Makefile.gui $(DIR) - echo $(LDFLAG) make -f Makefile.gui SLSDETLIB=$(LIBDIR) DESTDIR=$(DESTDIR) SUBLIBS='$(LDFLAG)' INCLUDES='$(INCLUDES)' - guiclient: echo $(WD) cd client && $(MAKE) DESTDIR=$(DESTDIR) From 9c5e2aa5b794a303e8e829825e3e622432f17a8e Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 9 Apr 2014 10:29:11 +0000 Subject: [PATCH 269/332] compiling with and without root defined in makefile.include git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@269 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/Makefile | 2 ++ slsDetectorGui/include/qDefs.h | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/slsDetectorGui/Makefile b/slsDetectorGui/Makefile index b9cccd7a7..f5ead9d49 100644 --- a/slsDetectorGui/Makefile +++ b/slsDetectorGui/Makefile @@ -13,6 +13,8 @@ INCLUDES ?= $(LIBRARYDIR)/commonFiles -I$(LIBRARYDIR)/MySocketTCP -I$(LIBRARYD ifeq ( $(EIGERSLS), yes) LDFLAG += $(EIGERFLAGS) +else ifeq ( $(ROOTSLS), yes) + LDFLAG += $(ROOTFLAGS) endif .PHONY: all lib clean mm doc htmldoc guiclient diff --git a/slsDetectorGui/include/qDefs.h b/slsDetectorGui/include/qDefs.h index 61e276e3f..497a809ba 100644 --- a/slsDetectorGui/include/qDefs.h +++ b/slsDetectorGui/include/qDefs.h @@ -217,10 +217,6 @@ static const int64_t GUI_VERSION=0x20121213; //display message qDefs::Message((MessageIndex)errorLevel,retval,title); - - if(retval.find("CAKE")!=string::npos){ - qDefs::Message((MessageIndex)errorLevel,"So You will get a cake tomorrow right?",title); - } } myDet->clearAllErrorMask(); From ea1878f848f524a1ba7519f5ea4a223af7cd472b Mon Sep 17 00:00:00 2001 From: Maliakal Dhanya Date: Tue, 20 May 2014 17:17:20 +0200 Subject: [PATCH 270/332] changes in makefile to make a separate receiver --- slsDetectorGui/Makefile | 19 ++++++++++--------- slsDetectorGui/client/Makefile | 8 ++++---- slsDetectorGui/slsDetectorGui.pro | 4 ++-- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/slsDetectorGui/Makefile b/slsDetectorGui/Makefile index f5ead9d49..fbbdeee59 100644 --- a/slsDetectorGui/Makefile +++ b/slsDetectorGui/Makefile @@ -8,14 +8,15 @@ DESTDIR ?= ../bin LIBDIR ?= $(DESTDIR) DOCDIR ?= docs -LIBRARYDIR ?= ../slsDetectorSoftware -INCLUDES ?= $(LIBRARYDIR)/commonFiles -I$(LIBRARYDIR)/MySocketTCP -I$(LIBRARYDIR)/slsReceiverInterface -I$(LIBRARYDIR)/slsDetector -I$(LIBRARYDIR)/slsDetectorAnalysis -I$(LIBRARYDIR)/multiSlsDetector -I$(LIBRARYDIR)/usersFunctions +LIBRARYDIR ?= ../slsDetectorSoftware +LIBRARYRXRDIR ?= ../slsReceiverSoftware +INCLUDES ?= $(LIBRARYDIR)/commonFiles -I$(LIBRARYRXRDIR)/MySocketTCP -I$(LIBRARYDIR)/slsReceiverInterface -I$(LIBRARYDIR)/slsDetector -I$(LIBRARYDIR)/slsDetectorAnalysis -I$(LIBRARYDIR)/multiSlsDetector -I$(LIBRARYDIR)/usersFunctions -I$(LIBRARYRXRDIR)/includes -ifeq ( $(EIGERSLS), yes) - LDFLAG += $(EIGERFLAGS) -else ifeq ( $(ROOTSLS), yes) - LDFLAG += $(ROOTFLAGS) -endif +#ifeq ( $(EIGERSLS), yes) +# LDFLAG += $(EIGERFLAGS) +#else ifeq ( $(ROOTSLS), yes) +# LDFLAG += $(ROOTFLAGS) +#endif .PHONY: all lib clean mm doc htmldoc guiclient @@ -34,7 +35,7 @@ clean: Makefile.gui: mm mm: - qmake -set QT_INSTALL_PREFIX $(QTDIR) && qmake -o Makefile.gui INCLUDES='$(INCLUDES)' DESTDIR=$(DESTDIR) SLSDETLIB=$(LIBDIR) SUBLIBS='$(LDFLAG)' + qmake -set QT_INSTALL_PREFIX $(QTDIR) && qmake -o Makefile.gui INCLUDES='$(INCLUDES)' DESTDIR=$(DESTDIR) SLSDETLIB=$(LIBDIR) SUBLIBS='$(LDFLAGDET)' doc: cd manual && make DESTDIR=$(DOCDIR) @@ -43,7 +44,7 @@ htmldoc: cd manual && make html DESTDIR=$(DOCDIR) $(PROG): Makefile.gui $(DIR) - make -f Makefile.gui SLSDETLIB=$(LIBDIR) DESTDIR=$(DESTDIR) SUBLIBS='$(LDFLAG)' INCLUDES='$(INCLUDES)' + make -f Makefile.gui SLSDETLIB=$(LIBDIR) DESTDIR=$(DESTDIR) SUBLIBS='$(LDFLAGDET)' INCLUDES='$(INCLUDES)' guiclient: echo $(WD) diff --git a/slsDetectorGui/client/Makefile b/slsDetectorGui/client/Makefile index a889e74c7..ca48957a2 100644 --- a/slsDetectorGui/client/Makefile +++ b/slsDetectorGui/client/Makefile @@ -3,8 +3,9 @@ CLAGS += -DVERBOSE #VERYBOSE LDLIBS += -lm -lstdc++ -lpthread LDIR = ../../slsDetectorSoftware -INCLUDES = -I ../../slsDetectorSoftware/commonFiles -I ../../slsDetectorSoftware/MySocketTCP -I ../../slsDetectorSoftware/slsDetector -I ../include -SRC_CLNT = qClient.cpp ../../slsDetectorSoftware/MySocketTCP/MySocketTCP.cpp +RDIR = ../../slsReceiverSoftware +INCLUDES = -I $(LDIR)/commonFiles -I $(RDIR)/MySocketTCP -I $(LDIR)/slsDetector -I ../include -I $(RDIR)/includes +SRC_CLNT = qClient.cpp $(RDIR)/MySocketTCP/MySocketTCP.cpp PROGS = gui_client DESTDIR ?= bin @@ -26,8 +27,7 @@ $(PROGS): mv $(PROGS) $(FINALDIR) clean: - rm -rf $(DESTDIR)/$(PROGS) *.o - rm -rf $(FINALDIR)/$(PROGS) + rm -rf $(DESTDIR)/$(PROGS) *.o $(FINALDIR)/$(PROGS) diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index 72f89a506..ac60c2004 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -16,11 +16,11 @@ QMAKE_LIBS = -L$(QTDIR)/lib #epics -#DEFINES += EPICS VERBOSE DACS_INT PRINT_LOG THIS_PATH=\\\"$$PWD\\\" #VERYVERBOSE +#DEFINES += EPICS VERBOSE DACS_INT PRINT_LOG #VERYVERBOSE #LIBS = -L$(QWTDIR)/lib -lqwt -L$(QWT3D)/lib -Wl,-R$(QWTDIR)/lib -L /usr/local/epics/base/lib/$(EPICS_HOST_ARCH)/ -Wl,-R/usr/local/epics/base/lib/$(EPICS_HOST_ARCH) -lca -lCom #default -DEFINES += VERBOSE DACS_INT PRINT_LOG THIS_PATH=\\\"$$PWD\\\" #VERYVERBOSE CHECKINFERROR +DEFINES += VERBOSE DACS_INT PRINT_LOG #VERYVERBOSE CHECKINFERROR LIBS = -L$(QWTDIR)/lib -lqwt -L$(QWT3D)/lib From 891c67f3d0d5ea50535c8a53a2c57ec889d9c8eb Mon Sep 17 00:00:00 2001 From: Maliakal Dhanya Date: Fri, 23 May 2014 14:52:12 +0200 Subject: [PATCH 271/332] added gitignore for gui --- slsDetectorGui/.gitignore | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 slsDetectorGui/.gitignore diff --git a/slsDetectorGui/.gitignore b/slsDetectorGui/.gitignore new file mode 100644 index 000000000..8626cc9e5 --- /dev/null +++ b/slsDetectorGui/.gitignore @@ -0,0 +1,5 @@ +Makefile.gui +forms/include/ +mocs/ +objs/ +qrc_icons.cpp From c985124b51d04b01d68d0d25db9c67a10c9b42d1 Mon Sep 17 00:00:00 2001 From: Maliakal Dhanya Date: Tue, 3 Jun 2014 12:07:35 +0200 Subject: [PATCH 272/332] git version history --- slsDetectorGui/gitInfo.txt | 9 +++++++++ slsDetectorGui/include/gitInfoGui.h | 11 +++++++++++ .../include/{svnInfoGuiTmp.h => gitInfoGuiTmp.h} | 0 slsDetectorGui/include/svnInfoGui.h | 11 ----------- 4 files changed, 20 insertions(+), 11 deletions(-) create mode 100644 slsDetectorGui/gitInfo.txt create mode 100644 slsDetectorGui/include/gitInfoGui.h rename slsDetectorGui/include/{svnInfoGuiTmp.h => gitInfoGuiTmp.h} (100%) delete mode 100644 slsDetectorGui/include/svnInfoGui.h diff --git a/slsDetectorGui/gitInfo.txt b/slsDetectorGui/gitInfo.txt new file mode 100644 index 000000000..0762de198 --- /dev/null +++ b/slsDetectorGui/gitInfo.txt @@ -0,0 +1,9 @@ +Path: slsDetectorsPackage/slsDetectorGui +URL: origin git@gitorious.psi.ch:sls_det_software/sls_detector_gui.git +Repository Root: origin git@gitorious.psi.ch:sls_det_software/sls_detector_gui.git +Repsitory UUID: bf99e3b9300675c33067e0934fd271b841d5dd66 +Revision: 271 +Branch: separate_receiver +Last Changed Author: Maliakal_Dhanya +Last Changed Rev: 271 +Last Changed Date: 2014-05-23 14:52:12 +0200 diff --git a/slsDetectorGui/include/gitInfoGui.h b/slsDetectorGui/include/gitInfoGui.h new file mode 100644 index 000000000..e6d8f76e0 --- /dev/null +++ b/slsDetectorGui/include/gitInfoGui.h @@ -0,0 +1,11 @@ +//#define SVNPATH "" +#define SVNURL "git@gitorious.psi.ch:sls_det_software/sls_detector_gui.git" +//#define SVNREPPATH "" +#define SVNREPUUID "bf99e3b9300675c33067e0934fd271b841d5dd66" +//#define SVNREV 0x271 +//#define SVNKIND "" +//#define SVNSCHED "" +#define SVNAUTH "Maliakal_Dhanya" +#define SVNREV 0x271 +#define SVNDATE 0x20140523 +// diff --git a/slsDetectorGui/include/svnInfoGuiTmp.h b/slsDetectorGui/include/gitInfoGuiTmp.h similarity index 100% rename from slsDetectorGui/include/svnInfoGuiTmp.h rename to slsDetectorGui/include/gitInfoGuiTmp.h diff --git a/slsDetectorGui/include/svnInfoGui.h b/slsDetectorGui/include/svnInfoGui.h deleted file mode 100644 index 0814f613f..000000000 --- a/slsDetectorGui/include/svnInfoGui.h +++ /dev/null @@ -1,11 +0,0 @@ -//#define SVNPATH "" -#define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui" -//#define SVNREPPATH "" -#define SVNREPUUID "af1100a4-978c-4157-bff7-07162d2ba061" -//#define SVNREV 0x262 -//#define SVNKIND "" -//#define SVNSCHED "" -#define SVNAUTH "l_maliakal_d" -#define SVNREV 0x262 -#define SVNDATE 0x20140227 -// From 0eaecc0e12114ad13dc059c3354642345270a1fb Mon Sep 17 00:00:00 2001 From: Maliakal Dhanya Date: Tue, 3 Jun 2014 13:56:39 +0200 Subject: [PATCH 273/332] git version history --- slsDetectorGui/gitInfo.txt | 8 ++++---- slsDetectorGui/include/gitInfoGui.h | 8 ++++---- slsDetectorGui/slsDetectorGui.pro | 2 +- slsDetectorGui/src/qDetectorMain.cpp | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/slsDetectorGui/gitInfo.txt b/slsDetectorGui/gitInfo.txt index 0762de198..129a7e955 100644 --- a/slsDetectorGui/gitInfo.txt +++ b/slsDetectorGui/gitInfo.txt @@ -1,9 +1,9 @@ Path: slsDetectorsPackage/slsDetectorGui URL: origin git@gitorious.psi.ch:sls_det_software/sls_detector_gui.git Repository Root: origin git@gitorious.psi.ch:sls_det_software/sls_detector_gui.git -Repsitory UUID: bf99e3b9300675c33067e0934fd271b841d5dd66 -Revision: 271 +Repsitory UUID: 8d8e3f9221be0f85c016a7d48e5d1abed5fdcc95 +Revision: 272 Branch: separate_receiver Last Changed Author: Maliakal_Dhanya -Last Changed Rev: 271 -Last Changed Date: 2014-05-23 14:52:12 +0200 +Last Changed Rev: 272 +Last Changed Date: 2014-06-03 12:07:35 +0200 diff --git a/slsDetectorGui/include/gitInfoGui.h b/slsDetectorGui/include/gitInfoGui.h index e6d8f76e0..ae315cd41 100644 --- a/slsDetectorGui/include/gitInfoGui.h +++ b/slsDetectorGui/include/gitInfoGui.h @@ -1,11 +1,11 @@ //#define SVNPATH "" #define SVNURL "git@gitorious.psi.ch:sls_det_software/sls_detector_gui.git" //#define SVNREPPATH "" -#define SVNREPUUID "bf99e3b9300675c33067e0934fd271b841d5dd66" -//#define SVNREV 0x271 +#define SVNREPUUID "8d8e3f9221be0f85c016a7d48e5d1abed5fdcc95" +//#define SVNREV 0x272 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "Maliakal_Dhanya" -#define SVNREV 0x271 -#define SVNDATE 0x20140523 +#define SVNREV 0x272 +#define SVNDATE 0x20140603 // diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index ac60c2004..da52c63f8 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -126,7 +126,7 @@ HEADERS = \ include/qTabDebugging.h\ include/qTabDeveloper.h\ include/qTabMessages.h\ - include/svnInfoGui.h\ + include/gitInfoGui.h\ ../slsDetectorSoftware/commonFiles/sls_detector_defs.h\ include/qServer.h diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index fcd191340..bfb4df3d6 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -17,7 +17,7 @@ #include "slsDetector.h" #include "multiSlsDetector.h" #include "sls_detector_defs.h" -#include "svnInfoGui.h" +#include "gitInfoGui.h" // Qt Include Headers #include #include From b256e0b9e3db6f596abdb75b146fe51f17629500 Mon Sep 17 00:00:00 2001 From: Maliakal Dhanya Date: Wed, 18 Jun 2014 16:39:11 +0200 Subject: [PATCH 274/332] included eiger dacs to gui --- slsDetectorGui/src/qTabDeveloper.cpp | 42 ++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/slsDetectorGui/src/qTabDeveloper.cpp b/slsDetectorGui/src/qTabDeveloper.cpp index 45cb171e8..2d88854ee 100644 --- a/slsDetectorGui/src/qTabDeveloper.cpp +++ b/slsDetectorGui/src/qTabDeveloper.cpp @@ -79,6 +79,24 @@ void qTabDeveloper::SetupWidgetWindow(){ case slsDetectorDefs::EIGER: NUM_DAC_WIDGETS = 16; NUM_ADC_WIDGETS = 0; + + dacNames.push_back("v SvP:"); + dacNames.push_back("v Vtr:"); + dacNames.push_back("v Vrf:"); + dacNames.push_back("v Vrs:"); + dacNames.push_back("v SvN"); + dacNames.push_back("v Vtgstv:"); + dacNames.push_back("v Vcmp_ll:"); + dacNames.push_back("v Vcmp_lr:"); + dacNames.push_back("i cal:"); + dacNames.push_back("v Vcmp_rl:"); + dacNames.push_back("v rxb_rb:"); + dacNames.push_back("v rxb_lb:"); + dacNames.push_back("v Vcmp_rr:"); + dacNames.push_back("v Vcp"); + dacNames.push_back("v Vcn:"); + dacNames.push_back("v Vis:"); + break; case slsDetectorDefs::GOTTHARD: NUM_DAC_WIDGETS = 8; @@ -296,8 +314,28 @@ slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(int index){ } break; case slsDetectorDefs::EIGER: - return slsDetectorDefs::HUMIDITY; - /**fill in here*/ + switch(index){ + case 0: return slsDetectorDefs::E_SvP; + case 1: return slsDetectorDefs::E_Vtr; + case 2: return slsDetectorDefs::E_Vrf; + case 3: return slsDetectorDefs::E_Vrs; + case 4: return slsDetectorDefs::E_SvN; + case 5: return slsDetectorDefs::E_Vtgstv; + case 6: return slsDetectorDefs::E_Vcmp_ll; + case 7: return slsDetectorDefs::E_Vcmp_lr; + case 8: return slsDetectorDefs::E_cal; + case 9: return slsDetectorDefs::E_Vcmp_rl; + case 10:return slsDetectorDefs::E_rxb_rb; + case 11:return slsDetectorDefs::E_rxb_lb; + case 12:return slsDetectorDefs::E_Vcmp_rr; + case 13:return slsDetectorDefs::E_Vcp; + case 14:return slsDetectorDefs::E_Vcn; + case 15:return slsDetectorDefs::E_Vis; + default: + qDefs::Message(qDefs::CRITICAL,"Unknown DAC/ADC Index. Weird Error","qTabDeveloper::getSLSIndex"); + Refresh(); + break; + } break; case slsDetectorDefs::MOENCH: case slsDetectorDefs::GOTTHARD: From 4d9bbeecc3c2f6a55ae89cc4f9d359822611a2a5 Mon Sep 17 00:00:00 2001 From: Maliakal Dhanya Date: Wed, 2 Jul 2014 10:57:03 +0200 Subject: [PATCH 275/332] eiger receiver, receiving many packets at a time, with 16,8, 4 bitmode sort of working --- slsDetectorGui/include/qTabSettings.h | 5 +- slsDetectorGui/src/qTabDeveloper.cpp | 5 +- slsDetectorGui/src/qTabMeasurement.cpp | 34 +++++------ slsDetectorGui/src/qTabSettings.cpp | 80 +++++++++++++------------- 4 files changed, 66 insertions(+), 58 deletions(-) diff --git a/slsDetectorGui/include/qTabSettings.h b/slsDetectorGui/include/qTabSettings.h index e397c606f..e66afedf3 100644 --- a/slsDetectorGui/include/qTabSettings.h +++ b/slsDetectorGui/include/qTabSettings.h @@ -76,7 +76,10 @@ private: */ void Initialization(); - + /** Gets the dynamic range and sets it on the gui + * @param setvalue the value set by the gui when used as a check + */ + void GetDynamicRange(int setvalue = -1); diff --git a/slsDetectorGui/src/qTabDeveloper.cpp b/slsDetectorGui/src/qTabDeveloper.cpp index 2d88854ee..16091379a 100644 --- a/slsDetectorGui/src/qTabDeveloper.cpp +++ b/slsDetectorGui/src/qTabDeveloper.cpp @@ -88,7 +88,7 @@ void qTabDeveloper::SetupWidgetWindow(){ dacNames.push_back("v Vtgstv:"); dacNames.push_back("v Vcmp_ll:"); dacNames.push_back("v Vcmp_lr:"); - dacNames.push_back("i cal:"); + dacNames.push_back("v cal:"); dacNames.push_back("v Vcmp_rl:"); dacNames.push_back("v rxb_rb:"); dacNames.push_back("v rxb_lb:"); @@ -260,7 +260,8 @@ void qTabDeveloper::SetDacValues(int id){ #ifdef VERBOSE cout << "Setting dac:" << dacNames[id] << " : " << spinDacs[id]->value() << endl; #endif - spinDacs[id]->setValue((double)myDet->setDAC((dacs_t)spinDacs[id]->value(),getSLSIndex(id))); + //spinDacs[id]->setValue((double)myDet->setDAC((dacs_t)spinDacs[id]->value(),getSLSIndex(id))); + myDet->setDAC((dacs_t)spinDacs[id]->value(),getSLSIndex(id)); qDefs::checkErrorMessage(myDet,"qTabDeveloper::SetDacValues"); } diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 0b3858326..5e6952b56 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -139,8 +139,8 @@ void qTabMeasurement::SetupTimingMode(){ item[(int)Gated_Start]->setEnabled(true); break; case slsDetectorDefs::EIGER: - item[(int)Trigger_Exp_Series]->setEnabled(false);/**not implemented yet*/ - item[(int)Trigger_Readout]->setEnabled(false); + item[(int)Trigger_Exp_Series]->setEnabled(true); + item[(int)Trigger_Readout]->setEnabled(true); item[(int)Gated]->setEnabled(true); item[(int)Gated_Start]->setEnabled(false); break; @@ -638,36 +638,38 @@ void qTabMeasurement::SetTimingMode(int mode){ if(myDet->setExternalCommunicationMode(slsDetectorDefs::AUTO_TIMING)==slsDetectorDefs::AUTO_TIMING) success = true; break; - case Trigger_Exp_Series://#Frames, #Triggers, ExpTime, Period, Delay - if(detType == slsDetectorDefs::EIGER)//more than 1 frame per trigger yet to be implemented - spinNumFrames->setValue(1); + case Trigger_Exp_Series://#(Frames), #Triggers, ExpTime, Period, (Delay) + if(detType == slsDetectorDefs::EIGER) //only 1 frame for each trigger for eiger + spinNumFrames->setValue(1); else{ - lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); + lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); + lblDelay->setEnabled(true); spinDelay->setEnabled(true); comboDelayUnit->setEnabled(true); + lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true); } lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true); - lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true); lblNumTriggers->setEnabled(true); spinNumTriggers->setEnabled(true); - lblDelay->setEnabled(true); spinDelay->setEnabled(true); comboDelayUnit->setEnabled(true); if(myDet->setExternalCommunicationMode(slsDetectorDefs::TRIGGER_EXPOSURE)==slsDetectorDefs::TRIGGER_EXPOSURE) success = true; break; - case Trigger_Readout://#Frames, ExpTime, Period, Delay + case Trigger_Readout://#Frames, ExpTime, Period, (Delay) + if(detType != slsDetectorDefs::EIGER){ + lblDelay->setEnabled(true); spinDelay->setEnabled(true); comboDelayUnit->setEnabled(true); + } spinNumTriggers->setValue(1); lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true); lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true); - lblDelay->setEnabled(true); spinDelay->setEnabled(true); comboDelayUnit->setEnabled(true); if(myDet->setExternalCommunicationMode(slsDetectorDefs::TRIGGER_READOUT)==slsDetectorDefs::TRIGGER_READOUT) success = true; break; - case Gated://#Frames, #Gates - spinNumTriggers->setValue(1); - if(detType == slsDetectorDefs::EIGER)//more than 1 frame per trigger yet to be implemented - spinNumGates->setValue(1); - else{ - lblNumGates->setEnabled(true); spinNumGates->setEnabled(true); + case Gated://#Frames, #(Gates) + if(detType != slsDetectorDefs::EIGER){ + lblNumGates->setEnabled(true); spinNumGates->setEnabled(true); } + spinNumTriggers->setValue(1); lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); + + if(myDet->setExternalCommunicationMode(slsDetectorDefs::GATE_FIX_NUMBER)==slsDetectorDefs::GATE_FIX_NUMBER) success = true; break; diff --git a/slsDetectorGui/src/qTabSettings.cpp b/slsDetectorGui/src/qTabSettings.cpp index b78e6b2cb..e886bc9ba 100644 --- a/slsDetectorGui/src/qTabSettings.cpp +++ b/slsDetectorGui/src/qTabSettings.cpp @@ -23,8 +23,6 @@ qTabSettings::qTabSettings(QWidget *parent,multiSlsDetector*& detector): item[i]=0; setupUi(this); SetupWidgetWindow(); - Initialization(); - } //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -54,21 +52,52 @@ void qTabSettings::SetupWidgetWindow(){ spinNumModules->setMaximum(myDet->getMaxNumberOfModules()); spinNumModules->setValue(myDet->setNumberOfModules()); + Initialization(); + // Dynamic Range - switch(myDet->setDynamicRange(-1)){ + GetDynamicRange(); + + qDefs::checkErrorMessage(myDet,"qTabSettings::SetupWidgetWindow"); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabSettings::GetDynamicRange(int setvalue){ +#ifdef VERBOSE + cout << "Getting dynamic range" << endl; +#endif + int ret = myDet->setDynamicRange(-1); + if(detType == slsDetectorDefs::MYTHEN) + if(ret==24) + ret=32; + else if(ret==24) + cout<<"ret:"<setCurrentIndex(0); break; - case 24: 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; } - - qDefs::checkErrorMessage(myDet,"qTabSettings::SetupWidgetWindow"); + connect(comboDynamicRange, SIGNAL(activated(int)), this, SLOT(SetDynamicRange(int))); } + //------------------------------------------------------------------------------------------------------------------------------------------------- + void qTabSettings::SetupDetectorSettings(){ // Get detector settings from detector slsDetectorDefs::detectorSettings sett = myDet->getSettings(); @@ -200,34 +229,20 @@ void qTabSettings::SetNumberOfModules(int index){ void qTabSettings::SetDynamicRange(int index){ - int ret,dr; + int dr; switch (index) { - case 0: dr=32; break; + case 0: dr=32; break; case 1: dr=16; break; case 2: dr=8; break; case 3: dr=4; break; default: dr=32; break; } - ret=myDet->setDynamicRange(dr); - if((ret==24)&&(dr==32)) dr = ret; + myDet->setDynamicRange(dr); #ifdef VERBOSE cout << "Setting dynamic range to "<< dr << endl; #endif - if(ret!=dr){ - qDefs::Message(qDefs::WARNING,"Dynamic Range cannot be set to this value.","qTabSettings::SetDynamicRange"); -#ifdef VERBOSE - cout << "ERROR: Setting dynamic range to "<< ret << endl; -#endif - switch(ret){ - case 32: comboDynamicRange->setCurrentIndex(0); break; - case 24: 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; - } - } - + //check + GetDynamicRange(dr); qDefs::checkErrorMessage(myDet,"qTabSettings::SetDynamicRange"); } @@ -263,7 +278,6 @@ void qTabSettings::Refresh(){ disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int))); disconnect(spinNumModules, SIGNAL(valueChanged(int)), this, SLOT(SetNumberOfModules(int))); - disconnect(comboDynamicRange, SIGNAL(activated(int)), this, SLOT(SetDynamicRange(int))); disconnect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy())); @@ -278,18 +292,7 @@ void qTabSettings::Refresh(){ spinNumModules->setValue(numMod); // Dynamic Range -#ifdef VERBOSE - cout << "Getting dynamic range" << endl; -#endif - switch(myDet->setDynamicRange(-1)){ - case 32: comboDynamicRange->setCurrentIndex(0); break; - case 24: 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; - } - + GetDynamicRange(); // Settings #ifdef VERBOSE @@ -319,7 +322,6 @@ void qTabSettings::Refresh(){ connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int))); connect(spinNumModules, SIGNAL(valueChanged(int)), this, SLOT(SetNumberOfModules(int))); - connect(comboDynamicRange, SIGNAL(activated(int)), this, SLOT(SetDynamicRange(int))); connect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy())); #ifdef VERBOSE From 7c58d3db468280b2a022316ffdf418ef9fc3313d Mon Sep 17 00:00:00 2001 From: Maliakal Dhanya Date: Fri, 11 Jul 2014 12:56:11 +0200 Subject: [PATCH 276/332] enabling 10Gbe for eiger, advanced settings and also mV for dacs for all detectors --- slsDetectorGui/forms/form_tab_dataoutput.ui | 200 +++++++++++--------- slsDetectorGui/include/qTabDataOutput.h | 3 + slsDetectorGui/include/qTabDeveloper.h | 1 + slsDetectorGui/src/qTabAdvanced.cpp | 20 +- slsDetectorGui/src/qTabDataOutput.cpp | 37 ++++ slsDetectorGui/src/qTabDeveloper.cpp | 70 ++++--- 6 files changed, 204 insertions(+), 127 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_dataoutput.ui b/slsDetectorGui/forms/form_tab_dataoutput.ui index 6e3dbd168..9d700034d 100644 --- a/slsDetectorGui/forms/form_tab_dataoutput.ui +++ b/slsDetectorGui/forms/form_tab_dataoutput.ui @@ -49,23 +49,13 @@ 15 25 701 - 141 + 66 3 - - - - false - - - Angular Conversion - - - @@ -107,55 +97,6 @@ - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 40 - 20 - - - - - - - - Discard Bad Channels - - - - - - - false - - - Auto - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 40 - 20 - - - - @@ -190,37 +131,15 @@ - - - - Qt::Horizontal + + + + false - - QSizePolicy::Fixed + + Auto - - - 40 - 20 - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 40 - 20 - - - + @@ -257,7 +176,23 @@ - + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + + Qt::Horizontal @@ -273,7 +208,71 @@ - + + + + + + 15 + 95 + 701 + 66 + + + + + 3 + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 310 + 20 + + + + + + + + Discard Bad Channels + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + + + + + false + + + Angular Conversion + + + + <nobr> @@ -287,6 +286,23 @@ Compression using Root. Available only for Gotthard in Expert Mode. + + + + false + + + <nobr> +Compression using Root. Available only for Gotthard in Expert Mode. +</nobr><br><nobr> + #r_compression# +</nobr> + + + 10GbE + + + @@ -508,8 +524,6 @@ Directory where one saves the data. radioAuto radioDeadTime spinDeadTime - chkAngular - chkDiscardBad diff --git a/slsDetectorGui/include/qTabDataOutput.h b/slsDetectorGui/include/qTabDataOutput.h index 86cfe431b..7f29b5164 100644 --- a/slsDetectorGui/include/qTabDataOutput.h +++ b/slsDetectorGui/include/qTabDataOutput.h @@ -117,6 +117,9 @@ void GetOutputDir(); /** set compression */ void SetCompression(bool enable); +/** enable 10GbE */ +void EnableTenGigabitEthernet(bool enable, int get=0); + signals: /**signal to enable/disable positions in Actions*/ void AngularConversionSignal(bool); diff --git a/slsDetectorGui/include/qTabDeveloper.h b/slsDetectorGui/include/qTabDeveloper.h index 13e1b3c04..a88499bff 100644 --- a/slsDetectorGui/include/qTabDeveloper.h +++ b/slsDetectorGui/include/qTabDeveloper.h @@ -100,6 +100,7 @@ private: QLabel *lblDacs[20]; QLabel *lblAdcs[20]; MyDoubleSpinBox *spinDacs[20]; + QLabel *lblDacsmV[20]; QDoubleSpinBox *spinAdcs[20]; QLabel *lblHV; QComboBox *comboHV; diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp index 3ce79318e..f07da9530 100644 --- a/slsDetectorGui/src/qTabAdvanced.cpp +++ b/slsDetectorGui/src/qTabAdvanced.cpp @@ -74,7 +74,15 @@ void qTabAdvanced::SetupWidgetWindow(){ detType = myDet->getDetectorsType(); switch(detType){ case slsDetectorDefs::MYTHEN: isEnergy = true; isAngular = true; break; - case slsDetectorDefs::EIGER: isEnergy = true; isAngular = false; break; + case slsDetectorDefs::EIGER: + isEnergy = true; + isAngular = false; + lblIP->setEnabled(true); + lblMAC->setEnabled(true); + dispIP->setEnabled(true); + dispMAC->setEnabled(true); + boxRxr->setEnabled(true); + break; case slsDetectorDefs::MOENCH: isEnergy = false; isAngular = false; @@ -223,7 +231,7 @@ void qTabAdvanced::Initialization(){ connect(spinStopPort, SIGNAL(valueChanged(int)), this, SLOT(SetStopPort(int))); connect(comboOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetOnline(int))); - if((detType==slsDetectorDefs::GOTTHARD) || (detType==slsDetectorDefs::MOENCH)){ + if((detType==slsDetectorDefs::GOTTHARD) || (detType==slsDetectorDefs::MOENCH) || (detType==slsDetectorDefs::EIGER)){ //network connect(spinTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int))); @@ -241,6 +249,8 @@ void qTabAdvanced::Initialization(){ //roi + + connect(btnClearRoi, SIGNAL(clicked()), this, SLOT(clearROIinDetector())); connect(btnGetRoi, SIGNAL(clicked()), this, SLOT(updateROIList())); connect(btnSetRoi, SIGNAL(clicked()), this, SLOT(setROI())); @@ -297,7 +307,7 @@ void qTabAdvanced::SetThreshold(){ #ifdef VERBOSE cout << "Setting Threshold DACu:" << spinThreshold->value() << endl; #endif - spinThreshold->setValue((double)myDet->setDAC((dacs_t)spinThreshold->value(),slsDetectorDefs::THRESHOLD)); + spinThreshold->setValue((double)myDet->setDAC((dacs_t)spinThreshold->value(),slsDetectorDefs::THRESHOLD,0)); qDefs::checkErrorMessage(myDet,"qTabAdvanced::SetThreshold"); } @@ -1122,7 +1132,7 @@ void qTabAdvanced::Refresh(){ //threshold - double threshold = (double)myDet->setDAC(-1,slsDetectorDefs::THRESHOLD); + double threshold = (double)myDet->setDAC(-1,slsDetectorDefs::THRESHOLD,0); #ifdef VERBOSE cout << "Getting Threshold DACu : " << threshold << endl; #endif @@ -1168,7 +1178,7 @@ void qTabAdvanced::Refresh(){ #ifdef VERBOSE cout << "Getting Receiver Network Information" << endl; #endif - if ((detType==slsDetectorDefs::GOTTHARD) || (detType==slsDetectorDefs::MOENCH)){ + if ((detType==slsDetectorDefs::GOTTHARD) || (detType==slsDetectorDefs::MOENCH)|| (detType==slsDetectorDefs::EIGER)){ //disconnect disconnect(spinTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int))); disconnect(spinUDPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrUDPPort(int))); diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index 63d2bff2a..9af47f7a4 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -29,6 +29,7 @@ qTabDataOutput::qTabDataOutput(QWidget *parent,multiSlsDetector*& detector): QWidget(parent),myDet(detector){ setupUi(this); SetupWidgetWindow(); + Refresh(); } @@ -54,6 +55,9 @@ void qTabDataOutput::SetupWidgetWindow(){ if((detType == slsDetectorDefs::MYTHEN)||(detType == slsDetectorDefs::GOTTHARD)) chkAngular->setEnabled(true); + if(detType == slsDetectorDefs::EIGER) + chkTenGiga->setEnabled(true); + /** error message **/ red = QPalette(); red.setColor(QPalette::Active,QPalette::WindowText,Qt::red); @@ -157,6 +161,8 @@ void qTabDataOutput::Initialization(){ connect(chkDiscardBad, SIGNAL(toggled(bool)), this, SLOT(DiscardBadChannels())); //compression connect(chkCompression, SIGNAL(toggled(bool)), this, SLOT(SetCompression(bool))); + //10GbE + connect(chkTenGiga, SIGNAL(toggled(bool)), this, SLOT(EnableTenGigabitEthernet(bool))); } @@ -735,6 +741,27 @@ void qTabDataOutput::SetCompression(bool enable){ //------------------------------------------------------------------------------------------------------------------------------------------------- +void qTabDataOutput::EnableTenGigabitEthernet(bool enable,int get){ +#ifdef VERBOSE + cout << endl << "Enabling/Disabling 10GbE" << endl; +#endif + disconnect(chkTenGiga, SIGNAL(toggled(bool)), this, SLOT(EnableTenGigabitEthernet(bool))); + int ret; + if(get) + ret = myDet->enableTenGigabitEthernet(-1); + else + ret = myDet->enableTenGigabitEthernet(enable); + if(ret > 0) chkTenGiga->setChecked(true); + else chkTenGiga->setChecked(false); + connect(chkTenGiga, SIGNAL(toggled(bool)), this, SLOT(EnableTenGigabitEthernet(bool))); + + qDefs::checkErrorMessage(myDet,"qTabDataOutput::EnableTenGigabitEthernet"); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + void qTabDataOutput::Refresh(){ #ifdef VERBOSE cout << endl << "**Updating DataOutput Tab" << endl; @@ -808,6 +835,16 @@ void qTabDataOutput::Refresh(){ GetCompression(); } + //getting 10GbE + if(chkTenGiga->isEnabled()){ +#ifdef VERBOSE + cout << "Getting 10GbE enable" << endl; +#endif + EnableTenGigabitEthernet(-1,1); + } + + + #ifdef VERBOSE cout << "**Updated DataOutput Tab" << endl << endl; diff --git a/slsDetectorGui/src/qTabDeveloper.cpp b/slsDetectorGui/src/qTabDeveloper.cpp index 16091379a..7280eb76f 100644 --- a/slsDetectorGui/src/qTabDeveloper.cpp +++ b/slsDetectorGui/src/qTabDeveloper.cpp @@ -38,6 +38,7 @@ qTabDeveloper::qTabDeveloper(QWidget *parent,multiSlsDetector*& detector): lblAdcs[i]=0; spinDacs[i]=0; spinAdcs[i]=0; + lblDacsmV[i]=0; } SetupWidgetWindow(); Initialization(); @@ -81,21 +82,23 @@ void qTabDeveloper::SetupWidgetWindow(){ NUM_ADC_WIDGETS = 0; dacNames.push_back("v SvP:"); - dacNames.push_back("v Vtr:"); + dacNames.push_back("v SvN"); dacNames.push_back("v Vrf:"); dacNames.push_back("v Vrs:"); - dacNames.push_back("v SvN"); + dacNames.push_back("v Vtr:"); dacNames.push_back("v Vtgstv:"); - dacNames.push_back("v Vcmp_ll:"); - dacNames.push_back("v Vcmp_lr:"); dacNames.push_back("v cal:"); - dacNames.push_back("v Vcmp_rl:"); - dacNames.push_back("v rxb_rb:"); - dacNames.push_back("v rxb_lb:"); - dacNames.push_back("v Vcmp_rr:"); dacNames.push_back("v Vcp"); dacNames.push_back("v Vcn:"); dacNames.push_back("v Vis:"); + dacNames.push_back("v rxb_lb:"); + dacNames.push_back("v rxb_rb:"); + dacNames.push_back("v Vcmp_ll:"); + dacNames.push_back("v Vcmp_lr:"); + dacNames.push_back("v Vcmp_rl:"); + dacNames.push_back("v Vcmp_rr:"); + + break; case slsDetectorDefs::GOTTHARD: @@ -218,13 +221,16 @@ void qTabDeveloper::CreateDACWidgets(){ lblDacs[i] = new QLabel(QString(dacNames[i].c_str()),boxDacs); spinDacs[i] = new MyDoubleSpinBox(i,boxDacs); spinDacs[i]->setMaximum(10000); + lblDacsmV[i]= new QLabel("",boxDacs); - dacLayout->addWidget(lblDacs[i],(int)(i/2),((i%2)==0)?1:4); - dacLayout->addWidget(spinDacs[i],(int)(i/2),((i%2)==0)?2:5); + + dacLayout->addWidget(lblDacs[i],(int)(i/2),((i%2)==0)?1:5); + dacLayout->addWidget(spinDacs[i],(int)(i/2),((i%2)==0)?2:6); + dacLayout->addWidget(lblDacsmV[i],(int)(i/2),((i%2)==0)?3:7); if(!(i%2)){ dacLayout->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed),(int)(i/2),0); - dacLayout->addItem(new QSpacerItem(60,20,QSizePolicy::Fixed,QSizePolicy::Fixed),(int)(i/2),3); - dacLayout->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed),(int)(i/2),6); + dacLayout->addItem(new QSpacerItem(60,20,QSizePolicy::Fixed,QSizePolicy::Fixed),(int)(i/2),4); + dacLayout->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed),(int)(i/2),8); } } } @@ -261,7 +267,8 @@ void qTabDeveloper::SetDacValues(int id){ cout << "Setting dac:" << dacNames[id] << " : " << spinDacs[id]->value() << endl; #endif //spinDacs[id]->setValue((double)myDet->setDAC((dacs_t)spinDacs[id]->value(),getSLSIndex(id))); - myDet->setDAC((dacs_t)spinDacs[id]->value(),getSLSIndex(id)); + myDet->setDAC((dacs_t)spinDacs[id]->value(),getSLSIndex(id),0); + lblDacsmV[id]->setText(QString("%1mV").arg(myDet->setDAC(-1,getSLSIndex(id),1),-10)); qDefs::checkErrorMessage(myDet,"qTabDeveloper::SetDacValues"); } @@ -275,7 +282,7 @@ void qTabDeveloper::SetHighVoltage(){ cout << "Setting high voltage:" << comboHV->currentText().toAscii().constData() << endl; #endif int highvoltage = comboHV->currentText().toInt(); - int ret = myDet->setDAC(highvoltage,slsDetectorDefs::HV_POT); + int ret = myDet->setDAC(highvoltage,slsDetectorDefs::HV_POT,0); qDefs::checkErrorMessage(myDet,"qTabDeveloper::SetHighVoltage"); //error if(ret != highvoltage){ @@ -317,21 +324,24 @@ slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(int index){ case slsDetectorDefs::EIGER: switch(index){ case 0: return slsDetectorDefs::E_SvP; - case 1: return slsDetectorDefs::E_Vtr; + case 1: return slsDetectorDefs::E_SvN; case 2: return slsDetectorDefs::E_Vrf; case 3: return slsDetectorDefs::E_Vrs; - case 4: return slsDetectorDefs::E_SvN; + case 4: return slsDetectorDefs::E_Vtr; case 5: return slsDetectorDefs::E_Vtgstv; - case 6: return slsDetectorDefs::E_Vcmp_ll; - case 7: return slsDetectorDefs::E_Vcmp_lr; - case 8: return slsDetectorDefs::E_cal; - case 9: return slsDetectorDefs::E_Vcmp_rl; - case 10:return slsDetectorDefs::E_rxb_rb; - case 11:return slsDetectorDefs::E_rxb_lb; - case 12:return slsDetectorDefs::E_Vcmp_rr; - case 13:return slsDetectorDefs::E_Vcp; - case 14:return slsDetectorDefs::E_Vcn; - case 15:return slsDetectorDefs::E_Vis; + case 6: return slsDetectorDefs::E_cal; + case 7: return slsDetectorDefs::E_Vcp; + case 8: return slsDetectorDefs::E_Vcn; + case 9: return slsDetectorDefs::E_Vis; + case 10:return slsDetectorDefs::E_rxb_lb; + case 11:return slsDetectorDefs::E_rxb_rb; + case 12:return slsDetectorDefs::E_Vcmp_ll; + case 13:return slsDetectorDefs::E_Vcmp_lr; + case 14:return slsDetectorDefs::E_Vcmp_rl; + case 15:return slsDetectorDefs::E_Vcmp_rr; + + + default: qDefs::Message(qDefs::CRITICAL,"Unknown DAC/ADC Index. Weird Error","qTabDeveloper::getSLSIndex"); Refresh(); @@ -394,8 +404,10 @@ void qTabDeveloper::Refresh(){ cout << "Gettings DACs" << endl; #endif //dacs - for(int i=0;isetValue((double)myDet->setDAC(-1,getSLSIndex(i))); + for(int i=0;isetValue((double)myDet->setDAC(-1,getSLSIndex(i),0)); + lblDacsmV[i]->setText(QString("%1mV").arg(myDet->setDAC(-1,getSLSIndex(i),1),-10)); + } //adcs if(NUM_ADC_WIDGETS) RefreshAdcs(); @@ -409,7 +421,7 @@ void qTabDeveloper::Refresh(){ lblHV->setToolTip(tipHV); comboHV->setToolTip(tipHV); //getting hv value - int ret = (int)myDet->setDAC(-1,slsDetectorDefs::HV_POT); + int ret = (int)myDet->setDAC(-1,slsDetectorDefs::HV_POT,0); switch(ret){ case 0: comboHV->setCurrentIndex(0);break; case 90: comboHV->setCurrentIndex(1);break; From 8a26eef0bff6a5dfef0679bd2efd0607086586b4 Mon Sep 17 00:00:00 2001 From: Maliakal Dhanya Date: Thu, 31 Jul 2014 12:14:09 +0200 Subject: [PATCH 277/332] scans for 2d detectors should read every frame --- slsDetectorGui/src/qTabPlot.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index 4eb9ce8e8..1a15a59a0 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -737,6 +737,18 @@ void qTabPlot::EnableScanBox(bool Histo){ boxScan->setChecked(false); boxScan->setEnabled(false); + //2d scans read every frame, not compulsory, but for historgrams + if((!isOriginallyOneD) && (mode0 || mode1)){ + //read every frame + disconnect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency())); + disconnect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency())); + comboFrequency->setCurrentIndex(1); + spinNthFrame->setValue(1); + SetFrequency(); + connect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency())); + connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency())); + } + //persistency, accumulate, pedestal, binary if(angConvert){ if(chkSuperimpose->isChecked()) chkSuperimpose->setChecked(false); From c33657f04dafc2de92b3c278e1563688b4a4ea30 Mon Sep 17 00:00:00 2001 From: Maliakal Dhanya Date: Tue, 5 Aug 2014 11:30:36 +0200 Subject: [PATCH 278/332] histogram for 2d and s curves --- slsDetectorGui/forms/form_tab_plot.ui | 118 ++++++++++++++++ slsDetectorGui/include/qDefs.h | 11 ++ slsDetectorGui/include/qDrawPlot.h | 5 +- slsDetectorGui/include/qTabPlot.h | 6 +- slsDetectorGui/src/qDrawPlot.cpp | 54 ++++++- slsDetectorGui/src/qTabPlot.cpp | 193 ++++++++++++++++++++------ 6 files changed, 334 insertions(+), 53 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index 1a5404f05..f50abeb2b 100644 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -2765,6 +2765,123 @@ Interval between plots has 2 modes. A condition to be satisfied, in order to avo true + + + + 410 + 5 + 351 + 51 + + + + Histogram - X Axis Values + + + false + + + false + + + + + 10 + 20 + 351 + 26 + + + + + 0 + + + + + + 0 + 0 + + + + <nobr>Enabled only when there is a Scan Level 0</nobr> + + + Intensity + + + true + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 7 + 10 + + + + + + + + + 0 + 0 + + + + <nobr>Enabled only when there is a Scan Level 1</nobr> + + + Level 0 + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 7 + 10 + + + + + + + + + 0 + 0 + + + + <nobr>Enabled only when there is a Scan Level 0 or a Scan Level 1, not both</nobr> + + + Level 1 + + + + + + box1D box2D boxSave @@ -2775,6 +2892,7 @@ Interval between plots has 2 modes. A condition to be satisfied, in order to avo boxSnapshot btnRight btnLeft + boxHistogram radioNoPlot diff --git a/slsDetectorGui/include/qDefs.h b/slsDetectorGui/include/qDefs.h index 497a809ba..badb9425d 100644 --- a/slsDetectorGui/include/qDefs.h +++ b/slsDetectorGui/include/qDefs.h @@ -281,6 +281,17 @@ static const int64_t GUI_VERSION=0x20121213; }; +//------------------------------------------------------------------------------------------------------------------------------------------------- + + + /** histogram arguments*/ + enum histogramArgumentList{ + Intensity, + histLevel0, + histLevel1 + }; + + //------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index c2210faed..f8266e517 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -143,7 +143,7 @@ public: void SetBinary(bool enable, int from=0, int to=0); /** Enable/Disable Histogram */ - void SetHistogram(bool enable,int min=0, int max=0, int size=0){histogram = enable;histFrom=min;histTo=max;histSize=size;}; + void SetHistogram(bool enable,int histArg, int min=0, int max=0, int size=0){histogram = enable;histogramArgument = histArg; histFrom=min;histTo=max;histSize=size;}; public slots: /** To select 1D or 2D plot @@ -494,6 +494,9 @@ bool isTriggerEnabled; /** scan arguments*/ int scanArgument; +/** histogram arguments*/ +int histogramArgument; + /** enable angle plot */ bool anglePlot; /** prevents err msg displaying twice when detector stopped, "transmitting" */ diff --git a/slsDetectorGui/include/qTabPlot.h b/slsDetectorGui/include/qTabPlot.h index 58f23a451..016f130d6 100644 --- a/slsDetectorGui/include/qTabPlot.h +++ b/slsDetectorGui/include/qTabPlot.h @@ -71,6 +71,7 @@ private: QComboBox *comboTimeGapUnit; QButtonGroup *btnGroupScan; QButtonGroup *btnGroupPlotType; + QButtonGroup *btnGroupHistogram; /** some Default Values */ static QString defaultPlotTitle; @@ -105,7 +106,7 @@ public slots: /** Enable Scan box */ - void EnableScanBox(bool Histo=false); + void EnableScanBox(); private slots: @@ -147,6 +148,9 @@ private slots: /** Plot binary plot */ void SetBinary(); + /** Set histogram options */ + void SetHistogramOptions(); + signals: void DisableZoomSignal(bool); void SetZRangeSignal(double,double); diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 28ab07d52..076e24c7b 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -168,6 +168,7 @@ void qDrawPlot::SetupWidgetWindow(){ isTriggerEnabled = false; scanArgument = qDefs::None; + histogramArgument = qDefs::Intensity; anglePlot = false; alreadyDisplayed = false; @@ -600,7 +601,7 @@ void qDrawPlot::SetScanArgument(int scanArg){ int max = (iloop+1)*histSize + histFrom; while(min < histTo){ histogramSamples.resize(iloop+1); - histogramSamples[iloop].interval.setInterval(min,max); + histogramSamples[iloop].interval.setInterval(min,max-1); histogramSamples[iloop].value = 0; iloop++; min = max; @@ -974,15 +975,56 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){ if(originally2D) numValues = nPixelsX*nPixelsY; + //clean up graph + if(histogramArgument == qDefs::Intensity){ + for(int j=0;jvalues[i] <= histFrom) || (data->values[i] >= histTo)) + continue; + //check for intervals, increment if validates + for(int j=0;jvalues[i])) + histogramSamples[j].value += 1; + + } + } + //get sum of data pixels + else + val += data->values[i]; + + } + + + if(histogramArgument != qDefs::Intensity){ + val /= numValues; + + //find scan value + int ci = 0, fi = 0; double cs0 = 0 , cs1 = 0; + fileIOStatic::getVariablesFromFileName(string(data->fileName), ci, fi, cs0, cs1); + + int scanval=-1; + if(cs0 != -1) + scanval = cs0; + else scanval = cs1; + //ignore outside limits - if ((data->values[i] <= histFrom) || (data->values[i] >= histTo)) - continue; + if ((scanval <= histFrom) || (scanval >= histTo) || (scanval == -1)) + scanval = -1; //check for intervals, increment if validates for(int j=0;jvalues[i])) - histogramSamples[j].value += 1; - + if(histogramSamples[j].interval.contains(scanval)){ + histogramSamples[j].value = val; + cout << "j:"<addButton(radioDataGraph,1); btnGroupPlotType->addButton(radioHistogram,2); +//histogram arguments + btnGroupHistogram = new QButtonGroup(this); + btnGroupHistogram->addButton(radioHistIntensity,0); + btnGroupHistogram->addButton(radioHistLevel0,1); + btnGroupHistogram->addButton(radioHistLevel1,2); + // Plot Axis dispTitle->setEnabled(false); dispXAxis->setEnabled(false); @@ -181,6 +188,9 @@ void qTabPlot::SetupWidgetWindow(){ //to check if this should be enabled EnableScanBox(); + //disable histogram initially + boxHistogram->hide(); + qDefs::checkErrorMessage(myDet,"qTabPlot::SetupWidgetWindow"); } @@ -273,6 +283,8 @@ void qTabPlot::Select1DPlot(bool b){ void qTabPlot::Initialization(){ // Plot arguments box connect(btnGroupPlotType,SIGNAL(buttonClicked(int)),this, SLOT(SetPlot())); +// Histogram arguments box + connect(btnGroupHistogram,SIGNAL(buttonClicked(int)),this, SLOT(SetHistogramOptions())); // Scan box connect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox())); // Snapshot box @@ -522,14 +534,20 @@ void qTabPlot::SetPlot(){ if(radioNoPlot->isChecked()){ cout << " - No Plot" << endl; + boxScan->show(); + boxHistogram->hide(); myPlot->EnablePlot(false); boxSnapshot->setEnabled(false); boxSave->setEnabled(false); boxFrequency->setEnabled(false); boxPlotAxis->setEnabled(false); boxScan->setEnabled(false); + }else if(radioDataGraph->isChecked()){ cout << " - DataGraph" << endl; + + boxScan->show(); + boxHistogram->hide(); myPlot->EnablePlot(true); Select1DPlot(isOriginallyOneD); boxSnapshot->setEnabled(true); @@ -538,6 +556,8 @@ void qTabPlot::SetPlot(){ boxPlotAxis->setEnabled(true); if(!myPlot->isRunning()) EnableScanBox(); + // To remind the updateplot in qdrawplot to set range after updating plot + myPlot->SetXYRange(true); } else{ //histogram and 2d scans dont work @@ -545,10 +565,20 @@ void qTabPlot::SetPlot(){ qDefs::Message(qDefs::WARNING,"Histogram cannot be used together with 2D Scan Plots.
" "Uncheck 2D Scan plots to plot Histograms", "qTabPlot::SetPlot"); radioDataGraph->setChecked(true); + boxScan->show(); + boxHistogram->hide(); return; } cout << " - Histogram" << endl; + + if(radioHistIntensity->isChecked()) + pageHistogram->setEnabled(true); + else + pageHistogram->setEnabled(false); + + boxScan->hide(); + boxHistogram->show(); myPlot->EnablePlot(true); Select1DPlot(isOriginallyOneD); boxSnapshot->setEnabled(true); @@ -556,7 +586,7 @@ void qTabPlot::SetPlot(){ boxFrequency->setEnabled(true); boxPlotAxis->setEnabled(true); if(!myPlot->isRunning()) - EnableScanBox(true); + EnableScanBox(); qDefs::Message(qDefs::INFORMATION,"Please check the Plot Histogram Options below " "before Starting Acquitision","qTabPlot::SetPlot"); } @@ -707,15 +737,18 @@ void qTabPlot::SetFrequency(){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void qTabPlot::EnableScanBox(bool Histo){ +void qTabPlot::EnableScanBox(){ #ifdef VERBOSE - cout << "Entering Enable Scan Box, Histo:" << Histo << endl; + cout << "Entering Enable Scan Box"<< endl; #endif disconnect(btnGroupPlotType,SIGNAL(buttonClicked(int)),this, SLOT(SetPlot())); disconnect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox())); int mode0 = myDet->getScanMode(0); int mode1 = myDet->getScanMode(1); + + radioHistLevel0->setEnabled(mode0); + radioHistLevel1->setEnabled(mode1); int ang; bool angConvert = myDet->getAngularConversion(ang); myPlot->EnableAnglePlot(angConvert); @@ -732,6 +765,9 @@ void qTabPlot::EnableScanBox(bool Histo){ chkBinary_2->setEnabled(true); } + + + //if angle plot or originally 2d, uncheck and disable scanbox if ((angConvert) || (!isOriginallyOneD)){ boxScan->setChecked(false); @@ -766,18 +802,23 @@ void qTabPlot::EnableScanBox(bool Histo){ pageAccumulate_2->setEnabled(false); } - - if(angConvert){ boxScan->setToolTip("Only 1D Plots enabled for Angle Plots"); //disable histogram if(radioHistogram->isChecked()){ radioDataGraph->setChecked(true); radioHistogram->setEnabled(false); + // To remind the updateplot in qdrawplot to set range after updating plot + myPlot->SetXYRange(true); + boxScan->show(); + boxHistogram->hide(); } } } + + + //originally1d && not angle plot else{ boxScan->setToolTip(""); @@ -787,6 +828,16 @@ void qTabPlot::EnableScanBox(bool Histo){ //2d enabled with boxscan if(boxScan->isChecked()){ + + //2d for 1d detctors and histogram dont go + if(radioHistogram->isChecked()){ + radioDataGraph->setChecked(true); + // To remind the updateplot in qdrawplot to set range after updating plot + myPlot->SetXYRange(true); + boxScan->show(); + boxHistogram->hide(); + } + //read every frame disconnect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency())); disconnect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency())); @@ -814,12 +865,10 @@ void qTabPlot::EnableScanBox(bool Histo){ //histogram if(radioHistogram->isChecked()){ - //switch back to datagraph - if(!Histo) - radioDataGraph->setChecked(true); - - pageHistogram->setEnabled(true); - pageHistogram_2->setEnabled(true); + if(radioHistIntensity->isChecked()) + pageHistogram->setEnabled(true); + else + pageHistogram->setEnabled(false); stackedWidget->setCurrentIndex(stackedWidget->count()-1); stackedWidget_2->setCurrentIndex(stackedWidget_2->count()-1); box1D->setTitle(QString("1D Plot Options %1 - Histogram").arg(stackedWidget->currentIndex()+1)); @@ -851,7 +900,7 @@ void qTabPlot::EnableScanBox(bool Histo){ }else{ pageHistogram->setEnabled(false); - pageHistogram_2->setEnabled(false); + /*pageHistogram_2->setEnabled(false);*/ } connect(btnGroupPlotType,SIGNAL(buttonClicked(int)),this, SLOT(SetPlot())); @@ -888,9 +937,49 @@ void qTabPlot::SetScanArgument(){ //histogram default - set before setscanargument - myPlot->SetHistogram(radioHistogram->isChecked(),spinHistFrom->value(),spinHistTo->value(),spinHistSize->value()); + int min = spinHistFrom->value(); + int max = spinHistTo->value(); + int size = spinHistSize->value(); + int histArg = qDefs::Intensity; if(radioHistogram->isChecked()){ - dispXAxis->setText("Intensity"); + if(!radioHistIntensity->isChecked()){ + + int mode = 0; + histArg = qDefs::histLevel0; + if(radioHistLevel1->isChecked()){ + mode = 1; + histArg = qDefs::histLevel1; + } + + + int numSteps = myDet->getScanSteps(mode); + double *values = NULL; + min = 0;max = 1;size = 1; + + if(numSteps > 0){ + values = new double[numSteps]; + myDet->getScanSteps(mode,values); + min = values[0]; + max = values[numSteps - 1]; + size = (max - min)/(numSteps - 1); + min -= (size/2); + max += (size/2); + } + } + + } + + cout <<"min:"<SetHistogram(radioHistogram->isChecked(),histArg,min,max,size); + + + if(radioHistogram->isChecked()){ + if(radioHistIntensity->isChecked()) + dispXAxis->setText("Intensity"); + else if (radioHistLevel0->isChecked()) + dispXAxis->setText("Level 0"); + else + dispXAxis->setText("Level 1"); dispYAxis->setText("Frequency"); myPlot->SetHistXAxisTitle("Intensity"); myPlot->SetHistYAxisTitle("Frequency"); @@ -941,36 +1030,6 @@ void qTabPlot::SetScanArgument(){ } -//------------------------------------------------------------------------------------------------------------------------------------------------- - -void qTabPlot::Refresh(){ -#ifdef VERBOSE - cout << endl << "**Updating Plot Tab" << endl; -#endif - if(!myPlot->isRunning()){ - if (!radioNoPlot->isChecked()) - boxFrequency->setEnabled(true); - connect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox())); - EnableScanBox(true); - SetFrequency(); - - }else{ - boxFrequency->setEnabled(false); - disconnect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox())); - boxScan->setEnabled(false); - pageHistogram->setEnabled(false); - pageHistogram_2->setEnabled(false); - if(radioHistogram->isChecked()) - radioDataGraph->setEnabled(false); - else - radioHistogram->setEnabled(false); - } -#ifdef VERBOSE - cout << "**Updated Plot Tab" << endl << endl; -#endif -} - - //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -1025,3 +1084,47 @@ void qTabPlot::SetBinary(){ //------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabPlot::SetHistogramOptions(){ + if(radioHistIntensity->isChecked()){ + pageHistogram->setEnabled(true); + }else { + pageHistogram->setEnabled(false); + } +} + + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabPlot::Refresh(){ +#ifdef VERBOSE + cout << endl << "**Updating Plot Tab" << endl; +#endif + if(!myPlot->isRunning()){ + if (!radioNoPlot->isChecked()) + boxFrequency->setEnabled(true); + connect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox())); + EnableScanBox(); + SetFrequency(); + + }else{ + boxFrequency->setEnabled(false); + disconnect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox())); + boxScan->setEnabled(false); + pageHistogram->setEnabled(false); + if(radioHistogram->isChecked()) + radioDataGraph->setEnabled(false); + else + radioHistogram->setEnabled(false); + } +#ifdef VERBOSE + cout << "**Updated Plot Tab" << endl << endl; +#endif +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + From 705a25c9e0f31bfe1794d5563a89f43af4e9ad88 Mon Sep 17 00:00:00 2001 From: Maliakal Dhanya Date: Fri, 29 Aug 2014 16:42:26 +0200 Subject: [PATCH 279/332] fixed moench dac error --- slsDetectorGui/gitInfo.txt | 12 ++++++------ slsDetectorGui/include/gitInfoGui.h | 8 ++++---- slsDetectorGui/src/qTabDeveloper.cpp | 27 ++++++++++++++++++++++++--- 3 files changed, 34 insertions(+), 13 deletions(-) diff --git a/slsDetectorGui/gitInfo.txt b/slsDetectorGui/gitInfo.txt index 129a7e955..0d8074016 100644 --- a/slsDetectorGui/gitInfo.txt +++ b/slsDetectorGui/gitInfo.txt @@ -1,9 +1,9 @@ -Path: slsDetectorsPackage/slsDetectorGui +Path: slsDetectorsPackage/calibrationWizards URL: origin git@gitorious.psi.ch:sls_det_software/sls_detector_gui.git Repository Root: origin git@gitorious.psi.ch:sls_det_software/sls_detector_gui.git -Repsitory UUID: 8d8e3f9221be0f85c016a7d48e5d1abed5fdcc95 -Revision: 272 -Branch: separate_receiver +Repsitory UUID: f2467753988c780455e50953db2cb6b4e643e704 +Revision: 278 +Branch: master Last Changed Author: Maliakal_Dhanya -Last Changed Rev: 272 -Last Changed Date: 2014-06-03 12:07:35 +0200 +Last Changed Rev: 278 +Last Changed Date: 2014-08-05 11:30:36 +0200 diff --git a/slsDetectorGui/include/gitInfoGui.h b/slsDetectorGui/include/gitInfoGui.h index ae315cd41..ead14bc8a 100644 --- a/slsDetectorGui/include/gitInfoGui.h +++ b/slsDetectorGui/include/gitInfoGui.h @@ -1,11 +1,11 @@ //#define SVNPATH "" #define SVNURL "git@gitorious.psi.ch:sls_det_software/sls_detector_gui.git" //#define SVNREPPATH "" -#define SVNREPUUID "8d8e3f9221be0f85c016a7d48e5d1abed5fdcc95" -//#define SVNREV 0x272 +#define SVNREPUUID "f2467753988c780455e50953db2cb6b4e643e704" +//#define SVNREV 0x278 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "Maliakal_Dhanya" -#define SVNREV 0x272 -#define SVNDATE 0x20140603 +#define SVNREV 0x278 +#define SVNDATE 0x20140805 // diff --git a/slsDetectorGui/src/qTabDeveloper.cpp b/slsDetectorGui/src/qTabDeveloper.cpp index 7280eb76f..e2470b20a 100644 --- a/slsDetectorGui/src/qTabDeveloper.cpp +++ b/slsDetectorGui/src/qTabDeveloper.cpp @@ -316,7 +316,7 @@ slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(int index){ case 4: return slsDetectorDefs::CALIBRATION_PULSE; case 5: return slsDetectorDefs::PREAMP; default: - qDefs::Message(qDefs::CRITICAL,"Unknown DAC/ADC Index. Weird Error","qTabDeveloper::getSLSIndex"); + qDefs::Message(qDefs::CRITICAL,"Unknown DAC/ADC Index. Weird Error Index:"+ index,"qTabDeveloper::getSLSIndex"); Refresh(); break; } @@ -343,12 +343,31 @@ slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(int index){ default: - qDefs::Message(qDefs::CRITICAL,"Unknown DAC/ADC Index. Weird Error","qTabDeveloper::getSLSIndex"); + qDefs::Message(qDefs::CRITICAL,"Unknown DAC/ADC Index. Weird Error Index:"+ index,"qTabDeveloper::getSLSIndex"); Refresh(); break; } break; case slsDetectorDefs::MOENCH: + switch(index){ + case 0: return slsDetectorDefs::V_DAC0; + case 1: return slsDetectorDefs::V_DAC1; + case 2: return slsDetectorDefs::V_DAC2; + case 3: return slsDetectorDefs::V_DAC3; + case 4: return slsDetectorDefs::V_DAC4; + case 5: return slsDetectorDefs::V_DAC5; + case 6: return slsDetectorDefs::V_DAC6; + case 7: return slsDetectorDefs::V_DAC7; + case 8: return slsDetectorDefs::TEMPERATURE_ADC; + case 9:return slsDetectorDefs::TEMPERATURE_FPGA; + + default: + qDefs::Message(qDefs::CRITICAL,"Unknown DAC/ADC Index. Weird Error. Index:"+ index,"qTabDeveloper::getSLSIndex"); + Refresh(); + break; + } + break; + case slsDetectorDefs::GOTTHARD: switch(index){ case 0: return slsDetectorDefs::G_VREF_DS; @@ -362,7 +381,7 @@ slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(int index){ case 8: return slsDetectorDefs::TEMPERATURE_ADC; case 9:return slsDetectorDefs::TEMPERATURE_FPGA; default: - qDefs::Message(qDefs::CRITICAL,"Unknown DAC/ADC Index. Weird Error","qTabDeveloper::getSLSIndex"); + qDefs::Message(qDefs::CRITICAL,"Unknown DAC/ADC Index. Weird Error Index:"+ index,"qTabDeveloper::getSLSIndex"); Refresh(); break; } @@ -387,6 +406,7 @@ void qTabDeveloper::RefreshAdcs(){ adcTimer->stop(); for(int i=0;isetValue((double)myDet->getADC(getSLSIndex(i+NUM_DAC_WIDGETS))); + adcTimer->start(ADC_TIMEOUT); qDefs::checkErrorMessage(myDet,"qTabDeveloper::RefreshAdcs"); } @@ -404,6 +424,7 @@ void qTabDeveloper::Refresh(){ cout << "Gettings DACs" << endl; #endif //dacs + for(int i=0;isetValue((double)myDet->setDAC(-1,getSLSIndex(i),0)); lblDacsmV[i]->setText(QString("%1mV").arg(myDet->setDAC(-1,getSLSIndex(i),1),-10)); From 0d66e62d107978ec858aa27880682d52e36dfe18 Mon Sep 17 00:00:00 2001 From: Maliakal Dhanya Date: Tue, 9 Sep 2014 15:46:36 +0200 Subject: [PATCH 280/332] fixed histogram for trimbits and threshold --- slsDetectorGui/include/qDrawPlot.h | 4 +-- slsDetectorGui/src/qDrawPlot.cpp | 49 +++++++++++++++++++----------- slsDetectorGui/src/qTabPlot.cpp | 27 ++++++++++------ 3 files changed, 52 insertions(+), 28 deletions(-) diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index f8266e517..2b09e840e 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -143,7 +143,7 @@ public: void SetBinary(bool enable, int from=0, int to=0); /** Enable/Disable Histogram */ - void SetHistogram(bool enable,int histArg, int min=0, int max=0, int size=0){histogram = enable;histogramArgument = histArg; histFrom=min;histTo=max;histSize=size;}; + void SetHistogram(bool enable,int histArg, int min=0, int max=0, double size=0){histogram = enable;histogramArgument = histArg; histFrom=min;histTo=max;histSize=size;}; public slots: /** To select 1D or 2D plot @@ -563,7 +563,7 @@ bool displayStatistics; bool histogram; int histFrom; int histTo; -int histSize; +double histSize; QwtPlotGrid *grid; QwtPlotHistogram *plotHistogram; QVector histogramSamples; diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 076e24c7b..308be8e78 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -210,7 +210,7 @@ void qDrawPlot::SetupWidgetWindow(){ grid->setMinPen(QPen(Qt::gray, 0 , Qt::DotLine)); */ plotHistogram = new QwtPlotHistogram(); - plotHistogram->setStyle(QwtPlotHistogram::Columns); + plotHistogram->setStyle(QwtPlotHistogram::Columns);//Options:Outline,Columns, Lines firstPlot = false; @@ -542,7 +542,6 @@ void qDrawPlot::SetScanArgument(int scanArg){ minPixelsY = 0; nPixelsX = myDet->getTotalNumberOfChannels(slsDetectorDefs::X); nPixelsY = myDet->getTotalNumberOfChannels(slsDetectorDefs::Y); - //cannot do this in between measurements , so update instantly if(scanArgument==qDefs::Level0){ //no need to check if numsteps=0,cuz otherwise this mode wont be set in plot tab @@ -595,25 +594,23 @@ void qDrawPlot::SetScanArgument(int scanArg){ //histogram if(histogram){ - histogramSamples.resize(0); int iloop = 0; - int min = iloop*histSize + histFrom; - int max = (iloop+1)*histSize + histFrom; - while(min < histTo){ - histogramSamples.resize(iloop+1); - histogramSamples[iloop].interval.setInterval(min,max-1); + int numSteps = ((histTo-histFrom)/(histSize)) + 1; + histogramSamples.resize(numSteps); + startPixel = histFrom -(histSize/2); + endPixel = histTo + (histSize/2); + while(startPixel < endPixel){ + histogramSamples[iloop].interval.setInterval(startPixel,startPixel+histSize,QwtInterval::ExcludeMaximum); histogramSamples[iloop].value = 0; + startPixel += histSize; iloop++; - min = max; - max = (iloop+1)*histSize + histFrom; - if(max>histTo) - max = histTo; } + //print values cout << "Histogram Intervals:" << endl; for(int j=0;jvalues[i] <= histFrom) || (data->values[i] >= histTo)) + if ((data->values[i] < histFrom) || (data->values[i] >= histTo)) continue; //check for intervals, increment if validates for(int j=0;j= histTo) || (scanval == -1)) + if ((scanval < histFrom) || (scanval > histTo) || (scanval == -1)) scanval = -1; //check for intervals, increment if validates for(int j=0;j l2){ + cout << "***** s curve inflectionfound at " << histogramSamples[j].interval.maxValue() << "" + "or j at " << j << " with l1 " << l1 << " and l2 " << l2 << endl; + } + } + } + return 0; } @@ -1321,9 +1336,9 @@ void qDrawPlot::UpdatePlot(){ histFrameIndexTitle->setText(GetHistTitle(0)); plotHistogram->attach(plot1D); //refixing all the zooming - plot1D->SetXMinMax(histFrom,histTo); + plot1D->SetXMinMax(startPixel,endPixel); plot1D->SetYMinMax(0,plotHistogram->boundingRect().height()); - plot1D->SetZoomBase(0,0,nPixelsX,plotHistogram->boundingRect().height()); + plot1D->SetZoomBase(startPixel,0,endPixel-startPixel,plotHistogram->boundingRect().height()); } //not histogram else{ diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index 3e16651f7..6fa2c46f9 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -572,11 +572,13 @@ void qTabPlot::SetPlot(){ cout << " - Histogram" << endl; - if(radioHistIntensity->isChecked()) + if(radioHistIntensity->isChecked()){ pageHistogram->setEnabled(true); - else + pageHistogram_2->setEnabled(true); + }else{ pageHistogram->setEnabled(false); - + pageHistogram_2->setEnabled(false); + } boxScan->hide(); boxHistogram->show(); myPlot->EnablePlot(true); @@ -587,8 +589,9 @@ void qTabPlot::SetPlot(){ boxPlotAxis->setEnabled(true); if(!myPlot->isRunning()) EnableScanBox(); - qDefs::Message(qDefs::INFORMATION,"Please check the Plot Histogram Options below " - "before Starting Acquitision","qTabPlot::SetPlot"); + + //qDefs::Message(qDefs::INFORMATION,"Please check the Plot Histogram Options below " + // "before Starting Acquitision","qTabPlot::SetPlot"); } } @@ -865,10 +868,13 @@ void qTabPlot::EnableScanBox(){ //histogram if(radioHistogram->isChecked()){ - if(radioHistIntensity->isChecked()) + if(radioHistIntensity->isChecked()){ pageHistogram->setEnabled(true); - else + pageHistogram_2->setEnabled(true); + }else{ pageHistogram->setEnabled(false); + pageHistogram_2->setEnabled(false); + } stackedWidget->setCurrentIndex(stackedWidget->count()-1); stackedWidget_2->setCurrentIndex(stackedWidget_2->count()-1); box1D->setTitle(QString("1D Plot Options %1 - Histogram").arg(stackedWidget->currentIndex()+1)); @@ -900,7 +906,7 @@ void qTabPlot::EnableScanBox(){ }else{ pageHistogram->setEnabled(false); - /*pageHistogram_2->setEnabled(false);*/ + pageHistogram_2->setEnabled(false); } connect(btnGroupPlotType,SIGNAL(buttonClicked(int)),this, SLOT(SetPlot())); @@ -939,7 +945,7 @@ void qTabPlot::SetScanArgument(){ //histogram default - set before setscanargument int min = spinHistFrom->value(); int max = spinHistTo->value(); - int size = spinHistSize->value(); + double size = spinHistSize->value(); int histArg = qDefs::Intensity; if(radioHistogram->isChecked()){ if(!radioHistIntensity->isChecked()){ @@ -1089,8 +1095,10 @@ void qTabPlot::SetBinary(){ void qTabPlot::SetHistogramOptions(){ if(radioHistIntensity->isChecked()){ pageHistogram->setEnabled(true); + pageHistogram_2->setEnabled(true); }else { pageHistogram->setEnabled(false); + pageHistogram_2->setEnabled(false); } } @@ -1115,6 +1123,7 @@ void qTabPlot::Refresh(){ disconnect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox())); boxScan->setEnabled(false); pageHistogram->setEnabled(false); + pageHistogram_2->setEnabled(false); if(radioHistogram->isChecked()) radioDataGraph->setEnabled(false); else From 92c56739d9b79cc9e545e8f6003ebb5096da29d1 Mon Sep 17 00:00:00 2001 From: Maliakal Dhanya Date: Tue, 9 Sep 2014 17:01:25 +0200 Subject: [PATCH 281/332] version --- slsDetectorGui/gitInfo.txt | 8 ++++---- slsDetectorGui/include/gitInfoGui.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/slsDetectorGui/gitInfo.txt b/slsDetectorGui/gitInfo.txt index 0d8074016..916e91c81 100644 --- a/slsDetectorGui/gitInfo.txt +++ b/slsDetectorGui/gitInfo.txt @@ -1,9 +1,9 @@ Path: slsDetectorsPackage/calibrationWizards URL: origin git@gitorious.psi.ch:sls_det_software/sls_detector_gui.git Repository Root: origin git@gitorious.psi.ch:sls_det_software/sls_detector_gui.git -Repsitory UUID: f2467753988c780455e50953db2cb6b4e643e704 -Revision: 278 +Repsitory UUID: 09bbb7805f877800116ba4333e891042c8289dbb +Revision: 280 Branch: master Last Changed Author: Maliakal_Dhanya -Last Changed Rev: 278 -Last Changed Date: 2014-08-05 11:30:36 +0200 +Last Changed Rev: 280 +Last Changed Date: 2014-09-09 15:46:36 +0200 diff --git a/slsDetectorGui/include/gitInfoGui.h b/slsDetectorGui/include/gitInfoGui.h index ead14bc8a..aa880ae4a 100644 --- a/slsDetectorGui/include/gitInfoGui.h +++ b/slsDetectorGui/include/gitInfoGui.h @@ -1,11 +1,11 @@ //#define SVNPATH "" #define SVNURL "git@gitorious.psi.ch:sls_det_software/sls_detector_gui.git" //#define SVNREPPATH "" -#define SVNREPUUID "f2467753988c780455e50953db2cb6b4e643e704" -//#define SVNREV 0x278 +#define SVNREPUUID "09bbb7805f877800116ba4333e891042c8289dbb" +//#define SVNREV 0x280 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "Maliakal_Dhanya" -#define SVNREV 0x278 -#define SVNDATE 0x20140805 +#define SVNREV 0x280 +#define SVNDATE 0x20140909 // From baf65e83183b31d4dfb1a274b4c6539d5e9667f2 Mon Sep 17 00:00:00 2001 From: Maliakal Dhanya Date: Wed, 10 Sep 2014 14:39:02 +0200 Subject: [PATCH 282/332] some clone changes and setting the gui image read frequency to be one for eiger in gui --- slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h | 3 ++- slsDetectorGui/src/qCloneWidget.cpp | 2 ++ slsDetectorGui/src/qTabPlot.cpp | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h index c1a80c395..967eb68fe 100644 --- a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h @@ -92,9 +92,10 @@ public: void SetData(int nbinsx, double xmin, double xmax, int nbinsy,double ymin, double ymax,double *d,double zmin=0, double zmax=-1){ hist->SetData(nbinsx,xmin,xmax,nbinsy,ymin,ymax,d,zmin,zmax); - } + + double* GetDataPtr() {return hist->GetDataPtr();} int GetBinIndex(int bx,int by) {return hist->GetBinIndex(bx,by);} int FindBinIndex(double x,double y) {return hist->FindBinIndex(x,y);} diff --git a/slsDetectorGui/src/qCloneWidget.cpp b/slsDetectorGui/src/qCloneWidget.cpp index 707db9781..5d4f79692 100644 --- a/slsDetectorGui/src/qCloneWidget.cpp +++ b/slsDetectorGui/src/qCloneWidget.cpp @@ -190,6 +190,7 @@ void qCloneWidget::SetCloneHists(int nHists,int histNBins,double* histXAxis,doub void qCloneWidget::SetCloneHists2D(int nbinsx,double xmin,double xmax,int nbinsy, double ymin, double ymax, double *d){ cloneplot2D->GetPlot()->SetData(nbinsx,xmin,xmax,nbinsy,ymin,ymax,d); + cloneplot2D->UpdateNKeepSetRangeIfSet(); } @@ -226,6 +227,7 @@ void qCloneWidget::SetRange(bool IsXYRange[],double XYRangeValues[]){ }else{ cloneplot2D->GetPlot()->SetXMinMax(XYRangeValues[qDefs::XMINIMUM],XYRangeValues[qDefs::XMAXIMUM]); cloneplot2D->GetPlot()->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]); + cloneplot2D->GetPlot()->Update(); } } diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index 6fa2c46f9..3e60667a0 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -1116,6 +1116,8 @@ void qTabPlot::Refresh(){ boxFrequency->setEnabled(true); connect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox())); EnableScanBox(); + if(myDet->getDetectorsType() == slsDetectorDefs::EIGER) + comboFrequency->setCurrentIndex(1); SetFrequency(); }else{ From 056fb4e119a7269266e450d37cc3c0cbc7746fff Mon Sep 17 00:00:00 2001 From: Leonardo Sala Date: Fri, 12 Sep 2014 13:47:19 +0200 Subject: [PATCH 283/332] updating Makefile --- slsDetectorGui/client/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/slsDetectorGui/client/Makefile b/slsDetectorGui/client/Makefile index ca48957a2..e2476eb83 100644 --- a/slsDetectorGui/client/Makefile +++ b/slsDetectorGui/client/Makefile @@ -4,8 +4,8 @@ LDLIBS += -lm -lstdc++ -lpthread LDIR = ../../slsDetectorSoftware RDIR = ../../slsReceiverSoftware -INCLUDES = -I $(LDIR)/commonFiles -I $(RDIR)/MySocketTCP -I $(LDIR)/slsDetector -I ../include -I $(RDIR)/includes -SRC_CLNT = qClient.cpp $(RDIR)/MySocketTCP/MySocketTCP.cpp +INCLUDES = -I $(LDIR)/commonFiles -I $(LDIR)/slsDetector -I ../include -I $(RDIR)/include +SRC_CLNT = qClient.cpp $(RDIR)/src/MySocketTCP.cpp PROGS = gui_client DESTDIR ?= bin From 13a54224eb42341fbfa8797d0cd9d6e953af60e9 Mon Sep 17 00:00:00 2001 From: Leonardo Sala Date: Fri, 12 Sep 2014 16:22:22 +0200 Subject: [PATCH 284/332] updating makefiles --- slsDetectorGui/Makefile | 8 ++++++++ slsDetectorGui/client/Makefile | 5 +++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/slsDetectorGui/Makefile b/slsDetectorGui/Makefile index fbbdeee59..26b0c4318 100644 --- a/slsDetectorGui/Makefile +++ b/slsDetectorGui/Makefile @@ -2,6 +2,14 @@ include ../Makefile.include +$(info ) +$(info ##################################) +$(info # Compiling slsDetectorGui #) +$(info ##################################) +$(info ) + + + PROG = $(DESTDIR)/slsDetectorGui DESTDIR ?= ../bin diff --git a/slsDetectorGui/client/Makefile b/slsDetectorGui/client/Makefile index ca48957a2..2b86b2a9c 100644 --- a/slsDetectorGui/client/Makefile +++ b/slsDetectorGui/client/Makefile @@ -4,8 +4,9 @@ LDLIBS += -lm -lstdc++ -lpthread LDIR = ../../slsDetectorSoftware RDIR = ../../slsReceiverSoftware -INCLUDES = -I $(LDIR)/commonFiles -I $(RDIR)/MySocketTCP -I $(LDIR)/slsDetector -I ../include -I $(RDIR)/includes -SRC_CLNT = qClient.cpp $(RDIR)/MySocketTCP/MySocketTCP.cpp +INCLUDES = -I $(LDIR)/commonFiles -I $(LDIR)/slsDetector -I ../include -I $(RDIR)/include +SRC_CLNT = qClient.cpp $(RDIR)/src/MySocketTCP.cpp + PROGS = gui_client DESTDIR ?= bin From 5acb1419afefb326e9b03d37a5c839df0304b2b0 Mon Sep 17 00:00:00 2001 From: Maliakal Dhanya Date: Thu, 16 Oct 2014 14:14:34 +0200 Subject: [PATCH 285/332] the version given to esrf --- slsDetectorGui/gitInfo.txt | 8 ++++---- slsDetectorGui/include/gitInfoGui.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/slsDetectorGui/gitInfo.txt b/slsDetectorGui/gitInfo.txt index 916e91c81..fe983e3a1 100644 --- a/slsDetectorGui/gitInfo.txt +++ b/slsDetectorGui/gitInfo.txt @@ -1,9 +1,9 @@ Path: slsDetectorsPackage/calibrationWizards URL: origin git@gitorious.psi.ch:sls_det_software/sls_detector_gui.git Repository Root: origin git@gitorious.psi.ch:sls_det_software/sls_detector_gui.git -Repsitory UUID: 09bbb7805f877800116ba4333e891042c8289dbb -Revision: 280 +Repsitory UUID: a6b29560c2d5dc8de95db22956b6a9ab29a0a688 +Revision: 282 Branch: master Last Changed Author: Maliakal_Dhanya -Last Changed Rev: 280 -Last Changed Date: 2014-09-09 15:46:36 +0200 +Last Changed Rev: 282 +Last Changed Date: 2014-09-10 14:39:02 +0200 diff --git a/slsDetectorGui/include/gitInfoGui.h b/slsDetectorGui/include/gitInfoGui.h index aa880ae4a..c8e4e0f3d 100644 --- a/slsDetectorGui/include/gitInfoGui.h +++ b/slsDetectorGui/include/gitInfoGui.h @@ -1,11 +1,11 @@ //#define SVNPATH "" #define SVNURL "git@gitorious.psi.ch:sls_det_software/sls_detector_gui.git" //#define SVNREPPATH "" -#define SVNREPUUID "09bbb7805f877800116ba4333e891042c8289dbb" -//#define SVNREV 0x280 +#define SVNREPUUID "a6b29560c2d5dc8de95db22956b6a9ab29a0a688" +//#define SVNREV 0x282 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "Maliakal_Dhanya" -#define SVNREV 0x280 -#define SVNDATE 0x20140909 +#define SVNREV 0x282 +#define SVNDATE 0x20140910 // From 8dc41efad296bb943ff694e185f20ee38ccc7a50 Mon Sep 17 00:00:00 2001 From: Maliakal Dhanya Date: Mon, 1 Dec 2014 10:54:31 +0100 Subject: [PATCH 286/332] changed to linux argument type with -- --- slsDetectorGui/src/qDetectorMain.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index bfb4df3d6..ef741ea56 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -47,20 +47,23 @@ 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(0),tabs(0),isDeveloper(0){ - +bool found; string configFName = ""; // Getting all the command line arguments for(int iarg=1; iarg Date: Wed, 14 Jan 2015 10:43:41 +0100 Subject: [PATCH 287/332] revision update --- slsDetectorGui/gitInfo.txt | 8 ++++---- slsDetectorGui/include/gitInfoGui.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/slsDetectorGui/gitInfo.txt b/slsDetectorGui/gitInfo.txt index fe983e3a1..2c642a1c6 100644 --- a/slsDetectorGui/gitInfo.txt +++ b/slsDetectorGui/gitInfo.txt @@ -1,9 +1,9 @@ Path: slsDetectorsPackage/calibrationWizards URL: origin git@gitorious.psi.ch:sls_det_software/sls_detector_gui.git Repository Root: origin git@gitorious.psi.ch:sls_det_software/sls_detector_gui.git -Repsitory UUID: a6b29560c2d5dc8de95db22956b6a9ab29a0a688 -Revision: 282 +Repsitory UUID: 81c5629da13fd8658d00bcad89e5fcbb9d901ef7 +Revision: 288 Branch: master Last Changed Author: Maliakal_Dhanya -Last Changed Rev: 282 -Last Changed Date: 2014-09-10 14:39:02 +0200 +Last Changed Rev: 288 +Last Changed Date: 2014-12-01 10:54:31 +0100 diff --git a/slsDetectorGui/include/gitInfoGui.h b/slsDetectorGui/include/gitInfoGui.h index c8e4e0f3d..e52ff8fee 100644 --- a/slsDetectorGui/include/gitInfoGui.h +++ b/slsDetectorGui/include/gitInfoGui.h @@ -1,11 +1,11 @@ //#define SVNPATH "" #define SVNURL "git@gitorious.psi.ch:sls_det_software/sls_detector_gui.git" //#define SVNREPPATH "" -#define SVNREPUUID "a6b29560c2d5dc8de95db22956b6a9ab29a0a688" -//#define SVNREV 0x282 +#define SVNREPUUID "81c5629da13fd8658d00bcad89e5fcbb9d901ef7" +//#define SVNREV 0x288 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "Maliakal_Dhanya" -#define SVNREV 0x282 -#define SVNDATE 0x20140910 +#define SVNREV 0x288 +#define SVNDATE 0x20141201 // From 3fa51917051ca6a5a3e297fdc6dc95fed0ce33ef Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Mon, 23 Feb 2015 15:26:14 +0100 Subject: [PATCH 288/332] so that the dacs dont go negative in the gui, default timer reduced to 200ms so more frames can be shown --- slsDetectorGui/include/qDrawPlot.h | 2 +- slsDetectorGui/src/qTabDeveloper.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index 2b09e840e..0b709b57d 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -481,7 +481,7 @@ double XYRangeValues[4]; bool IsXYRange[4]; /** Default timer between plots*/ -static const double PLOT_TIMER_MS = 250; +static const double PLOT_TIMER_MS = 200; /** Specific timer value between plots */ double timerValue; /** every nth frame when to plot */ diff --git a/slsDetectorGui/src/qTabDeveloper.cpp b/slsDetectorGui/src/qTabDeveloper.cpp index e2470b20a..258653f27 100644 --- a/slsDetectorGui/src/qTabDeveloper.cpp +++ b/slsDetectorGui/src/qTabDeveloper.cpp @@ -220,6 +220,7 @@ void qTabDeveloper::CreateDACWidgets(){ for(int i=0;isetMinimum(-1); spinDacs[i]->setMaximum(10000); lblDacsmV[i]= new QLabel("",boxDacs); From 848569b216b5f9dac8cf929400fce306d309f89a Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Mon, 2 Mar 2015 14:04:27 +0100 Subject: [PATCH 289/332] print receiver configurations and some error messages upon exit --- slsDetectorGui/src/qDetectorMain.cpp | 4 ++-- slsDetectorGui/src/qTabAdvanced.cpp | 7 +++++++ slsDetectorGui/src/qTabDeveloper.cpp | 2 ++ slsDetectorGui/src/qTabMeasurement.cpp | 2 ++ slsDetectorGui/src/qTabSettings.cpp | 1 + 5 files changed, 14 insertions(+), 2 deletions(-) diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index ef741ea56..527b68540 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -183,6 +183,7 @@ void qDetectorMain::SetUpWidgetWindow(){ // Default zoom Tool Tip zoomToolTip = dockWidgetPlot->toolTip(); + } @@ -207,9 +208,7 @@ void qDetectorMain::SetUpDetector(const string fName){ //if hostname doesnt exist even in shared memory if(!host.length()){ -#ifdef VERBOSE cout << endl << "No Detector Connected." << endl; -#endif qDefs::Message(qDefs::CRITICAL,"No Detectors Connected. ","qDetectorMain::SetUpDetector"); exit(-1); } @@ -237,6 +236,7 @@ void qDetectorMain::SetUpDetector(const string fName){ default: string detName = myDet->slsDetectorBase::getDetectorType(detType); qDefs::checkErrorMessage(myDet,"qDetectorMain::SetUpDetector"); + cout << "ERROR: " + host + " has unknown detector type \"" + detName + "\". Exiting GUI." << endl; string errorMess = host+string(" has unknown detector type \"")+ detName+string("\". Exiting GUI."); qDefs::Message(qDefs::CRITICAL,errorMess,"qDetectorMain::SetUpDetector"); diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp index f07da9530..4a60b237a 100644 --- a/slsDetectorGui/src/qTabAdvanced.cpp +++ b/slsDetectorGui/src/qTabAdvanced.cpp @@ -177,6 +177,13 @@ void qTabAdvanced::SetupWidgetWindow(){ cout << "Getting ROI" << endl; updateROIList(); + + // print receiver configurations + if(myDet->getDetectorsType() != slsDetectorDefs::MYTHEN){ + cout << endl; + myDet->printReceiverConfiguration(); + } + Initialization(); qDefs::checkErrorMessage(det,"qTabAdvanced::SetupWidgetWindow"); diff --git a/slsDetectorGui/src/qTabDeveloper.cpp b/slsDetectorGui/src/qTabDeveloper.cpp index 258653f27..3c865bfa4 100644 --- a/slsDetectorGui/src/qTabDeveloper.cpp +++ b/slsDetectorGui/src/qTabDeveloper.cpp @@ -134,6 +134,7 @@ void qTabDeveloper::SetupWidgetWindow(){ break; default: + cout << "ERROR: Unknown detector type: " + myDet->slsDetectorBase::getDetectorType(detType) << endl; qDefs::Message(qDefs::CRITICAL,string("Unknown detector type:")+myDet->slsDetectorBase::getDetectorType(detType),"qTabDeveloper::SetupWidgetWindow"); exit(-1); break; @@ -388,6 +389,7 @@ slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(int index){ } break; default: + cout << "Unknown detector type:" + myDet->slsDetectorBase::getDetectorType(detType) << endl; qDefs::Message(qDefs::CRITICAL,string("Unknown detector type:")+myDet->slsDetectorBase::getDetectorType(detType),"qTabDeveloper::getSLSIndex"); qDefs::checkErrorMessage(myDet,"qTabDeveloper::getSLSIndex"); exit(-1); diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 5e6952b56..eb0eb3095 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -152,6 +152,7 @@ void qTabMeasurement::SetupTimingMode(){ item[(int)Gated_Start]->setEnabled(false); break; default: + cout << "Unknown detector type." << endl; qDefs::Message(qDefs::CRITICAL,"Unknown detector type.","qTabMeasurement::SetupTimingMode"); exit(-1); break; @@ -683,6 +684,7 @@ void qTabMeasurement::SetTimingMode(int mode){ success = true; break; default: + cout << "Timing mode unknown to GUI" << endl; //This should never happen qDefs::Message(qDefs::CRITICAL,"Timing mode unknown to GUI","qTabMeasurement::SetTimingMode"); qDefs::checkErrorMessage(myDet,"qTabMeasurement::SetTimingMode"); diff --git a/slsDetectorGui/src/qTabSettings.cpp b/slsDetectorGui/src/qTabSettings.cpp index e886bc9ba..91d76cdb7 100644 --- a/slsDetectorGui/src/qTabSettings.cpp +++ b/slsDetectorGui/src/qTabSettings.cpp @@ -144,6 +144,7 @@ void qTabSettings::SetupDetectorSettings(){ item[(int)LowNoise]->setEnabled(false); break; default: + cout << "Unknown detector type. Exiting GUI." << endl; qDefs::Message(qDefs::CRITICAL,"Unknown detector type. Exiting GUI.","qTabSettings::SetupDetectorSettings"); exit(-1); break; From 71ad7ae2f03d77b8de2f521f80a8ed12c60b1cf0 Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Thu, 5 Mar 2015 15:30:21 +0100 Subject: [PATCH 290/332] some pointers deleted equalled to null --- slsDetectorGui/src/qDrawPlot.cpp | 17 +++++++++-------- slsDetectorGui/src/qTabActions.cpp | 6 +++--- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 308be8e78..c5ff3f6de 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -49,8 +49,8 @@ qDrawPlot::~qDrawPlot(){ plot1D_hists.clear(); if(lastImageArray) delete[] lastImageArray; lastImageArray=0; StartOrStopThread(0); - delete myDet; - for(int i=0;i::iterator h = plot1D_hists.begin(); h!=plot1D_hists.end();h++) + for(QVector::iterator h = plot1D_hists.begin(); h!=plot1D_hists.end();h++){ (*h)->Detach(plot1D); + //do not delete *h or h. + } plotHistogram->detach(); } @@ -1719,8 +1721,7 @@ int qDrawPlot::UpdateTrimbitPlot(bool fromDetector,bool Histogram){ //get trimbits actualPixelsX = myDet->getTotalNumberOfChannels(slsDetectorDefs::X); - if(histTrimbits) delete [] histTrimbits; - histTrimbits = new double[actualPixelsX]; + if(histTrimbits) delete [] histTrimbits; histTrimbits = new double[actualPixelsX]; ret = myDet->getChanRegs(histTrimbits,fromDetector); // cout << "got it!" << endl; if(!ret){ @@ -1896,8 +1897,8 @@ void qDrawPlot::RecalculatePedestal(){ pedestalCount = 0; //create array - if(pedestalVals) delete [] pedestalVals; pedestalVals = new double[nPixelsX*nPixelsY]; - if(tempPedestalVals) delete [] tempPedestalVals; tempPedestalVals = new double[nPixelsX*nPixelsY]; + if(pedestalVals) delete [] pedestalVals; pedestalVals = new double[nPixelsX*nPixelsY]; + if(tempPedestalVals) delete [] tempPedestalVals; tempPedestalVals = new double[nPixelsX*nPixelsY]; //reset all values for(unsigned int px=0;px<(nPixelsX*nPixelsY);px++) pedestalVals[px] = 0; diff --git a/slsDetectorGui/src/qTabActions.cpp b/slsDetectorGui/src/qTabActions.cpp index 80dea2508..f6044683a 100644 --- a/slsDetectorGui/src/qTabActions.cpp +++ b/slsDetectorGui/src/qTabActions.cpp @@ -197,7 +197,7 @@ void qTabActions::SetupWidgetWindow(){ //load positions if(lblName[NumPositions]->isEnabled()){ //delete existing positions - if (positions) delete [] positions; + if (positions) {delete [] positions; positions = NULL;} //get number of positions int numPos=myDet->getPositions(); comboPos->setMaxCount(numPos); @@ -404,7 +404,7 @@ void qTabActions::SetPosition(){ } //delete existing positions - if (positions) delete [] positions; + if (positions) {delete [] positions; positions = NULL;} positions=new double[comboPos->count()]; //copying the list for(int i=0;icount();i++) @@ -483,7 +483,7 @@ void qTabActions::Refresh(){ if(lblName[NumPositions]->isEnabled()){ //delete existing positions - if (positions) delete [] positions; + if (positions) {delete [] positions; positions = NULL;} //get number of positions int numPos=myDet->getPositions(); comboPos->setMaxCount(numPos); From b091b7e1a9a9817141fb3ec841d9f34bba3e5da2 Mon Sep 17 00:00:00 2001 From: Anna Bergamaschi Date: Fri, 6 Mar 2015 10:44:07 +0100 Subject: [PATCH 291/332] Smallish changes? --- slsDetectorGui/include/qTabAdvanced.h | 2 +- slsDetectorGui/src/qDetectorMain.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/slsDetectorGui/include/qTabAdvanced.h b/slsDetectorGui/include/qTabAdvanced.h index 5a15e6339..f6e75ca79 100644 --- a/slsDetectorGui/include/qTabAdvanced.h +++ b/slsDetectorGui/include/qTabAdvanced.h @@ -197,7 +197,7 @@ private: /** Trimming mode */ slsDetectorDefs::trimMode trimmingMode; - static const int TRIMMING_DYNAMIC_RANGE = 24; + static const int TRIMMING_DYNAMIC_RANGE = 32; static const int TRIMMING_FRAME_NUMBER = 1; static const int TRIMMING_TRIGGER_NUMBER = 1; static const int TRIMMING_PROBE_NUMBER = 0; diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index bfb4df3d6..d8e7d438f 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -58,6 +58,7 @@ qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app, QWidget * if(!strcasecmp(argv[iarg],"-help")){ cout << "Possible Arguments are:" << endl; cout << "-help \t\t : \t This help" << endl; + cout << "-config fname \t : \t specifies the configuration flie name to be used" << endl; cout << "-developer \t : \t Enables the developer tab" << endl; cout << "-id i \t\t : \t Sets the multi detector id to i (the default is 0). " "Required only when more than one multi detector object is needed." << endl; From 2c6f0c49a7410df96d843c74b60fccac300ce5e6 Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Thu, 12 Mar 2015 13:45:45 +0100 Subject: [PATCH 292/332] lets gui know if old plot --- slsDetectorGui/src/qDrawPlot.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index c5ff3f6de..43d4d14c1 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -1258,6 +1258,8 @@ int qDrawPlot::MeasurementFinished(int currentMeasurementIndex, int fileIndex){ #endif emit SetCurrentMeasurementSignal(currentMeasurement); SetupMeasurement(); + if((myDet->setReceiverOnline()==slsDetectorDefs::ONLINE_FLAG) && (myDet->getFramesCaughtByReceiver() == 0)) + boxPlot->setTitle("OLD_plot.raw"); return 0; } From 5c14453c5d013effa461a857ed29df8bfe70e193 Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Fri, 13 Mar 2015 11:20:00 +0100 Subject: [PATCH 293/332] fixed histogram issues --- slsDetectorGui/src/qDrawPlot.cpp | 8 ++++---- slsDetectorGui/src/qTabPlot.cpp | 2 -- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 43d4d14c1..97aa90ed8 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -595,10 +595,10 @@ void qDrawPlot::SetScanArgument(int scanArg){ //histogram if(histogram){ int iloop = 0; - int numSteps = ((histTo-histFrom)/(histSize)) + 1; + int numSteps = ((histTo-histFrom)/(histSize)) + 1;cout<<"numSteps:"<values[i] < histFrom) || (data->values[i] >= histTo)) + if ((data->values[i] < histFrom) || (data->values[i] > histTo)) continue; //check for intervals, increment if validates for(int j=0;j Date: Wed, 1 Apr 2015 12:05:09 +0200 Subject: [PATCH 294/332] indiviual dac control for each detector enabled in gui --- slsDetectorGui/include/qTabDeveloper.h | 31 ++++--- slsDetectorGui/src/qTabDeveloper.cpp | 114 ++++++++++++++++++++----- 2 files changed, 112 insertions(+), 33 deletions(-) diff --git a/slsDetectorGui/include/qTabDeveloper.h b/slsDetectorGui/include/qTabDeveloper.h index a88499bff..75f32eefb 100644 --- a/slsDetectorGui/include/qTabDeveloper.h +++ b/slsDetectorGui/include/qTabDeveloper.h @@ -68,10 +68,6 @@ public: */ ~qTabDeveloper(); - /** To refresh and update widgets - */ - void Refresh(); - /** To stop ADC Timer when starting acquisition */ void StopADCTimer(){if(adcTimer) adcTimer->stop();}; @@ -79,6 +75,8 @@ public: private: /** The sls detector object */ multiSlsDetector *myDet; + /** The sls detector object */ + slsDetector *det; /** detector type */ slsDetectorDefs::detectorType detType; /**number of dac widgets*/ @@ -108,6 +106,7 @@ private: QGridLayout *dacLayout; QString tipHV; QPalette red; + QComboBox *comboDetector; /** Sets up the widget */ void SetupWidgetWindow(); @@ -130,21 +129,25 @@ private: */ slsDetectorDefs::dacIndex getSLSIndex(int index); +public slots: + /** To refresh and update widgets + */ + void Refresh(); private slots: -/** Refreshes the adcs - */ -void RefreshAdcs(); + /** Refreshes the adcs + */ + void RefreshAdcs(); -/** Set Dac values - * @param id id of dac - */ -void SetDacValues(int id); + /** Set Dac values + * @param id id of dac + */ + void SetDacValues(int id); -/** Set High Voltage - */ -void SetHighVoltage(); + /** Set High Voltage + */ + void SetHighVoltage(); }; diff --git a/slsDetectorGui/src/qTabDeveloper.cpp b/slsDetectorGui/src/qTabDeveloper.cpp index 3c865bfa4..c772608ec 100644 --- a/slsDetectorGui/src/qTabDeveloper.cpp +++ b/slsDetectorGui/src/qTabDeveloper.cpp @@ -27,6 +27,7 @@ int qTabDeveloper::NUM_ADC_WIDGETS(0); qTabDeveloper::qTabDeveloper(QWidget *parent,multiSlsDetector*& detector): QWidget(parent), myDet(detector), + det(0), boxDacs(0), boxAdcs(0), lblHV(0), @@ -50,6 +51,7 @@ qTabDeveloper::qTabDeveloper(QWidget *parent,multiSlsDetector*& detector): qTabDeveloper::~qTabDeveloper(){ delete myDet; + if(det) delete det; } @@ -143,10 +145,11 @@ void qTabDeveloper::SetupWidgetWindow(){ //layout setFixedWidth(765); - setFixedHeight(50+(NUM_DAC_WIDGETS/2)*35); + setFixedHeight(20+50+(NUM_DAC_WIDGETS/2)*35); //setHeight(340); + scroll = new QScrollArea; - scroll->setFrameShape(QFrame::NoFrame); + //scroll->setFrameShape(QFrame::NoFrame); scroll->setWidget(this); scroll->setWidgetResizable(true); @@ -154,6 +157,16 @@ void qTabDeveloper::SetupWidgetWindow(){ layout->setContentsMargins(20,10,10,5); setLayout(layout); + //readout + comboDetector = new QComboBox(this); + //comboDetector->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); + comboDetector->addItem("All"); + //add detectors + for(int i=1;igetNumberOfDetectors()+1;i++) + comboDetector->addItem(QString(myDet->getHostname(i-1).c_str())); + comboDetector->setCurrentIndex(0); + + //dacs boxDacs = new QGroupBox("Dacs",this); boxDacs->setFixedHeight(25+(NUM_DAC_WIDGETS/2)*35); @@ -179,20 +192,21 @@ void qTabDeveloper::SetupWidgetWindow(){ dacLayout->addWidget(comboHV,(int)(NUM_DAC_WIDGETS/2),2); connect(comboHV, SIGNAL(currentIndexChanged(int)), this, SLOT(SetHighVoltage())); } - layout->addWidget(boxDacs,0,0); + layout->addWidget(comboDetector,0,0); + layout->addWidget(boxDacs,1,0); //adcs if((detType==slsDetectorDefs::GOTTHARD) || (detType==slsDetectorDefs::MOENCH)){ - setFixedHeight((50+(NUM_DAC_WIDGETS/2)*35)+(50+(NUM_ADC_WIDGETS/2)*35)); + setFixedHeight(20+(50+(NUM_DAC_WIDGETS/2)*35)+(50+(NUM_ADC_WIDGETS/2)*35)); boxAdcs = new QGroupBox("ADCs",this); boxAdcs->setFixedHeight(25+(NUM_ADC_WIDGETS/2)*35); - layout->addWidget(boxAdcs,1,0); + layout->addWidget(boxAdcs,2,0); CreateADCWidgets(); //to make the adcs at the bottom most int diff = 340-height(); setFixedHeight(340); - layout->setVerticalSpacing(diff); + layout->setVerticalSpacing(diff/2); //timer to check adcs adcTimer = new QTimer(this); } @@ -209,6 +223,8 @@ void qTabDeveloper::Initialization(){ for(int i=0;ivalue() << endl; #endif - //spinDacs[id]->setValue((double)myDet->setDAC((dacs_t)spinDacs[id]->value(),getSLSIndex(id))); - myDet->setDAC((dacs_t)spinDacs[id]->value(),getSLSIndex(id),0); - lblDacsmV[id]->setText(QString("%1mV").arg(myDet->setDAC(-1,getSLSIndex(id),1),-10)); - qDefs::checkErrorMessage(myDet,"qTabDeveloper::SetDacValues"); + int detid = comboDetector->currentIndex(); + if(detid) + det = myDet->getSlsDetector(detid-1); + + //all detectors + if(!detid){ + myDet->setDAC((dacs_t)spinDacs[id]->value(),getSLSIndex(id),0); + lblDacsmV[id]->setText(QString("%1mV").arg(myDet->setDAC(-1,getSLSIndex(id),1),-10)); + qDefs::checkErrorMessage(myDet,"qTabDeveloper::SetDacValues"); + } + //specific detector + else{ + det->setDAC((dacs_t)spinDacs[id]->value(),getSLSIndex(id),0); + lblDacsmV[id]->setText(QString("%1mV").arg(det->setDAC(-1,getSLSIndex(id),1),-10)); + qDefs::checkErrorMessage(det,"qTabDeveloper::SetDacValues"); + } + } @@ -283,9 +312,26 @@ void qTabDeveloper::SetHighVoltage(){ #ifdef VERBOSE cout << "Setting high voltage:" << comboHV->currentText().toAscii().constData() << endl; #endif + + int detid = comboDetector->currentIndex(); + if(detid) + det = myDet->getSlsDetector(detid-1); + int highvoltage = comboHV->currentText().toInt(); - int ret = myDet->setDAC(highvoltage,slsDetectorDefs::HV_POT,0); - qDefs::checkErrorMessage(myDet,"qTabDeveloper::SetHighVoltage"); + int ret; + + //all detectors + if(!detid){ + ret = myDet->setDAC(highvoltage,slsDetectorDefs::HV_POT,0); + qDefs::checkErrorMessage(myDet,"qTabDeveloper::SetHighVoltage"); + } + //specific detector + else{ + ret = det->setDAC(highvoltage,slsDetectorDefs::HV_POT,0); + qDefs::checkErrorMessage(det,"qTabDeveloper::SetHighVoltage"); + } + + //error if(ret != highvoltage){ qDefs::Message(qDefs::CRITICAL,"High Voltage could not be set to this value.","qTabDeveloper::SetHighVoltage"); @@ -407,8 +453,20 @@ void qTabDeveloper::RefreshAdcs(){ cout << "Updating ADCs" <stop(); - for(int i=0;isetValue((double)myDet->getADC(getSLSIndex(i+NUM_DAC_WIDGETS))); + + int detid = comboDetector->currentIndex(); + if(detid) + det = myDet->getSlsDetector(detid-1); + + for(int i=0;isetValue((double)myDet->getADC(getSLSIndex(i+NUM_DAC_WIDGETS))); + //specific detector + else + spinAdcs[i]->setValue((double)det->getADC(getSLSIndex(i+NUM_DAC_WIDGETS))); + } + adcTimer->start(ADC_TIMEOUT); qDefs::checkErrorMessage(myDet,"qTabDeveloper::RefreshAdcs"); @@ -423,15 +481,30 @@ void qTabDeveloper::Refresh(){ cout << endl << "**Updating Developer Tab" << endl; #endif + + int detid = comboDetector->currentIndex(); + if(detid) + det = myDet->getSlsDetector(detid-1); + + + //dacs #ifdef VERBOSE cout << "Gettings DACs" << endl; #endif - //dacs - for(int i=0;isetValue((double)myDet->setDAC(-1,getSLSIndex(i),0)); - lblDacsmV[i]->setText(QString("%1mV").arg(myDet->setDAC(-1,getSLSIndex(i),1),-10)); + //all detectors + if(!detid){ + spinDacs[i]->setValue((double)myDet->setDAC(-1,getSLSIndex(i),0)); + lblDacsmV[i]->setText(QString("%1mV").arg(myDet->setDAC(-1,getSLSIndex(i),1),-10)); + } + //specific detector + else{ + spinDacs[i]->setValue((double)det->setDAC(-1,getSLSIndex(i),0)); + lblDacsmV[i]->setText(QString("%1mV").arg(det->setDAC(-1,getSLSIndex(i),1),-10)); + } } + + //adcs if(NUM_ADC_WIDGETS) RefreshAdcs(); @@ -445,7 +518,10 @@ void qTabDeveloper::Refresh(){ lblHV->setToolTip(tipHV); comboHV->setToolTip(tipHV); //getting hv value - int ret = (int)myDet->setDAC(-1,slsDetectorDefs::HV_POT,0); + int ret; + if(!detid) ret = (int)myDet->setDAC(-1,slsDetectorDefs::HV_POT,0); + else ret = (int)det->setDAC(-1,slsDetectorDefs::HV_POT,0); + switch(ret){ case 0: comboHV->setCurrentIndex(0);break; case 90: comboHV->setCurrentIndex(1);break; From e0de23dd45118ac53ada01543355396cd5fdab65 Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Wed, 1 Apr 2015 12:17:55 +0200 Subject: [PATCH 295/332] threshold to set all vcmp dacs for eiger --- slsDetectorGui/src/qTabDeveloper.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/slsDetectorGui/src/qTabDeveloper.cpp b/slsDetectorGui/src/qTabDeveloper.cpp index c772608ec..01844bb6d 100644 --- a/slsDetectorGui/src/qTabDeveloper.cpp +++ b/slsDetectorGui/src/qTabDeveloper.cpp @@ -80,7 +80,7 @@ void qTabDeveloper::SetupWidgetWindow(){ dacNames.push_back("v Preamp:"); break; case slsDetectorDefs::EIGER: - NUM_DAC_WIDGETS = 16; + NUM_DAC_WIDGETS = 17; NUM_ADC_WIDGETS = 0; dacNames.push_back("v SvP:"); @@ -99,6 +99,7 @@ void qTabDeveloper::SetupWidgetWindow(){ dacNames.push_back("v Vcmp_lr:"); dacNames.push_back("v Vcmp_rl:"); dacNames.push_back("v Vcmp_rr:"); + dacNames.push_back("v threshold:"); @@ -387,7 +388,7 @@ slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(int index){ case 13:return slsDetectorDefs::E_Vcmp_lr; case 14:return slsDetectorDefs::E_Vcmp_rl; case 15:return slsDetectorDefs::E_Vcmp_rr; - + case 16:return slsDetectorDefs::THRESHOLD; default: From e035eeaf0804c82743391e144290f73b7238f416 Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Fri, 12 Jun 2015 17:44:30 +0200 Subject: [PATCH 296/332] not compulsory anymore for every frame for eiger --- slsDetectorGui/src/qTabPlot.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index 674590c49..50c5b4bc7 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -1114,8 +1114,8 @@ void qTabPlot::Refresh(){ boxFrequency->setEnabled(true); connect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox())); EnableScanBox(); - if(myDet->getDetectorsType() == slsDetectorDefs::EIGER) - comboFrequency->setCurrentIndex(1); + /*if(myDet->getDetectorsType() == slsDetectorDefs::EIGER) + comboFrequency->setCurrentIndex(1);*/ SetFrequency(); }else{ From 7b2934fb734dff22d5e61616fe6e7839112aaa93 Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Tue, 16 Jun 2015 11:56:58 +0200 Subject: [PATCH 297/332] git version update --- slsDetectorGui/gitInfo.txt | 14 +++++++------- slsDetectorGui/include/gitInfoGui.h | 12 ++++++------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/slsDetectorGui/gitInfo.txt b/slsDetectorGui/gitInfo.txt index 2c642a1c6..ab3a5cbe4 100644 --- a/slsDetectorGui/gitInfo.txt +++ b/slsDetectorGui/gitInfo.txt @@ -1,9 +1,9 @@ Path: slsDetectorsPackage/calibrationWizards -URL: origin git@gitorious.psi.ch:sls_det_software/sls_detector_gui.git -Repository Root: origin git@gitorious.psi.ch:sls_det_software/sls_detector_gui.git -Repsitory UUID: 81c5629da13fd8658d00bcad89e5fcbb9d901ef7 -Revision: 288 +URL: origin maliakal_d@gitorious.psi.ch:sls_det_software/sls_detector_gui.git +Repository Root: origin maliakal_d@gitorious.psi.ch:sls_det_software/sls_detector_gui.git +Repsitory UUID: d9b88696bfd75c95d13cada581f1901c235e25a7 +Revision: 299 Branch: master -Last Changed Author: Maliakal_Dhanya -Last Changed Rev: 288 -Last Changed Date: 2014-12-01 10:54:31 +0100 +Last Changed Author: Dhanya_Maliakal +Last Changed Rev: 299 +Last Changed Date: 2015-06-12 17:44:30 +0200 diff --git a/slsDetectorGui/include/gitInfoGui.h b/slsDetectorGui/include/gitInfoGui.h index e52ff8fee..47823f468 100644 --- a/slsDetectorGui/include/gitInfoGui.h +++ b/slsDetectorGui/include/gitInfoGui.h @@ -1,11 +1,11 @@ //#define SVNPATH "" -#define SVNURL "git@gitorious.psi.ch:sls_det_software/sls_detector_gui.git" +#define SVNURL "maliakal_d@gitorious.psi.ch:sls_det_software/sls_detector_gui.git" //#define SVNREPPATH "" -#define SVNREPUUID "81c5629da13fd8658d00bcad89e5fcbb9d901ef7" -//#define SVNREV 0x288 +#define SVNREPUUID "d9b88696bfd75c95d13cada581f1901c235e25a7" +//#define SVNREV 0x299 //#define SVNKIND "" //#define SVNSCHED "" -#define SVNAUTH "Maliakal_Dhanya" -#define SVNREV 0x288 -#define SVNDATE 0x20141201 +#define SVNAUTH "Dhanya_Maliakal" +#define SVNREV 0x299 +#define SVNDATE 0x20150612 // From a5e18833de1cda40e0c0dd3bd467c1e1eacb8955 Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Mon, 29 Jun 2015 16:55:51 +0200 Subject: [PATCH 298/332] git rev in --- slsDetectorGui/gitInfo.txt | 8 ++++---- slsDetectorGui/include/gitInfoGui.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/slsDetectorGui/gitInfo.txt b/slsDetectorGui/gitInfo.txt index ab3a5cbe4..0b5444b91 100644 --- a/slsDetectorGui/gitInfo.txt +++ b/slsDetectorGui/gitInfo.txt @@ -1,9 +1,9 @@ Path: slsDetectorsPackage/calibrationWizards URL: origin maliakal_d@gitorious.psi.ch:sls_det_software/sls_detector_gui.git Repository Root: origin maliakal_d@gitorious.psi.ch:sls_det_software/sls_detector_gui.git -Repsitory UUID: d9b88696bfd75c95d13cada581f1901c235e25a7 -Revision: 299 +Repsitory UUID: bc733edfc422efa18796b8b1dd47ad51c852884a +Revision: 300 Branch: master Last Changed Author: Dhanya_Maliakal -Last Changed Rev: 299 -Last Changed Date: 2015-06-12 17:44:30 +0200 +Last Changed Rev: 300 +Last Changed Date: 2015-06-16 11:56:58 +0200 diff --git a/slsDetectorGui/include/gitInfoGui.h b/slsDetectorGui/include/gitInfoGui.h index 47823f468..1c5ad2901 100644 --- a/slsDetectorGui/include/gitInfoGui.h +++ b/slsDetectorGui/include/gitInfoGui.h @@ -1,11 +1,11 @@ //#define SVNPATH "" #define SVNURL "maliakal_d@gitorious.psi.ch:sls_det_software/sls_detector_gui.git" //#define SVNREPPATH "" -#define SVNREPUUID "d9b88696bfd75c95d13cada581f1901c235e25a7" -//#define SVNREV 0x299 +#define SVNREPUUID "bc733edfc422efa18796b8b1dd47ad51c852884a" +//#define SVNREV 0x300 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "Dhanya_Maliakal" -#define SVNREV 0x299 -#define SVNDATE 0x20150612 +#define SVNREV 0x300 +#define SVNDATE 0x20150616 // From db5412e599b6d34a1229cda982e4787546d14900 Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Wed, 22 Jul 2015 10:06:38 +0200 Subject: [PATCH 299/332] propix integrated into gui --- slsDetectorGui/src/qDetectorMain.cpp | 9 +++++---- slsDetectorGui/src/qDrawPlot.cpp | 1 + slsDetectorGui/src/qTabActions.cpp | 5 ++++- slsDetectorGui/src/qTabAdvanced.cpp | 10 ++++++++-- slsDetectorGui/src/qTabDebugging.cpp | 27 +++++++++++++++++++++++++- slsDetectorGui/src/qTabDeveloper.cpp | 20 ++++++++++++++----- slsDetectorGui/src/qTabMeasurement.cpp | 1 + slsDetectorGui/src/qTabPlot.cpp | 5 ++++- slsDetectorGui/src/qTabSettings.cpp | 1 + 9 files changed, 65 insertions(+), 14 deletions(-) diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 527b68540..b46fb6532 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -230,8 +230,9 @@ void qDetectorMain::SetUpDetector(const string fName){ switch(detType){ case slsDetectorDefs::MYTHEN: break; case slsDetectorDefs::EIGER: break; - case slsDetectorDefs::GOTTHARD: actionLoadTrimbits->setText("Load Settings"); actionSaveTrimbits->setText("Save Settings"); break; - case slsDetectorDefs::AGIPD: actionLoadTrimbits->setText("Load Settings"); actionSaveTrimbits->setText("Save Settings"); break; + case slsDetectorDefs::GOTTHARD: + case slsDetectorDefs::AGIPD: + case slsDetectorDefs::PROPIX: case slsDetectorDefs::MOENCH: actionLoadTrimbits->setText("Load Settings"); actionSaveTrimbits->setText("Save Settings"); break; default: string detName = myDet->slsDetectorBase::getDetectorType(detType); @@ -603,7 +604,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ void qDetectorMain::ExecuteHelp(QAction *action){ if(action==actionAbout){ #ifdef VERBOSE - cout << "About: Common GUI for Mythen, Eiger, Gotthard and Agipd detectors" << endl; + cout << "About: Common GUI for Mythen, Eiger, Gotthard and Propix detectors" << endl; #endif char version[200]; int64_t retval= SVNREV; @@ -620,7 +621,7 @@ void qDetectorMain::ExecuteHelp(QAction *action){ "SLS Detector GUI version:   " + thisGUIVersion+"
" "SLS Detector Client version: "+thisClientVersion+"

" "Common GUI to control the SLS Detectors: " - "Mythen, Eiger, Gotthard and Agipd.

" + "Mythen, Eiger, Gotthard and Propix.

" "It can be operated in parallel with the command line interface:
" "sls_detector_put,
sls_detector_get,
sls_detector_acquire and
sls_detector_help.

" "The GUI Software is still in progress. " diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 97aa90ed8..1638f4a08 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -67,6 +67,7 @@ void qDrawPlot::SetupWidgetWindow(){ case slsDetectorDefs::MYTHEN: originally2D = false; break; case slsDetectorDefs::EIGER: originally2D = true; break; case slsDetectorDefs::GOTTHARD: originally2D = false; break; + case slsDetectorDefs::PROPIX: originally2D = true; break; case slsDetectorDefs::MOENCH: originally2D = true; break; default: cout << "ERROR: Detector Type is Generic" << endl; diff --git a/slsDetectorGui/src/qTabActions.cpp b/slsDetectorGui/src/qTabActions.cpp index f6044683a..ad450dbed 100644 --- a/slsDetectorGui/src/qTabActions.cpp +++ b/slsDetectorGui/src/qTabActions.cpp @@ -181,7 +181,10 @@ void qTabActions::SetupWidgetWindow(){ //Number of positions is only for mythen or gotthard detType = myDet->getDetectorsType(); - if((detType == slsDetectorDefs::EIGER) || (detType == slsDetectorDefs::AGIPD) || (detType == slsDetectorDefs::MOENCH)) { + if((detType == slsDetectorDefs::EIGER) || + (detType == slsDetectorDefs::AGIPD) || + (detType == slsDetectorDefs::PROPIX) || + (detType == slsDetectorDefs::MOENCH)) { lblName[NumPositions]->setEnabled(false); btnExpand[NumPositions]->setEnabled(false); }else{ diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp index 4a60b237a..b1dfed070 100644 --- a/slsDetectorGui/src/qTabAdvanced.cpp +++ b/slsDetectorGui/src/qTabAdvanced.cpp @@ -238,7 +238,10 @@ void qTabAdvanced::Initialization(){ connect(spinStopPort, SIGNAL(valueChanged(int)), this, SLOT(SetStopPort(int))); connect(comboOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetOnline(int))); - if((detType==slsDetectorDefs::GOTTHARD) || (detType==slsDetectorDefs::MOENCH) || (detType==slsDetectorDefs::EIGER)){ + if((detType==slsDetectorDefs::GOTTHARD) || + (detType==slsDetectorDefs::MOENCH) || + (detType==slsDetectorDefs::PROPIX) || + (detType==slsDetectorDefs::EIGER)){ //network connect(spinTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int))); @@ -1185,7 +1188,10 @@ void qTabAdvanced::Refresh(){ #ifdef VERBOSE cout << "Getting Receiver Network Information" << endl; #endif - if ((detType==slsDetectorDefs::GOTTHARD) || (detType==slsDetectorDefs::MOENCH)|| (detType==slsDetectorDefs::EIGER)){ + if ((detType==slsDetectorDefs::GOTTHARD) || + (detType==slsDetectorDefs::MOENCH)|| + (detType==slsDetectorDefs::PROPIX)|| + (detType==slsDetectorDefs::EIGER)){ //disconnect disconnect(spinTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int))); disconnect(spinUDPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrUDPPort(int))); diff --git a/slsDetectorGui/src/qTabDebugging.cpp b/slsDetectorGui/src/qTabDebugging.cpp index 6b3beee2d..80c0125e0 100644 --- a/slsDetectorGui/src/qTabDebugging.cpp +++ b/slsDetectorGui/src/qTabDebugging.cpp @@ -73,6 +73,7 @@ void qTabDebugging::SetupWidgetWindow(){ chkChip->setEnabled(false); chkModuleFirmware->setEnabled(false); break; + case slsDetectorDefs::PROPIX: case slsDetectorDefs::GOTTHARD: lblDetector->setText("Module:"); chkDetectorFirmware->setText("Module Firmware:"); @@ -295,6 +296,29 @@ void qTabDebugging::GetInfo(){ + case slsDetectorDefs::PROPIX: + + //display widget + formLayout->addWidget(new QLabel("Module:"),0,0); + formLayout->addItem(new QSpacerItem(15,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,1); + formLayout->addWidget(lblDetectorId,0,2); + formLayout->addWidget(new QLabel("Module MAC Address:"),1,0); + formLayout->addWidget(lblDetectorSerial,1,2); + formLayout->addWidget(new QLabel("Module Firmware Version:"),2,0); + formLayout->addWidget(lblDetectorFirmware,2,2); + formLayout->addWidget(new QLabel("Module Software Version:"),3,0); + formLayout->addWidget(lblDetectorSoftware,3,2); + //tree widget + treeDet->setHeaderLabel("Propix Detector"); + //gets det names + for (int i=0;icount();i++) + items.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString("Module (%1)").arg(comboDetector->itemText(i))))); + treeDet->insertTopLevelItems(0, items); + + break; + + + case slsDetectorDefs::GOTTHARD: //display widget @@ -425,7 +449,7 @@ void qTabDebugging::SetParameters(QTreeWidgetItem *item){ - + case slsDetectorDefs::PROPIX: case slsDetectorDefs::MOENCH: case slsDetectorDefs::GOTTHARD: //find index @@ -474,6 +498,7 @@ void qTabDebugging::TestDetector(){ break; case slsDetectorDefs::EIGER: Detector = "Half Module"; break; case slsDetectorDefs::MOENCH: + case slsDetectorDefs::PROPIX: case slsDetectorDefs::GOTTHARD: Detector = "Module"; break; default: break; } diff --git a/slsDetectorGui/src/qTabDeveloper.cpp b/slsDetectorGui/src/qTabDeveloper.cpp index 01844bb6d..5c17c04ed 100644 --- a/slsDetectorGui/src/qTabDeveloper.cpp +++ b/slsDetectorGui/src/qTabDeveloper.cpp @@ -104,6 +104,7 @@ void qTabDeveloper::SetupWidgetWindow(){ break; + case slsDetectorDefs::PROPIX: case slsDetectorDefs::GOTTHARD: NUM_DAC_WIDGETS = 8; NUM_ADC_WIDGETS = 2; @@ -174,7 +175,9 @@ void qTabDeveloper::SetupWidgetWindow(){ CreateDACWidgets(); //HV for gotthard - if ((detType==slsDetectorDefs::GOTTHARD) || (detType==slsDetectorDefs::MOENCH)){ + if ((detType==slsDetectorDefs::GOTTHARD) || + (detType==slsDetectorDefs::PROPIX) || + (detType==slsDetectorDefs::MOENCH)){ boxDacs->setFixedHeight(boxDacs->height()+35); lblHV = new QLabel("High Voltage",boxDacs); @@ -198,7 +201,9 @@ void qTabDeveloper::SetupWidgetWindow(){ //adcs - if((detType==slsDetectorDefs::GOTTHARD) || (detType==slsDetectorDefs::MOENCH)){ + if((detType==slsDetectorDefs::GOTTHARD) || + (detType==slsDetectorDefs::PROPIX) || + (detType==slsDetectorDefs::MOENCH)){ setFixedHeight(20+(50+(NUM_DAC_WIDGETS/2)*35)+(50+(NUM_ADC_WIDGETS/2)*35)); boxAdcs = new QGroupBox("ADCs",this); boxAdcs->setFixedHeight(25+(NUM_ADC_WIDGETS/2)*35); @@ -265,7 +270,10 @@ void qTabDeveloper::CreateADCWidgets(){ lblAdcs[i] = new QLabel(QString(adcNames[i].c_str()),boxAdcs); spinAdcs[i] = new QDoubleSpinBox(boxAdcs); spinAdcs[i]->setMaximum(10000); - if((detType==slsDetectorDefs::GOTTHARD) || (detType==slsDetectorDefs::MOENCH)) spinAdcs[i]->setSuffix(0x00b0+QString("C")); + if((detType==slsDetectorDefs::GOTTHARD) || + (detType==slsDetectorDefs::PROPIX) || + (detType==slsDetectorDefs::MOENCH)) + spinAdcs[i]->setSuffix(0x00b0+QString("C")); adcLayout->addWidget(lblAdcs[i],(int)(i/2),((i%2)==0)?1:4); adcLayout->addWidget(spinAdcs[i],(int)(i/2),((i%2)==0)?2:5); @@ -416,7 +424,7 @@ slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(int index){ break; } break; - + case slsDetectorDefs::PROPIX: case slsDetectorDefs::GOTTHARD: switch(index){ case 0: return slsDetectorDefs::G_VREF_DS; @@ -510,7 +518,9 @@ void qTabDeveloper::Refresh(){ if(NUM_ADC_WIDGETS) RefreshAdcs(); //gotthard -high voltage - if((detType == slsDetectorDefs::GOTTHARD) || (detType == slsDetectorDefs::MOENCH)){ + if((detType == slsDetectorDefs::GOTTHARD) || + (detType == slsDetectorDefs::PROPIX) || + (detType == slsDetectorDefs::MOENCH)){ disconnect(comboHV, SIGNAL(currentIndexChanged(int)), this, SLOT(SetHighVoltage())); //default should be correct diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index eb0eb3095..5d417b3ba 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -145,6 +145,7 @@ void qTabMeasurement::SetupTimingMode(){ item[(int)Gated_Start]->setEnabled(false); break; case slsDetectorDefs::MOENCH: + case slsDetectorDefs::PROPIX: case slsDetectorDefs::GOTTHARD: item[(int)Trigger_Exp_Series]->setEnabled(true); item[(int)Trigger_Readout]->setEnabled(false); diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index 50c5b4bc7..336358f48 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -175,6 +175,7 @@ void qTabPlot::SetupWidgetWindow(){ case slsDetectorDefs::GOTTHARD: isOriginallyOneD = true; break; + case slsDetectorDefs::PROPIX: case slsDetectorDefs::MOENCH: isOriginallyOneD = false; break; @@ -761,7 +762,9 @@ void qTabPlot::EnableScanBox(){ chkSuperimpose->setEnabled(true); pageAccumulate->setEnabled(true); pageAccumulate_2->setEnabled(true); - if((myDet->getDetectorsType() == slsDetectorDefs::GOTTHARD) || (myDet->getDetectorsType() == slsDetectorDefs::MOENCH)){ + if((myDet->getDetectorsType() == slsDetectorDefs::GOTTHARD) || + (myDet->getDetectorsType() == slsDetectorDefs::PROPIX) || + (myDet->getDetectorsType() == slsDetectorDefs::MOENCH)){ pagePedestal->setEnabled(true); pagePedestal_2->setEnabled(true); chkBinary->setEnabled(true); diff --git a/slsDetectorGui/src/qTabSettings.cpp b/slsDetectorGui/src/qTabSettings.cpp index 91d76cdb7..413c4c123 100644 --- a/slsDetectorGui/src/qTabSettings.cpp +++ b/slsDetectorGui/src/qTabSettings.cpp @@ -133,6 +133,7 @@ void qTabSettings::SetupDetectorSettings(){ item[(int)LowNoise]->setEnabled(true); break; case slsDetectorDefs::MOENCH: + case slsDetectorDefs::PROPIX: case slsDetectorDefs::GOTTHARD: item[(int)Standard]->setEnabled(false); item[(int)Fast]->setEnabled(false); From 2d8ee637dc921c0a07982b5eee7558e41ff8a7e2 Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Wed, 22 Jul 2015 10:35:26 +0200 Subject: [PATCH 300/332] adc update not stopped between acquisition --- slsDetectorGui/src/qDetectorMain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index b46fb6532..7777967fc 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -759,7 +759,7 @@ void qDetectorMain::EnableTabs(){ tab_plot->Refresh(); //stop the adc timer in gotthard - if(tab_developer->isEnabled()) + if(isDeveloper) tab_developer->StopADCTimer(); //set the plot type first(acccss shared memory) tab_plot->SetScanArgument(); From b1a9689caf57c23b711b7055c444190b779a9306 Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Mon, 27 Jul 2015 18:53:16 +0200 Subject: [PATCH 301/332] solved some zmax zmin problems with gui --- slsDetectorGui/include/qTabPlot.h | 3 ++ .../src/SlsQt2DPlotLayout.cxx | 50 ++++++++++++------- .../src/SlsQtNumberEntry.cxx | 12 +++-- slsDetectorGui/src/qTabPlot.cpp | 30 +++++++++-- 4 files changed, 70 insertions(+), 25 deletions(-) diff --git a/slsDetectorGui/include/qTabPlot.h b/slsDetectorGui/include/qTabPlot.h index 016f130d6..9ed83be7e 100644 --- a/slsDetectorGui/include/qTabPlot.h +++ b/slsDetectorGui/include/qTabPlot.h @@ -136,6 +136,9 @@ private slots: /** Enables the range of the z axis */ void EnableZRange(); + /** Return true if valid */ + bool CheckZRange(QString value); + /** Set Plot to none, data graph, histogram*/ void SetPlot(); diff --git a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx index 74769e76e..df80824a5 100644 --- a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx +++ b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx @@ -133,32 +133,43 @@ void SlsQt2DPlotLayout::ResetRange(){ void SlsQt2DPlotLayout::ResetZMinZMax(bool zmin, bool zmax, double min, double max){ - z_range_ne->SetNumber(min,0); - z_range_ne->SetNumber(max,1); + + if(zmin || zmax) zRangeChecked = true; + else zRangeChecked = false; + + if(zmin) z_range_ne->SetNumber(min,0); + if(zmax) z_range_ne->SetNumber(max,1); + //refind z limits the_plot->SetZMinMax(); - if(btnLogz->isChecked()) the_plot->SetZMinimumToFirstGreaterThanZero(); + //finds zmin value from hist + if(btnLogz->isChecked()) + the_plot->SetZMinimumToFirstGreaterThanZero(); - //first time check validity - if(zmax) z_range_ne->SetValue(max,0); - else z_range_ne->SetValue(the_plot->GetZMaximum(),1); + if(zRangeChecked){ - if(zmin) z_range_ne->SetValue(min,0); - else z_range_ne->SetValue(the_plot->GetZMinimum(),0); + //if value not given, take max or min of plot + if(zmax) z_range_ne->SetValue(max,0); + else z_range_ne->SetValue(the_plot->GetZMaximum(),1); + + if(zmin) z_range_ne->SetValue(min,0); + else z_range_ne->SetValue(the_plot->GetZMinimum(),0); + + //check if zmin and zmax is same or not a proper double value + //if(zmin && zmax){ + bool same = (z_range_ne->GetValue(0)==z_range_ne->GetValue(1)) ? 1:0; + if(!z_range_ne->IsValueOk(0)||same) z_range_ne->SetValue(the_plot->GetZMinimum(),0); + if(!z_range_ne->IsValueOk(1)||same) z_range_ne->SetValue(the_plot->GetZMaximum(),1); + //} + + z_range_ne->SetRange(the_plot->GetZMinimum(),z_range_ne->GetValue(1),0); + z_range_ne->SetRange(z_range_ne->GetValue(0),the_plot->GetZMaximum(),1); + + //set histogram range + the_plot->SetZMinMax(z_range_ne->GetValue(0),z_range_ne->GetValue(1)); - if(zmin && zmax){ - bool same = (z_range_ne->GetValue(0)==z_range_ne->GetValue(1)) ? 1:0; - if(!z_range_ne->IsValueOk(0)||same) z_range_ne->SetValue(the_plot->GetZMinimum(),0); - if(!z_range_ne->IsValueOk(1)||same) z_range_ne->SetValue(the_plot->GetZMaximum(),1); } - - z_range_ne->SetRange(the_plot->GetZMinimum(),z_range_ne->GetValue(1),0); - z_range_ne->SetRange(z_range_ne->GetValue(0),the_plot->GetZMaximum(),1); - - //set histogram range - the_plot->SetZMinMax(z_range_ne->GetValue(0),z_range_ne->GetValue(1)); - the_plot->Update(); } @@ -216,6 +227,7 @@ void SlsQt2DPlotLayout::SetZRange(double zmin, double zmax){ ResetRange(); } + void SlsQt2DPlotLayout::EnableZRange(bool enable){ #ifdef VERBOSE cout<<"Setting Z Range Enable to "<fixup(s); + //validator_double[i]->fixup(s);//commented out as it ignores the zmax values num_field[i]->setText(s); } }else if(spin_box[i]){ @@ -280,7 +280,7 @@ void SlsQtNumberEntry::SetRange(int min, int max,int which_number_field){ void SlsQtNumberEntry::SetRange(double min, double max,int which_number_field){ int i = (which_number_field<0||which_number_field>1) ? 0:which_number_field; if(min>max){ - cout<<"Warning: SetRange(double,double) no effect min >= max"<= max("<setRange(min,max,validator_double[i]->decimals()); @@ -407,7 +407,13 @@ double SlsQtNumberEntry::GetNumber(int which_number_field,bool* ok){ if(num_field[i]){ if(validator_int[i]) return num_field[i]->text().toInt(ok); - else return num_field[i]->text().toDouble(ok); + else { + bool k; + cout<<"val:"<text().toDouble(&k)<text().toDouble(ok); + } } else if(spin_box[i]) return spin_box[i]->value(); else {if(ok) *ok=0;} diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index 336358f48..97f73a078 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -510,8 +510,11 @@ void qTabPlot::SetAxesRange(){ void qTabPlot::SetZRange(){ -// emit SetZRangeSignal(dispZMin->text().toDouble(),dispZMax->text().toDouble()); - emit ResetZMinZMaxSignal(chkZMin->isChecked(),chkZMax->isChecked(),dispZMin->text().toDouble(),dispZMax->text().toDouble()); + emit ResetZMinZMaxSignal( + (chkZMin->isChecked() && CheckZRange(dispZMin->text())), + (chkZMax->isChecked() && CheckZRange(dispZMax->text())), + dispZMin->text().toDouble(), + dispZMax->text().toDouble()); } @@ -519,9 +522,30 @@ void qTabPlot::SetZRange(){ void qTabPlot::EnableZRange(){ + dispZMin->setEnabled(chkZMin->isChecked()); dispZMax->setEnabled(chkZMax->isChecked()); - emit ResetZMinZMaxSignal(chkZMin->isChecked(),chkZMax->isChecked(),dispZMin->text().toDouble(),dispZMax->text().toDouble()); + emit ResetZMinZMaxSignal( + (chkZMin->isChecked() && CheckZRange(dispZMin->text())), + (chkZMax->isChecked() && CheckZRange(dispZMax->text())), + dispZMin->text().toDouble(), + dispZMax->text().toDouble()); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +bool qTabPlot::CheckZRange(QString value){ + if(value.isEmpty()) + return false; + + bool ok; + value.toDouble(&ok); + if(!ok) + return false; + + return true; } From 5c5e9d349a8436f49554a6d9c3fe0e6c7f4f9bf7 Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Mon, 27 Jul 2015 19:18:32 +0200 Subject: [PATCH 302/332] zmin zmax change finish --- .../slsDetectorPlotting/src/SlsQtNumberEntry.cxx | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/slsDetectorGui/slsDetectorPlotting/src/SlsQtNumberEntry.cxx b/slsDetectorGui/slsDetectorPlotting/src/SlsQtNumberEntry.cxx index 541eae1eb..13a44e35f 100644 --- a/slsDetectorGui/slsDetectorPlotting/src/SlsQtNumberEntry.cxx +++ b/slsDetectorGui/slsDetectorPlotting/src/SlsQtNumberEntry.cxx @@ -407,13 +407,7 @@ double SlsQtNumberEntry::GetNumber(int which_number_field,bool* ok){ if(num_field[i]){ if(validator_int[i]) return num_field[i]->text().toInt(ok); - else { - bool k; - cout<<"val:"<text().toDouble(&k)<text().toDouble(ok); - } + else return num_field[i]->text().toDouble(ok); } else if(spin_box[i]) return spin_box[i]->value(); else {if(ok) *ok=0;} From 1c41ea88984a16091b4dcb716a821a0db3abca2f Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Thu, 10 Sep 2015 11:28:39 +0200 Subject: [PATCH 303/332] changes to includes clkdivider and flags in gui --- slsDetectorGui/forms/form_tab_dataoutput.ui | 667 ++++++++++++-------- slsDetectorGui/include/qTabDataOutput.h | 19 + slsDetectorGui/src/qTabDataOutput.cpp | 162 ++++- 3 files changed, 563 insertions(+), 285 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_dataoutput.ui b/slsDetectorGui/forms/form_tab_dataoutput.ui index 9d700034d..5e383bb75 100644 --- a/slsDetectorGui/forms/form_tab_dataoutput.ui +++ b/slsDetectorGui/forms/form_tab_dataoutput.ui @@ -31,287 +31,12 @@ Form - - - - 20 - 160 - 731 - 171 - - - - Options - - - - - 15 - 25 - 701 - 66 - - - - - 3 - - - - - Flat field corrections. - #flatfield# filename - - - Flat Field Correction File: - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 40 - 20 - - - - - - - - false - - - Qt::ClickFocus - - - Flat field corrections. - #flatfield# filename - - - - - - - false - - - - 0 - 0 - - - - Flat field corrections. - #flatfield# filename - - - Browse - - - - :/icons/images/browse.png:/icons/images/browse.png - - - - - - - false - - - Custom dead time: - - - - - - - false - - - Auto - - - - - - - false - - - - 0 - 0 - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - ns - - - 6 - - - 2000000000.000000000000000 - - - - - - - false - - - Rate Correction: - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 40 - 20 - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 40 - 20 - - - - - - - - - - 15 - 95 - 701 - 66 - - - - - 3 - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 310 - 20 - - - - - - - - Discard Bad Channels - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 40 - 20 - - - - - - - - false - - - Angular Conversion - - - - - - - <nobr> -Compression using Root. Available only for Gotthard in Expert Mode. -</nobr><br><nobr> - #r_compression# -</nobr> - - - Compression - - - - - - - false - - - <nobr> -Compression using Root. Available only for Gotthard in Expert Mode. -</nobr><br><nobr> - #r_compression# -</nobr> - - - 10GbE - - - - - - - 20 - 25 - 731 + 15 + 30 + 747 116 @@ -331,7 +56,7 @@ Directory where one saves the data. 5 10 - 721 + 731 96 @@ -354,7 +79,7 @@ Directory where one saves the data. 10 10 - 701 + 716 86 @@ -514,6 +239,388 @@ Directory where one saves the data. + + + + 15 + 160 + 746 + 170 + + + + Options + + + + + 17 + 21 + 192 + 137 + + + + + 6 + + + + + false + + + <nobr> +Compression using Root. Available only for Gotthard in Expert Mode. +</nobr><br><nobr> + #r_compression# +</nobr> + + + 10GbE + + + + + + + <nobr> +Compression using Root. Available only for Gotthard in Expert Mode. +</nobr><br><nobr> + #r_compression# +</nobr> + + + Compression + + + + + + + false + + + Angular Conversion + + + + + + + Discard Bad Channels + + + + + + + + + 255 + 21 + 476 + 66 + + + + + 6 + + + + + false + + + Auto + + + + + + + false + + + + 0 + 0 + + + + Flat field corrections. + #flatfield# filename + + + Browse + + + + :/icons/images/browse.png:/icons/images/browse.png + + + + + + + Flat field corrections. + #flatfield# filename + + + Flat Field File: + + + + + + + false + + + + 0 + 0 + + + + + 100 + 0 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + ns + + + 6 + + + 2000000000.000000000000000 + + + + + + + false + + + Rate: + + + + + + + false + + + Qt::ClickFocus + + + Flat field corrections. + #flatfield# filename + + + + + + + false + + + Custom dead time: + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 20 + + + + + + + + + + 230 + 21 + 20 + 134 + + + + QFrame::Raised + + + Qt::Vertical + + + + + + 244 + 92 + 491 + 72 + + + + + + 11 + 4 + 475 + 62 + + + + + + + + 200 + 16777215 + + + + + Continous + + + + + Store in RAM + + + + + + + + + 105 + 16777215 + + + + Clock Divider: + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 20 + + + + + + + + + 200 + 16777215 + + + + + Full Speed + + + + + Half Speed + + + + + Quarter Speed + + + + + Super Slow Speed + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 20 + + + + + + + + + 105 + 16777215 + + + + Flags: + + + + + + + + Parallel + + + + + Non Parallel + + + + + Safe + + + + + + + + dispReadOutputDir diff --git a/slsDetectorGui/include/qTabDataOutput.h b/slsDetectorGui/include/qTabDataOutput.h index 7f29b5164..7fd11da7e 100644 --- a/slsDetectorGui/include/qTabDataOutput.h +++ b/slsDetectorGui/include/qTabDataOutput.h @@ -67,6 +67,14 @@ private: QPalette *red1; QPalette *black1; + /** enum for the Eiger clock divider */ + enum {FullSpeed, HalfSpeed, QuarterSpeed, SuperSlowSpeed, NumberofSpeeds}; + /** enum for the Eiger readout flags1 */ + enum {Continous, Storeinram}; + /** enum for the Eiger readout flags2 */ + enum {Parallel, NonParallel, Safe}; + + /** methods */ /** Sets up the widget */ void SetupWidgetWindow(); @@ -81,6 +89,11 @@ private: /** Get Compression */ void GetCompression(); + /** update speed */ + void updateSpeedFromServer(); + + /** update flags */ + void updateFlagsFromServer(); private slots: @@ -120,6 +133,12 @@ void SetCompression(bool enable); /** enable 10GbE */ void EnableTenGigabitEthernet(bool enable, int get=0); +/** set speed */ +void setSpeed(); + +/** set flags */ +void setFlags(); + signals: /**signal to enable/disable positions in Actions*/ void AngularConversionSignal(bool); diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index 9af47f7a4..3465bddc9 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -47,6 +47,7 @@ qTabDataOutput::~qTabDataOutput(){ void qTabDataOutput::SetupWidgetWindow(){ // Detector Type detType=myDet->getDetectorsType(); + widgetEiger->setVisible(false); //rate correction - not for charge integrating detectors if((detType == slsDetectorDefs::MYTHEN)||(detType == slsDetectorDefs::EIGER)) @@ -55,8 +56,11 @@ void qTabDataOutput::SetupWidgetWindow(){ if((detType == slsDetectorDefs::MYTHEN)||(detType == slsDetectorDefs::GOTTHARD)) chkAngular->setEnabled(true); - if(detType == slsDetectorDefs::EIGER) + if(detType == slsDetectorDefs::EIGER){ chkTenGiga->setEnabled(true); + widgetEiger->setVisible(true); + + } /** error message **/ red = QPalette(); @@ -118,9 +122,6 @@ void qTabDataOutput::SetupWidgetWindow(){ #ifdef VERBOSE cout << "Getting bad channel correction:" << myDet->getBadChannelCorrection() << endl; #endif - - - disconnect(chkDiscardBad, SIGNAL(toggled(bool))); if(myDet->getBadChannelCorrection()) chkDiscardBad->setChecked(true); @@ -162,7 +163,16 @@ void qTabDataOutput::Initialization(){ //compression connect(chkCompression, SIGNAL(toggled(bool)), this, SLOT(SetCompression(bool))); //10GbE - connect(chkTenGiga, SIGNAL(toggled(bool)), this, SLOT(EnableTenGigabitEthernet(bool))); + connect(chkTenGiga, SIGNAL(toggled(bool)), this, SLOT(EnableTenGigabitEthernet(bool))); + + //eiger + if(widgetEiger->isVisible()){ + //speed + connect(comboEigerClkDivider,SIGNAL(currentIndexChanged(int)), this, SLOT(setSpeed())); + //flags + connect(comboEigerFlags1, SIGNAL(currentIndexChanged(int)), this, SLOT(setFlags())); + connect(comboEigerFlags2, SIGNAL(currentIndexChanged(int)), this, SLOT(setFlags())); + } } @@ -762,6 +772,133 @@ void qTabDataOutput::EnableTenGigabitEthernet(bool enable,int get){ //------------------------------------------------------------------------------------------------------------------------------------------------- +void qTabDataOutput::setSpeed(){ +#ifdef VERBOSE + cout << endl << "Setting Speed" << endl; +#endif + if(widgetEiger->isVisible()){ + myDet->setSpeed(slsDetectorDefs::CLOCK_DIVIDER,comboEigerClkDivider->currentIndex()); + qDefs::checkErrorMessage(myDet,"qTabDataOutput::setSpeed"); + updateSpeedFromServer(); + } + +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabDataOutput::setFlags(){ +#ifdef VERBOSE + cout << endl << "Setting Readout Flags" << endl; +#endif + slsDetectorDefs::readOutFlags val = slsDetectorDefs::GET_READOUT_FLAGS; + if(widgetEiger->isVisible()){ + + //set to continous or storeinram + switch(comboEigerFlags1->currentIndex()){ + case Storeinram: val = slsDetectorDefs::STORE_IN_RAM; break; + default: val = slsDetectorDefs::CONTINOUS_RO; break; + } + myDet->setReadOutFlags(val); + qDefs::checkErrorMessage(myDet,"qTabDataOutput::setFlags"); + + //set to parallel, nonparallel or safe + switch(comboEigerFlags2->currentIndex()){ + case Parallel: val = slsDetectorDefs::PARALLEL; break; + case Safe: val = slsDetectorDefs::SAFE; break; + default: val = slsDetectorDefs::NONPARALLEL; break; + } + myDet->setReadOutFlags(val); + qDefs::checkErrorMessage(myDet,"qTabDataOutput::setFlags"); + + //update flags + updateFlagsFromServer(); + } + +} + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabDataOutput::updateSpeedFromServer(){ + int ret; + if(widgetEiger->isVisible()){ + disconnect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(setSpeed())); + + //get speed + ret = myDet->setSpeed(slsDetectorDefs::CLOCK_DIVIDER, -1); + qDefs::checkErrorMessage(myDet,"qTabDataOutput::updateSpeedFromServer"); + + //valid speed + if(ret >= 0 && ret < NumberofSpeeds) + comboEigerClkDivider->setCurrentIndex(ret); + + //invalid speed + else{ + qDefs::Message(qDefs::WARNING,"Inconsistent value from clock divider.\n" + "Setting it for all detectors involved to half speed.","qTabDataOutput::updateSpeedFromServer"); + //set to default + comboEigerClkDivider->setCurrentIndex(HalfSpeed); + myDet->setSpeed(slsDetectorDefs::CLOCK_DIVIDER,HalfSpeed); + qDefs::checkErrorMessage(myDet,"qTabDataOutput::updateSpeedFromServer"); + + } + connect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(setSpeed())); + } +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabDataOutput::updateFlagsFromServer(){ + int ret; + if(widgetEiger->isVisible()){ + disconnect(comboEigerFlags1, SIGNAL(currentIndexChanged(int)), this, SLOT(setFlags())); + disconnect(comboEigerFlags2, SIGNAL(currentIndexChanged(int)), this, SLOT(setFlags())); + + //get speed + ret = myDet->setReadOutFlags(slsDetectorDefs::GET_READOUT_FLAGS); + qDefs::checkErrorMessage(myDet,"qTabDataOutput::updateFlagsFromServer"); + + //invalid flags + if(ret==-1){ + qDefs::Message(qDefs::WARNING,"Inconsistent value for readout flags.\n" + "Setting it for all detectors involved to continous nonparallel mode.", + "qTabDataOutput::updateFlagsFromServer"); + //set to default + comboEigerFlags1->setCurrentIndex(Continous); + myDet->setReadOutFlags(slsDetectorDefs::CONTINOUS_RO); + qDefs::checkErrorMessage(myDet,"qTabDataOutput::updateFlagsFromServer"); + comboEigerFlags2->setCurrentIndex(NonParallel); + myDet->setReadOutFlags(slsDetectorDefs::NONPARALLEL); + qDefs::checkErrorMessage(myDet,"qTabDataOutput::updateFlagsFromServer"); + } + + //valid flags + else{ + if(ret & slsDetectorDefs::STORE_IN_RAM) + comboEigerFlags1->setCurrentIndex(Storeinram); + else if(ret & slsDetectorDefs::CONTINOUS_RO) + comboEigerFlags1->setCurrentIndex(Continous); + if(ret & slsDetectorDefs::PARALLEL) + comboEigerFlags2->setCurrentIndex(Parallel); + else if(ret & slsDetectorDefs::NONPARALLEL) + comboEigerFlags2->setCurrentIndex(NonParallel); + else if(ret & slsDetectorDefs::SAFE) + comboEigerFlags2->setCurrentIndex(Safe); + } + + connect(comboEigerFlags1, SIGNAL(currentIndexChanged(int)), this, SLOT(setFlags())); + connect(comboEigerFlags2, SIGNAL(currentIndexChanged(int)), this, SLOT(setFlags())); + } +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + void qTabDataOutput::Refresh(){ #ifdef VERBOSE cout << endl << "**Updating DataOutput Tab" << endl; @@ -843,9 +980,24 @@ void qTabDataOutput::Refresh(){ EnableTenGigabitEthernet(-1,1); } + //Eiger specific + if(widgetEiger->isVisible()){ + //speed +#ifdef VERBOSE + cout << "Getting Speed" << endl; +#endif + updateSpeedFromServer(); + //flags +#ifdef VERBOSE + cout << "Getting Readout Flags" << endl; +#endif + updateFlagsFromServer(); + } + + #ifdef VERBOSE cout << "**Updated DataOutput Tab" << endl << endl; #endif From 754d0b7911ebd83b6dc5eaaf40373e1b9614c2bc Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Thu, 10 Sep 2015 12:53:18 +0200 Subject: [PATCH 304/332] included set all trimbits --- slsDetectorGui/forms/form_tab_advanced.ui | 64 ++++++++++++++++++++--- slsDetectorGui/include/qTabAdvanced.h | 8 +++ slsDetectorGui/src/qTabAdvanced.cpp | 54 ++++++++++++++++++- 3 files changed, 116 insertions(+), 10 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_advanced.ui b/slsDetectorGui/forms/form_tab_advanced.ui index 1de156a38..227ecd3e6 100644 --- a/slsDetectorGui/forms/form_tab_advanced.ui +++ b/slsDetectorGui/forms/form_tab_advanced.ui @@ -51,7 +51,7 @@ QTabWidget::North - 3 + 1 Qt::ElideLeft @@ -77,7 +77,7 @@ 25 20 - 313 + 320 31 @@ -124,7 +124,7 @@ 5 10 - 746 + 467 66 @@ -140,9 +140,9 @@ - 510 + 230 15 - 211 + 228 44 @@ -169,7 +169,7 @@ Updates plot with Trimbits from Shared Memory, not from Detector. - 16 + 24 16 @@ -740,6 +740,54 @@ An extension given by the modules serial number will be attached. + + + false + + + + 518 + 10 + 233 + 66 + + + + Developer Option + + + false + + + false + + + + + 12 + 28 + 94 + 16 + + + + Set All trimbits: + + + + + + 121 + 24 + 86 + 25 + + + + 63 + + + @@ -931,7 +979,7 @@ An extension given by the modules serial number will be attached. - -1 + 6 @@ -1218,7 +1266,7 @@ An extension given by the modules serial number will be attached. - -1 + 6 diff --git a/slsDetectorGui/include/qTabAdvanced.h b/slsDetectorGui/include/qTabAdvanced.h index f6e75ca79..05bde9ccf 100644 --- a/slsDetectorGui/include/qTabAdvanced.h +++ b/slsDetectorGui/include/qTabAdvanced.h @@ -63,6 +63,10 @@ private: */ int validateBeforeTrimming(); + /** update the setalltrimbits value from server + */ + void updateAllTrimbitsFromServer(); + private slots: @@ -172,6 +176,10 @@ private slots: */ void SetDetector(int index); + /** Set all trimbits to a value + */ + void SetAllTrimbits(); + private: /** The multi detector object */ multiSlsDetector *myDet; diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp index b1dfed070..2e141bfe5 100644 --- a/slsDetectorGui/src/qTabAdvanced.cpp +++ b/slsDetectorGui/src/qTabAdvanced.cpp @@ -58,6 +58,7 @@ void qTabAdvanced::SetupWidgetWindow(){ dispIP->setEnabled(false); dispMAC->setEnabled(false); boxRxr->setEnabled(false); + boxSetAllTrimbits->setEnabled(false); red = QPalette(); @@ -73,7 +74,10 @@ void qTabAdvanced::SetupWidgetWindow(){ detType = myDet->getDetectorsType(); switch(detType){ - case slsDetectorDefs::MYTHEN: isEnergy = true; isAngular = true; break; + case slsDetectorDefs::MYTHEN: + isEnergy = true; + isAngular = true; + break; case slsDetectorDefs::EIGER: isEnergy = true; isAngular = false; @@ -82,6 +86,7 @@ void qTabAdvanced::SetupWidgetWindow(){ dispIP->setEnabled(true); dispMAC->setEnabled(true); boxRxr->setEnabled(true); + boxSetAllTrimbits->setEnabled(true); break; case slsDetectorDefs::MOENCH: isEnergy = false; @@ -177,7 +182,6 @@ void qTabAdvanced::SetupWidgetWindow(){ cout << "Getting ROI" << endl; updateROIList(); - // print receiver configurations if(myDet->getDetectorsType() != slsDetectorDefs::MYTHEN){ cout << endl; @@ -216,6 +220,10 @@ void qTabAdvanced::Initialization(){ connect(dispFile, SIGNAL(editingFinished()), this, SLOT(SetOutputFile())); connect(btnFile, SIGNAL(clicked()), this, SLOT(BrowseOutputFile())); + //setalltrimbits + if(boxSetAllTrimbits->isEnabled()) + connect(spinSetAllTrimbits, SIGNAL(editingFinished()), this, SLOT(SetAllTrimbits())); + //enable trimming method group box connect(boxTrimming, SIGNAL(toggled(bool)), this, SLOT(EnableTrimming(bool))); @@ -1088,6 +1096,45 @@ void qTabAdvanced::SetDetector(int index){ //------------------------------------------------------------------------------------------------------------------------------------------------- +void qTabAdvanced::SetAllTrimbits(){ +#ifdef VERBOSE + cout<<"Set all trimbits to " << spinSetAllTrimbits->value() << endl; +#endif + myDet->setAllTrimbits(spinSetAllTrimbits->value()); + qDefs::checkErrorMessage(myDet,"qTabAdvanced::SetAllTrimbits"); + updateAllTrimbitsFromServer(); + +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabAdvanced::updateAllTrimbitsFromServer(){ +#ifdef VERBOSE + cout<<"Getting all trimbits value" << endl; +#endif + disconnect(spinSetAllTrimbits, SIGNAL(editingFinished()), this, SLOT(SetAllTrimbits())); + + int ret = myDet->setAllTrimbits(-1); + qDefs::checkErrorMessage(myDet,"qTabAdvanced::updateAllTrimbitsFromServer"); + if(ret<0){ + qDefs::Message(qDefs::WARNING,"Inconsistent value from alltrimbits value.\n" + "Setting it for all detectors involved to 0.","qTabAdvanced::updateAllTrimbitsFromServer"); + //set to default + spinSetAllTrimbits->setValue(0); + myDet->setAllTrimbits(0); + qDefs::checkErrorMessage(myDet,"qTabAdvanced::updateAllTrimbitsFromServer"); + }else + spinSetAllTrimbits->setValue(ret); + + connect(spinSetAllTrimbits, SIGNAL(editingFinished()), this, SLOT(SetAllTrimbits())); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + void qTabAdvanced::Refresh(){ @@ -1261,6 +1308,9 @@ void qTabAdvanced::Refresh(){ #endif updateROIList(); + //update alltirmbits from server + if(boxSetAllTrimbits->isEnabled()) + updateAllTrimbitsFromServer(); #ifdef VERBOSE cout << "**Updated Advanced Tab" << endl << endl; From 2ed8b46ad0d032b06fe08aab98c1d3e7d797b068 Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Wed, 23 Sep 2015 11:50:47 +0200 Subject: [PATCH 305/332] displaying subframe index in gui --- slsDetectorGui/include/qDrawPlot.h | 4 ++-- slsDetectorGui/src/qDrawPlot.cpp | 12 ++++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index 0b709b57d..1660eec9a 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -229,10 +229,10 @@ int ResetDaqForGui(); static void* DataStartAcquireThread(void *this_pointer); /** This is called by the detector class to copy the data it jus acquired */ -static int GetDataCallBack(detectorData *data, int fIndex, void *this_pointer); +static int GetDataCallBack(detectorData *data, int fIndex, int subIndex, void *this_pointer); /** This is called by the GetDataCallBack function to copy the data */ -int GetData(detectorData *data, int fIndex); +int GetData(detectorData *data, int fIndex, int subIndex); /** This is called by detector class when acquisition is finished * @param currentProgress current progress of measurement diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 1638f4a08..326deba11 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -735,8 +735,8 @@ void* qDrawPlot::DataStartAcquireThread(void *this_pointer){ //------------------------------------------------------------------------------------------------------------------------------------------------- -int qDrawPlot::GetDataCallBack(detectorData *data, int fIndex, void *this_pointer){ - ((qDrawPlot*)this_pointer)->GetData(data,fIndex); +int qDrawPlot::GetDataCallBack(detectorData *data, int fIndex, int subIndex, void *this_pointer){ + ((qDrawPlot*)this_pointer)->GetData(data,fIndex, subIndex); return 0; } @@ -744,10 +744,11 @@ int qDrawPlot::GetDataCallBack(detectorData *data, int fIndex, void *this_pointe //------------------------------------------------------------------------------------------------------------------------------------------------- -int qDrawPlot::GetData(detectorData *data,int fIndex){ +int qDrawPlot::GetData(detectorData *data,int fIndex, int subIndex){ #ifdef VERYVERBOSE cout << "******Entering GetDatafunction********" << endl; cout << "fIndex " << fIndex << endl; + cout << "subIndex " << subIndex << endl; cout << "fname " << data->fileName << endl; cout << "npoints " << data->npoints << endl; cout << "npy " << data->npy << endl; @@ -775,11 +776,14 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){ if(fIndex!=-1){ currentFrameIndex=fIndex; sprintf(temp_title,"#%d",fIndex); + if((myDet->getDetectorsType()==slsDetectorDefs::EIGER) && (subIndex != -1)) + sprintf(temp_title,"#%d %d",fIndex,subIndex); }else{ if(fileSaveEnable) strcpy(temp_title,"#%d"); else sprintf(temp_title,"",currentFrame); } - + if(subIndex != -1) + sprintf(temp_title,"#%d %d",fIndex,subIndex); //Plot Disabled if(!plotEnable) return 0; From 73ebb2750c246c825147a3643171e8c3a971f508 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Br=C3=BCckner?= Date: Fri, 23 Oct 2015 12:03:19 +0200 Subject: [PATCH 306/332] Better commandline parsing --- slsDetectorGui/src/qDetectorMain.cpp | 47 ++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 7777967fc..efffa5b96 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -25,6 +25,7 @@ // C++ Include Headers #include #include +#include using namespace std; @@ -47,9 +48,51 @@ 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(0),tabs(0),isDeveloper(0){ -bool found; +// bool found; + int c; string configFName = ""; + optind=1; // Getting all the command line arguments + while(1) { + static struct option long_options[] = { + { "developer", no_argument, 0, 'd' }, + { "config", required_argument, 0, 'f' }, + { "id", required_argument, 0, 'i' }, + { "f", required_argument, 0, 'f' }, + { "help", no_argument, 0, 'h' }, + { 0, 0, 0, 0 } + }; + c = getopt_long (argc, argv, "hdf:i:", long_options, NULL); + if (c == -1) break; + + switch (c) { + case 'd' : + isDeveloper=1; + break; + case 'f' : + configFName=string(optarg); + break; + case 'i' : + detID=atoi(optarg); + break; + case 'h' : + default: + cout << endl; + cout << "\t" << argv[0] << " [ARGUMENT]..." << endl; + cout << endl; + cout << "Possible Arguments are:" << endl; + cout << "\t-d, --developer \t\t : \t Enables the developer tab" << endl; + cout << "\t-f, --f, --config fname\t\t : \t Loads config file fname" << endl; + cout << "\t-i, --id NUMBER \t\t : \t Sets the multi detector id to NUMBER (the default is 0). " + "Required only when more than one multi detector object is needed." << endl; + exit(-1); + } + } + if (optind < argc) { + cout << "invalid option, try --help" << endl; + exit(-1); + } +/* for(int iarg=1; iarg Date: Mon, 26 Oct 2015 11:31:56 +0100 Subject: [PATCH 307/332] output dir multi for all --- slsDetectorGui/src/qTabDataOutput.cpp | 99 ++++++++++----------------- 1 file changed, 38 insertions(+), 61 deletions(-) diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index 3465bddc9..9c12888e7 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -129,11 +129,11 @@ void qTabDataOutput::SetupWidgetWindow(){ chkDiscardBad->setChecked(false); connect(chkDiscardBad, SIGNAL(toggled(bool)), this, SLOT(DiscardBadChannels())); - +/* if(detType == slsDetectorDefs::MYTHEN){ comboDetector->hide(); } - +*/ qDefs::checkErrorMessage(myDet,"qTabDataOutput::SetupWidgetWindow"); } @@ -492,14 +492,10 @@ void qTabDataOutput::PopulateDetectors(){ cout << "Populating detectors" << endl; #endif comboDetector->clear(); - if(myDet->setReceiverOnline() == slsDetectorDefs::OFFLINE_FLAG){ - boxOutDir->setTitle("Output Directory"); - comboDetector->addItem("All"); - } - - //if receiver, add detectors - else{ - boxOutDir->setTitle("Receiver Output Directory"); + comboDetector->addItem("All"); + boxOutDir->setTitle("Output Directory"); + //add specific detector options only if more than 1 detector + if(myDet->getNumberOfDetectors()>1){ for(int i=0;igetNumberOfDetectors();i++) comboDetector->addItem(QString(myDet->getHostname(i).c_str())); } @@ -514,11 +510,13 @@ void qTabDataOutput::GetOutputDir(){ #ifdef VERBOSE cout << "Getting output directory" << endl; #endif - - if(!comboDetector->itemText(0).compare("All")){ + //all + if(!comboDetector->currentIndex()) dispReadOutputDir->setText(QString(myDet->getFilePath().c_str())); - }else{ - slsDetector *det = myDet->getSlsDetector(comboDetector->currentIndex()); + + //specific + else{ + slsDetector *det = myDet->getSlsDetector(comboDetector->currentIndex()-1); qDefs::checkErrorMessage(myDet,"qTabDataOutput::GetOutputDir"); dispReadOutputDir->setText(QString(det->getFilePath().c_str())); } @@ -543,8 +541,8 @@ int qTabDataOutput::VerifyOutputDirectory(){ #endif bool error = false; QString errTip = outDirTip; - bool receiver = (comboDetector->itemText(0).compare("All")); - string path = string(dispReadOutputDir->text().toAscii().constData()); + string path = ""; + string inputpath = string(dispReadOutputDir->text().toAscii().constData()); string detName = ""; string mess = ""; @@ -552,11 +550,13 @@ int qTabDataOutput::VerifyOutputDirectory(){ for(int i=0;igetNumberOfDetectors();i++){ slsDetector *det = myDet->getSlsDetector(i); qDefs::checkErrorMessage(myDet,"qTabDataOutput::VerifyOutputDirectory"); - if(receiver){ - detName = string("\n - ") + string(comboDetector->itemText(i).toAscii().constData()) ; + detName = string("\n - ") + string(comboDetector->itemText(i+1).toAscii().constData()); + if(!comboDetector->currentIndex()) + path = inputpath; + else path = det->getFilePath(); - } + //verify if specific outdir works for each det if(det->setFilePath(path).empty()){ mess. append(detName); error = true; @@ -570,13 +570,15 @@ int qTabDataOutput::VerifyOutputDirectory(){ error = true; qDefs::Message(qDefs::WARNING,string("Enter a valid output directory ") + detName,"Data Output Verify"); }*/ - myDet->setFilePath(det->getFilePath()); + //myDet->setFilePath(det->getFilePath()); } - //set the read output dir anyway - if(receiver) - path = myDet->getSlsDetector(comboDetector->currentIndex())->getFilePath(); + //set the read output dir text anyway + //specific + if(comboDetector->currentIndex()) + path = myDet->getSlsDetector(comboDetector->currentIndex()-1)->getFilePath(); + //all else path = myDet->getFilePath(); dispReadOutputDir->setText(QString(path.c_str())); @@ -602,11 +604,7 @@ int qTabDataOutput::VerifyOutputDirectory(){ "Invalid Output Directory") + QString(mess.c_str()) + QString( ".
"); boxOutDir->setToolTip(errTip); - - if(receiver) - boxOutDir->setTitle("Receiver Output Directory*"); - else - boxOutDir->setTitle("Output Directory*"); + boxOutDir->setTitle("Output Directory*"); return slsDetectorDefs::FAIL; } @@ -619,11 +617,7 @@ int qTabDataOutput::VerifyOutputDirectory(){ dispReadOutputDir->setPalette(*black1); boxOutDir->setPalette(black); boxOutDir->setToolTip(outDirTip); - - if(receiver) - boxOutDir->setTitle("Receiver Output Directory"); - else - boxOutDir->setTitle("Output Directory"); + boxOutDir->setTitle("Output Directory"); } return slsDetectorDefs::OK; @@ -641,7 +635,6 @@ void qTabDataOutput::SetOutputDir(){ #endif bool error = false; - bool receiver = (comboDetector->itemText(0).compare("All")); QString path = dispOutputDir->text(); if(path.isEmpty()) @@ -654,45 +647,29 @@ void qTabDataOutput::SetOutputDir(){ while(path.endsWith('/')) path.chop(1); dispOutputDir->setText(path); - - if(receiver){ - slsDetector *det = myDet->getSlsDetector(comboDetector->currentIndex()); + //specific + if(comboDetector->currentIndex()){ + slsDetector *det = myDet->getSlsDetector(comboDetector->currentIndex()-1); qDefs::checkErrorMessage(myDet,"qTabDataOutput::SetOutputDir"); det->setFilePath(string(dispOutputDir->text().toAscii().constData())); + //if error, set it to what it was set before if(!qDefs::checkErrorMessage(det,"qTabDataOutput::SetOutputDir").empty()){ #ifdef VERBOSE cout << "The output path could not be set" << endl; #endif det->setFilePath(string(dispReadOutputDir->text().toAscii().constData())); + dispReadOutputDir->setText(QString(det->getFilePath().c_str())); error = true; - dispOutputDir->setPalette(*red1); } - myDet->setFilePath(det->getFilePath()); } else{ - //for each detector - for(int i=0;igetNumberOfDetectors();i++){ - slsDetector *det = myDet->getSlsDetector(i); - qDefs::checkErrorMessage(myDet,"qTabDataOutput::SetOutputDir"); - if(det->setFilePath(string(path.toAscii().constData())).empty()){ - error = true; - }else if(!qDefs::checkErrorMessage(det,"qTabDataOutput::SetOutputDir",false).empty()){ - error = true; - } - myDet->setFilePath(det->getFilePath()); - } - - - if(error){ - qDefs::Message(qDefs::WARNING,string("Invalid output directory "),"qTabDataOutput::SetOutputDir"); - for(int i=0;igetNumberOfDetectors();i++){ - slsDetector *det = myDet->getSlsDetector(i); - qDefs::checkErrorMessage(myDet,"qTabDataOutput::SetOutputDir"); - det->setFilePath(string(dispReadOutputDir->text().toAscii().constData())); - } - } + if(myDet->setFilePath(string(path.toAscii().constData())).empty()) + error = true; + else if(!qDefs::checkErrorMessage(myDet,"qTabDataOutput::SetOutputDir").empty()) + error = true; + myDet->setFilePath(string(dispReadOutputDir->text().toAscii().constData())); dispReadOutputDir->setText(QString(myDet->getFilePath().c_str())); } @@ -711,7 +688,7 @@ void qTabDataOutput::SetOutputDir(){ dispOutputDir->setPalette(*black1); dispReadOutputDir->setText(dispOutputDir->text()); dispOutputDir->setText(""); - VerifyOutputDirectory(); + //VerifyOutputDirectory(); } From 8ecc7955749ce8462def0c6e6f7f034144109339 Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Fri, 13 Nov 2015 13:48:30 +0100 Subject: [PATCH 308/332] corrected settings for eiger;removed loqwnoise to lowgain --- slsDetectorGui/src/qTabSettings.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/slsDetectorGui/src/qTabSettings.cpp b/slsDetectorGui/src/qTabSettings.cpp index 413c4c123..b0fc4788e 100644 --- a/slsDetectorGui/src/qTabSettings.cpp +++ b/slsDetectorGui/src/qTabSettings.cpp @@ -127,10 +127,10 @@ void qTabSettings::SetupDetectorSettings(){ item[(int)Fast]->setEnabled(false); item[(int)HighGain]->setEnabled(true); item[(int)DynamicGain]->setEnabled(false); - item[(int)LowGain]->setEnabled(false); + item[(int)LowGain]->setEnabled(true); item[(int)MediumGain]->setEnabled(false); item[(int)VeryHighGain]->setEnabled(false); - item[(int)LowNoise]->setEnabled(true); + item[(int)LowNoise]->setEnabled(false); break; case slsDetectorDefs::MOENCH: case slsDetectorDefs::PROPIX: From b803f3a32a1ca86b7ea70ffb1fe1d4c1e41ad08f Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Fri, 27 Nov 2015 17:30:45 +0100 Subject: [PATCH 309/332] works for jungfrau --- slsDetectorGui/src/qDetectorMain.cpp | 9 +- slsDetectorGui/src/qDrawPlot.cpp | 1 + slsDetectorGui/src/qTabActions.cpp | 1 + slsDetectorGui/src/qTabAdvanced.cpp | 13 +- slsDetectorGui/src/qTabDebugging.cpp | 24 +++- slsDetectorGui/src/qTabDeveloper.cpp | 175 ++++++++++++++++--------- slsDetectorGui/src/qTabMeasurement.cpp | 1 + slsDetectorGui/src/qTabPlot.cpp | 2 + slsDetectorGui/src/qTabSettings.cpp | 12 +- 9 files changed, 170 insertions(+), 68 deletions(-) diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index efffa5b96..c3d39928b 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -276,7 +276,10 @@ void qDetectorMain::SetUpDetector(const string fName){ case slsDetectorDefs::GOTTHARD: case slsDetectorDefs::AGIPD: case slsDetectorDefs::PROPIX: - case slsDetectorDefs::MOENCH: actionLoadTrimbits->setText("Load Settings"); actionSaveTrimbits->setText("Save Settings"); break; + case slsDetectorDefs::MOENCH: + case slsDetectorDefs::JUNGFRAU: + actionLoadTrimbits->setText("Load Settings"); actionSaveTrimbits->setText("Save Settings"); + break; default: string detName = myDet->slsDetectorBase::getDetectorType(detType); qDefs::checkErrorMessage(myDet,"qDetectorMain::SetUpDetector"); @@ -647,7 +650,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ void qDetectorMain::ExecuteHelp(QAction *action){ if(action==actionAbout){ #ifdef VERBOSE - cout << "About: Common GUI for Mythen, Eiger, Gotthard and Propix detectors" << endl; + cout << "About: Common GUI for Mythen, Eiger, Gotthard, Jungfrau, Moench and Propix detectors" << endl; #endif char version[200]; int64_t retval= SVNREV; @@ -664,7 +667,7 @@ void qDetectorMain::ExecuteHelp(QAction *action){ "SLS Detector GUI version:   " + thisGUIVersion+"
" "SLS Detector Client version: "+thisClientVersion+"

" "Common GUI to control the SLS Detectors: " - "Mythen, Eiger, Gotthard and Propix.

" + "Mythen, Eiger, Gotthard, Jungfrau, Moench and Propix.

" "It can be operated in parallel with the command line interface:
" "sls_detector_put,
sls_detector_get,
sls_detector_acquire and
sls_detector_help.

" "The GUI Software is still in progress. " diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 326deba11..67f3ed720 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -69,6 +69,7 @@ void qDrawPlot::SetupWidgetWindow(){ case slsDetectorDefs::GOTTHARD: originally2D = false; break; case slsDetectorDefs::PROPIX: originally2D = true; break; case slsDetectorDefs::MOENCH: originally2D = true; break; + case slsDetectorDefs::JUNGFRAU: originally2D = true; break; default: cout << "ERROR: Detector Type is Generic" << endl; exit(-1); diff --git a/slsDetectorGui/src/qTabActions.cpp b/slsDetectorGui/src/qTabActions.cpp index ad450dbed..c53c93499 100644 --- a/slsDetectorGui/src/qTabActions.cpp +++ b/slsDetectorGui/src/qTabActions.cpp @@ -184,6 +184,7 @@ void qTabActions::SetupWidgetWindow(){ if((detType == slsDetectorDefs::EIGER) || (detType == slsDetectorDefs::AGIPD) || (detType == slsDetectorDefs::PROPIX) || + (detType == slsDetectorDefs::JUNGFRAU) || (detType == slsDetectorDefs::MOENCH)) { lblName[NumPositions]->setEnabled(false); btnExpand[NumPositions]->setEnabled(false); diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp index 2e141bfe5..6c4f290b5 100644 --- a/slsDetectorGui/src/qTabAdvanced.cpp +++ b/slsDetectorGui/src/qTabAdvanced.cpp @@ -106,6 +106,15 @@ void qTabAdvanced::SetupWidgetWindow(){ dispMAC->setEnabled(true); boxRxr->setEnabled(true); break; + case slsDetectorDefs::JUNGFRAU: + isEnergy = false; + isAngular = false; + lblIP->setEnabled(true); + lblMAC->setEnabled(true); + dispIP->setEnabled(true); + dispMAC->setEnabled(true); + boxRxr->setEnabled(true); + break; default: break; } @@ -249,7 +258,8 @@ void qTabAdvanced::Initialization(){ if((detType==slsDetectorDefs::GOTTHARD) || (detType==slsDetectorDefs::MOENCH) || (detType==slsDetectorDefs::PROPIX) || - (detType==slsDetectorDefs::EIGER)){ + (detType==slsDetectorDefs::PROPIX) || + (detType==slsDetectorDefs::JUNGFRAU)){ //network connect(spinTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int))); @@ -1238,6 +1248,7 @@ void qTabAdvanced::Refresh(){ if ((detType==slsDetectorDefs::GOTTHARD) || (detType==slsDetectorDefs::MOENCH)|| (detType==slsDetectorDefs::PROPIX)|| + (detType==slsDetectorDefs::JUNGFRAU)|| (detType==slsDetectorDefs::EIGER)){ //disconnect disconnect(spinTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int))); diff --git a/slsDetectorGui/src/qTabDebugging.cpp b/slsDetectorGui/src/qTabDebugging.cpp index 80c0125e0..150f8dbe7 100644 --- a/slsDetectorGui/src/qTabDebugging.cpp +++ b/slsDetectorGui/src/qTabDebugging.cpp @@ -73,6 +73,7 @@ void qTabDebugging::SetupWidgetWindow(){ chkChip->setEnabled(false); chkModuleFirmware->setEnabled(false); break; + case slsDetectorDefs::JUNGFRAU: case slsDetectorDefs::PROPIX: case slsDetectorDefs::GOTTHARD: lblDetector->setText("Module:"); @@ -341,6 +342,26 @@ void qTabDebugging::GetInfo(){ break; + case slsDetectorDefs::JUNGFRAU: + + //display widget + formLayout->addWidget(new QLabel("Module:"),0,0); + formLayout->addItem(new QSpacerItem(15,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,1); + formLayout->addWidget(lblDetectorId,0,2); + formLayout->addWidget(new QLabel("Module MAC Address:"),1,0); + formLayout->addWidget(lblDetectorSerial,1,2); + formLayout->addWidget(new QLabel("Module Firmware Version:"),2,0); + formLayout->addWidget(lblDetectorFirmware,2,2); + formLayout->addWidget(new QLabel("Module Software Version:"),3,0); + formLayout->addWidget(lblDetectorSoftware,3,2); + //tree widget + treeDet->setHeaderLabel("JungFrau Detector"); + //gets det names + for (int i=0;icount();i++) + items.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString("Module (%1)").arg(comboDetector->itemText(i))))); + treeDet->insertTopLevelItems(0, items); + + break; default: @@ -448,7 +469,7 @@ void qTabDebugging::SetParameters(QTreeWidgetItem *item){ break; - + case slsDetectorDefs::JUNGFRAU: case slsDetectorDefs::PROPIX: case slsDetectorDefs::MOENCH: case slsDetectorDefs::GOTTHARD: @@ -497,6 +518,7 @@ void qTabDebugging::TestDetector(){ message = QString("Test Results for %1 and %2:

").arg(comboDetector->currentText(),comboModule->currentText()); break; case slsDetectorDefs::EIGER: Detector = "Half Module"; break; + case slsDetectorDefs::JUNGFRAU: case slsDetectorDefs::MOENCH: case slsDetectorDefs::PROPIX: case slsDetectorDefs::GOTTHARD: Detector = "Module"; break; diff --git a/slsDetectorGui/src/qTabDeveloper.cpp b/slsDetectorGui/src/qTabDeveloper.cpp index 5c17c04ed..56e46b47b 100644 --- a/slsDetectorGui/src/qTabDeveloper.cpp +++ b/slsDetectorGui/src/qTabDeveloper.cpp @@ -137,6 +137,31 @@ void qTabDeveloper::SetupWidgetWindow(){ adcNames.push_back("Temperature FPGA:"); break; + + + case slsDetectorDefs::JUNGFRAU: + NUM_DAC_WIDGETS = 16; + NUM_ADC_WIDGETS = 0; + dacNames.push_back("v Dac 0:"); + dacNames.push_back("v Dac 1:"); + dacNames.push_back("v Dac 2:"); + dacNames.push_back("v Dac 3:"); + dacNames.push_back("v Dac 4:"); + dacNames.push_back("v Dac 5:"); + dacNames.push_back("v Dac 6:"); + dacNames.push_back("i Dac 7:"); + dacNames.push_back("v Dac 8:"); + dacNames.push_back("v Dac 9:"); + dacNames.push_back("v Dac 10:"); + dacNames.push_back("v Dac 11:"); + dacNames.push_back("v Dac 12:"); + dacNames.push_back("v Dac 13:"); + dacNames.push_back("v Dac 14:"); + dacNames.push_back("i Dac 15:"); + + + break; + default: cout << "ERROR: Unknown detector type: " + myDet->slsDetectorBase::getDetectorType(detType) << endl; qDefs::Message(qDefs::CRITICAL,string("Unknown detector type:")+myDet->slsDetectorBase::getDetectorType(detType),"qTabDeveloper::SetupWidgetWindow"); @@ -378,72 +403,98 @@ slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(int index){ break; } break; - case slsDetectorDefs::EIGER: - switch(index){ - case 0: return slsDetectorDefs::E_SvP; - case 1: return slsDetectorDefs::E_SvN; - case 2: return slsDetectorDefs::E_Vrf; - case 3: return slsDetectorDefs::E_Vrs; - case 4: return slsDetectorDefs::E_Vtr; - case 5: return slsDetectorDefs::E_Vtgstv; - case 6: return slsDetectorDefs::E_cal; - case 7: return slsDetectorDefs::E_Vcp; - case 8: return slsDetectorDefs::E_Vcn; - case 9: return slsDetectorDefs::E_Vis; - case 10:return slsDetectorDefs::E_rxb_lb; - case 11:return slsDetectorDefs::E_rxb_rb; - case 12:return slsDetectorDefs::E_Vcmp_ll; - case 13:return slsDetectorDefs::E_Vcmp_lr; - case 14:return slsDetectorDefs::E_Vcmp_rl; - case 15:return slsDetectorDefs::E_Vcmp_rr; - case 16:return slsDetectorDefs::THRESHOLD; + case slsDetectorDefs::EIGER: + switch(index){ + case 0: return slsDetectorDefs::E_SvP; + case 1: return slsDetectorDefs::E_SvN; + case 2: return slsDetectorDefs::E_Vrf; + case 3: return slsDetectorDefs::E_Vrs; + case 4: return slsDetectorDefs::E_Vtr; + case 5: return slsDetectorDefs::E_Vtgstv; + case 6: return slsDetectorDefs::E_cal; + case 7: return slsDetectorDefs::E_Vcp; + case 8: return slsDetectorDefs::E_Vcn; + case 9: return slsDetectorDefs::E_Vis; + case 10:return slsDetectorDefs::E_rxb_lb; + case 11:return slsDetectorDefs::E_rxb_rb; + case 12:return slsDetectorDefs::E_Vcmp_ll; + case 13:return slsDetectorDefs::E_Vcmp_lr; + case 14:return slsDetectorDefs::E_Vcmp_rl; + case 15:return slsDetectorDefs::E_Vcmp_rr; + case 16:return slsDetectorDefs::THRESHOLD; - default: - qDefs::Message(qDefs::CRITICAL,"Unknown DAC/ADC Index. Weird Error Index:"+ index,"qTabDeveloper::getSLSIndex"); - Refresh(); + default: + qDefs::Message(qDefs::CRITICAL,"Unknown DAC/ADC Index. Weird Error Index:"+ index,"qTabDeveloper::getSLSIndex"); + Refresh(); + break; + } break; - } - break; - case slsDetectorDefs::MOENCH: - switch(index){ - case 0: return slsDetectorDefs::V_DAC0; - case 1: return slsDetectorDefs::V_DAC1; - case 2: return slsDetectorDefs::V_DAC2; - case 3: return slsDetectorDefs::V_DAC3; - case 4: return slsDetectorDefs::V_DAC4; - case 5: return slsDetectorDefs::V_DAC5; - case 6: return slsDetectorDefs::V_DAC6; - case 7: return slsDetectorDefs::V_DAC7; - case 8: return slsDetectorDefs::TEMPERATURE_ADC; - case 9:return slsDetectorDefs::TEMPERATURE_FPGA; + case slsDetectorDefs::MOENCH: + switch(index){ + case 0: return slsDetectorDefs::V_DAC0; + case 1: return slsDetectorDefs::V_DAC1; + case 2: return slsDetectorDefs::V_DAC2; + case 3: return slsDetectorDefs::V_DAC3; + case 4: return slsDetectorDefs::V_DAC4; + case 5: return slsDetectorDefs::V_DAC5; + case 6: return slsDetectorDefs::V_DAC6; + case 7: return slsDetectorDefs::V_DAC7; + case 8: return slsDetectorDefs::TEMPERATURE_ADC; + case 9:return slsDetectorDefs::TEMPERATURE_FPGA; - default: - qDefs::Message(qDefs::CRITICAL,"Unknown DAC/ADC Index. Weird Error. Index:"+ index,"qTabDeveloper::getSLSIndex"); - Refresh(); - break; - } - break; - case slsDetectorDefs::PROPIX: - case slsDetectorDefs::GOTTHARD: - switch(index){ - case 0: return slsDetectorDefs::G_VREF_DS; - case 1: return slsDetectorDefs::G_VCASCN_PB; - case 2: return slsDetectorDefs::G_VCASCP_PB; - case 3: return slsDetectorDefs::G_VOUT_CM; - case 4: return slsDetectorDefs::G_VCASC_OUT; - case 5: return slsDetectorDefs::G_VIN_CM; - case 6: return slsDetectorDefs::G_VREF_COMP; - case 7: return slsDetectorDefs::G_IB_TESTC; - case 8: return slsDetectorDefs::TEMPERATURE_ADC; - case 9:return slsDetectorDefs::TEMPERATURE_FPGA; - default: - qDefs::Message(qDefs::CRITICAL,"Unknown DAC/ADC Index. Weird Error Index:"+ index,"qTabDeveloper::getSLSIndex"); - Refresh(); - break; - } - break; - default: + default: + qDefs::Message(qDefs::CRITICAL,"Unknown DAC/ADC Index. Weird Error. Index:"+ index,"qTabDeveloper::getSLSIndex"); + Refresh(); + break; + } + break; + case slsDetectorDefs::PROPIX: + case slsDetectorDefs::GOTTHARD: + switch(index){ + case 0: return slsDetectorDefs::G_VREF_DS; + case 1: return slsDetectorDefs::G_VCASCN_PB; + case 2: return slsDetectorDefs::G_VCASCP_PB; + case 3: return slsDetectorDefs::G_VOUT_CM; + case 4: return slsDetectorDefs::G_VCASC_OUT; + case 5: return slsDetectorDefs::G_VIN_CM; + case 6: return slsDetectorDefs::G_VREF_COMP; + case 7: return slsDetectorDefs::G_IB_TESTC; + case 8: return slsDetectorDefs::TEMPERATURE_ADC; + case 9:return slsDetectorDefs::TEMPERATURE_FPGA; + default: + qDefs::Message(qDefs::CRITICAL,"Unknown DAC/ADC Index. Weird Error Index:"+ index,"qTabDeveloper::getSLSIndex"); + Refresh(); + break; + } + break; + case slsDetectorDefs::JUNGFRAU: + switch(index){ + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + return (slsDetectorDefs::dacIndex)index; + break; + default: + qDefs::Message(qDefs::CRITICAL,"Unknown DAC/ADC Index. Weird Error Index:"+ index,"qTabDeveloper::getSLSIndex"); + Refresh(); + break; + } + break; + default: cout << "Unknown detector type:" + myDet->slsDetectorBase::getDetectorType(detType) << endl; qDefs::Message(qDefs::CRITICAL,string("Unknown detector type:")+myDet->slsDetectorBase::getDetectorType(detType),"qTabDeveloper::getSLSIndex"); qDefs::checkErrorMessage(myDet,"qTabDeveloper::getSLSIndex"); diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 5d417b3ba..445ec4bab 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -147,6 +147,7 @@ void qTabMeasurement::SetupTimingMode(){ case slsDetectorDefs::MOENCH: case slsDetectorDefs::PROPIX: case slsDetectorDefs::GOTTHARD: + case slsDetectorDefs::JUNGFRAU: item[(int)Trigger_Exp_Series]->setEnabled(true); item[(int)Trigger_Readout]->setEnabled(false); item[(int)Gated]->setEnabled(false); diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index 97f73a078..7f23fe316 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -177,6 +177,7 @@ void qTabPlot::SetupWidgetWindow(){ break; case slsDetectorDefs::PROPIX: case slsDetectorDefs::MOENCH: + case slsDetectorDefs::JUNGFRAU: isOriginallyOneD = false; break; default: @@ -788,6 +789,7 @@ void qTabPlot::EnableScanBox(){ pageAccumulate_2->setEnabled(true); if((myDet->getDetectorsType() == slsDetectorDefs::GOTTHARD) || (myDet->getDetectorsType() == slsDetectorDefs::PROPIX) || + (myDet->getDetectorsType() == slsDetectorDefs::JUNGFRAU) || (myDet->getDetectorsType() == slsDetectorDefs::MOENCH)){ pagePedestal->setEnabled(true); pagePedestal_2->setEnabled(true); diff --git a/slsDetectorGui/src/qTabSettings.cpp b/slsDetectorGui/src/qTabSettings.cpp index b0fc4788e..4c6772c66 100644 --- a/slsDetectorGui/src/qTabSettings.cpp +++ b/slsDetectorGui/src/qTabSettings.cpp @@ -100,7 +100,7 @@ void qTabSettings::GetDynamicRange(int setvalue){ void qTabSettings::SetupDetectorSettings(){ // Get detector settings from detector - slsDetectorDefs::detectorSettings sett = myDet->getSettings(); + slsDetectorDefs::detectorSettings sett = myDet->getSettings();cout<<"sett:"<setEnabled(true); item[(int)LowNoise]->setEnabled(false); break; + case slsDetectorDefs::JUNGFRAU: + item[(int)Standard]->setEnabled(false); + item[(int)Fast]->setEnabled(false); + item[(int)HighGain]->setEnabled(true); + item[(int)DynamicGain]->setEnabled(false); + item[(int)LowGain]->setEnabled(false); + item[(int)MediumGain]->setEnabled(false); + item[(int)VeryHighGain]->setEnabled(false); + item[(int)LowNoise]->setEnabled(false); + break; default: cout << "Unknown detector type. Exiting GUI." << endl; qDefs::Message(qDefs::CRITICAL,"Unknown detector type. Exiting GUI.","qTabSettings::SetupDetectorSettings"); From 700346fbbe7a6ad93ee14d39311e3453f001c4b9 Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Tue, 1 Dec 2015 17:15:41 +0100 Subject: [PATCH 310/332] some changes for gui for settings for jungfrau --- slsDetectorGui/forms/form_tab_settings.ui | 25 +++++++++++++++++++++++ slsDetectorGui/include/qTabSettings.h | 4 +++- slsDetectorGui/src/qTabSettings.cpp | 24 ++++++++++++++++++++-- 3 files changed, 50 insertions(+), 3 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_settings.ui b/slsDetectorGui/forms/form_tab_settings.ui index 404dfcfba..797756a33 100644 --- a/slsDetectorGui/forms/form_tab_settings.ui +++ b/slsDetectorGui/forms/form_tab_settings.ui @@ -100,6 +100,31 @@ Low Noise + + + Dynamic HG0 + + + + + Fix Gain 1 + + + + + Fix Gain 2 + + + + + Force Switch G1 + + + + + Force Switch G2 + + Undefined diff --git a/slsDetectorGui/include/qTabSettings.h b/slsDetectorGui/include/qTabSettings.h index e66afedf3..2c5127bec 100644 --- a/slsDetectorGui/include/qTabSettings.h +++ b/slsDetectorGui/include/qTabSettings.h @@ -57,7 +57,9 @@ private: /** expert mode */ bool expertMode; - enum{Standard,Fast,HighGain,DynamicGain,LowGain,MediumGain,VeryHighGain,LowNoise,Undefined,Uninitialized,NumSettings}; + enum{Standard,Fast,HighGain,DynamicGain,LowGain,MediumGain,VeryHighGain,LowNoise, + DynamicHG0,FixGain1,FixGain2,ForceSwitchG1,ForceSwitchG2, + Undefined,Uninitialized,NumSettings}; /** To be able to index items on a combo box */ QStandardItemModel* model; diff --git a/slsDetectorGui/src/qTabSettings.cpp b/slsDetectorGui/src/qTabSettings.cpp index 4c6772c66..d5b181dad 100644 --- a/slsDetectorGui/src/qTabSettings.cpp +++ b/slsDetectorGui/src/qTabSettings.cpp @@ -121,6 +121,11 @@ void qTabSettings::SetupDetectorSettings(){ item[(int)MediumGain]->setEnabled(false); item[(int)VeryHighGain]->setEnabled(false); item[(int)LowNoise]->setEnabled(false); + item[(int)DynamicHG0]->setEnabled(false); + item[(int)FixGain1]->setEnabled(false); + item[(int)FixGain2]->setEnabled(false); + item[(int)ForceSwitchG1]->setEnabled(false); + item[(int)ForceSwitchG2]->setEnabled(false); break; case slsDetectorDefs::EIGER: item[(int)Standard]->setEnabled(true); @@ -131,6 +136,11 @@ void qTabSettings::SetupDetectorSettings(){ item[(int)MediumGain]->setEnabled(false); item[(int)VeryHighGain]->setEnabled(false); item[(int)LowNoise]->setEnabled(false); + item[(int)DynamicHG0]->setEnabled(false); + item[(int)FixGain1]->setEnabled(false); + item[(int)FixGain2]->setEnabled(false); + item[(int)ForceSwitchG1]->setEnabled(false); + item[(int)ForceSwitchG2]->setEnabled(false); break; case slsDetectorDefs::MOENCH: case slsDetectorDefs::PROPIX: @@ -143,16 +153,26 @@ void qTabSettings::SetupDetectorSettings(){ item[(int)MediumGain]->setEnabled(true); item[(int)VeryHighGain]->setEnabled(true); item[(int)LowNoise]->setEnabled(false); + item[(int)DynamicHG0]->setEnabled(false); + item[(int)FixGain1]->setEnabled(false); + item[(int)FixGain2]->setEnabled(false); + item[(int)ForceSwitchG1]->setEnabled(false); + item[(int)ForceSwitchG2]->setEnabled(false); break; case slsDetectorDefs::JUNGFRAU: item[(int)Standard]->setEnabled(false); item[(int)Fast]->setEnabled(false); - item[(int)HighGain]->setEnabled(true); - item[(int)DynamicGain]->setEnabled(false); + item[(int)HighGain]->setEnabled(false); + item[(int)DynamicGain]->setEnabled(true); item[(int)LowGain]->setEnabled(false); item[(int)MediumGain]->setEnabled(false); item[(int)VeryHighGain]->setEnabled(false); item[(int)LowNoise]->setEnabled(false); + item[(int)DynamicHG0]->setEnabled(true); + item[(int)FixGain1]->setEnabled(true); + item[(int)FixGain2]->setEnabled(true); + item[(int)ForceSwitchG1]->setEnabled(true); + item[(int)ForceSwitchG2]->setEnabled(true); break; default: cout << "Unknown detector type. Exiting GUI." << endl; From d489b34824ab11cca0c20f32f254677913f936a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Br=C3=BCckner?= Date: Tue, 2 Feb 2016 10:49:40 +0100 Subject: [PATCH 311/332] Test commit, added a space in makefile --- slsDetectorGui/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slsDetectorGui/Makefile b/slsDetectorGui/Makefile index 26b0c4318..39ba5f91b 100644 --- a/slsDetectorGui/Makefile +++ b/slsDetectorGui/Makefile @@ -1,5 +1,5 @@ # LEO: Won't compile without libSlsDetector - + include ../Makefile.include $(info ) From 1633cc3f01db4689f370f97adefeb02454f8d29b Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Wed, 17 Feb 2016 18:04:24 +0100 Subject: [PATCH 312/332] incorporated rate correction of eiger into gui --- slsDetectorGui/forms/form_tab_dataoutput.ui | 7 ++- slsDetectorGui/src/qTabDataOutput.cpp | 53 ++++++++++++++------- 2 files changed, 42 insertions(+), 18 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_dataoutput.ui b/slsDetectorGui/forms/form_tab_dataoutput.ui index 5e383bb75..5a0d355ab 100644 --- a/slsDetectorGui/forms/form_tab_dataoutput.ui +++ b/slsDetectorGui/forms/form_tab_dataoutput.ui @@ -80,7 +80,7 @@ Directory where one saves the data. 10 10 716 - 86 + 92 @@ -396,7 +396,10 @@ Compression using Root. Available only for Gotthard in Expert Mode. ns - 6 + 9 + + + -2.000000000000000 2000000000.000000000000000 diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index 9c12888e7..5ca1a3841 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -5,8 +5,6 @@ * 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" @@ -155,7 +153,7 @@ void qTabDataOutput::Initialization(){ 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())); + connect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); //angular correction connect(chkAngular, SIGNAL(toggled(bool)), this, SLOT(SetAngularCorrection())); //discard bad channels @@ -230,7 +228,7 @@ void qTabDataOutput::SetFlatField(){ chkFlatField->setToolTip(flatFieldTip); dispFlatField->setToolTip(flatFieldTip); - chkFlatField->setPalette(chkRate->palette()); + chkFlatField->setPalette(chkDiscardBad->palette()); chkFlatField->setText("Flat Field File:"); //set ff dir myDet->setFlatFieldCorrectionDir(dir.toAscii().constData()); @@ -261,7 +259,7 @@ void qTabDataOutput::SetFlatField(){ }else{ chkFlatField->setToolTip(flatFieldTip); dispFlatField->setToolTip(flatFieldTip); - chkFlatField->setPalette(chkRate->palette()); + chkFlatField->setPalette(chkDiscardBad->palette()); chkFlatField->setText("Flat Field File:"); //Unsetting flat field myDet->setFlatFieldCorrectionFile(""); @@ -298,7 +296,7 @@ void qTabDataOutput::UpdateFlatFieldFromServer(){ chkFlatField->setToolTip(flatFieldTip); dispFlatField->setToolTip(flatFieldTip); - chkFlatField->setPalette(chkRate->palette()); + chkFlatField->setPalette(chkDiscardBad->palette()); chkFlatField->setText("Flat Field File:"); connect(dispFlatField, SIGNAL(editingFinished()), this, SLOT(SetFlatField())); @@ -330,7 +328,7 @@ void qTabDataOutput::BrowseFlatFieldPath(){ 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())); + disconnect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); #ifdef VERBOSE cout << "Entering Set Rate Correction function" << endl; @@ -352,7 +350,10 @@ void qTabDataOutput::SetRateCorrection(){ }//custom dead time else{ spinDeadTime->setEnabled(true); - myDet->setRateCorrection((double)spinDeadTime->value()); + if(spinDeadTime->value()>=-1) + myDet->setRateCorrection((double)spinDeadTime->value()); + else + qDefs::Message(qDefs::WARNING,"Dead time is inconsistent for all detectors. Returned Value: -2.","qTabDataOutput::SetRateCorrection"); #ifdef VERBOSE cout << "Setting rate corrections with dead time "<< spinDeadTime->value() << endl; #endif @@ -371,9 +372,11 @@ void qTabDataOutput::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())); + connect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); qDefs::checkErrorMessage(myDet,"qTabDataOutput::SetRateCorrection"); + + } @@ -384,7 +387,7 @@ 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())); + disconnect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); double rate; rate = (double)myDet->getRateCorrectionTau(); @@ -399,35 +402,53 @@ void qTabDataOutput::UpdateRateCorrectionFromServer(){ radioAuto->setEnabled(false); radioDeadTime->setEnabled(false); spinDeadTime->setEnabled(false); - chkRate->setChecked(false); - }else if(rate<0){ + }else if(rate==-1){ #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 +#endif\ radioAuto->setEnabled(true); radioDeadTime->setEnabled(true); spinDeadTime->setEnabled(true); - chkRate->setChecked(true); radioDeadTime->setChecked(true); spinDeadTime->setValue((double)rate); } + if(rate == -2){ + qDefs::Message(qDefs::WARNING,"Dead time is inconsistent for all detectors. Returned Value: -2.","qTabDataOutput::UpdateRateCorrectionFromServer"); + QString errorTip = QString("Rate Corrections.
" + " #ratecorr# tau in seconds

")+ + QString("" + "Dead time is inconsistent for all detectors."); + chkRate->setToolTip(errorTip); + radioDeadTime->setToolTip(errorTip); + spinDeadTime->setToolTip(errorTip); + chkRate->setPalette(red); + chkRate->setText("Rate:*"); + }else{ + QString normalTip = QString("Rate Corrections.
" + " #ratecorr# tau in seconds

"); + chkRate->setToolTip(normalTip); + radioDeadTime->setToolTip(normalTip); + spinDeadTime->setToolTip(normalTip); + chkRate->setPalette(chkDiscardBad->palette()); + chkRate->setText("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())); + connect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); } From 6ad6c9e8bbb82395519b6834e1d4fe74eb899a77 Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Tue, 15 Mar 2016 16:10:10 +0100 Subject: [PATCH 313/332] fixed undefined gain enum to a large number --- slsDetectorGui/src/qTabSettings.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/slsDetectorGui/src/qTabSettings.cpp b/slsDetectorGui/src/qTabSettings.cpp index d5b181dad..6fdd12c5a 100644 --- a/slsDetectorGui/src/qTabSettings.cpp +++ b/slsDetectorGui/src/qTabSettings.cpp @@ -102,7 +102,9 @@ void qTabSettings::SetupDetectorSettings(){ // Get detector settings from detector slsDetectorDefs::detectorSettings sett = myDet->getSettings();cout<<"sett:"<(comboSettings->model()); if (model) { @@ -216,7 +218,9 @@ void qTabSettings::setSettings(int index){ qDefs::Message(qDefs::WARNING,"Cannot change settings to Undefined or Uninitialized.","qTabSettings::setSettings"); disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int))); int sett = (int)myDet->getSettings(); - if(sett==-1) sett = slsDetectorDefs::UNDEFINED; + if(sett==-1) sett = Undefined; + else if(sett == slsDetectorDefs::UNDEFINED) sett = Undefined; + else if(sett == slsDetectorDefs::UNINITIALIZED) sett = Uninitialized; comboSettings->setCurrentIndex(sett); connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int))); } @@ -331,7 +335,9 @@ void qTabSettings::Refresh(){ cout << "Getting settings" << endl; #endif int sett = (int)myDet->getSettings(); - if(sett==-1) sett = slsDetectorDefs::UNDEFINED; + if(sett==-1) sett = Undefined;//slsDetectorDefs::UNDEFINED; + else if(sett == slsDetectorDefs::UNDEFINED) sett = Undefined; + else if(sett == slsDetectorDefs::UNINITIALIZED) sett = Uninitialized; comboSettings->setCurrentIndex(sett); From e7dbbf4c1fdd4e6b9a133abdf8b7acafdfabf5a1 Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Tue, 15 Mar 2016 17:33:40 +0100 Subject: [PATCH 314/332] undefined enum fixed --- slsDetectorGui/src/qTabSettings.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/slsDetectorGui/src/qTabSettings.cpp b/slsDetectorGui/src/qTabSettings.cpp index 6fdd12c5a..97401250e 100644 --- a/slsDetectorGui/src/qTabSettings.cpp +++ b/slsDetectorGui/src/qTabSettings.cpp @@ -100,7 +100,7 @@ void qTabSettings::GetDynamicRange(int setvalue){ void qTabSettings::SetupDetectorSettings(){ // Get detector settings from detector - slsDetectorDefs::detectorSettings sett = myDet->getSettings();cout<<"sett:"<getSettings();cout<<"sett:"<isEnabled())){ + if(!(item[sett]->isEnabled())){ qDefs::Message(qDefs::CRITICAL,"Unknown Detector Settings retrieved from detector. Exiting GUI.","qTabSettings::SetupDetectorSettings"); #ifdef VERBOSE cout << "ERROR: Unknown Detector Settings retrieved from detector." << endl; @@ -193,7 +193,7 @@ void qTabSettings::SetupDetectorSettings(){ exit(-1); } // Setting the detector settings - else comboSettings->setCurrentIndex((int)sett); + else comboSettings->setCurrentIndex(sett); } } From 14c78dc5001948dd83c20a890187edf658479343 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Br=C3=BCckner?= Date: Wed, 4 May 2016 14:15:00 +0200 Subject: [PATCH 315/332] Changed make to $(MAKE) in Makefile for parallel compiling --- slsDetectorGui/Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/slsDetectorGui/Makefile b/slsDetectorGui/Makefile index 39ba5f91b..31fbd936f 100644 --- a/slsDetectorGui/Makefile +++ b/slsDetectorGui/Makefile @@ -32,10 +32,10 @@ INCLUDES ?= $(LIBRARYDIR)/commonFiles -I$(LIBRARYRXRDIR)/MySocketTCP -I$(LIBRA all: lib $(PROG) Makefile.gui guiclient lib: - cd ../ && make lib + cd ../ && $(MAKE) lib clean: - if test -e Makefile.gui; then make -f Makefile.gui clean; make -f Makefile.gui mocclean; rm Makefile.gui; else make Makefile.gui; make -f Makefile.gui clean; make -f Makefile.gui mocclean; fi + if test -e Makefile.gui; then $(MAKE) -f Makefile.gui clean; $(MAKE) -f Makefile.gui mocclean; rm Makefile.gui; else $(MAKE) Makefile.gui; $(MAKE) -f Makefile.gui clean; $(MAKE) -f Makefile.gui mocclean; fi cd client && $(MAKE) clean # cd manual && make clean @@ -46,13 +46,13 @@ mm: qmake -set QT_INSTALL_PREFIX $(QTDIR) && qmake -o Makefile.gui INCLUDES='$(INCLUDES)' DESTDIR=$(DESTDIR) SLSDETLIB=$(LIBDIR) SUBLIBS='$(LDFLAGDET)' doc: - cd manual && make DESTDIR=$(DOCDIR) + cd manual && $(MAKE) DESTDIR=$(DOCDIR) htmldoc: - cd manual && make html DESTDIR=$(DOCDIR) + cd manual && $(MAKE) html DESTDIR=$(DOCDIR) $(PROG): Makefile.gui $(DIR) - make -f Makefile.gui SLSDETLIB=$(LIBDIR) DESTDIR=$(DESTDIR) SUBLIBS='$(LDFLAGDET)' INCLUDES='$(INCLUDES)' + $(MAKE) -f Makefile.gui SLSDETLIB=$(LIBDIR) DESTDIR=$(DESTDIR) SUBLIBS='$(LDFLAGDET)' INCLUDES='$(INCLUDES)' guiclient: echo $(WD) From 328139434d153b4fa41337f4faf0deb35b53331c Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Wed, 11 May 2016 17:21:27 +0200 Subject: [PATCH 316/332] fixed the zooming in plot tab. if x andy axis zoom set, it didnt take it for next measurement --- slsDetectorGui/src/qTabPlot.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index 7f23fe316..2c46f07f1 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -805,6 +805,11 @@ void qTabPlot::EnableScanBox(){ boxScan->setChecked(false); boxScan->setEnabled(false); + /**Newly added*/ + // To remind the updateplot in qdrawplot to set range after updating plot + if(!isOriginallyOneD) + myPlot->SetXYRange(true); + //2d scans read every frame, not compulsory, but for historgrams if((!isOriginallyOneD) && (mode0 || mode1)){ //read every frame From 7db1136e651ec0b4551ba75f68c5290cd76abee6 Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Mon, 13 Jun 2016 19:10:38 +0200 Subject: [PATCH 317/332] versions update --- slsDetectorGui/gitInfo.txt | 14 +++++++------- slsDetectorGui/include/gitInfoGui.h | 10 +++++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/slsDetectorGui/gitInfo.txt b/slsDetectorGui/gitInfo.txt index 0b5444b91..401b88e25 100644 --- a/slsDetectorGui/gitInfo.txt +++ b/slsDetectorGui/gitInfo.txt @@ -1,9 +1,9 @@ Path: slsDetectorsPackage/calibrationWizards -URL: origin maliakal_d@gitorious.psi.ch:sls_det_software/sls_detector_gui.git -Repository Root: origin maliakal_d@gitorious.psi.ch:sls_det_software/sls_detector_gui.git -Repsitory UUID: bc733edfc422efa18796b8b1dd47ad51c852884a -Revision: 300 -Branch: master +URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_gui.git +Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_gui.git +Repsitory UUID: 2a2b6ce5f2e82573053510dd225db7f3d78e3e35 +Revision: 321 +Branch: developer Last Changed Author: Dhanya_Maliakal -Last Changed Rev: 300 -Last Changed Date: 2015-06-16 11:56:58 +0200 +Last Changed Rev: 321 +Last Changed Date: 2016-05-11 17:21:27 +0200 diff --git a/slsDetectorGui/include/gitInfoGui.h b/slsDetectorGui/include/gitInfoGui.h index 1c5ad2901..c8a317188 100644 --- a/slsDetectorGui/include/gitInfoGui.h +++ b/slsDetectorGui/include/gitInfoGui.h @@ -1,11 +1,11 @@ //#define SVNPATH "" -#define SVNURL "maliakal_d@gitorious.psi.ch:sls_det_software/sls_detector_gui.git" +#define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_gui.git" //#define SVNREPPATH "" -#define SVNREPUUID "bc733edfc422efa18796b8b1dd47ad51c852884a" -//#define SVNREV 0x300 +#define SVNREPUUID "2a2b6ce5f2e82573053510dd225db7f3d78e3e35" +//#define SVNREV 0x321 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "Dhanya_Maliakal" -#define SVNREV 0x300 -#define SVNDATE 0x20150616 +#define SVNREV 0x321 +#define SVNDATE 0x20160511 // From d4dd7b5d8c731163702a9e2fa5b68fccb6b1eeb5 Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Mon, 4 Jul 2016 15:44:59 +0200 Subject: [PATCH 318/332] added burst_trigger mode for eiger to replace trigger_readout mode --- slsDetectorGui/forms/form_tab_measurement.ui | 7 +++++- slsDetectorGui/include/qTabMeasurement.h | 2 +- slsDetectorGui/slsDetectorGui.pro | 2 +- slsDetectorGui/src/qTabMeasurement.cpp | 23 +++++++++++++++----- 4 files changed, 25 insertions(+), 9 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_measurement.ui b/slsDetectorGui/forms/form_tab_measurement.ui index cf912b679..9290c74c9 100644 --- a/slsDetectorGui/forms/form_tab_measurement.ui +++ b/slsDetectorGui/forms/form_tab_measurement.ui @@ -538,6 +538,11 @@ Maximum value is 3. <br> Gated with Start Trigger
+ + + Burst Trigger + + @@ -862,7 +867,7 @@ Frame period between exposures. - -1 + 6 diff --git a/slsDetectorGui/include/qTabMeasurement.h b/slsDetectorGui/include/qTabMeasurement.h index 5f34f978a..76180933a 100644 --- a/slsDetectorGui/include/qTabMeasurement.h +++ b/slsDetectorGui/include/qTabMeasurement.h @@ -180,7 +180,7 @@ private: /** detector type */ slsDetectorDefs::detectorType detType; /** enum for the timing mode */ - enum{None, Auto, Trigger_Exp_Series, Trigger_Readout, Gated, Gated_Start, NumTimingModes}; + enum{None, Auto, Trigger_Exp_Series, Trigger_Readout, Gated, Gated_Start, Burst_Trigger, NumTimingModes}; /** timer to update the progress*/ QTimer *progressTimer; /** tool tip variables*/ diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index da52c63f8..641716a66 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -23,7 +23,7 @@ QMAKE_LIBS = -L$(QTDIR)/lib DEFINES += VERBOSE DACS_INT PRINT_LOG #VERYVERBOSE CHECKINFERROR LIBS = -L$(QWTDIR)/lib -lqwt -L$(QWT3D)/lib - +CXXFLAGS += -g QMAKE_CXXFLAGS_WARN_ON = -w diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 445ec4bab..cd1893eb8 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -137,12 +137,14 @@ void qTabMeasurement::SetupTimingMode(){ item[(int)Trigger_Readout]->setEnabled(true); item[(int)Gated]->setEnabled(true); item[(int)Gated_Start]->setEnabled(true); + item[(int)Burst_Trigger]->setEnabled(false); break; case slsDetectorDefs::EIGER: item[(int)Trigger_Exp_Series]->setEnabled(true); - item[(int)Trigger_Readout]->setEnabled(true); + item[(int)Trigger_Readout]->setEnabled(false); item[(int)Gated]->setEnabled(true); item[(int)Gated_Start]->setEnabled(false); + item[(int)Burst_Trigger]->setEnabled(true); break; case slsDetectorDefs::MOENCH: case slsDetectorDefs::PROPIX: @@ -152,6 +154,7 @@ void qTabMeasurement::SetupTimingMode(){ item[(int)Trigger_Readout]->setEnabled(false); item[(int)Gated]->setEnabled(false); item[(int)Gated_Start]->setEnabled(false); + item[(int)Burst_Trigger]->setEnabled(false); break; default: cout << "Unknown detector type." << endl; @@ -175,7 +178,7 @@ void qTabMeasurement::GetModeFromDetector(bool startup){ slsDetectorDefs::externalCommunicationMode mode = myDet->setExternalCommunicationMode(); //Setting the timing mode in gui - if(model && model->itemFromIndex(model->index(mode,comboTimingMode->modelColumn(), comboTimingMode->rootModelIndex()))->isEnabled()){ + if(model && model->itemFromIndex(model->index(mode+1,comboTimingMode->modelColumn(), comboTimingMode->rootModelIndex()))->isEnabled()){ //these are things checked in setuptimingmode @@ -229,7 +232,7 @@ void qTabMeasurement::GetModeFromDetector(bool startup){ cout << "The detector(s) " << offline << " is/are not connected. Exiting GUI." << endl; exit(-1); } - + cout << "Unknown Timing Mode " << mode << " detected from detector" << endl; qDefs::Message(qDefs::WARNING,"Unknown Timing Mode detected from detector." "\n\nSetting the following defaults:\nTiming Mode \t: None\n" "Number of Frames \t: 1\nNumber of Triggers \t: 1","qTabMeasurement::GetModeFromDetector"); @@ -655,9 +658,6 @@ void qTabMeasurement::SetTimingMode(int mode){ success = true; break; case Trigger_Readout://#Frames, ExpTime, Period, (Delay) - if(detType != slsDetectorDefs::EIGER){ - lblDelay->setEnabled(true); spinDelay->setEnabled(true); comboDelayUnit->setEnabled(true); - } spinNumTriggers->setValue(1); lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true); @@ -685,6 +685,17 @@ void qTabMeasurement::SetTimingMode(int mode){ if(myDet->setExternalCommunicationMode(slsDetectorDefs::GATE_WITH_START_TRIGGER)==slsDetectorDefs::GATE_WITH_START_TRIGGER) success = true; break; + case Burst_Trigger://#Frames, ExpTime, Period, (Delay) + spinNumTriggers->setValue(1); + if(detType != slsDetectorDefs::EIGER){ + lblDelay->setEnabled(true); spinDelay->setEnabled(true); comboDelayUnit->setEnabled(true); + } + lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true); + lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true); + lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true); + if(myDet->setExternalCommunicationMode(slsDetectorDefs::BURST_TRIGGER)==slsDetectorDefs::BURST_TRIGGER) + success = true; + break; default: cout << "Timing mode unknown to GUI" << endl; //This should never happen From 6b0814c907bf83111c41ee00d25a58040f974e3a Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Mon, 4 Jul 2016 15:49:43 +0200 Subject: [PATCH 319/332] updating versions --- slsDetectorGui/gitInfo.txt | 8 ++++---- slsDetectorGui/include/gitInfoGui.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/slsDetectorGui/gitInfo.txt b/slsDetectorGui/gitInfo.txt index 401b88e25..2771c0fe9 100644 --- a/slsDetectorGui/gitInfo.txt +++ b/slsDetectorGui/gitInfo.txt @@ -1,9 +1,9 @@ Path: slsDetectorsPackage/calibrationWizards URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_gui.git Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_gui.git -Repsitory UUID: 2a2b6ce5f2e82573053510dd225db7f3d78e3e35 -Revision: 321 +Repsitory UUID: 2494c995c6030c594de0e30f7c8be8461e5ea5ab +Revision: 323 Branch: developer Last Changed Author: Dhanya_Maliakal -Last Changed Rev: 321 -Last Changed Date: 2016-05-11 17:21:27 +0200 +Last Changed Rev: 323 +Last Changed Date: 2016-07-04 15:44:59 +0200 diff --git a/slsDetectorGui/include/gitInfoGui.h b/slsDetectorGui/include/gitInfoGui.h index c8a317188..c9deb2ce1 100644 --- a/slsDetectorGui/include/gitInfoGui.h +++ b/slsDetectorGui/include/gitInfoGui.h @@ -1,11 +1,11 @@ //#define SVNPATH "" #define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_gui.git" //#define SVNREPPATH "" -#define SVNREPUUID "2a2b6ce5f2e82573053510dd225db7f3d78e3e35" -//#define SVNREV 0x321 +#define SVNREPUUID "2494c995c6030c594de0e30f7c8be8461e5ea5ab" +//#define SVNREV 0x323 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "Dhanya_Maliakal" -#define SVNREV 0x321 -#define SVNDATE 0x20160511 +#define SVNREV 0x323 +#define SVNDATE 0x20160704 // From cc896bd99cddddc224ea7625dea95c8e9333134b Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Tue, 5 Jul 2016 17:23:00 +0200 Subject: [PATCH 320/332] updating versions --- slsDetectorGui/gitInfo.txt | 8 ++++---- slsDetectorGui/include/gitInfoGui.h | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/slsDetectorGui/gitInfo.txt b/slsDetectorGui/gitInfo.txt index 2771c0fe9..45511c5aa 100644 --- a/slsDetectorGui/gitInfo.txt +++ b/slsDetectorGui/gitInfo.txt @@ -1,9 +1,9 @@ Path: slsDetectorsPackage/calibrationWizards URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_gui.git Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_gui.git -Repsitory UUID: 2494c995c6030c594de0e30f7c8be8461e5ea5ab -Revision: 323 +Repsitory UUID: 01c3a05e3df8fd0d15fdf1a04344edf2acd4cae0 +Revision: 324 Branch: developer Last Changed Author: Dhanya_Maliakal -Last Changed Rev: 323 -Last Changed Date: 2016-07-04 15:44:59 +0200 +Last Changed Rev: 324 +Last Changed Date: 2016-07-04 15:49:43 +0200 diff --git a/slsDetectorGui/include/gitInfoGui.h b/slsDetectorGui/include/gitInfoGui.h index c9deb2ce1..875e8b5c6 100644 --- a/slsDetectorGui/include/gitInfoGui.h +++ b/slsDetectorGui/include/gitInfoGui.h @@ -1,11 +1,11 @@ //#define SVNPATH "" #define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_gui.git" //#define SVNREPPATH "" -#define SVNREPUUID "2494c995c6030c594de0e30f7c8be8461e5ea5ab" -//#define SVNREV 0x323 +#define SVNREPUUID "01c3a05e3df8fd0d15fdf1a04344edf2acd4cae0" +//#define SVNREV 0x324 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "Dhanya_Maliakal" -#define SVNREV 0x323 +#define SVNREV 0x324 #define SVNDATE 0x20160704 // From be516e34b2fdab1c3133f7f6d79411a0973dc79b Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Tue, 5 Jul 2016 17:24:43 +0200 Subject: [PATCH 321/332] updating versions --- slsDetectorGui/gitInfo.txt | 8 ++++---- slsDetectorGui/include/gitInfoGui.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/slsDetectorGui/gitInfo.txt b/slsDetectorGui/gitInfo.txt index 45511c5aa..ef1d3e7e5 100644 --- a/slsDetectorGui/gitInfo.txt +++ b/slsDetectorGui/gitInfo.txt @@ -1,9 +1,9 @@ Path: slsDetectorsPackage/calibrationWizards URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_gui.git Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_gui.git -Repsitory UUID: 01c3a05e3df8fd0d15fdf1a04344edf2acd4cae0 -Revision: 324 +Repsitory UUID: 86038244df8ac6238d684c83c16084bfec0ad8f4 +Revision: 325 Branch: developer Last Changed Author: Dhanya_Maliakal -Last Changed Rev: 324 -Last Changed Date: 2016-07-04 15:49:43 +0200 +Last Changed Rev: 325 +Last Changed Date: 2016-07-05 17:23:00 +0200 diff --git a/slsDetectorGui/include/gitInfoGui.h b/slsDetectorGui/include/gitInfoGui.h index 875e8b5c6..b244a34da 100644 --- a/slsDetectorGui/include/gitInfoGui.h +++ b/slsDetectorGui/include/gitInfoGui.h @@ -1,11 +1,11 @@ //#define SVNPATH "" #define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_gui.git" //#define SVNREPPATH "" -#define SVNREPUUID "01c3a05e3df8fd0d15fdf1a04344edf2acd4cae0" -//#define SVNREV 0x324 +#define SVNREPUUID "86038244df8ac6238d684c83c16084bfec0ad8f4" +//#define SVNREV 0x325 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "Dhanya_Maliakal" -#define SVNREV 0x324 -#define SVNDATE 0x20160704 +#define SVNREV 0x325 +#define SVNDATE 0x20160705 // From 6e4d4eed0ec7046522a0004e90ef3ff6def0261d Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Wed, 6 Jul 2016 10:32:55 +0200 Subject: [PATCH 322/332] updating versions --- slsDetectorGui/gitInfo.txt | 8 ++++---- slsDetectorGui/include/gitInfoGui.h | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/slsDetectorGui/gitInfo.txt b/slsDetectorGui/gitInfo.txt index ef1d3e7e5..16dc368cb 100644 --- a/slsDetectorGui/gitInfo.txt +++ b/slsDetectorGui/gitInfo.txt @@ -1,9 +1,9 @@ Path: slsDetectorsPackage/calibrationWizards URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_gui.git Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_gui.git -Repsitory UUID: 86038244df8ac6238d684c83c16084bfec0ad8f4 -Revision: 325 +Repsitory UUID: 5dab438e97b82905da703f300fadd12d68e5cf29 +Revision: 326 Branch: developer Last Changed Author: Dhanya_Maliakal -Last Changed Rev: 325 -Last Changed Date: 2016-07-05 17:23:00 +0200 +Last Changed Rev: 326 +Last Changed Date: 2016-07-05 17:24:43 +0200 diff --git a/slsDetectorGui/include/gitInfoGui.h b/slsDetectorGui/include/gitInfoGui.h index b244a34da..9509e6738 100644 --- a/slsDetectorGui/include/gitInfoGui.h +++ b/slsDetectorGui/include/gitInfoGui.h @@ -1,11 +1,11 @@ //#define SVNPATH "" #define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_gui.git" //#define SVNREPPATH "" -#define SVNREPUUID "86038244df8ac6238d684c83c16084bfec0ad8f4" -//#define SVNREV 0x325 +#define SVNREPUUID "5dab438e97b82905da703f300fadd12d68e5cf29" +//#define SVNREV 0x326 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "Dhanya_Maliakal" -#define SVNREV 0x325 +#define SVNREV 0x326 #define SVNDATE 0x20160705 // From 843dbffcd8fe5aa33fdd2b4fd2f1374800916a21 Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Thu, 14 Jul 2016 16:23:41 +0200 Subject: [PATCH 323/332] updaterev --- slsDetectorGui/gitInfo.txt | 8 ++++---- slsDetectorGui/include/gitInfoGui.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/slsDetectorGui/gitInfo.txt b/slsDetectorGui/gitInfo.txt index 16dc368cb..caf4c943b 100644 --- a/slsDetectorGui/gitInfo.txt +++ b/slsDetectorGui/gitInfo.txt @@ -1,9 +1,9 @@ Path: slsDetectorsPackage/calibrationWizards URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_gui.git Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_gui.git -Repsitory UUID: 5dab438e97b82905da703f300fadd12d68e5cf29 -Revision: 326 +Repsitory UUID: 963873a75dba64daf0ae282bd6e166186f24959b +Revision: 327 Branch: developer Last Changed Author: Dhanya_Maliakal -Last Changed Rev: 326 -Last Changed Date: 2016-07-05 17:24:43 +0200 +Last Changed Rev: 327 +Last Changed Date: 2016-07-06 10:32:55 +0200 diff --git a/slsDetectorGui/include/gitInfoGui.h b/slsDetectorGui/include/gitInfoGui.h index 9509e6738..b81a1f021 100644 --- a/slsDetectorGui/include/gitInfoGui.h +++ b/slsDetectorGui/include/gitInfoGui.h @@ -1,11 +1,11 @@ //#define SVNPATH "" #define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_gui.git" //#define SVNREPPATH "" -#define SVNREPUUID "5dab438e97b82905da703f300fadd12d68e5cf29" -//#define SVNREV 0x326 +#define SVNREPUUID "963873a75dba64daf0ae282bd6e166186f24959b" +//#define SVNREV 0x327 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "Dhanya_Maliakal" -#define SVNREV 0x326 -#define SVNDATE 0x20160705 +#define SVNREV 0x327 +#define SVNDATE 0x20160706 // From 86308352cb7a8d0f91dae47a2f4b97f4e22dd820 Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Fri, 22 Jul 2016 10:41:35 +0200 Subject: [PATCH 324/332] added more accurate temperature sensors for eiger, and to gui --- slsDetectorGui/src/qTabDeveloper.cpp | 54 +++++++++++++++++++++------- 1 file changed, 41 insertions(+), 13 deletions(-) diff --git a/slsDetectorGui/src/qTabDeveloper.cpp b/slsDetectorGui/src/qTabDeveloper.cpp index 56e46b47b..365bf258e 100644 --- a/slsDetectorGui/src/qTabDeveloper.cpp +++ b/slsDetectorGui/src/qTabDeveloper.cpp @@ -81,7 +81,7 @@ void qTabDeveloper::SetupWidgetWindow(){ break; case slsDetectorDefs::EIGER: NUM_DAC_WIDGETS = 17; - NUM_ADC_WIDGETS = 0; + NUM_ADC_WIDGETS = 6; dacNames.push_back("v SvP:"); dacNames.push_back("v SvN"); @@ -101,7 +101,12 @@ void qTabDeveloper::SetupWidgetWindow(){ dacNames.push_back("v Vcmp_rr:"); dacNames.push_back("v threshold:"); - + adcNames.push_back("Temperature FPGA Ext:"); + adcNames.push_back("Temperature 10GE:"); + adcNames.push_back("Temperature DCDC:"); + adcNames.push_back("Temperature SODL:"); + adcNames.push_back("Temperature SODR:"); + adcNames.push_back("Temperature FPGA:"); break; case slsDetectorDefs::PROPIX: @@ -228,16 +233,19 @@ void qTabDeveloper::SetupWidgetWindow(){ //adcs if((detType==slsDetectorDefs::GOTTHARD) || (detType==slsDetectorDefs::PROPIX) || - (detType==slsDetectorDefs::MOENCH)){ + (detType==slsDetectorDefs::MOENCH)|| + (detType==slsDetectorDefs::EIGER)) { setFixedHeight(20+(50+(NUM_DAC_WIDGETS/2)*35)+(50+(NUM_ADC_WIDGETS/2)*35)); boxAdcs = new QGroupBox("ADCs",this); boxAdcs->setFixedHeight(25+(NUM_ADC_WIDGETS/2)*35); layout->addWidget(boxAdcs,2,0); CreateADCWidgets(); //to make the adcs at the bottom most - int diff = 340-height(); - setFixedHeight(340); - layout->setVerticalSpacing(diff/2); + if(detType!=slsDetectorDefs::EIGER) { + int diff = 340-height(); + setFixedHeight(340); + layout->setVerticalSpacing(diff/2); + } //timer to check adcs adcTimer = new QTimer(this); } @@ -295,9 +303,11 @@ void qTabDeveloper::CreateADCWidgets(){ lblAdcs[i] = new QLabel(QString(adcNames[i].c_str()),boxAdcs); spinAdcs[i] = new QDoubleSpinBox(boxAdcs); spinAdcs[i]->setMaximum(10000); + spinAdcs[i]->setMinimum(-1); if((detType==slsDetectorDefs::GOTTHARD) || (detType==slsDetectorDefs::PROPIX) || - (detType==slsDetectorDefs::MOENCH)) + (detType==slsDetectorDefs::MOENCH)|| + (detType==slsDetectorDefs::EIGER)) spinAdcs[i]->setSuffix(0x00b0+QString("C")); adcLayout->addWidget(lblAdcs[i],(int)(i/2),((i%2)==0)?1:4); @@ -422,8 +432,12 @@ slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(int index){ case 14:return slsDetectorDefs::E_Vcmp_rl; case 15:return slsDetectorDefs::E_Vcmp_rr; case 16:return slsDetectorDefs::THRESHOLD; - - + case 17:return slsDetectorDefs::TEMPERATURE_FPGAEXT; + case 18:return slsDetectorDefs::TEMPERATURE_10GE; + case 19:return slsDetectorDefs::TEMPERATURE_DCDC; + case 20:return slsDetectorDefs::TEMPERATURE_SODL; + case 21:return slsDetectorDefs::TEMPERATURE_SODR; + case 22:return slsDetectorDefs::TEMPERATURE_FPGA; default: qDefs::Message(qDefs::CRITICAL,"Unknown DAC/ADC Index. Weird Error Index:"+ index,"qTabDeveloper::getSLSIndex"); Refresh(); @@ -520,11 +534,25 @@ void qTabDeveloper::RefreshAdcs(){ for(int i=0;isetValue((double)myDet->getADC(getSLSIndex(i+NUM_DAC_WIDGETS))); + if(!detid){ + if(detType == slsDetectorDefs::EIGER){ + double value = (double)myDet->getADC(getSLSIndex(i+NUM_DAC_WIDGETS)); + if(value == -1) + spinAdcs[i]->setValue(value); + else + spinAdcs[i]->setValue(value/1000.00); + + } + else + spinAdcs[i]->setValue((double)myDet->getADC(getSLSIndex(i+NUM_DAC_WIDGETS))); + } //specific detector - else - spinAdcs[i]->setValue((double)det->getADC(getSLSIndex(i+NUM_DAC_WIDGETS))); + else{ + if(detType == slsDetectorDefs::EIGER) + spinAdcs[i]->setValue((double)det->getADC(getSLSIndex(i+NUM_DAC_WIDGETS))/1000.00); + else + spinAdcs[i]->setValue((double)det->getADC(getSLSIndex(i+NUM_DAC_WIDGETS))); + } } From 180038e48514b753127630500d26de231222ddf3 Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Fri, 22 Jul 2016 10:41:54 +0200 Subject: [PATCH 325/332] updaterev --- slsDetectorGui/gitInfo.txt | 10 +++++----- slsDetectorGui/include/gitInfoGui.h | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/slsDetectorGui/gitInfo.txt b/slsDetectorGui/gitInfo.txt index caf4c943b..37fa7817e 100644 --- a/slsDetectorGui/gitInfo.txt +++ b/slsDetectorGui/gitInfo.txt @@ -1,9 +1,9 @@ -Path: slsDetectorsPackage/calibrationWizards +Path: slsDetectorsPackage/slsDetectorGui URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_gui.git Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_gui.git -Repsitory UUID: 963873a75dba64daf0ae282bd6e166186f24959b -Revision: 327 +Repsitory UUID: 68ac7f5a712c45a0f3782b213528285e2dea84ff +Revision: 329 Branch: developer Last Changed Author: Dhanya_Maliakal -Last Changed Rev: 327 -Last Changed Date: 2016-07-06 10:32:55 +0200 +Last Changed Rev: 329 +Last Changed Date: 2016-07-22 10:41:35 +0200 diff --git a/slsDetectorGui/include/gitInfoGui.h b/slsDetectorGui/include/gitInfoGui.h index b81a1f021..a0a094a15 100644 --- a/slsDetectorGui/include/gitInfoGui.h +++ b/slsDetectorGui/include/gitInfoGui.h @@ -1,11 +1,11 @@ //#define SVNPATH "" #define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_gui.git" //#define SVNREPPATH "" -#define SVNREPUUID "963873a75dba64daf0ae282bd6e166186f24959b" -//#define SVNREV 0x327 +#define SVNREPUUID "68ac7f5a712c45a0f3782b213528285e2dea84ff" +//#define SVNREV 0x329 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "Dhanya_Maliakal" -#define SVNREV 0x327 -#define SVNDATE 0x20160706 +#define SVNREV 0x329 +#define SVNDATE 0x20160722 // From 91394511274647d47806aba503592cf6ed9e649f Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Wed, 3 Aug 2016 10:34:10 +0200 Subject: [PATCH 326/332] added 2 gain settings to eigeR --- slsDetectorGui/forms/form_tab_settings.ui | 5 +++++ slsDetectorGui/include/qTabSettings.h | 2 +- slsDetectorGui/src/qTabSettings.cpp | 6 +++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_settings.ui b/slsDetectorGui/forms/form_tab_settings.ui index 797756a33..7c9f8f3ed 100644 --- a/slsDetectorGui/forms/form_tab_settings.ui +++ b/slsDetectorGui/forms/form_tab_settings.ui @@ -125,6 +125,11 @@ Force Switch G2 + + + Very Low Gain + + Undefined diff --git a/slsDetectorGui/include/qTabSettings.h b/slsDetectorGui/include/qTabSettings.h index 2c5127bec..ddb0d4da6 100644 --- a/slsDetectorGui/include/qTabSettings.h +++ b/slsDetectorGui/include/qTabSettings.h @@ -58,7 +58,7 @@ private: bool expertMode; enum{Standard,Fast,HighGain,DynamicGain,LowGain,MediumGain,VeryHighGain,LowNoise, - DynamicHG0,FixGain1,FixGain2,ForceSwitchG1,ForceSwitchG2, + DynamicHG0,FixGain1,FixGain2,ForceSwitchG1,ForceSwitchG2, VeryLowGain, Undefined,Uninitialized,NumSettings}; /** To be able to index items on a combo box */ diff --git a/slsDetectorGui/src/qTabSettings.cpp b/slsDetectorGui/src/qTabSettings.cpp index 97401250e..bd943e162 100644 --- a/slsDetectorGui/src/qTabSettings.cpp +++ b/slsDetectorGui/src/qTabSettings.cpp @@ -128,6 +128,7 @@ void qTabSettings::SetupDetectorSettings(){ item[(int)FixGain2]->setEnabled(false); item[(int)ForceSwitchG1]->setEnabled(false); item[(int)ForceSwitchG2]->setEnabled(false); + item[(int)VeryLowGain]->setEnabled(false); break; case slsDetectorDefs::EIGER: item[(int)Standard]->setEnabled(true); @@ -136,13 +137,14 @@ void qTabSettings::SetupDetectorSettings(){ item[(int)DynamicGain]->setEnabled(false); item[(int)LowGain]->setEnabled(true); item[(int)MediumGain]->setEnabled(false); - item[(int)VeryHighGain]->setEnabled(false); + item[(int)VeryHighGain]->setEnabled(true); item[(int)LowNoise]->setEnabled(false); item[(int)DynamicHG0]->setEnabled(false); item[(int)FixGain1]->setEnabled(false); item[(int)FixGain2]->setEnabled(false); item[(int)ForceSwitchG1]->setEnabled(false); item[(int)ForceSwitchG2]->setEnabled(false); + item[(int)VeryLowGain]->setEnabled(true); break; case slsDetectorDefs::MOENCH: case slsDetectorDefs::PROPIX: @@ -160,6 +162,7 @@ void qTabSettings::SetupDetectorSettings(){ item[(int)FixGain2]->setEnabled(false); item[(int)ForceSwitchG1]->setEnabled(false); item[(int)ForceSwitchG2]->setEnabled(false); + item[(int)VeryLowGain]->setEnabled(false); break; case slsDetectorDefs::JUNGFRAU: item[(int)Standard]->setEnabled(false); @@ -175,6 +178,7 @@ void qTabSettings::SetupDetectorSettings(){ item[(int)FixGain2]->setEnabled(true); item[(int)ForceSwitchG1]->setEnabled(true); item[(int)ForceSwitchG2]->setEnabled(true); + item[(int)VeryLowGain]->setEnabled(false); break; default: cout << "Unknown detector type. Exiting GUI." << endl; From 5d3e925ed441dd814ba39253ca7d7885543078bd Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Wed, 3 Aug 2016 17:50:54 +0200 Subject: [PATCH 327/332] compatible with gcc 5.3.1 amd 6.1.1 --- slsDetectorGui/include/qDrawPlot.h | 4 ++++ slsDetectorGui/slsDetectorPlotting/src/SlsQt2DHist.cxx | 4 ++-- slsDetectorGui/src/qScanWidget.cpp | 2 +- slsDetectorGui/src/qTabActions.cpp | 3 ++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index 1660eec9a..aaf5814eb 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -481,7 +481,11 @@ double XYRangeValues[4]; bool IsXYRange[4]; /** Default timer between plots*/ +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 6) +static constexpr double PLOT_TIMER_MS = 200; +#else static const double PLOT_TIMER_MS = 200; +#endif /** Specific timer value between plots */ double timerValue; /** every nth frame when to plot */ diff --git a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DHist.cxx b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DHist.cxx index 1bbe9bcaa..fc7e09074 100644 --- a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DHist.cxx +++ b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DHist.cxx @@ -6,7 +6,7 @@ #include - +#include #include "SlsQt2DHist.h" using std::cout; @@ -125,7 +125,7 @@ double SlsQt2DHist::GetMean(){ } double SlsQt2DHist::SetMinimumToFirstGreaterThanZero(){ - z_min=abs(z_max)+1; + z_min=fabs(z_max)+1; for(int i=0;i0 && data[i]setIcon(QIcon( ":/icons/images/close.png" )); comboCustom->setEditable(true); - comboCustom->setCompleter(false); + comboCustom->setCompleter(NULL); comboCustom->setValidator(new QDoubleValidator(comboCustom)); comboCustom->setToolTip(customTip); btnCustom->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); diff --git a/slsDetectorGui/src/qTabActions.cpp b/slsDetectorGui/src/qTabActions.cpp index c53c93499..bbaf462fa 100644 --- a/slsDetectorGui/src/qTabActions.cpp +++ b/slsDetectorGui/src/qTabActions.cpp @@ -257,7 +257,8 @@ void qTabActions::CreatePositionsWidget(){ layout->addWidget(lblPosList,0,4); comboPos = new QComboBox(this); comboPos->setEditable(true); - comboPos->setCompleter(false); +// comboPos->setCompleter(false); + comboPos->setCompleter(NULL); normal = comboPos->palette(); comboPos->setEnabled(false); QDoubleValidator *validate = new QDoubleValidator(comboPos); From cf74f9b138ca41d352b934887e85e97b54666159 Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Mon, 8 Aug 2016 15:50:37 +0200 Subject: [PATCH 328/332] fixed rate correction to not include 16 bit dr --- slsDetectorGui/forms/form_tab_dataoutput.ui | 48 ++++- slsDetectorGui/src/qTabDataOutput.cpp | 190 +++++++++++++------- 2 files changed, 169 insertions(+), 69 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_dataoutput.ui b/slsDetectorGui/forms/form_tab_dataoutput.ui index 5a0d355ab..3546f216d 100644 --- a/slsDetectorGui/forms/form_tab_dataoutput.ui +++ b/slsDetectorGui/forms/form_tab_dataoutput.ui @@ -399,7 +399,7 @@ Compression using Root. Available only for Gotthard in Expert Mode. 9 - -2.000000000000000 + -1.000000000000000 2000000000.000000000000000 @@ -623,6 +623,52 @@ Compression using Root. Available only for Gotthard in Expert Mode. + + + + 384 + 60 + 348 + 27 + + + + + + + false + + + + 0 + 0 + + + + + 100 + 0 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + ns + + + 9 + + + -1.000000000000000 + + + 2000000000.000000000000000 + + + + + diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index 5ca1a3841..584797fcc 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -46,6 +46,7 @@ void qTabDataOutput::SetupWidgetWindow(){ // Detector Type detType=myDet->getDetectorsType(); widgetEiger->setVisible(false); + spinDeadTimeonly->setVisible(false); //rate correction - not for charge integrating detectors if((detType == slsDetectorDefs::MYTHEN)||(detType == slsDetectorDefs::EIGER)) @@ -57,7 +58,10 @@ void qTabDataOutput::SetupWidgetWindow(){ if(detType == slsDetectorDefs::EIGER){ chkTenGiga->setEnabled(true); widgetEiger->setVisible(true); - + spinDeadTimeonly->setVisible(true); + radioAuto->setVisible(false); + radioDeadTime->setVisible(false); + spinDeadTime->setVisible(false); } /** error message **/ @@ -151,9 +155,13 @@ void qTabDataOutput::Initialization(){ 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(editingFinished()), this, SLOT(SetRateCorrection())); + if(detType == slsDetectorDefs::EIGER) + connect(spinDeadTimeonly, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); + else{ + connect(radioAuto, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); + connect(radioDeadTime, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); + connect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); + } //angular correction connect(chkAngular, SIGNAL(toggled(bool)), this, SLOT(SetAngularCorrection())); //discard bad channels @@ -326,56 +334,80 @@ void qTabDataOutput::BrowseFlatFieldPath(){ void qTabDataOutput::SetRateCorrection(){ - disconnect(radioAuto, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); - disconnect(radioDeadTime, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); - disconnect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); + if(detType == slsDetectorDefs::EIGER) + disconnect(spinDeadTimeonly, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); + else{ + disconnect(radioAuto, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); + disconnect(radioDeadTime, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); + disconnect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); + } #ifdef VERBOSE cout << "Entering Set Rate Correction function" << endl; #endif 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); - myDet->setRateCorrection(-1); -#ifdef VERBOSE - cout << "Setting rate corrections with default dead time" << endl; -#endif - }//custom dead time + if(detType == slsDetectorDefs::EIGER){ + spinDeadTimeonly->setEnabled(true); + myDet->setRateCorrection((double)spinDeadTimeonly->value()); + } else{ - spinDeadTime->setEnabled(true); - if(spinDeadTime->value()>=-1) - myDet->setRateCorrection((double)spinDeadTime->value()); - else - qDefs::Message(qDefs::WARNING,"Dead time is inconsistent for all detectors. Returned Value: -2.","qTabDataOutput::SetRateCorrection"); + radioAuto->setEnabled(true); + radioDeadTime->setEnabled(true); + //set auto as default if nothing selected + if(!radioAuto->isChecked()&&!radioDeadTime->isChecked()) + radioAuto->setChecked(true); + //auto mode + if(radioAuto->isChecked()){ + spinDeadTime->setEnabled(false); + myDet->setRateCorrection(-1); #ifdef VERBOSE - cout << "Setting rate corrections with dead time "<< spinDeadTime->value() << endl; + cout << "Setting rate corrections with default dead time" << endl; #endif + } + //custom dead time + else{ + spinDeadTime->setEnabled(true); + myDet->setRateCorrection((double)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); + if(detType == slsDetectorDefs::EIGER) + spinDeadTimeonly->setEnabled(false); + else{ + radioAuto->setEnabled(false); + radioDeadTime->setEnabled(false); + spinDeadTime->setEnabled(false); + } //Unsetting rate correction - myDet->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(editingFinished()), this, SLOT(SetRateCorrection())); qDefs::checkErrorMessage(myDet,"qTabDataOutput::SetRateCorrection"); + //update just the value + double rate = (double)myDet->getRateCorrectionTau(); + if(spinDeadTime->isEnabled()) + spinDeadTime->setValue((double)rate); + else if(spinDeadTimeonly->isEnabled()) + spinDeadTimeonly->setValue((double)rate); + + + if(detType == slsDetectorDefs::EIGER) + connect(spinDeadTimeonly, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); + else{ + connect(radioAuto, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); + connect(radioDeadTime, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); + connect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); + } + } @@ -385,10 +417,14 @@ void qTabDataOutput::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(editingFinished()), this, SLOT(SetRateCorrection())); + if(detType == slsDetectorDefs::EIGER) + disconnect(spinDeadTimeonly, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); + else{ + disconnect(radioAuto, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); + disconnect(radioDeadTime, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); + disconnect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); + } double rate; rate = (double)myDet->getRateCorrectionTau(); qDefs::checkErrorMessage(myDet,"qTabDataOutput::UpdateRateCorrectionFromServer"); @@ -397,58 +433,76 @@ void qTabDataOutput::UpdateRateCorrectionFromServer(){ #endif if(rate==0){ #ifdef VERBOSE - cout << "None" << endl; + cout << "None" << endl; #endif - radioAuto->setEnabled(false); - radioDeadTime->setEnabled(false); - spinDeadTime->setEnabled(false); chkRate->setChecked(false); - }else if(rate==-1){ -#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); + if(detType == slsDetectorDefs::EIGER) + spinDeadTimeonly->setEnabled(false); + else{ + radioAuto->setEnabled(false); + radioDeadTime->setEnabled(false); + spinDeadTime->setEnabled(false); + } } - if(rate == -2){ - qDefs::Message(qDefs::WARNING,"Dead time is inconsistent for all detectors. Returned Value: -2.","qTabDataOutput::UpdateRateCorrectionFromServer"); + else{ + chkRate->setChecked(true); + + if(detType == slsDetectorDefs::EIGER){ + spinDeadTimeonly->setEnabled(true); + spinDeadTimeonly->setValue((double)rate); + } + //mythen + else{ + radioAuto->setEnabled(true); + radioDeadTime->setEnabled(true); + chkRate->setChecked(true); + if(rate == -1){ +#ifdef VERBOSE + cout << "Auto" << endl; +#endif + spinDeadTime->setEnabled(false); + radioAuto->setChecked(true); + }else{ +#ifdef VERBOSE + cout << "Custom" << endl; +#endif + radioDeadTime->setChecked(true); + spinDeadTime->setEnabled(true); + spinDeadTime->setValue((double)rate); + } + } + } + + + if(detType == slsDetectorDefs::EIGER && rate == -1){ + qDefs::Message(qDefs::WARNING,"Dead time is inconsistent for all detectors. Returned Value: -1.","qTabDataOutput::UpdateRateCorrectionFromServer"); QString errorTip = QString("Rate Corrections.
" " #ratecorr# tau in seconds

")+ QString("" "Dead time is inconsistent for all detectors."); chkRate->setToolTip(errorTip); - radioDeadTime->setToolTip(errorTip); - spinDeadTime->setToolTip(errorTip); + spinDeadTimeonly->setToolTip(errorTip); chkRate->setPalette(red); chkRate->setText("Rate:*"); }else{ QString normalTip = QString("Rate Corrections.
" " #ratecorr# tau in seconds

"); chkRate->setToolTip(normalTip); - radioDeadTime->setToolTip(normalTip); - spinDeadTime->setToolTip(normalTip); + spinDeadTimeonly->setToolTip(normalTip); chkRate->setPalette(chkDiscardBad->palette()); chkRate->setText("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(editingFinished()), this, SLOT(SetRateCorrection())); + + if(detType == slsDetectorDefs::EIGER) + disconnect(spinDeadTimeonly, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); + else{ + connect(radioAuto, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); + connect(radioDeadTime, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); + connect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); + } } From 4c2d28943f8ed8364de92213fb05291ed79157ae Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Thu, 11 Aug 2016 13:59:36 +0200 Subject: [PATCH 329/332] rate correction fixed for gui, removed auto made it defalt --- slsDetectorGui/forms/form_tab_dataoutput.ui | 328 +++++++++++--------- slsDetectorGui/include/qTabDataOutput.h | 5 +- slsDetectorGui/src/qTabDataOutput.cpp | 192 +++++------- 3 files changed, 253 insertions(+), 272 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_dataoutput.ui b/slsDetectorGui/forms/form_tab_dataoutput.ui index 3546f216d..52b88b59f 100644 --- a/slsDetectorGui/forms/form_tab_dataoutput.ui +++ b/slsDetectorGui/forms/form_tab_dataoutput.ui @@ -87,25 +87,6 @@ Directory where one saves the data. 4 - - - - <nobr> -Directory where one saves the data. -</nobr><br> - #outdir# -<br> - - - - Browse - - - - :/icons/images/browse.png:/icons/images/browse.png - - - @@ -130,21 +111,6 @@ Directory where one saves the data. - - - - Qt::StrongFocus - - - <nobr> -Directory where one saves the data. -</nobr><br> - #outdir# -<br> - - - - @@ -203,6 +169,21 @@ Directory where one saves the data. + + + + Qt::StrongFocus + + + <nobr> +Directory where one saves the data. +</nobr><br> + #outdir# +<br> + + + + @@ -235,6 +216,25 @@ Directory where one saves the data. + + + + <nobr> +Directory where one saves the data. +</nobr><br> + #outdir# +<br> + + + + Browse + + + + :/icons/images/browse.png:/icons/images/browse.png + + + @@ -320,24 +320,40 @@ Compression using Root. Available only for Gotthard in Expert Mode. 255 21 476 - 66 + 76 6 - - + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 20 + + + + + + false - Auto + Rate: - + false @@ -361,62 +377,7 @@ Compression using Root. Available only for Gotthard in Expert Mode. - - - - Flat field corrections. - #flatfield# filename - - - Flat Field File: - - - - - - - false - - - - 0 - 0 - - - - - 100 - 0 - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - ns - - - 9 - - - -1.000000000000000 - - - 2000000000.000000000000000 - - - - - - - false - - - Rate: - - - - + false @@ -430,13 +391,14 @@ Compression using Root. Available only for Gotthard in Expert Mode. - - - - false + + + + Flat field corrections. + #flatfield# filename - Custom dead time: + Flat Field File: @@ -456,6 +418,120 @@ Compression using Root. Available only for Gotthard in Expert Mode. + + + + false + + + + 0 + 0 + + + + + + + + + 2 + 2 + 2 + + + + + + + + + 0 + 0 + 0 + + + + + + + + + 119 + 119 + 119 + + + + + + + + <nobr> +Directory where one saves the data. +</nobr><br> + #outdir# +<br> + + + + Dead Time: + + + + + + + + 0 + 0 + + + + ns + + + -1 + + + 200000000 + + + + + + + false + + + + 0 + 0 + + + + + 16777215 + 30 + + + + <nobr> +Directory where one saves the data. +</nobr><br> + #outdir# +<br> + + + + Default + + + + :/icons/images/calculate.png:/icons/images/calculate.png + + + @@ -623,53 +699,10 @@ Compression using Root. Available only for Gotthard in Expert Mode. - - - - 384 - 60 - 348 - 27 - - - - - - - false - - - - 0 - 0 - - - - - 100 - 0 - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - ns - - - 9 - - - -1.000000000000000 - - - 2000000000.000000000000000 - - - - - + boxOutDir + boxCorrection_2 + btnOutputBrowse dispReadOutputDir @@ -677,9 +710,6 @@ Compression using Root. Available only for Gotthard in Expert Mode. dispFlatField btnFlatField chkRate - radioAuto - radioDeadTime - spinDeadTime diff --git a/slsDetectorGui/include/qTabDataOutput.h b/slsDetectorGui/include/qTabDataOutput.h index 7fd11da7e..026c38cc5 100644 --- a/slsDetectorGui/include/qTabDataOutput.h +++ b/slsDetectorGui/include/qTabDataOutput.h @@ -110,7 +110,10 @@ void UpdateFlatFieldFromServer(); void BrowseFlatFieldPath(); /**rate correction*/ -void SetRateCorrection(); +void SetRateCorrection(int deadtime=0); + +/** default rate correction */ +void SetDefaultRateCorrection(); /** update rate correction from server */ void UpdateRateCorrectionFromServer(); diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index 584797fcc..1f4974e43 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -46,7 +46,6 @@ void qTabDataOutput::SetupWidgetWindow(){ // Detector Type detType=myDet->getDetectorsType(); widgetEiger->setVisible(false); - spinDeadTimeonly->setVisible(false); //rate correction - not for charge integrating detectors if((detType == slsDetectorDefs::MYTHEN)||(detType == slsDetectorDefs::EIGER)) @@ -56,12 +55,9 @@ void qTabDataOutput::SetupWidgetWindow(){ chkAngular->setEnabled(true); if(detType == slsDetectorDefs::EIGER){ + chkRate->setEnabled(true); chkTenGiga->setEnabled(true); widgetEiger->setVisible(true); - spinDeadTimeonly->setVisible(true); - radioAuto->setVisible(false); - radioDeadTime->setVisible(false); - spinDeadTime->setVisible(false); } /** error message **/ @@ -154,14 +150,10 @@ void qTabDataOutput::Initialization(){ 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())); - if(detType == slsDetectorDefs::EIGER) - connect(spinDeadTimeonly, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); - else{ - connect(radioAuto, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); - connect(radioDeadTime, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); - connect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); - } + connect(chkRate, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); + connect(btnDefaultRate, SIGNAL(clicked()), this, SLOT(SetDefaultRateCorrection())); + connect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); + //angular correction connect(chkAngular, SIGNAL(toggled(bool)), this, SLOT(SetAngularCorrection())); //discard bad channels @@ -333,81 +325,69 @@ void qTabDataOutput::BrowseFlatFieldPath(){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void qTabDataOutput::SetRateCorrection(){ - if(detType == slsDetectorDefs::EIGER) - disconnect(spinDeadTimeonly, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); - else{ - disconnect(radioAuto, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); - disconnect(radioDeadTime, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); - disconnect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); - } +void qTabDataOutput::SetRateCorrection(int deadtime){ + disconnect(btnDefaultRate, SIGNAL(clicked()), this, SLOT(SetDefaultRateCorrection())); + disconnect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); #ifdef VERBOSE cout << "Entering Set Rate Correction function" << endl; #endif if(chkRate->isChecked()){ - if(detType == slsDetectorDefs::EIGER){ - spinDeadTimeonly->setEnabled(true); - myDet->setRateCorrection((double)spinDeadTimeonly->value()); + if(!btnDefaultRate->isEnabled()){ + btnDefaultRate->setEnabled(true); + lblDeadTime->setEnabled(true); + spinDeadTime->setEnabled(true); } - else{ - radioAuto->setEnabled(true); - radioDeadTime->setEnabled(true); - //set auto as default if nothing selected - if(!radioAuto->isChecked()&&!radioDeadTime->isChecked()) - radioAuto->setChecked(true); - //auto mode - if(radioAuto->isChecked()){ - spinDeadTime->setEnabled(false); - myDet->setRateCorrection(-1); + + if(deadtime!=-1){ + deadtime = (double)spinDeadTime->value(); #ifdef VERBOSE - cout << "Setting rate corrections with default dead time" << endl; + cout << "Setting rate corrections with custom dead time: " << deadtime << endl; #endif - } - //custom dead time - else{ - spinDeadTime->setEnabled(true); - myDet->setRateCorrection((double)spinDeadTime->value()); + }else{; #ifdef VERBOSE - cout << "Setting rate corrections with dead time "<< spinDeadTime->value() << endl; + cout << "Setting rate corrections with default dead time" << endl; #endif - } } - }//unsetting + myDet->setRateCorrection(deadtime); + + }//unsetting rate correction else{ - if(detType == slsDetectorDefs::EIGER) - spinDeadTimeonly->setEnabled(false); - else{ - radioAuto->setEnabled(false); - radioDeadTime->setEnabled(false); - spinDeadTime->setEnabled(false); - } - //Unsetting rate correction + btnDefaultRate->setEnabled(false); + lblDeadTime->setEnabled(false); + spinDeadTime->setEnabled(false); myDet->setRateCorrection(0); #ifdef VERBOSE cout << "Unsetting rate correction" << endl; #endif } - qDefs::checkErrorMessage(myDet,"qTabDataOutput::SetRateCorrection"); //update just the value double rate = (double)myDet->getRateCorrectionTau(); - if(spinDeadTime->isEnabled()) - spinDeadTime->setValue((double)rate); - else if(spinDeadTimeonly->isEnabled()) - spinDeadTimeonly->setValue((double)rate); - - - if(detType == slsDetectorDefs::EIGER) - connect(spinDeadTimeonly, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); - else{ - connect(radioAuto, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); - connect(radioDeadTime, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); - connect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); + spinDeadTime->setValue((double)rate); + if(rate == -1){ + qDefs::Message(qDefs::WARNING,"Dead time is inconsistent for all detectors. Returned Value: -1.","qTabDataOutput::UpdateRateCorrectionFromServer"); + QString errorTip = QString("Rate Corrections.
" + " #ratecorr# tau in seconds

")+ + QString("" + "Dead time is inconsistent for all detectors."); + chkRate->setToolTip(errorTip); + spinDeadTime->setToolTip(errorTip); + chkRate->setPalette(red); + chkRate->setText("Rate:*"); + }else{ + QString normalTip = QString("Rate Corrections.
" + " #ratecorr# tau in seconds

"); + chkRate->setToolTip(normalTip); + spinDeadTime->setToolTip(normalTip); + chkRate->setPalette(chkDiscardBad->palette()); + chkRate->setText("Rate:"); } + connect(btnDefaultRate, SIGNAL(clicked()), this, SLOT(SetDefaultRateCorrection())); + connect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); } @@ -415,94 +395,62 @@ void qTabDataOutput::SetRateCorrection(){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void qTabDataOutput::UpdateRateCorrectionFromServer(){ - disconnect(chkRate, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); +void qTabDataOutput::SetDefaultRateCorrection(){ + SetRateCorrection(-1); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabDataOutput::UpdateRateCorrectionFromServer(){ + disconnect(chkRate, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); + disconnect(btnDefaultRate, SIGNAL(clicked()), this, SLOT(SetDefaultRateCorrection())); + disconnect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); - if(detType == slsDetectorDefs::EIGER) - disconnect(spinDeadTimeonly, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); - else{ - disconnect(radioAuto, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); - disconnect(radioDeadTime, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); - disconnect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); - } double rate; rate = (double)myDet->getRateCorrectionTau(); qDefs::checkErrorMessage(myDet,"qTabDataOutput::UpdateRateCorrectionFromServer"); #ifdef VERBOSE - cout << "Getting rate correction from server:" << rate << " : "; + cout << "Getting rate correction from server: " << rate << endl; #endif if(rate==0){ -#ifdef VERBOSE - cout << "None" << endl; -#endif chkRate->setChecked(false); - if(detType == slsDetectorDefs::EIGER) - spinDeadTimeonly->setEnabled(false); - else{ - radioAuto->setEnabled(false); - radioDeadTime->setEnabled(false); - spinDeadTime->setEnabled(false); - } + btnDefaultRate->setEnabled(false); + lblDeadTime->setEnabled(false); + spinDeadTime->setEnabled(false); } else{ chkRate->setChecked(true); - - if(detType == slsDetectorDefs::EIGER){ - spinDeadTimeonly->setEnabled(true); - spinDeadTimeonly->setValue((double)rate); - } - //mythen - else{ - radioAuto->setEnabled(true); - radioDeadTime->setEnabled(true); - chkRate->setChecked(true); - if(rate == -1){ -#ifdef VERBOSE - cout << "Auto" << endl; -#endif - spinDeadTime->setEnabled(false); - radioAuto->setChecked(true); - }else{ -#ifdef VERBOSE - cout << "Custom" << endl; -#endif - radioDeadTime->setChecked(true); - spinDeadTime->setEnabled(true); - spinDeadTime->setValue((double)rate); - } - } + btnDefaultRate->setEnabled(true); + lblDeadTime->setEnabled(true); + spinDeadTime->setEnabled(true); + spinDeadTime->setValue((double)rate); } - - if(detType == slsDetectorDefs::EIGER && rate == -1){ + if(rate == -1){ qDefs::Message(qDefs::WARNING,"Dead time is inconsistent for all detectors. Returned Value: -1.","qTabDataOutput::UpdateRateCorrectionFromServer"); QString errorTip = QString("Rate Corrections.
" " #ratecorr# tau in seconds

")+ QString("" "Dead time is inconsistent for all detectors."); chkRate->setToolTip(errorTip); - spinDeadTimeonly->setToolTip(errorTip); + spinDeadTime->setToolTip(errorTip); chkRate->setPalette(red); chkRate->setText("Rate:*"); }else{ QString normalTip = QString("Rate Corrections.
" " #ratecorr# tau in seconds

"); chkRate->setToolTip(normalTip); - spinDeadTimeonly->setToolTip(normalTip); + spinDeadTime->setToolTip(normalTip); chkRate->setPalette(chkDiscardBad->palette()); chkRate->setText("Rate:"); } - connect(chkRate, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); - - if(detType == slsDetectorDefs::EIGER) - disconnect(spinDeadTimeonly, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); - else{ - connect(radioAuto, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); - connect(radioDeadTime, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); - connect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); - } + connect(chkRate, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); + connect(btnDefaultRate, SIGNAL(clicked()), this, SLOT(SetDefaultRateCorrection())); + connect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); } From 5b5e1e32b331bbe051c4c31b363de5d09e7daf7b Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Fri, 12 Aug 2016 11:14:57 +0200 Subject: [PATCH 330/332] updaterev --- slsDetectorGui/gitInfo.txt | 8 ++++---- slsDetectorGui/include/gitInfoGui.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/slsDetectorGui/gitInfo.txt b/slsDetectorGui/gitInfo.txt index 37fa7817e..7146b8444 100644 --- a/slsDetectorGui/gitInfo.txt +++ b/slsDetectorGui/gitInfo.txt @@ -1,9 +1,9 @@ Path: slsDetectorsPackage/slsDetectorGui URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_gui.git Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_gui.git -Repsitory UUID: 68ac7f5a712c45a0f3782b213528285e2dea84ff -Revision: 329 +Repsitory UUID: 703b3f772a26ba5af7eca275801dcf890376cf33 +Revision: 334 Branch: developer Last Changed Author: Dhanya_Maliakal -Last Changed Rev: 329 -Last Changed Date: 2016-07-22 10:41:35 +0200 +Last Changed Rev: 334 +Last Changed Date: 2016-08-11 13:59:36 +0200 diff --git a/slsDetectorGui/include/gitInfoGui.h b/slsDetectorGui/include/gitInfoGui.h index a0a094a15..6d991e548 100644 --- a/slsDetectorGui/include/gitInfoGui.h +++ b/slsDetectorGui/include/gitInfoGui.h @@ -1,11 +1,11 @@ //#define SVNPATH "" #define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_gui.git" //#define SVNREPPATH "" -#define SVNREPUUID "68ac7f5a712c45a0f3782b213528285e2dea84ff" -//#define SVNREV 0x329 +#define SVNREPUUID "703b3f772a26ba5af7eca275801dcf890376cf33" +//#define SVNREV 0x334 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "Dhanya_Maliakal" -#define SVNREV 0x329 -#define SVNDATE 0x20160722 +#define SVNREV 0x334 +#define SVNDATE 0x20160811 // From 5d52e41e37df4165673ed9c2a7ad34b3ace7576e Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Wed, 24 Aug 2016 17:10:07 +0200 Subject: [PATCH 331/332] adcs refresh only in developer tab --- slsDetectorGui/include/qDetectorMain.h | 2 ++ slsDetectorGui/include/qTabDeveloper.h | 6 +++++- slsDetectorGui/src/qDetectorMain.cpp | 8 ++++++++ slsDetectorGui/src/qTabDeveloper.cpp | 9 +++++++-- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/slsDetectorGui/include/qDetectorMain.h b/slsDetectorGui/include/qDetectorMain.h index 8833836f4..7574380f5 100644 --- a/slsDetectorGui/include/qDetectorMain.h +++ b/slsDetectorGui/include/qDetectorMain.h @@ -83,6 +83,8 @@ public: /** Verifies if output directories for all the receivers exist */ int DoesOutputDirExist(){return tab_dataoutput->VerifyOutputDirectory();}; + bool isCurrentlyTabDeveloper(); + private: /** The Qt Application */ QApplication *theApp; diff --git a/slsDetectorGui/include/qTabDeveloper.h b/slsDetectorGui/include/qTabDeveloper.h index 75f32eefb..2131a04e2 100644 --- a/slsDetectorGui/include/qTabDeveloper.h +++ b/slsDetectorGui/include/qTabDeveloper.h @@ -24,6 +24,8 @@ class multiSlsDetector; #include #include #include +class qDetectorMain; + /** C++ Include Headers */ #include #include @@ -62,7 +64,7 @@ public: * @param parent is the parent tab widget * @param detector is the detector returned from the detector tab */ - qTabDeveloper(QWidget *parent,multiSlsDetector*& detector); + qTabDeveloper(qDetectorMain *parent,multiSlsDetector*& detector); /** Destructor */ @@ -73,6 +75,8 @@ public: void StopADCTimer(){if(adcTimer) adcTimer->stop();}; private: + /** parent widget */ + qDetectorMain *thisParent; /** The sls detector object */ multiSlsDetector *myDet; /** The sls detector object */ diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index c3d39928b..1facae787 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -878,4 +878,12 @@ void qDetectorMain::UncheckServer(){ } +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +bool qDetectorMain::isCurrentlyTabDeveloper(){ + return (tabs->currentIndex()==Developer); +} + + //------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/slsDetectorGui/src/qTabDeveloper.cpp b/slsDetectorGui/src/qTabDeveloper.cpp index 365bf258e..d6d8a6d28 100644 --- a/slsDetectorGui/src/qTabDeveloper.cpp +++ b/slsDetectorGui/src/qTabDeveloper.cpp @@ -5,6 +5,7 @@ * Author: l_maliakal_d */ #include "qTabDeveloper.h" +#include "qDetectorMain.h" //Project Class Headers #include "slsDetector.h" #include "multiSlsDetector.h" @@ -24,8 +25,8 @@ int qTabDeveloper::NUM_ADC_WIDGETS(0); //------------------------------------------------------------------------------------------------------------------------------------------------- -qTabDeveloper::qTabDeveloper(QWidget *parent,multiSlsDetector*& detector): - QWidget(parent), +qTabDeveloper::qTabDeveloper(qDetectorMain *parent,multiSlsDetector*& detector): + thisParent(parent), myDet(detector), det(0), boxDacs(0), @@ -52,6 +53,7 @@ qTabDeveloper::qTabDeveloper(QWidget *parent,multiSlsDetector*& detector): qTabDeveloper::~qTabDeveloper(){ delete myDet; if(det) delete det; + if(thisParent) delete thisParent; } @@ -523,6 +525,9 @@ slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(int index){ void qTabDeveloper::RefreshAdcs(){ + if(!thisParent->isCurrentlyTabDeveloper()) + return; + #ifdef VERYVERBOSE cout << "Updating ADCs" < Date: Tue, 30 Aug 2016 16:12:47 +0200 Subject: [PATCH 332/332] updaterev --- slsDetectorGui/gitInfo.txt | 8 ++++---- slsDetectorGui/include/gitInfoGui.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/slsDetectorGui/gitInfo.txt b/slsDetectorGui/gitInfo.txt index 7146b8444..6d181708d 100644 --- a/slsDetectorGui/gitInfo.txt +++ b/slsDetectorGui/gitInfo.txt @@ -1,9 +1,9 @@ Path: slsDetectorsPackage/slsDetectorGui URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_gui.git Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_gui.git -Repsitory UUID: 703b3f772a26ba5af7eca275801dcf890376cf33 -Revision: 334 +Repsitory UUID: 2ad70c5041e2e2f6cdfa949639bb6250083eebec +Revision: 336 Branch: developer Last Changed Author: Dhanya_Maliakal -Last Changed Rev: 334 -Last Changed Date: 2016-08-11 13:59:36 +0200 +Last Changed Rev: 336 +Last Changed Date: 2016-08-24 17:10:07 +0200 diff --git a/slsDetectorGui/include/gitInfoGui.h b/slsDetectorGui/include/gitInfoGui.h index 6d991e548..66aa8b028 100644 --- a/slsDetectorGui/include/gitInfoGui.h +++ b/slsDetectorGui/include/gitInfoGui.h @@ -1,11 +1,11 @@ //#define SVNPATH "" #define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_gui.git" //#define SVNREPPATH "" -#define SVNREPUUID "703b3f772a26ba5af7eca275801dcf890376cf33" -//#define SVNREV 0x334 +#define SVNREPUUID "2ad70c5041e2e2f6cdfa949639bb6250083eebec" +//#define SVNREV 0x336 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "Dhanya_Maliakal" -#define SVNREV 0x334 -#define SVNDATE 0x20160811 +#define SVNREV 0x336 +#define SVNDATE 0x20160824 //