1 # -*- coding: utf-8 -*-
2 # CONFIGURATION MANAGEMENT OF EDF VERSION
3 # ======================================================================
4 # COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG
5 # THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
6 # IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY
7 # THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR
8 # (AT YOUR OPTION) ANY LATER VERSION.
10 # THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
11 # WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
12 # MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
13 # GENERAL PUBLIC LICENSE FOR MORE DETAILS.
15 # YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE
16 # ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER,
17 # 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE.
20 # ======================================================================
22 class CatalogDescription:
24 def __init__(self, identifier, cata_file_path, file_format = "python",
25 default = False, code = None, user_name = None,
26 selectable = True, file_format_in = "python"):
28 This class can be used to describe an Eficas catalog.
30 :type identifier: string
31 :param identifier: unique identifier for the catalog
33 :type cata_file_path: string
34 :param cata_file_path: path of the file containing the catalog itself
36 :type file_format: string
37 :param file_format: format of the files generated when using this
40 :type default: boolean
41 :param default: indicate if this catalog is the default one (appear on
42 the top of the catalogs list)
45 :param code: Deprecated. Used to indicate the code associated to this
48 :type user_name: string
49 :param user_name: name of the catalog as it will appear in the list
51 :type selectable: boolean
52 :param selectable: indicate if this catalog appears in the list.
53 Setting this parameter to False is useful to keep
54 old catalogs to edit existing files but to forbid
55 to use them to create new files.
58 self.identifier = identifier
59 self.cata_file_path = cata_file_path
60 self.file_format = file_format
61 self.default = default
64 self.user_name = identifier
66 self.user_name = user_name
67 self.selectable = selectable
68 self.file_format_in = file_format_in
71 def create_from_tuple(cata_tuple):
72 #print "Warning: Describing a catalog with a tuple is deprecated. " \
73 # "Please create a CatalogDescription instance directly."
74 desc = CatalogDescription(code = cata_tuple[0],
75 identifier = cata_tuple[1],
76 cata_file_path = cata_tuple[2],
77 file_format = cata_tuple[3])
78 if len(cata_tuple) == 5:
79 if cata_tuple[4] == "defaut":
82 desc.file_format_in = cata_tuple[4]