Salome HOME
Modifications liees a MT
[tools/eficas.git] / InterfaceQT4 / readercataXML.py
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2007-2013   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       self.appliEficas.format_fichier='python'
50       self.appliEficas.format_fichier_in ='xml'
51       self.modeNouvCommande=self.appliEficas.maConfiguration.modeNouvCommande
52       self.versionCode=self.appliEficas.versionCode
53       self.version_cata=None
54       self.fic_cata=None
55       self.OpenCata()
56       self.cataitem=None
57       self.titre='Eficas XML'
58       self.Ordre_Des_Commandes=None
59       self.Classement_Commandes_Ds_Arbre=()
60       self.demandeCatalogue=False
61
62       #self.traiteIcones()
63       #self.creeDicoInverse()
64
65
66    def OpenCata(self):
67
68       #self.fic_cata = 'Cata_MED_FAM.xml'
69       #xml = open('/home/A96028/QT5GitEficasTravail/eficas/Med/Cata_MED_FAM.xml').read()
70       #xml = open('/home/A96028/QT5GitEficasTravail/eficas/CataTestXSD/cata_test1.xml').read()
71       self.choisitCata()
72       xml=open(self.fic_cata).read()
73       SchemaMed = readerEfiXsd.efficas.CreateFromDocument(xml)
74       SchemaMed.exploreCata() 
75       self.cata=SchemaMed
76       uiinfo.traite_UIinfo(self.cata)
77       self.Commandes_Ordre_Catalogue=[]
78       self.cata_ordonne_dico,self.appliEficas.liste_simp_reel=autre_analyse_cata.analyseCatalogue(self.cata)
79       self.liste_groupes=None
80
81    def dumpToXml(self):
82       # pour compatibilite
83        pass