1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2007-2017 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, identifier, cata_file_path, file_format = "python",
27 default = False, code = None,ss_code=None, user_name = None,
28 selectable = True, file_format_in = "python"):
30 This class can be used to describe an Eficas catalog.
32 :type identifier: string
33 :param identifier: unique identifier for the catalog
35 :type cata_file_path: string
36 :param cata_file_path: path of the file containing the catalog itself
38 :type file_format: string
39 :param file_format: format of the files generated when using this
42 :type default: boolean
43 :param default: indicate if this catalog is the default one (appear on
44 the top of the catalogs list)
47 :param code: Deprecated. Used to indicate the code associated to this
51 :param ss_code: scheme associated to this catalog (Map only)
53 :type user_name: string
54 :param user_name: name of the catalog as it will appear in the list
56 :type selectable: boolean
57 :param selectable: indicate if this catalog appears in the list.
58 Setting this parameter to False is useful to keep
59 old catalogs to edit existing files but to forbid
60 to use them to create new files.
63 self.identifier = identifier
64 self.cata_file_path = cata_file_path
65 self.file_format = file_format
66 self.default = default
69 self.user_name = identifier
71 self.user_name = user_name
72 self.selectable = selectable
73 self.file_format_in = file_format_in
76 def create_from_tuple(cata_tuple):
77 #print "Warning: Describing a catalog with a tuple is deprecated. " \
78 # "Please create a CatalogDescription instance directly."
79 desc = CatalogDescription(code = cata_tuple[0],
80 identifier = cata_tuple[1],
81 cata_file_path = cata_tuple[2],
82 file_format = cata_tuple[3])
84 if len(cata_tuple) == 5:
85 if cata_tuple[4] == "defaut":
88 desc.file_format_in = cata_tuple[4]