1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2007-2013 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
20 class CatalogDescription:
22 def __init__(self, identifier, cata_file_path, file_format = "python",
23 default = False, code = None,ss_code=None, user_name = None,
24 selectable = True, file_format_in = "python"):
26 This class can be used to describe an Eficas catalog.
28 :type identifier: string
29 :param identifier: unique identifier for the catalog
31 :type cata_file_path: string
32 :param cata_file_path: path of the file containing the catalog itself
34 :type file_format: string
35 :param file_format: format of the files generated when using this
38 :type default: boolean
39 :param default: indicate if this catalog is the default one (appear on
40 the top of the catalogs list)
43 :param code: Deprecated. Used to indicate the code associated to this
47 :param ss_code: scheme associated to this catalog (Map only)
49 :type user_name: string
50 :param user_name: name of the catalog as it will appear in the list
52 :type selectable: boolean
53 :param selectable: indicate if this catalog appears in the list.
54 Setting this parameter to False is useful to keep
55 old catalogs to edit existing files but to forbid
56 to use them to create new files.
59 self.identifier = identifier
60 self.cata_file_path = cata_file_path
61 self.file_format = file_format
62 self.default = default
65 self.user_name = identifier
67 self.user_name = user_name
68 self.selectable = selectable
69 self.file_format_in = file_format_in
72 def create_from_tuple(cata_tuple):
73 #print "Warning: Describing a catalog with a tuple is deprecated. " \
74 # "Please create a CatalogDescription instance directly."
75 desc = CatalogDescription(code = cata_tuple[0],
76 identifier = cata_tuple[1],
77 cata_file_path = cata_tuple[2],
78 file_format = cata_tuple[3])
80 if len(cata_tuple) == 5:
81 if cata_tuple[4] == "defaut":
84 desc.file_format_in = cata_tuple[4]