--- /dev/null
+# Copyright (C) 2008-2018 EDF R&D
+#
+# This file is part of SALOME ADAO module
+#
+# 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, re
+import Accas
+from Accas import *
+
+JdC = JDC_CATA (
+ code = 'Map2',
+ )
+VERSION_CATALOGUE='V_0'
+
+class classCL(ASSD): pass
+
+class Surface_Elementaire(UserASSD): pass
+
+def creeSurfaceElementaire(MC) :
+ # PNPN pour qu eric puisse tester
+ MC.creeObjetClasse(Surface_Elementaire)
+ return
+
+
+CL=OPER(nom = 'CL', sd_prod=classCL,
+ Unite = SIMP(statut='o',typ='I',defaut=1),
+)
+MODELE_NUM = PROC( nom = 'MODELE_NUM',
+ MCA = SIMP(statut='o',typ='TXM'),
+ Condition = SIMP(statut='o',typ=classCL),
+)
+MODELE_NUM2 = PROC( nom = 'MODELE_NUM2',
+ surface_Elementaire=SIMP(statut= 'o',typ= 'TXM',max='**', siValide=creeSurfaceElementaire),
+ essai=SIMP(statut = 'f', typ = Surface_Elementaire),
+)
+
--- /dev/null
+# Copyright (C) 2007-2012 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
+#
+code="Essai"
+import sys, os
+if os.path.dirname(os.path.abspath(__file__)) not in sys.path :
+ sys.path.insert(0,os.path.dirname(os.path.abspath(__file__)))
--- /dev/null
+# -*- coding: utf-8 -*-
+# maConfiguration MANAGEMENT OF EDF VERSION
+# ======================================================================
+# COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG
+# THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+# IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY
+# THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR
+# (AT YOUR OPTION) ANY LATER VERSION.
+#
+# THIS PROGRAM 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
+# GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+#
+# YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE
+# ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER,
+# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE.
+#
+#
+# ======================================================================
+
+import os,sys
+# repIni sert a localiser le fichier editeur.ini
+# Obligatoire
+repIni=os.path.dirname(os.path.abspath(__file__))
+INSTALLDIR=os.path.join(repIni,'..')
+sys.path[:0]=[INSTALLDIR]
+
+
+# lang indique la langue utilisee pour les chaines d'aide : fr ou ang
+lang='fr'
+
+# Codage des strings qui accepte les accents (en remplacement de 'ascii')
+encoding='iso-8859-1'
+
+#
+#typeDeCata='XML'
+catalogues=(
+# ('Essai','V2017',os.path.join(repIni,'cata_bloc_ambigu.py'),'python','xml'),
+# ('Essai','V2017',os.path.join(repIni,'cata_blocs.py'),'python','xml'),
+# ('Essai','V2017',os.path.join(repIni,'cata_blocs_alter.py'),'python','xml'),
+ ('Essai','V2017',os.path.join(repIni,'cata_proc.py'),'python','python'),
+# ('Essai','V2017',os.path.join(repIni,'cata_condition_2MC.py'),'python','python'),
+# ('Essai','V2017',os.path.join(repIni,'cata_bloc_V0.py'),'python','xml'),
+# ('Essai','V2017',os.path.join(repIni,'cata_global.py'),'python','python'),
+)
+#nombreDeBoutonParLigne=4
+simpleClic=True
+#closeFrameRechercheCommande=True
+boutonDsMenuBar=False
+#closeArbre=True
+afficheListesPliees=False
+#withXSD=True
+afficheCommandesPliees = False
+#dumpXSD=True
+#afficheIhm=False
--- /dev/null
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# Copyright (C) 2007-2013 EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+"""
+ Ce module sert a lancer EFICAS configure pour MAP
+"""
+# 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__)),'..'))
+
+import prefs
+from InterfaceQT4 import eficas_go
+eficas_go.lanceEficas(code=prefs.code)
"""
d=self.getContexteAvant(etape)
-
l=[]
for k,v in d.items():
#if type(v) != types.InstanceType and not isinstance(v,object): continue
l.sort()
return l
+ def getSdCreeParObjet(self,classeAChercher):
+ l=[]
+ for v in list(self.sds_dict.keys()):
+ if (isinstance(self.sds_dict[v], classeAChercher)) :
+ l.append(self.sds_dict[v])
+ return l
+
+
def getVariables(self,etape):
etapeStop=etape
l=[]
# positionne prealablement par un appel a setEtapeContext
if CONTEXT.debug : print(("JDC.NommerSdprod ",sd,sdnom))
+ print(("JDC.NommerSdprod ",sd,sdnom))
if self._etape_context:
o=self.getContexteAvant(self._etape_context).get(sdnom,None)
from Noyau.N_ASSD import ASSD,assd
from Noyau.N_GEOM import GEOM,geom
from Noyau.N_CO import CO
+from Accas.A_ASSD import UserASSD
import Accas
# fin attention
self.definition.siValide(self)
return validite
+
def getNomConcept(self):
p=self
while p.parent :
return 0
def waitAssd(self):
+ """
+ Methode booleenne qui retourne 1 si le MCS attend un objet de type ASSD ou UserASSD
+ ou derive, 0 sinon
+ """
+ for typ in self.definition.type:
+ if type(typ) == type or isinstance(typ,type):
+ if issubclass(typ,ASSD) and not issubclass(typ,GEOM) :
+ return 1
+ return 0
+
+ def waitUserAssd(self):
"""
Methode booleenne qui retourne 1 si le MCS attend un objet de type ASSD
ou derive, 0 sinon
"""
for typ in self.definition.type:
if type(typ) == type or isinstance(typ,type):
- if issubclass(typ,ASSD) and not issubclass(typ,GEOM):
+ if issubclass(typ,UserASSD) :
return 1
return 0
+
def waitAssdOrGeom(self):
"""
Retourne 1 si le mot-cle simple attend un objet de type
self.parent.updateConditionBloc()
def setValeur(self,new_valeur,evaluation='oui'):
- print ("setValeur Ihm/IMCSIMP ",new_valeur)
+ #print ("setValeur Ihm/IMCSIMP ",new_valeur)
self.initModif()
self.valeur = new_valeur
self.val = new_valeur
"""
sd = self.jdc.getSdAvantEtape(new_valeur,self.etape)
#sd = self.jdc.getContexteAvant(self.etape).get(new_valeur,None)
- #print sd
if sd is not None:
return sd,1
lsd = self.jdc.chercheListAvant(self.etape,new_valeur)
d['EVAL']=Accas.EVAL
try :
objet = eval(new_valeur,d)
+ print (1)
return objet,1
except Exception:
+ print (2)
itparam=self.chercheItemParametre(new_valeur)
if itparam:
return itparam,1
def evalValItem(self,new_valeur):
"""
- Tente d'evaluer new_valeur comme un concept, un parametre, un objet Python
+ Tente d'evaluer new_valeur comme un concept, un parametre, un objet Python ou un UserASSD
Si c'est impossible retourne new_valeur inchange
argument new_valeur : string (nom de concept, de parametre, expression ou simple chaine)
"""
- if self.etape and self.etape.parent:
+ if new_valeur in list(self.jdc.sds_dict.keys()) and self.waitUserAssd():
+ valeur=self.jdc.sds_dict[new_valeur]
+ return valeur
+ elif self.etape and self.etape.parent:
valeur=self.etape.parent.evalInContext(new_valeur,self.etape)
return valeur
else:
self.item.connect("valid",self.onValid,())
self.item.connect("supp" ,self.onSupp,())
self.item.connect("add" ,self.onAdd,())
+ self.item.connect("reconstruit" ,self.onReconstruit,())
self.state=""
self.fenetre=None
# #------------------------------------------------------------------
def onValid(self):
- #print ("onValid pour ", self.item.nom)
+ print ("onValid pour ", self.item.nom)
if self.JESUISOFF==1 : return
if hasattr(self,'fenetre') and self.fenetre:
try :
self.updateNodeLabel()
self.updateNodeTexte()
+ def onReconstruit(self):
+ print ("onReconstruire pour ", self.item.nom)
+
def onAdd(self,object):
if self.JESUISOFF==1 : return
#print ("onAdd pour ", self.item.nom, object)
from InterfaceQT4 import browser
from Noyau.N_CR import justifyText
from Accas import SalomeEntry
+from Accas import UserASSD
class Node(browser.JDCNode,typeNode.PopUpMenuNodeMinimal):
Retourne la liste des noms des SD presentes avant l'etape qui contient
le MCS pointe par self et du type requis par ce MCS
"""
+ print ('self.object.definition.type' , self.object.definition.type)
a=self.object.etape.parent.getSdAvantDuBonType(self.object.etape,self.object.definition.type)
- return a
+
+ if self.waitUserAssd() : l=self.jdc.getSdCreeParObjet(self.object.definition.type)
+ else :l=[]
+ return a+l
def getSdAvantDuBonTypePourTypeDeBase(self):
a=self.object.jdc.getSdAvantDuBonTypePourTypeDe_Base(self.object.etape,"LASSD")
valeurretour,validite = valeur,1
else :
valeurretour,validite= self.object.evalValeur(valeur)
- #print "evalValeurItem",valeurretour,validite
if validite == 0:
if (type(valeur) == bytes or type(valeur) == str )and self.object.waitTxm():
self.boutonDsMenuBar=False
self.ficIcones=None
self.repIcones=None
- self.differencieSiDefaut=True
+ self.differencieSiDefaut=False
self.typeDeCata='Python'
self.closeParenthese=False
self.closeOptionnel=False
+ self.afficheFactOptionnel=False
self.enleverActionStructures=False
self.enleverPoubellePourCommande=False
self.enleverParametres=False
import six
from six.moves import range
-from PyQt5.QtWidgets import QLineEdit, QLabel, QFileDialog
+from PyQt5.QtWidgets import QLineEdit, QLabel, QFileDialog, QMessageBox
from PyQt5.QtCore import QEvent, Qt, QTimer
from PyQt5.QtGui import QIcon, QPalette
self.numDsLaListe=-1
self.parentTuple=None
self.valeur=None
+ self.editingFinished.connect(self.editFinished)
+ self.textEdited.connect(self.edited)
+ self.parentWidgetPlusieurs = parent
+ self.oldValeur=None
+
+ def edited(self,text):
+ #print ('dans textEdited')
+ self.parentQt.changeUnLineEdit=True
def focusInEvent(self,event):
#print ("dans focusInEvent de LECustom")
self.parentQt.aEuLeFocus=True
- self.aEuLeFocus=True
- self.parentQt.LineEditEnCours=self
self.parentQt.numLineEditEnCours=self.num
self.parentQt.textSelected=self.text()
self.setStyleSheet("border: 2px solid gray")
+ self.oldValeur=self.text()
QLineEdit.focusInEvent(self,event)
def focusOutEvent(self,event):
- #print (self.aEuLeFocus)
+ #print ("dans focusOutEvent de LECustom")
self.setStyleSheet("border: 0px")
if self.dansUnTuple : self.setStyleSheet("background:rgb(235,235,235); border: 0px;")
elif self.num % 2 == 1 : self.setStyleSheet("background:rgb(210,210,210)")
else : self.setStyleSheet("background:rgb(235,235,235)")
- if self.aEuLeFocus:
- self.aEuLeFocus=False
- self.litValeur()
- if self.dansUnTuple : self.parentTuple.getValeur()
+ if (self.oldValeur == self.text()): QLineEdit.focusOutEvent(self,event);return
+ self.litValeur()
QLineEdit.focusOutEvent(self,event)
+ def editFinished(self):
+ #print ("dans editFinished de LECustom")
+ if (self.oldValeur == self.text()): return
+ self.litValeur()
def litValeur(self):
#print ("dans litValeur de LECustom")
- self.aEuLeFocus=False
+ if (self.oldValeur == self.text()): return
+ self.oldValeur = self.text()
val=str(self.text())
- if str(val)=="" or val==None :
- self.valeur=None
- return
- try :
- valeur=eval(val,{})
+
+ # on verifie les ','
+ lval=val.split(',')
+ if len (lval) == 2 :
+ msgBox=QMessageBox()
+ msgBox.setText("separator ',' ")
+ msgBox.setInformativeText("Do you want to enter " + '.'.join(lval) + "?")
+ msgBox.setStandardButtons( QMessageBox.Ok | QMessageBox.Cancel)
+ msgBox.setDefaultButton(QMessageBox.Ok)
+ ret = msgBox.exec_()
+ if ret != 1024 : self.setText("")
+ else : self.setText('.'.join(lval))
+ self.litValeur()
+ if len (lval) > 2 :
+ self.setText("")
+ self.litValeur()
+ if str(val)=="" or val==None : self.valeur=None; return
+ try : valeur=eval(val,{})
except :
try :
d=self.parentQt.parentQt.objSimp.jdc.getContexteAvant(self.parentQt.objSimp. etape)
from .groupe import Groupe
from .gereIcones import FacultatifOuOptionnel
-from PyQt5.QtWidgets import QApplication, QWidget, QSpacerItem, QSizePolicy
+from PyQt5.QtWidgets import QApplication, QWidget, QSpacerItem, QSizePolicy, QRadioButton
from PyQt5.QtGui import QFont, QIcon
from PyQt5.QtCore import QTimer
from PyQt5.QtCore import Qt
from InterfaceQT4.gereListe import GerePlie
from InterfaceQT4.gereListe import LECustom
-dicoLongueur={2:95,3:125,4:154,5:183,6:210,float('inf'):210}
-hauteurMax=253
+dicoLongueur = {2:90,3:100,4:123,5:145,6:160,float('inf'):190}
+hauteurMaxFenetre = 190
class MonWidgetPlusieursBase (Ui_WidgetPlusieursBase,Feuille,GereListe,GerePlie):
def __init__(self,node,monSimpDef,nom,objSimp,parentQt,commande):
- #print "MonWidgetPlusieursBase", nom
- self.inFocusOutEvent=False
- self.nomLine="lineEditVal"
- self.inInit=True
- self.indexDernierLabel=0
- self.numLineEditEnCours=0
- self.listeAffichageWidget=[]
+ self.inFocusOutEvent = False
+ self.changeUnLineEdit = False
+ self.nomLine = "lineEditVal"
+ self.inInit = True # pour l affichage quand on cree le lineEdit
+ self.indexDernierLabel = 0
+ self.numLineEditEnCours = 0
+ self.listeAffichageWidget = []
+ self.politique = PolitiquePlusieurs(node,parentQt)
Feuille.__init__(self,node,monSimpDef,nom,objSimp,parentQt,commande)
GereListe.__init__(self)
self.gereIconePlier()
self.BSelectFichier.clicked.connect(self.selectInFile)
if sys.platform[0:5]!="linux":
- repIcon=self.node.editor.appliEficas.repIcon
- fichier=os.path.join(repIcon, 'arrow_up.png')
- icon = QIcon(fichier)
- self.RBHaut.setIcon(icon)
+ repIcon = self.node.editor.appliEficas.repIcon
+ fichierUp = os.path.join(repIcon, 'arrow_up.png')
+ iconUp = QIcon(fichierUp)
+ self.RBHaut.setIcon(iconUp)
self.RBHaut.setIconSize(QSize(32, 32))
- fichier2=os.path.join(repIcon, 'arrow_down.png')
- icon2 = QIcon(fichier2)
- self.RBBas.setIcon(icon2)
- fichier3=os.path.join(repIcon, 'file-explorer.png')
- icon3 = QIcon(fichier2)
- self.BSelectFichier.setIcon(icon3)
+ fichierDown = os.path.join(repIcon, 'arrow_down.png')
+ iconDown = QIcon(fichierDown)
+ self.RBBas.setIcon(iconArrowDown)
+ fichierExp = os.path.join(repIcon, 'file-explorer.png')
+ iconExp = QIcon(fichierExp)
+ self.BSelectFichier.setIcon(iconExp)
self.BSelectFichier.setIconSize(QSize(32, 32))
- icon=QIcon(self.repIcon+"/MoinsBleu.png")
- self.RBMoins.setIcon(icon)
- icon=QIcon(self.repIcon+"/PlusBleu.png")
- self.RBPlus.setIcon(icon)
- icon=QIcon(self.repIcon+"/verre-loupe-icone-6087-64.png")
- self.RBVoisListe.setIcon(icon)
+
+ iconMoins = QIcon (self.repIcon+"/MoinsBleu.png")
+ self.RBMoins.setIcon(iconMoins)
+ iconPlus = QIcon(self.repIcon+"/PlusBleu.png")
+ self.RBPlus.setIcon(iconPlus)
+ iconLoupe =QIcon(self.repIcon+"/verre-loupe-icone-6087-64.png")
+ self.RBVoisListe.setIcon(iconLoupe)
self.listeValeursCourantes=self.node.item.getListeValeurs()
- if self.monSimpDef.max != "**" and self.monSimpDef.max < 7:
- hauteurMax=dicoLongueur[self.monSimpDef.max]
- else :
- hauteurMax=220
- # if self.monSimpDef.max == self.monSimpDef.min : self.setMaximumHeight(hauteur)
- self.resize(self.width(),hauteurMax)
+ self.vScrollBar = self.scrollArea.verticalScrollBar()
+
+ if self.monSimpDef.max < 7 :
+ hauteurMax = dicoLongueur[self.monSimpDef.max]
+ self.RBVoisListe.close()
+ self.RBMoins.close()
+ self.RBPlus.close()
+ aConstruire = self.monSimpDef.max
+ else :
+ hauteurMax = hauteurMaxFenetre
+ aConstruire = 7
self.setMinimumHeight(hauteurMax)
- self.finCommentaireListe()
+ for i in range(1,aConstruire): self.ajoutLineEdit()
+
+
self.parentQt.commandesLayout.insertWidget(-1,self)
+
self.maCommande.listeAffichageWidget.append(self.lineEditVal1)
- self.AAfficher=self.lineEditVal1
- self.inInit=False
+ self.AAfficher = self.lineEditVal1
+ self.inInit = False
# PNPN a completer __ si tuple le type des tuples sinon le tuple
+ self.finCommentaireListe()
self.monCommentaireLabel.setText(self.finCommentaireListe())
self.scrollArea.leaveEvent = self.leaveEventScrollArea
def setValeurs(self):
- self.vScrollBar = self.scrollArea.verticalScrollBar()
- self.politique=PolitiquePlusieurs(self.node,self.editor)
- # construction du min de valeur a entrer
- if self.monSimpDef.max == "**" : aConstruire=7
- elif self.monSimpDef.max == float('inf'): aConstruire=7
- else : aConstruire=self.monSimpDef.max
-
- for i in range(1,aConstruire):
- self.ajoutLineEdit()
- QApplication.processEvents()
- self.scrollArea.ensureWidgetVisible(self.lineEditVal1)
+ # uniquement appele a l initialisation.
+ # les lineEdit ont deja ete crees
self.listeValeursCourantes=self.node.item.getListeValeurs()
index=1
for valeur in self.listeValeursCourantes :
- val=self.politique.getValeurTexte(valeur)
- nomLineEdit="lineEditVal"+str(index)
+ val = self.politique.getValeurTexte(valeur)
+ nomLineEdit = "lineEditVal"+str(index)
if hasattr(self,nomLineEdit) :
- courant=getattr(self,nomLineEdit)
+ courant = getattr(self,nomLineEdit)
if 'R' in self.objSimp.definition.type and str(val) != repr(val) : courant.setText(repr(val))
- else : courant.setText(str(val))
+ else : courant.setText(str(val))
else :
self.ajoutLineEdit(val)
index=index+1
- # ajout d'une ligne vide ou affichage commentaire
+
if self.indexDernierLabel < self.monSimpDef.max : self.ajoutLineEdit()
- else : self.scrollArea.setToolTip('nb max de valeurs atteint')
- #self.adjustSize()
- #self.vScrollBar.triggerAction(QScrollBar.SliderToMinimum)
def ajoutLineEdit(self,valeur=None,):
return self.finCommentaireListe()
def ajout1Valeur(self,valeur=None):
+ #import traceback
+ #traceback.print_stack()
if valeur == None : return
liste,validite=SaisieValeur.TraiteLEValeur(self,str(valeur))
if validite == 0 : return
def ajoutNValeur(self,liste):
#----------------------------
# attention quand on charge par un fichier, on ne peut pas se contenter d ajouter N fois 1 valeur
- # car alors le temps de verification devient prohibitif reconstructu=ion et verification a
+ # car alors le temps de verification devient prohibitif reconstructution et verification a
# chaque valeur. d ou l ajout de ajoutNTuple a politique plusieurs
def changeValeur(self,changeDePlace=True,oblige=False):
+ #print ('monWidgetPlusieursBase changeValeur')
+ self.changeUnLineEdit = False
donneFocus=None
derniereValeur=None
self.listeValeursCourantes = []
fin=self.indexDernierLabel
- for i in range (1, fin):
- nomLineEdit="lineEditVal"+str(i)
- courant=getattr(self,nomLineEdit)
- valeur=courant.text()
- lval=valeur.split(',')
- if len (lval) > 1 :
- msgBox=QMessageBox()
- msgBox.setText("separator ',' ")
- msgBox.setInformativeText("Do you want to enter " + str (lval) + "?")
- msgBox.setStandardButtons( QMessageBox.Ok | QMessageBox.Cancel)
- msgBox.setDefaultButton(QMessageBox.Ok)
- ret = msgBox.exec_()
- if ret != 1024 :
- courant.setText("")
- return
- courant.setText(lval[0])
- self.ajoutNValeur(lval[1:])
- self.listeValeursCourantes = []
for i in range (1, self.indexDernierLabel+1):
nomLineEdit="lineEditVal"+str(i)
def leaveEventScrollArea(self,event):
- self.changeValeur(changeDePlace=False)
- QScrollArea.leaveEvent(self.scrollArea,event)
+ #print ('monWidgetPlusBase leaveEventScrollArea', self.changeUnLineEdit)
+ if self.changeUnLineEdit : self.changeValeur(changeDePlace=False)
+ QScrollArea.leaveEvent(self.scrollArea,event)
-# Avertissement quand on quitte le widget
def boutonclic(self):
for valeur in self.dict_bouton:
if self.dict_bouton[valeur].isChecked():
- #print "dans boutonclic is checked", valeur, type(valeur)
SaisieValeur.LEvaleurPressed(self,valeur)
self.reaffiche()
def __init__(self,node,parent) :
self.node=node
self.parent=parent
+
def testeUneValeur(self,valeurentree):
commentaire = None
+ #print ('testeUneValeur', valeurentree)
valeur,validite=self.node.item.evalValeur(valeurentree)
if not validite :
commentaire = "impossible d'evaluer : %s " %repr(valeurentree)
def LEvaleurPressed(self,valeur=None):
+ #print('LEvaleurPressed', valeur, type(valeur))
if not hasattr(self, 'inSaisieValeur' ) : self.inSaisieValeur=False
if self.inSaisieValeur : return
self.inSaisieValeur=True
self.setValide()
- #def TraiteLEValeurTuple(self,valeurBrute=None) :
- # listeValeurs=[]
- # if valeurBrute== None :valeurBrute=str(self.LEValeur.text())
- # listeValeursSplit=valeurBrute.split(',')
- # for val in listeValeursSplit :
- # try :
- # valeur=eval(val,{})
- # except :
- # valeur=val
- # listeValeurs.append(valeur)
- # return listeValeurs
def TraiteLEValeur(self,valeurTraitee=None) :
# lit la chaine entree dans le line edit
def longueurDsArbre(self):
longueur=0
for mc in self.mcListe :
- longueur = longueur + longueurDsArbre(mc)
+ longueur = longueur + mc.longueurDsArbre()
return longueur
def blocUtils():
self.validators = self.factories['validator'](validators)
else:
self.validators = validators
+ self.doitSenregistrerComme = None
def affecter_parente(self):
"""
self.cr.fatal(_(u"L'attribut 'position' doit valoir 'local', 'global' "
u"ou 'global_jdc' : %r"), self.position)
- def dumpXSD(self):
- args = self.entites.copy()
- mcs = set()
- for nom, val in list(args.items()):
- if val.label == 'SIMP':
- mcs.add(nom)
- # XXX
- # if val.max != 1 and val.type == 'TXM':
- # print "#CMD", parent, nom
- elif val.label == 'FACT':
- liste=val.dumpXSD()
- mcs.update(liste)
- print (self.nom, mcs)
- return mcs
+# def dumpXSD(self):
+# args = self.entites.copy()
+# mcs = set()
+# for nom, val in list(args.items()):
+# if val.label == 'SIMP':
+# mcs.add(nom)
+# # XXX
+# # if val.max != 1 and val.type == 'TXM':
+# # print "#CMD", parent, nom
+# elif val.label == 'FACT':
+# liste=val.dumpXSD()
+# mcs.update(liste)
+# print (self.nom, mcs)
+# return mcs
from .N_Exception import AsException, InterruptParsingError
from .N_ASSD import ASSD
from .strfunc import getEncoding
-from six.moves import range
MemoryErrorMsg = """MemoryError :
# Dictionnaire pour stocker tous les concepts du JDC (acces rapide par
# le nom)
self.sds_dict = {}
+ self.utilise_un_sds_dict = {}
self.etapes = []
self.index_etapes = {}
self.mc_globaux = {}
self._reserved_kw.difference_update(
['OPER', 'MACRO', 'BLOC', 'SIMP', 'FACT', 'FORM',
'GEOM', 'MCSIMP', 'MCFACT'])
+
+
Attributs :
- val : valeur du mot clé simple
-
- definition
-
- nom
-
- parent
Autres attributs :
self.parent = parent
self.convProto = ConversionFactory('type', typ=self.definition.type)
self.valeur = self.GETVAL(self.val)
- self.objPyxbDeConstruction=objPyxbDeConstruction
+ self.objPyxbDeConstruction = objPyxbDeConstruction
+ self.listeNomsObjsCrees = []
if parent:
- self.jdc = self.parent.jdc
+ self.jdc = self.parent.jdc
if self.jdc : self.cata = self.jdc.cata
- else : self.cata = None
+ else : self.cata = None
self.niveau = self.parent.niveau
- self.etape = self.parent.etape
+ self.etape = self.parent.etape
self.buildObjPyxb()
else:
# Le mot cle simple a été créé sans parent
# est-ce possible ?
print ('je suis dans le else sans parent du build')
- self.jdc = None
- self.cata = None
+ self.jdc = None
+ self.cata = None
self.niveau = None
- self.etape = None
+ self.etape = None
+ if self.definition.doitSenregistrerComme != None :
+ if self.definition.doitSenregistrerComme in list(self.jdc.utilise_un_sds_dict.keys()):
+ self.jdc.utilise_un_sds_dict[self.definition.doitSenregistrerComme].append(self)
+ else :
+ self.jdc.utilise_un_sds_dict[self.definition.doitSenregistrerComme] = [self,]
def GETVAL(self, val):
"""
dico[self.nom] = l
return dico
+
def getMcsWithCo(self, co):
"""
Cette methode retourne l'objet MCSIMP self s'il a le concept co
def longueurDsArbre(self):
return 1
+ def creeObjetClasse(self, classeACreer):
+ # lors de la lecture du .comm, 1ere phase, les objets n existent pas
+ # mais il ne faut pas mettre la valeur des MC utilisant la classe a None
+ # sinon, le siValide ne peut rien faire
+ # c est pourquoi il faut gerer listeDesValeursSupprimees
+ if not hasattr(self,'listeNomsObjsCrees') : self.listeNomsObjsCrees = []
+ newlisteNomsObjsCrees = []
+ listeSupprimees = []
+ change=False
+ for v in self.valeur:
+ if not (v in self.listeNomsObjsCrees):
+ newObj=classeACreer(v)
+ change=True
+ if v in list(self.jdc.sds_dict.keys()):
+ if not isinstance (self.jdc.sds_dict[v], classeACreer):
+ self.valeur.remove(v)
+ continue
+ self.jdc.sds_dict[v] = newObj
+ newObj.sdnom = v
+ newlisteNomsObjsCrees.append(v)
+ for oldv in self.listeNomsObjsCrees :
+ if oldv not in self.valeur :
+ change=True
+ listeSupprimees.append(self.jdc.sds_dict[oldv])
+ self.jdc.sds_dict.pop(oldv)
+ self.listeNomsObjsCrees.remove(oldv)
+ for v in newlisteNomsObjsCrees :
+ self.listeNomsObjsCrees.append(v)
+ if not change : return
+ if classeACreer in list(self.jdc.utilise_un_sds_dict.keys()):
+ for MC in self.jdc.utilise_un_sds_dict[classeACreer] :
+ if isinstance(MC.valeur, str) and MC.valeur in list(self.jdc.sds_dict.keys()):
+ MC.valeur=self.jdc.sds_dict[MC.valeur]
+ if MC.valeur in listeSupprimees:
+ MC.valeur=None
+ MC.state = 'undetermined'
+ MC.isValid()
+
class ErrorObj(OBJECT):
from __future__ import absolute_import
import types
+import Accas
from Noyau import N_ENTITE
from Noyau import N_MCSIMP
def __init__(self, typ,ang="", fr="", statut='f', into=None, intoSug = None,siValide = None, defaut=None,
min=1, max=1, homo=1, position='local',
val_min=float('-inf'), val_max=float('inf'), docu="", validators=None,
- sug=None,fenetreIhm=None):
+ sug=None,fenetreIhm=None, attribut=False):
"""
Un mot-clé simple est caractérisé par les attributs suivants :
- type : cet attribut est obligatoire et indique le type de valeur attendue
- val_max : valeur maximale autorisée
- docu : clef sur de la documentation utilisateur
- sug : valeur suggere
- - fenetreIhm=None
+ - fenetreIhm : si widget particulier
+ - attribut : si projection XSD sur attribut
"""
#print (self)
#import traceback
self.type = typ
else:
self.type = (typ,)
+ for t in (self.type) :
+ if isinstance(t,str):continue
+ if issubclass(t, Accas.UserASSD) : self.doitSenregistrerComme= t
self.fr = fr
self.statut = statut
self.into = into
if self.min == '**' : self.min = float('-inf')
if self.val_min == '**' : self.val_min = float('-inf')
self.fenetreIhm=fenetreIhm
- #self.creeT_SIMP()
+ self.attribut = attribut
def verifCata(self):
"""
"""
return self.class_instance(nom=nom, definition=self, val=val, parent=parent, objPyxbDeConstruction=objPyxbDeConstruction)
-# def creeT_SIMP(self):
-# from Efi2Xsd.readerEfficas import monSIMP
-# from Efi2Xsd.mapDesTypes import dictSIMPEficasXML
-# self.objXML=monSIMP()
-# for nomEficasArg in dictSIMPEficasXML :
-# argu=getattr(self,nomEficasArg)
-# nomXMLarg=dictSIMPEficasXML[nomEficasArg]
-# if not isinstance(nomXMLarg, (list, tuple)) :
-# print(nomXMLarg, argu)
- #if nomEficasArg in listeParamDeTypeTypeAttendu:
- # typeAttendu = self.typ
-#
-# setattr(self.objXML, nomXMLarg, argu)
-# for nomXMLArg in dir(self) :
-# if nomXMLArg in self.dictATraiter :
-# nomEficasArg=self.dictATraiter[nomXMLArg]
-# argu=getattr(self,nomXMLArg)
-# if argu==None : continue
-#
-# if type(nomEficasArg) == types.DictionaryType:
-# for nomXML in list(nomEficasArg.keys()):
-# arguDecoupe=getattr(argu,nomXML)
-# nomEficasDecoupe=nomEficasArg[nomXML]
-# if arguDecoupe == None : continue
-# self.dictArgsEficas[nomEficasDecoupe]=arguDecoupe
-# else :
-# self.dictArgsEficas[nomEficasArg] = argu
-#
-#
-#
-#
-#
self.args = {}
def register(self, T, A):
+ print (T,A)
self.registry[T] = A
def adapt(self, obj):
self.typ = typ
def default(self, obj, typ):
-
err = ""
for type_permis in typ:
if type_permis == 'R':