Skip to content

Commit

Permalink
Refs #6315. Merging Windows fix.
Browse files Browse the repository at this point in the history
Merge branch 'feature/6936_pv_mantidplot_dialog' into feature/6315_build_pv_398

Conflicts:
	Code/Mantid/Build/CMake/DarwinSetup.cmake
  • Loading branch information
Michael Reuter committed May 1, 2013
2 parents 9d7e352 + 6c73742 commit 4093c4d
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 31 deletions.
6 changes: 3 additions & 3 deletions Code/Mantid/Framework/Kernel/src/ConfigService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1660,14 +1660,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 Down
5 changes: 0 additions & 5 deletions Code/Mantid/Framework/Properties/Mantid.properties.template
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,6 @@ pythonalgorithms.refresh.allowed = 0
# Use forward slash / for all paths
datasearch.directories = @DATADIRS@

# Path to the ParaView bin directory, i.e. the directory containing the paraview executable
# Warning: Mantid is compiled against a specific version of ParaView. Ensure that this path
# points to the ParaView obtained from the Mantid download page
paraview.path = @PARAVIEW_APP_BIN_DIR@

# Whether to look for ParaView (0 = try to use, 1 = don't use).
paraview.ignore = @IGNORE_PARAVIEW@

Expand Down
34 changes: 14 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,21 @@ void ApplicationWindow::trySetParaviewPath(const QStringList& commandArguments)
pv.exec();
}
}
}

#else
UNUSED_ARG(commandArguments)
#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: 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

0 comments on commit 4093c4d

Please sign in to comment.