Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/bugfix/10533_threeSlice_issue_va…
Browse files Browse the repository at this point in the history
…tes'
  • Loading branch information
martyngigg committed Nov 24, 2014
2 parents dceb451 + a2f7d8d commit c8462bd
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 3 deletions.
3 changes: 3 additions & 0 deletions Code/Mantid/Framework/Kernel/inc/MantidKernel/ConfigService.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,9 @@ namespace Mantid
/// Quick check to determine if vates has been installed.
bool quickVatesCheck() const;

/// Get the ParaViewPath
const std::string getParaViewPath() const;

private:
friend struct Mantid::Kernel::CreateUsingNew<ConfigServiceImpl>;
/// Handles distribution of Poco signals.
Expand Down
9 changes: 9 additions & 0 deletions Code/Mantid/Framework/Kernel/src/ConfigService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2157,6 +2157,15 @@ bool ConfigServiceImpl::quickVatesCheck() const
return found;
}

/**
* Gets the path to ParaView.
* @returns The ParaView path.
*/
const std::string ConfigServiceImpl::getParaViewPath() const
{
return getString("paraview.path");
}

/// \cond TEMPLATE
template DLLExport int ConfigServiceImpl::getValue(const std::string&, double&);
template DLLExport int ConfigServiceImpl::getValue(const std::string&, std::string&);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

#include "MantidQtAPI/InterfaceManager.h"
#include "MantidKernel/DynamicFactory.h"
#include "MantidKernel/Logger.h"
#include "MantidKernel/ConfigService.h"

// Have to deal with ParaView warnings and Intel compiler the hard way.
#if defined(__INTEL_COMPILER)
Expand Down Expand Up @@ -84,6 +86,8 @@
#include <QWidget>

#include <iostream>
#include <vector>
#include <string>

namespace Mantid
{
Expand All @@ -94,6 +98,12 @@ namespace SimpleGui
using namespace Mantid::API;
using namespace MantidQt::API;

namespace
{
/// Static logger
Kernel::Logger g_log("MdViewerWidget");
}

REGISTER_VATESGUI(MdViewerWidget)

/**
Expand Down Expand Up @@ -241,8 +251,17 @@ void MdViewerWidget::createAppCoreForPlugin()
{
if (!pqApplicationCore::instance())
{
// Provide ParaView's application core with a path to ParaView
int argc = 1;
char *argv[] = {"/tmp/MantidPlot"};

std::string paraviewPath = Mantid::Kernel::ConfigService::Instance().getParaViewPath();
std::vector<char> argvConversion(paraviewPath.begin(), paraviewPath.end());
argvConversion.push_back('\0');

char *argv[] = {&argvConversion[0]};

g_log.debug() << "Intialize pqApplicationCore with " << argv << "\n";

new pqPVApplicationCore(argc, argv);
}
else
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#include "MantidVatesSimpleGuiViewWidgets/ThreesliceView.h"
#include "MantidVatesSimpleGuiViewWidgets/LibHelper.h"
#include "MantidKernel/ConfigService.h"
#include "MantidKernel/Logger.h"
#include <Poco/Path.h>

#if defined(__INTEL_COMPILER)
#pragma warning disable 1170
Expand All @@ -23,23 +26,38 @@
#include <QMessageBox>

#include <iostream>
#include <string>

namespace Mantid
{
namespace Vates
{
namespace SimpleGui
{

namespace
{
/// Static logger
Kernel::Logger g_log("ThreeSliceView");
}
ThreeSliceView::ThreeSliceView(QWidget *parent) : ViewBase(parent)
{
this->ui.setupUi(this);

// We need to load the QuadView.dll plugin. The Windows system requires the full
// path information. The DLL is located in the apropriate executeable path of paraview.
const Poco::Path paraviewPath(Mantid::Kernel::ConfigService::Instance().getParaViewPath());

Poco::Path quadViewFullPath(paraviewPath, QUADVIEW_LIBRARY.toStdString());

QString quadViewLibrary(quadViewFullPath.toString().c_str());

// Need to load plugin
pqPluginManager* pm = pqApplicationCore::instance()->getPluginManager();
QString error;
pm->loadExtension(pqActiveObjects::instance().activeServer(),
QUADVIEW_LIBRARY, &error, false);
quadViewLibrary, &error, false);

g_log.debug() << "Loading QuadView.dll from " << quadViewLibrary.toStdString() << "\n";

this->mainView = this->createRenderView(this->ui.mainRenderFrame,
QString("pqQuadView"));
Expand Down

0 comments on commit c8462bd

Please sign in to comment.