from Editeur import Objecttreeitem
from desBaseWidget import Ui_baseWidget
from monViewTexte import ViewText
+from monWidgetCreeParam import MonWidgetCreeParam
import browser
import readercata
def __init__ (self,appli,fichier = None, jdc = None, QWParent=None, units = None, include=0 , vm=None):
#----------------------------------------------------------------------------------------------------------#
+ self.a=0
QtGui.QWidget.__init__(self,None)
self.setupUi(self)
self.monOptionnel=None
self.fenetreCentraleAffichee=None
+ self.dejaDansPlieTout=False
+ self.afficheCommandesPliees = True
self.appliEficas = appli
self.appli = appli #---- attendu par IHM
self.vm = vm
# ces attributs sont mis a jour par definitCode appelee par newEditor
self.code = self.appliEficas.CONFIGURATION.code
- self.affiche_alpha=1
- if self.code in ['MAP','Adao'] :
+ self.mode_nouv_commande=self.appliEficas.CONFIGURATION.mode_nouv_commande
+ self.affiche=self.appliEficas.CONFIGURATION.affiche
+ if self.code in ['MAP','CARMELCND'] : self.afficheCommandesPliees=False
+ if self.code in ['MAP',] :
self.widgetTree.close()
self.widgetTree=None
self.appliEficas.resize(1440,self.appliEficas.height())
self.readercata=self.appliEficas.readercata
if self.readercata.fic_cata == None : return #Sortie Salome
self.titre=self.readercata.titre
+ self.Ordre_Des_Commandes=self.readercata.Ordre_Des_Commandes
self.format = self.appliEficas.format_fichier
self.node_selected = []
self.deplier = True
self.message=''
+ if self.code in ['Adao','MAP'] : self.afficheApresInsert=True
+ else : self.afficheApresInsert=False
+ if self.code in ['TELEMAC',] : self.enteteQTree='premier'
+ else : self.enteteQTree='complet'
+ if self.code in ['Adao','TELEMAC'] : self.affichePlie=True
+ else : self.affichePlie=False
self.Commandes_Ordre_Catalogue =self.readercata.Commandes_Ordre_Catalogue
#------- construction du jdc --------------
jdc_item = None
- self.mode_nouv_commande=self.readercata.mode_nouv_commande
self.nouveau=0
if self.fichier is not None: # fichier jdc fourni
self.fileInfo = QFileInfo(self.fichier)
self.fileInfo.setCaching(0)
if jdc==None :
- try :
+ # try :
+ if 1:
self.jdc = self.readFile(self.fichier)
- except :
+ #except :
+ else :
print "mauvaise lecture"
else :
self.jdc=jdc
if self.jdc:
self.jdc.appli = self
self.jdc.lang = self.appli.langue
+ self.jdc.aReafficher=False
txt_exception = None
if not jdc:
self.jdc.analyse()
jdc_item=Objecttreeitem.make_objecttreeitem( self, "nom", self.jdc )
if (not self.jdc.isvalid()) and (not self.nouveau) and (self.appliEficas.ssIhm == False):
self.viewJdcRapport()
+
+ # if self.code=="TELEMAC" : print "kkkkkkkk"
+
if jdc_item:
self.tree = browser.JDCTree( jdc_item, self )
texte=""
if self.code == "CARMELCND" : texte=self._newJDCCND()
if self.code == "ZCRACKS" : texte=self._newZCRACKS()
+ if self.code == "TELEMAC" : texte=self._newTELEMAC()
# texte=self.newTexteCND
jdc=self.readercata.cata[0].JdC( procedure =texte,
QMessageBox.critical( self, tr("Type de fichier non reconnu"),tr("EFICAS ne sait pas ouvrir ce type de fichier"))
return None
- #----------------------------------------------#
- def _viewText(self, txt, caption = "FILE_VIEWER"):
- #----------------------------------------------#
- w = ViewText( self.QWParent )
- w.setWindowTitle( caption )
- w.setText(txt)
+ #-----------------------------------------------------------------------#
+ def _viewText(self, txt, caption = "FILE_VIEWER",largeur=1200,hauteur=600):
+ #--------------------------------------------------------------------#
+ w = ViewText( self.QWParent,self ,caption,txt,largeur,hauteur)
w.show()
#
+ #-----------------------#
+ def gestionParam(self):
+ #-----------------------#
+ w = MonWidgetCreeParam( self)
+ w.show()
+
#-----------------------#
def viewJdcSource(self):
#-----------------------#
#---------------------#
def handleDeplier(self):
#---------------------#
+ print "je passe ici"
if self.tree == None : return
- self.tree.collapseAll()
+ #self.tree.collapseAll()
if self.deplier :
- self.tree.collapseItem(self.tree.topLevelItem(0))
+ #print "je plie"
+ self.tree.expandItem(self.tree.topLevelItem(0))
self.deplier = False
+ if self.fenetreCentraleAffichee != None :
+ if hasattr(self.fenetreCentraleAffichee.node,'plieToutEtReaffiche'):
+ self.fenetreCentraleAffichee.node.plieToutEtReaffiche()
else:
+ #print "je deplie"
self.tree.expandItem(self.tree.topLevelItem(0))
self.deplier = True
+ if self.fenetreCentraleAffichee != None :
+ if hasattr(self.fenetreCentraleAffichee.node,'deplieToutEtReaffiche'):
+ self.fenetreCentraleAffichee.node.deplieToutEtReaffiche()
#---------------------#
def handleEditCut(self):
self.appliEficas.trUtf8('Wrapper Files (*.xml);;''All Files (*)'))
return fichier
- #----------------------------------#
- def writeFile(self, fn, txt = None):
- #----------------------------------#
+ #--------------------------------------------------#
+ def writeFile(self, fn, txt = None,formatLigne="beautifie"):
+ #--------------------------------------------------#
"""
Public slot to write the text to a file.
"""
fn = unicode(fn)
-
+
if txt == None :
- txt = self.get_text_JDC(self.format)
+ txt = self.get_text_JDC(self.format,formatLigne=formatLigne)
eol = '\n'
if len(txt) >= len(eol):
if txt[-len(eol):] != eol:
.arg(unicode(fn)).arg(str(why)))
return 0
- #-------------------------------------#
- def get_text_JDC(self,format,pourRun=0):
- #-------------------------------------#
+ #-----------------------------------------------------------#
+ def get_text_JDC(self,format,pourRun=0,formatLigne="beautifie"):
+ #-----------------------------------------------------------#
if self.code == "MAP" and not(generator.plugins.has_key(format)): format = "MAP"
if generator.plugins.has_key(format):
# Le generateur existe on l'utilise
self.generator=generator.plugins[format]()
try :
- jdc_formate=self.generator.gener(self.jdc,format='beautifie',config=self.appliEficas.CONFIGURATION)
+ jdc_formate=self.generator.gener(self.jdc,format=formatLigne,config=self.appliEficas.CONFIGURATION)
if pourRun : jdc_formate=self.generator.textePourRun
except ValueError,e:
QMessageBox.critical(self, tr("Erreur a la generation"),str(e))
#else :
pass
- #-----------------------------------------#
- def saveFile(self, path = None, saveas= 0):
- #-----------------------------------------#
+ #-----------------------------------------------------------------#
+ def saveFile(self, path = None, saveas= 0,formatLigne="beautifie"):
+ #-----------------------------------------------------------------#
"""
Public slot to save the text to a file.
fn = unicode(QDir.convertSeparators(fn))
newName = fn
- if not (self.writeFile(fn)): return (0, None)
+ if not (self.writeFile(fn,formatLigne=formatLigne)): return (0, None)
self.fichier = fn
self.modified = False
if self.fileInfo is None or saveas:
return (1, self.fichier)
#
+
+ #----------------------------------------------#
+ def sauveLigneFile(self):
+ #----------------------------------------------#
+ self.modified=1
+ return self.saveFile(formatLigne="Ligne")
+
+
#----------------------------------------------#
def saveFileAs(self, path = None,fileName=None):
#----------------------------------------------#
if fileName != None :
self.fichier = fileName
return self.saveFile()
- return self.saveFile(path,1)
+ return self.saveFile(path,1,"beautifie")
return ligne
+ #---------------------------#
+ def _newTELEMAC(self):
+ #---------------------------#
+ texte="INITIALIZATION();BOUNDARY_CONDITIONS();GENERAL_PARAMETERS();PHYSICAL_PARAMETERS();NUMERICAL_PARAMETERS();"
+ #texte=""
+ return texte
+
+ #---------------------------#
+
#---------------------------#
def _newZCRACKS(self):
#---------------------------#
from acquiertGroupes import getGroupes
erreur,self.listeGroupes,self.nomMaillage,self.dicoCoord=getGroupes(self.fichierMED)
if erreur != "" : print "a traiter"
- #else :
- # from monBoutonSalome import MonBoutonSalome
- # desBoutonSalome = MonBoutonSalome()
- # icon = QIcon()
- # icon = QIcon(self.appli.repIcon+"/image240.png")
- # desBoutonSalome.pushButton.setIcon(icon)
- # desBoutonSalome.setMinimumSize(QtCore.QSize(453, 103))
-
- # self.openfile=QFileDialog(self.appli,caption='Fichier Med',filter=extensions)
- # self.openfile.layout().addWidget(desBoutonSalome)
- # self.connect(desBoutonSalome.pushButton,SIGNAL("clicked()"),self.BoutonSalomePressed)
- # self.connect(self.openfile,SIGNAL("fileSelected(QString)"),self.BoutonFileSelected)
- # r=self.openfile.exec_()
texteComm="COMMENTAIRE(u'Cree - fichier : "+self.fichierMED +" - Nom Maillage : "+self.nomMaillage+"');\nPARAMETRES()\n"
texteSources=""
texteCond=""
texteNoCond=""
texteVcut=""
+ texteZs=""
for groupe in self.listeGroupes :
if groupe[0:8]=='CURRENT_':
texteSources +=groupe[8:]+"=SOURCE("
if groupe[0:5]=='COND_': texteCond +=groupe[5:]+"=CONDUCTEUR();\n"
if groupe[0:7]=='NOCOND_': texteNoCond +=groupe[7:]+"=NOCOND();\n"
if groupe[0:5]=='VCUT_': texteVcut +='V_'+groupe[5:]+"=VCUT();\n"
- texte=texteComm+texteSources+texteCond+texteNoCond+texteVcut
+ if groupe[0:3]=='ZS_': texteZs +=groupe[3:]+"=ZS();\n"
+ texte=texteComm+texteSources+texteCond+texteNoCond+texteVcut+texteZs
self.newTexteCND=texte
self.modified=1
return texte