Salome HOME
update version
[tools/eficas.git] / Ihm / I_PROC_ETAPE.py
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2007-2021   EDF R&D
3 #
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License.
8 #
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 # Lesser General Public License for more details.
13 #
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 #
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #
20 from __future__ import absolute_import
21 from . import I_ETAPE
22
23
24 # import rajoutes suite a l'ajout de buildSd --> a resorber
25 import sys
26 import traceback,types
27 import Noyau
28 from Noyau import N_Exception
29 from Noyau.N_Exception import AsException
30 from Extensions.eficas_exception import EficasException
31
32 class PROC_ETAPE(I_ETAPE.ETAPE):
33     def getSdname(self):
34         return ""
35
36     def getSdprods(self,nom_sd):
37         """
38            Fonction : retourne le concept produit par l etape de nom nom_sd
39            s il existe sinon None
40            Une PROC ne produit aucun concept
41         """
42         return None
43
44     def supprimeSdProds(self):
45         """
46            Fonction: Lors d'une destruction d'etape, detruit tous les concepts produits
47            Une procedure n'en a aucun
48         """
49         return
50
51     def deleteConcept(self,sd):
52         """
53             Fonction : Mettre a jour les mots cles de l etape
54             suite a la disparition du concept sd
55             Seuls les mots cles simples MCSIMP font un traitement autre
56             que de transmettre aux fils
57
58             Inputs :
59                - sd=concept detruit
60         """
61         for child in self.mcListe :
62             child.deleteConcept(sd)
63
64     def replaceConcept(self,old_sd,sd):
65         """
66             Fonction : Mettre a jour les mots cles de l etape
67             suite au remplacement du concept old_sd
68
69             Inputs :
70                - old_sd=concept remplace
71                - sd=nouveau concept
72         """
73         for child in self.mcListe :
74             child.replaceConcept(old_sd,sd)
75
76 #ATTENTION SURCHARGE: a garder en synchro ou a reintegrer dans le Noyau
77     def buildSd(self):
78         """
79              Methode de Noyau surchargee pour poursuivre malgre tout
80              si une erreur se produit pendant la creation du concept produit
81         """
82         try:
83             sd=Noyau.N_PROC_ETAPE.PROC_ETAPE.buildSd(self)
84         except AsException  :
85             # Une erreur s'est produite lors de la construction du concept
86             # Comme on est dans EFICAS, on essaie de poursuivre quand meme
87             # Si on poursuit, on a le choix entre deux possibilites :
88             # 1. on annule la sd associee a self
89             # 2. on la conserve mais il faut la retourner
90             # En plus il faut rendre coherents sdnom et sd.nom
91             self.sd=None
92             self.sdnom=None
93             self.state="unchanged"
94             self.valid=0