1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2007-2021 EDF R&D
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.
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.
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
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 from builtins import object
24 class CatalogDescription(object):
26 def __init__(self, labelCode, fichierCata, formatFichierOut = "python", formatFichierIn='python',
27 default = False, code = None,ss_code=None,):
29 This class can be used to describe an Eficas catalog.
31 :type labelCode: string
32 :param labelCode: unique labelCode for the catalog
34 :type fichierCata: string
35 :param fichierCata: path of the file containing the catalog itself
37 :type fileFormatOut: string
38 :param fileFormatOut: format of the files generated when using this catalog
40 :type default: boolean
41 :param default: indicate if this catalog is the default one (appear on the top of the catalogs list)
44 :param code: Used to indicate the code associated to this catalog
47 :param ss_code: scheme associated to this catalog (Map only)
52 self.labelCode = labelCode
53 self.fichierCata = fichierCata
54 self.formatFichierOut = formatFichierOut
55 self.formatFichierIn = formatFichierIn
56 self.default = default
60 def createFromTuple(cataTuple):
61 #print "Warning: Describing a catalog with a tuple is deprecated. " \
62 # "Please create a CatalogDescription instance directly."
63 if cataTuple[0] == 'MAP' :
64 desc = CatalogDescription(code = cataTuple[0],
65 labelCode = cataTuple[1],
66 fichierCata = cataTuple[2],
67 ssCode = cataTuple[3],
68 formatFichierOut = 'MAP',
69 formatFichierIn = 'MAP')
70 elif len(cataTuple) == 4:
71 desc = CatalogDescription(code = cataTuple[0],
72 labelCode = cataTuple[1],
73 fichierCata = cataTuple[2],
74 formatFichierOut = cataTuple[3],
75 formatFichierIn = 'python')
76 elif len(cataTuple) == 5 :
77 desc = CatalogDescription(code = cataTuple[0],
78 labelCode = cataTuple[1],
79 fichierCata = cataTuple[2],
80 formatFichierOut = cataTuple[3],
81 formatFichierIn = cataTuple[4])
82 elif len(cataTuple) == 6 :
83 desc = CatalogDescription(code = cataTuple[0],
84 labelCode = cataTuple[1],
85 fichierCata = cataTuple[2],
86 formatFichierOut = cataTuple[3],
87 formatFichierIn = cataTuple[4],
90 print ('pb a la description du catalogue avec les donnees')