--- /dev/null
+# Copyright (C) 2007-2022 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
+#
+
+from Accas.extensions.eficas_translation import tr
+
+# import traceback
+# traceback.print_stack()
+
+from Accas.IO.reader.reader_python import Pythonparser
+
+
+def entryPoint():
+ """
+ Return a dictionary containing the description needed to load the plugin
+ """
+ return {"name": "pythonUQ", "factory": pythonUQParser}
+
+
+class pythonUQParser(Pythonparser):
+ """
+ This converter works like Pythonparser, except that it also initializes all
+ links between deterministic and probabilistic variables
+ """
+
+ def convert(self, outformat, appliEficas=None):
+ text = Pythonparser.convert(self, outformat, appliEficas)
+ return text
+
+ def traitementApresLoad(self, jdc):
+ debug = 0
+ if debug:
+ print("traitementApresLoad")
+ etapeIncertitude = jdc.getEtapesByName("ExpressionIncertitude")
+ if etapeIncertitude == []:
+ return
+
+ incertitudeInput = etapeIncertitude[0].getChildOrChildInBloc("Input")
+ self.lesVariablesInput = incertitudeInput[0].getChildOrChildInBloc(
+ "VariableProbabiliste"
+ )
+ for mc in self.lesVariablesInput:
+ # if debug : print (mc,'mc')
+ mcVDPath = mc.getChild("MCPath").valeur
+ if debug:
+ print(mcVDPath)
+ # a modifier lorsque le MCPath comprendra le nom des OPERs
+ if not (mcVDPath):
+ mc.parent.suppentite(mc)
+ break # on admet ici que le . comm n est pas valide
+ mcModelVariable = mc.getChild("ModelVariable")
+ mcModelVariable.definition.addInto(mcModelVariable.valeur)
+ # try :
+ # mcObjectName=mc.getChild('ObjectName')
+ # mcObjectName.changeStatut('f')
+ # except :
+ # pass
+ mcCherche = jdc.getObjetByMCPath(mcVDPath)
+ if not (mcCherche):
+ mc.parent.suppentite(mc)
+ break # on admet ici que le . comm n est pas valide
+ if debug:
+ print(mcCherche)
+ if mc.nature == "MCFACT":
+ mc[0].variableDeterministe = mcCherche
+ mcCherche.variableProbabiliste = mc[0]
+ else:
+ mc.variableDeterministe = mcCherche
+ mcCherche.variableProbabiliste = mc[0]
+ mcCherche.definition.siValide = mcCherche.changeValeursRefUQ
+ mcCherche.associeVariableUQ = True
+ itemConsigne = mc.getChild("Consigne")
+ itemConsigne.setValeur(
+ "la valeur entrée pour {} est {}".format(
+ mcCherche.nom, mcCherche.valeur
+ )
+ )
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+import re
from Accas.extensions.eficas_translation import tr
-
-# import traceback
-# traceback.print_stack()
-
from Accas.IO.reader.reader_python import Pythonparser
-
def entryPoint():
"""
Return a dictionary containing the description needed to load the plugin
"""
- return {"name": "pythonUQ", "factory": pythonUQParser}
-
+ return {
+ 'name' : 'pythonUQ',
+ 'factory' : pythonUQParser
+ }
class pythonUQParser(Pythonparser):
"""
"""
def convert(self, outformat, appliEficas=None):
- text = Pythonparser.convert(self, outformat, appliEficas)
+ text=Pythonparser.convert(self, outformat, appliEficas)
return text
- def traitementApresLoad(self, jdc):
- debug = 0
- if debug:
- print("traitementApresLoad")
- etapeIncertitude = jdc.getEtapesByName("ExpressionIncertitude")
- if etapeIncertitude == []:
- return
-
- incertitudeInput = etapeIncertitude[0].getChildOrChildInBloc("Input")
- self.lesVariablesInput = incertitudeInput[0].getChildOrChildInBloc(
- "VariableProbabiliste"
- )
- for mc in self.lesVariablesInput:
- # if debug : print (mc,'mc')
- mcVDPath = mc.getChild("MCPath").valeur
- if debug:
- print(mcVDPath)
- # a modifier lorsque le MCPath comprendra le nom des OPERs
- if not (mcVDPath):
- mc.parent.suppentite(mc)
- break # on admet ici que le . comm n est pas valide
- mcModelVariable = mc.getChild("ModelVariable")
+ def traitementApresLoad(self,jdc):
+ debug=0
+ if debug : print ('traitementApresLoad')
+ etapeIncertitude=jdc.getEtapesByName('ExpressionIncertitude')
+ if etapeIncertitude==[] : return
+
+ incertitudeInput = etapeIncertitude[0].getChildOrChildInBloc('Input')[0]
+ self.lesVariablesInput = incertitudeInput.getChildOrChildInBloc('VariableProbabiliste')
+ for mc in self.lesVariablesInput :
+ if debug : print (mc,'mc')
+ mcVDPath=mc.getChild('MCPath').valeur
+ if debug : print(mcVDPath)
+ if not (mcVDPath) :
+ try: mc.parent.suppentite(mc)
+ except : pass
+ break # on admet ici que le . comm n est pas valide
+ mcModelVariable=mc.getChild('ModelVariable')
mcModelVariable.definition.addInto(mcModelVariable.valeur)
- # try :
- # mcObjectName=mc.getChild('ObjectName')
- # mcObjectName.changeStatut('f')
- # except :
- # pass
- mcCherche = jdc.getObjetByMCPath(mcVDPath)
- if not (mcCherche):
- mc.parent.suppentite(mc)
- break # on admet ici que le . comm n est pas valide
- if debug:
- print(mcCherche)
- if mc.nature == "MCFACT":
- mc[0].variableDeterministe = mcCherche
- mcCherche.variableProbabiliste = mc[0]
- else:
- mc.variableDeterministe = mcCherche
- mcCherche.variableProbabiliste = mc[0]
- mcCherche.definition.siValide = mcCherche.changeValeursRefUQ
- mcCherche.associeVariableUQ = True
- itemConsigne = mc.getChild("Consigne")
- itemConsigne.setValeur(
- "la valeur entrée pour {} est {}".format(
- mcCherche.nom, mcCherche.valeur
- )
- )
+
+ mcDeterministe=jdc.getObjetByMCPath(mcVDPath)
+ if debug : print ('mcDeterministe', mcDeterministe, 'trouve a partir de ', mcVDPath)
+ if not (mcDeterministe) :
+ try: mc.parent.suppentite(mc)
+ except : pass
+ break # on admet ici que le . comm n est pas valide
+ if debug : print('mcDeterministe',mcDeterministe, mcDeterministe.nom)
+
+ mc.variableDeterministe=mcDeterministe
+ if debug : print ('variableDeterministe pour ', mc, 'mis a ', mcDeterministe)
+ mcDeterministe.variableProbabiliste=mc
+ if debug : print ('variableProbabiliste pour ', mcDeterministe, 'mis a ', mc)
+
+ mcDeterministe.definition.siValide = mcDeterministe.changeValeursRefUQ
+ mcDeterministe.associeVariableUQ = True
+ # il ne faut pas mettre la consigne a jour. Elle le sera a la validation sans erreur sur les valeurs
+
nom=fichier,
appliEficas=self.jdc.appliEficas,
cata=self.jdc.cata,
- cata_ord_dico=self.jdc.cata_ordonne_dico,
+ dicoCataOrdonne=self.jdc.dicoCataOrdonne,
context_ini=context_ini,
jdc_pere=self.jdc,
etape_include=self,
# Attention : les mots clefs listes (+sieurs fact )
# n ont pas toutes ces methodes. a priori pas appele mais
if self.nature != "MCLIST":
- self.listeMc = self.getListeMcOrdonnee(genea, self.jdc.cata_ordonne_dico)
+ self.listeMc = self.getListeMcOrdonnee(genea, self.jdc.dicoCataOrdonne)
listeNomsPresents = self.dictMcPresents()
for regle in self.getRegles():
(monToolTip, regleOk) = regle.verif(listeNomsPresents)
Retourne l'index dans la liste des fils de self du nouveau fils de nom nom_fils
Permet de savoir a quelle position il faut ajouter un nouveau mot-cle
"""
- cata_ordonne = self.jdc.cata_ordonne_dico
+ cata_ordonne = self.jdc.dicoCataOrdonne
liste_noms_mc_ordonnee = self.getListeMcOrdonneeBrute(
self.getGenealogie(), cata_ordonne
)
listeSimpReel.append(objet.nom)
-def analyseNiveau(cata_ordonne_dico, niveau, listeSimpReel):
+def analyseNiveau(dicoCataOrdonne, niveau, listeSimpReel):
"""
Analyse un niveau dans un catalogue de commandes
"""
# Il n'y a pas de sous niveaux
for oper in niveau.entites:
traiteEntite(oper, listeSimpReel)
- cata_ordonne_dico[oper.nom] = oper
+ dicoCataOrdonne[oper.nom] = oper
else:
for niv in niveau.lNiveaux:
- analyseNiveau(cata_ordonne_dico, niv)
+ analyseNiveau(dicoCataOrdonne, niv)
def analyseCatalogue(cata):
Elle retourne un dictionnaire qui contient toutes les commandes
du catalogue indexees par leur nom
"""
- cata_ordonne_dico = {}
+ dicoCataOrdonne = {}
listeSimpReel = []
if cata.JdC.lNiveaux == ():
# Il n'y a pas de niveaux
for oper in cata.JdC.commandes:
traiteEntite(oper, listeSimpReel)
- cata_ordonne_dico[oper.nom] = oper
+ dicoCataOrdonne[oper.nom] = oper
else:
for niv in cata.JdC.lNiveaux:
- analyseNiveau(cata_ordonne_dico, niv, listeSimpReel)
- return cata_ordonne_dico, listeSimpReel
+ analyseNiveau(dicoCataOrdonne, niv, listeSimpReel)
+ return dicoCataOrdonne, listeSimpReel
if __name__ == "__main__":
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-# Classe permettant d ajouter un catalogue par un utilisateur
-# Attention plus utilisé car peu utile
+# Classe permettant a un utilisateur d ajouter un catalogue
# permet d avoir les valeurs par defaut dans le tuple
# Exemple dans un pref.py
-# self.catalogues = (CatalogDescription("monCata", os.path.join(repIni, "monCata.py")),)
+# gere les ssCodes autrefois utilises par Map
+# self.catalogues = (CatalogDescription("monCataVO", os.path.join(repIni, "monCata.py")),)
class CatalogDescription(object):
def __init__(
self,
- labelCode,
+ versionCode,
fichierCata,
formatFichierOut="python",
formatFichierIn="python",
"""
This class can be used to describe an Eficas catalog.
- :type labelCode: string
- :param labelCode: unique labelCode for the catalog
+ :type versionCode: string
+ :param versionCode: unique versionCode for the catalog
:type fichierCata: string
:param fichierCata: path of the file containing the catalog itself
"""
- self.labelCode = labelCode
+ self.versionCode = versionCode
self.fichierCata = fichierCata
self.formatFichierOut = formatFichierOut
self.formatFichierIn = formatFichierIn
self.code = code
self.ssCode = ssCode
if userName is None:
- self.userName = labelCode
+ self.userName = versionCode
else:
self.userName = userName
self.selectable = selectable
desc = CatalogDescription(
code=cataTuple[0],
ssCode=cataTuple[1],
- labelCode=cataTuple[0] + cataTuple[1],
+ versionCode=cataTuple[0] + cataTuple[1],
fichierCata=cataTuple[2],
formatFichierOut=cataTuple[3],
formatFichierIn=cataTuple[4],
if cataTuple[0] == "MAP":
desc = CatalogDescription(
code=cataTuple[0],
- labelCode=cataTuple[1],
+ versionCode=cataTuple[1],
fichierCata=cataTuple[2],
ssCode=cataTuple[3],
formatFichierOut="MAP",
elif len(cataTuple) == 4:
desc = CatalogDescription(
code=cataTuple[0],
- labelCode=cataTuple[1],
+ versionCode=cataTuple[1],
fichierCata=cataTuple[2],
formatFichierOut=cataTuple[3],
formatFichierIn="python",
elif len(cataTuple) == 5:
desc = CatalogDescription(
code=cataTuple[0],
- labelCode=cataTuple[1],
+ versionCode=cataTuple[1],
fichierCata=cataTuple[2],
formatFichierOut=cataTuple[3],
formatFichierIn=cataTuple[4],
elif len(cataTuple) == 6:
desc = CatalogDescription(
code=cataTuple[0],
- labelCode=cataTuple[1],
+ versionCode=cataTuple[1],
fichierCata=cataTuple[2],
formatFichierOut=cataTuple[3],
formatFichierIn=cataTuple[4],
pathGui='InterfaceGUI.'+ self.appliEficas.GUIPath + '.monChoixCata'
MonChoixCata =__import__(pathGui, globals(), locals(), ['MonChoixCata,'])
widgetChoix = MonChoixCata.MonChoixCata(
- self.appliEficas, [cata.labelCode for cata in cataListeChoix], title
+ self.appliEficas, [cata.versionCode for cata in cataListeChoix], title
)
ret = widgetChoix.exec_()
#if ret == QDialog.Accepted:
if ret == 1:
cata = cataListeChoix[widgetChoix.CBChoixCata.currentIndex()]
self.fichierCata = cata.fichierCata
- self.labelCode = cata.labelCode
+ self.versionCode = cata.versionCode
self.appliEficas.formatFichierOut = cata.formatFichierOut
self.appliEficas.formatFichierIn = cata.formatFichierIn
- titre='{} pour {} avec le catalogue {}'.format(self.appliEficas.versionEficas,self.code,self.labelCode)
+ titre='{} pour {} avec le catalogue {}'.format(self.appliEficas.versionEficas,self.code,self.versionCode)
self.appliEficas.setWindowTitle(titre)
widgetChoix.close()
else:
raise EficasException()
def choisitCata(self):
- # ____________________
+ #--------------------#
listeCataPossibles = []
else:
print(("Catalog description cannot be interpreted: ", catalogue))
- if self.labelCode is None:
+ if self.versionCode is None:
listeCataPossibles = listeTousLesCatas
else:
+ # a priori impossible sans l idee du sousCode
for catalogue in listeTousLesCatas:
- if catalogue.code == self.code and catalogue.ssCode == self.ssCode:
+ if catalogue.code == self.code and catalogue.versionCode == self.versionCode:
listeCataPossibles.append(catalogue)
if len(listeCataPossibles) == 0:
if self.appliEficas.salome == 0: sys.exit(1)
return
- if self.labelCode is not None:
+ if self.versionCode is not None:
# La version a ete fixee
for cata in listeCataPossibles:
- if self.labelCode == cata.labelCode:
+ if self.versionCode == cata.versionCode:
self.fichierCata = cata.fichierCata
- self.labelCode = cata.labelCode
+ self.versionCode = cata.versionCode
self.appliEficas.formatFichierOut = cata.formatFichierOut
self.appliEficas.formatFichierIn = cata.formatFichierIn
else:
if self.appliEficas.fichierCata != None:
trouve = False
for catalogue in listeTousLesCatas:
- if os.path.abspath(catalogue.fichierCata) == (
- os.path.abspath(self.appliEficas.fichierCata)
- ):
+ if os.path.abspath(catalogue.fichierCata) == ( os.path.abspath(self.appliEficas.fichierCata)):
listeCataPossibles = (catalogue,)
trouve = True
break
if not trouve:
+ # utilise par Telemac
catalogue = CatalogDescription.createFromTuple(
- (
- self.code,
- self.code,
- self.appliEficas.fichierCata,
- "python",
- "python",
- )
+ ( self.code, self.code, self.appliEficas.fichierCata, "python", "python",)
)
listeCataPossibles = (catalogue,)
return
# le label est fixe dans la ligne de commande
- if self.labelCode is not None:
+ if self.versionCode is not None:
# La version a ete fixee
for cata in listeCataPossibles:
- if self.labelCode == cata.labelCode:
+ if self.versionCode == cata.versionCode:
self.fichierCata = cata.fichierCata
self.appliEficas.formatFichierIn = cata.formatFichierIn
self.appliEficas.formatFichierOut = cata.formatFichierOut
else:
cataListeChoix = []
for cata in listeCataPossibles:
- if cata.default:
- cataListeChoix.insert(0, cata)
- else:
- cataListeChoix.append(cata)
+ if cata.default: cataListeChoix.insert(0, cata)
+ else: cataListeChoix.append(cata)
if len(cataListeChoix) == 0:
self.appliEficas.afficheMessage(
elif len(cataListeChoix) == 1:
self.fichierCata = cataListeChoix[0].fichierCata
- self.labelCode = cataListeChoix[0].labelCode
+ self.versionCode = cataListeChoix[0].versionCode
self.appliEficas.formatFichierOut = cataListeChoix[0].formatFichierOut
self.appliEficas.formatFichierIn = cataListeChoix[0].formatFichierIn
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(cataListeChoix)
+ print ('PN : --> passer la commande askChoixCatalogue dans Editor avec sortie pour non QT / non Web')
+ #self.appliEficas.afficheMessage( tr("Import du catalogue"), tr('Aucun catalogue choisi'), critique = True)
self.demandeCatalogue = True
+ self.askChoixCatalogue(cataListeChoix)
if self.fichierCata == None:
if self.appliEficas.salome == 0:
- print(
- (
- "Pas de catalogue pour code %s, version %s"
- % (self.code, self.labelCode)
- )
- )
+ print( "Pas de catalogue pour code %s, version %s" % (self.code, self.versionCode))
sys.exit(1)
else:
self.appliEficas.close()
self.demandeCatalogue = False
self.code = self.appliEficas.code
self.titre = self.appliEficas.code
- self.ssCode = self.appliEficas.ssCode
# on positionne par defaut mais est-ce vraiment necessaire
self.appliEficas.formatFichierIn = "python"
self.appliEficas.formatFichierOut = "python"
- self.labelCode = self.appliEficas.labelCode
+ self.versionCode = self.appliEficas.versionCode
self.fichierCata = self.appliEficas.fichierCata
self.openCata()
self.traiteIcones()
self.creeDicoCasToCata()
def openCata(self):
- # _________________________________
+ # _________________
"""
Ouvre le catalogue standard du code courant, cad le catalogue present
dans le repertoire Cata
if self.code == "NonConnu": self.code = self.cata.JdC.code
modeleMetier = None
dicoEltDif = {}
- if not (self.appliEficas.genereXSD):
- if self.appliEficas.maConfiguration.withXSD or self.appliEficas.withXSD:
+ if not(self.appliEficas.genereXSD) and self.appliEficas.withXSD:
try:
import pyxb
except:
# print ('dans readerCata _________', dicoEltDif)
except Exception as e :
- if self.appliEficas.ssIhm == False:
- self.appliEficas.afficheMessage(
- "XSD driver", "unable to load xsd driver", critique=False
- )
- print (e)
+ self.appliEficas.afficheMessage( "XSD driver", "unable to load xsd driver" + str(e), critique=False)
modeleMetier = None
self.cata.DicoNomTypeDifferentNomElt = dicoEltDif
self.cata.JdC.importedBy = self.cata.importedBy
else:
self.cata.JdC.importedBy = []
- self.cata.JdC.labelCode = self.labelCode
+ self.cata.JdC.versionCode = self.versionCode
if not (hasattr(self.cata, "dict_condition")):
self.cata.dict_condition = {}
sys.exit(1)
#
# retrouveOrdreCataStandard fait une analyse textuelle du catalogue
- # retrouveOrdreCataImpose qui utilise une numerotation
- # des mots cles a la creation
- #if self.appliEficas.maConfiguration.modeNouvCommande == "initial": self.retrouveOrdreCata()
- #else : self.retrouveOrdreCataImpose()
+ # retrouveOrdreCataImpose utilise une numerotation des mots cles a la creation
self.retrouveOrdreCata()
self.retrouveOrdreCataImpose()
if hasattr(self.cata, "ordreDesCommandes"):
#
uiinfo.traite_UIinfo(self.cata)
- #
- # traitement des clefs documentaires
- #
-
self.titre = (
- self.versionEficas
- + " "
- + tr(" avec le catalogue ")
+ self.versionEficas + tr(" avec le catalogue ")
+ os.path.basename(self.fichierCata)
)
- if self.appliEficas.ssIhm == False:
- self.appliEficas.setWindowTitle(self.titre)
self.editor.titre = self.titre
+ if hasattr(self.appliEficas, 'setWindowTitle') :
+ self.appliEficas.setWindowTitle(self.titre)
- # incertitude --> change le convert
- if hasattr(self.cata, "avecIncertitude"):
- self.appliEficas.ajoutUQ()
+ # incertitude ou modification du Catalogue
+ if hasattr(self.cata, "avecIncertitude"): self.appliEficas.ajoutUQ()
if hasattr(self.cata, "modifieCatalogueDeterministe"):
self.cata.modifieCatalogueDeterministe(self.cata)
if k[0 : len(nomCata) + 1] == nomCata + ".":
del sys.modules[k]
- # permet d ajouter des scripts appelables par des fonctions supplementaires
+ # permettait d ajouter des scripts appelables par des fonctions supplementaires
# dans l ihm
- mesScriptsNomFichier = "mesScripts_" + self.code.upper()
- try: self.appliEficas.mesScripts[self.code] = __import__(mesScriptsNomFichier)
- except: pass
+ # par exemple permet d ajouter des morceaux dans le jeu de données
+ # mecanisme mis en place pout MT et laisse pour pouvoir eventuellement
+ # etre repris
+ # mesScriptsNomFichier = "mesScripts_" + self.code.upper()
+ # try: self.appliEficas.mesScripts[self.code] = __import__(mesScriptsNomFichier)
+ # except: pass
try:
#import importlib.util
Pour chaque entite du catalogue on cree une liste de nom ordreMC qui
contient le nom des mots cles dans le bon ordre
"""
- self.cata_ordonne_dico, self.appliEficas.liste_simp_reel = analyse_ordre_catalogue.analyseCatalogue(self.cata)
- # self.appliEficas.liste_simp_reel = ()
- # self.cata_ordonne_dico = {}
+ self.dicoCataOrdonne, self.appliEficas.liste_simp_reel = analyse_ordre_catalogue.analyseCatalogue(self.cata)
def retrouveOrdreCataImpose(self):
"""
-# -*- coding: utf-8 -*-
+sC -*- coding: utf-8 -*-
# Copyright (C) 2007-2024 EDF R&D
#
# This library is free software; you can redistribute it and/or
class ReaderCata(ReaderCataCommun):
+# essai de lecture de catalogue en XML
+# obsolete
def __init__(self, appliEficas, editor):
self.appliEficas = appliEficas
self.editor = editor
self.versionEficas = self.appliEficas.versionEficas
self.code = self.appliEficas.code
- self.ssCode = self.appliEficas.ssCode
- # PN ?? bizarre le 22/04/20
+
+ # PN ?? bizarre le 22/04/24
self.appliEficas.formatfichierOut = "python"
self.appliEficas.formatfichierIn = "xml"
self.modeNouvCommande = self.appliEficas.maConfiguration.modeNouvCommande
- self.labelCode = self.appliEficas.labelCode
+ self.versionCode = self.appliEficas.versionCode
self.version_cata = None
self.ficCata = None
self.OpenCata()
self.cata = SchemaMed
uiinfo.traite_UIinfo(self.cata)
#self.commandesOrdreCatalogue = []
- self.cata_ordonne_dico, self.appliEficas.liste_simp_reel = autre_analyse_cata.analyseCatalogue(self.cata)
+ self.dicoCataOrdonne, self.appliEficas.liste_simp_reel = autre_analyse_cata.analyseCatalogue(self.cata)
self.liste_groupes = None
def dumpToXml(self):
procedure=self.valeur,
definition=self.jdc.definition,
cata=self.jdc.cata,
- cata_ord_dico=self.jdc.cata_ordonne_dico,
+ dicoCataOrdonne=self.jdc.dicoCataOrdonne,
context_ini=context_ini,
)
J.analyse()
definition=None,
procedure=None,
cata=None,
- cata_ord_dico=None,
+ dicoCataOrdonne=None,
parent=None,
nom="SansNom",
appliEficas=None,
definition=definition,
procedure=procedure,
cata=cata,
- cata_ord_dico=cata_ord_dico,
+ dicoCataOrdonne=dicoCataOrdonne,
parent=parent,
nom=nom,
appli=appliEficas,
JDC.supprime(self)
self.jdc_pere = None
self.etape_include = None
- # self.cata_ordonne_dico={}
+ # self.dicoCataOrdonne={}
self.appliEficas = None
# self.context_ini={}
from Accas.processing.P_utils import SEP
- def __init__( self, definition=None, procedure=None, cata=None, cata_ord_dico=None,
+ def __init__( self, definition=None, procedure=None, cata=None, dicoCataOrdonne=None,
parent=None, nom="SansNom", appliEficas=None, context_ini=None, **args):
self.procedure = procedure
self.definition = definition
self.cata = cata
self._build_reserved_kw_list()
- self.cata_ordonne_dico = cata_ord_dico
+ self.dicoCataOrdonne = dicoCataOrdonne
self.nom = nom
self.appliEficas = appliEficas
self.parent = parent
if isinstance(sd, ASSD):
self.sdsDict[sdnom] = sd
- # if self.appliEficas != None:
- # self.appliEficas.afficheInfos(
- # 'Interpretation du fichier de commandes en cours ...')
# On sauve le contexte pour garder la memoire des constantes
# En mode edition (EFICAS) ou lors des verifications le contexte
self.listeUserASSDDumpes = set()
self.listeTypeTXMAvecBlancs = set()
- def __call__( self, procedure=None, cata=None, cata_ord_dico=None, nom="SansNom",
+ def __call__( self, procedure=None, cata=None, dicoCataOrdonne=None, nom="SansNom",
parent=None, **args):
"""
Construit l'objet JDC a partir de sa definition (self),
definition=self,
procedure=procedure,
cata=cata,
- cata_ord_dico=cata_ord_dico,
+ dicoCataOrdonne=dicoCataOrdonne,
nom=nom,
parent=parent,
**args
Ordonne la liste suivant l'ordre du catalogue.
Seulement pour IHM graphique
"""
- if self.jdc and self.jdc.cata_ordonne_dico != None:
+ if self.jdc and self.jdc.dicoCataOrdonne != None:
liste_noms_mc_ordonnee = self.getListeMcOrdonneeBrute(
- self.getGenealogie(), self.jdc.cata_ordonne_dico
+ self.getGenealogie(), self.jdc.dicoCataOrdonne
)
return self.ordonneListeMc(mcListe, liste_noms_mc_ordonnee)
else:
self.nom = nom
self.val = val
self.parent = parent
+ self.associeVariableUQ = False
self.objPyxbDeConstruction = objPyxbDeConstruction
if parent:
self.jdc = self.parent.jdc
import prefs
from InterfaceQT4 import eficas_go
print (prefs.code)
-eficas_go.lanceEficas(code=prefs.code)
+eficas_go.lanceQtEficas(code=prefs.code)
from InterfaceQT4 import eficas_go
-dico=eficas_go.lanceEficas_param(code=prefs.code,fichier="/local00/home/A96028/GitEficas/eficas/Adao/exemple01.comm",version="V760",macro="ASSIMILATION_STUDY")
+dico=eficas_go.lanceQtEficas_param(code=prefs.code,fichier="/local00/home/A96028/GitEficas/eficas/Adao/exemple01.comm",version="V760",macro="ASSIMILATION_STUDY")
#print dico
import pprint
#sys.setdefaultencoding('latin1')
from InterfaceQT4 import eficas_go
-eficas_go.lanceEficas(code=prefs.code)
+eficas_go.lanceQtEficas(code=prefs.code)
import prefs
from InterfaceQT4 import eficas_go
-eficas_go.lanceEficas(code=prefs.code)
+eficas_go.lanceQtEficas(code=prefs.code)
# simulation de la recuperation zone
#import eficasSalome
#eficasSalome.runEficas(code='MT',fichier='/home/I29518/test_zone.comm')
- appli.viewmanager.handleOpen(fichier='/home/A96028/Install_EficasV1/EficasV1/MT/MT_include.comm')
+ appli.editorManager.handleOpen(fichier='/home/A96028/Install_EficasV1/EficasV1/MT/MT_include.comm')
def import_zone2(listeparam,appli) :
editor=listeparam[0]
print ('Unable to import {}').format(prefFile)
exit(1)
from Editeur import eficas_go
-eficas_go.lanceEficas(code=code,GUIPath='QT5')
+eficas_go.lanceQtEficas(code=code,GUIPath='QT5')
# Modules Python
# Modules Eficas
import prefs
-name='prefs_'+prefs.code
-#__import__(name)
-
import os, sys
sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'..','..'))
from Editeur import eficas_go
-print (prefs.code)
-eficas_go.lanceEficas(code=prefs.code, GUIPath='QT5')
+print ('lancement d eficas pour : ', prefs.code)
+eficas_go.lanceQtEficas(code=prefs.code, GUIPath='QT5')
from Editeur import eficas_go
print (prefs.code)
-eficas_go.lanceEficas(code=prefs.code, GUIPath='QT5')
+eficas_go.lanceQtEficas(code=prefs.code, GUIPath='QT5')
print ("traitement de : ", 'CasEn/'+f)
# on veut ouvrir un fichier directement au lancement d'Eficas
- eficas_go.lanceEficas_ssIhm_reecrit(code='TELEMAC',fichier = 'CasEn/'+f,ou = 'CasEn_Reecrits',cr=True)
+ eficas_go.lanceQtEficas_ssIhm_reecrit(code='TELEMAC',fichier = 'CasEn/'+f,ou = 'CasEn_Reecrits',cr=True)
print ("\n")
from Editeur import eficas_go
print (prefs.code)
-eficas_go.lanceEficas(code=prefs.code, GUIPath='QT5')
+eficas_go.lanceQtEficas(code=prefs.code, GUIPath='QT5')
sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'..','..'))
from Editeur import eficas_go
-eficas_go.lanceEficas(code=prefs.code, GUIPath='cinqC')
+eficas_go.lanceQtEficas(code=prefs.code, GUIPath='cinqC')
+++ /dev/null
- def __init__(self, appliEficas, fichier=None, jdc=None, units=None, include=0):
- def readFile(self, fn):
- def _newJDC(self, texte = "", units=None):
- def _newJDCInclude(self, units=None):
- def getSource(self, file):
- def __generateTempFilename(self, prefix, suffix):
- def generDico(self):
- def generDicoPourWeb(self, obj=None):
- def generDicoPython(self):
- def viewJdcSource(self):
- def viewJdcPy(self):
- def viewJdcRapport(self):
- def viewJdcRegles(self):
- def getJdcRapport(self):
- def getFileName(self):
- def initModif(self):
- def writeFile(self, fn, txt=None, formatLigne="beautifie"):
- def getTextJDC(self, format=None, pourRun=0, formatLigne="beautifie"):
- def verifieChecksum(self, text):
- def getChecksum(self, texte):
- def getDico(self):
- def chercheGroupes(self):
- def chercheDico(self):
- def saveFileLegerAs(self, fileName=None):
- def saveFileComplet(self, fichier=None, formatLigne="beautifie"):
- def saveUQFile(self, fichier=None):
- def sauvePourPersalys(self, fichier=None):
- def exeUQ(self, fichier=None, path=None):
- def ajoutCommentaire(self):
- def informe(self, titre, txt, critique=True):
- def afficheInfos(self, txt, couleur=None):
- def _viewText(self, txt, caption="FILE_VIEWER", largeur=1200, hauteur=600):
- def saveFile(self, fichier, formatLigne="beautifie"):
- def sauveLigneFile(self):
- def updateJdc(self, itemApres, texte):
- def updateJdcEtape(self, itemApres, texte):
- def deleteEtape(self, etape):
- def deleteMC(self, etape, MCFils, listeAvant=()):
- def ajoutMC(self, etape, MCFils, valeurs, listeAvant=()):
- def ajoutMCinMCFactUnique(self, etape, MCFils, valeurs, listeAvant=()):
- def ajoutMCFact(self, etape, MCFils, listeAvant=()):
- def setValeurMCSimpInEtape(self, etape, listeAvant, valeur):
- def getValeur(self, nomEtape, MCFils, listeAvant=()):
- def getMCDsEtape(self, etape, MCFils, listeAvant=()):
- def setValeur(self, nomEtape, MCFils, valeur, listeAvant=()):
- def changeIntoMC(self, etape, MCFils, valeurs, listeAvant=()):
- def reCalculeValiditeMCApresChgtInto(self, nomEtape, MCFils, listeAvant=()):
- def dumpXsd(self, avecEltAbstrait=False):
- def dumpStructure(self):
- def dumpGitStringFormat(self):
- def changeDefautDefMC(self, nomEtape, listeMC, valeurs):
- def changeIntoDefMC(self, etape, listeMC, valeurs, rechercheParNom=False):
- def deleteDefinitionMC(self, etape, listeAvant, nomDuMC):
- def ajoutDefinitionMC(self, nomEtape, listeAvant, nomDuMC, typ, **args):
- def ajoutDefinitionMCFact(self, nomEtape, listeAvant, nomDuMC, listeMC, **args):
- def changeIntoMCandSet(self, etape, listeMC, into, valeurs):
- def ajoutVersionCataDsJDC(self, txt):
- def verifieVersionCataDuJDC(self, text):
- def traduitCatalogue(self, texte):
- def insertInDB(self):
- def dumpStringDataBase(self, nomDataBaseACreer=None):
if self.salome: name = "prefs_eficas_salome.ini"
else: name = "prefs_eficas.ini"
- if sys.platform == 'linux' : repUser = os.path.join( os.path.expanduser("~"), '.config/Eficas',self.code)
- else : repUser = os.path.join('C:/','.config/Eficas',self.code)
- self.fichierPrefsUtilisateur = os.path.join(repUser, name)
+ if sys.platform == 'linux' : self.repUser = os.path.join( os.path.expanduser("~"), '.config/Eficas',self.code)
+ else : self.repUser = os.path.join('C:/','.config/Eficas',self.code)
+ self.fichierPrefsUtilisateur = os.path.join(self.repUser, name)
self.labelsStandards = ('PdfReader', 'saveDir', 'modeNouvCommande', 'afficheUQ', 'closeAutreCommande', 'closeFrameRechercheCommande',
'closeFrameRechercheCommandeSurPageDesCommandes', 'closeEntete', 'closeArbre', 'demandeLangue', 'suiteTelemac',
else :
self.saveDir = os.path.join('C:/','Eficas',self.code)
+ # ----------------------------
def setValeursParDefaut(self):
# ----------------------------
# pour garder ce qui existait pour Aster
self.repMat = None
- # --------------------------------------
+ # ---------------------------------
def lectureFichierIniStandard(self):
- # --------------------------------------
+ # ----------------------------------
if self.salome : name = "prefs_salome_" + self.appliEficas.code
else : name = "prefs_" + self.appliEficas.code
def __init__(self, appliEficas, fichier=None, jdc=None, units=None, include=0):
# ----------------------------------------------------------------------------#
- if debug: print("dans le init de JDCEditorSsIhm")
+ if debug: print("dans le init de Editor")
self.appliEficas = appliEficas
+
self.fichier = fichier
self.fichierComplet = fichier
- if fichier != None:
- self.extensionFichier = os.path.splitext(fichier)[1]
- else:
- self.extensionFichier = None
+ if fichier != None: self.extensionFichier = os.path.splitext(fichier)[1]
+ else: self.extensionFichier = None
+
self.jdc = jdc
self.first = True
self.jdc_item = None
self.dict_reels = {}
self.liste_simp_reel = []
- if self.appliEficas != None:
- self.salome = self.appliEficas.salome
- else:
- self.salome = 0
# ces attributs sont mis a jour par definitCode appelee par newEditor
self.code = self.appliEficas.maConfiguration.code
self.formatFichierOut = self.appliEficas.formatFichierOut
self.formatFichierIn = self.appliEficas.formatFichierIn
- # if self.appliEficas.maConfiguration.dumpXSD==True : self.appliEficas.dumpXsd()
- self.dict_reels = {}
- self.liste_simp_reel = []
- self.dicoNouveauxMC = {}
- self.dicoNouveauxFact = {}
-
- try:
- if self.maConfiguration.writerModule :
+ if self.maConfiguration.writerModule :
+ try:
_module = __import__(self.maConfiguration.writermodule)
info = _module.entryPoint()
writer.plugins.addEntryPoint(info)
- except:
+ except:
pass
- try:
- if self.maConfiguration.readerModule :
+ if self.maConfiguration.readerModule :
+ try:
# print self.maConfiguration.readerModule
_module = __import__(self.maConfiguration.readerModule)
info = _module.entryPoint()
reader.plugins.addEntryPoint(info)
- except:
- pass
+ except:
+ pass
self.mesWriters = writer
- try: self.XMLWriter = writer.plugins["xml"]()
- except: self.XMLWriter = None
- try: self.pythonWriter = writer.plugins["python"]()
- except: self.pythonWriter = None
-
+ if "xml" in writer.plugins.keys():
+ self.XMLWriter = writer.plugins["xml"]()
+ else : self.XMLWriter = None
+ if "python" in writer.plugins.keys():
+ self.XMLWriter = writer.plugins["python"]()
+ else : self.XMLWriter = None
if self.formatFichierOut in writer.plugins.keys():
self.myWriter = writer.plugins[self.formatFichierOut]()
except:
#else :
print("mauvaise lecture du fichier")
- if self.salome:
+ if self.appliEficas.salome:
try:
self.appliEficas.addJdcInSalome(self.fichier)
except:
txt_exception = None
if not jdc:
if self.extensionFichier == ".xml":
- if self.appliEficas.maConfiguration.withXSD:
+ if self.appliEficas.withXSD:
self.jdc.analyseXML()
else:
print("run MDM with -x option (MDM for XML)")
# Il faut convertir le contenu du fichier en fonction du format
formatIn = self.appliEficas.formatFichierIn
- if self.extensionFichier == ".xml" and self.appliEficas.maConfiguration.withXSD:
+ if self.extensionFichier == ".xml" and self.appliEficas.withXSD:
formatIn = "xml"
if formatIn in reader.plugins:
# Le convertisseur existe on l'utilise
CONTEXT.unsetCurrentStep()
# le jdc n est pas charge
- if not (hasattr(self.readercata, "cata_ordonne_dico")):
+ if not (hasattr(self.readercata, "dicoCataOrdonne")):
return
jdc = self.readercata.cata.JdC(
procedure=text,
appliEficas=self.appliEficas,
cata=self.readercata.cata,
- cata_ord_dico=self.readercata.cata_ordonne_dico,
+ dicoCataOrdonne=self.readercata.dicoCataOrdonne,
nom=jdcName,
repMat=self.maConfiguration.repMat,
)
procedure=texte,
appliEficas=self.appliEficas,
cata=self.readercata.cata,
- cata_ord_dico=self.readercata.cata_ordonne_dico,
+ dicoCataOrdonne=self.readercata.dicoCataOrdonne,
repMat=self.maConfiguration.repMat,
)
procedure="",
appliEficas=self.appliEficas,
cata=self.readercata.cata,
- cata_ord_dico=self.readercata.cata_ordonne_dico,
+ dicoCataOrdonne=self.readercata.dicoCataOrdonne,
repMat=self.maConfiguration.repMat,
)
jaux.editor = self
procedure="",
appliEficas=self.appliEficas,
cata=self.readercata.cata,
- cata_ord_dico=self.readercata.cata_ordonne_dico,
+ dicoCataOrdonne=self.readercata.dicoCataOrdonne,
jdc_pere=jaux,
repMat=self.maConfiguration.repMat,
)
if nomDuMC in self.dicoNouveauxMC:
del self.dicoNouveauxMC[nomDuMC]
self.dicoNouveauxMC[nomDuMC] = (
- "ajoutDefinitionMC",
- nomEtape,
- listeAvant,
- nomDuMC,
- typ,
- args,
- )
- # print self.dicoNouveauxMC
+ "ajoutDefinitionMC", nomEtape, listeAvant, nomDuMC, typ, args,)
# ---------------------------------------------------------------------#
def ajoutDefinitionMCFact(self, nomEtape, listeAvant, nomDuMC, listeMC, **args):
--- /dev/null
+# -*- coding: utf-8 -*-
+# Copyright (C) 2007-2024 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
+#
+
+import os
+
+# --------------------------
+class EditorManager(object):
+# --------------------------
+ """
+ classe mere des managers d editeur pour Qt et le web
+ permettent de gerer plusieurs ouvertures de fichiers simultannees en IHM
+ utilisee sans etre derivee pour le dumpXSD ou les transformations
+ """
+ counter = 0
+ # remplace par l index du viewManager
+
+ # --------------------------------
+ def __init__(self, appliEficas):
+ # --------------------------------
+ self.appliEficas = appliEficas
+ self.mesIndexes = {}
+ self.dictEditors = {}
+ self.editors = []
+ self.doubles = {}
+
+
+ # ----------------------------------------------------------------
+ def getEditor(self, fichier=None, jdc=None, units=None, include=0):
+ # ----------------------------------------------------------------
+ """
+ Retourne un nouvel editeur ou None si doublon
+ """
+
+ if fichier == None :
+ self.appliEficas.afficheMessage('Eficas sans Ihm',
+ 'nom de fichier obligatoire pour obtenir un editor')
+ return None
+ for indexEditor in self.dictEditors:
+ editor = self.dictEditors[indexEditor]
+ if self.samePath(fichier, editor.getFileName()):
+ self.appliEficas.afficheMessage('Eficas sans Ihm', 'Fichier deja ouvert')
+ return None
+ from Editeur.editor import Editor
+ editor = Editor(self.appliEficas, fichier, jdc, units, include)
+ if not editor.jdc :
+ self.appliEficas.afficheMessage('Eficas sans Ihm', 'impossible d allouer un editor')
+ return None
+ self.editors.append(editor)
+ self.dictEditors[EditorManager.counter] = editor
+ EditorManager.counter += 1
+ return editor
+
+ # -------------------------
+ def samePath(self, f1, f2):
+ # --------------------------
+ """
+ compare two paths.
+ """
+ if f1 is None or f2 is None: return 0
+ if os.path.normcase(os.path.normpath(f1)) == os.path.normcase( os.path.normpath(f2)):
+ return 1
+ return 0
+
+ #-------------------------------
+ def indexChanged(self, newIndex):
+ #--------------------------------
+ if newIndex in self.dictEditors:
+ editor = self.dictEditors[newIndex]
+ if editor.jdc != None:
+ CONTEXT.unsetCurrentJdC()
+ CONTEXT.setCurrentJdC(editor.jdc)
+ self.appliEficas.maConfiguration = editor.maConfiguration
+ self.appliEficas.code = editor.maConfiguration.code
+ self.appliEficas.setWindowTitle(editor.titre)
+ self.appliEficas.construitMenu()
+ return 1
+ else :
+ return 0
+
+
+ # -----------------------------
+ def getFileName(self, index):
+ # -------------------------------
+ if not (index in self.dictEditors):
+ # print("editor non trouve")
+ return
+ return self.dictEditors[index].getFileName()
+
+
+ # ---------------------------------------------
+ def handleGetJdcRapport(self, index):
+ # ---------------------------------------------
+ if not (index in self.dictEditors):
+ # print("editor non trouve")
+ return
+ return self.dictEditors[index].getJdcRapport()
+
+ # ---------------------------------------------
+ def handleViewJdcRapport(self, index):
+ # ---------------------------------------------
+ # print(index)
+ if not (index in self.dictEditors):
+ # print("editor non trouve")
+ return
+ self.dictEditors[index].viewJdcRapport()
+
+ # ---------------------------------------------
+ def generDico(self, index):
+ # ---------------------------------------------
+ # print(index)
+ if not (index in self.dictEditors):
+ # print("editor non trouve")
+ return
+ return self.dictEditors[index].generDico()
+
+ # ---------------------------------------------
+ def isJdcValid(self, index):
+ # ---------------------------------------------
+ # print(index)
+ if not (index in self.dictEditors):
+ # print("editor non trouve")
+ return
+ return self.dictEditors[index].jdc.isValid()
+
+ # ---------------------------------------------
+ def fileSaveAs(self, index, fileName):
+ # ---------------------------------------------
+ # print(index)
+ if not (index in self.dictEditors):
+ # print("editor non trouve")
+ return
+ return self.dictEditors[index].saveFile(fileName)
+
+ # ---------------------------------------------
+ def fileLegerSaveAs(self, index, fileName):
+ # ---------------------------------------------
+ # print (index)
+ if not (index in self.dictEditors):
+ # print("editor non trouve")
+ return
+ self.dictEditors[index].saveFileLegerAs(fileName)
+
+
+
+
import os, sys
from Accas.extensions.eficas_exception import EficasException
-from Editeur.viewManagerSsIhm import MyViewManagerSsIhm
from Editeur import session
from Editeur.getVersion import getEficasVersion
Class implementing the main user interface.
"""
- def __init__( self, code=None, salome=1, parent=None, multi=False, langue="fr",
- ssIhm=True, labelCode=None, genereXSD=False, versionCode=None, ssCode=None, fichierCata=None,
- GUIPath=None,
- ):
+ def __init__(self, code=None, versionCode=None, salome=1, multi=False, langue="fr", ssCode=None, fichierCata=None, GUIPath=None):
+ #--------------------------------------------------------------------------------------------------------------------------------
"""
- Constructor
+ Constructor d appli eficas. classe mere de appli-qtEficas et de appli-web eficas et utilisee sans IHM pour les
+ transformations des catas en XSD, des comm en XML et de validation des donnees
+ les parametres sont :
+ nom du code (exple Adao)
+ versionCode (version du code permet de retrouver le catalogue dans le fichier prefs : exple V10-4)
+ salome : lance ou non a partir de salome
+ multi (permet de ne pas specifier le code mais de le demander )
+ langue des messages
+ ssCode (utilise pour MAP permet de distinguer un patron specifique, un catalogue specifique...)
+ fichier catalogue utilise
"""
- version = getEficasVersion()
- self.versionEficas = "Eficas QT5 Salome " + version
- self.labelCode = labelCode
- self.GUIPath = None
-
- self.salome = salome
- self.ssIhm = True
self.code = code
- self.genereXSD = genereXSD
- self.versionCode = versionCode
self.ssCode = ssCode
+ self.multi = multi
+ self.salome = salome
+ version = getEficasVersion()
+ self.versionEficas = "Eficas Salome " + version
+ self.GUIPath = GUIPath
self.dict_reels = {}
self.fichierIn = None
self.fichierOut = None
- self.recent = []
self.ficRecents = {}
self.mesScripts = {}
self.listePathAEnlever = []
- self.repIcon = os.path.join( os.path.dirname(os.path.abspath(__file__)), "..", "Editeur", "icons")
if fichierCata == None: self.fichierCata = session.d_env.fichierCata
else: self.fichierCata = fichierCata
- if session.d_env.labelCode: self.labelCode = session.d_env.labelCode
- self.withXSD = session.d_env.withXSD
+ self.versionCode = versionCode
+ if session.d_env.versionCode: self.versionCode = session.d_env.versionCode
if self.salome:
try:
from Accas import eficasSalome
Accas.SalomeEntry = eficasSalome.SalomeEntry
- except:
- print("eficas hors salome")
-
- self.multi = multi
- # on peut avoir multi et sans Ihm si on est en Web
- # if self.multi: print("pas de multi sans ihm")
+ except e:
+ print ("impossible d importer les salome entry")
+ print (str(e))
if langue == "fr": self.langue = langue
else: self.langue = "ang"
self.maConfiguration = BaseConfiguration(self)
self.suiteTelemac = False
- self.viewmanager = MyViewManagerSsIhm(self)
self.withUQ = False
+ self.genereXSD = False
+ from Editeur.editor_manager import EditorManager
+ self.editorManager = EditorManager(self)
def ajoutUQ(self):
+ #-----------------
self.withUQ = True
self.formatFichierIn = "pythonUQ" # par defaut
def definitCode(self, code, ssCode):
+ #-----------------------------------
# ssCode sert pour Map
self.code = code
self.ssCode = ssCode
- if self.code == None:
- return # pour le cancel de la fenetre choix code
+ if self.code == None: return
if ssCode != None:
self.formatFichierOut = ssCode # par defaut
self.formatFichierIn = "python" # par defaut
self.formatFichierOut = "python" # par defaut
+ self.listePathAEnlever = []
from Editeur.configuration import BaseConfiguration
self.maConfiguration = BaseConfiguration(self)
localisation.localise( None, self.langue,
translatorFile=self.maConfiguration.translatorFile,
)
- if self.withXSD:
- self.maConfiguration.withXSD = True
+
+ # Comment faire si Multi ?
+ self.withXSD = session.d_env.withXSD
def getSource(self, file):
+ #-------------------------
# appele par Editeur/session.py
import Accas.IO.reader
return texte
def initEditor(self, fichier=None, jdc=None, units=None, include=0):
+ #------------------------------------------------------------------
if (hasattr(self, "editor")) and self.editor != None:
- print("un seul editeur par application")
+ print("un seul editeur par application eficas_appli ")
sys.exit()
- self.editor = self.viewmanager.getNewEditor()
+ self.editor = self.editorManager.getNewEditor()
def fileNew(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):
+ #---------------------------
fichierIn = os.path.abspath(fichier)
try:
- monEditor = self.viewmanager.handleOpen(fichierIn)
+ monEditor = self.editorManager.handleOpen(fichierIn)
except EficasException as exc:
print("poum")
monEditor = None
return monEditor
def fileSave(self):
+ #-------------------
if self.editor == None:
return False
ok, newName = editor.saveFileAs()
print("ok, newName ", ok, newName)
def fileSaveAs(self, fileName):
+ #-----------------_------------
if self.editor == None:
return False
ok = editor.saveFileAs()
print("ok ", ok)
def dumpXsd(self, avecEltAbstrait=False):
+ #-----------------------------------------
currentCata = CONTEXT.getCurrentCata()
texteXSD = currentCata.dumpXsd(avecEltAbstrait)
return texteXSD
def afficheMessage(self, titre, texte,critical=True):
+ #-----------------------------------------------------
print ('__________________________')
print (tr(titre))
print ('')
print ('__________________________')
-# ,self.fileSaveAs
-# ,self.fileClose
-# ,self.fileExit
-# ,self.jdcRapport
-# ,self.jdcRegles
-# ,self.jdcFichierSource
-# ,self.visuJdcPy
-
-
if __name__ == "__main__":
# Modules Eficas
- monEficas = AppliSsIhm(code="Adao", salome=0, labelCode="V83")
+ pass
sys.exit()
-def lanceEficas(code=None, multi=False, langue="en", labelCode=None, GUIPath='QT5', salome=0):
-# -------------------------------------------------------------------------------------------
+def lanceQtEficas(code=None, versionCode = None, multi=False, langue="en", GUIPath='QT5', salome=0):
+# ---------------------------------------------------------------------------------------------------
"""
Lance l'appli EFICAS avec Ihm QT
"""
print("Please, set qt environment")
return
+ if not GUIPath in ('QT5','cinqC') :
+ print ('Attention, lancement de Eficas pour QT avec GUIPath = {}'.format(GUIPath))
+
from Editeur import session
options = session.parse(sys.argv)
if options.code != None:
code = options.code
+ if options.versionCode != None:
+ versionCode = options.versionCode
- if GUIPath == 'QT5' or GUIPath == 'cinqC' :
- pathAbso=os.path.abspath(os.path.join(os.path.dirname(__file__),'..','InterfaceGUI',GUIPath))
- if pathAbso not in sys.path : sys.path.insert(0,pathAbso)
+ pathAbso=os.path.abspath(os.path.join(os.path.dirname(__file__),'..','InterfaceGUI',GUIPath))
+ if pathAbso not in sys.path : sys.path.insert(0,pathAbso)
from qt_eficas import QtEficasAppli
app = QApplication(sys.argv)
- Eficas = QtEficasAppli(code=code, salome=salome, multi=multi, langue=langue, labelCode=labelCode, GUIPath=GUIPath)
+ Eficas = QtEficasAppli(code=code, versionCode = versionCode, salome=salome, multi=multi, langue=langue, GUIPath=GUIPath)
+
Eficas.show()
res = app.exec_()
sys.exit(res)
-def getEficas( code=None, multi=False, langue="en", ssCode=None, labelCode=None,
- forceXML=False, genereXSD=False, fichierCata=None,GUIPath=None, salome = False):
-# -----------------------------------------------------------------------------------
+def getEficas( code=None, multi=False, langue="en", forceXML=False, fichierCata=None,GUIPath=None):
+# ------------------------------------------------------------------------------------------------------------------
"""
instancie l'appli EFICAS sans Ihm
"""
code = options.code
if forceXML: options.withXSD = True
- if GUIPath in ('QT5', 'cinqC', 'Web') :
+ if GUIPath in ('QT5', 'cinqC') :
pathAbso=os.path.abspath(os.path.join(os.path.dirname(__file__),'..','InterfaceGUI',GUIPath))
if pathAbso not in sys.path : sys.path.insert(0,pathAbso)
+ from qt_eficas import QtEficasAppli as EficasAppli
+ if GUIPath in ( 'Web') :
+ pathAbso=os.path.abspath(os.path.join(os.path.dirname(__file__),'..','InterfaceGUI',GUIPath))
+ if pathAbso not in sys.path : sys.path.insert(0,pathAbso)
+ from web_eficas import WebEficasAppli as EficasAppli
+ else :
+ print ('lancement de Eficas avec GUIPath = {}'.format(GUIPath))
+ from Editeur.eficas_appli import EficasAppli
- from Editeur.eficas_appli import EficasAppli
- Eficas = EficasAppli( code=code, salome=salome, multi=multi, langue=langue,
- ssCode=ssCode, labelCode=labelCode, genereXSD=genereXSD, fichierCata=fichierCata)
+ Eficas = EficasAppli(code=code, multi=multi, langue=langue, ssCode=ssCode, versionCode=versionCode, fichierCata=fichierCata, GUIPath=GUIPath)
return Eficas
def genereXSD(code=None):
# -----------------------
from Editeur import session
-
options = session.parse(sys.argv)
if code != None:
options.code = code
print("Use -c cata_name.py")
return
- monEficas = getEficas(code=options.code, genereXSD=True)
+ monEficas = getEficas(code=options.code)
+ monEficas.genereXSD = True
monEditor = monEficas.getEditor()
texteXSD = monEditor.dumpXsd(avecEltAbstrait=options.avecEltAbstrait)
"""
Ce module centralise les informations issues de la ligne de commande.
-La ligne de commande est parsee avec l'aide du module python optparse.
-Les options possibles sont : -l, -j, -p, -d, -i, -f comme definies ci-dessous.
-
-Un exemple typique d'utilisation est :
->>> ./appli.py -v V7.3 -d 1 -j aa -i 11 iii -p ppp -i 22 ii -j bb -f ff
-
-qui demande a l'application d'ouvrir trois jeux de commandes.
-
-Le premier (aa) a un include (11,iii) et est la suite du fichier poursuite ppp
-qui a lui meme un include (22,ii).
-
-Le deuxieme bb est un jeu de commandes simple.
-
-Le troisieme est decrit dans le fichier ff de type .ini
-qui est parse par le module Configparser.
-Chaque section du fichier decrit un jeu de commandes.
-Un include est specifie par: numero logique=nom du fichier
-Une poursuite est specifiee par: poursuite=reference a un jeu de commande
-Cette reference correspond a un nom de section decrivant le jeu de commandes.
-Le jeu de commandes maitre est donne par l'entree globale jdc dans la section jdc.
-
-Exemple:
-[jdc]
-jdc=a
-[a]
-comm=aa
-poursuite=pours
-11=iii
-[pours]
-comm=ppp
-22=ii
-
-La session utilisera le catalogue V7.3 en mode debug.
"""
+#Version Obsolete pour Aster mais qui explique l utilisation de poursuite et include
+#La ligne de commande est parsee avec l'aide du module python optparse.
+#Les options possibles sont : -l, -j, -p, -d, -i, -f comme definies ci-dessous.
+#
+#Un exemple typique d'utilisation est :
+#>>> ./appli.py -v V7.3 -d 1 -j aa -i 11 iii -p ppp -i 22 ii -j bb -f ff
+#qui demande a l'application d'ouvrir trois jeux de commandes.
+#Le premier (aa) a un include (11,iii) et est la suite du fichier poursuite ppp
+#qui a lui meme un include (22,ii).
+#
+#Le deuxieme bb est un jeu de commandes simple.
+#Le troisieme est decrit dans le fichier ff de type .ini
+#qui est parse par le module Configparser.
+#Chaque section du fichier decrit un jeu de commandes.
+#Un include est specifie par: numero logique=nom du fichier
+#Une poursuite est specifiee par: poursuite=reference a un jeu de commande
+#Cette reference correspond a un nom de section decrivant le jeu de commandes.
+#Le jeu de commandes maitre est donne par l'entree globale jdc dans la section jdc.
+
+
from builtins import str
import optparse
"--label",
action="store",
type="string",
- dest="labelCode",
+ dest="versionCode",
help=tr("version de catalogue a utiliser"),
)
options.comm = []
if not hasattr(options, "fichierCata"):
options.fichierCata = None
- if not hasattr(options, "labelCode"):
- options.labelCode = None
+ if not hasattr(options, "versionCode"):
+ options.versionCode = None
if not hasattr(options, "fichierXMLOut"):
options.fichierXMLOut = None
if options.withXSD:
+++ /dev/null
-# -*- coding: utf-8 -*-
-# Copyright (C) 2007-2024 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
-#
-
-import os
-
-# --------------------------------
-class MyViewManagerSsIhm(object):
- # --------------------------------
- # Symetrique de ViewManager mais pas d heritage entre les 2
- # beaucoup de fonctions sont pretes mesi pas ou peu usitees
- # developpement pas termine
-
- # --------------------------------
- def __init__(self, appliEficas):
- # --------------------------------
- self.appliEficas = appliEficas
- self.tabWidgets = []
- self.mesIndexes = {}
- self.dictEditors = {}
- self.untitledCount = 0
- self.doubles = {}
-
- # ------------------------------------------------------
- def handleOpen(self, fichier=None, units=None):
- # ------------------------------------------------------
- result = None
- if fichier is None:
- # print("nom de fichier obligatoire")
- return None
-
- for handler in self.dictEditors:
- editor = self.dictEditors[handler]
- if self.samePath(fichier, editor.getFileName()):
- # print("fichier deja ouvert . pas de nouvel editor")
- return handler
-
- monNewHandler = self.getNewHandler(fichier, units)
- return monNewHandler
-
- # ----------------------------------------------------------------------
- def getNewHandler(self, fichier=None, jdc=None, units=None, include=0):
- # ----------------------------------------------------------------------
- # il faudrait decider entre e handler ou non
- # le cas d usage n est pas tout a fait identique :
- # avec handler pour les utilisateurs avance
- # sans pour les utilisateurs encore plus ancvances et les tests
-
- from editorSsIhm import JDCEditorSsIhm
-
- editor = JDCEditorSsIhm(
- self.appliEficas, fichier, jdc, units=units, include=include
- )
-
- if editor.jdc: # le fichier est bien un jdc
- monHandler = JdcSsIhmHandler(self)
- self.dictEditors[monHandler] = editor
- return monHandler
- else:
- # print("impossible de construire le jdc")
- return None
-
- # -------------------------------------------------------------------
- def getNewEditor(self, fichier=None, jdc=None, units=None, include=0):
- # ------------------------------------------------------------------------
-
- from editorSsIhm import JDCEditorSsIhm
- editor = JDCEditorSsIhm(
- self.appliEficas, fichier, jdc, units=units, include=include
- )
- self.editor = editor
- return editor
-
- # -----------------------------
- def samePath(self, f1, f2):
- # ------------------------------
- """
- compare two paths.
- """
- if f1 is None or f2 is None:
- return 0
- if os.path.normcase(os.path.normpath(f1)) == os.path.normcase(
- os.path.normpath(f2)
- ):
- return 1
- return 0
-
- # ---------------------------------
- def handleViewJdcPy(self, handler):
- # ---------------------------------
- if not (handler in self.dictEditors):
- # print("editor non trouve")
- return
- self.dictEditors[handler].viewJdcPy()
-
- # ---------------------------------
- def getFileName(self, handler):
- # ---------------------------------
- if not (handler in self.dictEditors):
- # print("editor non trouve")
- return
- return self.dictEditors[handler].getFileName()
-
- # ---------------------------------------------
- def handleViewJdcSource(self, handler):
- # ---------------------------------------------
- # print(handler)
- if not (handler in self.dictEditors):
- # print("editor non trouve")
- return
- self.dictEditors[handler].viewJdcSource()
-
- # ---------------------------------------------
- def handleViewJdcRapport(self, handler):
- # ---------------------------------------------
- # print(handler)
- if not (handler in self.dictEditors):
- # print("editor non trouve")
- return
- self.dictEditors[handler].viewJdcRapport()
-
- # ---------------------------------------------
- def handleGetJdcRapport(self, handler):
- # ---------------------------------------------
- if not (handler in self.dictEditors):
- # print("editor non trouve")
- return
- return self.dictEditors[handler].getJdcRapport()
-
- # ---------------------------------------------
- def handleViewJdcRapport(self, handler):
- # ---------------------------------------------
- # print(handler)
- if not (handler in self.dictEditors):
- # print("editor non trouve")
- return
- self.dictEditors[handler].viewJdcRapport()
-
- # ---------------------------------------------
- def generDico(self, handler):
- # ---------------------------------------------
- # print(handler)
- if not (handler in self.dictEditors):
- # print("editor non trouve")
- return
- return self.dictEditors[handler].generDico()
-
- # ---------------------------------------------
- def isJdcValid(self, handler):
- # ---------------------------------------------
- # print(handler)
- if not (handler in self.dictEditors):
- # print("editor non trouve")
- return
- return self.dictEditors[handler].jdc.isValid()
-
- # ---------------------------------------------
- def fileSaveAs(self, handler, fileName):
- # ---------------------------------------------
- # print(handler)
- if not (handler in self.dictEditors):
- # print("editor non trouve")
- return
- return self.dictEditors[handler].saveFile(fileName)
-
- # ---------------------------------------------
- def fileLegerSaveAs(self, handler, fileName):
- # ---------------------------------------------
- # print (handler)
- if not (handler in self.dictEditors):
- # print("editor non trouve")
- return
- self.dictEditors[handler].saveFileLegerAs(fileName)
-
-# --------------------------------
-class JdcSsIhmHandler(object):
-# ------------------------------
- # retourne a l utilisateur
-
- def __init__(self, viewManager):
- # --------------------------------------
- self.viewManagerSsIhm = viewManager
-
- def viewJdcPy(self):
- # ---------------------
- self.viewManagerSsIhm.handleViewJdcPy(self)
-
- def viewJdcSource(self):
- # ---------------------
- self.viewManagerSsIhm.handleViewJdcSource(self)
-
- def getFileName(self):
- # ---------------------
- self.viewManagerSsIhm.getFileName(self)
-
- def viewJdcRapport(self):
- # ---------------------
- self.viewManagerSsIhm.handleViewJdcRapport(self)
-
- def getJdcRapport(self):
- # ---------------------
- return self.viewManagerSsIhm.handleGetJdcRapport(self)
-
- def getDicoPython(self):
- # -------------------------
- return self.viewManagerSsIhm.generDico(self)
-
- def isJdcValid(self):
- # -------------------------
- return self.viewManagerSsIhm.isJdcValid(self)
-
- def fileSaveAs(self, fileName):
- # -------------------------
- return self.viewManagerSsIhm.fileSaveAs(self, fileName)
-
- def fileLegerSaveAs(self, fileName):
- # -----------------------------------
- return self.viewManagerSsIhm.fileLegerSaveAs(self, fileName)
-
- def handleSortieUQ(self, fileName):
- # -----------------------------------
- return self.viewManagerSsIhm.handleSortieUQ(self, fileName)
-
- def handleExeUQ(self, fileName):
- # -----------------------------------
- # est-ce que cela a un sens de faire l exe hors IHM ?
- return self.viewManagerSsIhm.handleExeUQ(self, fileName)
-
-
else:
from InterfaceGUI.QT5.monWidgetCB import MonWidgetCBSD
widget = MonWidgetCBSD( self, maDefinition, monNom, monObjet, parentQt, maCommande)
- elif self.item.waitSalome() and self.editor.salome:
+ elif self.item.waitSalome() and self.editor.appliEficas.salome:
from InterfaceGUI.QT5.monWidgetSimpSalome import MonWidgetSimpSalome
widget = MonWidgetSimpSalome( self, maDefinition, monNom, monObjet, parentQt, maCommande)
elif self.item.waitTxm():
listeAAfficher = self.item.getSdAvantDuBonType()
# a changer selon UserASSD ou UserASSDMultiple
mctype = maDefinition.type[0]
- enable_salome_selection = self.editor.salome and (
+ enable_salome_selection = self.editor.appliEficas.salome and (
("grma" in repr(mctype))
or ("grno" in repr(mctype))
or ("SalomeEntry" in repr(mctype))
""" Gere les boutons """
def setReglesEtAide(self):
listeRegles = ()
- try:
- listeRegles = self.node.item.getRegles()
+ # PN fevrier 24 pourquoi ce try ?
+ # FACT multiple ?
+ try: listeRegles = self.node.item.getRegles()
except:
+ print ('FacultatifOuOptionnel, dans le except pour', self.node.item.nom)
pass
if hasattr(self, "RBRegle"):
- if listeRegles == ():
- self.RBRegle.close()
+ if listeRegles == (): self.RBRegle.close()
else:
- icon3 = QIcon(self.repIcon + "/lettreRblanc30.png")
- self.RBRegle.setIcon(icon3)
+ icon = QIcon(self.repIcon + "/lettreRblanc30.png")
+ self.RBRegle.setIcon(icon)
self.RBRegle.clicked.connect(self.viewRegles)
cle_doc = None
- if not hasattr(self, "RBInfo"):
- return
+
+ if not hasattr(self, "RBInfo"): return
icon = QIcon(self.repIcon + "/point-interrogation30.png")
self.RBInfo.setIcon(icon)
mc = self.node.item.get_definition()
mctype = mc.type[0]
- enable_salome_selection = self.editor.salome and (
- ("grma" in repr(mctype))
- or ("grno" in repr(mctype))
- or ("SalomeEntry" in repr(mctype))
- or (
- hasattr(mctype, "enable_salome_selection")
- and mctype.enable_salome_selection
- )
- )
+ enable_salome_selection = "grma" in repr(mctype) or "grno" in repr(mctype) or "SalomeEntry" in repr(mctype)
+ # or (hasattr(mctype, "enable_salome_selection" and mctype.enable_salome_selection))
if enable_salome_selection:
icon = QIcon(self.repIcon + "/flecheSalome.png")
try:
# if 1 :
self.listeMc = self.obj.getListeMcOrdonnee(
- genea, self.jdc.cata_ordonne_dico
+ genea, self.jdc.dicoCataOrdonne
)
listeNomsPresents = self.obj.dictMcPresents()
for regle in self.obj.getRegles():
class QtEditor(Editor, Ui_baseWidget, QWidget):
-# ----------------------------------------------------- #
+# -------------------------------------------- #
"""
Editeur de jdc
"""
# ou se trouve le fichier de traduction si demandeCatalogue
if self.appliEficas.readercata.demandeCatalogue == True:
nomFichierTranslation = (
- "translatorFile" + "_" + str(self.appliEficas.readercata.labelCode)
+ "translatorFile" + "_" + str(self.appliEficas.readercata.versionCode)
)
if hasattr(self.appliEficas.maConfiguration, nomFichierTranslation):
translatorFile = getattr(
None, self.appliEficas.langue, translatorFile=translatorFile
)
- if self.jdc_item and self.appliEficas.ssIhm == False:
- self.tree = browser.JDCTree(self.jdc_item, self)
self.appliEficas.construitMenu()
-
+ if self.jdc_item : self.tree = browser.JDCTree(self.jdc_item, self)
self.adjustSize()
# --------------------#
def closeIt(self):
# ----------------#
"""
- Public method called by the viewmanager to finally get rid of us.
+ Public method called by the editorManager to finally get rid of us.
"""
if self.jdc:
self.jdc.supprime()
appliEficas=self.appliEficas,
)
- if self.salome:
+ if self.appliEficas.salome:
self.appliEficas.addJdcInSalome(self.fichierComplet)
self.modified = 0
else:
sys.exit(1)
- if self.salome:
+ if self.appliEficas.salome:
self.appliEficas.addJdcInSalome(self.fichier)
self.modified = 0
nouveauTitre = (
ret, fichier = Editor.saveUQFile(self, fn)
if ret:
self.fichier = fichier
- if self.salome and ret:
+ if self.appliEficas.salome and ret:
self.appliEficas.addJdcInSalome(self.fichier)
return (1, self.fichier)
if self.appliEficas.salome:
--- /dev/null
+# -*- coding: utf-8 -*-
+# Copyright (C) 2007-2024 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
+#
+
+import os
+from Accas.extensions.eficas_translation import tr
+from Editeur.editor_manager import EditorManager
+from PyQt5.QtWidgets import QFileDialog, QMessageBox
+from PyQt5.QtCore import QFileInfo
+
+Dictextensions = {"MAP": ".map", "TELEMAC" :".cas"}
+
+#-----------------------------------#
+class QtEditorManager(EditorManager):
+#-----------------------------------#
+ """
+ classe qui gere la QTtab de la fenetre Eficas
+ c'est a dire la gestion des differents onglets de la mainWindow
+ gere egalement l ouverture d un fichier via le menu ( c est l equivalent
+ l ouverture d un onglet
+ """
+
+ #--------------------------------
+ def __init__(self, appliEficas):
+ #--------------------------------
+ super().__init__(appliEficas)
+ self.tabWidgets = []
+ self.untitledCount = 0
+ self.myQtab = self.appliEficas.myQtab
+ self.myQtab.currentChanged.connect(self.indexChanged)
+ self.myQtab.tabCloseRequested.connect(self.closeTab)
+
+ #----------------------
+ def indexChanged(self):
+ #----------------------
+ index = self.myQtab.currentIndex()
+ EditorManager.indexChanged(self,index)
+
+ #----------------------------------------------
+ def handleOpen(self, fichier=None, units=None):
+ #----------------------------------------------
+ result = None
+ if self.appliEficas.code == None:
+ self.appliEficas.definitCode(None, None)
+ if self.appliEficas.code == None: return
+
+ if fichier is None:
+ if self.appliEficas.code in Dictextensions:
+ chaine = "JDC (*" + Dictextensions[self.appliEficas.code] + ");;"
+ extensions = tr(chaine + "All Files (*)")
+ else:
+ extensions = tr("Fichiers JDC (*.comm);;" "Tous les Fichiers (*)")
+
+ fichier = QFileDialog.getOpenFileName(
+ self.appliEficas,
+ tr("Ouvrir Fichier"),
+ self.appliEficas.maConfiguration.saveDir,
+ extensions,)
+ fichier = fichier[0]
+
+ if len(fichier) == 0: return None
+
+ fichier = os.path.abspath(fichier)
+ ulfile = os.path.abspath(fichier)
+ self.appliEficas.maConfiguration.saveDir = os.path.split(ulfile)[0]
+ self.appliEficas.addToRecentList(fichier)
+ maPage = self.getEditor(fichier, units=units)
+ if maPage: result = maPage
+ if maPage: self.myQtab.setTabText(
+ self.myQtab.indexOf(maPage), os.path.basename(fichier))
+ return result
+
+ #--------------------------------
+ def closeTab(self, indexAFermer):
+ #--------------------------------
+ self.handleClose(indexAFermer=indexAFermer)
+
+ #--------------------------------------------------------
+ def handleClose(self, index = None, texte=tr("&Quitter")):
+ #--------------------------------------------------------
+ self.appliEficas.sauveRecents()
+ if not index : index = self.myQtab.currentIndex()
+ if index < 0: return
+
+ res = self.checkDirty(self.dictEditors[index], texte)
+ if res == 2: return 2 # l utilisateur a annule
+ idx = index
+ while idx < len(self.dictEditors) - 1:
+ self.dictEditors[idx] = self.dictEditors[idx + 1]
+ idx = idx + 1
+ del self.dictEditors[len(self.dictEditors) - 1]
+ try:
+ del self.doubles[self.dictEditors[index]]
+ except:
+ pass
+ self.myQtab.removeTab(index)
+ return res
+
+ #-------------
+ def run(self):
+ #-------------
+ index = self.myQtab.currentIndex()
+ if index < 0: return
+ editor = self.dictEditors[index]
+ editor.run()
+
+ #-----------------
+ def saveRun(self):
+ #------------------
+ index = self.myQtab.currentIndex()
+ if index < 0: return
+ editor = self.dictEditors[index]
+ editor.saveRun()
+
+ #---------------------------------------------
+ def handleCloseAll(self, texte=tr("Quitter")):
+ #---------------------------------------------
+ res = 0
+ self.appliEficas.sauveRecents()
+ while len(self.dictEditors) > 0:
+ self.myQtab.setCurrentIndex(0)
+ res = self.handleClose(0, texte)
+ if res == 2: return res # l utilsateur a annule
+ return res
+
+ #--------------------------
+ def handleRechercher(self):
+ #--------------------------
+ # print "passage dans handleRechercher"
+ index = self.myQtab.currentIndex()
+ if index < 0: return
+ editor = self.dictEditors[index]
+ editor.handleRechercher()
+
+ #-------------------------------------
+ def handleRechercherDsCatalogue(self):
+ #-------------------------------------
+ # print "passage dans handleRechercher"
+ index = self.myQtab.currentIndex()
+ if index < 0:
+ return
+ editor = self.dictEditors[index]
+ editor.handleRechercherDsCatalogue()
+
+ #-----------------------
+ def handleDeplier(self):
+ #-----------------------
+ index = self.myQtab.currentIndex()
+ if index < 0: return
+ editor = self.dictEditors[index]
+ editor.handleDeplier()
+
+ #------------------------
+ def handleEditCopy(self):
+ #------------------------
+ # print "passage dans handleEditCopy"
+ index = self.myQtab.currentIndex()
+ if index < 0: return
+ editor = self.dictEditors[index]
+ editor.handleEditCopy()
+
+ #-----------------------
+ def handleEditCut(self):
+ #-----------------------
+ # print "passage dans handleEditCut"
+ index = self.myQtab.currentIndex()
+ if index < 0: return
+ editor = self.dictEditors[index]
+ editor.handleEditCut()
+
+ #-----------------------
+ def handleEditPaste(self):
+ #-------------------------
+ # print "passage dans handleEditPaste"
+ index = self.myQtab.currentIndex()
+ if index < 0:
+ return
+ editor = self.dictEditors[index]
+ editor.handleEditPaste()
+
+ #--------------------------
+ def handleSupprimer(self):
+ #-------------------------
+ index = self.myQtab.currentIndex()
+ if index < 0: return
+ editor = self.dictEditors[index]
+ editor.handleSupprimer()
+
+ #------------------------------------
+ def handleAjoutEtape(self, nomEtape):
+ #------------------------------------
+ index = self.myQtab.currentIndex()
+ if index < 0: return
+ editor = self.dictEditors[index]
+ editor.handleAjoutEtape(nomEtape)
+
+ #------------------------------
+ def newEditor(self, include=0):
+ #------------------------------
+ if self.appliEficas.multi == True:
+ self.appliEficas.definitCode(None, None)
+ if self.appliEficas.code == None:
+ return
+ maPage = self.getEditor(include=include)
+
+ #--------------------------
+ def newIncludeEditor(self):
+ #--------------------------
+ self.newEditor(include=1)
+
+ #------------------------------------
+ def handleViewJdcFichierSource(self):
+ #------------------------------------
+ index = self.myQtab.currentIndex()
+ if index < 0:
+ return
+ self.dictEditors[index].viewJdcSource()
+
+ #--------------------
+ def ouvreArbre(self):
+ #--------------------
+ index = self.myQtab.currentIndex()
+ if index < 0: return
+ self.dictEditors[index].ouvreArbre()
+
+ #--------------------
+ def fermeArbre(self):
+ #--------------------
+ index = self.myQtab.currentIndex()
+ if index < 0: return
+ self.dictEditors[index].fermeArbre()
+
+ #--------------------------
+ def ajoutCommentaire(self):
+ #--------------------------
+ index = self.myQtab.currentIndex()
+ if index < 0: return
+ editor = self.dictEditors[index]
+ editor.ajoutCommentaire()
+
+ #-----------------------------
+ def handleViewJdcRegles(self):
+ #-----------------------------
+ index = self.myQtab.currentIndex()
+ if index < 0: return
+ self.dictEditors[index].viewJdcRegles()
+
+ #----------------------------
+ def handleGestionParam(self):
+ #----------------------------
+ index = self.myQtab.currentIndex()
+ if index < 0:
+ QMessageBox.warning(
+ self.appliEficas,
+ tr("Creation Parametre indisponible"),
+ tr("les parametres sont lies a un jeu de donnees"),
+ )
+ return
+ self.dictEditors[index].gestionParam()
+
+ #------------------------------
+ def handleViewJdcRapport(self):
+ #------------------------------
+ index = self.myQtab.currentIndex()
+ if index < 0: return
+ self.dictEditors[index].viewJdcRapport()
+
+ #-------------------------
+ def handleViewJdcPy(self):
+ #-------------------------
+ index = self.myQtab.currentIndex()
+ if index < 0:
+ return
+ self.dictEditors[index].viewJdcPy()
+
+ #--------------------
+ def handleSave(self):
+ #--------------------
+ index = self.myQtab.currentIndex()
+ if index < 0: return
+ editor = self.dictEditors[index]
+ if editor in self.doubles:
+ QMessageBox.warning(
+ None,
+ tr("Fichier Duplique"),
+ tr("Le fichier ne sera pas sauvegarde."),
+ )
+ return
+ ok, newName = editor.saveFile()
+ if ok:
+ fileName = os.path.basename(newName)
+ self.myQtab.setTabText(index, fileName)
+ return ok
+
+ #------------------------
+ def handleSortieUQ(self):
+ #------------------------
+ index = self.myQtab.currentIndex()
+ if index < 0:
+ return
+ editor = self.dictEditors[index]
+ ok, newName = editor.saveUQFile()
+ return ok
+
+ #---------------------------------
+ def handleSauvePourPersalys(self):
+ #---------------------------------
+ index = self.myQtab.currentIndex()
+ if index < 0:
+ return
+ editor = self.dictEditors[index]
+ ok = editor.sauvePourPersalys()
+ return ok
+
+ #---------------------
+ def handleExeUQ(self):
+ #---------------------
+ index = self.myQtab.currentIndex()
+ if index < 0: return
+ editor = self.dictEditors[index]
+ ok = editor.exeUQ()
+ return ok
+
+ #-------------------------
+ def handleSaveLigne(self):
+ #-------------------------
+ index = self.myQtab.currentIndex()
+ if index < 0: return
+ editor = self.dictEditors[index]
+ ok, newName = editor.saveLigneFile()
+ return ok
+
+ #----------------------
+ def handleSaveAs(self):
+ #----------------------
+ index = self.myQtab.currentIndex()
+ editor = self.dictEditors[index]
+ oldName = editor.fichier
+ ok, newName = editor.saveFileAs()
+ if ok:
+ fileName = os.path.basename(newName)
+ self.myQtab.setTabText(index, fileName)
+ if editor in self.doubles:
+ if oldName != newName:
+ del self.doubles[editor]
+ return ok
+
+ #----------------------------------
+ def displayJDC(self, jdc, fn=None):
+ #----------------------------------
+ """
+ Public slot to display a file in an editor.
+ sert pour les includes
+ # a revoir
+ # insert filename into list of recently opened files
+ """
+ titre = None
+ if fn != None:
+ titre = fn.split("/")[-1]
+ editor = self.getEditor(fichier=fn, jdc=jdc, include=1)
+ self.appliEficas.addToRecentList(editor.getFileName())
+
+ #------------------------------------------------------------------
+ def getEditor(self, fichier=None, jdc=None, units=None, include=0):
+ #------------------------------------------------------------------
+ newWin = 0
+ double = None
+ for indexEditor in self.dictEditors:
+ editor = self.dictEditors[indexEditor]
+ if self.samePath(fichier, editor.getFileName()):
+ msgBox = QMessageBox()
+ msgBox.setWindowTitle(tr("Fichier"))
+ msgBox.setText(tr("Le fichier <b>%s</b> est deja ouvert", str(fichier)))
+ msgBox.addButton(tr("&Duplication"), 0)
+ msgBox.addButton(tr("&Abandonner"), 1)
+ abort = msgBox.exec_()
+ if abort:
+ break
+ double = editor
+ else:
+ from qt_editor import QtEditor
+ editor = QtEditor(self.appliEficas, fichier, jdc, self.myQtab, units, include)
+ if double != None: self.doubles[editor] = double
+ if editor.jdc: # le fichier est bien un jdc
+ self.editors.append(editor)
+ newWin = 1
+ else:
+ editor.closeIt()
+ if newWin: self.addView(editor, fichier)
+ elif editor.jdc: self.myQtab.setCurrentIndex(indexEditor)
+
+ index = self.myQtab.currentIndex()
+ if index != -1: self.dictEditors[index] = editor
+ return editor
+
+ #------------------------------------
+ def addView(self, win, fichier=None):
+ #------------------------------------
+ if fichier is None:
+ self.untitledCount += 1
+ self.myQtab.addTab(
+ win, tr("Fichier non encore nomme") + str(self.untitledCount)
+ )
+ # self.myQtab.addTab(win, str(self.appliEficas.code))
+ else:
+ liste = fichier.split("/")
+ txt = liste[-1]
+ if not QFileInfo(fichier).isWritable():
+ txt = "%s (ro)" % txt
+ self.myQtab.addTab(win, txt)
+ self.myQtab.setCurrentWidget(win)
+ self.currentEditor = win
+ win.setFocus()
+
+
+ #-----------------------------------
+ def checkDirty(self, editor, texte):
+ #-----------------------------------
+ """
+ Private method to check dirty status and open a message window.
+
+ @param editor editor window to check
+ @return flag indicating successful reset of the dirty flag (boolean)
+ """
+ res = 1
+ if (editor.modified) and (editor in self.doubles):
+ msgBox = QMessageBox(None)
+ msgBox.setWindowTitle(tr("Fichier Duplique"))
+ msgBox.setText(tr("Le fichier ne sera pas sauvegarde."))
+ msgBox.addButton(texte, 0)
+ msgBox.addButton(tr("&Annuler"), 1)
+ res = msgBox.exec_()
+ if res == 0:
+ return 1
+ return 2
+ if editor.modified:
+ fn = editor.getFileName()
+ if fn is None:
+ fn = tr("Noname")
+ msgBox = QMessageBox(None)
+ msgBox.setWindowTitle(tr("Fichier Modifie"))
+ msgBox.setText(tr("Le fichier ne sera pas sauvegarde."))
+ msgBox.addButton(tr("&Sauvegarder"), 1)
+ msgBox.addButton(tr("&Quitter sans sauvegarder"), 0)
+ msgBox.addButton(tr("&Annuler"), 2)
+ res = msgBox.exec_()
+ if res == 2: return res
+ if res == 0 and self.appliEficas.maConfiguration.afficheUQ:
+ if fn is None:
+ ret, fichier = editor.saveUQFile(self)
+ else:
+ ret, fichier = editor.saveUQFile(self, fn)
+ return 2
+ if res == 0:
+ (ok, newName) = editor.saveFile()
+ if ok:
+ fileName = os.path.basename(newName)
+ index = self.myQtab.currentIndex()
+ self.myQtab.setTabText(index, fileName)
+ return ok
+ return res
+
+ #---------------------------------------
+ def handleAjoutGroup(self, listeGroup):
+ #---------------------------------------
+ index = self.myQtab.currentIndex()
+ if index < 0: return
+ editor = self.dictEditors[index]
+ editor.handleAjoutGroup(listeGroup)
+
+ #------------------------------------------------------------------------
+ def handleFonctionUtilisateur(self, laFonctionUtilisateur, lesArguments):
+ #------------------------------------------------------------------------
+ # fonction qui permettait d ajouter une fonction utilisateur
+ # et d inserer du texte genere dans un Jeu de donnees machine tournante
+ index = self.myQtab.currentIndex()
+ if index < 0:
+ return
+ editor = self.dictEditors[index]
+ if editor.getEtapeCourante() == None:
+ QMessageBox.information(
+ self.appliEficas,
+ tr("Selectionner une etape"),
+ tr( "Le texte ne peut pas etre insere dans un fichier vide"),
+ )
+ return
+
+ listeParam = []
+ for p in lesArguments:
+ if hasattr(editor, p):
+ listeParam.append(getattr(editor, p))
+ if p == "editor":
+ listeParam.append(editor)
+ if p == "etapeCourante":
+ listeParam.append(editor.getEtapeCourante())
+ laFonctionUtilisateur(*listeParam)
from Editeur import session
from Editeur.eficas_appli import EficasAppli
from UiQT5.myMain import Ui_Eficas
-from InterfaceGUI.QT5.view_manager import ViewManager
+from InterfaceGUI.QT5.qt_editor_manager import QtEditorManager
from Accas.extensions.eficas_translation import tr
from Accas.extensions.eficas_exception import EficasException
class QtEficasAppli(EficasAppli, Ui_Eficas, QMainWindow):
"""
- Class implementing the main user interface.
+ Class implementing the main QT user interface.
"""
- def __init__( self, code=None, salome=1, parent=None, multi=False, langue="en", ssIhm=False,
- labelCode=None, GUIPath="InterfaceGUI.QT5",):
+ #----------------------------------------------------------------------------------------------------------------------------------------------
+ def __init__(self, code=None, versionCode=None, salome=1, multi=False, langue="fr", ssCode=None, fichierCata=None, GUIPath="InterfaceGUI.QT5"):
+ #----------------------------------------------------------------------------------------------------------------------------------------------
"""
Constructor
"""
- if ssIhm == True:
- print("mauvaise utilisation de la classe AppliWithGui. Utiliser Appli SVP")
- exit()
-
- QMainWindow.__init__(self, parent)
+ QMainWindow.__init__(self)
Ui_Eficas.__init__(self)
- EficasAppli.__init__( self, code, salome, parent, multi=multi, langue=langue, ssIhm=True, labelCode=labelCode,)
- app = QApplication
+ self.setupUi(self)
+
+ EficasAppli.__init__( self, code, versionCode, salome, multi, langue, ssCode, fichierCata, GUIPath)
+ print (self.myQtab)
+
+ self.editorManager = QtEditorManager(self)
- self.ssIhm = False
- self.multi = multi
- self.demande = multi # voir PSEN
self.GUIPath = GUIPath
+ self.suiteTelemac = self.maConfiguration.suiteTelemac
+ self.multi = multi
if self.multi :
self.definitCode(code, None)
- if self.code == None:
- return
+ if self.code == None: return
- self.suiteTelemac = False
if self.maConfiguration.demandeLangue:
from InterfaceGUI.QT5.monChoixLangue import MonChoixLangue
widgetLangue = MonChoixLangue(self)
ret = widgetLangue.exec_()
- self.suiteTelemac = self.maConfiguration.suiteTelemac
from Accas.extensions import localisation
localisation.localise(None, self.langue, translatorFile=self.maConfiguration.translatorFile,)
- self.setupUi(self)
+ self.repIcon = os.path.join( os.path.dirname(os.path.abspath(__file__)),"..", "..", "Editeur", "icons")
+ app = QApplication
if not self.salome:
self.resize(self.maConfiguration.taille, self.height())
if self.maConfiguration.closeEntete :
self.closeEntete()
-
- self.viewmanager = ViewManager(self)
self.recentMenu = QMenu(tr("&Recents"))
# actionARemplacer ne sert que pour l insert Menu
self.connecterSignaux()
if hasattr(self, 'toolBar') : self.toolBar.addSeparator()
- if self.code != None:
- self.construitMenu()
+ if self.code != None: self.construitMenu()
self.setWindowTitle(self.versionEficas)
try:
print("je suis dans le except du ouvreFichier")
if self.salome == 0 : exit(1)
+ #--------------------
def closeEntete(self):
+ #--------------------
self.menuBar().close()
self.toolBar.close()
self.frameEntete.close()
+ #-----------------------------------
def definitCode(self, code, ssCode):
+ #-----------------------------------
self.code = code
self.ssCode = ssCode
if self.code == None:
- self.cleanPath()
from InterfaceGUI.QT5.monChoixCode import MonChoixCode
widgetChoix = MonChoixCode(self)
ret = widgetChoix.exec_()
- # widgetChoix.show()
if self.code == None:
return # pour le cancel de la fenetre choix code
EficasAppli.definitCode(self, self.code, ssCode)
+ #-----------------------
def construitMenu(self):
+ #-----------------------
self.initPatrons()
self.initRecents()
self.initAides()
if hasattr(self, "maConfiguration") and self.maConfiguration.ajoutExecution:
self.ajoutExecution()
+ #-------------------
def initAides(self):
+ #-------------------
# print "je passe la"
repAide = os.path.dirname(os.path.abspath(__file__))
fileName = "index.html"
self.menuAide.addAction(self.actionCode)
+ #-----------------
def ajoutUQ(self):
+ #-----------------
EficasAppli.ajoutUQ(self)
self.menuUQ = self.menubar.addMenu(tr("Incertitude"))
self.actionSaveUQ = QAction(self)
# self.actionEnregistrer_sous.setDisabled(True)
+ #------------------------
def ajoutExecution(self):
+ #------------------------
self.menuExecution = self.menubar.addMenu(tr("&Run"))
self.actionExecution = QAction(self)
if sys.platform[0:5] == "linux":
self.actionExecution.setText(tr("Run"))
self.actionExecution.triggered.connect(self.run)
+ #-----------------------------
def ajoutSauveExecution(self):
+ #-----------------------------
self.actionSaveRun = QAction(self)
icon7 = QIcon(self.repIcon + "/export_MAP.png")
self.actionSaveRun.setIcon(icon7)
self.actionSaveRun.setText(tr("Save Run"))
self.actionSaveRun.triggered.connect(self.saveRun)
+ #---------------------------------
def griserActionsStructures(self):
+ #---------------------------------
self.actionCouper.setEnabled(False)
self.actionColler.setEnabled(False)
self.actionCopier.setEnabled(False)
self.actionSupprimer.setEnabled(False)
+ #---------------------------------
def enleverActionsStructures(self):
+ #---------------------------------
self.toolBar.removeAction(self.actionCopier)
self.toolBar.removeAction(self.actionColler)
self.toolBar.removeAction(self.actionCouper)
self.menuEdition.removeAction(self.actionCopier)
self.menuEdition.removeAction(self.actionColler)
+ #---------------------------
def enleverParametres(self):
+ #---------------------------
self.toolBar.removeAction(self.actionParametres)
self.menuJdC.removeAction(self.actionParametres)
+ #---------------------------
def enleverSupprimer(self):
+ #---------------------------
self.toolBar.removeAction(self.actionSupprimer)
+ #---------------------------
def enlevernewInclude(self):
+ #---------------------------
self.actionNouvel_Include.setVisible(False)
+ #-------------------------------------
def enleverRechercherDsCatalogue(self):
+ #-------------------------------------
self.actionRechercherDsCatalogue.setVisible(False)
+ #-------------------------------------
def connectRechercherDsCatalogue(self):
+ #------------------------------------
if hasattr(self, "rechercherDejaLa"):
return
self.rechercherDejaLa = True
self.handleRechercherDsCatalogue
)
+ #-----------------------------
def ajoutSortieComplete(self):
+ #---------------------------
if hasattr(self, "actionSortieComplete"):
return
self.actionSortieComplete = QAction(self)
def ChercheGrpMesh(self):
Msg, listeGroup = self.ChercheGrpMeshInSalome()
if Msg == None:
- self.viewmanager.handleAjoutGroup(listeGroup)
+ self.editorManager.handleAjoutGroup(listeGroup)
else:
print("il faut gerer les erreurs")
except:
raise ValueError("Salome non ouvert")
if Msg == None:
- self.viewmanager.handleAjoutGroup(listeGroup)
+ self.editorManager.handleAjoutGroup(listeGroup)
else:
print("il faut gerer les erreurs")
self.actionCode.triggered.connect(self.aideCode)
def handleDeplier(self):
- self.viewmanager.handleDeplier()
+ self.editorManager.handleDeplier()
def handleSortieUQ(self):
- self.viewmanager.handleSortieUQ()
+ self.editorManager.handleSortieUQ()
def handleExeUQ(self):
- self.viewmanager.handleExeUQ()
+ self.editorManager.handleExeUQ()
def handleSauvePourPersalys(self):
- self.viewmanager.handleSauvePourPersalys()
+ self.editorManager.handleSauvePourPersalys()
def ajoutCommentaire(self):
- self.viewmanager.ajoutCommentaire()
+ self.editorManager.ajoutCommentaire()
def ouvreFichiers(self):
# Ouverture des fichiers de commandes donnes sur la ligne de commande
for study in session.d_env.studies:
os.chdir(cwd)
d = session.getUnit(study, self)
- self.viewmanager.handleOpen(fichier=study["comm"], units=d)
+ self.editorManager.handleOpen(fichier=study["comm"], units=d)
def getSource(self, file):
# appele par Editeur/session.py
# self.Patrons.setItemParameter(id,idx)
idx = idx + 1
+ #----------------------
def initRecents(self):
- self.recent = []
- try:
- rep = os.path.join(os.path.expanduser("~"), ".config/Eficas", self.code)
- monFichier = rep + "/listefichiers_" + self.code
- index = 0
- f = open(monFichier)
- while index < 9:
- ligne = f.readline()
- if ligne != "":
- l = (ligne.split("\n"))[0]
- self.recent.append(l)
- index = index + 1
- except:
- pass
-
+ #----------------------
+ self.recemmentUtilises = []
+ rep = self.maConfiguration.repUser
+ monFichier = rep + "/listefichiers_" + self.code
+ index = 0
try:
- f.close()
+ with open(monFichier) as f:
+ while index < 9:
+ ligne = f.readline()
+ if ligne != "":
+ l = (ligne.split("\n"))[0]
+ self.recemmentUtilises.append(l)
+ index = index + 1
except:
pass
+ #------------------------------
def addToRecentList(self, fn):
- while fn in self.recent:
- self.recent.remove(fn)
- self.recent.insert(0, fn)
- if len(self.recent) > 9:
- self.recent = self.recent[:9]
-
- def addToRecentListQT4(self, fn):
- """
- Public slot to add a filename to the list of recently opened files.
-
- @param fn name of the file to be added
- """
- self.recent.removeAll(fn)
- self.recent.prepend(fn)
- if len(self.recent) > 9:
- self.recent = self.recent[:9]
- index = 0
- self.sauveRecents()
-
+ #------------------------------
+ while fn in self.recemmentUtilises:
+ self.recemmentUtilises.remove(fn)
+ self.recemmentUtilises.insert(0, fn)
+ if len(self.recemmentUtilises) > 9:
+ self.recemmentUtilises = self.recemmentUtilises[:9]
+
+ #----------------------
def sauveRecents(self):
+ #----------------------
+ if len(self.recemmentUtilises) == 0: return
+ rep = self.maConfiguration.repUser
+ if not (os.path.isdir(rep)) :
+ try:
+ os.makedirs(rep)
+ except:
+ self.afficheMessage ('liste des fichiers recents','creation de la directory impossible')
+ return
+
+ monFichier = rep + "/listefichiers_" + self.code
try:
- rep = self.maConfiguration.repUser
- monFichier = rep + "/listefichiers_" + self.code
- except:
- return
- try:
- f = open(monFichier, "w")
- if len(self.recent) == 0:
- return
index = 0
- while index < len(self.recent):
- ligne = str(self.recent[index]) + "\n"
- f.write(ligne)
- index = index + 1
+ with open(monFichier, "w") as f:
+ while index < len(self.recemmentUtilises):
+ ligne = str(self.recemmentUtilises[index]) + "\n"
+ f.write(ligne)
+ index = index + 1
except:
- pass
- try:
- f.close()
- except:
- pass
+ self.afficheMessage ('liste des fichiers recents','impossible de sauvegarder la liste des fichiers recents')
+ #-------------------------
def traductionV11V12(self):
+ #-------------------------
from InterfaceGUI.QT5.gereTraduction import traduction
- traduction(self.maConfiguration.repIni, self.viewmanager, "V11V12")
+ traduction(self.maConfiguration.repIni, self.editorManager, "V11V12")
+ #--------------------------
def traductionV10V11(self):
+ #---------------------------
from InterfaceGUI.QT5.gereTraduction import traduction
- traduction(self.maConfiguration.repIni, self.viewmanager, "V10V11")
+ traduction(self.maConfiguration.repIni, self.editorManager, "V10V11")
+ #----------------------------
def traductionV9V10(self):
+ #----------------------------
from InterfaceGUI.QT5.gereTraduction import traduction
- traduction(self.maConfiguration.repIni, self.viewmanager, "V9V10")
+ traduction(self.maConfiguration.repIni, self.editorManager, "V9V10")
+ #--------------------------------------------------
def afficheMessage(self, titre, texte,critical=True):
+ #--------------------------------------------------
if critical :
QMessageBox.critical( None, tr(titre), tr(texte))
else :
QMessageBox.warning( None, tr(titre), tr(texte))
-
+ #----------------
def version(self):
+ #----------------
from InterfaceGUI.QT5.monVisu import DVisu
titre = tr("version ")
monVisuDialg.adjustSize()
monVisuDialg.show()
+ #----------------
def aidePPal(self):
+ #----------------
repAide = os.path.dirname(os.path.abspath(__file__))
maD = os.path.join(repAide, "..", "Doc")
try:
self, tr("Aide Indisponible"), tr("l'aide n est pas installee ")
)
- def aidePSEN(self):
- repAide = os.path.dirname(os.path.abspath(__file__))
- maD = os.path.join(repAide, "..", "Doc")
- try:
- indexAide = os.path.join(maD, "index.html")
- if sys.platform[0:5] == "linux":
- cmd = "xdg-open " + indexAide
- else:
- cmd = "start " + indexAide
- os.system(cmd)
- except:
- QMessageBox.warning(
- self, tr("Aide Indisponible"), tr("l'aide n est pas installee ")
- )
-
+ #----------------
def aideCode(self):
- if self.code == None:
- return
+ #----------------
+ if self.code == None: return
try:
- # if 1 :
if sys.platform[0:5] == "linux":
cmd = "xdg-open " + self.fileDoc
else:
self, tr("Aide Indisponible"), tr("l'aide n est pas installee ")
)
+ #------------------------
def optionEditeur(self):
+ #------------------------
try:
name = "monOptions_" + self.code
except:
monOption.show()
def handleSortieComplete(self):
- return self.viewmanager.saveCompleteCurrentEditor()
+ return self.editorManager.saveCompleteCurrentEditor()
def handleShowRecentMenu(self):
"""
"""
self.recentMenu.clear()
- for rp in self.recent:
+ for rp in self.recemmentUtilises:
id = self.recentMenu.addAction(rp)
self.ficRecents[id] = rp
id.triggered.connect(self.handleOpenRecent)
+ "/"
+ self.ficPatrons[idx]
)
- self.viewmanager.handleOpen(fichier=fichier, patron=1)
+ self.editorManager.handleOpen(fichier=fichier, patron=1)
def handleOpenRecent(self):
idx = self.sender()
fichier = self.ficRecents[idx]
- self.viewmanager.handleOpen(fichier=fichier, patron=0)
+ self.editorManager.handleOpen(fichier=fichier, patron=0)
def handleClearRecent(self):
- self.recent = []
+ self.recemmentUtilises = []
self.sauveRecents()
def handleRechercherDsCatalogue(self):
- if not self.viewmanager:
+ if not self.editorManager:
return
- self.viewmanager.handleRechercherDsCatalogue()
+ self.editorManager.handleRechercherDsCatalogue()
def fileNew(self):
try:
- self.viewmanager.newEditor()
+ self.editorManager.newEditor()
except EficasException as exc:
msg = str(exc)
if msg != "":
def fileOpen(self):
try:
- self.viewmanager.handleOpen()
+ self.editorManager.handleOpen()
except EficasException as exc:
msg = str(exc)
if msg != "":
QMessageBox.warning(self, tr("Erreur"), msg)
def saveLigne(self):
- return self.viewmanager.handleSaveLigne()
+ return self.editorManager.handleSaveLigne()
def fileSave(self):
- return self.viewmanager.handleSave()
+ return self.editorManager.handleSave()
def fileSaveAs(self):
- return self.viewmanager.handleSaveAs()
+ return self.editorManager.handleSaveAs()
def fileClose(self):
- self.viewmanager.handleClose(texte="&Fermer")
+ self.editorManager.handleClose(texte="&Fermer")
def fileCloseAll(self):
- self.viewmanager.handleCloseAll(texte="&Fermer")
+ self.editorManager.handleCloseAll(texte="&Fermer")
def fileExit(self):
# On peut sortir sur Abort
- res = self.viewmanager.handleCloseAll()
+ res = self.editorManager.handleCloseAll()
if res != 2:
self.close()
return res
def editCopy(self):
- self.viewmanager.handleEditCopy()
+ self.editorManager.handleEditCopy()
def editCut(self):
- self.viewmanager.handleEditCut()
+ self.editorManager.handleEditCut()
def editPaste(self):
- self.viewmanager.handleEditPaste()
+ self.editorManager.handleEditPaste()
def rechercher(self):
- self.viewmanager.handleRechercher()
+ self.editorManager.handleRechercher()
def run(self):
- self.viewmanager.run()
+ self.editorManager.run()
def saveRun(self):
- self.viewmanager.saveRun()
+ self.editorManager.saveRun()
def supprimer(self):
- self.viewmanager.handleSupprimer()
+ self.editorManager.handleSupprimer()
def jdcFichierSource(self):
- self.viewmanager.handleViewJdcFichierSource()
+ self.editorManager.handleViewJdcFichierSource()
def jdcRapport(self):
- self.viewmanager.handleViewJdcRapport()
+ self.editorManager.handleViewJdcRapport()
def jdcRegles(self):
- self.viewmanager.handleViewJdcRegles()
+ self.editorManager.handleViewJdcRegles()
def gestionParam(self):
- self.viewmanager.handleGestionParam()
+ self.editorManager.handleGestionParam()
def visuJdcPy(self):
- self.viewmanager.handleViewJdcPy()
+ self.editorManager.handleViewJdcPy()
def ouvreArbre(self):
- self.viewmanager.ouvreArbre()
+ self.editorManager.ouvreArbre()
def fermeArbre(self):
- self.viewmanager.fermeArbre()
+ self.editorManager.fermeArbre()
def newInclude(self):
- self.viewmanager.newIncludeEditor()
-
- def cleanPath(self):
- for pathCode in self.listeAPathEnlever:
- try:
- sys.path.remove(aEnlever)
- except:
- pass
+ self.editorManager.newIncludeEditor()
def closeEvent(self, event):
res = self.fileExit()
self.monLayoutBoutonRempli = MonLayoutBouton(self)
def handleAjoutEtape(self, nomEtape):
- self.viewmanager.handleAjoutEtape(nomEtape)
+ self.editorManager.handleAjoutEtape(nomEtape)
def metMenuAJourUtilisateurs(self):
self.lesFonctionsUtilisateurs = {}
def handleFonctionUtilisateur(self, action):
(laFonctionUtilisateur, lesArguments) = self.lesFonctionsUtilisateurs[action]
- self.viewmanager.handleFonctionUtilisateur(laFonctionUtilisateur, lesArguments)
+ self.editorManager.handleFonctionUtilisateur(laFonctionUtilisateur, lesArguments)
if __name__ == "__main__":
+++ /dev/null
-# -*- coding: utf-8 -*-
-# Copyright (C) 2007-2024 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
-#
-
-
-
-import os
-from Accas.extensions.eficas_translation import tr
-from PyQt5.QtWidgets import QFileDialog, QMessageBox
-from PyQt5.QtCore import QFileInfo
-
-Dictextensions = {"MAP": ".map"}
-
-#------------------------#
-class ViewManager(object):
-#------------------------#
- def __init__(self, appliEficas):
- #--------------------------------
- self.appliEficas = appliEficas
- self.tabWidgets = []
- self.mesIndexes = {}
- self.appliEficas = appliEficas
- self.editors = []
- self.dictEditors = {}
- self.untitledCount = 0
- self.doubles = {}
-
- self.myQtab = self.appliEficas.myQtab
-
- self.myQtab.currentChanged.connect(self.indexChanged)
- self.myQtab.tabCloseRequested.connect(self.closeTab)
-
- def indexChanged(self):
- #----------------------
- index = self.myQtab.currentIndex()
- if index in self.dictEditors:
- editor = self.dictEditors[index]
- if editor.jdc != None:
- CONTEXT.unsetCurrentJdC()
- CONTEXT.setCurrentJdC(editor.jdc)
- self.appliEficas.maConfiguration = editor.maConfiguration
- self.appliEficas.code = editor.maConfiguration.code
- self.appliEficas.setWindowTitle(editor.titre)
- self.appliEficas.construitMenu()
-
- def handleOpen(self, fichier=None, patron=0, units=None):
- #--------------------------------------------------------
- result = None
- if fichier is None:
- if self.appliEficas.demande == True:
- self.appliEficas.definitCode(None, None)
- if self.appliEficas.code == None:
- return
-
- if self.appliEficas.code in Dictextensions:
- chaine = "JDC (*" + Dictextensions[self.appliEficas.code] + ");;"
- extensions = tr(chaine + "All Files (*)")
- elif self.appliEficas.code == "TELEMAC":
- extensions = tr("CAS (*.cas);;All Files (*)")
- else:
- extensions = tr("Fichiers JDC (*.comm);;" "Tous les Fichiers (*)")
-
- fichier = QFileDialog.getOpenFileName(
- self.appliEficas,
- tr("Ouvrir Fichier"),
- self.appliEficas.maConfiguration.saveDir,
- extensions,
- )
- fichier = fichier[0]
- if len(fichier) == 0:
- return None
- fichier = os.path.abspath(fichier)
- ulfile = os.path.abspath(fichier)
- self.appliEficas.maConfiguration.saveDir = os.path.split(ulfile)[0]
- self.appliEficas.addToRecentList(fichier)
- maPage = self.getEditor(fichier, units=units)
- if maPage:
- result = maPage
- if maPage:
- self.myQtab.setTabText(
- self.myQtab.indexOf(maPage), os.path.basename(fichier)
- )
- return result
-
- def closeTab(self, indexAFermer):
- #--------------------------------
- self.handleClose(indexAFermer=indexAFermer)
-
- def handleClose(self, doitSauverRecent=1, texte=tr("&Quitter"), indexAFermer=None):
- #----------------------------------------------------------------------------------
- if doitSauverRecent:
- self.appliEficas.sauveRecents()
- if indexAFermer == None:
- index = self.myQtab.currentIndex()
- else:
- index = indexAFermer
- if index < 0:
- return
- res = self.checkDirty(self.dictEditors[index], texte)
- if res == 2:
- return 2 # l utilisateur a annule
- idx = index
- while idx < len(self.dictEditors) - 1:
- self.dictEditors[idx] = self.dictEditors[idx + 1]
- idx = idx + 1
- del self.dictEditors[len(self.dictEditors) - 1]
- try:
- del self.doubles[self.dictEditors[index]]
- except:
- pass
- self.myQtab.removeTab(index)
- return res
-
- def run(self):
- #-------------
- index = self.myQtab.currentIndex()
- if index < 0:
- return
- editor = self.dictEditors[index]
- editor.run()
-
- def saveRun(self):
- #------------------
- index = self.myQtab.currentIndex()
- if index < 0:
- return
- editor = self.dictEditors[index]
- editor.saveRun()
-
- def handleCloseAll(self, texte=tr("Quitter")):
- #---------------------------------------------
- res = 0
- self.appliEficas.sauveRecents()
- while len(self.dictEditors) > 0:
- self.myQtab.setCurrentIndex(0)
- res = self.handleClose(0, texte)
- if res == 2:
- return res # l utilsateur a annule
- return res
-
- def handleRechercher(self):
- #--------------------------
- # print "passage dans handleRechercher"
- index = self.myQtab.currentIndex()
- if index < 0:
- return
- editor = self.dictEditors[index]
- editor.handleRechercher()
-
- def handleRechercherDsCatalogue(self):
- #-------------------------------------
- # print "passage dans handleRechercher"
- index = self.myQtab.currentIndex()
- if index < 0:
- return
- editor = self.dictEditors[index]
- editor.handleRechercherDsCatalogue()
-
- def handleDeplier(self):
- #-----------------------
- index = self.myQtab.currentIndex()
- if index < 0:
- return
- editor = self.dictEditors[index]
- editor.handleDeplier()
-
- def handleEditCopy(self):
- #------------------------
- # print "passage dans handleEditCopy"
- index = self.myQtab.currentIndex()
- if index < 0:
- return
- editor = self.dictEditors[index]
- editor.handleEditCopy()
-
- def handleEditCut(self):
- #-----------------------
- # print "passage dans handleEditCut"
- index = self.myQtab.currentIndex()
- if index < 0:
- return
- editor = self.dictEditors[index]
- editor.handleEditCut()
-
- def handleEditPaste(self):
- #-------------------------
- # print "passage dans handleEditPaste"
- index = self.myQtab.currentIndex()
- if index < 0:
- return
- editor = self.dictEditors[index]
- editor.handleEditPaste()
-
- def handleSupprimer(self):
- #-------------------------
- index = self.myQtab.currentIndex()
- if index < 0:
- return
- editor = self.dictEditors[index]
- editor.handleSupprimer()
-
- def handleAjoutEtape(self, nomEtape):
- #------------------------------------
- index = self.myQtab.currentIndex()
- if index < 0:
- return
- editor = self.dictEditors[index]
- editor.handleAjoutEtape(nomEtape)
-
- def newEditor(self, include=0):
- #------------------------------
- if self.appliEficas.demande == True:
- self.appliEficas.definitCode(None, None)
- if self.appliEficas.code == None:
- return
- maPage = self.getEditor(include=include)
-
- def newIncludeEditor(self):
- #--------------------------
- self.newEditor(include=1)
-
- def handleViewJdcFichierSource(self):
- #------------------------------------
- index = self.myQtab.currentIndex()
- if index < 0:
- return
- self.dictEditors[index].viewJdcSource()
-
- def ouvreArbre(self):
- #--------------------
- index = self.myQtab.currentIndex()
- if index < 0:
- return
- self.dictEditors[index].ouvreArbre()
-
- def fermeArbre(self):
- #--------------------
- index = self.myQtab.currentIndex()
- if index < 0:
- return
- self.dictEditors[index].fermeArbre()
-
- def ajoutCommentaire(self):
- #--------------------------
- index = self.myQtab.currentIndex()
- if index < 0:
- return
- editor = self.dictEditors[index]
- editor.ajoutCommentaire()
-
- def handleViewJdcRegles(self):
- #-----------------------------
- index = self.myQtab.currentIndex()
- if index < 0:
- return
- self.dictEditors[index].viewJdcRegles()
-
- def handleGestionParam(self):
- #----------------------------
- index = self.myQtab.currentIndex()
- if index < 0:
- QMessageBox.warning(
- self.appliEficas,
- tr("Creation Parametre indisponible"),
- tr("les parametres sont lies a un jeu de donnees"),
- )
- return
- self.dictEditors[index].gestionParam()
-
- def handleViewJdcRapport(self):
- #------------------------------
- index = self.myQtab.currentIndex()
- if index < 0:
- return
- self.dictEditors[index].viewJdcRapport()
-
- def handleViewJdcPy(self):
- #-------------------------
- index = self.myQtab.currentIndex()
- if index < 0:
- return
- self.dictEditors[index].viewJdcPy()
-
- def handleSave(self):
- #--------------------
- index = self.myQtab.currentIndex()
- if index < 0: return
- editor = self.dictEditors[index]
- if editor in self.doubles:
- QMessageBox.warning(
- None,
- tr("Fichier Duplique"),
- tr("Le fichier ne sera pas sauvegarde."),
- )
- return
- ok, newName = editor.saveFile()
- if ok:
- fileName = os.path.basename(newName)
- self.myQtab.setTabText(index, fileName)
- return ok
-
- def handleSortieUQ(self):
- #------------------------
- index = self.myQtab.currentIndex()
- if index < 0:
- return
- editor = self.dictEditors[index]
- ok, newName = editor.saveUQFile()
- return ok
-
- def handleSauvePourPersalys(self):
- #---------------------------------
- index = self.myQtab.currentIndex()
- if index < 0:
- return
- editor = self.dictEditors[index]
- ok = editor.sauvePourPersalys()
- return ok
-
- def handleExeUQ(self):
- #---------------------
- index = self.myQtab.currentIndex()
- if index < 0:
- return
- editor = self.dictEditors[index]
- ok = editor.exeUQ()
- return ok
-
- def handleSaveLigne(self):
- #-------------------------
- index = self.myQtab.currentIndex()
- if index < 0:
- return
- editor = self.dictEditors[index]
- ok, newName = editor.saveLigneFile()
- return ok
-
- def handleSaveAs(self):
- #----------------------
- index = self.myQtab.currentIndex()
- editor = self.dictEditors[index]
- oldName = editor.fichier
- ok, newName = editor.saveFileAs()
- if ok:
- fileName = os.path.basename(newName)
- self.myQtab.setTabText(index, fileName)
- if editor in self.doubles:
- if oldName != newName:
- del self.doubles[editor]
- return ok
-
- def displayJDC(self, jdc, fn=None):
- #----------------------------------
- """
- Public slot to display a file in an editor.
- @param fn name of file to be opened
- # insert filename into list of recently opened files
- """
- titre = None
- if fn != None:
- titre = fn.split("/")[-1]
- editor = self.getEditor(fichier=fn, jdc=jdc, include=1)
- self.appliEficas.addToRecentList(editor.getFileName())
-
- def getEditor(self, fichier=None, jdc=None, units=None, include=0):
- #------------------------------------------------------------------
- newWin = 0
- double = None
- indexEditor = 0
- for indexEditor in self.dictEditors:
- editor = self.dictEditors[indexEditor]
- if self.samePath(fichier, editor.getFileName()):
- msgBox = QMessageBox()
- msgBox.setWindowTitle(tr("Fichier"))
- msgBox.setText(tr("Le fichier <b>%s</b> est deja ouvert", str(fichier)))
- msgBox.addButton(tr("&Duplication"), 0)
- msgBox.addButton(tr("&Abandonner"), 1)
- abort = msgBox.exec_()
- if abort:
- break
- double = editor
- else:
- from qt_editor import QtEditor
- editor = QtEditor( self.appliEficas, fichier, jdc, self.myQtab, units=units, include=include,)
- if double != None:
- self.doubles[editor] = double
- if editor.jdc: # le fichier est bien un jdc
- self.editors.append(editor)
- newWin = 1
- else:
- editor.closeIt()
-
- if newWin:
- self.addView(editor, fichier)
- elif editor.jdc:
- self.myQtab.setCurrentIndex(indexEditor)
-
- index = self.myQtab.currentIndex()
- if index != -1:
- self.dictEditors[index] = editor
- return editor
-
- def addView(self, win, fichier=None):
- #------------------------------------
- if fichier is None:
- self.untitledCount += 1
- self.myQtab.addTab(
- win, tr("Fichier non encore nomme") + str(self.untitledCount)
- )
- # self.myQtab.addTab(win, str(self.appliEficas.code))
- else:
- liste = fichier.split("/")
- txt = liste[-1]
- if not QFileInfo(fichier).isWritable():
- txt = "%s (ro)" % txt
- self.myQtab.addTab(win, txt)
- self.myQtab.setCurrentWidget(win)
- self.currentEditor = win
- win.setFocus()
-
- def getOpenStartDir(self):
- #-------------------------
- # TODO PN --> Les Preferences
- try:
- userDir = os.path.expanduser("~/Eficas_install/")
- return userDir
- except:
- return ""
-
- def samePath(self, f1, f2):
- """
- compare two paths.
- """
- if f1 is None or f2 is None:
- return 0
- if os.path.normcase(os.path.normpath(f1)) == os.path.normcase(
- os.path.normpath(f2)
- ):
- return 1
- return 0
-
- def checkDirty(self, editor, texte):
- """
- Private method to check dirty status and open a message window.
-
- @param editor editor window to check
- @return flag indicating successful reset of the dirty flag (boolean)
- """
- res = 1
- if (editor.modified) and (editor in self.doubles):
- msgBox = QMessageBox(None)
- msgBox.setWindowTitle(tr("Fichier Duplique"))
- msgBox.setText(tr("Le fichier ne sera pas sauvegarde."))
- msgBox.addButton(texte, 0)
- msgBox.addButton(tr("&Annuler"), 1)
- res = msgBox.exec_()
- if res == 0:
- return 1
- return 2
- if editor.modified:
- fn = editor.getFileName()
- if fn is None:
- fn = tr("Noname")
- msgBox = QMessageBox(None)
- msgBox.setWindowTitle(tr("Fichier Modifie"))
- msgBox.setText(tr("Le fichier ne sera pas sauvegarde."))
- msgBox.addButton(tr("&Sauvegarder"), 1)
- msgBox.addButton(tr("&Quitter sans sauvegarder"), 0)
- msgBox.addButton(tr("&Annuler"), 2)
- res = msgBox.exec_()
- if res == 2:
- return res
- if res == 0 and self.appliEficas.maConfiguration.afficheUQ:
- if fn is None:
- ret, fichier = editor.saveUQFile(self)
- else:
- ret, fichier = editor.saveUQFile(self, fn)
- return 2
- if res == 0:
- (ok, newName) = editor.saveFile()
- if ok:
- fileName = os.path.basename(newName)
- index = self.myQtab.currentIndex()
- self.myQtab.setTabText(index, fileName)
- return ok
- return res
-
- def handleAjoutGroup(self, listeGroup):
- index = self.myQtab.currentIndex()
- if index < 0:
- return
- editor = self.dictEditors[index]
- editor.handleAjoutGroup(listeGroup)
-
- def handleFonctionUtilisateur(self, laFonctionUtilisateur, lesArguments):
- # Peut-etre a blinder un peu plus sur le nb d argument
- index = self.myQtab.currentIndex()
- if index < 0:
- return
- editor = self.dictEditors[index]
- if editor.getEtapeCourante() == None:
- QMessageBox.information(
- self.appliEficas,
- tr("Selectionner une etape"),
- tr(
- "Le texte ne peut pas etre insere dans un fichier vide,\nCreer un materiau vide ou une zone vide et inserer le catalogue apres"
- ),
- )
- return
-
- listeParam = []
- for p in lesArguments:
- if hasattr(editor, p):
- listeParam.append(getattr(editor, p))
- if p == "editor":
- listeParam.append(editor)
- if p == "etapeCourante":
- listeParam.append(editor.getEtapeCourante())
- laFonctionUtilisateur(*listeParam)
QWidget.__init__(self,None)
self.setupUi(self)
- appliEficas.maConfiguration.withXSD=1
Editor.__init__(self,appliEficas, fichier, jdc=jdc)
comploader.chargerComposants(self.appliEficas.GUIPath)
self.initQTSignals()
self.message=''
#self.commandesOrdreCatalogue =self.readercata.commandesOrdreCatalogue
- nomFichierTranslation='translatorFile'+'_'+str(self.appliEficas.readercata.labelCode)
+ nomFichierTranslation='translatorFile'+'_'+str(self.appliEficas.readercata.versionCode)
if hasattr(self.appliEficas.maConfiguration,nomFichierTranslation) :
translatorFile=getattr(self.appliEficas.maConfiguration,nomFichierTranslation)
from Accas.extensions import localisation
self.jdcSelection.analyse()
if debug : print (self.jdcSelection.etapes)
self.jdcSelectionItem = Objecttreeitem.makeObjecttreeitem( self, "nom", self.jdcSelection )
- if self.jdcSelectionItem and self.appliEficas.ssIhm==False :
+ if self.jdcSelectionItem :
self.treeJdcSelection = browser.JDCTree( self.jdcSelectionItem, self )
if debug : print (self.treeJdcSelection)
self.widgetSelection = self.treeJdcSelection.racine.children[0].fenetre
self.jdcLabels=self._newJDC(texte=texte)
self.jdcLabels.analyse()
jdcLabelsItem = Objecttreeitem.makeObjecttreeitem( self, "nom", self.jdcLabels )
- if jdcLabelsItem and self.appliEficas.ssIhm==False :
+ if jdcLabelsItem :
treeJdcLabels = browser.JDCTree( jdcLabelsItem, self )
widgetLabels = treeJdcLabels.racine.children[0].fenetre
widgetLabels.show()
def afficheMessage(self,titre,message,critique=True):
#----------------------------------------------------
- if self.appliEficas.ssIhm:
- print ('******************', titre, '*************')
- print (message)
- print ('*******************************')
- else:
- if critique :
- from PyQt5.QtWidgets import QMessageBox
- QMessageBox.critical(self, titre, message)
- else :
- from PyQt5.QtWidgets import QMessageBox
- QMessageBox.information(self, titre, message)
+ if critique :
+ from PyQt5.QtWidgets import QMessageBox
+ QMessageBox.critical(self, titre, message)
+ else :
+ from PyQt5.QtWidgets import QMessageBox
+ QMessageBox.information(self, titre, message)
def appelleExecutionRequete(self,requete,chercheUneSeuleValeur=True):
Class implementing the 5C user interface.
"""
- def __init__(self,code='5C', salome=0, multi = 0, labelCode=None, langue='en', GUIPath="InterfaceGUI.cinqC"):
- super().__init__(code=code, salome=salome, multi=multi, langue=langue, labelCode=labelCode, GUIPath=GUIPath)
- self.GUIPath=GUIPath
- self.viewmanager.newEditor()
+ def __init__(self,code='5C', salome=0, multi = 0, versionCode=None, langue='en', GUIPath="InterfaceGUI.cinqC"):
+ super().__init__(code=code, salome=salome, multi=multi, langue=langue, versionCode=versionCode, GUIPath=GUIPath)
+ self.withXSD = True
+ self.GUIPath = GUIPath
+ self.editorManager.newEditor()
def connecterSignaux(self) :
def fileOpen(self) :
print ('aChanger')
- print ( self.viewmanager)
+ print ( self.editorManager)
def closeEvent(self,event):
le nouveau mot-cle
"""
liste_noms_mc_ordonnee = self.getListeMcOrdonneeBrute(
- self.getGenealogie(), self.getJdc().cata_ordonne_dico
+ self.getGenealogie(), self.getJdc().dicoCataOrdonne
)
liste_noms_mc_presents = self.object.listeMcPresents()
l = []
self._object.remove(item.getObject())
# la liste peut etre retournee vide !
message = "Mot-clef " + item.getObject().nom + " supprime"
- self.appliEficas.afficheInfos(message)
+ self.appliEficas.afficheMessages(message)
return 1
except:
return 0
from PyQt4.QtGui import *
from myMain import Ui_Eficas
-from viewManager import MyTabview
+from editorManager import MyTabview
from getVersion import getEficasVersion
from Accas.extensions.eficas_translation import tr
def close(self):
if ( self.editor != None ):
- vm=self.Eficas.viewmanager
+ vm=self.Eficas.editorManager
index=vm.myQtab.currentIndex()
idx=index
while idx < len(vm.dict_editors) -1 :
result=True
try:
- self.Eficas.viewmanager.handleOpen(fileName)
- index=self.Eficas.viewmanager.myQtab.currentIndex()
- self.editor=self.Eficas.viewmanager.dict_editors[index]
+ self.Eficas.editorManager.handleOpen(fileName)
+ index=self.Eficas.editorManager.myQtab.currentIndex()
+ self.editor=self.Eficas.editorManager.dict_editors[index]
except:
result=False
pass
#sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'../..'))
from Editeur import eficas_go
-eficas_go.lanceEficas(code='NonConnu')
+eficas_go.lanceQtEficas(code='NonConnu')
if self.monEficas == None :
self.toWebApp('afficheInfos', 'erreur à la construction de l appli Eficas', 'rouge')
return
- # faire l equivalent du viewmanager
+ # faire l equivalent du editorManager
if fichierCata == None and fichierComm :
self.toWebApp('afficheInfos', 'pour ouvrir un JDC, il faut connaitre le catalogue', 'rouge')
return
import prefs
from InterfaceSsIhm import eficas_go
-eficas_go.lanceEficas_Web(code=prefs.code)
+eficas_go.lanceQtEficas_Web(code=prefs.code)