X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=Ihm%2FI_OBJECT.py;h=48c444c2d223fdcf0513c6456adbeec19767e2c7;hb=9f4ff7ed9afd87c96e11d61e442e39e5511f60d1;hp=99a54efb12cd08cb5ffe0241d88fd8c50eb13294;hpb=503f8080f65b562d3188ef92944811386f99073f;p=tools%2Feficas.git diff --git a/Ihm/I_OBJECT.py b/Ihm/I_OBJECT.py index 99a54efb..48c444c2 100644 --- a/Ihm/I_OBJECT.py +++ b/Ihm/I_OBJECT.py @@ -1,36 +1,28 @@ # -*- 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 # -# ====================================================================== """ """ -import string - +from __future__ import absolute_import import Noyau -try: - import prefs - lang=prefs.lang -except: - lang='fr' - -import CONNECTOR +from . import CONNECTOR class OBJECT: from Noyau.N_CO import CO @@ -38,13 +30,13 @@ class OBJECT: def isMCList(self): """ - Retourne 1 si self est une MCList (liste de mots-clés), 0 sinon (défaut) + Retourne 1 si self est une MCList (liste de mots-cles), 0 sinon (defaut) """ return 0 def get_regles(self): """ - Retourne les règles de self + Retourne les regles de self """ if hasattr(self,'definition'): return self.definition.regles @@ -55,7 +47,7 @@ class OBJECT: def init_modif(self): """ - Met l'état de l'objet à modified et propage au parent + Met l'etat de l'objet a modified et propage au parent qui vaut None s'il n'existe pas """ self.state = 'modified' @@ -64,11 +56,11 @@ class OBJECT: def fin_modif(self): """ - Méthode appelée après qu'une modification a été faite afin de déclencher - d'éventuels traitements post-modification + Methode appelee apres qu'une modification a ete faite afin de declencher + d'eventuels traitements post-modification """ #print "fin_modif",self - # pour les objets autres que les commandes, aucun traitement spécifique + # pour les objets autres que les commandes, aucun traitement specifique # on remonte l'info de fin de modif au parent CONNECTOR.Emit(self,"valid") if self.parent: @@ -76,13 +68,13 @@ class OBJECT: def isrepetable(self): """ - Indique si l'objet est répétable + Indique si l'objet est repetable """ return 0 def liste_mc_presents(self): """ - Retourne la liste des noms des mots clés présents + Retourne la liste des noms des mots cles presents """ return [] @@ -91,14 +83,14 @@ class OBJECT: def get_liste_mc_inconnus(self): """ - Retourne la liste des mots-clés inconnus dans self + Retourne la liste des mots-cles inconnus dans self """ return [] def verif_condition_regles(self,liste_presents): """ - Retourne la liste des mots-clés à rajouter pour satisfaire les règles - en fonction de la liste des mots-clés présents + Retourne la liste des mots-cles a rajouter pour satisfaire les regles + en fonction de la liste des mots-cles presents """ liste=[] for regle in self.definition.regles: @@ -108,42 +100,57 @@ class OBJECT: def verif_condition_bloc(self): """ Evalue les conditions de tous les blocs fils possibles - (en fonction du catalogue donc de la définition) de self et + (en fonction du catalogue donc de la definition) de self et retourne deux listes : - - la première contient les noms des blocs à rajouter - - la seconde contient les noms des blocs à supprimer + - la premiere contient les noms des blocs a rajouter + - la seconde contient les noms des blocs a supprimer """ return [],[] + def get_genealogie_precise(self): + if self.parent: + l=self.parent.get_genealogie_precise() + l.append(self.nom.strip()) + return l + else: + return [self.nom.strip()] + def get_genealogie(self): """ Retourne la liste des noms des ascendants (noms de MCSIMP,MCFACT,MCBLOC - ou ETAPE) de self jusqu'au premier objet etape rencontré + ou ETAPE) de self jusqu'au premier objet etape rencontre """ if self.parent: l=self.parent.get_genealogie() - l.append(string.strip(self.nom)) + l.append(self.nom.strip()) return l else: - return [string.strip(self.nom)] + return [self.nom.strip()] def get_fr(self): """ Retourne la chaine d'aide contenue dans le catalogue en tenant compte de la langue """ - try : - return getattr(self.definition,lang) + try: + #if 1 : + c=getattr(self.definition,self.jdc.lang) + return c except: - return '' + #else: + try : + c=getattr(self.definition,"fr") + return c + except : + return '' def update_concept(self,sd): pass def normalize(self): - """ Retourne l'objet normalisé. En général self sauf si - pour etre inséré dans l'objet père il doit etre - wrappé dans un autre objet (voir mot cle facteur). + """ Retourne l'objet normalise. En general self sauf si + pour etre insere dans l'objet pere il doit etre + wrappe dans un autre objet (voir mot cle facteur). """ return self @@ -155,3 +162,6 @@ class OBJECT: #def __del__(self): # print "__del__",self + +class ErrorObj(OBJECT):pass +