Salome HOME
Merge branch 'abn/configuration'
[modules/med.git] / src / MEDCalc / tui / medevents.py
index 2feb1645d3f7aa388579badd44fe53dbcf909e06..2e17a37100f72789bad4db8f17573d8b4490aa74 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2015  CEA/DEN, EDF R&D
+# Copyright (C) 2015-2016  CEA/DEN, EDF R&D
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -38,9 +38,9 @@ def connectEventListener():
     __eventListener = salome.orb.string_to_object(eventListenerIOR)
   except SALOME.SALOME_Exception, e:
     medcalc.wrn("The event listener is not running yet")
-    medcalc.msg ="When you'll have loaded the MED GUI, "
-    medcalc.msg+="call explicitely \"medcalc.medevents.connectEventListener()\" "
-    medcalc.msg+="to connect the GUI event listener"
+    msg ="When you'll have loaded the MED GUI, "
+    msg+="call explicitely \"medcalc.medevents.connectEventListener()\" "
+    msg+="to connect the GUI event listener"
     medcalc.inf(msg)
     __eventListener = None
   except Exception, e:
@@ -83,8 +83,8 @@ connectEventListener()
 # that they could be used in another context than the FieldProxy instances
 import MEDCALC
 
-def __notifyGui(eventType, dataId=-1, filename=""):
-  medEvent = MEDCALC.MedEvent(eventType, dataId, filename)
+def __notifyGui(eventType, dataId=-1, filename="", presentationId=-1, msg=""):
+  medEvent = MEDCALC.MedEvent(eventType, dataId, filename, presentationId, msg)
   if not eventListenerIsRunning(): return
 
   # Notify the GUI of the update event
@@ -97,21 +97,35 @@ def notifyGui_updateField(fieldId):
   meta-data have changed so it could update the gui
   presentations of this field.
   """
-  __notifyGui(MEDCALC.EVENT_UPDATE_FIELD,fieldId)
+  __notifyGui(MEDCALC.EVENT_UPDATE_FIELD, dataId=fieldId)
 #
 
 def notifyGui_putInWorkspace(fieldId):
-  __notifyGui(MEDCALC.EVENT_PUT_IN_WORKSPACE,fieldId)
+  __notifyGui(MEDCALC.EVENT_PUT_IN_WORKSPACE, dataId=fieldId)
 #
 def notifyGui_removeFromWorkspace(fieldId):
-  __notifyGui(MEDCALC.EVENT_REMOVE_FROM_WORKSPACE, fieldId)
+  __notifyGui(MEDCALC.EVENT_REMOVE_FROM_WORKSPACE, dataId=fieldId)
 
 def notifyGui_cleanWorkspace():
   __notifyGui(MEDCALC.EVENT_CLEAN_WORKSPACE)
 #
-def notifyGui_addDatasource(filename):
-  __notifyGui(MEDCALC.EVENT_ADD_DATASOURCE, -1, filename)
+def notifyGui_addDatasource(handlerId, filename):
+  __notifyGui(MEDCALC.EVENT_ADD_DATASOURCE, dataId=handlerId, filename=filename)
 #
-def notifyGui_addPresentation(presentation_id):
-  __notifyGui(MEDCALC.EVENT_ADD_PRESENTATION, presentation_id)
+def notifyGui_addPresentation(fieldId, presId):
+  __notifyGui(MEDCALC.EVENT_ADD_PRESENTATION, dataId=fieldId, presentationId=presId)
 #
+def notifyGui_removePresentation(presId):
+  __notifyGui(MEDCALC.EVENT_REMOVE_PRESENTATION, presentationId=presId)
+#
+def notifyGui_playQtTestingScenario(filename):
+  __notifyGui(MEDCALC.EVENT_PLAY_TEST, filename=filename)
+#
+def notifyGui_termination():
+  __notifyGui(MEDCALC.EVENT_QUIT_SALOME)
+  
+def notifyGui_error(msg):
+  __notifyGui(MEDCALC.EVENT_ERROR, msg=msg)
+  
+def notifyGui_modifyPresentation(presId):
+  __notifyGui(MEDCALC.EVENT_MODIFY_PRESENTATION, presentationId=presId)