Commit 70d2cc97 authored by whitlocb's avatar whitlocb
Browse files

I changed the Expression window so it appends expression from a file to the...

I changed the Expression window so it appends expression from a file to the expression list instead of replacing the list.



git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@14756 18c085ea-50e0-402c-830e-de6fd14e8384
parent edfb9b52
......@@ -40,11 +40,13 @@
#include <Expression.h>
#include <ExpressionList.h>
#include <SingleAttributeConfigManager.h>
#include <ViewerProxy.h>
#include <QApplication>
#include <QCheckBox>
#include <QComboBox>
#include <QFileDialog>
#include <QGroupBox>
#include <QLabel>
#include <QLayout>
......@@ -2050,3 +2052,66 @@ QvisExpressionsWindow::newExpression()
nameEdit->setCursorPosition(0);
nameEdit->selectAll();
}
// ****************************************************************************
// Method: QvisExpressionsWindow::loadSubject
//
// Purpose:
// This is a Qt slot function that gets called when the window's Load button
// is clicked.
//
// Arguments:
//
// Returns:
//
// Note: We append the expressions from the file to the list instead of
// replacing the ones in the list.
//
// Programmer: Brad Whitlock
// Creation: Fri May 6 14:40:40 PDT 2011
//
// Modifications:
//
// ****************************************************************************
void
QvisExpressionsWindow::loadSubject()
{
if (!subject)
return;
QString filename = QFileDialog::getOpenFileName(this,
tr("Open Attribute XML"),
NULL,
tr("XML Files (*.xml);;"
"All files (*)"));
if (filename.isNull())
return;
ExpressionList newExpressions;
SingleAttributeConfigManager mgr(&newExpressions);
mgr.Import(filename.toStdString());
// Let's append the expressions from the new list to the existing list and
// check for duplicates.
bool foundDuplicates = false;
for(int i = 0; i < newExpressions.GetNumExpressions(); ++i)
{
// Check for dups
Expression *e = exprList->operator[](newExpressions[i].GetName().c_str());
foundDuplicates |= (e != NULL);
// Append the new expression.
exprList->AddExpressions(newExpressions[i]);
}
Apply();
if(foundDuplicates)
{
Message(tr("The expressions loaded from %1 contained expressions "
"having the same names as expressions already in the "
"expression list. You may want to edit some of your "
"expression names so they are unique.").arg(filename));
}
}
......@@ -85,6 +85,9 @@ class QvisPythonFilterEditor;
// Cyrus Harrison, Wed Jun 11 13:49:19 PDT 2008
// Initial Qt4 Port.
//
// Brad Whitlock, Fri May 6 14:42:31 PDT 2011
// I added an override for loadSubject.
//
// ****************************************************************************
class GUI_API QvisExpressionsWindow : public QvisPostableWindowObserver
......@@ -100,6 +103,7 @@ class GUI_API QvisExpressionsWindow : public QvisPostableWindowObserver
virtual void CreateWindowContents();
public slots:
virtual void apply();
virtual void loadSubject();
void newExpression();
protected:
void UpdateWindow(bool doAll);
......
......@@ -32,7 +32,7 @@ enhancements and bug-fixes that were added to this release.</p>
<a name="General_Features"></a>
<p><b><font size="4">General features added in version 2.3</font></b></p>
<ul>
<li></li>
<li>The <b>Expression</b> window's <b>Load</b> button now causes expressions from XML files to be appended to the expression list instead of replacing the expressions in the list.</li>
</ul>
<a name="Advanced_Features"></a>
......@@ -114,6 +114,6 @@ enhancements and bug-fixes that were added to this release.</p>
</ul>
<p>Click the following link to view the release notes for the previous version
of VisIt: <a href="relnotes2.2.0.html">VisIt 2.2.0 Release Notes</a>.</p>
of VisIt: <a href="relnotes2.2.2.html">VisIt 2.2.2 Release Notes</a>.</p>
</body>
</html>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment