Skip to content

Commit

Permalink
Merge branch 'master' into feature/10223_new_refl_ui_improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Harry Jeffery committed Sep 19, 2014
2 parents 3eb782b + 03921fe commit 691708b
Show file tree
Hide file tree
Showing 189 changed files with 3,711 additions and 1,906 deletions.
1 change: 1 addition & 0 deletions Code/Mantid/Build/Jenkins/buildscript
Expand Up @@ -13,6 +13,7 @@
# Print out the versions of things we are using
###############################################################################
cmake --version
echo "SHA1=${sha1}"

###############################################################################
# OS X setup steps
Expand Down

This file was deleted.

This file was deleted.

@@ -1,16 +1,17 @@
Name: mantid-developer
Version: 1.3
Release: 8%{?dist}
Version: 1.4
Release: 1%{?dist}
Summary: Meta Package to install dependencies for Mantid Development

Group: Development/Tools
License: GPL

BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

Requires: rpmfusion-nonfree-release
%{?fc20:Requires: rpmfusion-nonfree-release}
Requires: cmake-gui >= 2.8.5
Requires: boost-devel
%{?el6:Requires: epel-release}
Requires: gperftools-devel
Requires: gperftools-libs
Requires: gcc-c++
Expand All @@ -27,11 +28,16 @@ Requires: OCE-devel
Requires: poco-devel
Requires: PyQt4-devel
Requires: python-devel
Requires: python-ipython
Requires: python-ipython >= 1.1
Conflicts: python-ipython >= 2.0
Requires: python-sphinx
Requires: qscintilla-devel
Requires: qt-devel >= 4.6
%if 0%{?el6}
Requires: qwt-devel
%else
Requires: qwt5-qt4-devel
%endif
Requires: qwtplot3d-qt4-devel
Requires: redhat-lsb
Requires: rpmdevtools
Expand All @@ -44,8 +50,14 @@ Requires: texlive-latex-bin
Requires: texlive-was
Requires: tex-preview
Requires: dvipng
%if 0%{?el6}
Requires: mantidlibs-qt-devel
Requires: mantidlibs-qtwebkit-devel
Requires: scl-utils
%else
Requires: qt-devel
Requires: qtwebkit-devel
%endif

BuildArch: noarch

Expand All @@ -68,6 +80,9 @@ required for Mantid development.
%files

%changelog
* Wed Aug 13 2014 Peter Peterson <petersonpf@ornl.gov>
- Merged all three distribution spec files into one

* Fri Apr 25 2014 Michael Reuter <reuterma@ornl.gov>
- Added texlive-latex-bin, texlive-was, tex-preview

Expand Down
31 changes: 29 additions & 2 deletions Code/Mantid/Framework/API/src/NumericAxis.cpp
Expand Up @@ -5,7 +5,13 @@
#include "MantidKernel/Exception.h"
#include "MantidKernel/VectorHelper.h"

#include <boost/lexical_cast.hpp>
#include <boost/format.hpp>

#include "MantidKernel/Logger.h"
namespace
{
Mantid::Kernel::Logger g_log("NumericAxis");
}

namespace Mantid
{
Expand Down Expand Up @@ -157,7 +163,28 @@ bool NumericAxis::operator==(const Axis& axis2) const
*/
std::string NumericAxis::label(const std::size_t& index)const
{
return boost::lexical_cast<std::string>((*this)(index));
std::string numberLabel = boost::str(boost::format("%.13f") % (*this)(index));

// Remove all zeros up to the decimal place or a non zero value
auto it = numberLabel.end() - 1;
for(; it != numberLabel.begin(); --it)
{
if(*it == '0')
{
numberLabel.erase(it);
}
else if(*it == '.')
{
numberLabel.erase(it);
break;
}
else
{
break;
}
}

return numberLabel;
}

/**
Expand Down
10 changes: 8 additions & 2 deletions Code/Mantid/Framework/API/src/ScriptBuilder.cpp
Expand Up @@ -176,10 +176,16 @@ const std::string ScriptBuilder::buildPropertyString(PropertyHistory_const_sptr
{
std::string value = (propHistory->value() == "1" ? "True" : "False");
prop = propHistory->name() + "=" + value;
}
}
else
{
prop = propHistory->name() + "='" + propHistory->value() + "'";
std::string opener = "='";
if (propHistory->value().find('\\') != std::string::npos )
{
opener= "=r'";
}

prop = propHistory->name() + opener + propHistory->value() + "'";
}
}

Expand Down
36 changes: 36 additions & 0 deletions Code/Mantid/Framework/API/test/ScriptBuilderTest.h
Expand Up @@ -305,6 +305,42 @@ class ScriptBuilderTest : public CxxTest::TestSuite
AnalysisDataService::Instance().remove("test_input_workspace");
}


void test_Build_Simple_with_backslash()
{
//checks that property values with \ get prefixed with r, eg. filename=r'c:\test\data.txt'
std::string result[] = {
"TopLevelAlgorithm(InputWorkspace=r'test_inp\\ut_workspace', OutputWorkspace='test_output_workspace')",
""
};
boost::shared_ptr<WorkspaceTester> input(new WorkspaceTester());
AnalysisDataService::Instance().addOrReplace("test_inp\\ut_workspace", input);

auto alg = AlgorithmFactory::Instance().create("TopLevelAlgorithm", 1);
alg->initialize();
alg->setRethrows(true);
alg->setProperty("InputWorkspace", input);
alg->setPropertyValue("OutputWorkspace", "test_output_workspace");
alg->execute();

auto ws = AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>("test_output_workspace");
auto wsHist = ws->getHistory();

ScriptBuilder builder(wsHist.createView());
std::string scriptText = builder.build();

std::vector<std::string> scriptLines;
boost::split(scriptLines, scriptText, boost::is_any_of("\n"));

int i=0;
for (auto it = scriptLines.begin(); it != scriptLines.end(); ++it, ++i)
{
TS_ASSERT_EQUALS(*it, result[i])
}

AnalysisDataService::Instance().remove("test_output_workspace");
AnalysisDataService::Instance().remove("test_inp\\ut_workspace");
}

};

Expand Down

0 comments on commit 691708b

Please sign in to comment.