mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-29 01:20:02 +02:00
added load paramaters to detector.h
This commit is contained in:
parent
fc0b25cfa7
commit
7abb18e5c8
@ -229,8 +229,9 @@
|
|||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Utilities</string>
|
<string>Utilities</string>
|
||||||
</property>
|
</property>
|
||||||
<addaction name="actionConfigurationLoad"/>
|
<addaction name="actionLoadConfiguration"/>
|
||||||
<addaction name="actionTrimbitsLoad"/>
|
<addaction name="actionLoadTrimbits"/>
|
||||||
|
<addaction name="actionLoadParameters"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menuModes">
|
<widget class="QMenu" name="menuModes">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
@ -465,12 +466,12 @@ p, li { white-space: pre-wrap; }
|
|||||||
<string>&About</string>
|
<string>&About</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionConfigurationLoad">
|
<action name="actionLoadConfiguration">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Load Configuration</string>
|
<string>Load Configuration</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionTrimbitsLoad">
|
<action name="actionLoadTrimbits">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Load Trimbits</string>
|
<string>Load Trimbits</string>
|
||||||
</property>
|
</property>
|
||||||
@ -499,6 +500,11 @@ p, li { white-space: pre-wrap; }
|
|||||||
<string>Dockable Windows</string>
|
<string>Dockable Windows</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionLoadParameters">
|
||||||
|
<property name="text">
|
||||||
|
<string>Load Parameters</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
@ -190,7 +190,7 @@ void qDetectorMain::SetUpWidgetWindow() {
|
|||||||
tabs->setTabEnabled(DEBUGGING, false);
|
tabs->setTabEnabled(DEBUGGING, false);
|
||||||
tabs->setTabEnabled(ADVANCED, false);
|
tabs->setTabEnabled(ADVANCED, false);
|
||||||
tabs->setTabEnabled(DEVELOPER, isDeveloper);
|
tabs->setTabEnabled(DEVELOPER, isDeveloper);
|
||||||
actionTrimbitsLoad->setVisible(false);
|
actionLoadTrimbits->setVisible(false);
|
||||||
|
|
||||||
dockWidgetPlot->setFloating(false);
|
dockWidgetPlot->setFloating(false);
|
||||||
dockWidgetPlot->setFeatures(QDockWidget::NoDockWidgetFeatures);
|
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
|
// validate detector type (for GUI) and update menu
|
||||||
detType = det->getDetectorType().tsquash("Different detector type for all modules.");
|
detType = det->getDetectorType().tsquash("Different detector type for all modules.");
|
||||||
actionTrimbitsLoad->setEnabled(false);
|
actionLoadTrimbits->setEnabled(false);
|
||||||
switch (detType) {
|
switch (detType) {
|
||||||
case slsDetectorDefs::EIGER:
|
case slsDetectorDefs::EIGER:
|
||||||
actionTrimbitsLoad->setEnabled(true);
|
actionLoadTrimbits->setEnabled(true);
|
||||||
break;
|
break;
|
||||||
case slsDetectorDefs::GOTTHARD:
|
case slsDetectorDefs::GOTTHARD:
|
||||||
case slsDetectorDefs::JUNGFRAU:
|
case slsDetectorDefs::JUNGFRAU:
|
||||||
@ -320,7 +320,7 @@ void qDetectorMain::EnableModes(QAction *action) {
|
|||||||
enable = actionExpert->isChecked();
|
enable = actionExpert->isChecked();
|
||||||
|
|
||||||
tabs->setTabEnabled(ADVANCED, enable);
|
tabs->setTabEnabled(ADVANCED, enable);
|
||||||
actionTrimbitsLoad->setVisible(enable && detType == slsDetectorDefs::EIGER);
|
actionLoadTrimbits->setVisible(enable && detType == slsDetectorDefs::EIGER);
|
||||||
FILE_LOG(logINFO) << "Expert Mode: "
|
FILE_LOG(logINFO) << "Expert Mode: "
|
||||||
<< slsDetectorDefs::stringEnable(enable);
|
<< slsDetectorDefs::stringEnable(enable);
|
||||||
}
|
}
|
||||||
@ -343,7 +343,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action) {
|
|||||||
bool refreshTabs = false;
|
bool refreshTabs = false;
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (action == actionConfigurationLoad) {
|
if (action == actionLoadConfiguration) {
|
||||||
FILE_LOG(logDEBUG) << "Loading Configuration";
|
FILE_LOG(logDEBUG) << "Loading Configuration";
|
||||||
QString fName = QString(det->getFilePath().squash("/tmp/").c_str());
|
QString fName = QString(det->getFilePath().squash("/tmp/").c_str());
|
||||||
fName = QFileDialog::getOpenFileName(
|
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());
|
QString fName = QString((det->getSettingsDir().squash("/tmp/")).c_str());
|
||||||
FILE_LOG(logDEBUG) << "Loading Trimbits";
|
FILE_LOG(logDEBUG) << "Loading Trimbits";
|
||||||
// so that even nonexisting files can be selected
|
// so that even nonexisting files can be selected
|
||||||
@ -520,7 +540,8 @@ void qDetectorMain::EnableTabs(bool enable) {
|
|||||||
tabs->setTabEnabled(MESSAGES, enable);
|
tabs->setTabEnabled(MESSAGES, enable);
|
||||||
|
|
||||||
// actions check
|
// actions check
|
||||||
actionConfigurationLoad->setEnabled(enable);
|
actionLoadConfiguration->setEnabled(enable);
|
||||||
|
actionLoadParameters->setEnabled(enable);
|
||||||
actionDebug->setEnabled(enable);
|
actionDebug->setEnabled(enable);
|
||||||
actionExpert->setEnabled(enable);
|
actionExpert->setEnabled(enable);
|
||||||
|
|
||||||
@ -530,7 +551,7 @@ void qDetectorMain::EnableTabs(bool enable) {
|
|||||||
// expert
|
// expert
|
||||||
bool expertTab = enable && (actionExpert->isChecked());
|
bool expertTab = enable && (actionExpert->isChecked());
|
||||||
tabs->setTabEnabled(ADVANCED, expertTab);
|
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
|
// moved to here, so that its all in order, instead of signals and different
|
||||||
// threads
|
// threads
|
||||||
|
@ -41,6 +41,8 @@ class Detector {
|
|||||||
|
|
||||||
void loadConfig(const std::string &fname);
|
void loadConfig(const std::string &fname);
|
||||||
|
|
||||||
|
void loadParameters(const std::string &fname);
|
||||||
|
|
||||||
Result<std::string> getHostname(Positions pos = {}) const;
|
Result<std::string> getHostname(Positions pos = {}) const;
|
||||||
|
|
||||||
/* Frees shared memory, adds detectors to the list
|
/* Frees shared memory, adds detectors to the list
|
||||||
|
@ -21,6 +21,10 @@ void Detector::loadConfig(const std::string &fname) {
|
|||||||
pimpl->readConfigurationFile(fname);
|
pimpl->readConfigurationFile(fname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Detector::loadParameters(const std::string &fname) {
|
||||||
|
pimpl->retrieveDetectorSetup(fname, 0);
|
||||||
|
}
|
||||||
|
|
||||||
Result<std::string> Detector::getHostname(Positions pos) const {
|
Result<std::string> Detector::getHostname(Positions pos) const {
|
||||||
return pimpl->Parallel(&slsDetector::getHostname, pos);
|
return pimpl->Parallel(&slsDetector::getHostname, pos);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user