Skip to content

Commit

Permalink
refs #5103. New ignore pv property.
Browse files Browse the repository at this point in the history
Make it possible to ignore Paraview dependent components completely ad continously if required.
  • Loading branch information
OwenArnold committed Apr 17, 2012
1 parent 7c3c1b1 commit 48464bc
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 17 deletions.
7 changes: 4 additions & 3 deletions Code/Mantid/Framework/API/src/FrameworkManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,17 @@ FrameworkManagerImpl::FrameworkManagerImpl() : g_log(Kernel::Logger::get("Framew
_set_output_format(_TWO_DIGIT_EXPONENT);
#endif

Kernel::ConfigServiceImpl& config = Kernel::ConfigService::Instance();
// Load plugin libraries if possible
std::string pluginDir = Kernel::ConfigService::Instance().getString("plugins.directory");
std::string pluginDir = config.getString("plugins.directory");
if (pluginDir.length() > 0)
{
Mantid::Kernel::LibraryManager::Instance().OpenAllLibraries(pluginDir, false);
}
// Load Paraview plugin libraries if possible
if(Kernel::ConfigService::Instance().quickParaViewCheck())
if(config.quickParaViewCheck())
{
const std::string pvPluginDir = Kernel::ConfigService::Instance().getString("pvplugins.directory");
const std::string pvPluginDir = config.getString("pvplugins.directory");
if (pvPluginDir.length() > 0)
{
this->g_log.information("Loading PV plugin libraries");
Expand Down
12 changes: 11 additions & 1 deletion Code/Mantid/Framework/Kernel/src/ConfigService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1730,12 +1730,22 @@ void ConfigServiceImpl::setParaviewLibraryPath(const std::string& path)
}

/*
Quick check to determine if paraview is installed. We make the assumption
Checks to see whether paraview usage is explicitly ignored in the property file then,
quick check to determine if paraview is installed. We make the assumption
that if the executable paraview binary is on the path that the paraview libraries
will also be available on the library path, or equivalent.
@return True if paraview is available or not disabled.
*/
bool ConfigServiceImpl::quickParaViewCheck() const
{
const std::string paraviewIgnoreProperty = "paraview.ignore";
const bool ignoreParaview = hasProperty(paraviewIgnoreProperty) && atoi(getString(paraviewIgnoreProperty).c_str());
if(ignoreParaview)
{
this->g_log.information("Ignoring ParaView");
return false;
}

this->g_log.information("Checking for ParaView");
bool isAvailable = false;

Expand Down
8 changes: 6 additions & 2 deletions Code/Mantid/MantidPlot/src/ApplicationWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -499,8 +499,9 @@ This is a windows only feature. the PATH enviromental variable can be set at run
void ApplicationWindow::trySetParaviewPath(const QStringList& commandArguments)
{
#ifdef _WIN32
if(this->hasVatesAvailable())
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;
Expand All @@ -513,10 +514,13 @@ void ApplicationWindow::trySetParaviewPath(const QStringList& commandArguments)
}
}

//If the ignore property exists and is set to true, then skip the dialog.
const std::string paraviewIgnoreProperty = "paraview.ignore";
b_skipDialog = confService.hasProperty(paraviewIgnoreProperty) && QString(confService.getString(paraviewIgnoreProperty).c_str()).toInt() == true;

if(this->hasParaviewPath())
{
//Already have a path in the properties file, just apply it.
Mantid::Kernel::ConfigServiceImpl& confService = Mantid::Kernel::ConfigService::Instance();
std::string path = confService.getString("paraview.path");
confService.setParaviewLibraryPath(path);
}
Expand Down
21 changes: 11 additions & 10 deletions Code/Mantid/MantidPlot/src/Mantid/SetUpParaview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void SetUpParaview::initLayout()
connect(m_uiForm.btn_set, SIGNAL(clicked()), this, SLOT(onSet()));
connect(m_uiForm.btn_cancel, SIGNAL(clicked()), this, SLOT(reject()));
connect(m_uiForm.btn_help, SIGNAL(clicked()), this, SLOT(onHelp()));

connect(m_uiForm.btn_ignore_paraview, SIGNAL(clicked()), this, SLOT(onIgnoreHenceforth()));
}

///On help requested.
Expand All @@ -56,21 +56,22 @@ void SetUpParaview::onHelp()
void SetUpParaview::onSet()
{
ConfigServiceImpl& config = ConfigService::Instance();

std::cout << "getting location" << m_candidateLocation.toStdString() << std::endl;
config.setParaviewLibraryPath(m_candidateLocation.toStdString());

std::cout << "getting paraview path" << std::endl;
config.setString("paraview.path", m_candidateLocation.toStdString());

std::cout << "getting file name" << std::endl;
std::string filename = config.getUserFilename();
//Save the result so that on the next start up we don't have to bother the user.

std::cout << "saving" << std::endl;
config.saveConfig(filename);
this->close();
}

std::cout << "closing" << std::endl;
/// Event handler for the ignore paraview henceforth event.
void SetUpParaview::onIgnoreHenceforth()
{
ConfigServiceImpl& config = ConfigService::Instance();
config.setString("paraview.ignore", QString::number(true).toStdString());
std::string filename = config.getUserFilename();
//Save the result so that on the next start up we don't have to bother the user.
config.saveConfig(filename);
this->close();
}

Expand Down
1 change: 1 addition & 0 deletions Code/Mantid/MantidPlot/src/Mantid/SetUpParaview.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ private slots:
void onChoose();
void onSet();
void onHelp();
void onIgnoreHenceforth();
private:
Ui::SetUpParaview m_uiForm;
QString m_candidateLocation;
Expand Down
11 changes: 10 additions & 1 deletion Code/Mantid/MantidPlot/src/Mantid/SetUpParaview.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>559</width>
<height>279</height>
<height>287</height>
</rect>
</property>
<property name="sizePolicy">
Expand Down Expand Up @@ -137,6 +137,13 @@ This dialog will allow you to complete the second stage.</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btn_ignore_paraview">
<property name="text">
<string>KEEP IGNORING</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btn_set">
<property name="text">
Expand All @@ -154,6 +161,8 @@ This dialog will allow you to complete the second stage.</string>
<include location="../../../Images/images.qrc"/>
<include location="../../../Images/images.qrc"/>
<include location="../../../Images/images.qrc"/>
<include location="../../../Images/images.qrc"/>
<include location="../../../Images/images.qrc"/>
</resources>
<connections/>
</ui>

0 comments on commit 48464bc

Please sign in to comment.