Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/gui.git] / src / SUITApp / SUITApp_Application.cxx
index 4639f100d79933cce38cbf6c192eed56eca62494..bf32979dea0b74650c171d9529389c82b1573c04 100644 (file)
@@ -18,6 +18,7 @@
 //
 #include "SUITApp_Application.h"
 
+#include "SUIT_Session.h"
 #include "SUIT_MessageBox.h"
 #include "SUIT_ExceptionHandler.h"
 
@@ -68,6 +69,20 @@ myExceptHandler( hand )
 */
 bool SUITApp_Application::notify( QObject* receiver, QEvent* e )
 {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) < 0x060101
+  // Disable GUI user actions while python command is executed
+  if (SUIT_Session::IsPythonExecuted()) {
+    // Disable mouse and keyboard events
+    QEvent::Type aType = e->type();
+    if (aType == QEvent::MouseButtonPress || aType == QEvent::MouseButtonRelease ||
+        aType == QEvent::MouseButtonDblClick || aType == QEvent::MouseMove ||
+        aType == QEvent::Wheel || aType == QEvent::ContextMenu ||
+        aType == QEvent::KeyPress || aType == QEvent::KeyRelease ||
+        aType == QEvent::Accel || aType == QEvent::AccelOverride)
+      return false;
+  }
+#endif
+
   return myExceptHandler ? myExceptHandler->handle( receiver, e ) :
                            QApplication::notify( receiver, e );
 }