diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/SANSRunWindow.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/SANSRunWindow.h index 24b9ee880f813ba1bb69ff75a9c036f4c7e07071..e43f04ae1a79925b9e4d31fe39ca7d6521e1b15a 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/SANSRunWindow.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/SANSRunWindow.h @@ -89,6 +89,8 @@ signals: void dataReadyToProcess(bool state); // signal to notify mask file loaded void userfileLoaded(); + /// signal to send gemoetry information + void sendGeometryInformation(QString &, QString &, QString &, QString &); private: /// Stores the batch or single run mode selection @@ -315,6 +317,8 @@ private slots: void onUpDownCheckboxChanged(); /// Handle a change of the aperture geometry for QResolution void handleQResolutionApertureChange(int aperture); + /// + void onUpdateGeometryRequest(); private: /// used to specify the range of validation to do diff --git a/MantidQt/CustomInterfaces/src/SANSRunWindow.cpp b/MantidQt/CustomInterfaces/src/SANSRunWindow.cpp index 2fa029192f63da9756a447ee7c5dd1b1ae9eead5..fd593e738465482bead16f8033f1a9384e1ef0ee 100644 --- a/MantidQt/CustomInterfaces/src/SANSRunWindow.cpp +++ b/MantidQt/CustomInterfaces/src/SANSRunWindow.cpp @@ -479,6 +479,13 @@ void SANSRunWindow::saveWorkspacesDialog() { // Connect to change in the zero-error removal checkbox connect(m_uiForm.zeroErrorCheckBox, SIGNAL(stateChanged(int)), m_saveWorkspaces, SLOT(onSaveAsZeroErrorFreeChanged(int))); + // Connect the transfer of geometry inforamtion + connect(m_saveWorkspaces, SIGNAL(updateGeometryInformation()), this, + SLOT(onUpdateGeometryRequest())); + connect(this, SIGNAL(sendGeometryInformation(QString &, QString &, QString &, + QString &)), + m_saveWorkspaces, SLOT(onUpdateGeomtryInformation( + QString &, QString &, QString &, QString &))); m_uiForm.saveSel_btn->setEnabled(false); m_saveWorkspaces->show(); @@ -2943,7 +2950,17 @@ void SANSRunWindow::handleDefSaveClick() { } } } - // finish the saveCommand for SaveCanSAS1D + + // Add the sample information to the output + auto sampleWidth =m_uiForm.sample_width->text(); + auto sampleHeight = m_uiForm.sample_height->text(); + auto sampleThickness = m_uiForm.sample_thick->text(); + auto geometryID = m_uiForm.sample_geomid->currentText(); + // Remove the first three characters, since they are unwanted + auto geometryName = geometryID.mid(3); + saveCommand += ", Geometry='" + geometryName + "', SampleHeight=" + + sampleHeight + ", SampleWidth=" + sampleWidth + + ", SampleThickness=" + sampleThickness; saveCommand += ")\n"; } else saveCommand += (*alg) + "('" + m_outputWS + "','" + fname + "')\n"; @@ -5070,5 +5087,17 @@ void SANSRunWindow::updateIDFFilePath() { m_uiForm.current_idf_path->setText(resultIdf); } } + +void SANSRunWindow::onUpdateGeometryRequest() { + auto sampleWidth = m_uiForm.sample_width->text(); + auto sampleHeight = m_uiForm.sample_height->text(); + auto sampleThickness = m_uiForm.sample_thick->text(); + auto geometryID = m_uiForm.sample_geomid->currentText(); + auto geometryName = geometryID.mid(3); + + emit sendGeometryInformation(geometryName, sampleHeight, sampleWidth, + sampleThickness); +} + } // namespace CustomInterfaces } // namespace MantidQt diff --git a/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/SaveWorkspaces.h b/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/SaveWorkspaces.h index 9b68deccae29a8b8d4ac92a8eceb7cbf2b5d7b63..973c217eaeeb6df44467f91c87e72b56c7d34c61 100644 --- a/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/SaveWorkspaces.h +++ b/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/SaveWorkspaces.h @@ -54,12 +54,16 @@ public: static QString getSaveAlgExt(const QString &algName); public slots: void onSaveAsZeroErrorFreeChanged(int state); + void onUpdateGeomtryInformation(QString &geometryID, QString &sampleHeight, + QString &sampleWidth, + QString &sampleThickness); signals: void closing(); void createZeroErrorFreeWorkspace(QString &originalWorkspace, QString &zeroFreeWorkspace); void deleteZeroErrorFreeWorkspace(QString &zeroFreeWorkspace); + void updateGeometryInformation(); private: QLineEdit *m_fNameEdit; @@ -67,6 +71,10 @@ private: QCheckBox *m_append; QString m_lastName; bool m_saveAsZeroErrorFree; + QString m_geometryID; + QString m_sampleHeight; + QString m_sampleWidth; + QString m_sampleThickness; QHash<QCheckBox *const, QString> m_savFormats; typedef QHash<QCheckBox *const, QString>::const_iterator SavFormatsConstIt; diff --git a/MantidQt/MantidWidgets/src/SaveWorkspaces.cpp b/MantidQt/MantidWidgets/src/SaveWorkspaces.cpp index c58cb747d6762ba02c7cbf91e00066a5fb573dc8..dc090712e2abaf9cc9226fed89d453fd8410386b 100644 --- a/MantidQt/MantidWidgets/src/SaveWorkspaces.cpp +++ b/MantidQt/MantidWidgets/src/SaveWorkspaces.cpp @@ -39,7 +39,8 @@ using namespace Mantid::API; SaveWorkspaces::SaveWorkspaces(QWidget *parent, const QString &suggFname, QHash<const QCheckBox *const, QString> &defSavs, bool saveAsZeroErrorFree) - : API::MantidDialog(parent), m_saveAsZeroErrorFree(saveAsZeroErrorFree) { + : API::MantidDialog(parent), m_saveAsZeroErrorFree(saveAsZeroErrorFree), m_geometryID("), + m_sampleHeight(""), m_sampleWidth(""), m_sampleThickness(""){ setAttribute(Qt::WA_DeleteOnClose); setWindowTitle("Save Workspaces"); @@ -271,7 +272,12 @@ QString SaveWorkspaces::saveList(const QList<QListWidgetItem *> &wspaces, // g_log.wa } } - // finally finish the algorithm call + // Add the geometry information + emit updateGeometryInformation(); + // Remove the first three characters, since they are unwanted + saveCommands += ", Geometry='" + m_geometryID + "', SampleHeight=" + + m_sampleHeight + ", SampleWidth=" + m_sampleWidth + + ", SampleThickness=" + m_sampleThickness; saveCommands += ")\n"; } return saveCommands; @@ -431,3 +437,16 @@ void SaveWorkspaces::onSaveAsZeroErrorFreeChanged(int state) { m_saveAsZeroErrorFree = true; } } + +/** + * Recieves an update for the geometry information + */ +void SaveWorkspaces::onUpdateGeomtryInformation(QString &geometryID, + QString &sampleHeight, + QString &sampleWidth, + QString &sampleThickness) { + m_geometryID = geometryID; + m_sampleHeight = sampleHeight; + m_sampleWidth = sampleWidth; + m_sampleThickness = sampleThickness; +}