From e80e7f7fa6716eb79a74468182f1161ae5121298 Mon Sep 17 00:00:00 2001 From: mkr Date: Mon, 20 Mar 2006 14:00:27 +0000 Subject: [PATCH] 1) Fix for bug PAL6276 : QtCanvas: "Error"(Can't Set Input Value) message box doesn't appear for the incorrect input for the MacroNode. 2) Fix for bug PAL7037 : "Filter Notification" functionality doesn't work. --- src/SUPERVGUI/SUPERVGUI.cxx | 33 +++++++++++++++++++++++ src/SUPERVGUI/SUPERVGUI.h | 7 +++++ src/SUPERVGUI/SUPERVGUI_BrowseNodeDlg.cxx | 30 ++++++++++++++++++--- src/SUPERVGUI/SUPERVGUI_Information.cxx | 11 ++++++-- src/SUPERVGUI/SUPERVGUI_Notification.cxx | 9 ++++++- 5 files changed, 83 insertions(+), 7 deletions(-) diff --git a/src/SUPERVGUI/SUPERVGUI.cxx b/src/SUPERVGUI/SUPERVGUI.cxx index 2442a96..dce6074 100644 --- a/src/SUPERVGUI/SUPERVGUI.cxx +++ b/src/SUPERVGUI/SUPERVGUI.cxx @@ -538,6 +538,22 @@ void SUPERVGUI::renameDataflow() { updateObjBrowser(); //QApplication::restoreOverrideCursor(); + + // mkr : PAL7037 => rename engine of the graph (i.e. corresponding SUPERV_Graph) --> + if ( obj->FindAttribute(anAttr, "AttributeIOR") ) { + _PTR(AttributeIOR) anIOR ( anAttr ); + SUPERV_Graph aDataFlow = engine->getGraph(anIOR->Value().c_str()); + if ( !SUPERV_isNull(aDataFlow) ) { + if ( aDataFlow->IsStreamGraph() ) { + SUPERV_StreamGraph aStreamDataFlow = aDataFlow->ToStreamGraph(); + if ( !SUPERV_isNull(aStreamDataFlow) ) + aStreamDataFlow->SetName( nm.latin1() ); + } + else + aDataFlow->SetName( nm.latin1() ); + } + } + // mkr : PAL7037 <-- } } } @@ -1023,3 +1039,20 @@ void SUPERVGUI::fillInterfaceNameMap() { QMap SUPERVGUI::getInterfaceNameMap() const { return myInterfaceNameMap; } + +bool SUPERVGUI::updateDataFlowSOName( SUPERV::Graph_ptr theDataflow ) { + if ( !SUPERV_isNull(theDataflow) ) { + _PTR(Study) aStudy = (( SalomeApp_Study* )study)->studyDS(); + _PTR(SObject) aSO ( aStudy->FindObjectIOR( theDataflow->getIOR() ) ); + + _PTR(GenericAttribute) anAttr; + if ( aSO ) // i.e. if theDataflow is in study + if ( aSO->FindAttribute(anAttr, "AttributeName") ) { + _PTR(AttributeName) aName ( anAttr ); + aName->SetValue( theDataflow->Name() ); + updateObjBrowser(); + return true; + } + } + return false; +} diff --git a/src/SUPERVGUI/SUPERVGUI.h b/src/SUPERVGUI/SUPERVGUI.h index 2092a9f..803043e 100644 --- a/src/SUPERVGUI/SUPERVGUI.h +++ b/src/SUPERVGUI/SUPERVGUI.h @@ -122,6 +122,13 @@ class SUPERVGUI: public SalomeApp_Module { QColor getIVFBackgroundColor() { return myIVFBackgroundColor; } void setIVFBackgroundColor( QColor theColor ) { if ( myInitialViewFrame ) myIVFBackgroundColor = theColor; } + // mkr : PAL7037 + /*! + * \brief The method update name of the given dataflow, if this dataflow is in study. + * Returns true if update was done. + */ + bool updateDataFlowSOName( SUPERV::Graph_ptr theDataflow ); + signals: void KillMainThread(bool theValue); diff --git a/src/SUPERVGUI/SUPERVGUI_BrowseNodeDlg.cxx b/src/SUPERVGUI/SUPERVGUI_BrowseNodeDlg.cxx index 54cf5fa..6d05fb7 100644 --- a/src/SUPERVGUI/SUPERVGUI_BrowseNodeDlg.cxx +++ b/src/SUPERVGUI/SUPERVGUI_BrowseNodeDlg.cxx @@ -44,7 +44,7 @@ SUPERVGUI_PortField::SUPERVGUI_PortField( QWidget* theParent, SUPERV_Port thePor QString aLabelTxt(myPort->Name()); - SUPERV_CNode aNode = myPort->Node(); + /*SUPERV_CNode aNode = myPort->Node(); SALOME_ModuleCatalog::Service* aService = aNode->Service(); SALOME_ModuleCatalog::ListOfServicesParameter aList; aList = (myPort->IsInput())? aService->ServiceinParameter : aService->ServiceoutParameter; @@ -55,8 +55,12 @@ SUPERVGUI_PortField::SUPERVGUI_PortField( QWidget* theParent, SUPERV_Port thePor break; } } - - aLabelTxt += QString(":"); + aLabelTxt += QString(":");*/ + + // mkr : the following way is easyer to get ports' type than commented above + QString aPortType = QString(myPort->Type()); + aLabelTxt += QString(" (") + aPortType + QString("):"); + myLabel = new QLabel(aLabelTxt, theParent ); myValue = new QLineEdit( theParent ); @@ -67,7 +71,25 @@ SUPERVGUI_PortField::SUPERVGUI_PortField( QWidget* theParent, SUPERV_Port thePor aPalette.setInactive(aPalette.disabled()); aPalette.setActive(aPalette.disabled()); myValue->setPalette(aPalette); - } + } + // mkr : PAL6276 --> + else { + if ( !aPortType.compare(QString("boolean")) ) + myValue->setValidator( new QIntValidator( 0, 1, theParent ) ); + + if ( !aPortType.compare(QString("short")) || !aPortType.compare(QString("int")) || !aPortType.compare(QString("long")) ) + myValue->setValidator( new QIntValidator( theParent ) ); + + if ( !aPortType.compare(QString("float")) || !aPortType.compare(QString("double")) ) + myValue->setValidator( new QDoubleValidator( theParent ) ); + + if ( !aPortType.compare(QString("char")) ) { + QRegExp aRX( "." ); + myValue->setValidator( new QRegExpValidator( aRX, theParent ) ); + + } + } + // mkr : PAL6276 <-- myValue->installEventFilter( this ); } diff --git a/src/SUPERVGUI/SUPERVGUI_Information.cxx b/src/SUPERVGUI/SUPERVGUI_Information.cxx index d747448..7452268 100644 --- a/src/SUPERVGUI/SUPERVGUI_Information.cxx +++ b/src/SUPERVGUI/SUPERVGUI_Information.cxx @@ -26,6 +26,7 @@ // Module : SUPERV #include "SUPERVGUI_Information.h" +#include "SUPERVGUI.h" #include "CAM_Application.h" #include "SUIT_Desktop.h" @@ -36,7 +37,6 @@ #include #include - /*! Constructor */ @@ -278,11 +278,18 @@ void SUPERVGUI_Information::okButton() { Trace("SUPERVGUI_Information::okButton"); //mkr : modifications for fixing bug IPAL9972 bool aIsAccept = true; - if ( QString( myNode->Name() ).compare( nameV->text() ) != 0 ) + if ( QString( myNode->Name() ).compare( nameV->text() ) != 0 ) { if ( !myNode->SetName( nameV->text().latin1()) ) { QMessageBox::warning( SUIT_Session::session()->activeApplication()->desktop(), tr( "ERROR" ), tr( "MSG_CANT_RENAMENODE" ) ); aIsAccept = false; } + // mkr : PAL7037 => update dataflow name in object browser if this dialog called for the dataflow and the dataflow is in study --> + if ( myNode->IsGraph() || myNode->IsStreamGraph() ) { + SUPERVGUI* aSupMod = SUPERVGUI::Supervision(); + if ( aSupMod ) aSupMod->updateDataFlowSOName(SUPERV::Graph::_narrow(myNode)); + } + // mkr : PAL7037 <-- + } myNode->SetAuthor( authV->text().latin1() ); if (myNode->IsFactory()) { SUPERV_FNode aFNode = SUPERV::FNode::_narrow(myNode); diff --git a/src/SUPERVGUI/SUPERVGUI_Notification.cxx b/src/SUPERVGUI/SUPERVGUI_Notification.cxx index 7d1e7ef..94e98a3 100644 --- a/src/SUPERVGUI/SUPERVGUI_Notification.cxx +++ b/src/SUPERVGUI/SUPERVGUI_Notification.cxx @@ -94,7 +94,14 @@ SUPERVGUI_Notification::SUPERVGUI_Notification( SUPERVGUI_Main* m ) myMainNotif->setVerbose( false ); /* nodes notification */ - QObjectList* ihmList = myMain->/*getGraph()->*/queryList( "SUPERVGUI_CanvasNode" ); + // mkr : PAL7037 --> + //QObjectList* ihmList = myMain->/*getGraph()->*/queryList( "SUPERVGUI_CanvasNode" ); + QObjectList* ihmList; + if ( myMain->getViewType() == CANVASTABLE ) + ihmList = myMain->getCanvasArray()->queryList( "SUPERVGUI_CanvasNode" ); + else + ihmList = myMain->getCanvas()->queryList( "SUPERVGUI_CanvasNode" ); + // mkr : PAL7037 <-- QObjectListIt i( *ihmList ); SUPERVGUI_CanvasNode* theNode; while ( ( theNode = ( ( SUPERVGUI_CanvasNode* )i.current() ) ) != 0) { -- 2.39.2