From: André Ribes Date: Wed, 23 Feb 2011 17:09:59 +0000 (+0100) Subject: Bouton Close ok X-Git-Tag: V6_4_0rc3~79 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0840867c5c0be0c00de39564506d9fd3f2f6514f;p=modules%2Fadao.git Bouton Close ok --- diff --git a/src/daSalome/daGUI/daEficasWrapper/adaoEficasWrapper.py b/src/daSalome/daGUI/daEficasWrapper/adaoEficasWrapper.py index b477086..b724a93 100644 --- a/src/daSalome/daGUI/daEficasWrapper/adaoEficasWrapper.py +++ b/src/daSalome/daGUI/daEficasWrapper/adaoEficasWrapper.py @@ -118,6 +118,21 @@ class AdaoEficasWrapper(eficasSalome.MyEficas): adao_case.eficas_editor = self.viewmanager.dict_editors[index] self.notifyObserver(EficasEvent.EVENT_TYPES.OPEN, callbackId=adao_case) + def adaoFileClose(self, adao_case): + + index = self.viewmanager.myQtab.currentIndex() + close_editor = self.viewmanager.dict_editors[index] + res = self.viewmanager.handleClose(self) + if res != 2: # l utilsateur a annule + if close_editor.fichier is None: + # Cas fichier vide + print "cas fichier vide" + self.notifyObserver(EficasEvent.EVENT_TYPES.CLOSE, callbackId=close_editor) + else: + # Cas fichier existant + print "cas fichier existant" + self.notifyObserver(EficasEvent.EVENT_TYPES.CLOSE, callbackId=close_editor) + ####### # # Méthodes auxiliares de gestion du GUI Eficas pour synchronisation diff --git a/src/daSalome/daGUI/daGuiImpl/adaoGuiManager.py b/src/daSalome/daGUI/daGuiImpl/adaoGuiManager.py index 4d9e525..88c0caf 100644 --- a/src/daSalome/daGUI/daGuiImpl/adaoGuiManager.py +++ b/src/daSalome/daGUI/daGuiImpl/adaoGuiManager.py @@ -254,6 +254,35 @@ class AdaoCaseManager(EficasObserver): # Ajout du cas self.cases[adao_case.name] = adao_case +####### +# +# Gestion de la fermeture d'un cas +# 1: la fonction closeAdaoCase est appelée par le GUI SALOME +# 2: la fonction _processEficasCloseEvent est appelée par le manager EFICAS +# +####### + + def closeAdaoCase(self): + adaoLogger.debug("Fermeture d'un cas") + # A priori, l'utilisateur s'attend à sauvegarder le cas qui est ouvert + # dans le GUI d'Eficas + self.harmonizeSelectionFromEficas() + salomeStudyItem = adaoGuiHelper.getSelectedItem() + for case_name, adao_case in self.cases.iteritems(): + if adao_case.salome_study_item.GetID() == salomeStudyItem.GetID(): + self.eficas_manager.adaoFileClose(adao_case) + break + + def _processEficasCloseEvent(self, eficasWrapper, eficasEvent): + editor = eficasEvent.callbackId + # Recuperation du cas + adao_case = self.cases[editor] + # Suppression de l'objet dans l'étude + adaoStudyEditor.removeItem(adao_case.salome_study_id, adao_case.salome_study_item) + adaoGuiHelper.refreshObjectBrowser() + # Suppression du cas + del self.cases[editor] + ####### # # Méthodes secondaires permettant de rediriger les évènements @@ -266,7 +295,7 @@ class AdaoCaseManager(EficasObserver): EficasEvent.EVENT_TYPES.CLOSE : "_processEficasCloseEvent", EficasEvent.EVENT_TYPES.SAVE : "_processEficasSaveEvent", EficasEvent.EVENT_TYPES.NEW : "_processEficasNewEvent", - EficasEvent.EVENT_TYPES.DESTROY : "_processEficasDestroyEvent", + EficasEvent.EVENT_TYPES.CLOSE : "_processEficasCloseEvent", EficasEvent.EVENT_TYPES.OPEN : "_processEficasOpenEvent", EficasEvent.EVENT_TYPES.TABCHANGED : "_processEficasTabChanged", EficasEvent.EVENT_TYPES.REOPEN : "_processEficasReOpenEvent" @@ -543,7 +572,6 @@ class AdaoGuiActionImpl(EficasObserver): EficasEvent.EVENT_TYPES.CLOSE : "_processEficasCloseEvent", EficasEvent.EVENT_TYPES.SAVE : "_processEficasSaveEvent", EficasEvent.EVENT_TYPES.NEW : "_processEficasNewEvent", - EficasEvent.EVENT_TYPES.DESTROY : "_processEficasDestroyEvent", EficasEvent.EVENT_TYPES.OPEN : "_processEficasOpenEvent", EficasEvent.EVENT_TYPES.REOPEN : "_processEficasReOpenEvent" } diff --git a/src/daSalome/daGUI/daUtils/adaoEficasEvent.py b/src/daSalome/daGUI/daUtils/adaoEficasEvent.py index f16ced4..f739253 100644 --- a/src/daSalome/daGUI/daUtils/adaoEficasEvent.py +++ b/src/daSalome/daGUI/daUtils/adaoEficasEvent.py @@ -49,7 +49,7 @@ class EficasEvent: EVENT_TYPES=Enumerate([ 'CLOSE', 'SAVE', - 'DESTROY', + 'CLOSE', 'OPEN', 'REOPEN', 'NEW',