Salome HOME
1) Fix for bug PAL6276 : QtCanvas: "Error"(Can't Set Input Value) message box doesn... OCC_3_2_0a2_TC
authormkr <mkr@opencascade.com>
Mon, 20 Mar 2006 14:00:27 +0000 (14:00 +0000)
committermkr <mkr@opencascade.com>
Mon, 20 Mar 2006 14:00:27 +0000 (14:00 +0000)
2) Fix for bug PAL7037 : "Filter Notification" functionality doesn't work.

src/SUPERVGUI/SUPERVGUI.cxx
src/SUPERVGUI/SUPERVGUI.h
src/SUPERVGUI/SUPERVGUI_BrowseNodeDlg.cxx
src/SUPERVGUI/SUPERVGUI_Information.cxx
src/SUPERVGUI/SUPERVGUI_Notification.cxx

index 2442a9678132e3718b2dcb28396e6b0a3b5b889e..dce6074b55f62a538ddf1d45ea3ad188233909e2 100644 (file)
@@ -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<QString, QString> 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;
+}
index 2092a9f526ec74f7382da45f8b8062b7f09f4386..803043e2b0b6c48e1a43200a1b047614825a1916 100644 (file)
@@ -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);
 
index 54cf5fa61d8bdafcbbb7e45159759d2cbf1adbfb..6d05fb711da36b5e9e0208eacb0539b643fcaf38 100644 (file)
@@ -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 );
 }
 
index d7474486e0e938f8e12743c4b3d7ced4deda63f7..745226885816a9b25b20d71b50a2516bd20265dd 100644 (file)
@@ -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 <qgroupbox.h>
 #include <qlayout.h>
 
-
 /*!
   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);
index 7d1e7eff9848e8e495894045fb597f5b2bdf7fb7..94e98a3692a63cf4de5237eff565b00df0891c1b 100644 (file)
@@ -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) {