Commit 0b3f95ac authored by hkrishna's avatar hkrishna

adding helper functions for getting access to VisIt widgets

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@22883 18c085ea-50e0-402c-830e-de6fd14e8384
parent 12614635
......@@ -116,86 +116,95 @@ QvisGUIApplicationDerived::GetApp()
return (QApplication*)mainApp;
}
QMainWindow* QvisGUIApplicationDerived::GetPlotWindow(int index)
{
if(index >= plotWindows.size() || index < 0)
return NULL;
int QvisGUIApplicationDerived::GetPlotWindowSize()
{
return plotWindows.size();
}
ActivatePlotWindow(index);
QMainWindow* win = ((QMainWindow*)plotWindows[index]);
win->hide();
win->move(QCursor::pos());
QMainWindow* QvisGUIApplicationDerived::GetPlotWindow(int index)
{
if(index >= plotWindows.size() || index < 0)
return NULL;
if(win->inherits("QvisPostableWindow"))
{
if(((QvisPostableWindow*)win)->posted())
((QvisPostableWindow*)win)->unpost();
}
ActivatePlotWindow(index);
QMainWindow* win = ((QMainWindow*)plotWindows[index]);
win->hide();
win->move(QCursor::pos());
return win;
if(win->inherits("QvisPostableWindow"))
{
if(((QvisPostableWindow*)win)->posted())
((QvisPostableWindow*)win)->unpost();
}
QMainWindow* QvisGUIApplicationDerived::GetPlotWindow(const QString& name)
return win;
}
QMainWindow* QvisGUIApplicationDerived::GetPlotWindow(const QString& name)
{
PlotPluginManager* mgr = GetViewerProxy()->GetPlotPluginManager();
for(int i = 0; i < mgr->GetNEnabledPlugins(); ++i)
{
PlotPluginManager* mgr = GetViewerProxy()->GetPlotPluginManager();
for(int i = 0; i < mgr->GetNEnabledPlugins(); ++i)
{
if(mgr->GetPluginName(mgr->GetEnabledID(i)) == name.toStdString())
return GetPlotWindow(i);
}
return NULL;
if(mgr->GetPluginName(mgr->GetEnabledID(i)) == name.toStdString())
return GetPlotWindow(i);
}
return NULL;
}
QMainWindow* QvisGUIApplicationDerived::GetOperatorWindow(int index)
{
if(index >= operatorWindows.size() || index < 0)
return NULL;
int QvisGUIApplicationDerived::GetOperatorWindowSize() {
return operatorWindows.size();
}
ActivateOperatorWindow(index);
QMainWindow* QvisGUIApplicationDerived::GetOperatorWindow(int index)
{
if(index >= operatorWindows.size() || index < 0)
return NULL;
QMainWindow* win = (QMainWindow*)operatorWindows[index];
win->hide();
win->move(QCursor::pos());
ActivateOperatorWindow(index);
if(win->inherits("QvisPostableWindow"))
{
if(((QvisPostableWindow*)win)->posted())
((QvisPostableWindow*)win)->unpost();
}
return win;
QMainWindow* win = (QMainWindow*)operatorWindows[index];
win->hide();
win->move(QCursor::pos());
if(win->inherits("QvisPostableWindow"))
{
if(((QvisPostableWindow*)win)->posted())
((QvisPostableWindow*)win)->unpost();
}
return win;
}
QMainWindow* QvisGUIApplicationDerived::GetOperatorWindow(const QString& name)
QMainWindow* QvisGUIApplicationDerived::GetOperatorWindow(const QString& name)
{
OperatorPluginManager* mgr = GetViewerProxy()->GetOperatorPluginManager();
for(int i = 0; i < mgr->GetNEnabledPlugins(); ++i)
{
OperatorPluginManager* mgr = GetViewerProxy()->GetOperatorPluginManager();
for(int i = 0; i < mgr->GetNEnabledPlugins(); ++i)
{
if(mgr->GetPluginName(mgr->GetEnabledID(i)) == name.toStdString())
return GetOperatorWindow(i);
}
return NULL;
if(mgr->GetPluginName(mgr->GetEnabledID(i)) == name.toStdString())
return GetOperatorWindow(i);
}
return NULL;
}
QMainWindow* QvisGUIApplicationDerived::GetOtherWindow(const QString& name)
QMainWindow* QvisGUIApplicationDerived::GetOtherWindow(const QString& name)
{
for(int i = 0; i < windowNames.size(); ++i)
{
for(int i = 0; i < windowNames.size(); ++i)
if( windowNames[i] == name )
{
if( windowNames[i] == name )
QvisGUIApplication::GetInitializedWindowPointer(i)->show();
QMainWindow* win = QvisGUIApplication::GetInitializedWindowPointer(i);
if(win->inherits("QvisPostableWindow"))
{
QvisGUIApplication::GetInitializedWindowPointer(i)->show();
QMainWindow* win = QvisGUIApplication::GetInitializedWindowPointer(i);
if(win->inherits("QvisPostableWindow"))
{
if(((QvisPostableWindow*)win)->posted())
((QvisPostableWindow*)win)->unpost();
}
win->move(QCursor::pos());
win->hide();
return win;
if(((QvisPostableWindow*)win)->posted())
((QvisPostableWindow*)win)->unpost();
}
win->move(QCursor::pos());
win->hide();
return win;
}
return NULL;
}
return NULL;
}
QStringList
QvisGUIApplicationDerived::GetOtherWindowNames()
......@@ -326,6 +335,47 @@ GUIWrapper::GetTimeSliderWindow()
return gui->GetTimeSliderWindow();
}
QList<QMainWindow*>
GUIWrapper::GetPlotWindows() {
QList<QMainWindow*> plots;
int len = gui->GetPlotWindowSize();
for(int i = 0; i < len; ++i) {
plots.push_back(gui->GetPlotWindow(i));
}
return plots;
}
QList<QMainWindow*>
GUIWrapper::GetOperatorWindows() {
QList<QMainWindow*> operators;
int len = gui->GetOperatorWindowSize();
for(int i = 0; i < len; ++i) {
operators.push_back(gui->GetOperatorWindow(i));
}
return operators;
}
QList<QMainWindow*>
GUIWrapper::GetOtherWindows() {
QList<QMainWindow*> windowNames;
QStringList names = gui->GetOtherWindowNames();
foreach(const QString& name, names) {
windowNames.push_back(GetOtherWindow(name));
}
return windowNames;
}
long
GUIWrapper::GetViewerProxyPtr()
{
......
......@@ -73,9 +73,11 @@ public:
QMainWindow* GetMainWindow();
QApplication* GetApp();
int GetPlotWindowSize();
QMainWindow* GetPlotWindow(int index);
QMainWindow* GetPlotWindow(const QString& name);
int GetOperatorWindowSize();
QMainWindow* GetOperatorWindow(int index);
QMainWindow* GetOperatorWindow(const QString& name);
......@@ -115,7 +117,12 @@ public:
QMainWindow* GetOtherWindow(const QString& name);
//QMainWindow* GetPlotManagerWindow() { return gui->GetPlotManagerWindow(); }
/// Get list of all windows
QList<QMainWindow*> GetPlotWindows();
QList<QMainWindow*> GetOperatorWindows();
QList<QMainWindow*> GetOtherWindows();
//QMainWindow* GetPlotManagerWindow(){ return gui->GetPlotManagerWindow(); }
QMainWindow* GetSourceManagerWindow();
......
......@@ -52,6 +52,12 @@ public:
QStringList GetOtherWindowNames();
QMainWindow* GetOtherWindow(const QString& name);
QMainWindow* GetSourceManagerWindow();
QMainWindow* GetTimeSliderWindow();
QList<QMainWindow*> GetPlotWindows();
QList<QMainWindow*> GetOperatorWindows();
QList<QMainWindow*> GetOtherWindows();
long GetViewerProxyPtr();
};
......
......@@ -61,7 +61,7 @@ try:
except ImportError:
pass
__all__ = ["LaunchPyViewer","SetupTimer","GetRenderWindow","GetRenderWindowIds","GetUIWindow","GetPlotWindow","GetOperatorWindow", "GetOtherWindow", "GetOtherWindowNames"]
__all__ = ["LaunchPyViewer","SetupTimer","GetRenderWindow","GetRenderWindowIds","GetUIWindow","GetPlotWindow","GetOperatorWindow", "GetOtherWindow", "GetOtherWindowNames", "GetTimeSliderWindow", "GetSourceManagerWindow", "GetPlotWindows", "GetOperatorWindows", "GetOtherWindows"]
__pyside_viewer_instance__ = None
# this is a function that polls for keyboard input,
......@@ -139,8 +139,7 @@ def GetRenderWindow(i):
inst = GetPySideViewerInstance()
if not inst is None:
return inst.GetRenderWindow(i)
else:
return None
return None
def GetRenderWindowIds():
if using_pyside:
......@@ -148,8 +147,7 @@ def GetRenderWindowIds():
inst = GetPySideViewerInstance()
if not inst is None:
return inst.GetRenderWindowIDs()
else:
return None
return None
def GetUIWindow():
if using_pyside:
......@@ -157,8 +155,7 @@ def GetUIWindow():
inst = GetPySideViewerInstance()
if not inst is None:
return inst.GetUIWindow()
else:
return None
return None
def GetPlotWindow(name):
if using_pyside:
......@@ -166,8 +163,7 @@ def GetPlotWindow(name):
inst = GetPySideViewerInstance()
if not inst is None:
return inst.GetPlotWindow(name)
else:
return None
return None
def GetOperatorWindow(name):
if using_pyside:
......@@ -175,8 +171,7 @@ def GetOperatorWindow(name):
inst = GetPySideViewerInstance()
if not inst is None:
return inst.GetOperatorWindow(name)
else:
return None
return None
def GetOtherWindow(name):
if using_pyside:
......@@ -184,8 +179,7 @@ def GetOtherWindow(name):
inst = GetPySideViewerInstance()
if not inst is None:
return inst.GetOtherWindow(name)
else:
return None
return None
def GetOtherWindowNames():
if using_pyside:
......@@ -193,6 +187,45 @@ def GetOtherWindowNames():
inst = GetPySideViewerInstance()
if not inst is None:
return inst.GetOtherWindowNames()
else:
return None
return None
def GetTimeSliderWindow():
if using_pyside:
# this will return None, unless properly inited
inst = GetPySideViewerInstance()
if not inst is None:
return inst.GetTimeSliderWindow()
return None
def GetSourceManagerWindow():
if using_pyside:
# this will return None, unless properly inited
inst = GetPySideViewerInstance()
if not inst is None:
return inst.GetSourceManagerWindow()
return None
def GetPlotWindows():
if using_pyside:
# this will return None, unless properly inited
inst = GetPySideViewerInstance()
if not inst is None:
return inst.GetPlotWindows()
return None
def GetOperatorWindows():
if using_pyside:
# this will return None, unless properly inited
inst = GetPySideViewerInstance()
if not inst is None:
return inst.GetOperatorWindows()
return None
def GetOtherWindows():
if using_pyside:
# this will return None, unless properly inited
inst = GetPySideViewerInstance()
if not inst is None:
return inst.GetOtherWindows()
return None
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