Salome HOME
commentaire
[tools/eficas.git] / Ihm / I_VALIDATOR.py
index 3e6aa3aca74218c54c3ab4e0e167b2f16d733124..ec414ba2eff2287e1a50f8a5fb0e4425d535cfc8 100644 (file)
@@ -1,52 +1,41 @@
 # -*- coding: utf-8 -*-
-"""
-   Ce module contient des classes permettant de définir des validateurs
-   pour EFICAS. Ces classes constituent un complément à des classes existantes
-   dans Noyau/N_VALIDATOR.py ou de nouvelles classes de validation.
-   Ces classes complémentaires ne servent que pour l'IHM d'EFICAS.
-   Elles servent essentiellement à ajouter des comportements spécifiques
-   IHM aux classes existantes dans le Noyau.
-   Ces comportements pourront etre rapatries dans le Noyau quand leur
-   interface sera stabilisée.
-"""
-
-import types
-
-class Valid:
-   """
-        Cette classe est la classe mere de toutes les classes complémentaires
-        que l'on trouve dans Ihm.
-   """
-
-class ListVal(Valid):pass
-
-class RangeVal(ListVal):pass
-
-class CardVal(Valid):pass
-
-class PairVal(ListVal):pass
-
-class EnumVal(ListVal):pass
-          
-class NoRepeat(ListVal):pass
-
-class LongStr(ListVal):pass
-
-class OrdList(ListVal):pass
-
-CoercableFuncs = { types.IntType:     int,
-                   types.LongType:    long,
-                   types.FloatType:   float,
-                   types.ComplexType: complex,
-                   types.UnicodeType: unicode }
-
-class TypeVal(ListVal):pass
-
-class InstanceVal(ListVal):pass
-
-class FunctionVal(Valid):pass
-
-class OrVal(Valid):pass
-
-class AndVal(Valid):pass
+# Copyright (C) 2007-2013   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
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# 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
+#
+
+from __future__ import absolute_import
+from Noyau.N_VALIDATOR import *
+
+class Compulsory(Compulsory):
+      def has_into(self):
+          return 0
+      def valide_liste_partielle(self,liste_courante=None):
+          return 1
+
+class OrdList(OrdList):
+      def valide_liste_partielle(self,liste_courante=None):
+          """
+           Methode de validation de liste partielle pour le validateur OrdList
+          """
+          try:
+             self.convert(liste_courante)
+             valid=1
+          except :
+             valid=0
+          return valid