From: smh Date: Wed, 21 Apr 2004 06:00:48 +0000 (+0000) Subject: Merge from QT_EVENT branch X-Git-Tag: mergefrom_QT_EVENT_20Apr04~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=049fbe8a834c480b8020165c1ea90b909c16b341;p=modules%2Fsuperv.git Merge from QT_EVENT branch --- diff --git a/examples/test_events.py b/examples/test_events.py new file mode 100644 index 0000000..fe394f4 --- /dev/null +++ b/examples/test_events.py @@ -0,0 +1,66 @@ + +# Generated python file of Graph aNewDataFlow + +from SuperV import * +# Graph creation +aNewDataFlow = Graph( 'aNewDataFlow' ) +aNewDataFlow.SetName( 'aNewDataFlow' ) +aNewDataFlow.SetAuthor( '' ) +aNewDataFlow.SetComment( '' ) +aNewDataFlow.Coords( 0 , 0 ) + +# Creation of Factory Nodes + +# Creation of InLine Nodes +PyFunc = [] +PyFunc.append( 'def Func( A ): ' ) +PyFunc.append( ' import batchmode_visu ' ) +PyFunc.append( ' batchmode_visu.myVisu.CreateTestView() ' ) +PyFunc.append( ' batchmode_visu.myVisu.ShowTestObject() ' ) +PyFunc.append( ' return A ' ) +Func = aNewDataFlow.INode( 'Func' , PyFunc ) +Func.SetName( 'Func' ) +Func.SetAuthor( '' ) +Func.SetComment( 'Compute Node' ) +Func.Coords( 375 , 162 ) +Func.InPort( 'A' , 'int' ) +Func.OutPort( 'B' , 'int' ) + +# Creation of Loop Nodes +PyInit = [] +PyInit.append( 'def Init( A ): ' ) +PyInit.append( ' return A ' ) +PyMoreInit = [] +PyMoreInit.append( 'def More( A ): ' ) +PyMoreInit.append( ' if A < 10: ' ) +PyMoreInit.append( ' return 1,A ' ) +PyMoreInit.append( ' return 0,A ' ) +PyNextInit = [] +PyNextInit.append( 'def Next( A ): ' ) +PyNextInit.append( ' return (A + 1) ' ) +Init,EndInit = aNewDataFlow.LNode( 'Init' , PyInit , 'More' , PyMoreInit , 'Next' , PyNextInit ) +EndInit.SetName( 'EndInit' ) +EndInit.SetAuthor( '' ) +EndInit.SetComment( '' ) +EndInit.Coords( 740 , 168 ) +PyEndInit = [] +EndInit.SetPyFunction( 'EndInit' , PyEndInit ) +Init.SetName( 'Init' ) +Init.SetAuthor( '' ) +Init.SetComment( '' ) +Init.Coords( 118 , 160 ) +Init.InPort( 'A' , 'int' ) +Init.OutPort( 'A' , 'int' ) + +# Creation of Links +InitA = Init.Port( 'A' ) +FuncA = aNewDataFlow.Link( InitA , Func.Port( 'A' ) ) + +FuncB = Func.Port( 'B' ) +EndInitA = aNewDataFlow.Link( FuncB , EndInit.Port( 'A' ) ) + +# Creation of Input datas +InitA = Init.Input( 'A' , 0) + +# Creation of Output variables +EndInitA = EndInit.Port( 'A' ) diff --git a/examples/test_events.xml b/examples/test_events.xml new file mode 100644 index 0000000..97a7ce8 --- /dev/null +++ b/examples/test_events.xml @@ -0,0 +1,167 @@ + + + + +? + ? + aNewDataFlow + 1 + ? + +aNewDataFlow + + +int + Init\A + + +int + EndInit\A + + + 2/4/2004 - 16:38:31 + 2/4/2004 - 18:30:31 + 1.05 + ? + ? + ? + 0 + 0 + + +? + ? + Init + 4 + EndInit + +Init + + +int + A + + +int + A + + + +Init + + + +More + + + + + +Next + + + 2/4/2004 - 18:30:31 + 2/4/2004 - 18:30:31 + 1.05 + ? + ? + ? + 118 + 160 + +? + ? + EndInit + 5 + Init + +EndInit + + +int + A + + +int + A + + + +EndInit + + 2/4/2004 - 18:30:31 + 2/4/2004 - 18:30:31 + 1.05 + ? + ? + ? + 740 + 168 + +? + ? + Func + 3 + ? + +Func + + +int + A + + +int + B + + + +Func + + + + + + 2/4/2004 - 18:30:31 + 2/4/2004 - 18:30:31 + 1.05 + ? + ? + Compute Node + 375 + 162 + + +Init + DoLoop + EndInit + DoLoop + + +Init + A + Func + A + + +EndInit + DoLoop + Init + InitLoop + + +Func + B + EndInit + A + + + +aNewDataFlow + Init\A + Init + A + +3 + 0 + diff --git a/src/SUPERVGUI/SUPERVGUI.cxx b/src/SUPERVGUI/SUPERVGUI.cxx index 394710b..e0893ba 100644 --- a/src/SUPERVGUI/SUPERVGUI.cxx +++ b/src/SUPERVGUI/SUPERVGUI.cxx @@ -49,13 +49,14 @@ using namespace std; int SUPERVGUI::factory = 0; -SUPERVGUI Supervision; +SUPERVGUI Supervision(""); -SUPERVGUI::SUPERVGUI(): QObject(), - desktop(0), - study(0), - browser(0) +SUPERVGUI::SUPERVGUI(const QString& theName, QObject* theParent) + : SALOMEGUI( theName, theParent ), + desktop(0), + study(0), + browser(0) //info(0) { Trace("SUPERVGUI::SUPERVGUI") @@ -445,8 +446,10 @@ void SUPERVGUI::showComponents() { } } -void SUPERVGUI::customPopup(QPopupMenu* popup) { + +bool SUPERVGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString& theContext, const QString& theParent, const QString& theObject) { Trace("SUPERVGUI::customPopup"); + Supervision.init(parent); if(popup->count() > 3) { // Temporary code: is to be deleted soon popup->removeItem(QAD_Display_Popup_ID); @@ -457,7 +460,7 @@ void SUPERVGUI::customPopup(QPopupMenu* popup) { // Temporary code end } SALOME_Selection* Sel = SALOME_Selection::Selection(study->getSelection() ); - if ((Sel==NULL) || (Sel->IObjectCount() == 0)) return; + if ((Sel==NULL) || (Sel->IObjectCount() == 0)) return false; if (Sel->IObjectCount() == 1) { Handle(SALOME_InteractiveObject) anIObj = Sel->firstIObject(); @@ -488,6 +491,7 @@ void SUPERVGUI::customPopup(QPopupMenu* popup) { if (aIObjCount == Sel->IObjectCount()) //all selected objects belong to Supervision popup->insertItem(tr("MSG_DELETE"), this, SLOT(deleteObject())); } + return(true); } @@ -577,105 +581,81 @@ void SUPERVGUI::deleteObject() { Sel->ClearIObjects() ; } - - -void SUPERVGUI::activeStudyChanged() { - Trace("SUPERVGUI::activeStudyChanged"); - study = desktop->getActiveStudy(); -} - -extern "C" bool OnGUIEvent(int command, QAD_Desktop* parent) { - Supervision.init(parent); - switch (command) { - case 301: - Supervision.importDataflow(); - return(false); - - case 302: - Supervision.exportDataflow(); - return(false); - - case 303: - Supervision.newDataflow(); - return(false); - - case 304: - Supervision.modifyDataflow(); - return(false); - - case 305: - Supervision.reloadDataflow(); - return(false); - - case 306: - Supervision.runDataflow(); - return(false); - - case 307: - Supervision.killDataflow(); - return(false); - - case 308: - Supervision.suspendResumeDataflow(); - return(false); - - case 309: - Supervision.showComponents(); - return(false); - - case 310: - Supervision.stepByStep(); - return(false); - - default: - QMessageBox::warning(QAD_Application::getDesktop(), "Supervision Error", "Unknown Command From Salome"); - return(false); - - } -} - -extern "C" bool OnKeyPress(QKeyEvent* e, QAD_Desktop* parent, SUPERVGUI_Main* s) { +bool SUPERVGUI::OnGUIEvent(int command, QAD_Desktop* parent) { + Supervision.init(parent); + switch (command) { + case 301: + Supervision.importDataflow(); return(false); -} - -extern "C" bool OnMousePress(QMouseEvent* e, QAD_Desktop* parent, SUPERVGUI_Main* s) { + + case 302: + Supervision.exportDataflow(); return(false); -} - -extern "C" bool OnMouseMove(QMouseEvent* e, QAD_Desktop* parent, SUPERVGUI_Main* s) { + + case 303: + Supervision.newDataflow(); return(false); -} - -extern "C" bool OnPopupGUIEvent(int theCommandID, QAD_Desktop* parent) { + + case 304: + Supervision.modifyDataflow(); return(false); + + case 305: + Supervision.reloadDataflow(); + return(false); + + case 306: + Supervision.runDataflow(); + return(false); + + case 307: + Supervision.killDataflow(); + return(false); + + case 308: + Supervision.suspendResumeDataflow(); + return(false); + + case 309: + Supervision.showComponents(); + return(false); + + case 310: + Supervision.stepByStep(); + return(false); + + default: + QMessageBox::warning(QAD_Application::getDesktop(), "Supervision Error", "Unknown Command From Salome"); + return(false); + } } -extern "C" bool SetSettings(QAD_Desktop* parent) { - Trace("extern SUPERVGUI::SetSettings") - Supervision.init(parent); - return(true); -} - -extern "C" void definePopup(QString& theContext, QString& theParent, QString& theObject) { - theObject = ""; - theContext = ""; +bool SUPERVGUI::SetSettings(QAD_Desktop* parent) { + Trace("SUPERVGUI::SetSettings"); + Supervision.init(parent); + return(true); } -extern "C" bool customPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString& theContext, const QString& theParent, const QString& theObject) { - Supervision.init(parent); - Supervision.customPopup(popup); - return(true); +void SUPERVGUI::DefinePopup(QString& theContext, QString& theParent, QString& theObject) { + theObject = ""; + theContext = ""; } -extern "C" void activeStudyChanged(QAD_Desktop* parent) { - Supervision.activeStudyChanged(); +bool SUPERVGUI::ActiveStudyChanged(QAD_Desktop* parent) { + Trace("SUPERVGUI::activeStudyChanged"); + study = desktop->getActiveStudy(); + return true; } -extern "C" int supportedViewType() +void SUPERVGUI::SupportedViewType (int* buffer, int bufferSize) { - return (int)VIEW_GRAPHSUPERV; + if (!buffer || !bufferSize) return; + buffer[0] = (int)VIEW_GRAPHSUPERV; } -extern "C" void buildPresentation ( const Handle(SALOME_InteractiveObject)& theIO ) +extern "C" { + Standard_EXPORT SALOMEGUI* GetComponentGUI() { + return &Supervision; + } } diff --git a/src/SUPERVGUI/SUPERVGUI.h b/src/SUPERVGUI/SUPERVGUI.h index 3bf4606..977e719 100644 --- a/src/SUPERVGUI/SUPERVGUI.h +++ b/src/SUPERVGUI/SUPERVGUI.h @@ -28,7 +28,7 @@ #ifndef SUPERVGUI_H #define SUPERVGUI_H -// Acces a l'ihm de SALOME +// Acces a l`ihm de SALOME // ----------------------- #include "QAD_Desktop.h" @@ -39,15 +39,16 @@ #include "SUPERVGUI_Main.h" //#include "SUPERVGUI_Information.h" +#include "SALOMEGUI.h" // Definition de la classe principale du module de supervision // ----------------------------------------------------------- -class SUPERVGUI: public QObject { +class SUPERVGUI: public SALOMEGUI { Q_OBJECT public: - SUPERVGUI(); + SUPERVGUI( const QString&, QObject* = 0 ); virtual ~SUPERVGUI(); QAD_Desktop* getDesktop(); @@ -73,8 +74,19 @@ class SUPERVGUI: public QObject { void init(QAD_Desktop* parent); SUPERVGUI_Main* getMain(); - void customPopup(QPopupMenu* popup); - void activeStudyChanged(); + + bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); + bool SetSettings(QAD_Desktop* parent); + void DefinePopup(QString & theContext, + QString & theParent, + QString & theObject ) ; + bool CustomPopup(QAD_Desktop* parent, + QPopupMenu* popup, + const QString & theContext, + const QString & theParent, + const QString & theObject); + bool ActiveStudyChanged( QAD_Desktop* parent ); + void SupportedViewType (int* buffer, int bufferSize); bool isContains(QAD_Study* theStudy, const QString theKey);