Salome HOME
Update object browser after put in study the result of Geometry
[modules/superv.git] / src / SUPERVGUI / SUPERVGUI_Main.cxx
index ad484dd39574c1c19a910ee7a5ad06afd7f31049..d5e4e3f26f62ea021ce0e85207c9523f0121e057 100644 (file)
@@ -963,6 +963,8 @@ void SUPERVGUI_Main::addDataflowToStudy() {
 bool SUPERVGUI_Main::putDataStudy( SUPERV_Port p, const char* inout ) {
   Trace("SUPERVGUI_Main::putDataStudy");
 
+  bool PublishOtherComponent = false;
+
   // static variable to ensure that only one instance (thread) is executing this function 
   static bool isIn = false;
   if (isIn)   return true; 
@@ -1042,6 +1044,7 @@ bool SUPERVGUI_Main::putDataStudy( SUPERV_Port p, const char* inout ) {
            if ( !aSStudy ) return false;
            aTmpSO = aDriver->PublishInStudy( aSStudy->GetStudy(), aTmpSO, anObject, "" );
            aBuilder->Addreference(aSO, _PTR(SObject)(new SALOMEDS_SObject( aTmpSO )) );
+           PublishOtherComponent = true;
          } 
          else { // can't publish object: abort transaction
            MESSAGE( "CanPublishInStudy() returned FALSE.  ok, AbortCommand.." );
@@ -1078,14 +1081,18 @@ bool SUPERVGUI_Main::putDataStudy( SUPERV_Port p, const char* inout ) {
     aBuilder->CommitCommand();
   else
     aBuilder->AbortCommand();
-  
-  if ( !myThread->running() ) {
+
+  if ( p->State() == SUPERV::ReadyState ) {
     SUPERVGUI* aSupMod = SUPERVGUI::Supervision();
-    if ( aSupMod ) 
-      aSupMod->updateObjBrowser();
+    if ( aSupMod ) {
+      if ( PublishOtherComponent )
+       dynamic_cast<SalomeApp_Application*>( study->application() )->updateObjectBrowser(true);
+      else
+       aSupMod->updateObjBrowser();
+    }
     else MESSAGE("NULL Supervision module!");
   }
-
+  
   isIn = false;
   return true;
 }
@@ -1121,14 +1128,14 @@ void SUPERVGUI_Main::syncNotification() {
   long  stamp;
   
   while (notification->Receive(&graph, &node, &type, &message, &sender, &counter, &date, &stamp)) {
-    if (isFiltered(graph, node, type, message, sender, counter, date, stamp)) {
+//    if (isFiltered(graph, node, type, message, sender, counter, date, stamp)) {
       QString mess("");
       mess += "NOTIF: "; mess += graph;
       mess += " / "    ; mess += node;
       mess += " / "    ; mess += type;
       mess += " / "    ; mess += message;
       getMessage()->putMessage(mess.latin1());
-    };
+//    };
   };
 }
   
@@ -1337,6 +1344,9 @@ void SUPERVGUI_Thread::run()
     // blocking function of Engine.  Return from there only after anEvent happens on node aNode
     myMain->getDataflow()->Event(aNode, aEvent, aState);
     
+    // in case node "said" something during changing state through notification mechanism - output it
+    myMain->syncNotification();
+    
     // "kill" or undefined event came
     if (( aEvent == SUPERV::UndefinedEvent && aState == SUPERV::UndefinedState ) ||
        ( aEvent == SUPERV::NoEvent && aState == SUPERV::NoState ) ||