From fd2dd5b28c3efc737bb395b216ab34d4cbc5c5dd Mon Sep 17 00:00:00 2001 From: mkr Date: Wed, 13 Jul 2005 10:10:10 +0000 Subject: [PATCH] Update object browser after put in study the result of Geometry or GEOM_Superv node execution. Modifications in syncNotification() function and calling it in SUPERVGUI_Thread::run() function. --- src/SUPERVGUI/SUPERVGUI_Main.cxx | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/SUPERVGUI/SUPERVGUI_Main.cxx b/src/SUPERVGUI/SUPERVGUI_Main.cxx index ad484dd..d5e4e3f 100644 --- a/src/SUPERVGUI/SUPERVGUI_Main.cxx +++ b/src/SUPERVGUI/SUPERVGUI_Main.cxx @@ -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( 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 ) || -- 2.39.2