From b0ecd61d385f9eb924f633456a7b444dba1bfe77 Mon Sep 17 00:00:00 2001 From: smh Date: Tue, 7 Feb 2006 15:13:39 +0000 Subject: [PATCH] Merge from OCC_development_generic_2006 Preparation of 3.2.0a1 --- idl/SUPERV.idl | 8 +- src/GraphBase/DataFlowBase_ComputingNode.cxx | 13 +- src/GraphBase/DataFlowBase_ComputingNode.hxx | 2 +- src/GraphEditor/DataFlowEditor_DataFlow.lxx | 15 +- src/GraphEditor/DataFlowEditor_InNode.hxx | 4 +- src/GraphEditor/DataFlowEditor_OutNode.cxx | 15 +- src/SUPERVGUI/Makefile.in | 4 +- src/SUPERVGUI/SUPERVGUI.cxx | 14 +- src/SUPERVGUI/SUPERVGUI_ArrayView.cxx | 54 +++++- src/SUPERVGUI/SUPERVGUI_BrowseNodeDlg.cxx | 10 +- src/SUPERVGUI/SUPERVGUI_BrowseNodeDlg.h | 5 +- src/SUPERVGUI/SUPERVGUI_Canvas.cxx | 1 - src/SUPERVGUI/SUPERVGUI_Canvas.h | 1 - src/SUPERVGUI/SUPERVGUI_CanvasArray.cxx | 3 - src/SUPERVGUI/SUPERVGUI_CanvasArray.h | 1 - src/SUPERVGUI/SUPERVGUI_CanvasCellNodePrs.h | 1 - src/SUPERVGUI/SUPERVGUI_CanvasControlNode.cxx | 1 - src/SUPERVGUI/SUPERVGUI_CanvasControlNode.h | 1 - .../SUPERVGUI_CanvasControlNodePrs.cxx | 2 - .../SUPERVGUI_CanvasControlNodePrs.h | 1 - src/SUPERVGUI/SUPERVGUI_CanvasLink.cxx | 25 ++- src/SUPERVGUI/SUPERVGUI_CanvasLink.h | 6 +- src/SUPERVGUI/SUPERVGUI_CanvasNode.cxx | 27 ++- src/SUPERVGUI/SUPERVGUI_CanvasNode.h | 8 +- src/SUPERVGUI/SUPERVGUI_CanvasNodePrs.cxx | 24 ++- src/SUPERVGUI/SUPERVGUI_CanvasNodePrs.h | 1 - src/SUPERVGUI/SUPERVGUI_CanvasPort.cxx | 7 +- src/SUPERVGUI/SUPERVGUI_CanvasPort.h | 4 +- src/SUPERVGUI/SUPERVGUI_CanvasView.cxx | 13 +- src/SUPERVGUI/SUPERVGUI_CanvasView.h | 3 + src/SUPERVGUI/SUPERVGUI_Clipboard.cxx | 5 +- src/SUPERVGUI/SUPERVGUI_Def.h | 3 +- src/SUPERVGUI/SUPERVGUI_Information.cxx | 1 - src/SUPERVGUI/SUPERVGUI_Information.h | 1 - src/SUPERVGUI/SUPERVGUI_Library.cxx | 34 +++- src/SUPERVGUI/SUPERVGUI_Main.cxx | 70 ++++++-- src/SUPERVGUI/SUPERVGUI_Main.h | 17 +- src/SUPERVGUI/SUPERVGUI_ManagePortsDlg.cxx | 159 ++++++++++++++++-- src/SUPERVGUI/SUPERVGUI_ManagePortsDlg.h | 7 + src/SUPERVGUI/SUPERVGUI_Notification.cxx | 2 - src/SUPERVGUI/SUPERVGUI_Notification.h | 1 - src/SUPERVGUI/SUPERVGUI_Selection.h | 1 - src/SUPERVGUI/SUPERVGUI_Service.cxx | 9 +- src/SUPERVGUI/SUPERVGUI_Service.h | 1 - src/SUPERVGUI/SUPERV_images.po | 3 + src/SUPERVGUI/SUPERV_msg_en.po | 10 +- src/Supervision/CNode_Impl.cxx | 37 +++- src/Supervision/CNode_Impl.hxx | 6 +- src/Supervision/FNode_Impl.cxx | 7 +- src/Supervision/FNode_Impl.hxx | 6 +- src/Supervision/Graph_Impl.cxx | 26 ++- src/Supervision/Graph_Impl.hxx | 3 +- src/Supervision/Port_Impl.cxx | 2 +- src/Supervision/SuperV.py | 19 ++- src/Supervision/batchmode_SuperV.py | 19 ++- 55 files changed, 576 insertions(+), 147 deletions(-) diff --git a/idl/SUPERV.idl b/idl/SUPERV.idl index f4502eb..ce99fb0 100644 --- a/idl/SUPERV.idl +++ b/idl/SUPERV.idl @@ -631,6 +631,11 @@ the component from the container, which will be called for execution of the calc \param aContainer Container containing the component. */ boolean SetContainer(in string aContainer ) ; +/*! Method to define if %FNode gets from a component, which is implemented in C++ or Python. + Returns True if it's a C++ component node +*/ + boolean IsCimpl() ; + } ; /*! \brief %INode class @@ -778,7 +783,8 @@ This interface includes a set of methods used for management of the graphs in %S */ SUPERV::FNode FNode( in string aComponentName , in string anInterfaceName , - in SALOME_ModuleCatalog::Service aService ) ; + in SALOME_ModuleCatalog::Service aService , + in boolean isCimpl ) ; /*! Creates an InLine Node in a Graph. */ diff --git a/src/GraphBase/DataFlowBase_ComputingNode.cxx b/src/GraphBase/DataFlowBase_ComputingNode.cxx index f5203ff..d8c606e 100644 --- a/src/GraphBase/DataFlowBase_ComputingNode.cxx +++ b/src/GraphBase/DataFlowBase_ComputingNode.cxx @@ -333,11 +333,15 @@ void GraphBase::ComputingNode::NodePort( const char * NodeName , } } -bool GraphBase::ComputingNode::IsLinked(const char * ToServiceParameterName ) { +bool GraphBase::ComputingNode::IsLinked(const char * ToServiceParameterName, bool isInput ) { bool RetVal = false ; - const GraphBase::InPort * thePort = GetInPort( ToServiceParameterName ) ; - if ( thePort ) { - RetVal = thePort->IsPortConnected() ; + if ( isInput ) { // mkr : PAL8060 + // we have to know the type of the port, because of input and output ports + // belong to one node may have the same names + const GraphBase::InPort * thePort = GetInPort( ToServiceParameterName ) ; + if ( thePort ) { + RetVal = thePort->IsPortConnected() ; + } } else { const GraphBase::OutPort * thePort = GetOutPort( ToServiceParameterName ) ; @@ -462,6 +466,7 @@ void GraphBase::ComputingNode::UpdateMacroPorts( GraphBase::Graph * aGraph ) { cdebug << "UpdateMacroPorts DelInPort In" << i << " " << GetNodeInPort( i )->PortName() << " " << GetNodeInPort( i )->PortType() << " " << GetNodeInPort( i )->Kind() << endl ; DelInPort( GetNodeInPort( i )->PortName() ) ; + i--; // mkr : fix for bug PAL8004 } } int index ; diff --git a/src/GraphBase/DataFlowBase_ComputingNode.hxx b/src/GraphBase/DataFlowBase_ComputingNode.hxx index 76b84f4..9770303 100644 --- a/src/GraphBase/DataFlowBase_ComputingNode.hxx +++ b/src/GraphBase/DataFlowBase_ComputingNode.hxx @@ -183,7 +183,7 @@ namespace GraphBase { const char * ServiceParameterName , char ** aNode , char ** aPort ) ; - bool IsLinked(const char * ToServiceParameterName ) ; + bool IsLinked(const char * ToServiceParameterName, bool isInput ) ; // mkr : PAL8060 bool HasInput(const char * ToServiceParameterName ) ; GraphBase::SNode * GetInfo() ; diff --git a/src/GraphEditor/DataFlowEditor_DataFlow.lxx b/src/GraphEditor/DataFlowEditor_DataFlow.lxx index d793893..24f63f6 100644 --- a/src/GraphEditor/DataFlowEditor_DataFlow.lxx +++ b/src/GraphEditor/DataFlowEditor_DataFlow.lxx @@ -476,7 +476,11 @@ inline bool GraphEditor::DataFlow::IsReadOnly() { inline long GraphEditor::DataFlow::LevelMax() { // if ( !IsValid( false ) ) { - if ( !IsExecutable() ) { +// if ( !IsExecutable() ) { + // mkr : IPAL9974 --> + int SubStreamGraphsNumber = 0 ; + if ( !IsValid() || !Graph()->Sort( SubStreamGraphsNumber ) ) { + // mkr : IPAL9974 <-- return 0 ; } return Graph()->LevelMax() ; @@ -484,7 +488,8 @@ inline long GraphEditor::DataFlow::LevelMax() { inline SUPERV::ListOfStrings * GraphEditor::DataFlow::LevelNodes(long aLevel ) { // if ( !IsValid( false ) ) { - if ( !IsExecutable() ) { +// if ( !IsExecutable() ) { + if ( !IsValid() ) { // mkr : IPAL9974 return ((SUPERV::ListOfStrings * ) NULL ) ; } return Graph()->LevelNodes( aLevel ) ; @@ -492,7 +497,11 @@ inline SUPERV::ListOfStrings * GraphEditor::DataFlow::LevelNodes(long aLevel ) { inline long GraphEditor::DataFlow::ThreadsMax() { // if ( !IsValid() ) { - if ( !IsExecutable() ) { +// if ( !IsExecutable() ) { + // mkr : IPAL9974 --> + int SubStreamGraphsNumber = 0 ; + if ( !IsValid() || !Graph()->Sort( SubStreamGraphsNumber ) ) { + // mkr : IPAL9974 <-- return 0 ; } return Graph()->ThreadsMax() ; diff --git a/src/GraphEditor/DataFlowEditor_InNode.hxx b/src/GraphEditor/DataFlowEditor_InNode.hxx index 0bb2a91..9a6bac5 100644 --- a/src/GraphEditor/DataFlowEditor_InNode.hxx +++ b/src/GraphEditor/DataFlowEditor_InNode.hxx @@ -222,8 +222,8 @@ namespace GraphEditor { void DelOutPort( const char * OutputParameterName ) { _ComputingNode->DelOutPort( OutputParameterName ) ; } ; - bool IsLinked(const char * ToServiceParameterName ) { - return _ComputingNode->IsLinked( ToServiceParameterName ) ; } ; + bool IsLinked(const char * ToServiceParameterName, bool isInput ) { + return _ComputingNode->IsLinked( ToServiceParameterName, isInput ) ; } ; // mkr : PAL8060 bool HasInput(const char * ToServiceParameterName ) { return _ComputingNode->HasInput( ToServiceParameterName ) ; } ; diff --git a/src/GraphEditor/DataFlowEditor_OutNode.cxx b/src/GraphEditor/DataFlowEditor_OutNode.cxx index 5221b4f..52d6601 100644 --- a/src/GraphEditor/DataFlowEditor_OutNode.cxx +++ b/src/GraphEditor/DataFlowEditor_OutNode.cxx @@ -36,14 +36,11 @@ using namespace std; map< string , int > _MapOfGraphNames; string GraphInstanceName( const char * aGraphName ) { + // mkr : PAL8004 --> + // For Macro nodes : names of subgraphs must be unique and differ from the main dataflow + // name (i.e. the dataflow with MacroLevel = 0). + // It is neccessary for reqursive call of LoadDataFlows(...) method for MacroNodes execution. int GraphInstanceNumber = _MapOfGraphNames[ aGraphName ] ; - if ( GraphInstanceNumber ) { - _MapOfGraphNames[ aGraphName ] = GraphInstanceNumber + 1 ; - } - else { - GraphInstanceNumber = 0 ; - _MapOfGraphNames[ aGraphName ] = GraphInstanceNumber + 1 ; - } string theGraphInstanceName = string( aGraphName ) ; if ( GraphInstanceNumber ) { theGraphInstanceName += "_" ; @@ -51,6 +48,10 @@ string GraphInstanceName( const char * aGraphName ) { astr << GraphInstanceNumber ; theGraphInstanceName += astr.str() ; } + if ( theGraphInstanceName != string( aGraphName ) ) + _MapOfGraphNames[ theGraphInstanceName ] = GraphInstanceNumber ; + _MapOfGraphNames[ aGraphName ] = GraphInstanceNumber + 1 ; + // mkr : PAL8004 <-- return theGraphInstanceName ; } diff --git a/src/SUPERVGUI/Makefile.in b/src/SUPERVGUI/Makefile.in index 0655a87..465b18d 100644 --- a/src/SUPERVGUI/Makefile.in +++ b/src/SUPERVGUI/Makefile.in @@ -68,7 +68,7 @@ LIB_SRC = SUPERVGUI.cxx \ SUPERVGUI_Notification.cxx \ SUPERVGUI_ManagePortsDlg.cxx \ SUPERVGUI_Library.cxx \ - SUPERVGUI_Clipboard.cxx + SUPERVGUI_Clipboard.cxx LIB_MOC = SUPERVGUI.h \ SUPERVGUI_ArrayView.h \ @@ -86,7 +86,7 @@ LIB_MOC = SUPERVGUI.h \ SUPERVGUI_Notification.h \ SUPERVGUI_ManagePortsDlg.h \ SUPERVGUI_Library.h \ - SUPERVGUI_Clipboard.h + SUPERVGUI_Clipboard.h LIB_CLIENT_IDL = SALOMEDS.idl \ SALOMEDS_Attributes.idl \ diff --git a/src/SUPERVGUI/SUPERVGUI.cxx b/src/SUPERVGUI/SUPERVGUI.cxx index 35c1474..4f75dfb 100644 --- a/src/SUPERVGUI/SUPERVGUI.cxx +++ b/src/SUPERVGUI/SUPERVGUI.cxx @@ -25,16 +25,10 @@ // Author : Francis KLOSS // Module : SUPERV -using namespace std; #include "SUPERVGUI.h" #include "SUPERVGUI_DataModel.h" #include "SUPERVGUI_Selection.h" - -#include "SALOMEDSClient.hxx" -#include -using namespace boost; - #include "CAM_Application.h" #include "OB_Browser.h" #include "OB_ListItem.h" @@ -63,6 +57,10 @@ using namespace boost; #include #include +#include "SALOMEDSClient.hxx" +#include +using namespace boost; + int SUPERVGUI::factory = 0; extern "C" { @@ -489,6 +487,8 @@ void SUPERVGUI::displayDataflow() { else { // second case : get empty initial view frame as new ViewFrame object aViewFrame = myInitialViewFrame; + // mkr : PAL8237 : remove first "gag" Main from children + aViewFrame->removeChild( aViewFrame->queryList("SUPERVGUI_Main")->first() ); } if( aViewFrame ) { @@ -678,6 +678,8 @@ bool SUPERVGUI::createDataflow( const NEW_DF_MODE mode, bool theInitialDF ) { else { // 2. get empty initial view frame as new ViewFrame object aViewFrame = myInitialViewFrame; + // mkr : PAL8237 : remove first "gag" Main from children + aViewFrame->removeChild( aViewFrame->queryList("SUPERVGUI_Main")->first() ); } if ( aViewFrame ) { diff --git a/src/SUPERVGUI/SUPERVGUI_ArrayView.cxx b/src/SUPERVGUI/SUPERVGUI_ArrayView.cxx index 08477e5..772ce27 100644 --- a/src/SUPERVGUI/SUPERVGUI_ArrayView.cxx +++ b/src/SUPERVGUI/SUPERVGUI_ArrayView.cxx @@ -6,12 +6,12 @@ // Author : // Module : SUPERV - -using namespace std; #include "SUPERVGUI.h" #include "SUPERVGUI_ArrayView.h" #include "SUPERVGUI_Main.h" #include "SUPERVGUI_CanvasCellNodePrs.h" +#include "SUPERVGUI_CanvasLink.h" +#include "SUPERVGUI_CanvasPort.h" #include @@ -192,25 +192,63 @@ void SUPERVGUI_ToolTip::maybeTip(const QPoint& theP) { // compute collision rectangle QRect aSel(theP.x()-MARGIN, theP.y()-MARGIN, 1+2*MARGIN, 1+2*MARGIN); - QCanvasItemList l = ((SUPERVGUI_ArrayView*)parentWidget())->canvas()->collisions(aSel); + QCanvasItemList l = ((QCanvasView*)parentWidget())->canvas()->collisions(aSel); for (QCanvasItemList::Iterator it = l.begin(); it != l.end(); ++it) { + // tooltip for node if ((*it)->rtti() == SUPERVGUI_Canvas::Rtti_Node) { - SUPERVGUI_CanvasCellNodePrs* aNodePrs = (SUPERVGUI_CanvasCellNodePrs*) (*it); + SUPERVGUI_CanvasNodePrs* aNodePrs = (SUPERVGUI_CanvasNodePrs*) (*it); QObject* anObj = aNodePrs->getObject(theP); - if (anObj->inherits("SUPERVGUI_CanvasCellNode")) { + if (anObj->inherits("SUPERVGUI_CanvasNode")) { QRect aTitleRect = aNodePrs->getTitleRect(); + QRect aLabelRect = aNodePrs->getLabelRect(); + QRect aStatusRect = aNodePrs->getStatusRect(); + + if (aTitleRect.bottom()+1 == aLabelRect.top() && + aLabelRect.bottom()+1 == aStatusRect.top()) { + QRect aTipRect(aTitleRect.left(), aTitleRect.top(), aTitleRect.width(), + aTitleRect.height() + aLabelRect.height() + aStatusRect.height()); + tip(aTipRect, ((SUPERVGUI_CanvasNode*)anObj)->getToolTipText()); + return; + } + if (aTitleRect.contains(theP, true)) { - tip(aTitleRect, ((SUPERVGUI_CanvasCellNode*)anObj)->getEngine()->Name()); + tip(aTitleRect, ((SUPERVGUI_CanvasNode*)anObj)->getToolTipText()); return; } - QRect aLabelRect = aNodePrs->getLabelRect(); if (aLabelRect.contains(theP, true)) { - tip(aLabelRect, ((SUPERVGUI_CanvasCellNode*)anObj)->getLabelText()); + tip(aLabelRect, ((SUPERVGUI_CanvasNode*)anObj)->getToolTipText()); return; } + + if (aStatusRect.contains(theP, true)) { + tip(aStatusRect, ((SUPERVGUI_CanvasNode*)anObj)->getToolTipText()); + return; + } + } + // tooltip for nodes' port + if (anObj->inherits("SUPERVGUI_CanvasPort")) { + SUPERVGUI_CanvasPort* aPort = (SUPERVGUI_CanvasPort*)anObj; + tip(aPort->getPrs()->getPortRect(), + aPort->getEngine()->Type() + QString(" ") + aPort->getPrs()->getText()); + return; + } + } + // tootip for links' point + if ((*it)->rtti() == SUPERVGUI_Canvas::Rtti_LinkPoint) { + SUPERVGUI_CanvasPointPrs* aPrs = (SUPERVGUI_CanvasPointPrs*) (*it); + if (aPrs->getLink()->getMain()->getViewType() == CANVAS) + tip(aSel, aPrs->getLink()->getToolTipText()); + return; + } + // tooltip for links' edge + if ((*it)->rtti() == SUPERVGUI_Canvas::Rtti_LinkEdge) { + SUPERVGUI_CanvasEdgePrs* aPrs = (SUPERVGUI_CanvasEdgePrs*) (*it); + if (aPrs->getLink()->getMain()->getViewType() == CANVAS) + tip(aSel, aPrs->getLink()->getToolTipText()); + return; } } } diff --git a/src/SUPERVGUI/SUPERVGUI_BrowseNodeDlg.cxx b/src/SUPERVGUI/SUPERVGUI_BrowseNodeDlg.cxx index 334b7c3..54cf5fa 100644 --- a/src/SUPERVGUI/SUPERVGUI_BrowseNodeDlg.cxx +++ b/src/SUPERVGUI/SUPERVGUI_BrowseNodeDlg.cxx @@ -8,13 +8,9 @@ // Author : Vitaly SMETANNIKOV // Module : SUPERV -using namespace std; - #include "SALOMEDSClient.hxx" #include "SALOMEDS_SObject.hxx" #include "SALOMEDS_Study.hxx" -#include -using namespace boost; #include "SalomeApp_Application.h" #include "LightApp_SelectionMgr.h" @@ -36,6 +32,9 @@ using namespace boost; #include #include +#include +using namespace boost; + /** * Constructor */ @@ -216,7 +215,8 @@ SUPERVGUI_BrowseNodeDlg::~SUPERVGUI_BrowseNodeDlg() { void SUPERVGUI_BrowseNodeDlg::setValues() { SUPERVGUI_PortField* aField; for ( aField = myPortsList.first(); aField; aField = myPortsList.next() ) { - aField->updateGUI(); + if ( aField->getData().isEmpty() || aField->getData().isNull() ) // mkr : PAL11406 + aField->updateGUI(); } } diff --git a/src/SUPERVGUI/SUPERVGUI_BrowseNodeDlg.h b/src/SUPERVGUI/SUPERVGUI_BrowseNodeDlg.h index 19563ce..b22fda2 100644 --- a/src/SUPERVGUI/SUPERVGUI_BrowseNodeDlg.h +++ b/src/SUPERVGUI/SUPERVGUI_BrowseNodeDlg.h @@ -29,8 +29,9 @@ public: bool isEditable () { return myIsEditable; } - void setData( const QString& data ) { myValue->setText( data ); myValue->home( false ); } - void updateGUI() { myValue->setText( myPort->ToString() ); } + QString getData() const { return myValue->text(); } // mkr : PAL11406 + void setData( const QString& data ) { myValue->setText( data ); myValue->home( false ); } + void updateGUI() { myValue->setText( myPort->ToString() ); } bool setNewValue(); diff --git a/src/SUPERVGUI/SUPERVGUI_Canvas.cxx b/src/SUPERVGUI/SUPERVGUI_Canvas.cxx index 776849d..56e41fd 100644 --- a/src/SUPERVGUI/SUPERVGUI_Canvas.cxx +++ b/src/SUPERVGUI/SUPERVGUI_Canvas.cxx @@ -6,7 +6,6 @@ // Author : Natalia KOPNOVA // Module : SUPERV -using namespace std; #include "SUPERVGUI.h" #include "SUPERVGUI_Def.h" #include "SUPERVGUI_Main.h" diff --git a/src/SUPERVGUI/SUPERVGUI_Canvas.h b/src/SUPERVGUI/SUPERVGUI_Canvas.h index 32c01aa..f9f523c 100644 --- a/src/SUPERVGUI/SUPERVGUI_Canvas.h +++ b/src/SUPERVGUI/SUPERVGUI_Canvas.h @@ -9,7 +9,6 @@ #ifndef SUPERVGUI_Canvas_H #define SUPERVGUI_Canvas_H -using namespace std; #include "SUPERVGUI_Def.h" #include diff --git a/src/SUPERVGUI/SUPERVGUI_CanvasArray.cxx b/src/SUPERVGUI/SUPERVGUI_CanvasArray.cxx index 19d07d2..07e07ce 100644 --- a/src/SUPERVGUI/SUPERVGUI_CanvasArray.cxx +++ b/src/SUPERVGUI/SUPERVGUI_CanvasArray.cxx @@ -6,7 +6,6 @@ // Author : // Module : SUPERV -using namespace std; #include "SUPERVGUI.h" #include "SUPERVGUI_CanvasArray.h" #include "SUPERVGUI_Main.h" @@ -148,9 +147,7 @@ bool SUPERVGUI_CanvasArray::create() { int x, y; int nligs = myMain->getDataflow()->LevelMax(); - cout<<"-> myMain->getDataflow()->LevelMax() = "<getDataflow()->LevelMax()<getDataflow()->ThreadsMax(); - cout<<"-> myMain->getDataflow()->ThreadsMax() = "<getDataflow()->ThreadsMax()< diff --git a/src/SUPERVGUI/SUPERVGUI_CanvasControlNodePrs.cxx b/src/SUPERVGUI/SUPERVGUI_CanvasControlNodePrs.cxx index c8b00f6..f51649b 100644 --- a/src/SUPERVGUI/SUPERVGUI_CanvasControlNodePrs.cxx +++ b/src/SUPERVGUI/SUPERVGUI_CanvasControlNodePrs.cxx @@ -6,8 +6,6 @@ // Author : Natalia KOPNOVA // Module : SUPERV - -using namespace std; #include "SUPERVGUI_CanvasControlNodePrs.h" #include "SUPERVGUI_CanvasControlNode.h" #include "SUPERVGUI_Canvas.h" diff --git a/src/SUPERVGUI/SUPERVGUI_CanvasControlNodePrs.h b/src/SUPERVGUI/SUPERVGUI_CanvasControlNodePrs.h index 536833d..5b0bb97 100644 --- a/src/SUPERVGUI/SUPERVGUI_CanvasControlNodePrs.h +++ b/src/SUPERVGUI/SUPERVGUI_CanvasControlNodePrs.h @@ -9,7 +9,6 @@ #ifndef SUPERVGUI_CanvasControlNodePrs_H #define SUPERVGUI_CanvasControlNodePrs_H -using namespace std; #include "SUPERVGUI_Def.h" #include "SUPERVGUI_CanvasNodePrs.h" diff --git a/src/SUPERVGUI/SUPERVGUI_CanvasLink.cxx b/src/SUPERVGUI/SUPERVGUI_CanvasLink.cxx index 955d3b8..a58cbb5 100644 --- a/src/SUPERVGUI/SUPERVGUI_CanvasLink.cxx +++ b/src/SUPERVGUI/SUPERVGUI_CanvasLink.cxx @@ -6,7 +6,6 @@ // Author : Natalia KOPNOVA // Module : SUPERV -using namespace std; #include "SUPERVGUI_CanvasLink.h" #include "SUPERVGUI_Canvas.h" #include "SUPERVGUI_CanvasPort.h" @@ -52,6 +51,9 @@ SUPERVGUI_CanvasLink::SUPERVGUI_CanvasLink(QObject* theParent, SUPERVGUI_Main* t else myColor = DRAW_COLOR; } + + // mkr : PAL8237 + connect(this, SIGNAL(objectCreatedDeleted()), myMain, SLOT(onObjectCreatedDeleted())); } SUPERVGUI_CanvasLink::~SUPERVGUI_CanvasLink() @@ -231,7 +233,10 @@ void SUPERVGUI_CanvasLink::remove() { } } myLink->destroy(); + + emit objectCreatedDeleted(); // mkr : PAL8237 } + delete this; if (aPort && !aValue.isEmpty() && myMain->getDataflow()->GraphLevel() == 0) { aPort->setValue(aValue); @@ -254,8 +259,10 @@ void SUPERVGUI_CanvasLink::addPoint() { anIndex = aPoint->getIndex()+1; if (anIndex < 1) anIndex = 1; } - if (myLink && !SUPERV_isNull(myLink)) + if (myLink && !SUPERV_isNull(myLink)) { myLink->AddCoord(anIndex, mySelectedPoint.x(), mySelectedPoint.y()); + emit objectCreatedDeleted(); // mkr : PAL8237 + } merge(); myMain->getCanvas()->update(); } @@ -264,13 +271,25 @@ void SUPERVGUI_CanvasLink::addPoint() { void SUPERVGUI_CanvasLink::removePoint() { if (mySelectedItem && mySelectedItem->rtti() == SUPERVGUI_Canvas::Rtti_LinkPoint) { SUPERVGUI_CanvasPointPrs* aPoint = (SUPERVGUI_CanvasPointPrs*) mySelectedItem; - if (myLink && !SUPERV_isNull(myLink)) + if (myLink && !SUPERV_isNull(myLink)) { myLink->RemoveCoord(aPoint->getIndex()); + emit objectCreatedDeleted(); // mkr : PAL8237 + } merge(); myMain->getCanvas()->update(); } } +QString SUPERVGUI_CanvasLink::getToolTipText() const { + QString aTTT; + if (myInputPort && myOutputPort) + aTTT = myOutputPort->getEngine()->Node()->Name() + QString(" : ") + + myOutputPort->getEngine()->Name() + QString(" => ") + + myInputPort->getEngine()->Node()->Name() + QString(" : ") + + myInputPort->getEngine()->Name(); + return aTTT; +} + /* //=============================================================================== // SUPERVGUI_CanvasStreamLink: new link to be created diff --git a/src/SUPERVGUI/SUPERVGUI_CanvasLink.h b/src/SUPERVGUI/SUPERVGUI_CanvasLink.h index 3865950..f9592af 100644 --- a/src/SUPERVGUI/SUPERVGUI_CanvasLink.h +++ b/src/SUPERVGUI/SUPERVGUI_CanvasLink.h @@ -9,7 +9,6 @@ #ifndef SUPERVGUI_CanvasLink_H #define SUPERVGUI_CanvasLink_H -using namespace std; #include "SUPERVGUI_Def.h" #include #include @@ -42,6 +41,11 @@ class SUPERVGUI_CanvasLink : public QObject { void setSelectedObject(QCanvasItem* theItem, const QPoint& thePoint); virtual QPopupMenu* getPopupMenu(QWidget* theParent); + QString getToolTipText() const; + + signals: + void objectCreatedDeleted(); // mkr : PAL8237 + public slots: virtual void remove(); void addPoint(); diff --git a/src/SUPERVGUI/SUPERVGUI_CanvasNode.cxx b/src/SUPERVGUI/SUPERVGUI_CanvasNode.cxx index 66bf49b..cd3a955 100644 --- a/src/SUPERVGUI/SUPERVGUI_CanvasNode.cxx +++ b/src/SUPERVGUI/SUPERVGUI_CanvasNode.cxx @@ -6,7 +6,6 @@ // Author : Natalia KOPNOVA // Module : SUPERV -using namespace std; #include "SUPERVGUI_CanvasNode.h" #include "SUPERVGUI_CanvasNodePrs.h" #include "SUPERVGUI_CanvasPort.h" @@ -77,6 +76,10 @@ SUPERVGUI_CanvasNode::SUPERVGUI_CanvasNode( SUIT_ResourceMgr* mgr, QObject* theP } isIgnore = false; + + // mkr : PAL8237 + connect(this, SIGNAL(objectCreatedDeleted()), myMain, SLOT(onObjectCreatedDeleted())); + emit objectCreatedDeleted(); } SUPERVGUI_CanvasNode::~SUPERVGUI_CanvasNode() @@ -105,6 +108,14 @@ SUPERVGUI_CanvasNodePrs* SUPERVGUI_CanvasNode::getPrs() SUPERVGUI_CanvasNodePrs* SUPERVGUI_CanvasNode::createPrs() const { + // + //SUPERVGUI_PrsNode* glNode = new SUPERVGUI_PrsNode( (SUPERVGUI_CanvasNode*)this ); + //glNode->setFirstPoint( new GLViewer_Pnt( 10, 10 ) ); + //glNode->compute(); + //glNode->update(); + //getGLContext()->insertObject( glNode, true /*false*/ ); + // + return new SUPERVGUI_CanvasNodePrs( myMgr, myMain->getCanvas(), (SUPERVGUI_CanvasNode*)this); } @@ -119,6 +130,8 @@ void SUPERVGUI_CanvasNode::createPort(SUPERV::Port_ptr thePort) if (aPort) { connect(aPort, SIGNAL(destroyed(QObject*)), this, SLOT(onDestroyed(QObject*))); if (!isIgnore) getPrs()->updatePorts(); + + emit objectCreatedDeleted(); // mkr : PAL8237 } } @@ -386,6 +399,9 @@ void SUPERVGUI_CanvasNode::remove() { SUPERVGUI_Canvas* aCanvas = myMain->getCanvas(); setDestroyed(); myNode->destroy(); + + emit objectCreatedDeleted(); // mkr : PAL8237 + delete this; aCanvas->update(); } @@ -681,3 +697,12 @@ void SUPERVGUI_CanvasNode::exportToLib() { else SUIT_MessageBox::error1( SUIT_Session::session()->activeApplication()->desktop(), tr( "ERROR" ), tr( "MSG_BAD_INODE" ), tr( "OK" ) ); } + +QString SUPERVGUI_CanvasNode::getToolTipText() const { + if ( myNode->IsFactory() ) + return QString("Name : ") + SUPERV::FNode::_narrow(myNode)->Name() + + QString("\nContainer : ") + SUPERV::FNode::_narrow(myNode)->GetContainer() + + QString("\nComponentName : ") + SUPERV::FNode::_narrow(myNode)->GetComponentName() + + QString("\nInterfaceName : ") + SUPERV::FNode::_narrow(myNode)->GetInterfaceName(); + return QString("Name : ") + myNode->Name() + '\n' + getLabelText(); +} diff --git a/src/SUPERVGUI/SUPERVGUI_CanvasNode.h b/src/SUPERVGUI/SUPERVGUI_CanvasNode.h index 0be086d..d34a654 100644 --- a/src/SUPERVGUI/SUPERVGUI_CanvasNode.h +++ b/src/SUPERVGUI/SUPERVGUI_CanvasNode.h @@ -9,7 +9,6 @@ #ifndef SUPERVGUI_CanvasNode_H #define SUPERVGUI_CanvasNode_H -using namespace std; #include "SUPERVGUI_Def.h" #include "SUPERVGUI_BrowseNodeDlg.h" #include @@ -72,6 +71,11 @@ class SUPERVGUI_CanvasNode : public QObject { QString getLabelText() const { return myLabelText; } + virtual QString getToolTipText() const; + + signals: + void objectCreatedDeleted(); // mkr : PAL8237 + public slots: void suspendResume(); void kill(); @@ -101,7 +105,7 @@ class SUPERVGUI_CanvasNode : public QObject { virtual void pastePort(); void managePorts(); void exportToLib(); - + protected: // redefined by most of CanvasNode successors virtual SUPERVGUI_CanvasNodePrs* createPrs() const; diff --git a/src/SUPERVGUI/SUPERVGUI_CanvasNodePrs.cxx b/src/SUPERVGUI/SUPERVGUI_CanvasNodePrs.cxx index d82abd2..6f03a18 100644 --- a/src/SUPERVGUI/SUPERVGUI_CanvasNodePrs.cxx +++ b/src/SUPERVGUI/SUPERVGUI_CanvasNodePrs.cxx @@ -6,12 +6,12 @@ // Author : Natalia KOPNOVA // Module : SUPERV -using namespace std; #include "SUPERVGUI_CanvasNodePrs.h" #include "SUPERVGUI_CanvasNode.h" #include "SUPERVGUI_CanvasPort.h" #include "SUPERVGUI_Canvas.h" #include "SUPERVGUI_CanvasCellNodePrs.h" +#include "SUPERVGUI_Main.h" #include "SUIT_ResourceMgr.h" @@ -21,7 +21,7 @@ using namespace std; #include #endif -#define PORT_MARGIN 2 +//#define PORT_MARGIN 2 #undef PORT_HEIGHT // to avoid warning message #define PORT_HEIGHT LABEL_HEIGHT #define TEXT_MARGIN 5 @@ -561,7 +561,8 @@ void SUPERVGUI_CanvasNodePrs::draw(QPainter& thePainter) { thePainter.setPen(pen()); thePainter.setBrush(nodeColor()); - drawShape(thePainter); + if ( !CORBA::is_nil( myNode->getMain()->getDataflow()->Node( myNode->name() ) ) ) // mkr : IPAL11360 + drawShape(thePainter); } void SUPERVGUI_CanvasNodePrs::drawShape(QPainter& thePainter) @@ -671,7 +672,12 @@ void SUPERVGUI_CanvasNodePrs::drawPort(QPainter& thePainter) ++it; if (obj->inherits("SUPERVGUI_CanvasPort")) { aPort = (SUPERVGUI_CanvasPort*) obj; - if (!aPort->getEngine()->IsGate()) { + + SUPERV_Port aPortEng = aPort->getEngine(); + // if ( CORBA::is_nil( aPortEng ) ) + // printf ( "---\n port engine IS NIL ---\n\n" ); + + if ( !CORBA::is_nil( aPortEng ) && !aPortEng->IsGate() ) { aPort->getPrs()->draw(thePainter); } } @@ -878,9 +884,13 @@ bool SUPERVGUI_CanvasPortPrs::isAlert() const QString SUPERVGUI_CanvasPortPrs::getText() const { SUPERV_Port aPort = myPort->getEngine(); - QString aText = aPort->Name(); - if (aPort->IsParam() || aPort->IsInLine() || myPort->isStream()) - aText = aText + "=" + aPort->ToString(); + QString aText; + if ( !CORBA::is_nil( aPort ) ) { + aText = aPort->Name(); + if (aPort->IsParam() || aPort->IsInLine() || myPort->isStream()) + aText = aText + "=" + aPort->ToString(); + } + // printf( "--- return text of port : %s ---\n", aText.latin1() ); return aText; } diff --git a/src/SUPERVGUI/SUPERVGUI_CanvasNodePrs.h b/src/SUPERVGUI/SUPERVGUI_CanvasNodePrs.h index b59bd15..dabf8cb 100644 --- a/src/SUPERVGUI/SUPERVGUI_CanvasNodePrs.h +++ b/src/SUPERVGUI/SUPERVGUI_CanvasNodePrs.h @@ -9,7 +9,6 @@ #ifndef SUPERVGUI_CanvasNodePrs_H #define SUPERVGUI_CanvasNodePrs_H -using namespace std; #include "SUPERVGUI_Def.h" #include diff --git a/src/SUPERVGUI/SUPERVGUI_CanvasPort.cxx b/src/SUPERVGUI/SUPERVGUI_CanvasPort.cxx index 8274ca9..2b8b0f5 100644 --- a/src/SUPERVGUI/SUPERVGUI_CanvasPort.cxx +++ b/src/SUPERVGUI/SUPERVGUI_CanvasPort.cxx @@ -6,7 +6,6 @@ // Author : Natalia KOPNOVA // Module : SUPERV -using namespace std; #include "SUPERVGUI_CanvasPort.h" #include "SUPERVGUI_CanvasNode.h" #include "SUPERVGUI_CanvasLink.h" @@ -29,6 +28,9 @@ SUPERVGUI_CanvasPort::SUPERVGUI_CanvasPort(QObject* theParent, SUPERVGUI_Main* t // setName(myPort->Name()); setName(myMain->getCanvas()->getPortName(thePort)); + + // mkr : PAL8237 + connect(this, SIGNAL(objectDeleted()), myMain, SLOT(onObjectCreatedDeleted())); } SUPERVGUI_CanvasPort::~SUPERVGUI_CanvasPort() @@ -138,6 +140,9 @@ void SUPERVGUI_CanvasPort::remove() { Trace("SUPERVGUI_CanvasPort::remove"); myPort->destroy(); + + emit objectDeleted(); // mkr : PAL8237 + delete this; } diff --git a/src/SUPERVGUI/SUPERVGUI_CanvasPort.h b/src/SUPERVGUI/SUPERVGUI_CanvasPort.h index 0d964ed..6ed5f5d 100644 --- a/src/SUPERVGUI/SUPERVGUI_CanvasPort.h +++ b/src/SUPERVGUI/SUPERVGUI_CanvasPort.h @@ -9,7 +9,6 @@ #ifndef SUPERVGUI_CanvasPort_H #define SUPERVGUI_CanvasPort_H -using namespace std; #include "SUPERVGUI_Def.h" @@ -42,6 +41,9 @@ class SUPERVGUI_CanvasPort : public QObject { void removeLink(SUPERVGUI_CanvasLink* theLink); void updateLinks(); + signals: + void objectDeleted(); // mkr : PAL8237 + public slots: void sketchLink(); virtual void remove(); diff --git a/src/SUPERVGUI/SUPERVGUI_CanvasView.cxx b/src/SUPERVGUI/SUPERVGUI_CanvasView.cxx index c336716..f2b54a7 100644 --- a/src/SUPERVGUI/SUPERVGUI_CanvasView.cxx +++ b/src/SUPERVGUI/SUPERVGUI_CanvasView.cxx @@ -8,8 +8,6 @@ // Author : Natalia KOPNOVA // Module : SUPERV -using namespace std; - #include "SUPERVGUI.h" #include "SUPERVGUI_CanvasView.h" #include "SUPERVGUI_Main.h" @@ -19,6 +17,8 @@ using namespace std; #include "SUPERVGUI_CanvasNodePrs.h" #include "SUPERVGUI_Clipboard.h" +#include "SUPERVGUI_ArrayView.h" //for tooltip testing + #include "SUIT_MessageBox.h" #include @@ -160,6 +160,9 @@ SUPERVGUI_CanvasView::SUPERVGUI_CanvasView(SUPERVGUI_Canvas* theCanvas, SUPERVGU myPopup->insertSeparator(); myShowToolBarItem = myPopup->insertItem( tr( "MEN_SHOW_TOOLBAR" ), myMain, SLOT( onShowToolbar() ) ); } + + // mkr : PAL8237 + connect(this, SIGNAL(objectCreated()), myMain, SLOT(onObjectCreatedDeleted())); } @@ -439,6 +442,10 @@ void SUPERVGUI_CanvasView::contentsMouseMoveEvent(QMouseEvent* theEvent) setHilighted(0); } + // QToolTip for title and label for SUPERVGUI_CanvasNode + SUPERVGUI_ToolTip* aTT = new SUPERVGUI_ToolTip(this); + aTT->maybeTip(p); + busy = false; } @@ -677,6 +684,8 @@ void SUPERVGUI_CanvasView::endSketch(SUPERVGUI_CanvasPort* thePort) SUPERVGUI_CanvasLink* aLink = new SUPERVGUI_CanvasLink(canvas(), myMain, aLinkEngine); aLink->show(); + emit objectCreated(); // mkr : PAL8237 + canvas()->update(); myIsLinkCreating = false; diff --git a/src/SUPERVGUI/SUPERVGUI_CanvasView.h b/src/SUPERVGUI/SUPERVGUI_CanvasView.h index feda501..082a6c7 100644 --- a/src/SUPERVGUI/SUPERVGUI_CanvasView.h +++ b/src/SUPERVGUI/SUPERVGUI_CanvasView.h @@ -37,6 +37,9 @@ class SUPERVGUI_CanvasView: public QCanvasView { bool isAnyLinkCreating() const { return myIsLinkCreating; } void startSketch(SUPERVGUI_CanvasPort* thePort); + signals: + void objectCreated(); // mkr : PAL8237 + public slots: void addToStudy(); void onTimeout(); diff --git a/src/SUPERVGUI/SUPERVGUI_Clipboard.cxx b/src/SUPERVGUI/SUPERVGUI_Clipboard.cxx index fab39c4..bffc222 100644 --- a/src/SUPERVGUI/SUPERVGUI_Clipboard.cxx +++ b/src/SUPERVGUI/SUPERVGUI_Clipboard.cxx @@ -158,8 +158,9 @@ void SUPERVGUI_Clipboard::pasteNode() { case SUPERV::FactoryNode : { SUPERV::FNode_var aFNode = dataflow->FNode( SUPERV::FNode::_narrow(aNode)->GetComponentName(), - SUPERV::FNode::_narrow(aNode)->GetInterfaceName(), - *SUPERV::FNode::_narrow(aNode)->Service() ); + SUPERV::FNode::_narrow(aNode)->GetInterfaceName(), + *SUPERV::FNode::_narrow(aNode)->Service(), + SUPERV::FNode::_narrow(aNode)->IsCimpl()); // mkr : PAL11273 if (CORBA::is_nil(aFNode)) { QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_CANT_CREATE_NODE")); return; diff --git a/src/SUPERVGUI/SUPERVGUI_Def.h b/src/SUPERVGUI/SUPERVGUI_Def.h index 1abc0b8..a78b457 100644 --- a/src/SUPERVGUI/SUPERVGUI_Def.h +++ b/src/SUPERVGUI/SUPERVGUI_Def.h @@ -79,7 +79,8 @@ NODE_Editing "", NODE_RED, NODE_GREEN, NODE_BLUE, true, false, true // ----- #define PORT_WIDTH 75 -#define PORT_HEIGHT 28 +#define PORT_HEIGHT 20 +#define PORT_MARGIN 2 // Taille des points carres constituant les lignes entre les noeuds // ---------------------------------------------------------------- diff --git a/src/SUPERVGUI/SUPERVGUI_Information.cxx b/src/SUPERVGUI/SUPERVGUI_Information.cxx index 2fda73a..d747448 100644 --- a/src/SUPERVGUI/SUPERVGUI_Information.cxx +++ b/src/SUPERVGUI/SUPERVGUI_Information.cxx @@ -25,7 +25,6 @@ // Author : Francis KLOSS // Module : SUPERV -using namespace std; #include "SUPERVGUI_Information.h" #include "CAM_Application.h" diff --git a/src/SUPERVGUI/SUPERVGUI_Information.h b/src/SUPERVGUI/SUPERVGUI_Information.h index 115b822..97e5ec1 100644 --- a/src/SUPERVGUI/SUPERVGUI_Information.h +++ b/src/SUPERVGUI/SUPERVGUI_Information.h @@ -25,7 +25,6 @@ // Author : Francis KLOSS // Module : SUPERV -using namespace std; #ifndef SUPERVGUI_Information_H #define SUPERVGUI_Information_H diff --git a/src/SUPERVGUI/SUPERVGUI_Library.cxx b/src/SUPERVGUI/SUPERVGUI_Library.cxx index 4af1b37..044f5de 100644 --- a/src/SUPERVGUI/SUPERVGUI_Library.cxx +++ b/src/SUPERVGUI/SUPERVGUI_Library.cxx @@ -101,8 +101,33 @@ bool SUPERVGUI_Library::createLibFile() const { return true; } else { - SUIT_MessageBox::error1( (QWidget*)(SUIT_Session::session()->activeApplication()->desktop()), tr( "ERROR" ), tr( "MSG_ERROR_LIB1" ), tr( "OK" ) ); - return false; // error opening library file for writing + // mkr : PAL8557 + QString aFullPath = GetLibraryFileName(); + QString aDir = aFullPath.left( aFullPath.findRev('/')+1 ); + const int toCreateDir = SUIT_MessageBox::warn2( (QWidget*)(SUIT_Session::session()->activeApplication()->desktop()), tr( "ERROR" ), + tr( "MSG_ERROR_LIB_DIR_NOT_EXIST_RECREATE" ).arg(aDir), tr( "BUT_YES" ), tr( "BUT_NO" ), 1, 0, 0 ); + if ( toCreateDir ) { // user selected to create a new ./salome subdirectory in HOME directory + + // create directory + QString aCommand = QString("mkdir ") + aDir; + int status = system( aCommand.latin1() ); + + if ( status == -1 || status == 217 ) { + SUIT_MessageBox::error1( (QWidget*)(SUIT_Session::session()->activeApplication()->desktop()), tr( "ERROR" ), tr( "MSG_ERROR_LIB_RECREATE_DIR" ).arg(aDir), tr( "OK" ) ); + return false; + } + + // create XML file + libFile.open( IO_WriteOnly | IO_Truncate ); + QDomDocument doc( DOCTYPE ); // create a simple XML stub + doc.appendChild( doc.createElement( ROOT_ELEMENT ) ); // IMPORTANT: do not delete this root element + QTextStream stream( &libFile ); + doc.save( stream, 0 ); + libFile.close(); + return true; + } + else // user chose not to create a new ./salome subdirectory in HOME directory + return false; } } catch ( ... ) { @@ -163,6 +188,11 @@ bool SUPERVGUI_Library::Export( SUPERV::INode_var theNode ) const { tr( "MSG_ERROR_LIB_IS_RECREATE" ), tr( "BUT_YES" ), tr( "BUT_NO" ), 1, 0, 0 ); if ( toRecreate ) { // user selected to recreate a bad XML file libFile.close(); // in case it was opened by doc.setContent() + + // remove old bad file + QString aCommand = QString("rm -f ") + libFile.name(); + system( aCommand.latin1() ); + if ( !createLibFile() ) return false; // error opening library file for writing. MB was already displayed diff --git a/src/SUPERVGUI/SUPERVGUI_Main.cxx b/src/SUPERVGUI/SUPERVGUI_Main.cxx index 3ffa305..49c4b88 100644 --- a/src/SUPERVGUI/SUPERVGUI_Main.cxx +++ b/src/SUPERVGUI/SUPERVGUI_Main.cxx @@ -25,17 +25,14 @@ // Author : Francis KLOSS // Module : SUPERV -using namespace std; - #include "SALOMEDSClient.hxx" #include "SALOMEDS_Study.hxx" #include "SALOMEDS_SObject.hxx" -#include -using namespace boost; #include "NOTIFICATION.hxx" #include "SALOME_Event.hxx" #include "SUPERVGraph_ViewFrame.h" +#include "SUPERVGraph_ViewModel.h" #include "LogWindow.h" #include "OB_Browser.h" @@ -65,7 +62,11 @@ using namespace boost; #include #include -SUPERVGUI_Main::SUPERVGUI_Main(SUPERVGraph_ViewFrame* theParent, SUIT_Desktop* theDesktop, SUPERV_Graph theDataFlow ) +#include +using namespace boost; + +SUPERVGUI_Main::SUPERVGUI_Main( SUPERVGraph_ViewFrame* theParent, + SUIT_Desktop* theDesktop, SUPERV_Graph theDataFlow ) : SUPERVGraph_View(theParent), myLogged( false ), myFiltered( false ), @@ -75,10 +76,11 @@ SUPERVGUI_Main::SUPERVGUI_Main(SUPERVGraph_ViewFrame* theParent, SUIT_Desktop* t myStep( false ), myTrace( false ), myVerbose( false ) - //myExecuted( false ) + //myExecuted( false ) { Trace("SUPERVGUI_Main::SUPERVGUI_Main (copy)"); - theParent->setViewWidget(this); + setFocusPolicy( StrongFocus ); // mkr : IPAL11388 + theParent->setViewWidget(this); dataflow = theDataFlow; if (SUPERV_isNull(dataflow)) { QMessageBox::warning(0, tr("ERROR"), tr("MSG_CANT_COPY")); @@ -86,6 +88,8 @@ SUPERVGUI_Main::SUPERVGUI_Main(SUPERVGraph_ViewFrame* theParent, SUIT_Desktop* t } else { init(theDesktop); } + // mkr : IPAL11362 + connect(this, SIGNAL(EventToSync()), this, SLOT(onObjectCreatedDeleted())); } void SUPERVGUI_Main::init(SUIT_Desktop* theDesktop) { @@ -271,13 +275,17 @@ void SUPERVGUI_Main::syncAsync() { void SUPERVGUI_Main::execute( char * theNodeName, SUPERV::GraphState theNodeState ) { if (myCurrentView == CANVAS || myCurrentView == CONTROLFLOW) { SUPERVGUI_CanvasNode* aNode = (SUPERVGUI_CanvasNode*) myCanvas->child(theNodeName, "SUPERVGUI_CanvasNode"); - if ( aNode ) + if ( aNode ) { aNode->sync(); + emit EventToSync(); // mkr : IPAL11362 + } } else if (myCurrentView == CANVASTABLE) { SUPERVGUI_CanvasCellNode* aNode = (SUPERVGUI_CanvasCellNode*) myArray->child(theNodeName, "SUPERVGUI_CanvasCellNode"); - if (aNode) + if (aNode) { aNode->sync(); + emit EventToSync(); // mkr : IPAL11362 + } } // asv : 26.01.05 : Bug PAL7164 : puting out-value to study if the "put_to_Study" flag is set on a @@ -556,6 +564,33 @@ void SUPERVGUI_Main::onShowToolbar() aVF->getToolBar()->show(); } +// mkr : PAL8237 : synchronize many views of the same dataflow (objects creation/deletion) +void SUPERVGUI_Main::onObjectCreatedDeleted() +{ + if ( study ) { + if ( STD_Application* app = dynamic_cast( study->application() ) ) { + ViewManagerList aVMList; + app->viewManagers( SUPERVGraph_Viewer::Type(), aVMList ); + SUIT_ViewManager* aVM; + for ( aVM = aVMList.first(); aVM; aVM = aVMList.next() ) { + QPtrVector aVWList = aVM->getViews(); + for ( int i = 0; i < aVWList.count(); i++ ) { + SUPERVGraph_ViewFrame* aVW = dynamic_cast( aVWList[i] ); + QObjectList* aMainList = aVW->queryList("SUPERVGUI_Main"); + if ( aMainList->count() == 1 ) { + SUPERVGUI_Main* aMain = dynamic_cast( aMainList->first() ); + if ( aMain ) + if ( !QString(aMain->getDataflow()->getIOR()).compare(getDataflow()->getIOR()) // equal dataflows + && + aMain != this ) // not equal mains + aMain->getCanvas()->merge(); + } + } + } + } + } +} + void SUPERVGUI_Main::run( const bool andSuspend ) { Trace("SUPERVGUI_Main::run"); if ( SUPERV_isNull(dataflow) ) @@ -570,7 +605,11 @@ void SUPERVGUI_Main::run( const bool andSuspend ) { QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_DF_NOTVALID") + QString(" : ") + QString(dataflow->Messages())); } else if (!dataflow->IsExecutable()) { - QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_DF_NOTEXECUTABLE") + QString(" : ") + QString(dataflow->Messages())); + QString aMessage = QString(dataflow->Messages()); + if ( aMessage.isEmpty() ) // mkr : IPAL11471 + QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_DF_NOTEXECUTABLE")); + else + QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_DF_NOTEXECUTABLE") + QString(" : ") + aMessage); } else if (myCanvasView->isAnyLinkCreating()) { QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_CRL_NOTCOMPLETE")); @@ -817,6 +856,7 @@ void SUPERVGUI_Main::showPopup(QPopupMenu* p, QMouseEvent* e) { //if (dataflow->IsExecuting()) return; CAM_Application* anApp = ( CAM_Application* )(SUIT_Session::session()->activeApplication()); + if ( !anApp->activeModule() ) return; if ( anApp->activeModule()->moduleName().compare( anApp->moduleTitle( "SUPERV" ) ) !=0 ) return; if (e->button() == RightButton) { @@ -1057,9 +1097,13 @@ bool SUPERVGUI_Main::putDataStudy( SUPERV_Port p, const char* inout ) { SALOMEDS::SObject_var aTmpSO;// = aSO; SALOMEDS_Study* aSStudy = dynamic_cast( aStudy.get() ); if ( !aSStudy ) return false; - aTmpSO = aDriver->PublishInStudy( aSStudy->GetStudy(), aTmpSO, anObject, "" ); - aBuilder->Addreference(aSO, _PTR(SObject)(new SALOMEDS_SObject( aTmpSO )) ); - PublishOtherComponent = true; + try { + aTmpSO = aDriver->PublishInStudy( aSStudy->GetStudy(), aTmpSO, anObject, "" ); + aBuilder->Addreference(aSO, _PTR(SObject)(new SALOMEDS_SObject( aTmpSO )) ); + PublishOtherComponent = true; + } + catch ( ... ) { // mkr : PAL8150 + } } else { // can't publish object: abort transaction MESSAGE( "CanPublishInStudy() returned FALSE. ok, AbortCommand.." ); diff --git a/src/SUPERVGUI/SUPERVGUI_Main.h b/src/SUPERVGUI/SUPERVGUI_Main.h index 5fde3ae..146c90f 100644 --- a/src/SUPERVGUI/SUPERVGUI_Main.h +++ b/src/SUPERVGUI/SUPERVGUI_Main.h @@ -137,6 +137,7 @@ class SUPERVGUI_Main: public SUPERVGraph_View { signals: void KillMyThread(bool theValue); + void EventToSync(); // mkr : IPAL11362 public slots: void execute(char * theNodeNode, SUPERV::GraphState theNodeState); @@ -158,6 +159,8 @@ class SUPERVGUI_Main: public SUPERVGraph_View { void onSubGraphActivated( SUIT_ViewWindow* ); void onShowToolbar(); + + void onObjectCreatedDeleted(); // mkr : PAL8237 private slots: void chooseData(QListViewItem* item); @@ -172,12 +175,12 @@ class SUPERVGUI_Main: public SUPERVGraph_View { SUPERV_Graph dataflow; QMap mySubGraphs; - QMap mySubGraphMap; - SUIT_ViewWindow* myLastGraph; + QMap mySubGraphMap; + SUIT_ViewWindow* myLastGraph; - SUIT_Study* study; - OB_Browser* objectBrowser; - LogWindow* message; + SUIT_Study* study; + OB_Browser* objectBrowser; + LogWindow* message; GraphViewType myCurrentView; SUPERVGUI_CanvasArray* myArray; @@ -209,8 +212,8 @@ class SUPERVGUI_Main: public SUPERVGraph_View { SUPERVGUI_Thread* myThread; - QPtrList< char * > myEventNodes ; - QPtrList< SUPERV::GraphState > myStates ; + QPtrList myEventNodes ; + QPtrList myStates ; QTimer* myTimer; }; diff --git a/src/SUPERVGUI/SUPERVGUI_ManagePortsDlg.cxx b/src/SUPERVGUI/SUPERVGUI_ManagePortsDlg.cxx index fb4c557..bbf2d1e 100644 --- a/src/SUPERVGUI/SUPERVGUI_ManagePortsDlg.cxx +++ b/src/SUPERVGUI/SUPERVGUI_ManagePortsDlg.cxx @@ -8,8 +8,6 @@ // Author : Alexander SLADKOV // Module : SUPERV -using namespace std; - #include "SUIT_Desktop.h" #include "SUIT_Session.h" @@ -17,7 +15,7 @@ using namespace std; #include "SUPERVGUI_CanvasNode.h" #include "SUPERVGUI_CanvasPort.h" #include "SUPERVGUI_CanvasControlNode.h" -#include "SUPERVGUI.h" +#include "SUPERVGUI_CanvasLink.h" #include #include @@ -294,6 +292,33 @@ void SUPERVGUI_ManagePortsDlg::init() SUPERVGUI_ManagePortsDlg::~SUPERVGUI_ManagePortsDlg() { } +// mkr : PAL8060 +void SUPERVGUI_ManagePortsDlg::createLinkEngine( SUPERV::Port_ptr thePort, + QValueList< QPair< QString,QString > >& theOwnList, + QValueList< QPair< QString,QString > >& theCorrespList ) { + // pair for the given port + QPair anOwnPair(QString(thePort->Node()->Name()), QString(thePort->Name())); + int aNum = theOwnList.contains(anOwnPair); + while ( aNum > 0 ) { + int anId = theOwnList.findIndex(anOwnPair); // get index in theOwnList + QPair aCorrespPair = theCorrespList[anId]; // corresponding pair in theCorrespList + + theOwnList.remove(theOwnList.at(anId)); + theCorrespList.remove(theCorrespList.at(anId)); + + SUPERV_Port aCorrespPort = myNode->getMain()->getDataflow()->Node(aCorrespPair.first)->Port(aCorrespPair.second); + SUPERV_Link aLinkEngine; + if ( thePort->IsInput() ) + aLinkEngine = myNode->getMain()->getDataflow()->Link(aCorrespPort, thePort); + else + aLinkEngine = myNode->getMain()->getDataflow()->Link(thePort, aCorrespPort); + SUPERVGUI_CanvasLink* aLink = new SUPERVGUI_CanvasLink(myNode->getMain()->getCanvas(), myNode->getMain(), aLinkEngine); + aLink->show(); + + aNum--; + } +} + /** * Set the ports as entered by user (order, name/type, etc.) and close the dialog */ @@ -314,14 +339,61 @@ void SUPERVGUI_ManagePortsDlg::accept() { // automatically removes the corresponding Output Port. So for Loops the // oldPorts list should be filtered to include only Input Ports. // But I'll filter Gate-s as well.. + bool isAnyLinked = false; // check if any port from old ports is linked + // map PortName <-> (PortType, PortInputValue) for non linked input ports, which have input + QMap< QString, QPair< QString,QString > > InNameInput; QObjectList portsToRemove; while ( (obj = it.current()) != 0 ) { ++it; SUPERV::Port_var aPort = ((SUPERVGUI_CanvasPort*)obj)->getEngine(); - if ( !aPort->IsGate() && ( !isLoop || aPort->IsInput() ) ) + if ( !aPort->IsGate() && ( !isLoop || aPort->IsInput() ) ) { portsToRemove.append( obj ); + } + // check if port has a link (output porst of Loop node are also checked) + if ( !aPort->IsGate() && aPort->IsLinked() && !isAnyLinked) + isAnyLinked = true; + // check if input port has an input value + if ( !aPort->IsGate() && aPort->IsInput() && aPort->HasInput() ) + InNameInput.insert( QString(aPort->Name()), + QPair(QString(aPort->Type()),QString(aPort->ToString())) ); } delete oldPorts; // delete the list, not the objects + + // mkr : PAL8060 --> + QString aNodeName = myNode->getEngine()->Name(); + QValueList< QPair< QString,QString > > InPortsL, OutPortsL; + if ( isAnyLinked ) { + // if myNode has linked port(s), create two lists of In/Out ports (InPortsL, OutPortsL) to identify all links for myNode + QObjectList* list = myNode->getMain()->getCanvas()->queryList("SUPERVGUI_CanvasLink"); + QObjectListIt listit( *list ); + QObject *listobj; + while ( (listobj = listit.current()) != 0 ) { + ++listit; + SUPERV::Link_var aLink = ((SUPERVGUI_CanvasLink*)listobj)->getEngine(); + if ( aNodeName.compare(aLink->InPort()->Node()->Name()) == 0 + || + aNodeName.compare(aLink->OutPort()->Node()->Name()) == 0 ) { + QPair InPair(QString(aLink->InPort()->Node()->Name()), QString(aLink->InPort()->Name())); + QPair OutPair(QString(aLink->OutPort()->Node()->Name()), QString(aLink->OutPort()->Name())); + InPortsL.append(InPair); + OutPortsL.append(OutPair); + } + + if ( isLoop ) { + // put into In/Out lists all links for corresponding EndLoop node + QString aCoupledNodeName = ((SUPERVGUI_CanvasStartNode*)myNode)->getCoupled()->getEngine()->Name(); + if ( aCoupledNodeName.compare(aLink->InPort()->Node()->Name()) == 0 + || + aCoupledNodeName.compare(aLink->OutPort()->Node()->Name()) == 0 ) { + QPair InPair(QString(aLink->InPort()->Node()->Name()), QString(aLink->InPort()->Name())); + QPair OutPair(QString(aLink->OutPort()->Node()->Name()), QString(aLink->OutPort()->Name())); + InPortsL.append(InPair); + OutPortsL.append(OutPair); + } + } + } + } + // mkr : PAL8060 <-- // portsToRemove list contains: // for Loop node: all INPUT ports except Gates @@ -338,19 +410,78 @@ void SUPERVGUI_ManagePortsDlg::accept() { for ( i = 0; i < myInList->count(); i++ ) { item = (PortListItem*)myInList->item( i ); aPort = aINode->InPort( item->PortName.latin1(), item->PortType.latin1() ); - myNode->createPort( aPort.in() ); + if ( InNameInput.contains( item->PortName ) + && + item->PortType.compare(InNameInput[item->PortName].first) == 0 ) { + // i.e. aPort is input and had a value (not linked!) + // if ports' name and type didn't change and ports had an input value => set this value again + SUPERVGUI* aSupMod = SUPERVGUI::Supervision(); + if ( aSupMod ) + aPort->Input( aSupMod->getEngine()->StringValue( InNameInput[item->PortName].second ) ); + myNode->createPort( aPort.in() ); + } + else { + myNode->createPort( aPort.in() ); + // mkr : PAL8060 + if ( !InPortsL.isEmpty() && !OutPortsL.isEmpty() ) + // create links for those input ports, which had links earlier + createLinkEngine( aPort, InPortsL, OutPortsL ); + } + } + + if ( isLoop ) { // asv : 11.01.05 : for Loop nodes do the same as in SUPERVGUI_CanvasStartNode::addInputPort() - if ( isLoop ) { - SUPERVGUI_CanvasStartNode* aStartLoopNode = (SUPERVGUI_CanvasStartNode*)myNode; - aStartLoopNode->merge(); - aStartLoopNode->getCoupled()->merge(); + SUPERVGUI_CanvasStartNode* aStartLoopNode = (SUPERVGUI_CanvasStartNode*)myNode; + aStartLoopNode->merge(); + aStartLoopNode->getCoupled()->merge(); + + // mkr : PAL8060 --> + if ( !InPortsL.isEmpty() && !OutPortsL.isEmpty() ) { + + // 1) create old links for output ports of Loop node + QObjectList* aPortsOut = aStartLoopNode->queryList("SUPERVGUI_CanvasPortOut"); + QObjectListIt aPorstOutit( *aPortsOut ); + QObject *listobj; + while ( (listobj = aPorstOutit.current()) != 0 ) { + ++aPorstOutit; + + SUPERV::Port_var aPortOut = ((SUPERVGUI_CanvasPort*)listobj)->getEngine(); + createLinkEngine( aPortOut, OutPortsL, InPortsL ); + } + + // 2) create old links for input ports of EndLoop node + QObjectList* aPortsIn = aStartLoopNode->getCoupled()->queryList("SUPERVGUI_CanvasPortIn"); + QObjectListIt aPorstInit( *aPortsIn ); + while ( (listobj = aPorstInit.current()) != 0 ) { + ++aPorstInit; + + SUPERV::Port_var aPortIn = ((SUPERVGUI_CanvasPort*)listobj)->getEngine(); + createLinkEngine( aPortIn, InPortsL, OutPortsL ); + } + + // 3) create old links for output ports of EndLoop node + aPortsOut = aStartLoopNode->getCoupled()->queryList("SUPERVGUI_CanvasPortOut"); + aPorstOutit = QObjectListIt( *aPortsOut ); + while ( (listobj = aPorstOutit.current()) != 0 ) { + ++aPorstOutit; + + SUPERV::Port_var aPortOut = ((SUPERVGUI_CanvasPort*)listobj)->getEngine(); + createLinkEngine( aPortOut, OutPortsL, InPortsL ); + } } + // mkr : PAL8060 <-- } + // creating Out-ports, except LoopNode-s for ( i = 0; i < myOutList->count() && !isLoop; i++ ) { item = (PortListItem*)myOutList->item( i ); aPort = aINode->OutPort( item->PortName.latin1(), item->PortType.latin1() ); myNode->createPort( aPort.in() ); + + // mkr : PAL8060 + if ( !InPortsL.isEmpty() && !OutPortsL.isEmpty() ) + // create links for those output ports, which had links earlier + createLinkEngine( aPort, OutPortsL, InPortsL ); } // 2. update the node's presentation @@ -397,16 +528,20 @@ void SUPERVGUI_ManagePortsDlg::init( const SUPERVGUI_CanvasNode* theNode ) { // 1. fill myTypeCombo with all available types myTypeCombo->insertStrList( gTypes ); - + // 2. fill Input and Output listboxes with Ports' names/types QStringList aTypes; SUPERV_Ports aPorts = aINode->Ports(); for ( int i=0; i < aPorts->length(); i++ ) { if ( aPorts[i]->IsGate() ) continue; - if ( aPorts[i]->IsInput() ) + if ( aPorts[i]->IsInput() + && + !myInList->findItem( QString( "%1 (%2)" ).arg( aPorts[i]->Name() ).arg( aPorts[i]->Type() ) ) ) // mkr : PAL11332 new PortListItem( myInList, aPorts[i]->Name(), aPorts[i]->Type() ); - else + if ( !aPorts[i]->IsInput() + && + !myOutList->findItem( QString( "%1 (%2)" ).arg( aPorts[i]->Name() ).arg( aPorts[i]->Type() ) ) ) // mkr : PAL11332 new PortListItem( myOutList, aPorts[i]->Name(), aPorts[i]->Type() ); } } diff --git a/src/SUPERVGUI/SUPERVGUI_ManagePortsDlg.h b/src/SUPERVGUI/SUPERVGUI_ManagePortsDlg.h index 345d1cb..1e3506b 100644 --- a/src/SUPERVGUI/SUPERVGUI_ManagePortsDlg.h +++ b/src/SUPERVGUI/SUPERVGUI_ManagePortsDlg.h @@ -11,11 +11,14 @@ #ifndef SUPERVGUI_ManagePortsDlg_H #define SUPERVGUI_ManagePortsDlg_H +#include "SUPERVGUI.h" + #include #include #include #include #include +#include class SUPERVGUI_CanvasNode; @@ -68,6 +71,10 @@ protected: void moveUp( QListBox* ); void moveDown( QListBox* ); void moveItem( QListBox* theLB, const int from, const int to ); + // mkr : PAL8060 + void createLinkEngine( SUPERV::Port_ptr thePort, + QValueList< QPair< QString,QString > >& theOwnList, + QValueList< QPair< QString,QString > >& theCorrespList ); private: void init(); diff --git a/src/SUPERVGUI/SUPERVGUI_Notification.cxx b/src/SUPERVGUI/SUPERVGUI_Notification.cxx index e991427..7d1e7ef 100644 --- a/src/SUPERVGUI/SUPERVGUI_Notification.cxx +++ b/src/SUPERVGUI/SUPERVGUI_Notification.cxx @@ -25,8 +25,6 @@ // Author : Francis KLOSS // Module : SUPERV -using namespace std; - #include "SUPERVGUI_Notification.h" #include "SUPERVGUI_Main.h" #include "SUPERVGUI_CanvasNode.h" diff --git a/src/SUPERVGUI/SUPERVGUI_Notification.h b/src/SUPERVGUI/SUPERVGUI_Notification.h index 82ef1eb..2f3fc8d 100644 --- a/src/SUPERVGUI/SUPERVGUI_Notification.h +++ b/src/SUPERVGUI/SUPERVGUI_Notification.h @@ -28,7 +28,6 @@ #ifndef SUPERVGUI_Notification_H #define SUPERVGUI_Notification_H -using namespace std; #include "SUPERVGUI_Def.h" #include #include diff --git a/src/SUPERVGUI/SUPERVGUI_Selection.h b/src/SUPERVGUI/SUPERVGUI_Selection.h index 74f9716..c08c5ad 100644 --- a/src/SUPERVGUI/SUPERVGUI_Selection.h +++ b/src/SUPERVGUI/SUPERVGUI_Selection.h @@ -34,7 +34,6 @@ #include "SALOMEDSClient.hxx" #include -using namespace boost; class SALOME_InteractiveObject; diff --git a/src/SUPERVGUI/SUPERVGUI_Service.cxx b/src/SUPERVGUI/SUPERVGUI_Service.cxx index 3afcebb..3f49540 100644 --- a/src/SUPERVGUI/SUPERVGUI_Service.cxx +++ b/src/SUPERVGUI/SUPERVGUI_Service.cxx @@ -25,7 +25,6 @@ // Author : Francis KLOSS // Module : SUPERV -using namespace std; #include "SUPERVGUI_Service.h" #include "SUPERVGUI_Main.h" #include "SUPERVGUI_Library.h" @@ -471,7 +470,7 @@ void SUPERVGUI_Service::addFactoryNode() { } } else { // Factory Node - aNode = aMain->getDataflow()->FNode(component, interface, *myService); + aNode = aMain->getDataflow()->FNode(component, interface, *myService, myComponent->implementation_type()); // mkr : PAL11273 if ( CORBA::is_nil( aNode ) ) { QMessageBox::warning(aDesktop, tr("ERROR"), tr("MSG_CANT_CREATE_NODE")); return; @@ -519,6 +518,12 @@ void SUPERVGUI_Service::addInlineNode() { return; } SUPERV::INode_var aDummyEndNode; + // here we have to + // 1) parse nodes' python function to find ports names + // 2) create ports for engine node with found names and "undefined" types + // ( aNode->InPort(name,type), aNode->OutPort(name,type) ) + // P.S. CanvasNode->createPort(...) for create presentation of port + // will be called from addNode(...) (inside CanvasNode constructor) addNode( aNode, aDummyEndNode, myX, myY ); } break; diff --git a/src/SUPERVGUI/SUPERVGUI_Service.h b/src/SUPERVGUI/SUPERVGUI_Service.h index 366648c..3a46679 100644 --- a/src/SUPERVGUI/SUPERVGUI_Service.h +++ b/src/SUPERVGUI/SUPERVGUI_Service.h @@ -28,7 +28,6 @@ #ifndef SUPERVGUI_Service_H #define SUPERVGUI_Service_H -using namespace std; #include "SUPERVGUI_Def.h" #include #include diff --git a/src/SUPERVGUI/SUPERV_images.po b/src/SUPERVGUI/SUPERV_images.po index 0d0e8a0..3277a1f 100644 --- a/src/SUPERVGUI/SUPERV_images.po +++ b/src/SUPERVGUI/SUPERV_images.po @@ -65,3 +65,6 @@ msgstr "kill.png" msgid "ICO_SUSPEND/RESUME" msgstr "suspend-resume.gif" + +msgid "ICO_NODE_INLINE" +msgstr "node_inline.png" diff --git a/src/SUPERVGUI/SUPERV_msg_en.po b/src/SUPERVGUI/SUPERV_msg_en.po index 706508f..95ee79d 100644 --- a/src/SUPERVGUI/SUPERV_msg_en.po +++ b/src/SUPERVGUI/SUPERV_msg_en.po @@ -781,13 +781,19 @@ msgid "MSG_ERROR_LIB1" msgstr "Error creating a library file and opening for writing." msgid "MSG_ERROR_LIB_IS_RECREATE" -msgstr "Library file is corrupt (bad XML structure). Remove it and create a new one?" +msgstr "Library file is corrupt (bad XML structure) or read-protected. Remove it and create a new one?" + +msgid "MSG_ERROR_LIB_DIR_NOT_EXIST_RECREATE" +msgstr "%1 directory doesn't exist. Create it?" + +msgid "MSG_ERROR_LIB_RECREATE_DIR" +msgstr "Can not create %1 directory." msgid "MSG_ERROR_LIB_IO" msgstr "Unknown I/O error occured creating new library file." msgid "MSG_ERROR_LIB_WRITE" -msgstr "Error writing library file!" +msgstr "Error writing library file: file is write-protected!" msgid "MSG_ERROR_LIB_NIL_NODE" msgstr "Error: the node to be exported is NULL" diff --git a/src/Supervision/CNode_Impl.cxx b/src/Supervision/CNode_Impl.cxx index 9dd23bb..31a2dbe 100644 --- a/src/Supervision/CNode_Impl.cxx +++ b/src/Supervision/CNode_Impl.cxx @@ -23,6 +23,8 @@ using namespace std; #include "StreamPort_Impl.hxx" +char *FACTORYSERVERPY = "localhost/FactoryServerPy" ; + CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb , PortableServer::POA_ptr poa , PortableServer::ObjectId * contId , @@ -65,7 +67,8 @@ CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb , const char * NodeName , const SUPERV::KindOfNode NodeKindOfNode , const char * FuncName , - const SUPERV::ListOfStrings & PythonFunction ) : + const SUPERV::ListOfStrings & PythonFunction , + bool isCimpl ) : Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) { // beginService( "CNode_Impl::CNode_Impl" ); // cout << "CNode_Impl::CNode_Impl -->" << endl ; @@ -92,10 +95,25 @@ CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb , aPythonFunction.resize(1) ; aPythonFunction[0] = &PythonFunction ; } - _DataFlowNode = DataFlowEditor()->AddNode( NodeService , "" , "" , NodeName , - NodeKindOfNode , - aFuncName , - aPythonFunction ) ; + + // mkr : PAL11273 --> + if ( isCimpl ) // C++ implementation + _DataFlowNode = DataFlowEditor()->AddNode( NodeService , "" , "" , NodeName , + NodeKindOfNode , + aFuncName , + aPythonFunction ) ; + else // Python implementation + _DataFlowNode = DataFlowEditor()->AddNode( NodeService , "" , "" , NodeName , + NodeKindOfNode , + aFuncName , + aPythonFunction , + SUPERV::SDate() , + SUPERV::SDate() , + NULLSTRING , + NULLSTRING , + FACTORYSERVERPY ) ; + // mkr : PAL11273 <-- + _IsNode = true ; // endService( "CNode_Impl::CNode_Impl" ); // cout << "<-- CNode_Impl::CNode_Impl" << endl ; @@ -1017,7 +1035,7 @@ SUPERV::ListOfPorts * CNode_Impl::Ports() { begin = false ; } if ( anInPort->IsLoop() || ( anInPort->IsGate() && anInPort->IsNotConnected() && - ( IsExecuting() || DataFlowEditor()->IsReadOnly() ) ) ) { + ( /*IsExecuting() || */DataFlowEditor()->IsReadOnly() ) ) ) { // mkr : IPAL11362 // MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " ignored" ) ; } else if ( CORBA::is_nil( anInPort->ObjRef() ) ) { @@ -1072,7 +1090,7 @@ SUPERV::ListOfPorts * CNode_Impl::Ports() { begin = false ; } if ( anOutPort->IsLoop() || ( anOutPort->IsGate() && anOutPort->IsNotConnected() && - ( IsExecuting() || DataFlowEditor()->IsReadOnly() ) ) ) { + ( /*IsExecuting() || */DataFlowEditor()->IsReadOnly() ) ) ) { // mkr : IPAL11362 // MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() << " ignored" ) ; } else if ( CORBA::is_nil( anOutPort->ObjRef() ) ) { @@ -1490,13 +1508,14 @@ long CNode_Impl::SubStreamGraph() { return RetVal ; } -bool CNode_Impl::IsLinked(const char * ServiceParameterName ) { +// mkr : PAL8060 : this method is not used +/*bool CNode_Impl::IsLinked(const char * ServiceParameterName ) { beginService( "CNode_Impl::IsLinked" ); bool RetVal = DataFlowNode()->IsLinked( ServiceParameterName ) ; MESSAGE( Name() << "->IsLinked( '" << ServiceParameterName << "' )" ) ; endService( "CNode_Impl::IsLinked" ); return RetVal ; -} + }*/ bool CNode_Impl::HasInput(const char * ServiceParameterName ) { // beginService( "CNode_Impl::HasInput" ); diff --git a/src/Supervision/CNode_Impl.hxx b/src/Supervision/CNode_Impl.hxx index 78c085c..19ca441 100644 --- a/src/Supervision/CNode_Impl.hxx +++ b/src/Supervision/CNode_Impl.hxx @@ -54,7 +54,8 @@ class CNode_Impl : public POA_SUPERV::CNode , const char * NodeName = NULLSTRING , const SUPERV::KindOfNode NodeKindOfNode = SUPERV::ComputingNode , const char * aFuncName = NULLSTRING , - const SUPERV::ListOfStrings & aPythonFunction = SUPERV::ListOfStrings() ) ; + const SUPERV::ListOfStrings & aPythonFunction = SUPERV::ListOfStrings() , + bool isCimpl = true ) ; // mkr : PAL11273 : C++ implementation by default CNode_Impl( CORBA::ORB_ptr orb , PortableServer::POA_ptr poa , PortableServer::ObjectId * contId , @@ -214,7 +215,8 @@ class CNode_Impl : public POA_SUPERV::CNode , virtual long SubGraph() ; virtual long SubStreamGraph() ; - virtual bool IsLinked(const char * ToServiceParameterName ) ; + // mkr : PAL8060 : this method is not used + //virtual bool IsLinked(const char * ToServiceParameterName ) ; virtual bool HasInput(const char * ToServiceParameterName ) ; // virtual SUPERV::Link_ptr GetLink(const char * ToServiceParameterName ) ; diff --git a/src/Supervision/FNode_Impl.cxx b/src/Supervision/FNode_Impl.cxx index 99a4311..9426497 100644 --- a/src/Supervision/FNode_Impl.cxx +++ b/src/Supervision/FNode_Impl.cxx @@ -32,9 +32,10 @@ FNode_Impl::FNode_Impl( CORBA::ORB_ptr orb , const char * NodeComponentName , const char * NodeInterfaceName , const char * NodeName , - const SUPERV::KindOfNode NodeKindOfNode ) : + const SUPERV::KindOfNode NodeKindOfNode , + bool isCimpl ) : // Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) { - CNode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowEditor , NodeService , NodeName , NodeKindOfNode , NULLSTRING ) { + CNode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowEditor , NodeService , NodeName , NodeKindOfNode , NULLSTRING , SUPERV::ListOfStrings() , isCimpl ) { // MESSAGE( NodeName << " " ); beginService( "FNode_Impl::FNode_Impl" ); // cout << "FNode_Impl::FNode_Impl -->" << endl ; @@ -43,6 +44,7 @@ FNode_Impl::FNode_Impl( CORBA::ORB_ptr orb , _Orb = CORBA::ORB::_duplicate(orb); _Poa = poa ; _ContId = contId ; + _isCimpl = isCimpl ; // DataFlowNode( DataFlowEditor()->AddNode( NodeService , NodeComponentName , // NodeInterfaceName , NodeName , // NodeKindOfNode ) ) ; @@ -68,6 +70,7 @@ FNode_Impl::FNode_Impl( CORBA::ORB_ptr orb , _Orb = CORBA::ORB::_duplicate(orb); _Poa = poa ; _ContId = contId ; + _isCimpl = true ; endService( "FNode_Impl::FNode_Impl" ); } diff --git a/src/Supervision/FNode_Impl.hxx b/src/Supervision/FNode_Impl.hxx index 0b9105e..3fd4057 100644 --- a/src/Supervision/FNode_Impl.hxx +++ b/src/Supervision/FNode_Impl.hxx @@ -34,6 +34,7 @@ class FNode_Impl : public CNode_Impl , CORBA::ORB_ptr _Orb ; PortableServer::POA_ptr _Poa ; PortableServer::ObjectId * _ContId ; + bool _isCimpl; public: FNode_Impl(); @@ -53,7 +54,8 @@ class FNode_Impl : public CNode_Impl , const char * NodeComponentName , const char * NodeInterfaceName , const char * NodeName = NULLSTRING , - const SUPERV::KindOfNode NodeKindOfNode = SUPERV::FactoryNode ) ; + const SUPERV::KindOfNode NodeKindOfNode = SUPERV::FactoryNode , + bool isCimpl = true ) ; // mkr : PAL11273 : C++ implementation by default FNode_Impl( CORBA::ORB_ptr orb , PortableServer::POA_ptr poa , PortableServer::ObjectId * contId , @@ -75,6 +77,8 @@ class FNode_Impl : public CNode_Impl , virtual GraphBase::FactoryNode * BaseNode() { return DataFlowNode()->FactoryNode() ; } ; + virtual bool IsCimpl() { return _isCimpl; } ; // mkr : PAL11273 + } ; #endif diff --git a/src/Supervision/Graph_Impl.cxx b/src/Supervision/Graph_Impl.cxx index 9be1703..a00e43f 100644 --- a/src/Supervision/Graph_Impl.cxx +++ b/src/Supervision/Graph_Impl.cxx @@ -400,7 +400,8 @@ SUPERV::CNode_ptr Graph_Impl::CNode( const SALOME_ModuleCatalog::Service &NodeSe SUPERV::FNode_ptr Graph_Impl::FNode( const char * NodeComponentName , const char * NodeInterfaceName , - const SALOME_ModuleCatalog::Service &NodeService ) { + const SALOME_ModuleCatalog::Service &NodeService , + bool isCimpl ) { beginService( "Graph_Impl::FNode" ); SUPERV::FNode_var iobject = SUPERV::FNode::_nil() ; if ( DataFlowEditor()->IsEditing() && !DataFlowEditor()->IsReadOnly() && !IsMacro() ) { @@ -409,7 +410,10 @@ SUPERV::FNode_ptr Graph_Impl::FNode( const char * NodeComponentName , DataFlowEditor() , NodeService , NodeComponentName , - NodeInterfaceName ) ; + NodeInterfaceName , + NULLSTRING , + SUPERV::FactoryNode , + isCimpl ) ; if ( myNode->DataFlowNode() ) { PortableServer::ObjectId * id = myNode->getId() ; CORBA::Object_var obj = _poa->id_to_reference(*id); @@ -1804,6 +1808,13 @@ long Graph_Impl::SuspendedThreads() { bool Graph_Impl::Begin() { bool RetVal = false ; + // mkr : IPAL11408 : "Run()" method returns "0" after trying to start graph execution. + // If we call Run() method from Python script two times for one graph, we have to be sure, + // that first execution of this graph ended (i.e. GraphEditor::DataFlow::Editing() method was called). + // Otherwise, the second call of Run() method will return 0. Therefore, we have to waiting for + // the first execution finish. + // NB! From GUI we cann't run dataflow if its previous execution not finished. + while ( !DataFlowEditor()->IsEditing() ) {} // waiting for the previous execution of this graph ended if ( DataFlowEditor()->IsEditing() ) { if ( pthread_mutex_lock( &_MutexExecutorWait ) ) { perror("pthread_mutex_lock _MutexExecutorWait") ; @@ -2178,7 +2189,8 @@ bool Graph_Impl::Merge(const SUPERV::Graph_ptr aGraph , map< string , int > & aM SUPERV::FNode_var aNode = (aGraphNodes->FNodes)[ i ] ; SUPERV::FNode_ptr myNode = FNode( aNode->GetComponentName() , aNode->GetInterfaceName() , - *(aNode->Service()) ) ; + *(aNode->Service()) , + aNode->IsCimpl() ) ; // mkr : PAL11273 if ( !CORBA::is_nil( myNode ) ) { myNode->SetName( aNode->Name() ) ; myNode->SetAuthor( aNode->Author() ) ; @@ -2406,20 +2418,20 @@ bool Graph_Impl::Merge(const SUPERV::Graph_ptr aGraph , map< string , int > & aM myPorts = *(myEndOfSwitch->Ports()) ; for ( j = 0 ; j < (int ) myPorts.length() ; j++ ) { if ( myPorts[ j ]->IsInput() ) { - aPort = myNode->InPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ; + aPort = anEndOfSwitch->InPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ; // mkr : IPAL11394 (add port to !EndSwitch! node) } else { - aPort = myNode->OutPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ; + aPort = anEndOfSwitch->OutPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ; // mkr : IPAL11394 (add port to !EndSwitch! node) } } if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) { SUPERV::ListOfStreamPorts myStreamSwitchPorts = *(myEndOfSwitch->StreamPorts()) ; for ( j = 0 ; j < (int ) myStreamSwitchPorts.length() ; j++ ) { if ( myStreamSwitchPorts[ j ]->IsInput() ) { - aPort = myNode->InStreamPort( myStreamSwitchPorts[ j ]->Name() , StringToDataStreamType( myStreamSwitchPorts[ j ]->Type() ) , myStreamSwitchPorts[ j ]->Dependency() ) ; + aPort = anEndOfSwitch->InStreamPort( myStreamSwitchPorts[ j ]->Name() , StringToDataStreamType( myStreamSwitchPorts[ j ]->Type() ) , myStreamSwitchPorts[ j ]->Dependency() ) ; // mkr : IPAL11394 (add port to !EndSwitch! node) } else { - aPort = myNode->OutStreamPort( myStreamSwitchPorts[ j ]->Name() , StringToDataStreamType( myStreamSwitchPorts[ j ]->Type() ) , myStreamSwitchPorts[ j ]->Dependency() ) ; + aPort = anEndOfSwitch->OutStreamPort( myStreamSwitchPorts[ j ]->Name() , StringToDataStreamType( myStreamSwitchPorts[ j ]->Type() ) , myStreamSwitchPorts[ j ]->Dependency() ) ; // mkr : IPAL11394 (add port to !EndSwitch! node) } } } diff --git a/src/Supervision/Graph_Impl.hxx b/src/Supervision/Graph_Impl.hxx index e15f095..b8515c7 100644 --- a/src/Supervision/Graph_Impl.hxx +++ b/src/Supervision/Graph_Impl.hxx @@ -114,7 +114,8 @@ class Graph_Impl : public POA_SUPERV::Graph , virtual SUPERV::FNode_ptr FNode( const char * NodeComponentName , const char * InterfaceName , - const SALOME_ModuleCatalog::Service &NodeService ) ; + const SALOME_ModuleCatalog::Service &NodeService , + bool isCimpl ) ; // mkr : PAL11273 : C++ implementation by default virtual SUPERV::INode_ptr INode( const char * FuncName , const SUPERV::ListOfStrings & PythonFunction ) ; diff --git a/src/Supervision/Port_Impl.cxx b/src/Supervision/Port_Impl.cxx index 60d11ac..f791aa2 100644 --- a/src/Supervision/Port_Impl.cxx +++ b/src/Supervision/Port_Impl.cxx @@ -465,7 +465,7 @@ bool Port_Impl::IsLinked() { // << anInPort->PortName() << ")" << " ignored" ) ; } else { - RetVal = _DataFlowNode->IsLinked( _DataFlowPort->PortName() ) ; + RetVal = _DataFlowNode->IsLinked( _DataFlowPort->PortName(), IsInput() ) ; // mkr : PAL8060 } } // endService( "Port_Impl::IsLinked" ) ; diff --git a/src/Supervision/SuperV.py b/src/Supervision/SuperV.py index f68f82a..69a38e3 100644 --- a/src/Supervision/SuperV.py +++ b/src/Supervision/SuperV.py @@ -38,7 +38,6 @@ except : import os import re from types import * -import readline #try : # SuperVision = SuperV_Swig( len(sys.argv) , sys.argv ) @@ -591,6 +590,8 @@ class FNode(CNode): return self.N.SetInterfaceName( anInterfaceName ) def SetContainer( self , aComputer ): return self.N.SetContainer( aComputer ) + def IsCimpl( self ): + return self.N.isCimpl ########################################################## class INode(CNode): @@ -798,13 +799,27 @@ class Graph(GNode): #if SuperVision.Swig : #aService = Service_Swig( aService ) return self.FNode( aComponent , anInterface , aService ) + def FNodeImpl( self , aComponent , anInterface , aService, isCimpl ): + NodeComponent = modulecatalog.GetComponent( aComponent ) + aService = NodeComponent.GetService( anInterface , aService ) + aNode = self.G.FNode( aComponent , anInterface , aService, isCimpl ) + if aNode != None : + aNode.isCimpl = isCimpl + myNode = FNode( aNode , self.G.Verbose ) + return myNode + ErrMsg = "Failed to create a Node with Service " + aService.ServiceName + if self.G.Verbose : + print ErrMsg + return aNode def FNode( self , aComponent , anInterface , aService ): + # create node with C++ implementation type by default NodeComponent = modulecatalog.GetComponent( aComponent ) aService = NodeComponent.GetService( anInterface , aService ) #if SuperVision.Swig : #aService = Service_Swig( aService ) - aNode = self.G.FNode( aComponent , anInterface , aService ) + aNode = self.G.FNode( aComponent , anInterface , aService, 1 ) if aNode != None : + aNode.isCimpl = 1 myNode = FNode( aNode , self.G.Verbose ) return myNode ErrMsg = "Failed to create a Node with Service " + aService.ServiceName diff --git a/src/Supervision/batchmode_SuperV.py b/src/Supervision/batchmode_SuperV.py index 17d3f24..9dfb5e0 100644 --- a/src/Supervision/batchmode_SuperV.py +++ b/src/Supervision/batchmode_SuperV.py @@ -40,7 +40,6 @@ except : import os import re from types import * -import readline import SALOMEDS import SALOMEDS_Attributes_idl #try : @@ -608,6 +607,8 @@ class FNode(CNode): return self.N.SetInterfaceName( anInterfaceName ) def SetContainer( self , aComputer ): return self.N.SetContainer( aComputer ) + def IsCimpl( self ): + return self.N.isCimpl ########################################################## class INode(CNode): @@ -815,13 +816,27 @@ class Graph(GNode): #if SuperVision.Swig : #aService = Service_Swig( aService ) return self.FNode( aComponent , anInterface , aService ) + def FNodeImpl( self , aComponent , anInterface , aService, isCimpl ): + NodeComponent = modulecatalog.GetComponent( aComponent ) + aService = NodeComponent.GetService( anInterface , aService ) + aNode = self.G.FNode( aComponent , anInterface , aService, isCimpl ) + if aNode != None : + aNode.isCimpl = isCimpl + myNode = FNode( aNode , self.G.Verbose ) + return myNode + ErrMsg = "Failed to create a Node with Service " + aService.ServiceName + if self.G.Verbose : + print ErrMsg + return aNode def FNode( self , aComponent , anInterface , aService ): + # create node with C++ implementation type by default NodeComponent = modulecatalog.GetComponent( aComponent ) aService = NodeComponent.GetService( anInterface , aService ) #if SuperVision.Swig : #aService = Service_Swig( aService ) - aNode = self.G.FNode( aComponent , anInterface , aService ) + aNode = self.G.FNode( aComponent , anInterface , aService, 1 ) if aNode != None : + aNode.isCimpl = 1 myNode = FNode( aNode , self.G.Verbose ) return myNode ErrMsg = "Failed to create a Node with Service " + aService.ServiceName -- 2.39.2