Skip to content

Commit

Permalink
added doCalib in presenter, re #12610
Browse files Browse the repository at this point in the history
  • Loading branch information
FedeMPouzols committed Aug 11, 2015
1 parent 22f394b commit 8195237
Show file tree
Hide file tree
Showing 8 changed files with 412 additions and 74 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef MANTIDQTCUSTOMINTERFACES_ENGGDIFFRACTION_ENGGDIFFRACTIONPRESENTER_H_
#define MANTIDQTCUSTOMINTERFACES_ENGGDIFFRACTION_ENGGDIFFRACTIONPRESENTER_H_

#include "MantidAPI/MatrixWorkspace_fwd.h"
#include "MantidKernel/System.h"
#include "MantidQtCustomInterfaces/EnggDiffraction/IEnggDiffractionPresenter.h"
#include "MantidQtCustomInterfaces/EnggDiffraction/IEnggDiffractionView.h"
Expand Down Expand Up @@ -39,8 +40,7 @@ File change history is stored at: <https://github.com/mantidproject/mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
// needs to be dll-exported for the tests
class DLLExport EnggDiffractionPresenter
: public IEnggDiffractionPresenter {
class DLLExport EnggDiffractionPresenter : public IEnggDiffractionPresenter {

public:
/// Default constructor - normally used from the concrete view
Expand All @@ -63,6 +63,37 @@ class DLLExport EnggDiffractionPresenter
void processShutDown();

private:
std::string buildCalibrateSuggestedFilename(const std::string &vanNo,
const std::string &ceriaNo) const;

void doCalib(const EnggDiffCalibSettings &cs, const std::string &vanNo,
const std::string &ceriaNo, const std::string &outFilename);

void parseCalibrateFilename(const std::string &path, std::string &instName,
std::string &vanNo, std::string &ceriaNo);

void loadVanadiumWorkspaces(const std::string &vanNo, const std::string &dir,
Mantid::API::MatrixWorkspace_sptr &vanIntegWS,
Mantid::API::MatrixWorkspace_sptr &vanCurvesWS);

void calcVanadiumWorkspaces(const std::string &vanNo,
Mantid::API::MatrixWorkspace_sptr &vanIntegWS,
Mantid::API::MatrixWorkspace_sptr &vanCurvesWS);

void findPrecalcVanadiumCorrFilenames(const std::string &vanNo,
const std::string &inputDirCalib,
std::string &preIntegFilename,
std::string &preCurvesFilename,
bool &found);

void loadOrCalcanadiumWorkspaces(
const std::string &vanNo, const std::string &inputDirCalib,
Mantid::API::MatrixWorkspace_sptr &vanIntegWS,
Mantid::API::MatrixWorkspace_sptr &vanCurvesWS, bool forceRecalc);

/// string to use for ENGINX file names (as a prefix, etc.)
const static std::string g_enginxStr;

/// Associated view for this presenter (MVP pattern)
IEnggDiffractionView *const m_view;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
<item row="2" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Folder/path:</string>
<string>Path:</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -119,13 +119,19 @@
<property name="text">
<string>241391</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="2" colspan="3">
<widget class="QLineEdit" name="lineEdit_vanadium_num">
<property name="text">
<string>236516</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="1" colspan="4">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ class MANTIDQT_CUSTOMINTERFACES_DLL EnggDiffractionViewQtGUI

void userError(const std::string &err, const std::string &description);

std::vector<std::string> logMsgs() const { return m_logMsgs; }
std::string askNewCalibrationFilename(const std::string &suggestedFname);

std::vector<std::string> logMsgs() const { return m_logMsgs; }

std::string getRBNumber() const;

Expand Down Expand Up @@ -111,8 +113,6 @@ private slots:
void doSetupTabSettings();

std::string guessGSASTemplatePath() const;
std::string buildCalibrateSuggestedFilename(const std::string &vanNo,
const std::string &ceriaNo) const;

/// Load default interface settings for each tab, normally on startup
void readSettings();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,19 @@ class IEnggDiffractionView {
const std::string &description) = 0;

/**
* Gives messages that this View wants to send to the logging
* system.
* Gets a filename from the user, to use for a new calibration file.
*
* @param suggested filename that the user can just accept without
* typing anything
*
* @return filename (can be empty if not given or an error happened)
*/
virtual std::string
askNewCalibrationFilename(const std::string &suggestedFname) = 0;

/**
* Gives one or more messages that this View wants to send to the
* logging system.
*
* @return list of messages to log, one by one.
*/
Expand Down Expand Up @@ -102,10 +113,24 @@ class IEnggDiffractionView {
/**
* The Ceria (CeO2) run number used in the current calibration
*
* @return Vanadium run number, as a string
* @return Ceria run number, as a string
*/
virtual std::string currentCeriaNo() const = 0;

/**
* The Vanadium run number to use for a new calibration
*
* @return Vanadium run number, as a string
*/
virtual std::string newVanadiumNo() const = 0;

/**
* The Ceria (CeO2) run number to use for a new calibration
*
* @return Ceria run number, as a string
*/
virtual std::string newCeriaNo() const = 0;

/**
* The filename (can be full path) selected to write a calibration
*
Expand Down

0 comments on commit 8195237

Please sign in to comment.