Salome HOME
update version
[tools/eficas.git] / InterfaceQT4 / readercataXML.py
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2007-2021   EDF R&D
3 #
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.
8 #
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.
13 #
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
17 #
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #
20 """
21     Ce module sert a lire un catalogue et a construire
22     un objet CataItem pour Eficas.
23     Il s'appuie sur la classe READERCATA
24 """
25 # Modules Python
26 import sys, os
27 import autre_analyse_cata
28
29
30 # Modules Eficas
31
32 from monChoixCata import MonChoixCata
33 from Extensions.i18n import tr
34 from Extensions.eficas_exception import EficasException
35 import uiinfo
36 from Efi2Xsd import readerEfiXsd
37 # ATtention pas teste depuis le chgt de nom
38
39 from readercata import ReaderCataCommun
40
41 class ReaderCata (ReaderCataCommun):
42
43     def __init__(self,QWParent, appliEficas):
44         self.QWParent=QWParent
45         self.appliEficas=appliEficas
46         self.VERSION_EFICAS=self.appliEficas.VERSION_EFICAS
47         self.code=self.appliEficas.code
48         self.ssCode=self.appliEficas.ssCode
49         # PN ?? bizarre le 22/04/20
50         self.appliEficas.formatfichierOut='python'
51         self.appliEficas.formatfichierIn ='xml'
52         self.modeNouvCommande=self.appliEficas.maConfiguration.modeNouvCommande
53         self.labelCode=self.appliEficas.labelCode
54         self.version_cata=None
55         self.ficCata=None
56         self.OpenCata()
57         self.cataitem=None
58         self.titre='Eficas XML'
59         self.Ordre_Des_Commandes=None
60         self.Classement_Commandes_Ds_Arbre=()
61         self.demandeCatalogue=False
62
63         #self.traiteIcones()
64         #self.creeDicoInverse()
65
66
67     def OpenCata(self):
68
69         #self.ficCata = 'Cata_MED_FAM.xml'
70         #xml = open('/home/A96028/QT5GitEficasTravail/eficas/Med/Cata_MED_FAM.xml').read()
71         #xml = open('/home/A96028/QT5GitEficasTravail/eficas/CataTestXSD/cata_test1.xml').read()
72         self.choisitCata()
73         xml=open(self.ficCata).read()
74         SchemaMed = readerEfiXsd.efficas.CreateFromDocument(xml)
75         SchemaMed.exploreCata()
76         self.cata=SchemaMed
77         uiinfo.traite_UIinfo(self.cata)
78         self.Commandes_Ordre_Catalogue=[]
79         self.cata_ordonne_dico,self.appliEficas.liste_simp_reel=autre_analyse_cata.analyseCatalogue(self.cata)
80         self.liste_groupes=None
81
82     def dumpToXml(self):
83         # pour compatibilite
84         pass