from Editeur import Objecttreeitem
from desBaseWidget import Ui_baseWidget
from monViewTexte import ViewText
-from monWidgetParam import MonWidgetParam
+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 = 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
+ 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.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',] : self.afficheCommandesPliees=True
+ 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 )
- self.jdc.aReafficher=False
self.appliEficas.construitMenu()
#--------------------------------#
#-----------------------#
def gestionParam(self):
#-----------------------#
- w = MonWidgetParam( self)
+ w = MonWidgetCreeParam( self)
w.show()
#-----------------------#
#---------------------#
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'):
- print "plie"
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'):
- print "deplie"
self.fenetreCentraleAffichee.node.deplieToutEtReaffiche()
#---------------------#
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")
#---------------------------#
def _newTELEMAC(self):
#---------------------------#
- texte="INITIALIZATION();TIDE_PARAMETERS();INITIAL_STATE();NUMERICAL_PARAMETERS();PHYSICAL_PARAMETERS()"
+ texte="INITIALIZATION();BOUNDARY_CONDITIONS();GENERAL_PARAMETERS();PHYSICAL_PARAMETERS();NUMERICAL_PARAMETERS();"
+ #texte=""
return texte
#---------------------------#