X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDCalc%2Ftui%2Fmedevents.py;h=d09ea3230e0fcc4205f465d66f5a8e61defa8f4b;hb=aec2051b4624c4fdc835a901e30a4b7801022af5;hp=96ad59ed41b49bf677f1a27b0ad8ea27f51bea0e;hpb=bb6d28ff5b18878d9351223d03e3eeb909483b50;p=modules%2Fmed.git diff --git a/src/MEDCalc/tui/medevents.py b/src/MEDCalc/tui/medevents.py index 96ad59ed4..d09ea3230 100644 --- a/src/MEDCalc/tui/medevents.py +++ b/src/MEDCalc/tui/medevents.py @@ -1,4 +1,4 @@ -# Copyright (C) 2015 CEA/DEN, EDF R&D +# Copyright (C) 2015-2019 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 @@ -36,16 +36,16 @@ def connectEventListener(): try: eventListenerIOR = dataManager.getEventListenerIOR() __eventListener = salome.orb.string_to_object(eventListenerIOR) - except SALOME.SALOME_Exception, e: + except SALOME.SALOME_Exception as 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 explicitly \"medcalc.medevents.connectEventListener()\" " + msg+="to connect the GUI event listener" medcalc.inf(msg) __eventListener = None - except Exception, e: + except Exception as e: medcalc.err("An unknown error occurs. Check if this ior=%s is valid."%eventListenerIOR) - print e + print(e) # def eventListenerIsRunning(): @@ -56,7 +56,7 @@ def eventListenerIsRunning(): # Try to define the event listener connectEventListener() if __eventListener is None: - # it definitly does not work + # it definitely does not work medcalc.wrn("the GUI is not loaded yet and will not be notified of the modification") return False @@ -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="", presentationId=-1): - medEvent = MEDCALC.MedEvent(eventType, dataId, filename, presentationId) +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 @@ -109,9 +109,29 @@ def notifyGui_removeFromWorkspace(fieldId): def notifyGui_cleanWorkspace(): __notifyGui(MEDCALC.EVENT_CLEAN_WORKSPACE) # -def notifyGui_addDatasource(filename): - __notifyGui(MEDCALC.EVENT_ADD_DATASOURCE, filename=filename) +def notifyGui_addDatasource(handlerId, filename): + __notifyGui(MEDCALC.EVENT_ADD_DATASOURCE, dataId=handlerId, filename=filename) # 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_modifyPresentation(presId): + __notifyGui(MEDCALC.EVENT_MODIFY_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_changeUnderlyingMesh(fieldId): + __notifyGui(MEDCALC.EVENT_CHANGE_UNDERLYING_MESH, dataId=fieldId) + +def notifyGui_interpolateField(fieldId): + __notifyGui(MEDCALC.EVENT_INTERPOLATE_FIELD, dataId=fieldId)