--- /dev/null
+#! /usr/bin/env python
+# -*- coding:utf-8 -*-
+# /* This file is part of MED.
+# *
+# * COPYRIGHT (C) 1999 - 2013 EDF R&D, CEA/DEN
+# * MED 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 3 of the License, or
+# * (at your option) any later version.
+# *
+# * MED 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 MED. If not, see <http://www.gnu.org/licenses/>.
+# */
+
+
+import sys
+sys.path.append('/home/A96028/Salome/V7_main/tools/install/Medfichier-307-hdf51810/lib/python2.7/site-packages')
+
+from med.medfile import *
+from med.medmesh import *
+from med.medfamily import *
+from med.medfilter import *
+
+
+def getGroupes(filename,debug=0) :
+ listeGroupes=[]
+ maa=""
+
+ dicoNumFam={}
+
+ try :
+ fid = MEDfileOpen(filename,MED_ACC_RDONLY)
+ except :
+ return ("Pb a la lecture du fichier", listeGroupes,maa)
+
+
+ # /* Lecture des infos concernant le premier maillage */
+ maa, sdim, mdim, type, desc, dtunit, sort, nstep, rep, nomcoo,unicoo = MEDmeshInfo(fid, 1)
+ if debug :
+ print "Maillage de nom : |%s| de dimension : %ld , et de type %s\n"%(maa,mdim,type)
+ print "Maillage de nom : |%s| , de dimension : %ld , et de type %s\n"%(maa,mdim,type)
+ print "\t -Dimension de l'espace : %ld\n"%(sdim)
+ print "\t -Description du maillage : %s\n"%(desc)
+ print "\t -Noms des axes : |%s|\n"%(nomcoo)
+ print "\t -Unités des axes : |%s|\n"%(unicoo)
+ print "\t -Type de repère : %s\n"%(rep)
+ print "\t -Nombre d'étape de calcul : %ld\n"%(nstep)
+ print "\t -Unité des dates : |%s|\n"%(dtunit)
+
+ # /* Lecture du nombre de familles */
+ nfam = MEDnFamily(fid,maa)
+ if debug :
+ print "Nombre de familles : %d \n"%(nfam)
+
+ # /* Lecture de chaque famille */
+ for i in xrange(0,nfam):
+
+ # /* Lecture du nombre de groupe */
+ ngro = MEDnFamilyGroup(fid,maa,i+1)
+ if debug :
+ print "Famille %d a %d groupes \n"%(i+1,ngro)
+
+ gro = MEDCHAR(MED_LNAME_SIZE*ngro+1)
+
+ nomfam,numfam,gro = MEDfamilyInfo(fid,maa,i+1,gro)
+ if debug :
+ print "Famille de nom %s et de numero %d : \n"%(nomfam,numfam)
+ print "Attributs : \n"
+
+ for j in xrange(0,ngro):
+ # print "gro = %s\n"%(gro[j*MED_LNAME_SIZE:j*MED_LNAME_SIZE+MED_LNAME_SIZE])
+ groupSplit=gro[j*MED_LNAME_SIZE:j*MED_LNAME_SIZE+MED_LNAME_SIZE]
+ groupeName="".join(groupSplit).split("\x00")[0]
+ if groupeName[0:7]=="CENTRE_" : dicoNumFam[groupeName]=numfam
+ if groupeName not in listeGroupes : listeGroupes.append(groupeName)
+
+
+ # /* Lecture des Numeros de Familles */
+
+ nnoe, chgt, trsf = MEDmeshnEntity(fid,maa,MED_NO_DT,MED_NO_IT, MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE)
+ nufano = MEDINT(nnoe)
+ MEDmeshEntityFamilyNumberRd(fid,maa, MED_NO_DT, MED_NO_IT, MED_NODE,MED_NONE,nufano)
+ dicoNumNode={}
+ for groupe in dicoNumFam.keys():
+ famille=dicoNumFam[groupe]
+ i=0
+ while i < nufano.size():
+ if nufano[i]==famille :
+ dicoNumNode[groupe]=i
+ break
+ i=i+1
+
+
+ print dicoNumNode
+ dicoCoord={}
+# for groupe in dicoNumNode.keys() :
+# for groupe in (1,) :
+# flt=MEDINT(1)
+# flt[0]=2
+# print flt
+# coo1=MEDFLOAT(4)
+# filter=med_filter()
+# print "kk"
+# err=MEDfilterEntityCr( fid, nnoe, 1, sdim, MED_ALL_CONSTITUENT, MED_FULL_INTERLACE, MED_COMPACT_PFLMODE, MED_NO_PROFILE,1 , flt, filter)
+# print err
+# print "kk"
+# MEDmeshNodeCoordinateAdvancedRd(fid, maa, MED_NO_DT, MED_NO_IT, filter, coo1)
+# print "kk"
+# MEDfilterClose(filter)
+# print "kk"
+# print coo1
+ dicoCoord['CENTRE_saxBas']=(0,0,28.5e-3)
+ dicoCoord['CENTRE_saxHaut']=(0,0,31.5e-3)
+
+ MEDfileClose(fid)
+ return ("",listeGroupes,maa,dicoCoord)
+
+if __name__ == "__main__":
+ filename="/home/A96028/Carmel/Pascale/Domaine_Bidouille.med"
+ print getGroupes(filename)
pass
def handleDoubleClickedOnItem(self,item,int):
- item.affichePanneau()
- self.expandItem(item)
+ print "handleDoubleClickedOnItem on ",item
+ print "handleDoubleClickedOnItem on ",item.fenetre
+ if item.fenetre == None :
+ while not (hasattr (item,'getPanel2')) : item=item.treeParent
+ item.affichePanneau()
+ self.expandItem(item)
+ else:
+ print item.fenetre
+ item.fenetre.rendVisible()
def choisitPremier(self,name):
self.editor.layoutJDCCHOIX.removeWidget(self.racine.fenetre)
value = self.appliEficas.trUtf8( str( item.GetText() ) )
mesColonnes=QStringList()
mesColonnes << name << value
- from InterfaceQT4 import compobloc
ajoutAuParentduNoeud=0
+ from InterfaceQT4 import compobloc
while (isinstance(self.treeParent,compobloc.Node)) :
self.treeParent=self.treeParent.treeParent
ajoutAuParentduNoeud=1
parent.removeChild(item)
self.children = []
+ self.childrenComplete = []
sublist = self.item._GetSubList()
ind=0
for item in sublist :
def affichePanneau(self) :
- #print "affichePanneau pour" ,self.item.nom
- self.select()
+ #print "dans affichePanneau"
if self.item.isactif():
panel=self.getPanel2()
else:
self.editor.splitter.setSizes((400,1400,400))
if not(isinstance(self.fenetre,MonChoixCommande)): self.editor.first=False
self.tree.expandItem(self)
- #print "fin affichePanneau"
+ self.select()
def createPopUpMenu(self):
"""
for item in self.tree.selectedItems() :
item.setSelected(0)
- #print "select -----------> " , self.item.GetLabelText()
self.setSelected( True )
self.setExpanded( True )
self.tree.setCurrentItem( self )
## PNPNPN : cas de Map nouvelle version
#if 1 :
try :
- print "1er Try"
+ #print "1er Try"
old_obj = self.item.object.get_child(name.nom,restreint = 'oui')
child=old_obj[-1]
child.affichePanneau()
self.treeParent.build_children()
if self.treeParent.childrenComplete : toselect=self.treeParent.childrenComplete[index]
else: toselect=self.treeParent
- if recalcule :
- jdc.recalcule_etat_correlation()
- toselect.select()
- #toselect.affichePanneau()
+ if recalcule : jdc.recalcule_etat_correlation()
+ from InterfaceQT4 import compojdc
+ # cas ou on detruit dans l arbre sans affichage
+ if self.treeParent.fenetre== None : return
+ if isinstance(self.treeParent,compojdc.Node) :
+ toselect.affichePanneau()
+ else :
+ self.treeParent.fenetre.reaffiche(toselect)
def deleteMultiple(self,liste=()):
"""
return MonMacroPanel(self,parent=self.editor)
def getPanel2(self):
- print "getPanel2 de compoproc"
+ #print "getPanel2 de compoproc"
from monWidgetCommande import MonWidgetCommande
return MonWidgetCommande(self,self.editor,self.item.object)
from Editeur import comploader
from Editeur import Objecttreeitem
from desBaseWidget import Ui_baseWidget
+from monViewTexte import ViewText
import browser
import readercata
-import qtCommun
DictExtensions= {"MAP" : ".map"}
if self.code in ['MAP','Adao'] :
self.widgetTree.close()
self.widgetTree=None
- self.appliEficas.resize(1400,self.appliEficas.height())
+ self.appliEficas.resize(1440,self.appliEficas.height())
else :
self.appliEficas.resize(2000,self.appliEficas.height())
CONTEXT.unset_current_step()
texte=""
- #if self.code == "CARMELCND" : texte=self._newJDCCND()
+ if self.code == "CARMELCND" : texte=self._newJDCCND()
if self.code == "ZCRACKS" : texte=self._newZCRACKS()
# texte=self.newTexteCND
#----------------------------------------------#
def _viewText(self, txt, caption = "FILE_VIEWER"):
#----------------------------------------------#
- w = qtCommun.ViewText( self.QWParent )
+ w = ViewText( self.QWParent )
w.setWindowTitle( caption )
w.setText(txt)
w.show()
#----------------------------------------------#
def _viewTextExecute(self, txt, prefix, suffix):
#----------------------------------------------#
- self.w = qtCommun.ViewText( self.QWParent )
+ self.w = ViewText( self.QWParent )
self.w.setWindowTitle( "execution" )
self.monExe=QProcess(self.w)
pid=self.monExe.pid()
if self.max!=1 : commentaire+="s"
return commentaire
-
-
-
def setZoneInfo(self):
# info=str(self.nom)+' '
# if self.monSimpDef.get_fr() != None and self.monSimpDef.get_fr() != "": info+=self.monSimpDef.get_sug() +" "
def aDetruire(self):
self.node.delete()
- # Cas du mono-commande
- if self.parentQt == None : self.afficheCatalogue()
- else : self.parentQt.reaffiche()
def setValide(self):
if not(hasattr (self,'RBValide')) : return
icon=QIcon(self.repIcon+"/ast-red-ball.png")
self.RBValide.setIcon(icon)
+ def rendVisible(self):
+ self.editor.fenetreCentraleAffichee.scrollAreaCommandes.ensureWidgetVisible(self)
+ self.setFocus()
class ContientIcones:
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from Extensions.i18n import tr
+from monViewTexte import ViewText
+
+# ---------------------- #
+class LECustom(QLineEdit):
+# ---------------------- #
+ def __init__(self,parent,parentQt,i):
+ """
+ Constructor
+ """
+ QMainWindow.__init__(self,parent)
+ self.parentQt=parentQt
+ self.num=i
+
+ def focusInEvent(self,event):
+ self.parentQt.LineEditEnCours=self
+ self.parentQt.NumLineEditEnCours=self.num
+
+
+
# ------------- #
class GereListe:
self.connecterSignaux()
def connecterSignaux(self):
- self.connect(self.RBUp,SIGNAL("clicked()"),self.upPushed)
- self.connect(self.RBDown,SIGNAL("clicked()"),self.downPushed)
- self.connect(self.RBPoubelleVal,SIGNAL("clicked()"),self.poubPushed)
+ self.connect(self.RBHaut,SIGNAL("clicked()"),self.hautPushed)
+ self.connect(self.RBBas,SIGNAL("clicked()"),self.basPushed)
+ self.connect(self.RBMoins,SIGNAL("clicked()"),self.moinsPushed)
+ self.connect(self.RBPlus,SIGNAL("clicked()"),self.plusPushed)
+ self.connect(self.RBVoisListe,SIGNAL("clicked()"),self.voisListePushed)
+ self.connect(self.RBSalome,SIGNAL("clicked()"),self.salomePushed)
+ self.connect(self.RBSalomeVue,SIGNAL("clicked()"),self.salomeVuePushed)
+
+ def hautPushed(self):
+ if self.NumLineEditEnCours == 1 : return
+ else : numEchange=self.NumLineEditEnCours-1
+ self.echange(self.NumLineEditEnCours,numEchange)
+ self.scrollArea.ensureWidgetVisible(self.LineEditEnCours)
+
+
+ def basPushed(self):
+ if self.NumLineEditEnCours == self.indexDernierLabel : return
+ else : numEchange=self.NumLineEditEnCours+1
+ self.echange(self.NumLineEditEnCours,numEchange)
+ self.scrollArea.ensureWidgetVisible(self.LineEditEnCours)
+
+ def echange(self,num1,num2):
+ # on donne le focus au a celui ou on a bouge
+ # par convention le 2
+ nomLineEdit="labelVal"+str(num1)
+ print nomLineEdit
+ courant=getattr(self,nomLineEdit)
+ valeurAGarder=courant.text()
+ nomLineEdit2="labelVal"+str(num2)
+ print nomLineEdit2
+ courant2=getattr(self,nomLineEdit2)
+ courant.setText(courant2.text())
+ courant2.setText(valeurAGarder)
+ self.changeValeur(changeDePlace=False)
+ self.NumLineEditEnCours=num2
+ self.LineEditEnCours=courant2
+
+ def moinsPushed(self):
+ # on supprime le dernier
+ if self.NumLineEditEnCours==self.indexDernierLabel :
+ self.setText("")
+ else :
+ for i in range (self.NumLineEditEnCours, self.indexDernierLabel):
+ aRemonter=i+1
+ nomLineEdit="labelVal"+str(aRemonter)
+ courant=getattr(self,nomLineEdit)
+ valeurARemonter=courant.text()
+ nomLineEdit="labelVal"+str(i)
+ courant=getattr(self,nomLineEdit)
+ courant.setText(valeurARemonter)
+ nomLineEdit="labelVal"+str(self.indexDernierLabel)
+ courant=getattr(self,nomLineEdit)
+ courant.setText("")
+ self.changeValeur(changeDePlace=False)
+
+ def plusPushed(self):
+ self.ajoutLineEdit()
+ if self.NumLineEditEnCours==self.indexDernierLabel : return
+ nomLineEdit="labelVal"+str(self.NumLineEditEnCours+1)
+ courant=getattr(self,nomLineEdit)
+ valeurADescendre=courant.text()
+ courant.setText("")
+ for i in range (self.NumLineEditEnCours+1, self.indexDernierLabel):
+ aDescendre=i+1
+ nomLineEdit="labelVal"+str(aDescendre)
+ courant=getattr(self,nomLineEdit)
+ valeurAGarder=courant.text()
+ courant.setText(valeurADescendre)
+ valeurADescendre=valeurAGarder
+ self.changeValeur(changeDePlace=False)
+ self.scrollArea.ensureWidgetVisible(self.LineEditEnCours)
+
+ def voisListePushed(self):
+ print "voisListePushed"
+ texteValeurs=""
+ for v in self.node.item.GetListeValeurs():
+ texteValeurs+=str(v)+", "
+ entete="Valeurs pour "+self.nom
+ f=ViewText(self,self.editor,entete,texteValeurs[0:-2])
+ f.show()
- def upPushed(self):
- print "upPushed"
+ def salomePushed(self):
+ print "salomePushed"
- def downPushed(self):
- print "downPushed"
+ def salomeVuePushed(self):
+ print "salomeVuePushed"
- def poubPushed(self):
- print "poubPushed"
self.node.setDeplie()
self.reaffiche()
-
from PyQt4 import *
from PyQt4.QtCore import *
from PyQt4.QtGui import *
-from PyQt4.QtCore import *
from Extensions.i18n import tr
# Import des panels
--- /dev/null
+# -*- 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
+#
+# Modules Python
+import string,types,os
+import traceback
+
+from Extensions.i18n import tr
+from PyQt4.QtGui import *
+from PyQt4.QtCore import *
+from desViewTexte import Ui_dView
+
+# ------------------------------- #
+class ViewText(Ui_dView,QDialog):
+# ------------------------------- #
+ """
+ Classe permettant la visualisation de texte
+ """
+ def __init__(self,parent,editor=None,entete=None,texte=None):
+ QDialog.__init__(self,parent)
+ self.editor=editor
+ self.setupUi(self)
+
+ self.resize( QSize(600,600).expandedTo(self.minimumSizeHint()) )
+ self.connect( self.bclose,SIGNAL("clicked()"), self, SLOT("close()") )
+ self.connect( self.bsave,SIGNAL("clicked()"), self.saveFile )
+ if entete != None : self.setWindowTitle (entete)
+ if entete != None : self.setText (texte)
+
+
+ def setText(self, txt ):
+ self.view.setText(txt)
+
+ def saveFile(self):
+ #recuperation du nom du fichier
+ if self.editor != None :
+ dir=self.editor.appliEficas.CONFIGURATION.savedir
+ else:
+ dir='/tmp'
+ fn = QFileDialog.getSaveFileName(None,
+ tr("Sauvegarder le fichier"),
+ dir)
+ if fn.isNull() : return
+ ulfile = os.path.abspath(unicode(fn))
+ if self.editor != None :
+ self.editor.appliEficas.CONFIGURATION.savedir=os.path.split(ulfile)[0]
+ try:
+ f = open(fn, 'wb')
+ f.write(str(self.view.toPlainText()))
+ f.close()
+ return 1
+ except IOError, why:
+ QMessageBox.critical(self, tr("Sauvegarder le fichier"),
+ tr("Le fichier <b>%(v_1)s</b> n'a pu etre sauvegarde. <br>Raison : %(v_2)s", {'v_1': unicode(fn), 'v_2': unicode(why)}))
+ return
+
"""
"""
def __init__(self,node,editor,etape):
- print "MonWidgetCommande ", self
+ #print "MonWidgetCommande ", self
Groupe.__init__(self,node,editor,None,etape.definition,etape,1)
if (etape.get_type_produit()==None): self.LENom.close()
elif (hasattr (etape, 'sdnom')) and etape.sdnom != "sansnom" : self.LENom.setText(etape.sdnom)
def setValide(self):
if not(hasattr (self,'RBValide')) : return
icon = QIcon()
- print self.repIcon
if self.node.item.object.isvalid() :
icon=QIcon(self.repIcon+"/ast-green-ball.png")
else :
from politiquesValidation import PolitiquePlusieurs
from qtSaisie import SaisieValeur
from gereListe import GereListe
+from gereListe import LECustom
-class MonWidgetPlusieursBase (Ui_WidgetPlusieursBase,Feuille):
+class MonWidgetPlusieursBase (Ui_WidgetPlusieursBase,Feuille,GereListe):
def __init__(self,node,monSimpDef,nom,objSimp,parentQt):
- print "MonWidgetPlusieursBase", nom
+ #print "MonWidgetPlusieursBase", nom
self.index=1
self.indexDernierLabel=0
Feuille.__init__(self,node,monSimpDef,nom,objSimp,parentQt)
+ GereListe.__init__(self)
self.listeValeursCourantes=self.node.item.GetListeValeurs()
self.parentQt.commandesLayout.insertWidget(1,self)
if hasattr(self,nomLineEdit) :
self.indexDernierLabel=self.indexDernierLabel-1
return
- nouveauLE = QLineEdit(self.scrollArea)
+ nouveauLE = LECustom(self.scrollArea,self,self.indexDernierLabel)
self.verticalLayoutLE.insertWidget(self.indexDernierLabel-1,nouveauLE)
nouveauLE.setText("")
if self.indexDernierLabel % 2 == 1 : nouveauLE.setStyleSheet("background:rgb(210,210,210)")
- def changeValeur(self):
+ def changeValeur(self,changeDePlace=True):
+ print 'ds chge valeur'
donneFocus=None
derniereValeur=None
self.listeValeursCourantes = []
nomDernierLineEdit="labelVal"+str(self.indexDernierLabel)
dernier=getattr(self,nomDernierLineEdit)
derniereValeur=dernier.text()
- print 'ds chge valeur'
- if donneFocus != None :
- donneFocus.setFocus()
- self.scrollArea.ensureWidgetVisible(donneFocus)
- elif self.indexDernierLabel < self.monSimpDef.max :
+ if changeDePlace:
+ if donneFocus != None :
+ donneFocus.setFocus()
+ self.scrollArea.ensureWidgetVisible(donneFocus)
+ elif self.indexDernierLabel < self.monSimpDef.max :
self.ajoutLineEdit()
- else :
+ if self.indexDernierLabel == self.monSimpDef.max :
self.scrollArea.setToolTip('nb max de valeurs atteint')
self.editor.affiche_infos('nb max de valeurs atteint')
if self.listeValeursCourantes == [] : return
class MonWidgetPlusieursInto (Ui_WidgetPlusieursInto,Feuille):
def __init__(self,node,monSimpDef,nom,objSimp,parentQt):
- print "MonWidgetPlusieursInto", nom
+ #print "MonWidgetPlusieursInto", nom
self.index=1
Feuille.__init__(self,node,monSimpDef,nom,objSimp,parentQt)
self.listeValeursCourantes=self.node.item.GetListeValeurs()
classe servant pour les entrees ne demandant qu un mot clef
"""
def __init__(self,node,parent) :
- print "ds PolitiquePlusieurs"
+ #print "ds PolitiquePlusieurs"
self.node=node
self.parent=parent
- print self.node
- print self.parent
+ #print self.node
+ #print self.parent
def AjoutValeurs(self,listevaleur,index,listecourante):
+++ /dev/null
-# -*- 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
-#
-# Modules Python
-import string,types,os
-import traceback
-
-from PyQt4 import *
-from PyQt4.QtGui import *
-from PyQt4.QtCore import *
-from Extensions.i18n import tr
-
-# Import des panels
-
-# ---------- #
-class QTPanel:
-# ---------- #
- """
- Classe contenant les methodes Qt communes a tous les panneaux droits
- Tous les panneaux Mon...Panel heritent de cette classe
- Gere plus precisement :
- - l affichage de la doc
- - le bouton Suppression (BSupPressed)
- - la mutualisation de l affichage des regles
- """
- def __init__(self,node, parent = None):
- self.editor = parent
- self.node = node
- if hasattr(self,'TWChoix'):
- self.connect(self.TWChoix, SIGNAL("currentChanged(QWidget *)"), self.GestionBALpha)
-
- def keyReleaseEvent(self,event):
- if event.matches(QKeySequence.Copy): self.editor.appliEficas.editCopy()
- if event.matches(QKeySequence.Cut): self.editor.appliEficas.editCut()
- if event.matches(QKeySequence.Paste): self.editor.appliEficas.editPaste()
-
-
- def GestionBALpha(self,fenetre):
- if self.TWChoix.currentIndex()!=0:
- if hasattr(self,'BAlpha'): #pour include materiau
- self.BAlpha.hide()
- else :
- if hasattr(self,'BAlpha'):
- self.BAlpha.setVisible(True)
- self.BuildLBMCPermis()
-
- def BOkPressed(self):
- if hasattr(self, "Commande") and self.TWChoix.currentWidget() is self.Commande:
- self.DefCmd()
- elif hasattr(self, "Concept") and self.TWChoix.currentWidget() is self.Concept:
- self.LENomConceptReturnPressed()
- elif hasattr(self, "MotClef") and self.TWChoix.currentWidget() is self.MotClef:
- if self.LBMCPermis.currentItem() == None : return
- self.DefMC(self.LBMCPermis.currentItem())
- elif hasattr(self, "Formule") and self.TWChoix.currentWidget() is self.Formule:
- self.BOkPressedFormule()
- elif hasattr(self, "Valeur_Parametre") and self.TWChoix.currentWidget() is self.Valeur_Parametre:
- self.BOkParamPressed()
- elif hasattr(self, "maPageOk") and self.TWChoix.currentWidget() is self.maPageOk:
- self.BOkIncPressed()
- else:
- raise Exception("Unknown selected tab %s" % self.TWChoix.tabText(self.TWChoix.currentIndex()))
-
- def BParametresPressed(self):
- liste=self.node.item.get_liste_param_possible()
- from monListeParamPanel import MonListeParamPanel
- MonListeParamPanel(liste=liste,parent=self).show()
-
- def AppelleBuildLBRegles(self):
- listeRegles = self.node.item.get_regles()
- listeNomsEtapes = self.node.item.get_mc_presents()
- self.BuildLBRegles(listeRegles,listeNomsEtapes)
-
-
- def BuildLBRegles(self,listeRegles,listeNomsEtapes):
- self.LBRegles.clear()
- if len(listeRegles) > 0:
- for regle in listeRegles :
- texteRegle=regle.gettext()
- texteMauvais,test = regle.verif(listeNomsEtapes)
- for ligne in texteRegle.split("\n") :
- if ligne == "" :
- self.LBRegles.addItem(ligne)
- continue
- if ligne[0]=="\t" :
- ligne=" "+ligne[1:]
- if test :
- self.LBRegles.addItem(ligne)
- else :
-
- monItem=QListWidgetItem(ligne)
- monItem.setForeground(Qt.red)
- self.LBRegles.addItem(monItem)
-
-
-# ----------------------- #
-class QTPanelTBW1(QTPanel):
-# ----------------------- #
- """
- Classe contenant les methodes necessaires a l onglet "Ajouter Mot-Clef"
- herite de QTPanel # Attention n appelle pas le __init__
- Gere plus precisement :
- """
- def __init__(self,node, parent = None):
- self.editor = parent
- self.node = node
- if not(hasattr(self.node,'alpha')): self.node.alpha = 0
- self.BuildLBMCPermis()
- self.AppelleBuildLBRegles()
- if hasattr(self,'BAlpha'):
- self.connect(self.BAlpha,SIGNAL("clicked()"),self.BAlphaPressed)
-
- def BAlphaPressed (self):
- if self.node.alpha == 0 :
- self.node.alpha=1
- self.BAlpha.setText(tr("Tri Cata"))
- else :
- self.node.alpha=0
- self.BAlpha.setText(tr("Tri Alpha"))
- self.BuildLBMCPermis()
-
-
- def BuildLBMCPermis(self):
- self.LBMCPermis.clear()
- QObject.connect(self.LBMCPermis,SIGNAL("itemDoubleClicked(QListWidgetItem*)"),self.DefMC)
- jdc = self.node.item.get_jdc()
- genea =self.node.item.get_genealogie()
- liste_mc=self.node.item.get_liste_mc_ordonnee(genea,jdc.cata_ordonne_dico)
- if ((len(liste_mc) < 10) and (hasattr(self,'BAlpha'))):
- self.BAlpha.hide()
- if self.node.alpha == 1 : liste_mc.sort()
- for aMc in liste_mc: self.LBMCPermis.addItem( aMc)
- if len(liste_mc) !=0: self.LBMCPermis.setCurrentItem(self.LBMCPermis.item(0))
-
-
- def DefMC(self,item):
- """ On ajoute un mot-cle à la commande : subnode """
- name=str(item.text())
- self.editor.init_modif()
- self.node.append_child(name)
-
-# ---------------------------- #
-class QTPanelTBW2(QTPanel):
-# ---------------------------- #
- """
- Classe contenant les methodes necessaires a l onglet "Nouvelle Commande"
- herite de QTPanel # Attention n appelle pas le __init__
- Gere plus precisement :
- """
-
- def __init__(self,node, parent = None, racine = 0):
- self.editor = parent
- self.node = node
- self.BuildLBNouvCommande()
- self.LEFiltre.setFocus()
- self.NbRecherches = 0
- if racine == 1 :
- self.AppelleBuildLBRegles()
- self.LEFiltre.setFocus()
- else :
- self.connect(self.TWChoix, SIGNAL("currentChanged(QWidget *)"), self.handleCurrentChanged)
-
-
-
- def handleCurrentChanged(self):
- try :
- label=self.TWChoix.tabText(self.TWChoix.currentIndex())
- if label==tr("Nouvelle Commande"):
- self.LEFiltre.setFocus()
- if label==tr("Nommer Concept"):
- self.LENomConcept.setFocus()
- if label==tr("Definition Formule"):
- self.LENomFormule.setFocus()
- if label==tr("Valeur Parametre"):
- self.lineEditNom.setFocus()
- if label==tr("Fichier Include"):
- self.LENomFichier.setFocus()
- if label==tr("Ajouter Mot-Clef"):
- self.LBMCPermis.setCurrentItem(self.LBMCPermis.item(0))
- except :
- pass
-
-
- def BuildLBNouvCommande(self):
- self.LBNouvCommande.clear()
-
- jdc=self.node.item.object.get_jdc_root()
-
- listeGroupes,dictGroupes=jdc.get_groups()
- if "CACHE" in dictGroupes.keys():
- aExclure=dictGroupes["CACHE"]
- else:
- aExclure=()
- if ((self.editor.mode_nouv_commande == "alpha") and (hasattr(self,'RBalpha'))):
- self.RBalpha.setChecked(True)
- self.RBGroupe.setChecked(False)
- listeCmd = jdc.get_liste_cmd()
- for aCmd in listeCmd:
- if aCmd not in aExclure :
- self.LBNouvCommande.addItem( aCmd )
- elif self.editor.mode_nouv_commande== "groupe" :
- self.RBGroupe.setChecked(True)
- self.RBalpha.setChecked(False)
-
- listeGroupes,dictGroupes=jdc.get_groups()
- for grp in listeGroupes:
- if grp == "CACHE":continue
- listeCmd=dictGroupes[grp]
- texte="GROUPE : "+grp
- self.LBNouvCommande.addItem( texte )
- self.LBNouvCommande.addItem( " " )
- for aCmd in listeCmd:
- if aCmd not in aExclure :
- self.LBNouvCommande.addItem( aCmd)
- self.LBNouvCommande.addItem( " " )
- elif self.editor.mode_nouv_commande== "initial" :
- listeCmd = self.editor.Commandes_Ordre_Catalogue
- listeCmd2=jdc.get_liste_cmd()
- if len(listeCmd) != len(listeCmd2):
- listeCmd = listeCmd2
- for aCmd in listeCmd:
- if aCmd not in aExclure :
- self.LBNouvCommande.addItem( aCmd )
- #QObject.connect( self.LBNouvCommande, SIGNAL("itemClicked(QListWidgetItem*)"),self.DefCmd )
- QObject.connect( self.LBNouvCommande, SIGNAL("itemDoubleClicked(QListWidgetItem*)"),self.DefCmd )
-
- def BuildLBNouvCommandChanged(self) :
- if self.RBalpha.isChecked():
- self.editor.mode_nouv_commande="alpha"
- else :
- self.editor.mode_nouv_commande="groupe"
- self.BuildLBNouvCommande()
- self.LEFiltre.setFocus()
-
- def DefCmd(self):
- if self.LBNouvCommande.currentItem()== 0 : return
- if self.LBNouvCommande.currentItem()== None : return
- name=str(self.LBNouvCommande.currentItem().text())
- if name==QString(" "):
- return
- if name.find("GROUPE :")==0 :
- return
- self.editor.init_modif()
- new_node = self.node.append_brother(name,'after')
-
-
- def LEFiltreTextChanged(self):
- self.NbRecherches = 0
- try :
- MonItem=self.LBNouvCommande.findItems(self.LEFiltre.text().toUpper(),Qt.MatchContains)[0]
- self.LBNouvCommande.setCurrentItem(MonItem)
- except :
- pass
-
- def LEfiltreReturnPressed(self):
- self.DefCmd()
-
- def BNextPressed(self):
- self.NbRecherches = self.NbRecherches + 1
- monItem = None
- try :
- MonItem=self.LBNouvCommande.findItems(self.LEFiltre.text().toUpper(),Qt.MatchContains)[self.NbRecherches]
- except :
- try : # ce try sert si la liste est vide
- MonItem=self.LBNouvCommande.findItems(self.LEFiltre.text().toUpper(),Qt.MatchContains)[0]
- self.NbRecherches = 0
- except :
- return
- self.LBNouvCommande.setCurrentItem(MonItem)
-
- def LBNouvCommandeClicked(self):
- name=str(self.LBNouvCommande.currentText())
-
-
-# ---------------------------- #
-class QTPanelTBW3(QTPanel):
-# ---------------------------- #
-
- """
- Classe contenant les methodes necessaires a l onglet "Nommer Concept"
- si non reentrant
- herite de QTPanel # Attention n appelle pas le __init__
- Gere plus precisement :
- """
-
- def __init__(self,node, parent = None):
- self.editor = parent
- self.node = node
- type_sd = self.node.item.get_type_sd_prod()
- nomConcept = self.node.item.GetText()
- self.typeConcept.setText(type_sd)
- self.LENomConcept.setText("")
- self.LENomConcept.setText(nomConcept)
- self.LENomConcept.setFocus()
- if self.node.item.is_reentrant():
- self.makeConceptPage_reentrant()
- else :
- self.listBoxASSD.close()
-
- def makeConceptPage_reentrant(self):
- self.bOk.close()
- self.LENomConcept.close()
- self.Label2.close()
- self.Label3.close()
- self.typeConcept.close()
- self.LENomConcept.close()
- self.Label1.setText(tr("<font size=\"+1\"><p align=\"center\">Structures de donnees a enrichir\n"
-" par l\'operateur courant :</p></font>"))
- listeNomsSD = self.node.item.get_noms_sd_oper_reentrant()
- for aSD in listeNomsSD:
- self.listBoxASSD.addItem( aSD)
- QObject.connect(self.listBoxASSD, SIGNAL("itemDoubleClicked(QListWidgetItem*)" ), self.ClicASSD )
-
-
- def ClicASSD(self):
- if self.listBoxASSD.currentItem()== None : return
- val=self.listBoxASSD.currentItem().text()
- nom=str(val)
- nom = string.strip(nom)
- test,mess = self.node.item.nomme_sd(nom)
- if (test== 0):
- self.editor.affiche_infos(mess,Qt.red)
-
- def LENomConceptReturnPressed(self):
- """
- Nomme le concept SD retourne par l'etape
- """
- nom = str(self.LENomConcept.text())
- nom = string.strip(nom)
- if nom == '' : return # si pas de nom, on ressort sans rien faire
- self.editor.init_modif()
- test,mess = self.node.item.nomme_sd(nom)
- #Notation scientifique
- from politiquesValidation import Validation
- validation=Validation(self.node,self.editor)
- validation.AjoutDsDictReelEtape()
- self.editor.affiche_infos(mess)
-
-# ------------------------------- #
-from desViewTexte import Ui_dView
-class ViewText(Ui_dView,QDialog):
-# ------------------------------- #
- """
- Classe permettant la visualisation de texte
- """
- def __init__(self,parent,editor=None,entete=None):
- QDialog.__init__(self,parent)
- self.editor=editor
- self.setupUi(self)
-
- self.resize( QSize(600,600).expandedTo(self.minimumSizeHint()) )
- self.connect( self.bclose,SIGNAL("clicked()"), self, SLOT("close()") )
- self.connect( self.bsave,SIGNAL("clicked()"), self.saveFile )
- if entete != None : self.setWindowTitle (entete)
-
-
- def setText(self, txt ):
- self.view.setText(txt)
-
- def saveFile(self):
- #recuperation du nom du fichier
- if self.editor != None :
- dir=self.editor.appliEficas.CONFIGURATION.savedir
- else:
- dir='/tmp'
- fn = QFileDialog.getSaveFileName(None,
- tr("Sauvegarder le fichier"),
- dir)
- if fn.isNull() : return
- ulfile = os.path.abspath(unicode(fn))
- if self.editor != None :
- self.editor.appliEficas.CONFIGURATION.savedir=os.path.split(ulfile)[0]
- try:
- f = open(fn, 'wb')
- f.write(str(self.view.toPlainText()))
- f.close()
- return 1
- except IOError, why:
- QMessageBox.critical(self, tr("Sauvegarder le fichier"),
- tr("Le fichier <b>%(v_1)s</b> n'a pu etre sauvegarde. <br>Raison : %(v_2)s", {'v_1': unicode(fn), 'v_2': unicode(why)}))
- return
-
<property name="spacing">
<number>0</number>
</property>
- <property name="margin">
+ <property name="leftMargin">
<number>0</number>
</property>
+ <property name="topMargin">
+ <number>2</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>2</number>
+ </property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<property name="spacing">
<number>0</number>
</property>
- <property name="margin">
+ <property name="leftMargin">
<number>0</number>
</property>
+ <property name="topMargin">
+ <number>2</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>2</number>
+ </property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">