Skip to content

Commit

Permalink
Refs #6315. Merging the Paraview work.
Browse files Browse the repository at this point in the history
Merge branch 'feature/6315_build_pv_398'

Conflicts:
	Code/Mantid/CMakeLists.txt
  • Loading branch information
Michael Reuter committed May 3, 2013
2 parents 82a9074 + 7c56eb0 commit f07a924
Show file tree
Hide file tree
Showing 133 changed files with 3,970 additions and 1,206 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,5 @@ Desktop.ini

# Mac OS X Finder
.DS_Store

Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/inc/MantidVatesSimpleGuiViewWidgets/LibHelper.h
1 change: 0 additions & 1 deletion Code/Mantid/Build/CMake/CommonSetup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ set ( CMAKE_INCLUDE_PATH ${MAIN_CMAKE_INCLUDE_PATH} )
set ( MtdVersion_WC_LAST_CHANGED_REV 0 )
set ( MtdVersion_WC_LAST_CHANGED_DATE Unknown )
set ( NOT_GIT_REPO "Not" )
set ( Compatible_ParaView_Version "3.10" )

find_package ( Git )
if ( GIT_FOUND )
Expand Down
3 changes: 2 additions & 1 deletion Code/Mantid/Build/CMake/DarwinSetup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ endif()
set ( CMAKE_INSTALL_PREFIX /Applications )
set ( INBUNDLE MantidPlot.app/ )
# We know exactly where this has to be on Darwin
set ( PARAVIEW_APP_DIR "/Applications/ParaView 3.10.1.app" )
set ( PARAVIEW_APP_DIR "/Applications/${OSX_PARAVIEW_APP}" )
set ( PARAVIEW_APP_BIN_DIR "${PARAVIEW_APP_DIR}/Contents/MacOS" )
set ( PARAVIEW_APP_LIB_DIR "${PARAVIEW_APP_DIR}/Contents/Libraries" )
set ( PARAVIEW_APP_PLUGIN_DIR "${PARAVIEW_APP_DIR}/Contents/Plugins" )

set ( BIN_DIR MantidPlot.app/Contents/MacOS )
set ( LIB_DIR MantidPlot.app/Contents/MacOS )
Expand Down
7 changes: 7 additions & 0 deletions Code/Mantid/Build/CMake/ParaViewSetup.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This file will setup some common items that later setups depend on

# Set the version of ParaView that is compatible with the Mantid code base
set ( COMPATIBLE_PARAVIEW_VERSION "3.98.1" )

# Set the name of the OSX application as this tends to be different
set ( OSX_PARAVIEW_APP "paraview.app" )
5 changes: 5 additions & 0 deletions Code/Mantid/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ set ( CPACK_PACKAGE_NAME "mantid${CPACK_PACKAGE_SUFFIX}" )
###########################################################################
find_package ( Qt4 COMPONENTS QtCore QtGui QtOpenGL QtXml QtSvg Qt3Support REQUIRED )

###########################################################################
# Set ParaView information since later items depend on it
###########################################################################
include ( ParaViewSetup )

###########################################################################
# Set paths to Third_Party for Windows builds
###########################################################################
Expand Down
15 changes: 9 additions & 6 deletions Code/Mantid/Framework/Kernel/src/ConfigService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1664,14 +1664,14 @@ void ConfigServiceImpl::setParaviewLibraryPath(const std::string& path)
if(Poco::Environment::has(platformPathName))
{
existingPath = Poco::Environment::get(platformPathName);
existingPath.append(strSeparator);
existingPath.append(path);
existingPath.append(strSeparator + path);
}
else
{
existingPath = path;
}
Poco::Environment::set(platformPathName, existingPath.toString());
const std::string newPath = existingPath.toString();
Poco::Environment::set(platformPathName, newPath);
#elif defined __linux__
UNUSED_ARG(path)
throw std::runtime_error("Cannot dynamically set the library path on Linux");
Expand All @@ -1695,7 +1695,7 @@ const std::string extractVersionNumberFromPipe(const Poco::Pipe& pipe)
Poco::StreamCopier::copyStream(pipeStream, stringStream);
const std::string givenVersion = stringStream.str();
boost::smatch match;
boost::regex expression("(\\d+)\\.(\\d+)$"); // Gets the version number part.
boost::regex expression("(\\d+)\\.(\\d+)\\.?(\\d*)$"); // Gets the version number part.
if(boost::regex_search(givenVersion, match, expression))
{
versionString = match[0];
Expand Down Expand Up @@ -1760,13 +1760,16 @@ bool ConfigServiceImpl::quickParaViewCheck() const
}
else
{
this->g_log.notice("ParaView is not available");
std::stringstream messageStream;
messageStream << "ParaView version query failed with code: " << rc;
this->g_log.notice(messageStream.str());
this->g_log.notice("ParaView is not available, query failed.");
}
}
catch(Poco::SystemException &e)
{
g_log.debug(e.what());
this->g_log.notice("ParaView is not available");
this->g_log.notice("ParaView is not available, Poco::SystemException");
}
return isAvailable;
}
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/Kernel/src/ParaViewVersion.cpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Kernel

std::string ParaViewVersion::targetVersion()
{
return "@Compatible_ParaView_Version@";
return "@COMPATIBLE_PARAVIEW_VERSION@";
}

} // namespace Kernel
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/MDAlgorithms/src/LoadMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ namespace Mantid
}
else
{
g_log.notice("Do not know how to process coordinate transform " + type);
g_log.information("Do not know how to process coordinate transform " + type);
}
return transform;
}
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Installers/MacInstaller/Info.plist.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<key>LSEnvironment</key>
<dict>
<key>DYLD_LIBRARY_PATH</key>
<string>@PARAVIEW_APP_LIB_DIR@</string>
<string>@PARAVIEW_APP_LIB_DIR@:@PARAVIEW_APP_PLUGIN_DIR@</string>
</dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
Expand Down
5 changes: 5 additions & 0 deletions Code/Mantid/MantidPlot/FixBundle.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ function(gp_resolved_file_type_override resolved_file type_var)
message(STATUS "resolving ${file} as system")
set(${type_var} system PARENT_SCOPE)
endif()
# Copy Qt dependencies to bundle
if(file MATCHES "libQt")
message("resolving ${file} as embedded")
set(${type_var} embedded PARENT_SCOPE)
endif()
# Don't copy ParaView into the bundle
if(resolved_file MATCHES "^@ParaView_DIR@")
message(STATUS "resolving ParaView dependency ${file} as system")
Expand Down
35 changes: 15 additions & 20 deletions Code/Mantid/MantidPlot/src/ApplicationWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@
#include <QUndoView>
#include <QSignalMapper>
#include <QDesktopWidget>

#include <zlib.h>

#include <gsl/gsl_sort.h>
Expand Down Expand Up @@ -290,6 +289,7 @@ void ApplicationWindow::init(bool factorySettings, const QStringList& args)
// Set the Paraview path BEFORE libaries are loaded. Doing it here prevents
// the logs being poluted with library loading errors.
trySetParaviewPath(args);

using Mantid::Kernel::ConfigService;
ConfigService::Instance(); // Starts logging
resultsLog->attachLoggingChannel(); // Must be done after logging starts
Expand Down Expand Up @@ -476,6 +476,12 @@ void ApplicationWindow::init(bool factorySettings, const QStringList& args)
AlgorithmFactory::Instance().enableNotifications();
AlgorithmFactory::Instance().notificationCenter.postNotification(new AlgorithmFactoryUpdateNotification);

/*
The scripting enironment call setScriptingLanguage is trampling over the PATH, so we have to set it again.
Here we do not off the setup dialog.
*/
const bool skipDialog = true;
trySetParaviewPath(args, skipDialog);
}

/*
Expand All @@ -488,16 +494,16 @@ This is a windows only feature. the PATH enviromental variable can be set at run
- Otherwise, if the user is not using executeandquit command arguments launch the Setup gui.

@param commandArguments : all command line arguments.
@param noDialog : set to true to skip over the a dialog launch.
*/
void ApplicationWindow::trySetParaviewPath(const QStringList& commandArguments)
void ApplicationWindow::trySetParaviewPath(const QStringList& commandArguments, bool noDialog)
{
#ifdef _WIN32
if(this->hasVatesAvailable())//TODO: This condition is redundant since Vates will be shipped by default.
{

Mantid::Kernel::ConfigServiceImpl& confService = Mantid::Kernel::ConfigService::Instance();
//Early check of execute and quit command arguments used by system tests.
QString str;
bool b_skipDialog = false;
bool b_skipDialog = noDialog;
foreach(str, commandArguments)
{
if(this->shouldExecuteAndQuit(str))
Expand Down Expand Up @@ -531,33 +537,22 @@ void ApplicationWindow::trySetParaviewPath(const QStringList& commandArguments)
pv.exec();
}
}
}

#else
UNUSED_ARG(commandArguments)
UNUSED_ARG(noDialog)
#endif
}


/*
Getter to determine if the vates paraview plugins are available.

The code below may be used before MantidUI::init is called and therefore the implementation
must not rely on the Vates Libraries to be loaded in order to determine whether Vates is available.

@return TRUE if vates is available
*/
bool ApplicationWindow::hasVatesAvailable() const
{
return Mantid::Kernel::ConfigService::Instance().quickVatesCheck();
}

/*
Getter to determine if the paraview path has been set.
*/
bool ApplicationWindow::hasParaviewPath() const
{
const std::string propertyname = "paraview.path";
Mantid::Kernel::ConfigServiceImpl& config = Mantid::Kernel::ConfigService::Instance();
return config.hasProperty("paraview.path");
return config.hasProperty(propertyname) && !config.getString(propertyname).empty() ;
}

void ApplicationWindow::initWindow()
Expand Down
3 changes: 1 addition & 2 deletions Code/Mantid/MantidPlot/src/ApplicationWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -1094,9 +1094,8 @@ public slots:
QPoint positionNewFloatingWindow(QSize sz) const;
QPoint desktopTopLeft() const;
bool hasParaviewPath() const;
bool hasVatesAvailable() const;
bool shouldExecuteAndQuit(const QString& arg);
void trySetParaviewPath(const QStringList& commandArguments);
void trySetParaviewPath(const QStringList& commandArguments, bool noDialog=false);

private slots:
//! \name Initialization
Expand Down
2 changes: 2 additions & 0 deletions Code/Mantid/MantidPlot/src/Mantid/MantidUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,8 @@ void MantidUI::showVatesSimpleInterface()
MantidQt::API::VatesViewerInterface *vsui = interfaceManager.createVatesSimpleGui();
if (vsui)
{
connect(m_appWindow, SIGNAL(shutting_down()),
vsui, SLOT(shutdown()));
vsui->setParent(m_vatesSubWindow);
m_vatesSubWindow->setWindowTitle("Vates Simple Interface");
vsui->setupPluginMode();
Expand Down
14 changes: 12 additions & 2 deletions Code/Mantid/MantidPlot/src/Mantid/SetUpParaview.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "SetUpParaview.h"
#include "MantidKernel/ConfigService.h"
#include "MantidKernel/ParaViewVersion.h"
#include "MantidQtAPI/ManageUserDirectories.h"
#include "MantidKernel/ConfigService.h"
#include <boost/regex.hpp>
Expand Down Expand Up @@ -32,7 +33,7 @@ bool isParaviewHere(const QString& location)
{
it.next();
QString file =it.fileName();
regex expression("^(pqcore)", boost::regex::icase);
regex expression("^(paraview.exe)", boost::regex::icase);
if(regex_search(file.toStdString(), expression) && it.fileInfo().isFile())
{
found = true;
Expand All @@ -50,11 +51,20 @@ SetUpParaview::SetUpParaview(StartUpFrom from, QWidget *parent) : QDialog(parent

initLayout();

QString versionRevision = QString::fromStdString(Mantid::Kernel::ParaViewVersion::targetVersion());
if (!versionRevision.contains("3.98"))
{
// For ParaView 3.10, minor version number is not available
versionRevision.append(".1");
}
const QString predictedLocation = QString("C:/Program Files (x86)/ParaView %1/bin").arg(versionRevision);
const QString hintText = QString("Hint: the usual install location for ParaView is: %1").arg(predictedLocation);
m_uiForm.lblHint->setText(hintText);

m_candidateLocation = QString(ConfigService::Instance().getString("paraview.path").c_str());
//Do our best to figure out the location based on where paraview normally sits.
if(m_candidateLocation.isEmpty())
{
const QString predictedLocation = "C:/Program Files (x86)/ParaView 3.10.1/bin";
if(isParaviewHere(predictedLocation))
{
acceptPotentialLocation(predictedLocation);
Expand Down
20 changes: 9 additions & 11 deletions Code/Mantid/MantidPlot/src/Mantid/SetUpParaview.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>665</width>
<width>659</width>
<height>465</height>
</rect>
</property>
Expand Down Expand Up @@ -58,16 +58,7 @@
<item>
<widget class="QLabel" name="lbl_instructions">
<property name="text">
<string>&lt;h2&gt;Your Mantid installation is nearly ready to use with 3D visualisation&lt;/h2&gt;
&lt;h3&gt;Not interested?&lt;/h3&gt;
&lt;p&gt;&lt;b&gt;If you don't want 3D visualisation at the present time, you may click KEEP IGNORING&lt;/b&gt;.You can enable it later via the help menu.&lt;/p&gt;
&lt;h3&gt;Interested?&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt; Prerequisite: You must install ParaView from &lt;a
href=&quot;http://download.mantidproject.org/VatesDownload.psp&quot;&gt;here&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;The install location of ParaView must be set in Mantid ...&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Hint: the usual install location for ParaView is: &lt;i&gt;C:/Program Files (x86)/ParaView 3.10.1/bin&lt;/i&gt;&lt;/p&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:x-large; font-weight:600;&quot;&gt;Your Mantid installation is nearly ready to use with 3D visualisation&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-size:large; font-weight:600;&quot;&gt;Not interested?&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;If you don't want 3D visualisation at the present time, you may click KEEP IGNORING&lt;/span&gt;.You can enable it later via the help menu.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-size:large; font-weight:600;&quot;&gt;Interested?&lt;/span&gt;&lt;/p&gt;&lt;ol style=&quot;margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;&quot;&gt;&lt;li style=&quot; margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Prerequisite: You must install ParaView from &lt;a href=&quot;http://download.mantidproject.org/VatesDownload.psp&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;here&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;li style=&quot; margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;The install location of ParaView must be set in Mantid ...&lt;/li&gt;&lt;/ol&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
Expand All @@ -77,6 +68,13 @@ href=&quot;http://download.mantidproject.org/VatesDownload.psp&quot;&gt;here&lt;
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblHint">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="layoutChoose">
<item>
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/MantidPlot/src/PythonScripting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ bool PythonScripting::start()

//Get the refresh protection flag
configSvc.getValue("pythonalgorithms.refresh.allowed", refresh_allowed);
if( loadInitFile(mantidbin.absoluteFilePath("mantidplotrc.py")) )
if( loadInitFile(mantidbin.absoluteFilePath("mantidplotrc.py")) )
{
d_initialized = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ class EXPORT_OPT_MANTIDQT_API VatesViewerInterface : public QWidget

/// Enum to track the workspace type
enum WorkspaceType { MDEW, PEAKS, MDHW };

public slots:
/// Perform any clean up on main window shutdown
virtual void shutdown();
};

}
Expand Down
4 changes: 4 additions & 0 deletions Code/Mantid/MantidQt/API/src/VatesViewerInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ void VatesViewerInterface::renderWorkspace(QString wsname, int wstype)
UNUSED_ARG(wsname);
UNUSED_ARG(wstype);
}

void VatesViewerInterface::shutdown()
{
}
7 changes: 2 additions & 5 deletions Code/Mantid/Vates/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Define the project name
project( Vates )



###########################################################################
# Add OpenMP flags here . TODO: Is this the right spot?
###########################################################################
Expand All @@ -12,7 +10,6 @@ if ( OPENMP_FOUND )
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}" )
endif ()


include( CommonVatesSetup )

# Select either building Paraview plugins
Expand All @@ -21,8 +18,8 @@ set( USE_PARAVIEW ON CACHE BOOL "Create paraview plugins. " )
# Paraview dependencies built if Paraview is found
find_package( ParaView )
if( ParaView_FOUND AND USE_PARAVIEW )

include ( ${PARAVIEW_USE_FILE} )
message( STATUS "Using ParaView ${PARAVIEW_VERSION_FULL}" )
include( ${PARAVIEW_USE_FILE} )
add_subdirectory( VatesAPI )
add_subdirectory( ParaviewPlugins )
add_subdirectory( VatesSimpleGui )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
Available timestep values.
</Documentation>
</DoubleVectorProperty>
<StringVectorProperty
name="TimeLabelAnnotation"
information_only="1"
si_class="vtkSITimeLabelProperty">
</StringVectorProperty>
<IntVectorProperty
name="OutputHistoWorkspace"
command="SetOutputHistogramWS"
Expand Down

0 comments on commit f07a924

Please sign in to comment.