class ETAPE(I_ETAPE.ETAPE,V_ETAPE.ETAPE,X_MCCOMPO,N_ETAPE.ETAPE):
def __init__(self,oper=None,reuse=None,args={}):
- print ('------------- ETAPE accas', oper.nom, args)
N_ETAPE.ETAPE.__init__(self,oper,reuse,args)
V_ETAPE.ETAPE.__init__(self)
def dumpXsd(self):
cata = CONTEXT.getCurrentCata()
if self.fichierSource != self.module.__file__ :
- self.dumpDifferenceModuleMetier()
- return
+ self.texteXSD = self.dumpDifferenceModuleMetier()
+ return self.texteXSD
self.texteSimple = ""
self.texteComplexe = ""
self.nomDuTypePyxb='T_'+self.code
self.texteXSD += self.texteCata
self.texteXSD += self.texteElt
self.texteXSD += texteFin
- if not PourTraduction : print (self.texteXSD)
+ #if not PourTraduction : print (self.texteXSD)
dico = {}
for k in list(cata.dictTypesXSD.keys()):
if len(cata.dictTypesXSD[k]) > 1:
#import pprint
#if (not PourTraduction) and (dico != {}) : pprint.pprint(dico)
+ return self.texteXSD
def dumpDifferenceModuleMetier(self):
self.texteElt = ""
for c in allClassToDump :
- if (isinstance(c, Accas.ETAPE)) : print (c, 'aDumper')
+ if not(isinstance(c, Accas.OPER)) and not(isinstance(c, Accas.PROC)) : continue
c.code=self.code
c.dumpXsd(inExtension=True)
self.texteSimple += c.texteSimple
#print (self.texteSimple)
#print (self.texteElt)
self.texteXSD = self.texteCata+'\n'+self.texteSimple+'\n'+self.texteElt+'\n'+texteFin+'\n'
- if not PourTraduction : print (self.texteXSD)
+ #if not PourTraduction : print (self.texteXSD)
+ return self.texteXSD
#print (listeArg)
nvlObjPerePyxb=self.perePyxb.maClasseModeleMetier(*listeArg)
#print (nvlObjPerePyxb)
- print (nvlObjPerePyxb.orderedContent())
+ #print (nvlObjPerePyxb.orderedContent())
self.perePyxb.objPyxb=nvlObjPerePyxb
self.perePyxb.objPyxb.objAccas=ancienObjPerePyxb.objAccas
# print(e.details())
def toXml(self,fichier=None):
- print ('ds to XML')
+ #print ('ds to XML')
if not self.cata.modeleMetier : return
#print ('***************',self.objPyxb,'***************',)
#print ('***************',self,'***************',)
#print ('***************',self.objPyxb.orderedContent(),'***************',)
#print(self.objPyxb.toDOM().toprettyxml())
- print(self.objPyxb.toxml())
+ #print(self.objPyxb.toxml())
return (self.objPyxb.toDOM().toprettyxml())
# positionne prealablement par un appel a setEtapeContext
if CONTEXT.debug : print(("JDC.NommerSdprod ",sd,sdnom))
- print(("JDC.NommerSdprod ",sd,sdnom))
if self._etape_context:
o=self.getContexteAvant(self._etape_context).get(sdnom,None)
if ihmQTDir not in sys.path : sys.path.append(ihmQTDir)
if editeurDir not in sys.path :sys.path.append(editeurDir)
-def getEficasSsIhm(code=None,fichier=None,ssCode=None,multi=False,langue='en',versionCode=None):
- #print (versionCode)
+def getEficasSsIhm(code=None,fichier=None,ssCode=None,multi=False,langue='en',versionCode=None, fichierCata=None):
+ if fichierCata != None : fichierCata = os.path.abspath(fichierCata)
from InterfaceQT4.qtEficasSsIhm import AppliSsIhm
- Eficas=AppliSsIhm(code=code,salome=0,ssCode=ssCode,multi=multi,langue=langue,versionCode=versionCode)
+ Eficas=AppliSsIhm(code=code,salome=0,ssCode=ssCode,multi=multi,langue=langue,versionCode=versionCode, fichierCata=fichierCata)
from Editeur import session
options=session.parse(['ssIhm','-k',code,'-v',versionCode])
return Eficas
res=app.exec_()
sys.exit(res)
+def genereXSD(code=None,fichier=None,ssCode=None,multi=False,langue='en',debug=True):
+ from Editeur import session
+ options=session.parse(sys.argv)
+ if options.code!= None : code=options.code
+ if options.ssCode!= None : ssCode=options.ssCode
+ if options.cata == None :
+ print ('Use -c cata_name.py')
+ return
+ monEficasSsIhm = getEficasSsIhm(code=code, fichierCata=options.cata)
+ monEditor=monEficasSsIhm.getEditor()
+ texteXSD=monEficasSsIhm.dumpXsd()
+
+ fileXSD = options.cata[:options.cata.rfind(".")] + '_genere.xsd'
+ f = open( str(fileXSD), 'w')
+ f.write(str(texteXSD))
+
+
def lanceEficas_ssIhm(code=None,fichier=None,ssCode=None,version=None,debug=False,langue='en'):
"""
"""
Class implementing the main user interface.
"""
- def __init__(self,code=None,salome=1,parent=None,ssCode=None,multi=False,langue='fr',ssIhm=False,versionCode=None):
+ def __init__(self,code=None,salome=1,parent=None,ssCode=None,multi=False,langue='fr',ssIhm=False,versionCode=None,fichierCata=None):
"""
Constructor
"""
print ('mauvaise utilisation de la classe Appli. Utiliser AppliSsIm SVP')
exit()
- AppliSsIhm.__init__(self,code,salome,parent,ssCode,multi,langue,ssIhm=True,versionCode=None)
+ AppliSsIhm.__init__(self,code,salome,parent,ssCode,multi,langue,ssIhm=True,versionCode=versionCode,fichierCata=fichierCata)
QMainWindow.__init__(self,parent)
Ui_Eficas.__init__(self)
"""
Class implementing the main user interface.
"""
- def __init__(self,code=None,salome=1,parent=None,ssCode=None,multi=False,langue='fr',ssIhm=True,versionCode=None):
+ def __init__(self,code=None,salome=1,parent=None,ssCode=None,multi=False,langue='fr',ssIhm=True,versionCode=None,fichierCata=None):
"""
Constructor
"""
version=getEficasVersion()
self.VERSION_EFICAS="Eficas QT5 Salome " + version
self.versionCode=versionCode
+ self.fichierCata=fichierCata
self.salome=salome
self.ssIhm=True
def initEditor(self,fichier = None,jdc = None, units = None,include=0):
- if self.editor != None :
+ if (hasattr(self, 'editor')) and self.editor != None :
print ('un seul editeur par appli')
sys.Exit()
- self.editor = JDCEditorSsIhm(self,fichier, jdc, self.myQtab,units=units,include=include)
+ #self.editor = JDCEditorSsIhm(self,fichier, jdc, self.myQtab,units=units,include=include)
+ self.editor = self.viewmanager.getNewEditorNormal()
+
+ def initEditorNormal(self,fichier = None,jdc = None, units = None,include=0):
+ if (hasattr(self, 'editor')) and self.editor != None :
+ print ('un seul editeur par appli')
+ sys.Exit()
+ #self.editor = JDCEditorSsIhm(self,fichier, jdc, self.myQtab,units=units,include=include)
+ self.editor = self.viewmanager.getNewEditorNormal()
def fileNew(self):
- self.editor=initEditor(self)
+ self.editor=self.initEditor()
def getEditor(self):
+ if (hasattr(self, 'editor')) and self.editor != None : return self.editor
+ self.initEditor()
return self.editor
def fileOpen(self,fichier):
def dumpXsd(self):
current_cata = CONTEXT.getCurrentCata()
- current_cata.dumpXsd()
- if self.maConfiguration.afficheIhm==False : exit()
+ texteXSD = current_cata.dumpXsd()
+ return texteXSD
+ #if self.maConfiguration.afficheIhm==False : exit()
+ #else : return texteXSD
#,self.fileSaveAs
#,self.fileClose
if self.ssCode is None: liste_cata_possibles = all_cata_list
else:
for catalogue in all_cata_list:
- if catalogue.code == self.code and catalogue.file_format == self.ssCode: liste_cata_possibles.append(catalogue)
+ if catalogue.code == self.code and catalogue.file_format == self.ssCode: liste_cata_possibles.append(catalogue)
+ if self.appliEficas.fichierCata != None :
+ for catalogue in all_cata_list:
+ if os.path.abspath(catalogue.cata_file_path) == self.appliEficas.fichierCata :
+ liste_cata_possibles=(catalogue,)
+ break
+
if len(liste_cata_possibles)==0:
try :
else:
# plusieurs catalogues sont disponibles : il faut demander a l'utilisateur
# lequel il veut utiliser ...
+ if self.appliEficas.ssIhm :
+ print ('Unable to know which catafile is choosen')
+ exit()
self.askChoixCatalogue(cata_choice_list)
self.demandeCatalogue=True
print ('impossible de construire le jdc')
return None
+# --------------------------------------------------------------------------------
+ def getNewEditorNormal(self,fichier = None,jdc = None, units = None,include=0):
+# --------------------------------------------------------------------------------
+
+ from InterfaceQT4.editorSsIhm import JDCEditorSsIhm
+ editor = JDCEditorSsIhm(self.appliEficas,fichier,jdc, units=units,include=include)
+ self.editor=editor
+ return editor
+
# -----------------------------
def samePath(self,f1, f2):
# ------------------------------
--- /dev/null
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# Copyright (C) 2007-2013 EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+"""
+ Ce module sert a lancer EFICAS configure pour Meteo
+"""
+# Modules Python
+# Modules Eficas
+import prefs
+name='prefs_'+prefs.code
+__import__(name)
+
+import sys
+import os
+sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'../..'))
+
+import prefs
+from InterfaceQT4 import eficas_go
+eficas_go.genereXSD(code=prefs.code)
def gener(self,obj,format='brut',config=None,appli=None):
try :
- print (obj)
self.texteXML=obj.toXml()
except :
self.texteXML='erreur generation'
def writeDefault(self,fn) :
fileXML = fn[:fn.rfind(".")] + '.xml'
#fileDico='/tmp/toto.xml'
- print (self.texteXML)
+ #print (self.texteXML)
f = open( str(fileXML), 'w')
f.write(str(self.texteXML))
f.close()