]> SALOME platform Git repositories - modules/superv.git/commitdiff
Salome HOME
Merge from QT_EVENT branch
authorsmh <smh@opencascade.com>
Wed, 21 Apr 2004 06:00:48 +0000 (06:00 +0000)
committersmh <smh@opencascade.com>
Wed, 21 Apr 2004 06:00:48 +0000 (06:00 +0000)
examples/test_events.py [new file with mode: 0644]
examples/test_events.xml [new file with mode: 0644]
src/SUPERVGUI/SUPERVGUI.cxx
src/SUPERVGUI/SUPERVGUI.h

diff --git a/examples/test_events.py b/examples/test_events.py
new file mode 100644 (file)
index 0000000..fe394f4
--- /dev/null
@@ -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 (file)
index 0000000..97a7ce8
--- /dev/null
@@ -0,0 +1,167 @@
+<!DOCTYPE Dataflow>
+<dataflow>
+<info-list>
+<node>
+<component-name>?</component-name>
+   <interface-name>?</interface-name>
+   <node-name>aNewDataFlow</node-name>
+   <kind>1</kind>
+   <coupled-node>?</coupled-node>
+   <service>
+<service-name>aNewDataFlow</service-name>
+    <inParameter-list>
+<inParameter>
+<inParameter-type>int</inParameter-type>
+      <inParameter-name>Init\A</inParameter-name>     </inParameter>    </inParameter-list>
+    <outParameter-list>
+<outParameter>
+<outParameter-type>int</outParameter-type>
+      <outParameter-name>EndInit\A</outParameter-name>     </outParameter>    </outParameter-list>   </service>
+   <Parameter-list/>
+   <PyFunction-list/>
+   <creation-date>2/4/2004 - 16:38:31</creation-date>
+   <lastmodification-date>2/4/2004 - 18:30:31</lastmodification-date>
+   <editor-release>1.05</editor-release>
+   <author>?</author>
+   <container>?</container>
+   <comment>?</comment>
+   <x-position>0</x-position>
+   <y-position>0</y-position>  </node> </info-list>
+ <node-list>
+<node>
+<component-name>?</component-name>
+   <interface-name>?</interface-name>
+   <node-name>Init</node-name>
+   <kind>4</kind>
+   <coupled-node>EndInit</coupled-node>
+   <service>
+<service-name>Init</service-name>
+    <inParameter-list>
+<inParameter>
+<inParameter-type>int</inParameter-type>
+      <inParameter-name>A</inParameter-name>     </inParameter>    </inParameter-list>
+    <outParameter-list>
+<outParameter>
+<outParameter-type>int</outParameter-type>
+      <outParameter-name>A</outParameter-name>     </outParameter>    </outParameter-list>   </service>
+   <Parameter-list/>
+   <PyFunction-list>
+<PyFunction>
+<FuncName>Init</FuncName>
+     <PyFunc><![CDATA[def Init( A ):   ]]></PyFunc>
+     <PyFunc><![CDATA[  return A   ]]></PyFunc>    </PyFunction>
+    <PyFunction>
+<FuncName>More</FuncName>
+     <PyFunc><![CDATA[def More( A ):   ]]></PyFunc>
+     <PyFunc><![CDATA[  if A < 10:   ]]></PyFunc>
+     <PyFunc><![CDATA[    return 1,A   ]]></PyFunc>
+     <PyFunc><![CDATA[  return 0,A   ]]></PyFunc>    </PyFunction>
+    <PyFunction>
+<FuncName>Next</FuncName>
+     <PyFunc><![CDATA[def Next( A ):   ]]></PyFunc>
+     <PyFunc><![CDATA[  return (A + 1)   ]]></PyFunc>    </PyFunction>   </PyFunction-list>
+   <creation-date>2/4/2004 - 18:30:31</creation-date>
+   <lastmodification-date>2/4/2004 - 18:30:31</lastmodification-date>
+   <editor-release>1.05</editor-release>
+   <author>?</author>
+   <container>?</container>
+   <comment>?</comment>
+   <x-position>118</x-position>
+   <y-position>160</y-position>  </node>
+  <node>
+<component-name>?</component-name>
+   <interface-name>?</interface-name>
+   <node-name>EndInit</node-name>
+   <kind>5</kind>
+   <coupled-node>Init</coupled-node>
+   <service>
+<service-name>EndInit</service-name>
+    <inParameter-list>
+<inParameter>
+<inParameter-type>int</inParameter-type>
+      <inParameter-name>A</inParameter-name>     </inParameter>    </inParameter-list>
+    <outParameter-list>
+<outParameter>
+<outParameter-type>int</outParameter-type>
+      <outParameter-name>A</outParameter-name>     </outParameter>    </outParameter-list>   </service>
+   <Parameter-list/>
+   <PyFunction-list>
+<PyFunction>
+<FuncName>EndInit</FuncName>
+     <PyFunc><![CDATA[?]]></PyFunc>    </PyFunction>   </PyFunction-list>
+   <creation-date>2/4/2004 - 18:30:31</creation-date>
+   <lastmodification-date>2/4/2004 - 18:30:31</lastmodification-date>
+   <editor-release>1.05</editor-release>
+   <author>?</author>
+   <container>?</container>
+   <comment>?</comment>
+   <x-position>740</x-position>
+   <y-position>168</y-position>  </node>
+  <node>
+<component-name>?</component-name>
+   <interface-name>?</interface-name>
+   <node-name>Func</node-name>
+   <kind>3</kind>
+   <coupled-node>?</coupled-node>
+   <service>
+<service-name>Func</service-name>
+    <inParameter-list>
+<inParameter>
+<inParameter-type>int</inParameter-type>
+      <inParameter-name>A</inParameter-name>     </inParameter>    </inParameter-list>
+    <outParameter-list>
+<outParameter>
+<outParameter-type>int</outParameter-type>
+      <outParameter-name>B</outParameter-name>     </outParameter>    </outParameter-list>   </service>
+   <Parameter-list/>
+   <PyFunction-list>
+<PyFunction>
+<FuncName>Func</FuncName>
+     <PyFunc><![CDATA[def Func( A ):     ]]></PyFunc>
+     <PyFunc><![CDATA[  import batchmode_visu  ]]></PyFunc>
+     <PyFunc><![CDATA[  batchmode_visu.myVisu.CreateTestView()   ]]></PyFunc>
+     <PyFunc><![CDATA[  batchmode_visu.myVisu.ShowTestObject()   ]]></PyFunc>
+     <PyFunc><![CDATA[  return A     ]]></PyFunc>    </PyFunction>   </PyFunction-list>
+   <creation-date>2/4/2004 - 18:30:31</creation-date>
+   <lastmodification-date>2/4/2004 - 18:30:31</lastmodification-date>
+   <editor-release>1.05</editor-release>
+   <author>?</author>
+   <container>?</container>
+   <comment>Compute Node</comment>
+   <x-position>375</x-position>
+   <y-position>162</y-position>  </node> </node-list>
+ <link-list>
+<link>
+<fromnode-name>Init</fromnode-name>
+   <fromserviceparameter-name>DoLoop</fromserviceparameter-name>
+   <tonode-name>EndInit</tonode-name>
+   <toserviceparameter-name>DoLoop</toserviceparameter-name>
+   <coord-list/>  </link>
+  <link>
+<fromnode-name>Init</fromnode-name>
+   <fromserviceparameter-name>A</fromserviceparameter-name>
+   <tonode-name>Func</tonode-name>
+   <toserviceparameter-name>A</toserviceparameter-name>
+   <coord-list/>  </link>
+  <link>
+<fromnode-name>EndInit</fromnode-name>
+   <fromserviceparameter-name>DoLoop</fromserviceparameter-name>
+   <tonode-name>Init</tonode-name>
+   <toserviceparameter-name>InitLoop</toserviceparameter-name>
+   <coord-list/>  </link>
+  <link>
+<fromnode-name>Func</fromnode-name>
+   <fromserviceparameter-name>B</fromserviceparameter-name>
+   <tonode-name>EndInit</tonode-name>
+   <toserviceparameter-name>A</toserviceparameter-name>
+   <coord-list/>  </link> </link-list>
+ <data-list>
+<data>
+<fromnode-name>aNewDataFlow</fromnode-name>
+   <fromserviceparameter-name>Init\A</fromserviceparameter-name>
+   <tonode-name>Init</tonode-name>
+   <toserviceparameter-name>A</toserviceparameter-name>
+   <data-value>
+<value-type>3</value-type>
+    <value>0</value>   </data-value>
+   <coord-list/>  </data> </data-list></dataflow>
index 394710b9da2e466cecf82190236295ca85ebec8d..e0893ba04e32179265cc4264fda88935287bc5c0 100644 (file)
@@ -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;
+  }
 }
index 3bf460606e3d5a5c35a22f44a226ebde1ed510ff..977e71950a4604695d7cc88621c06eea5ec9faba 100644 (file)
@@ -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"
 #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);