Commit a1f4b2dd authored by hkrishna's avatar hkrishna

adding support for pyside client, this involved restructuring functions in...

adding support for pyside client, this involved restructuring functions in mdserver. I took the opportunity to make VisIt's client facing rpc & proxy api to be more consistent, this requires modifications to mdserver, launcher, engine, viewer, and gui

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@18783 18c085ea-50e0-402c-830e-de6fd14e8384
parent d882e99e
......@@ -48,7 +48,7 @@ ELSE (WIN32)
IF("${VISIT_CMAKE_PLATFORM}" STREQUAL "Linux")
# Linux requires librt to resolve "clock_gettime"
# add this as a general dep:
SET(FASTBIT_LIBDEP /usr/lib rt "${FASTBIT_LIBDEP}")
#SET(FASTBIT_LIBDEP /usr/lib rt "${FASTBIT_LIBDEP}")
ENDIF("${VISIT_CMAKE_PLATFORM}" STREQUAL "Linux")
SET_UP_THIRD_PARTY(FASTBIT lib include fastbit)
ENDIF (WIN32)
......
......@@ -108,7 +108,7 @@ public:
void AddProfileArguments(const MachineProfile &machine,
bool addParallelArgs);
void Create(const std::string &hostName,
virtual void Create(const std::string &hostName,
MachineProfile::ClientHostDetermination chd,
const std::string &clientHostName,
bool manualSSHPort,
......
This diff is collapsed.
......@@ -69,6 +69,7 @@ class ProcInfoRPC;
class SimulationCommandRPC;
class SetEFileOpenOptionsRPC;
class LaunchRPC;
class EngineState;
// Other classes
class avtDatabaseMetaData;
......@@ -366,32 +367,7 @@ class ENGINE_MAIN_API Engine
// The RPCs
QuitRPC *quitRPC;
KeepAliveRPC *keepAliveRPC;
ReadRPC *readRPC;
ApplyOperatorRPC *applyOperatorRPC;
MakePlotRPC *makePlotRPC;
UseNetworkRPC *useNetworkRPC;
UpdatePlotAttsRPC *updatePlotAttsRPC;
PickRPC *pickRPC;
StartPickRPC *startPickRPC;
StartQueryRPC *startQueryRPC;
ExecuteRPC *executeRPC;
ClearCacheRPC *clearCacheRPC;
QueryRPC *queryRPC;
QueryParametersRPC *queryParametersRPC;
ReleaseDataRPC *releaseDataRPC;
OpenDatabaseRPC *openDatabaseRPC;
DefineVirtualDatabaseRPC *defineVirtualDatabaseRPC;
RenderRPC *renderRPC;
SetWinAnnotAttsRPC *setWinAnnotAttsRPC;
CloneNetworkRPC *cloneNetworkRPC;
ProcInfoRPC *procInfoRPC;
SimulationCommandRPC *simulationCommandRPC;
ExportDatabaseRPC *exportDatabaseRPC;
ConstructDataBinningRPC *constructDataBinningRPC;
NamedSelectionRPC *namedSelectionRPC;
SetEFileOpenOptionsRPC *setEFileOpenOptionsRPC;
EnginePropertiesRPC *enginePropertiesRPC;
LaunchRPC *launchRPC;
EngineState *enginestate;
#ifdef DEBUG_MEMORY_LEAKS
ParsingExprList *parsingExprList;
......
This diff is collapsed.
This diff is collapsed.
......@@ -54,6 +54,8 @@ CloneNetworkRPC.C
ConstructDataBinningRPC.C
DefineVirtualDatabaseRPC.C
EnginePropertiesRPC.C
EngineMethods.C
EngineState.C
ExecuteRPC.C
ExportDatabaseRPC.C
MakePlotRPC.C
......@@ -78,6 +80,16 @@ UseNetworkRPC.C
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_SOURCE_DIR}
${VISIT_COMMON_INCLUDES}
${VISIT_SOURCE_DIR}/avt/DBAtts/MetaData
${VISIT_SOURCE_DIR}/avt/DBAtts/SIL
${VISIT_SOURCE_DIR}/avt/Math
${VISIT_SOURCE_DIR}/avt/Pipeline/AbstractFilters
${VISIT_SOURCE_DIR}/avt/Pipeline/Data
${VISIT_SOURCE_DIR}/avt/Pipeline/Pipeline
${VISIT_SOURCE_DIR}/avt/Pipeline/Sinks
${VISIT_SOURCE_DIR}/avt/Pipeline/Sources
${VISIT_SOURCE_DIR}/avt/VisWindow/VisWindow
${VISIT_SOURCE_DIR}/engine/rpc
)
LINK_DIRECTORIES(${LIBRARY_OUTPUT_DIRECTORY})
......
This diff is collapsed.
/*****************************************************************************
*
* Copyright (c) 2000 - 2012, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-442911
* All rights reserved.
*
* This file is part of VisIt. For details, see https://visit.llnl.gov/. The
* full copyright notice is contained in the file COPYRIGHT located at the root
* of the VisIt distribution or at http://www.llnl.gov/visit/copyright.html.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the disclaimer (as noted below) in the
* documentation and/or other materials provided with the distribution.
* - Neither the name of the LLNS/LLNL nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL SECURITY,
* LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
*****************************************************************************/
// ************************************************************************* //
// EngineMethods.h //
// ************************************************************************* //
#ifndef ENGINE_METHODS_H
#define ENGINE_METHODS_H
#include <engine_rpc_exports.h>
#include <string>
#include <maptypes.h>
#include <vectortypes.h>
#include <avtSILRestriction.h>
#include <MaterialAttributes.h>
#include <SelectionSummary.h>
#include <ExpressionList.h>
#include <MeshManagementAttributes.h>
#include <WindowAttributes.h>
#include <AnnotationAttributes.h>
#include <SelectionProperties.h>
#include <PickAttributes.h>
#include <EngineProperties.h>
#include <ProcessAttributes.h>
#include <FileOpenOptions.h>
#include <ParentProcess.h>
#include <RemoteProcess.h>
#include <avtDataObjectReader.h>
class EngineState;
class AttributeSubject;
class QueryAttributes;
class ExportDBAttributes;
class QueryOverTimeAttributes;
class AnnotationObjectList;
class ConstructDataBinningAttributes;
class VisualCueList;
class StatusAttributes;
class ENGINE_RPC_API EngineMethods
{
public:
EngineMethods(EngineState*);
~EngineMethods();
StatusAttributes *GetStatusAttributes() const;
// RPCs to access functionality on the engine.
void OpenDatabase(const std::string &,
const std::string &, int = 0,
bool=true, bool=true, bool=false);
void DefineVirtualDatabase(const std::string &,
const std::string &,
const std::string &,
const stringVector &,
int = 0, bool=true,
bool=true);
void ReadDataObject(const std::string &format,
const std::string &filename,
const std::string &var, const int ts,
avtSILRestriction_p,
const MaterialAttributes&,
const ExpressionList &,
const MeshManagementAttributes &,
bool treatAllDbsAsTimeVarying,
bool ignoreExtents,
const std::string &selName,
int windowID);
void ApplyOperator(const std::string&,
const AttributeSubject*);
void ApplyNamedFunction(const std::string &name,
int nargs);
int MakePlot(const std::string &plotName,
const std::string &pluginID,
const AttributeSubject*,
const std::vector<double>&,
int winID);
void UseNetwork(int);
void UpdatePlotAttributes(const std::string &, int,
const AttributeSubject*);
void Pick(const int, const PickAttributes *,
PickAttributes &, const int);
void StartPick(const bool, const bool, const int);
void StartQuery(const bool, const int);
void SetWinAnnotAtts(const WindowAttributes*,
const AnnotationAttributes*,
const AnnotationObjectList*,
std::string,
const VisualCueList*,
const int *frameAndState,
const double *viewExtents,
const std::string,
const int winID);
void SetDefaultFileOpenOptions(const FileOpenOptions&);
avtDataObjectReader_p Render(bool, const intVector&, int, int, bool,
void (*waitCB)(void *), void *cbData);
avtDataObjectReader_p Execute(bool, void (*waitCB)(void*),void *cbData);
void ClearCache();
void ClearCache(const std::string &);
void Query(const std::vector<int> &,
const QueryAttributes *,
QueryAttributes &);
void ExportDatabase(int, const ExportDBAttributes *);
void ConstructDataBinning(int, const ConstructDataBinningAttributes *);
const SelectionSummary &CreateNamedSelection(int id, const SelectionProperties &props);
const SelectionSummary &UpdateNamedSelection(int id, const SelectionProperties &props, bool cache);
void DeleteNamedSelection(const std::string selName);
void LoadNamedSelection(const std::string selName);
void SaveNamedSelection(const std::string selName);
void ReleaseData(const int);
void CloneNetwork(const int,
const QueryOverTimeAttributes *);
void UpdateExpressions(const ExpressionList &);
std::string GetQueryParameters(const std::string &qName);
void GetProcInfo(ProcessAttributes &);
void ExecuteSimulationControlCommand(
const std::string &cmd);
void ExecuteSimulationControlCommand(
const std::string &cmd,
const std::string &arg);
EngineProperties GetEngineProperties();
void LaunchProcess(const stringVector &programArgs);
void SetParentProcess(ParentProcess* _engineP) { engineP = _engineP; }
void SetRemoteProcess(RemoteProcess* _component) { component = _component; }
void SetNumNodes(int _numNodes) { numNodes = _numNodes; }
protected:
void BlockForNamedSelectionOperation();
void Status(const char *message);
void Status(int percent, int curStage,
const std::string &curStageName,
int maxStage);
void ClearStatus();
void Warning(const char *message);
private:
int numNodes;
// For indicating status.
ParentProcess *engineP;
RemoteProcess *component;
EngineState* state;
};
#endif
#include <EngineState.h>
#include <Xfer.h>
EngineState::EngineState()
{
objVector.push_back(&readRPC);
objVector.push_back(&applyOperatorRPC);
objVector.push_back(&makePlotRPC);
objVector.push_back(&useNetworkRPC);
objVector.push_back(&updatePlotAttsRPC);
objVector.push_back(&pickRPC);
objVector.push_back(&startPickRPC);
objVector.push_back(&startQueryRPC);
objVector.push_back(&executeRPC);
objVector.push_back(&clearCacheRPC);
objVector.push_back(&queryRPC);
objVector.push_back(&queryParametersRPC);
objVector.push_back(&releaseDataRPC);
objVector.push_back(&openDatabaseRPC);
objVector.push_back(&defineVirtualDatabaseRPC);
objVector.push_back(&renderRPC);
objVector.push_back(&setWinAnnotAttsRPC);
objVector.push_back(&cloneNetworkRPC);
objVector.push_back(&procInfoRPC);
objVector.push_back(&simulationCommandRPC);
objVector.push_back(&exportDatabaseRPC);
objVector.push_back(&constructDataBinningRPC);
objVector.push_back(&namedSelectionRPC);
objVector.push_back(&setEFileOpenOptionsRPC);
objVector.push_back(&enginePropertiesRPC);
objVector.push_back(&launchRPC);
statusAtts = new StatusAttributes;
}
EngineState::~EngineState()
{
delete statusAtts;
}
void
EngineState::SetupComponentRPCs(Xfer* xfer)
{
//
// Add RPCs to the transfer object.
//
for(int i = 0; i < GetNumStateObjects(); ++i)
xfer->Add(GetStateObject(i));
//xfer->Add(&exprList); TODO: PUT THIS BACK when Engine.C xfer->Add(l->GetList()); is fixed..
}
size_t
EngineState::GetNumStateObjects()
{
return objVector.size();
}
VisItRPC*
EngineState::GetStateObject(int i)
{
return (i >= 0 && i < objVector.size()) ?
objVector[i] : 0;
}
/*****************************************************************************
*
* Copyright (c) 2000 - 2012, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-442911
* All rights reserved.
*
* This file is part of VisIt. For details, see https://visit.llnl.gov/. The
* full copyright notice is contained in the file COPYRIGHT located at the root
* of the VisIt distribution or at http://www.llnl.gov/visit/copyright.html.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the disclaimer (as noted below) in the
* documentation and/or other materials provided with the distribution.
* - Neither the name of the LLNS/LLNL nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL SECURITY,
* LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
*****************************************************************************/
#ifndef ENGINE_STATE_H
#define ENGINE_STATE_H
#include <engine_rpc_exports.h>
#include <ReadRPC.h>
#include <RenderRPC.h>
#include <ExecuteRPC.h>
#include <ApplyOperatorRPC.h>
#include <ClearCacheRPC.h>
#include <CloneNetworkRPC.h>
#include <ConstructDataBinningRPC.h>
#include <DefineVirtualDatabaseRPC.h>
#include <EnginePropertiesRPC.h>
#include <ExportDatabaseRPC.h>
#include <LaunchRPC.h>
#include <MakePlotRPC.h>
#include <NamedSelectionRPC.h>
#include <OpenDatabaseRPC.h>
#include <PickRPC.h>
#include <ProcInfoRPC.h>
#include <QueryRPC.h>
#include <QueryParametersRPC.h>
#include <ReleaseDataRPC.h>
#include <SetWinAnnotAttsRPC.h>
#include <SimulationCommand.h>
#include <SimulationCommandRPC.h>
#include <SILAttributes.h>
#include <StartPickRPC.h>
#include <StartQueryRPC.h>
#include <UpdatePlotAttsRPC.h>
#include <UseNetworkRPC.h>
#include <ExpressionList.h>
#include <FileOpenOptions.h>
#include <SetEFileOpenOptionsRPC.h>
#include <SelectionProperties.h>
#include <StatusAttributes.h>
class ENGINE_RPC_API EngineState
{
public:
EngineState();
~EngineState();
size_t GetNumStateObjects();
VisItRPC* GetStateObject(int i);
void SetupComponentRPCs(Xfer* xfer);
ReadRPC& GetReadRPC() { return readRPC; }
ApplyOperatorRPC& GetApplyOperatorRPC() { return applyOperatorRPC; }
MakePlotRPC& GetMakePlotRPC() { return makePlotRPC; }
UseNetworkRPC& GetUseNetworkRPC() { return useNetworkRPC; }
UpdatePlotAttsRPC& GetUpdatePlotAttsRPC() { return updatePlotAttsRPC; }
ExecuteRPC& GetExecuteRPC() { return executeRPC; }
PickRPC& GetPickRPC() { return pickRPC; }
StartPickRPC& GetStartPickRPC(){ return startPickRPC; }
StartQueryRPC& GetStartQueryRPC() { return startQueryRPC; }
ClearCacheRPC& GetClearCacheRPC() { return clearCacheRPC; }
QueryRPC& GetQueryRPC() { return queryRPC; }
QueryParametersRPC& GetQueryParametersRPC() { return queryParametersRPC; }
ReleaseDataRPC& GetReleaseDataRPC() { return releaseDataRPC; }
OpenDatabaseRPC& GetOpenDatabaseRPC() { return openDatabaseRPC; }
DefineVirtualDatabaseRPC& GetDefineVirtualDatabaseRPC() { return defineVirtualDatabaseRPC; }
RenderRPC& GetRenderRPC() { return renderRPC; }
SetWinAnnotAttsRPC& GetSetWinAnnotAttsRPC() { return setWinAnnotAttsRPC; }
CloneNetworkRPC& GetCloneNetworkRPC() { return cloneNetworkRPC; }
ProcInfoRPC& GetProcInfoRPC() { return procInfoRPC; }
SimulationCommandRPC& GetSimulationCommandRPC() { return simulationCommandRPC; }
ExportDatabaseRPC& GetExportDatabaseRPC() { return exportDatabaseRPC; }
ConstructDataBinningRPC& GetConstructDataBinningRPC() { return constructDataBinningRPC; }
NamedSelectionRPC& GetNamedSelectionRPC() { return namedSelectionRPC; }
SetEFileOpenOptionsRPC& GetSetEFileOpenOptionsRPC() { return setEFileOpenOptionsRPC; }
EnginePropertiesRPC& GetEnginePropertiesRPC() { return enginePropertiesRPC; }
LaunchRPC& GetLaunchRPC() { return launchRPC; }
private:
ReadRPC readRPC;
ApplyOperatorRPC applyOperatorRPC;
MakePlotRPC makePlotRPC;
UseNetworkRPC useNetworkRPC;
UpdatePlotAttsRPC updatePlotAttsRPC;
ExecuteRPC executeRPC;
PickRPC pickRPC;
StartPickRPC startPickRPC;
StartQueryRPC startQueryRPC;
ClearCacheRPC clearCacheRPC;
QueryRPC queryRPC;
QueryParametersRPC queryParametersRPC;
ReleaseDataRPC releaseDataRPC;
OpenDatabaseRPC openDatabaseRPC;
DefineVirtualDatabaseRPC defineVirtualDatabaseRPC;
RenderRPC renderRPC;
SetWinAnnotAttsRPC setWinAnnotAttsRPC;
CloneNetworkRPC cloneNetworkRPC;
ProcInfoRPC procInfoRPC;
SimulationCommandRPC simulationCommandRPC;
ExportDatabaseRPC exportDatabaseRPC;
ConstructDataBinningRPC constructDataBinningRPC;
NamedSelectionRPC namedSelectionRPC;
SetEFileOpenOptionsRPC setEFileOpenOptionsRPC;
EnginePropertiesRPC enginePropertiesRPC;
LaunchRPC launchRPC;
StatusAttributes *statusAtts;
//void SetupComponentRPCs(Xfer* xfer);
std::vector<VisItRPC*> objVector;
friend class EngineMethods;
public:
ExpressionList exprList;
};
#endif
This diff is collapsed.
......@@ -46,7 +46,7 @@
#include <MRUCache.h>
#include <AttributeSubject.h>
#include <ConnectCallback.h>
#include <MDServerProxy.h>
#include <MDServerManager.h>
#include <QualifiedFilename.h>
#include <avtSIL.h>
......@@ -216,16 +216,16 @@ class MessageAttributes;
class GUI_API FileServerList : public AttributeSubject
{
typedef struct
{
std::string path;
MDServerProxy *server;
} ServerInfo;
// typedef struct
// {
// std::string path;
// MDServerProxy *server;
// } ServerInfo;
// The '50' sets the *initial* number of slots in the MRU cache. It can
// always be increased or decreased with a call to numslots(int n).
// Note that the cache itself knows how to delete its entries
typedef std::map<std::string, ServerInfo *> ServerMap;
//typedef std::map<std::string, ServerInfo *> ServerMap;
typedef MRUCache<std::string, avtDatabaseMetaData*, MRUCache_Delete, 50> FileMetaDataMap;
typedef MRUCache<std::string, avtSIL*, MRUCache_Delete, 50> SILMap;
......@@ -275,7 +275,7 @@ public:
std::string ExpandPath(const std::string &p);
stringVector GetRecentHosts() const;
const std::string &GetFilter() const;
const MDServerProxy::FileList &GetFileList() const;
const MDServerMethods::FileList &GetFileList() const;
const QualifiedFilenameVector &GetAppliedFileList();
QualifiedFilenameVector GetFilteredFileList();
bool GetUseCurrentDirectory() const;
......@@ -380,7 +380,7 @@ private:
bool smartFileGroupingFlag; // attribute 9
// Information about the open md servers.
ServerMap servers;
// ServerMap servers;
std::string activeHost;
bool connectingServer;
std::string filter;
......@@ -392,7 +392,7 @@ private:
bool createVectorMagnitudeExpressions;
// The file list for the current host.
MDServerProxy::FileList fileList;
MDServerMethods::FileList fileList;
// The applied file list
QualifiedFilenameVector appliedFileList;
......
......@@ -748,7 +748,7 @@ QvisFileWindowBase::UpdateHostComboBox()
void
QvisFileWindowBase::UpdateDirectoryList()
{
const MDServerProxy::FileList &f = fileServer->GetFileList();
const MDServerMethods::FileList &f = fileServer->GetFileList();
// Get the strings for current directory and up directory.
QString curDirString, upDirString;
......@@ -756,7 +756,7 @@ QvisFileWindowBase::UpdateDirectoryList()
// Iterate through the the directory list and add the dirs.
directoryList->clear();
MDServerProxy::FileEntryVector::const_iterator pos;
MDServerMethods::FileEntryVector::const_iterator pos;
for(pos = f.dirs.begin(); pos != f.dirs.end(); ++pos)
{
QListWidgetItem *item = new QListWidgetItem(directoryList);
......
......@@ -621,7 +621,7 @@ GUI_LogQtMessages(QtMsgType type, const char *msg)
//
// ****************************************************************************
QvisGUIApplication::QvisGUIApplication(int &argc, char **argv) :
QvisGUIApplication::QvisGUIApplication(int &argc, char **argv, ViewerProxy *proxy) :
ConfigManager(), GUIBase(), windowNames(), message(), plotWindows(),
operatorWindows(), otherWindows(), foregroundColor(), backgroundColor(),
applicationStyle(), applicationLocale("default"), loadFile(), sessionFile(),
......@@ -703,9 +703,10 @@ QvisGUIApplication::QvisGUIApplication(int &argc, char **argv) :
savedGUILocation[1] = 0;
// Create the viewer, statusSubject, and fileServer for GUIBase.
SetViewerProxy(new ViewerProxy());
SetViewerProxy( proxy ? proxy : new ViewerProxy());
statusSubject = new StatusSubject;
fileServer = new FileServerList;
embeddedGUI = false;
// Process any GUI arguments that should not be passed on to other programs.
// This also has the effect of setting color/style attributes. This must
......@@ -759,7 +760,18 @@ QvisGUIApplication::QvisGUIApplication(int &argc, char **argv) :
debug1 << "QvisApplication::QvisApplication: -font " << qt_argv[argc+1] << endl;
qInstallMsgHandler(GUI_LogQtMessages);
mainApp = new QvisApplication(qt_argc, qt_argv);
if(QApplication::instance()) //if application instance already exists..
{
mainApp = dynamic_cast<QApplication*>(QApplication::instance());
inheritedGUI = true;
}
else
{
mainApp = new QvisApplication(qt_argc, qt_argv);
inheritedGUI = false;
}
SetWaitCursor();
GetViewerState()->GetAppearanceAttributes()->SelectAll();
......@@ -1018,7 +1030,8 @@ QvisGUIApplication::~QvisGUIApplication()
delete fromViewer;
// Delete the application
delete mainApp;
if(!inheritedGUI)
delete mainApp;
// Delete the args for QT
for (i = 0 ; i < qt_argc ; i++)
......@@ -1157,12 +1170,14 @@ QvisGUIApplication::HeavyInitialization()
break;
case 5:
// Create the socket notifier and hook it up to the viewer.
fromViewer = new QSocketNotifier(
GetViewerProxy()->GetWriteConnection()->GetDescriptor(),
QSocketNotifier::Read);
connect(fromViewer, SIGNAL(activated(int)),
this, SLOT(ReadFromViewer(int)));
if(!inheritedGUI)
{
fromViewer = new QSocketNotifier(
GetViewerProxy()->GetWriteConnection()->GetDescriptor(),
QSocketNotifier::Read);
connect(fromViewer, SIGNAL(activated(int)),
this, SLOT(ReadFromViewer(int)));
}
SplashScreenProgress(tr("Starting metadata server..."), 32);
visitTimer->StopTimer(timeid, "stage 5");
break;
......@@ -1170,7 +1185,8 @@ QvisGUIApplication::HeavyInitialization()
// Initialize the file server. This connects the GUI to the mdserver
// running on localhost.
fileServer->SetConnectCallback(StartMDServer, (void *)GetViewerProxy());
if(!inheritedGUI)
fileServer->SetConnectCallback(StartMDServer, (void *)GetViewerProxy());
fileServer->Initialize();
visitTimer->StopTimer(timeid, "stage 6 - Launching mdserver");
break;
......@@ -1204,6 +1220,7 @@ QvisGUIApplication::HeavyInitialization()
case 12:
// Load plugin info
GetViewerProxy()->InitializePlugins(PluginManager::GUI);
if(inheritedGUI) LoadPlugins();
visitTimer->StopTimer(timeid, "stage 12 - Loading plugin info");
break;
case 13:
......@@ -1594,8 +1611,11 @@ QvisGUIApplication::FinalInitialization()
allowSocketRead = false;
// Show the main window and the viewer window.
mainWin->show();
ShowAllWindows();
if(!embeddedGUI)
{
mainWin->show();
ShowAllWindows();
}
// Indicate that future messages should go to windows and not
// to the console.
......@@ -1735,13 +1755,16 @@ QvisGUIApplication::FinalInitialization()
Synchronize(INITIALIZE_SESSIONDIR_TAG);
// If we have a crash recovery file, restore it?
if(sessionFile.isEmpty())
RestoreCrashRecoveryFile();
else
if(!embeddedGUI)
{
debug1 << "The user wants to load a session file so blow away any "
"crash recovery file that may be present." << endl;
RemoveCrashRecoveryFile(true);
if(sessionFile.isEmpty())