Commit c738450d authored by whitlocb's avatar whitlocb

I fixed some exception handling in the gui.



git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@13261 18c085ea-50e0-402c-830e-de6fd14e8384
parent 85119020
......@@ -1518,6 +1518,10 @@ FileServerList::CloseFile()
//
// Mark C. Miller, Wed Jun 17 14:27:08 PDT 2009
// Replaced CATCHALL(...) with CATCHALL.
//
// Brad Whitlock, Mon Dec 13 10:35:24 PST 2010
// Call the "Ex" versions of GetMetaData and GetSIL.
//
// ****************************************************************************
void
......@@ -1526,7 +1530,7 @@ FileServerList::OpenAndGetMetaData(const QualifiedFilename &filename,
{
// If the metadata has been seen before, indicate that we have it.
// Otherwise, read it from the MetaData Server.
if (GetMetaData(filename, timeState, !ANY_STATE, !GET_NEW_MD))
if (GetMetaData(filename, timeState, !ANY_STATE, !GET_NEW_MD) != 0)
{
// The metadata has been read previously.
fileAction = action;
......@@ -1562,12 +1566,12 @@ FileServerList::OpenAndGetMetaData(const QualifiedFilename &filename,
TRY
{
// Do a GetMetaData RPC on the MD Server.
// Do a GetMetaData RPC on the MD Server. Let it throw exceptions
const avtDatabaseMetaData *newMetaData =
GetMetaData(filename, timeState, !ANY_STATE, GET_NEW_MD);
GetMetaDataEx(filename, timeState, !ANY_STATE, GET_NEW_MD);
const avtSIL *newSIL =
GetSIL(filename, timeState, !ANY_STATE, GET_NEW_MD);
GetSILEx(filename, timeState, !ANY_STATE, GET_NEW_MD);
readFileFailed = false;
......@@ -2483,14 +2487,66 @@ FileServerList::GetOpenFile() const
// ****************************************************************************
// Method: FileServerList::GetMetaData
//
// Purpose:
// This method wraps GetMetaDataEx in a layer of exception handling so the
// method will return 0 when it can't get metadata instead of throwing an
// exception.
//
// Arguments:
// filename : The name of the file for which we want metadata.
// timeState : The desired time state
// anyStateOk : If true then metadata for any time state is okay.
// dontGetNew : Prevent VisIt from requesting the metadata if not found.
// key :
//
// Returns: Metadata or 0 if we can't get it.
//
// Note:
//
// Programmer: Brad Whitlock
// Creation: Mon Dec 13 10:00:52 PST 2010
//
// Modifications:
//
// ****************************************************************************
const avtDatabaseMetaData *
FileServerList::GetMetaData(const QualifiedFilename &filename,
int timeState, bool anyStateOk, bool dontGetNew, string *key)
{
const avtDatabaseMetaData *md = 0;
TRY
{
md = GetMetaDataEx(filename, timeState, anyStateOk, dontGetNew, key);
}
CATCH(VisItException)
{
}
ENDTRY
return md;
}
// ****************************************************************************
// Method: FileServerList::GetMetaDataEx
//
// Purpose: Get metadata for specified file and time state. First, tries to
// find it in the cache by either filename key only or filename+state
// key. If it can't find it in the cache, requests it from the MD
// server unless dontGetNew is set to true.
//
// Arguments:
// filename : The name of the file for which we want metadata.
// timeState : The desired time state
// anyStateOk : If true then metadata for any time state is okay.
// dontGetNew : Prevent VisIt from requesting the metadata if not found.
// key :
//
// Programmer: Mark C. Miller (totally re-wrote)
// Creation: July 25, 2006
//
// Note: IF YOU CALL THIS METHOD THEN YOU MUST CATCH GetMetaDataException!
//
// Modifications:
// Kathleen Bonnell, Tue Oct 9 14:40:10 PDT 2007
// Send flags for creation of MeshQuality and TimeDerivative expressions
......@@ -2504,10 +2560,11 @@ FileServerList::GetOpenFile() const
// Mark C. Miller, Tue Oct 19 17:19:48 PDT 2010
// Wrapped attempt to print MD in a TRY/CATCHALL block just to be safe.
// Added test for debug level prior to calling Print() method.
//
// ****************************************************************************
const avtDatabaseMetaData *
FileServerList::GetMetaData(const QualifiedFilename &filename,
FileServerList::GetMetaDataEx(const QualifiedFilename &filename,
int timeState, bool anyStateOk, bool dontGetNew, string *key)
{
// build set of keys for cached metadata
......@@ -2668,21 +2725,69 @@ FileServerList::GetCreateVectorMagnitudeExpressions() const
return createVectorMagnitudeExpressions;
}
// ****************************************************************************
// Method: FileServerList::GetSIL
//
// Purpose:
// Return a pointer for the SIL for a given filename.
//
// Arguments:
// filename : The name of the file for which we want a sil.
// timeState : The desired time state
// anyStateOk : If true then metadata for any time state is okay.
// dontGetNew : Prevent VisIt from requesting the metadata if not found.
// key :
//
//
// Returns:
//
// Note:
//
// Programmer: Brad Whitlock
// Creation: Mon Dec 13 10:18:41 PST 2010
//
// Modifications:
//
// ****************************************************************************
const avtSIL *
FileServerList::GetSIL(const QualifiedFilename &filename, int timeState,
bool anyStateOk, bool dontGetNew, string *key)
{
const avtSIL *sil = 0;
TRY
{
sil = GetSILEx(filename, timeState, anyStateOk, dontGetNew, key);
}
CATCH(VisItException)
{
}
ENDTRY
return sil;
}
// ****************************************************************************
// Method: FileServerList::GetSILEx
//
// Purpose:
// Returns a pointer to a SIL for the given filename.
//
// Arguments:
// filename : The filename for which we will try and read a SIL.
// timeState : The desired time state
// anyStateOk : If true then metadata for any time state is okay.
// dontGetNew : Prevent VisIt from requesting the metadata if not found.
// key :
//
// Returns: A pointer to a the SIL or NULL if the filename is bad.
//
// Programmer: Brad Whitlock
// Creation: Thu Jul 5 09:53:57 PDT 2001
//
// Note: IF YOU CALL THIS METHOD, YOU MUST CATCH VisItException.
//
// Modifications:
// Eric Brugger, Thu Nov 29 12:02:21 PST 2001
// Added caching of SILs.
......@@ -2695,14 +2800,18 @@ FileServerList::GetCreateVectorMagnitudeExpressions() const
//
// Mark C. Miller, Tue Oct 19 17:19:48 PDT 2010
// Wrapped attempt to print SIL in a TRY/CATCHALL block as we discovered
// a case where avtSIL would through an exception causing GUI to die.
// a case where avtSIL would throw an exception causing GUI to die.
//
// Mark C. Miller, Tue Oct 19 20:23:27 PDT 2010
// Added test for debug level before calling Print() method for SIL.
//
// Brad Whitlock, Mon Dec 13 10:12:10 PST 2010
// Added checks for metadata==NULL.
//
// ****************************************************************************
const avtSIL *
FileServerList::GetSIL(const QualifiedFilename &filename, int timeState,
FileServerList::GetSILEx(const QualifiedFilename &filename, int timeState,
bool anyStateOk, bool dontGetNew, string *key)
{
// build set of keys for cached SIL
......@@ -2756,10 +2865,15 @@ FileServerList::GetSIL(const QualifiedFilename &filename, int timeState,
// decide on the right key
string useKey = mdKeys[0]; // non-state-qualified key
if (treatAllDBsAsTimeVarying ||
GetMetaData(filename, timeState, ANY_STATE, !GET_NEW_MD, 0)->
GetMustRepopulateOnStateChange())
if (treatAllDBsAsTimeVarying)
useKey = mdKeys[1]; // state-qualified key
else
{
const avtDatabaseMetaData *md =
GetMetaData(filename, timeState, ANY_STATE, !GET_NEW_MD, 0);
if(md != 0 && md->GetMustRepopulateOnStateChange())
useKey = mdKeys[1]; // state-qualified key
}
// cache it. Note MRU handles deletion
SILData[useKey] = newSIL;
......
......@@ -213,6 +213,9 @@ class MessageAttributes;
// Jeremy Meredith, Tue Mar 30 15:54:17 EDT 2010
// Add way for GUI to pre-set a plugin we intend to use for a file.
//
// Brad Whitlock, Mon Dec 13 10:37:33 PST 2010
// I added "Ex" versions of GetMetaData and GetSIL.
//
// ****************************************************************************
class GUI_API FileServerList : public AttributeSubject
......@@ -301,8 +304,6 @@ public:
const avtDatabaseMetaData *GetMetaData(const QualifiedFilename &filename,
int timeState, bool anyStateOk,
bool dontGetNew, string *key = 0);
const avtDatabaseMetaData *GetCachedMetaData(const QualifiedFilename &filename,
int timeState) const;
char GetSeparator();
char GetSeparator(const string &host);
string GetSeparatorString();
......@@ -351,6 +352,13 @@ public:
private:
virtual void SelectAll();
const avtSIL *GetSILEx(const QualifiedFilename &f,
int timeState, bool anyStateOk,
bool dontGetNew, string *key = 0);
const avtDatabaseMetaData *GetMetaDataEx(const QualifiedFilename &filename,
int timeState, bool anyStateOk,
bool dontGetNew, string *key = 0);
void StartServer(const string &host);
void CloseServer(const string &host);
void OpenAndGetMetaData(const QualifiedFilename &filename, int timeState,
......
......@@ -1216,6 +1216,9 @@ QvisCMFEWizard::UpdateTargetMesh(void)
// Cyrus Harrison, Mon Aug 30 11:59:25 PDT 2010
// Simplify wizard & add ability to open new databases.
//
// Brad Whitlock, Mon Dec 13 10:46:08 PST 2010
// Check for metadata==NULL.
//
// ****************************************************************************
Expression::ExprType
......@@ -1241,16 +1244,18 @@ QvisCMFEWizard::GetVarType(const std::string &str)
GetStateForSource(filename),
!FileServerList::ANY_STATE,
FileServerList::GET_NEW_MD);
avtVarType vt = AVT_UNKNOWN_TYPE;
TRY
{
vt = md->DetermineVarType(str, true);
}
CATCH (VisItException)
avtVarType vt = AVT_SCALAR_VAR;
if(md != 0)
{
vt = AVT_SCALAR_VAR;
TRY
{
vt = md->DetermineVarType(str, true);
}
CATCH (VisItException)
{
}
ENDTRY
}
ENDTRY
return avtVarType_To_ExprType(vt);
}
......@@ -1270,6 +1275,9 @@ QvisCMFEWizard::GetVarType(const std::string &str)
// Cyrus Harrison, Mon Aug 30 11:59:25 PDT 2010
// Simplify wizard & add ability to open new databases.
//
// Brad Whitlock, Mon Dec 13 10:48:26 PST 2010
// Check for NULL metadata.
//
// ****************************************************************************
std::string
......@@ -1296,10 +1304,10 @@ QvisCMFEWizard::GetMeshForTargetDatabase(void)
GetStateForSource(filename),
!FileServerList::ANY_STATE,
FileServerList::GET_NEW_MD);
int nMeshes = md->GetNumMeshes();
if (nMeshes != 1)
return "";
return md->GetMeshes(0).name;
std::string mesh;
if(md != 0 && md->GetNumMeshes() == 1)
mesh = md->GetMeshes(0).name;
return mesh;
}
......
......@@ -1185,6 +1185,9 @@ QvisTimeSliderControlWidget::sliderChange(int val)
// Changed set of time field text to use SetTimeFieldText to make sure
// long time values remain visible.
//
// Brad Whitlock, Mon Dec 13 10:39:28 PST 2010
// Return early if we get NULL metadata.
//
// ****************************************************************************
void
......@@ -1200,6 +1203,11 @@ QvisTimeSliderControlWidget::processTimeText()
GetStateForSource(fileServer->GetOpenFile()),
FileServerList::ANY_STATE,
!FileServerList::GET_NEW_MD);
if(md == 0)
{
SetTimeFieldText("");
return;
}
int index = 0;
bool okay = false;
......
......@@ -36,6 +36,7 @@ list of changes in release 2.1.1.</p>
<li>A bug causing the mdserver to crash on some ddcMD databases was resolved.</li>
<li>A bug in the Subset window preventing "Turn On All" from working was resolved.</li>
<li>A bug with page progression in the Save Movie Wizard was resolved.</li>
<li>The exception handling in VisIt's gui was improved so VisIt no longer locks up when files are missing.</li>
</ul>
<p><b><font size="4">Enhancements in version 2.1.2</font></b></p>
......
......@@ -29,6 +29,11 @@
# "common/Exceptions/VisWindow" no longer exists, removed it from the python
# module build.
#
# Brad Whitlock, Mon Dec 13 11:02:58 PST 2010
# I changed the build so it works again. Unfortunately, it won't work with
# plugins anymore since we link plugins against dependent libs now. This
# module was always kind of a hack anyway.
#
###############################################################################
from distutils.core import setup, Extension
......@@ -51,7 +56,7 @@ def RemoveFileFromList(filelist, rm):
return ret
# Get all of the VisIt sources that we need to build the VisIt module.
srcdirs = ("../../common/comm",
srcdirs = ["../../common/comm",
"../../common/state",
"../../common/misc",
"../../common/utility",
......@@ -67,7 +72,7 @@ srcdirs = ("../../common/comm",
"../../viewer/proxy",
".",
"../visitpy",
"../common")
"../common"]
visitmod_sources = []
for d in srcdirs:
visitmod_sources = visitmod_sources + GetCXXFilesInDirectory(d)
......@@ -102,7 +107,7 @@ ver = string.replace(lines[0], "\n", "")
visitmod = Extension("visitmodule",
language="c++",
#extra_compile_args="-Wno-deprecated",
include_dirs=['.', "../visitpy", "../common", "../../include", "../../include/visit"],
include_dirs=srcdirs + ["../../include"],
sources = visitmod_sources)
setup(name = "visit",
version = ver,
......
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