From 27c52748d211f9b392dcc55b58d5da1641e48a1e Mon Sep 17 00:00:00 2001
From: Elliot Oram <Elliot.Oram@stfc.ac.uk>
Date: Mon, 12 Oct 2015 17:00:38 +0100
Subject: [PATCH] Ensure all properties are set and used correctly

Refs #13826
---
 .../algorithms/WorkflowAlgorithms/QLRun.py    | 26 +++++++++----------
 .../CustomInterfaces/src/Indirect/Quasi.cpp   | 20 +++++++-------
 2 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/QLRun.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/QLRun.py
index c5b1bf94fe0..f39a61fc598 100644
--- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/QLRun.py
+++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/QLRun.py
@@ -1,6 +1,6 @@
 #pylint: disable=no-init
 from mantid.api import PythonAlgorithm, AlgorithmFactory, MatrixWorkspaceProperty, PropertyMode
-from mantid.kernel import StringListValidator, StringMandatoryValidator, Direction
+from mantid.kernel import StringListValidator, Direction
 from mantid.simpleapi import *
 from mantid import config, logger
 import os
@@ -42,26 +42,26 @@ class QLRun(PythonAlgorithm):
         self.declareProperty(name='ResolutionBins', defaultValue=1,
                              doc='The number of resolution bins')
 
-        self.declareProperty(name='Elastic', defaultValue='True', validator=StringMandatoryValidator(),
+        self.declareProperty(name='Elastic', defaultValue=True,
                              doc='Fit option for using the elastic peak')
 
         self.declareProperty(name='Background', defaultValue='Flat',
                              validator=StringListValidator(['Sloping','Flat','Zero']),
                              doc='Fit option for the type of background')
 
-        self.declareProperty(name='FixedWidth', defaultValue='True', validator=StringMandatoryValidator(),
+        self.declareProperty(name='FixedWidth', defaultValue=True,
                              doc='Fit option for using FixedWidth')
 
-        self.declareProperty(name='UseResNorm', defaultValue='False', validator=StringMandatoryValidator(),
+        self.declareProperty(name='UseResNorm', defaultValue=False,
                              doc='fit option for using ResNorm')
 
         self.declareProperty(name='WidthFile', defaultValue='', doc='The name of the fixedWidth file')
 
-        self.declareProperty(name='Loop', defaultValue='True', doc='Switch Sequential fit On/Off')
+        self.declareProperty(name='Loop', defaultValue=True, doc='Switch Sequential fit On/Off')
 
-        self.declareProperty(name='Plot', defaultValue='False', doc='Plot options')
+        self.declareProperty(name='Plot', defaultValue='', doc='Plot options')
 
-        self.declareProperty(name='Save', defaultValue='False', doc='Switch Save result to nxs file Off/On')
+        self.declareProperty(name='Save', defaultValue=False, doc='Switch Save result to nxs file Off/On')
 
     def PyExec(self):
         from IndirectImport import run_f2py_compatibility_test, is_supported_f2py_platform
@@ -78,18 +78,18 @@ class QLRun(PythonAlgorithm):
         program = self.getPropertyValue('Program')
         samWS = self.getPropertyValue('SampleWorkspace')
         resWS = self.getPropertyValue('ResolutionWorkspace')
-        resNormWs = self.getPropertyValue('ResNormWorkspace')
+        resnormWS = self.getPropertyValue('ResNormWorkspace')
         e_min = self.getProperty('MinRange').value
         e_max = self.getProperty('MaxRange').value
         sam_bins = self.getPropertyValue('SampleBins')
         res_bins = self.getPropertyValue('ResolutionBins')
-        elastic = self.getPropertyValue('Elastic')
+        elastic = self.getProperty('Elastic').value
         background = self.getPropertyValue('Background')
-        width = self.getPropertyValue('FixedWidth')
-        res_norm = self.getPropertyValue('UseResNorm')
+        width = self.getProperty('FixedWidth').value
+        res_norm = self.getProperty('UseResNorm').value
         wfile = self.getPropertyValue('WidthFile')
-        Loop = self.getPropertyValue('Loop')
-        Save = self.getPropertyValue('Save')
+        Loop = self.getProperty('Loop').value
+        Save = self.getProperty('Save').value
         Plot = self.getPropertyValue('Plot')
 
         erange = [e_min, e_max]
diff --git a/MantidQt/CustomInterfaces/src/Indirect/Quasi.cpp b/MantidQt/CustomInterfaces/src/Indirect/Quasi.cpp
index 1ff68516133..decb54b22d0 100644
--- a/MantidQt/CustomInterfaces/src/Indirect/Quasi.cpp
+++ b/MantidQt/CustomInterfaces/src/Indirect/Quasi.cpp
@@ -124,14 +124,14 @@ void Quasi::run() {
   // Using 1/0 instead of True/False for compatibility with underlying Fortran
   // code
   // in some places
-  std::string save("False");
-  std::string elasticPeak("False");
-  std::string sequence("False");
+  bool save = false;
+  bool elasticPeak = false;
+  bool sequence = false;
 
-  std::string fixedWidth("False");
+  bool fixedWidth = false;
   std::string fixedWidthFile("");
 
-  std::string useResNorm("False");
+  bool useResNorm = false;
   std::string resNormFile("");
 
   std::string pyInput = "from IndirectBayes import QLRun\n";
@@ -153,19 +153,19 @@ void Quasi::run() {
   std::string background = m_uiForm.cbBackground->currentText().toStdString();
 
   if (m_uiForm.chkElasticPeak->isChecked()) {
-    elasticPeak = "True";
+    elasticPeak = true;
   }
   if (m_uiForm.chkSequentialFit->isChecked()) {
-    sequence = "True";
+    sequence = true;
   }
 
   if (m_uiForm.chkFixWidth->isChecked()) {
-    fixedWidth = "True";
+    fixedWidth = true;
     fixedWidthFile = m_uiForm.mwFixWidthDat->getFirstFilename().toStdString();
   }
 
   if (m_uiForm.chkUseResNorm->isChecked()) {
-    useResNorm = "True";
+    useResNorm = true;
     resNormFile = m_uiForm.dsResNorm->getCurrentDataName().toStdString();
   }
 
@@ -178,7 +178,7 @@ void Quasi::run() {
 
   // Output options
   if (m_uiForm.chkSave->isChecked()) {
-    save = "True";
+    save = true;
   }
   std::string plot = m_uiForm.cbPlot->currentText().toStdString();
 
-- 
GitLab