Commit 4d918efb authored by hkrishna's avatar hkrishna

adding temporary fix for synchronizing Python and Qt event

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@22841 18c085ea-50e0-402c-830e-de6fd14e8384
parent c653d2e8
......@@ -18649,8 +18649,23 @@ Synchronize()
// Return if the thread initialization failed.
// or if viewer is embedded
if(!moduleUseThreads || viewerEmbedded)
if(!moduleUseThreads) {
return 0;
}
if(viewerEmbedded) {
SyncAttributes *syncAtts = GetViewerState()->GetSyncAttributes();
syncAtts->SetSyncTag(syncCount);
syncAtts->Notify();
syncAtts->SetSyncTag(-1);
/// should only run once?
while(syncCount != syncAtts->GetSyncTag()) {
PyRun_SimpleString("visit.__VisIt_PySide_Idle_Hook__()");
}
syncCount++;
return 0;
}
//
// If the 2nd thread is not running, don't enter this method or we'll
......
......@@ -63,9 +63,33 @@ from evalfuncs import *
from writescript import *
try:
import PySide
import pyside_hook
import pyside_gui
import pyside_support
class KeyPressEater(PySide.QtCore.QObject):
def eventFilter(self, obj, event):
if event.type() == PySide.QtCore.QEvent.KeyPress:
return True
elif event.type() == PySide.QtCore.QEvent.MouseButtonPress:
return True
elif event.type() == PySide.QtCore.QEvent.MouseButtonRelease:
return True
elif event.type() == PySide.QtCore.QEvent.MouseButtonDblClick:
return True
elif event.type() == PySide.QtCore.QEvent.MouseMove:
return True
else:
return PySide.QtCore.QObject.eventFilter(self, obj, event)
def __VisIt_PySide_Idle_Hook__():
a = KeyPressEater()
app = PySide.QtCore.QEventLoop();
PySide.QtCore.QCoreApplication.instance().installEventFilter(a)
app.processEvents(PySide.QtCore.QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents);
PySide.QtCore.QCoreApplication.instance().removeEventFilter(a)
def IsPySideViewerEnabled(): return True
except ImportError:
def IsPySideViewerEnabled(): return False
......
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