diff --git a/slsDetectorGui/forms/form_detectormain.ui b/slsDetectorGui/forms/form_detectormain.ui
index 3a2005d22..09ddba539 100755
--- a/slsDetectorGui/forms/form_detectormain.ui
+++ b/slsDetectorGui/forms/form_detectormain.ui
@@ -229,8 +229,9 @@
Utilities
-
-
+
+
+
diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp
index 7f3fba1d0..dc7f2f9e5 100755
--- a/slsDetectorGui/src/qDetectorMain.cpp
+++ b/slsDetectorGui/src/qDetectorMain.cpp
@@ -190,7 +190,7 @@ void qDetectorMain::SetUpWidgetWindow() {
tabs->setTabEnabled(DEBUGGING, false);
tabs->setTabEnabled(ADVANCED, false);
tabs->setTabEnabled(DEVELOPER, isDeveloper);
- actionTrimbitsLoad->setVisible(false);
+ actionLoadTrimbits->setVisible(false);
dockWidgetPlot->setFloating(false);
dockWidgetPlot->setFeatures(QDockWidget::NoDockWidgetFeatures);
@@ -219,10 +219,10 @@ void qDetectorMain::SetUpDetector(const std::string fName, int multiID) {
// validate detector type (for GUI) and update menu
detType = det->getDetectorType().tsquash("Different detector type for all modules.");
- actionTrimbitsLoad->setEnabled(false);
+ actionLoadTrimbits->setEnabled(false);
switch (detType) {
case slsDetectorDefs::EIGER:
- actionTrimbitsLoad->setEnabled(true);
+ actionLoadTrimbits->setEnabled(true);
break;
case slsDetectorDefs::GOTTHARD:
case slsDetectorDefs::JUNGFRAU:
@@ -320,7 +320,7 @@ void qDetectorMain::EnableModes(QAction *action) {
enable = actionExpert->isChecked();
tabs->setTabEnabled(ADVANCED, enable);
- actionTrimbitsLoad->setVisible(enable && detType == slsDetectorDefs::EIGER);
+ actionLoadTrimbits->setVisible(enable && detType == slsDetectorDefs::EIGER);
FILE_LOG(logINFO) << "Expert Mode: "
<< slsDetectorDefs::stringEnable(enable);
}
@@ -343,7 +343,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action) {
bool refreshTabs = false;
try {
- if (action == actionConfigurationLoad) {
+ if (action == actionLoadConfiguration) {
FILE_LOG(logDEBUG) << "Loading Configuration";
QString fName = QString(det->getFilePath().squash("/tmp/").c_str());
fName = QFileDialog::getOpenFileName(
@@ -363,7 +363,27 @@ void qDetectorMain::ExecuteUtilities(QAction *action) {
}
}
- else if (action == actionTrimbitsLoad) {
+ else if (action == actionLoadParameters) {
+ FILE_LOG(logDEBUG) << "Loading Parameters";
+ QString fName = QString(det->getFilePath().squash("/tmp/").c_str());
+ fName = QFileDialog::getOpenFileName(
+ this, tr("Load Measurement Setup"), fName,
+ tr("Parameter files (*.det);;All Files(*)"));
+ // Gets called when cancelled as well
+ if (!fName.isEmpty()) {
+ refreshTabs = true;
+ det->loadParameters(
+ std::string(fName.toAscii().constData()));
+ qDefs::Message(qDefs::INFORMATION,
+ "The Detector Parameters have been "
+ "configured successfully.",
+ "qDetectorMain::ExecuteUtilities");
+ FILE_LOG(logINFO)
+ << "Parameters loaded successfully";
+ }
+ }
+
+ else if (action == actionLoadTrimbits) {
QString fName = QString((det->getSettingsDir().squash("/tmp/")).c_str());
FILE_LOG(logDEBUG) << "Loading Trimbits";
// so that even nonexisting files can be selected
@@ -520,7 +540,8 @@ void qDetectorMain::EnableTabs(bool enable) {
tabs->setTabEnabled(MESSAGES, enable);
// actions check
- actionConfigurationLoad->setEnabled(enable);
+ actionLoadConfiguration->setEnabled(enable);
+ actionLoadParameters->setEnabled(enable);
actionDebug->setEnabled(enable);
actionExpert->setEnabled(enable);
@@ -530,7 +551,7 @@ void qDetectorMain::EnableTabs(bool enable) {
// expert
bool expertTab = enable && (actionExpert->isChecked());
tabs->setTabEnabled(ADVANCED, expertTab);
- actionTrimbitsLoad->setVisible(expertTab && detType == slsDetectorDefs::EIGER);
+ actionLoadTrimbits->setVisible(expertTab && detType == slsDetectorDefs::EIGER);
// moved to here, so that its all in order, instead of signals and different
// threads
diff --git a/slsDetectorSoftware/include/Detector.h b/slsDetectorSoftware/include/Detector.h
index 8f2b761d1..f1787db77 100644
--- a/slsDetectorSoftware/include/Detector.h
+++ b/slsDetectorSoftware/include/Detector.h
@@ -41,6 +41,8 @@ class Detector {
void loadConfig(const std::string &fname);
+ void loadParameters(const std::string &fname);
+
Result getHostname(Positions pos = {}) const;
/* Frees shared memory, adds detectors to the list
diff --git a/slsDetectorSoftware/src/Detector.cpp b/slsDetectorSoftware/src/Detector.cpp
index 981ca48bd..80a1a980f 100644
--- a/slsDetectorSoftware/src/Detector.cpp
+++ b/slsDetectorSoftware/src/Detector.cpp
@@ -21,6 +21,10 @@ void Detector::loadConfig(const std::string &fname) {
pimpl->readConfigurationFile(fname);
}
+void Detector::loadParameters(const std::string &fname) {
+ pimpl->retrieveDetectorSetup(fname, 0);
+}
+
Result Detector::getHostname(Positions pos) const {
return pimpl->Parallel(&slsDetector::getHostname, pos);
}