# -*- coding: utf-8 -*-
-# CONFIGURATION MANAGEMENT OF EDF VERSION
-# ======================================================================
-# COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG
-# THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-# IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY
-# THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR
-# (AT YOUR OPTION) ANY LATER VERSION.
+# Copyright (C) 2007-2013 EDF R&D
#
-# THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-# WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-# GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
#
-# YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE
-# ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER,
-# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE.
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-# ======================================================================
"""
Ce module contient la classe JDC_INCLUDE qui sert a inclure
que le jeu de commandes inclus est valide et compatible
avec le contexte avant et apres l'insertion
"""
+import string
from Accas import JDC,ASSD,AsException,JDC_CATA
from Ihm import CONNECTOR
if recorded_units is not None:self.recorded_units=recorded_units
if old_recorded_units is not None:self.old_recorded_units=old_recorded_units
+ def o_register(self,sd):
+ return self.jdc_pere.o_register(sd)
+
def NommerSdprod(self,sd,sdnom,restrict='non'):
"""
Nomme la SD apres avoir verifie que le nommage est possible : nom
#print "NommerSdprod",sd,sdnom,restrict
if self.prefix_include:
if sdnom != self.prefix_include:sdnom=self.prefix_include+sdnom
+
+ if sdnom != '' and sdnom[0] == '_':
+ # Si le nom du concept commence par le caractere _ on lui attribue
+ # un identificateur automatique comme dans JEVEUX (voir gcncon)
+ #
+ # nom commencant par __ : il s'agit de concepts qui seront detruits
+ # nom commencant par _ : il s'agit de concepts intermediaires qui seront gardes
+ # ATTENTION : il faut traiter différemment les concepts dont le nom
+ # commence par _ mais qui sont des concepts nommés automatiquement par
+ # une éventuelle sous macro.
+ if sdnom[1] in string.digits:
+ # Ce concept provient probablement d'une sous macro (cas improbable)
+ #pas de renommage
+ pass
+ elif sdnom[1] == '_':
+ #cas d'un concept à ne pas conserver apres execution de la commande
+ sdnom=sd.id[2:]
+ pass
+ else:
+ sdnom=sd.id[2:]
+ pass
+
o=self.sds_dict.get(sdnom,None)
if isinstance(o,ASSD):
- raise AsException("Nom de concept deja defini : %s" % sdnom)
+ raise AsException(tr("Nom de concept deja defini : %s" ,sdnom))
# On pourrait verifier que le jdc_pere apres l'etape etape_include
# ne contient pas deja un concept de ce nom
def supprime(self):
"""
- On ne supprime rien pour un jdc auxiliaire d'include ou de poursuite
+ On ne supprime rien directement pour un jdc auxiliaire d'include ou de poursuite
+ Utiliser supprime_aux
"""
pass
+ def supprime_aux(self):
+ #print "supprime_aux",self
+ JDC.supprime(self)
+ self.jdc_pere=None
+ self.etape_include=None
+ # self.cata_ordonne_dico={}
+ self.appli=None
+ # self.context_ini={}
+ # self.procedure=None
+
def get_contexte_avant(self,etape):
"""
Retourne le dictionnaire des concepts connus avant etape
#Regularise les etapes du jdc apres l'etape etape
self.control_jdc_context_apres(etape)
if self.etape_include:
+ #print "CONTROL_INCLUDE:",self.etape_include,self.etape_include.nom
# il existe un jdc pere. On propage la regularisation
self.etape_include.parent.control_context_apres(self.etape_include)
from Accas import AU_MOINS_UN,A_CLASSER
-JdC_include=JDC_CATA_INCLUDE(code='ASTER', execmodul=None)
+import prefs
+c=prefs.code
+JdC_include=JDC_CATA_INCLUDE(code=c, execmodul=None)
JdC_poursuite=JDC_CATA_POURSUITE(code='ASTER', execmodul=None,
regles = (AU_MOINS_UN('DEBUT','POURSUITE'),