Commit 9a73770c authored by cyrush's avatar cyrush
Browse files

merge from 2.1RC

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@12561 18c085ea-50e0-402c-830e-de6fd14e8384
parent 11920fd1
......@@ -295,6 +295,9 @@ avtQueryFactory::Instance()
// Eric Brugger, Wed Jun 30 14:03:06 PDT 2010
// Added the xray image query.
//
// Cyrus Harrison, Tue Sep 21 11:12:17 PDT 2010
// Added explicit passing of args to the python filter query.
//
// ****************************************************************************
avtDataObjectQuery *
......@@ -678,12 +681,13 @@ avtQueryFactory::CreateQuery(const QueryAttributes *qa)
int nargs = args.size();
stringVector vars;
for(int i= 0; i < nargs -1;i++)
for(int i= 0; i < nargs -2;i++)
vars.push_back(args[i]);
// set variable names
py_query->SetVariableNames(vars);
// python script is passed in as the last variable
py_query->SetPythonArgs(args[nargs-2]);
py_query->SetPythonScript(args[nargs-1]);
query = py_query;
#else
......
......@@ -83,7 +83,7 @@ using std::string;
// ****************************************************************************
avtPythonQuery::avtPythonQuery()
: avtDataObjectQuery(), avtDatasetSink(), pyEnv(NULL)
: avtDataObjectQuery(), avtDatasetSink(), pyEnv(NULL), pyScript(""),pyArgs("")
{
pyEnv = new avtPythonFilterEnvironment();
}
......@@ -208,6 +208,27 @@ avtPythonQuery::SetPythonScript(const std::string &py_script)
pyScript = py_script;
}
// ****************************************************************************
// Method: avtPythonQuery::SetPythonArgs
//
// Purpose:
// Sets the python args scring used to setup the python query. This string
// should contain a pickled list.
//
// Programmer: Cyrus Harrison
// Creation: September 21, 2010
//
// Modifications:
//
// ****************************************************************************
void
avtPythonQuery::SetPythonArgs(const std::string &py_args)
{
pyArgs = py_args;
}
// ****************************************************************************
// Method: avtPythonQuery::PerformQuery
//
......@@ -319,6 +340,8 @@ avtPythonQuery::GetSecondaryVariables(std::vector<std::string> &res)
// Creation: Wed Feb 17 09:30:46 PST 2010
//
// Modifications:
// Cyrus Harrison, Tue Sep 21 11:29:47 PDT 2010
// Unpickle passed args from pyArgs member.
//
// ****************************************************************************
......@@ -411,10 +434,9 @@ avtPythonQuery::UpdateContract()
}
// get any other args
std::string args_str = varNames[varNames.size()-1];
if(args_str != "")
if(pyArgs != "")
{
PyObject *py_args = pyEnv->Unpickle(args_str);
PyObject *py_args = pyEnv->Unpickle(pyArgs);
if(!pyEnv->Filter()->SetAttribute("arguments",py_args))
PYQUERY_ERROR("avtPythonQuery::UpdateContract Error - "
"Unable to set Python Query 'arguments' attribute.");
......
......@@ -63,6 +63,8 @@ class avtPythonFilterEnvironment;
// Creation: Tue Feb 9 15:15:41 PST 2010
//
// Modifications:
// Cyrus Harrison, Tue Sep 21 11:14:21 PDT 2010
// Added SetPythonArgs()
//
// ****************************************************************************
......@@ -75,6 +77,7 @@ class QUERY_API avtPythonQuery : public avtDataObjectQuery,
void CleanUp();
void SetPythonScript(const std::string &py_script);
void SetPythonArgs(const std::string &py_args);
virtual const char *GetType(void);
virtual const char *GetDescription(void);
......@@ -107,6 +110,7 @@ class QUERY_API avtPythonQuery : public avtDataObjectQuery,
avtPythonFilterEnvironment *pyEnv;
std::string pyScript;
std::string pyArgs;
stringVector varNames;
......
......@@ -1673,6 +1673,8 @@ QvisQueryWindow::ExecuteStandardQuery(bool doTime)
//
//
// Modifications:
// Cyrus Harrison, Tue Sep 21 11:23:00 PDT 2010
// Support passing of arbitary arguments via "args" keyword.
//
// ****************************************************************************
......@@ -1687,6 +1689,8 @@ QvisQueryWindow::ExecutePythonQuery()
QStringListIterator itr(vlist);
while(itr.hasNext())
py_args.push_back(itr.next().toStdString());
// blank spot for 'args' that can be passed via the cli
py_args.push_back("");
// get python script from pyFilterEdit
QString query_def = pyFilterEdit->getSource();
......
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