1 # -*- coding: utf-8 -*-
2 # CONFIGURATION MANAGEMENT OF EDF VERSION
3 # ======================================================================
4 # COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG
5 # THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
6 # IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY
7 # THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR
8 # (AT YOUR OPTION) ANY LATER VERSION.
10 # THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
11 # WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
12 # MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
13 # GENERAL PUBLIC LICENSE FOR MORE DETAILS.
15 # YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE
16 # ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER,
17 # 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE.
20 # ======================================================================
22 Ce module contient la classe BUREAU qui gere les JDC ouverts
28 from widgets import askopenfilename,asksaveasfilename
29 from widgets import showinfo,askyesno,showerror
38 from jdcdisplay import JDCDISPLAY
39 from utils import extension_fichier,stripPath,save_in_file
40 from widgets import Fenetre,Ask_Format_Fichier,FenetreSurLigneWarning
41 from fenetre_mc_inconnus import fenetre_mc_inconnus
42 from Ihm import CONNECTOR
43 from Traducteur import traduitV7V8
50 ('Nouveau','newJDC','<Control-n>'),
51 ('Ouvrir','openJDC','<Control-o>'),
52 ('Enregistrer','saveJDC','<Control-e>'),
53 ('Enregistrer sous','saveasJDC','<Control-s>'),
55 ('Fermer','closeJDC','<Control-f>'),
56 ('Quitter','exitEFICAS','<Control-q>'),
60 ('Copier','copy','<Control-c>'),
61 ('Couper','cut','<Control-x>'),
62 ('Coller','paste','<Control-v>'),
66 ('Rapport de validation','visuCRJDC','<Control-r>'),
67 ('Fichier à plat','visu_a_plat','<Control-p>'),
68 ('Fichier .py','visuJDC_py'),
69 ('Fichier source','visu_txt_brut_JDC','<Control-b>'),
70 ('Paramètres Eficas','affichage_fichier_ini'),
71 ('Mots-clés inconnus','mc_inconnus'),
75 ('Traduction v7 en v8','TraduitFichier','<Control-t>','Ctrl+T')
79 ('Aide EFICAS','aideEFICAS'),
84 button_defs = (('New24',"newJDC","Création d'un nouveau fichier",'always'),
85 ('Open24',"openJDC","Ouverture d'un fichier existant",'always'),
86 ('Save24',"saveJDC","Sauvegarde du fichier courant",'always'),
87 ('Fermer24',"closeJDC","Fermeture du fichier courant",'always'),
88 ('Zoom24',"visuJDC","Visualisation du fichier de commandes",'always'),
90 ('Copy24',"copy","Copie l'objet courant",'jdc'),
91 ('Cut24',"cut","Coupe l'objet courant",'jdc'),
92 ('Paste24',"paste","Colle l'objet copié après l'objet courant",'jdc'),
94 ('Delete24',"delete","Supprime l'objet courant",'jdc'),
95 ('Help24',"view_doc","Documentation de l'objet courant",'jdc')
98 menu_defs=prefs.menu_defs['bureau']
102 button_defs=prefs.button_defs['bureau']
106 def __init__(self,appli,parent):
109 if self.appli.test == 0 :
110 splash._splash.configure(text = "Création du bureau")
111 self.nb = Pmw.NoteBook(self.parent,raisecommand=self.selectJDC)
112 self.nb.pack(fill='both',expand=1)
113 self.JDCDisplay_courant=None
115 self.liste_JDCDisplay=[]
116 comploader.charger_composants()
119 self.initialdir = self.appli.CONFIGURATION.initialdir
121 def cree_cataitem(self):
123 On récupère dans l'appli_composant readercata les variables
124 qui servent par la suite pour la création des JDC
126 self.cataitem=self.appli.readercata.cataitem
127 self.cata=self.appli.readercata.cata
128 self.cata_ordonne_dico=self.appli.readercata.cata_ordonne_dico
129 self.code=self.appli.readercata.code
130 self.version_code=self.appli.readercata.version_code
131 self.fic_cata=self.appli.readercata.fic_cata
133 def selectJDC(self,event=None):
135 Cette méthode est appelée chaque fois que l'on sélectionne
136 l'onglet d'un JDC dans le NoteBook des JDC.
137 Elle permet de stocker dans les variable self.JDC et
138 self.JDCDisplay_courant les valeurs concernant le JDC courant
140 if len(self.liste_JDCDisplay) == 0 : return
141 #if self.JDCDisplay_courant : self.JDCDisplay_courant.jdc.unset_context()
142 numero_jdc = self.nb.index(self.nb.getcurselection())
143 self.JDCDisplay_courant.unselect()
144 self.JDCDisplay_courant = self.liste_JDCDisplay[numero_jdc]
145 self.JDC = self.JDCDisplay_courant.jdc
146 self.JDCName = self.JDC.nom
147 self.JDCDisplay_courant.select()
148 #print "selectJDC",numero_jdc,self.JDCDisplay_courant,self.JDCName
151 def newJDC_include(self,event=None):
153 Initialise un nouveau JDC include vierge
155 import Extensions.jdc_include
156 JdC_aux=Extensions.jdc_include.JdC_include
158 self.appli.statusbar.reset_affichage_infos()
160 CONTEXT.unset_current_step()
161 jaux=self.cata[0].JdC(procedure="",appli=self.appli,
162 cata=self.cata,cata_ord_dico=self.cata_ordonne_dico,
163 rep_mat=self.appli.CONFIGURATION.rep_mat,
167 J=JdC_aux(procedure="",appli=self.appli,
168 cata=self.cata,cata_ord_dico=self.cata_ordonne_dico,
170 rep_mat=self.appli.CONFIGURATION.rep_mat,
175 self.ShowJDC(J,self.JDCName)
176 self.appli.toolbar.active_boutons()
179 def newJDC(self,event=None):
181 Initialise un nouveau JDC vierge
183 self.appli.statusbar.reset_affichage_infos()
185 CONTEXT.unset_current_step()
186 J=self.cata[0].JdC(procedure="",appli=self.appli,
187 cata=self.cata,cata_ord_dico=self.cata_ordonne_dico,
188 rep_mat=self.appli.CONFIGURATION.rep_mat,
193 self.ShowJDC(J,self.JDCName)
194 self.appli.toolbar.active_boutons()
197 def ShowJDC(self,JDC,nom,label_onglet=None,JDCDISPLAY=JDCDISPLAY,enregistre="non"):
199 Lance l'affichage du JDC cad création du JDCDisplay
200 Rajoute le JDCDisplay à la liste des JDCDisplay si label_onglet == None cad si on crée
201 bien un nouveau JDCDisplay et non si on remplace (renommage de l'onglet)
204 self.JDCName = self.JDC.nom = nom
205 if label_onglet == None :
206 # On veut un nouvel onglet
207 label_onglet = self.GetLabelJDC()
208 self.nb.add(label_onglet,tab_text = nom,tab_width=20)
212 self.JDCDisplay_courant=JDCDISPLAY(self.JDC,nom,appli=self.appli,parent=self.nb.page(label_onglet))
214 self.liste_JDCDisplay.append(self.JDCDisplay_courant)
215 self.JDCDisplay_courant.modified='n'
216 if enregistre != "non" :
217 self.JDCDisplay_courant.fichier=self.fileName
219 self.initialdir = self.appli.CONFIGURATION.rep_user
220 self.nb.selectpage(label_onglet)
221 self.nb.setnaturalsize()
222 self.nb.bind_all("<Key-Next>",lambda e,s=self:s.selectArbreDown())
223 self.nb.bind_all("<Key-Prior>",lambda e,s=self:s.selectArbreUp())
224 self.nb.bind_all("<Insert>",lambda e,s=self:s.deplieReplieNode())
225 texte = "Jeu de commandes :" + self.JDCName+" ouvert"
226 CONNECTOR.Connect(JDC,"close",self.onClose,(self.JDCDisplay_courant,))
227 self.appli.affiche_infos(texte)
229 def onClose(self,jdcdisplay):
230 #print "onClose",jdcdisplay
231 self.closeJDCDISPLAY(jdcdisplay)
233 def closeJDCDISPLAY(self,jdc):
235 Ferme le jdcdisplay spécifié par l'argument jdc
237 if jdc is self.JDCDisplay_courant:
238 # on ferme le jdcdisplay courant
239 self.closeSelectedJDC()
241 # on ferme un autre jdcdisplay que le courant
242 old_JDCDisplay=self.JDCDisplay_courant
243 old_page=self.nb.getcurselection()
245 self.JDCDisplay_courant=jdc
247 numero_jdc=self.liste_JDCDisplay.index(jdc)
248 self.nb.selectpage(numero_jdc)
251 self.closeSelectedJDC()
252 self.JDCDisplay_courant=old_JDCDisplay
253 self.JDC=old_JDCDisplay.jdc
254 self.nb.selectpage(old_page)
256 def closeJDC (self,event=None) :
258 Ferme le JDC associé au JDCDISPLAY selectionné
260 if self.JDCDisplay_courant :
261 self.JDCDisplay_courant.jdc.close()
263 def closeSelectedJDC (self) :
265 Ferme le JDC courant et détruit l'onglet associé dans le notebook self.nb
267 if self.JDCDisplay_courant.modified == 'o' :
268 message = "Voulez-vous sauvegarder le jeu de commandes "+self.JDC.nom+" courant ?"
269 reponse = askyesno(title="Sauvegarde du jdc courant",
272 test = self.saveJDC()
274 self.appli.affiche_infos("Sauvegarde impossible")
277 CONNECTOR.Disconnect(self.JDCDisplay_courant.jdc,"close",self.onClose,(self.JDCDisplay_courant,))
278 self.JDCDisplay_courant.supprime()
279 self.JDCDisplay_courant.jdc.supprime()
280 self.liste_JDCDisplay.remove(self.JDCDisplay_courant)
281 # Active le mecanisme de selection du notebook (selectJDC)
282 self.nb.delete(self.nb.getcurselection())
285 index = self.nb.index(self.nb.getcurselection())
286 self.JDCDisplay_courant = self.liste_JDCDisplay[index]
287 self.JDC = self.JDCDisplay_courant.jdc
290 self.JDCDisplay_courant = None
291 self.appli.toolbar.inactive_boutons()
293 def visuCRJDC(self,event=None):
294 return self.visuCR(mode='JDC')
296 def visuCR(self,mode):
298 Méthode permettant l'affichage du rapport de validation
301 if not hasattr(self,'JDC') : return
302 if self.JDC == None : return
303 titre="rapport de validation du jeu de commandes courant"
304 cr = self.JDC.report()
305 #self.update_jdc_courant()
307 from Noyau.N_CR import CR
309 cr.debut = "Début rapport de validation du catalogue"
310 cr.fin = "Fin rapport de validation du catalogue"
311 titre="rapport de validation du catalogue"
312 if hasattr(self,'cata_ordonne_cr') :
313 cr.add(self.cata_ordonne_cr)
314 if hasattr(self,'cata_dev_ordonne_cr') :
315 cr.add(self.cata_dev_ordonne_cr)
316 for cata in self.cata:
317 if hasattr(cata,'JdC'):
318 cr.add(cata.JdC.report())
320 self.visu_texte_cr = Fenetre(self.appli,titre=titre,texte=texte_cr)
322 def openJDC(self,event=None,file=None,units=None,enregistre="oui"):
324 Demande à l'utilisateur quel JDC existant il veut ouvrir
326 if self.code == 'ASTER':
327 filetypes = ( ("format "+self.appli.format_fichier.get(), ".com*"),("Tous",'*'))
328 elif self.code == 'HOMARD' :
329 filetypes = ( ("format "+self.appli.format_fichier.get(), ".py"),("Tous",'*'))
331 filetypes = ( ("format "+self.appli.format_fichier.get(), ".py"),)
332 if not hasattr(self,'initialdir'):
333 self.initialdir = self.appli.CONFIGURATION.initialdir
336 file = askopenfilename(title="Ouverture d'un fichier de commandes Aster",
337 defaultextension=".comm",
338 filetypes = filetypes,
339 initialdir = self.initialdir)
342 e=extension_fichier(file)
343 self.JDCName=stripPath(file)
344 self.initialdir = os.path.dirname(os.path.abspath(file))
348 format=self.appli.format_fichier.get()
349 # Il faut convertir le contenu du fichier en fonction du format
350 if convert.plugins.has_key(format):
351 # Le convertisseur existe on l'utilise
352 p=convert.plugins[format]()
354 text=p.convert('exec',self.appli)
355 if not p.cr.estvide():
356 self.appli.affiche_infos("Erreur à la conversion")
358 titre="compte-rendu d'erreurs, EFICAS ne sait pas convertir ce fichier",
359 texte = str(p.cr)).wait()
361 if enregistre == "oui" :
362 self.appli.listeFichiers.aOuvert(file)
364 # Il n'existe pas c'est une erreur
365 self.appli.affiche_infos("Type de fichier non reconnu")
366 showerror("Type de fichier non reconnu","EFICAS ne sait pas ouvrir ce type de fichier")
369 # On se met dans le repertoire ou se trouve le fichier de commandes
370 # pour trouver les eventuels fichiers include ou autres
371 # localises a cote du fichier de commandes
372 os.chdir(self.initialdir)
373 CONTEXT.unset_current_step()
374 J=self.cata[0].JdC(procedure=text,appli=self.appli,
375 cata=self.cata,cata_ord_dico=self.cata_ordonne_dico,
377 rep_mat=self.appli.CONFIGURATION.rep_mat,
379 if units is not None:
380 J.recorded_units=units
381 J.old_recorded_units=units
384 txt_exception = J.cr.get_mess_exception()
386 # des exceptions ont été levées à la création du JDC
387 # --> on affiche les erreurs mais pas le JDC
389 self.appli.affiche_infos("Erreur fatale au chargement de %s" %file)
390 if self.appli.test == 0 :
391 showerror("Erreur fatale au chargement d'un fichier",txt_exception)
393 self.ShowJDC(J,self.JDCName,enregistre=enregistre)
394 self.appli.toolbar.active_boutons()
395 # si le JDC ne contient rien (vide), on retourne ici
396 if len(self.JDC.etapes) == 0 : return
397 # dans le cas où le JDC est invalide, on affiche son CR
398 if not self.JDC.isvalid():
399 self.appli.top.update()
400 self.visuCR(mode='JDC')
403 def deplieReplieNode(self):
404 self.JDCDisplay_courant.tree.tree.deplieReplieNode()
406 def selectArbreDown(self):
407 self.JDCDisplay_courant.tree.tree.canvas.focus_set()
408 self.JDCDisplay_courant.tree.tree.mot_down_force()
410 def selectArbreUp(self):
411 self.JDCDisplay_courant.tree.tree.canvas.focus_set()
412 self.JDCDisplay_courant.tree.tree.mot_up_force()
414 def GetLabelJDC(self,nb_jdc = 'absent'):
416 Retourne le label de l'onglet du NoteBook associé au JDC à afficher
418 if nb_jdc == 'absent':
419 nb_jdc = len(self.nb.pagenames())
421 label_onglet = 'JDC'+`nb_jdc`
422 if label_onglet not in self.nb.pagenames() :
425 return self.GetLabelJDC(nb_jdc)
427 def saveasJDC(self,event=None):
429 Sauvegarde le JDC courant en demandant impérativement à l'utilisateur de
430 donner le nom du fichier de sauvegarde
432 self.saveJDC(echo='oui')
434 def saveJDC(self,echo='non'):
436 Sauvegarde le JDC courant.
437 Retourne 1 si la sauvegarde s'est bien faite, 0 sinon.
439 - Si echo = 'oui' : interactif (l'utilisateur donne le nom sous lequel il
441 - Si echo = 'non' : muet (sauvegarde le JDC dans JDC.procedure)
444 if not hasattr(self,'JDC') : return 0
445 format=self.appli.format_fichier.get()
446 if generator.plugins.has_key(format):
447 # Le generateur existe on l'utilise
448 g=generator.plugins[format]()
449 jdc_formate=g.gener(self.JDC,format='beautifie')
450 if format == 'homard':
451 self.jdc_homard=g.get_homard()
452 if not g.cr.estvide():
453 self.appli.affiche_infos("Erreur à la generation")
454 showerror("Erreur à la generation","EFICAS ne sait pas convertir ce JDC")
457 # Il n'existe pas c'est une erreur
458 self.appli.affiche_infos("Format %s non reconnu" % format)
459 showerror("Format %s non reconnu" % format,"EFICAS ne sait pas convertir le JDC")
461 self.jdc_fini = string.replace(jdc_formate,'\r\n','\n')
463 if echo =='oui' or self.JDCDisplay_courant.fichier == None:
464 ok = self.asknomsauvegardeJDC()
465 elif self.JDCDisplay_courant.fichier != None :
466 # le JDC a déjà un nom : on sauvegarde directement sans demander
467 # un autre nom au développeur
468 if not save_in_file(self.JDCDisplay_courant.fichier,self.jdc_fini,self.appli.dir) :
469 showinfo("Erreur","Problème à la sauvegarde du fichier :" + `self.JDCDisplay_courant.fichier`)
473 if self.appli.format_fichier.get() == 'homard':
474 self.save_homard(self.JDCDisplay_courant.fichier,self.jdc_homard)
475 self.JDCDisplay_courant.stop_modif()
476 self.appli.affiche_infos("sauvegarde de "+`self.JDCDisplay_courant.fichier`+" effectuée")
479 if ok and hasattr( self.appli, 'salome'):
480 # eficas a été lancé à partir deSalome
481 #1)ajout dans l'arbre d'étude du nom du jdc
482 ok, msg = self.appli.addJdcInSalome( self.JDCDisplay_courant.fichier )
485 from panelsSalome import SALOME_UNIQUE_BASE_Panel
486 if len(SALOME_UNIQUE_BASE_Panel.dict_fichier_unite) > 0 :
487 print 'CS_pbruno if len(SALOMchier_unite) > 0 :???????'
488 self.appli.creeConfigTxt( self.appli.CONFIGURATION.initialdir, SALOME_UNIQUE_BASE_Panel.dict_fichier_unite )
490 #3)création/mise à jours d'un maillage dans Salome
491 self.appli.createOrUpdateMesh()
494 def asknomsauvegardeJDC(self):
495 """ Demande à l'utilsateur le nom sous lequel il veut sauvegarder le JDC courant """
496 titre = "Sauvegarde d'un fichier de commandes "+self.code
497 if self.code == 'ASTER':
499 filtyp = ( ("ASTER", ".comm"),)
502 filtyp = ( (self.code, ".py"),)
503 sauvegarde = asksaveasfilename(title=titre,
504 defaultextension=defext,
506 initialdir = self.initialdir)
507 #initialdir = self.appli.CONFIGURATION.initialdir)
508 #initialdir = self.appli.CONFIGURATION.rep_user)
510 if not save_in_file(sauvegarde,self.jdc_fini,None) :
511 showinfo("Erreur","Problème à la sauvegarde du fichier "+`sauvegarde`)
514 if self.appli.format_fichier.get() == 'homard':
515 self.save_homard(sauvegarde,self.jdc_homard)
516 self.JDCDisplay_courant.stop_modif()
517 self.appli.affiche_infos("Sauvegarde effectuée")
518 if sauvegarde != self.JDCDisplay_courant.fichier :
519 # l'utilisateur a sauvegardé le JDC sous un autre nom
520 self.JDCDisplay_courant.fichier = sauvegarde
521 self.JDCName = self.JDC.nom = stripPath(sauvegarde)
522 self.JDC.changefichier(sauvegarde)
528 def changeNomPage(self):
529 """ Change le nom de l'onglet contenant le JDC courant : en fait détruit l'actuel
530 et recrée un autre onglet à la même place avec le bon nom
533 self.JDCDisplay_courant.jdc.nom = nom
534 nom_page = self.nb.getcurselection()
535 num_page = self.nb.index(nom_page)
536 tab = self.nb.tab(num_page)
537 tab.configure(text = nom)
539 def exitEFICAS(self,event=None):
541 Permet de sortir d'EFICAS en demandant à l'utilisateur
542 s'il veut sauvegarder les modifications en cours
544 liste = self.GetListeJDCaSauvegarder()
546 # Certains fichiers n'ont pas été sauvegardés ...
547 if askyesno("Enregistrer modifications","Enregistrer les modifications ?") :
548 test = self.saveall(liste)
551 if askyesno ("Quitter","Voulez-vous vraiment quitter l'application ?") :
552 for JDCDisplay in self.liste_JDCDisplay:
553 JDCDisplay.jdc.supprime()
557 def GetListeJDCaSauvegarder(self) :
558 """ Retourne parmi la liste de tous les JDC ouverts la liste de ceux qui ont été modifiés """
559 if not self.JDCDisplay_courant : return []
560 if len(self.liste_JDCDisplay) == 0 : return l
562 for JDCDisplay in self.liste_JDCDisplay:
563 if JDCDisplay.modified == 'o' :
567 def copy(self,event=None):
569 Lance la copie sur le JDC courant
571 if self.JDCDisplay_courant : self.JDCDisplay_courant.doCopy()
573 def paste(self,event=None):
575 Lance le collage sur le JDC courant
577 if self.JDCDisplay_courant : self.JDCDisplay_courant.doPaste()
579 def cut(self,event=None):
581 Lance le cut sur le JDC courant
583 if self.JDCDisplay_courant: self.JDCDisplay_courant.doCut()
587 Lance la suppression du noeud courant
589 if not self.JDCDisplay_courant : return
590 self.JDCDisplay_courant.init_modif()
591 self.JDCDisplay_courant.node_selected.delete()
593 def visuJDC_py(self,event=None):
595 Méthode permettant d'afficher dans une fenêtre à part l'écho au
596 format python du jdc courant
598 if not hasattr(self,'JDC') : return
599 jdc_fini = self.get_text_JDC('python')
600 if jdc_fini == None : return
602 titre = 'fichier '+ self.JDCName + ' à la syntaxe Python',
607 Méthode permettant d'afficher dans une fenêtre à part l'écho au
608 format .comm ou .py du jdc courant
610 if not hasattr(self,'JDC') : return
611 titre = 'fichier '+ self.JDCName + ' à la syntaxe '+ self.code
612 format=self.appli.format_fichier.get()
613 self.jdc_fini = self.get_text_JDC(format)
614 if self.jdc_fini == None : return
615 self.visu_fichier_cmd = Fenetre(self.appli,titre=titre,texte = self.jdc_fini)
617 def get_text_JDC(self,format):
618 if generator.plugins.has_key(format):
619 # Le generateur existe on l'utilise
620 g=generator.plugins[format]()
621 jdc_formate=g.gener(self.JDC,format='beautifie')
622 if not g.cr.estvide():
623 self.appli.affiche_infos("Erreur à la generation")
624 showerror("Erreur à la generation","EFICAS ne sait pas convertir ce JDC")
629 # Il n'existe pas c'est une erreur
630 self.appli.affiche_infos("Format %s non reconnu" % format)
631 showerror("Format %s non reconnu" % format,"EFICAS ne sait pas convertir le JDC en format %s "% format)
636 Permet d'ouvrir le fichier doc U de la commande au format pdf avec Acrobat Reader
637 - Ne fonctionne pas sous UNIX (chemin d'accès Acrobat Reader)
638 - indication du chemin d'accès aux fichiers pdf à revoir : trop statique
640 if not self.JDCDisplay_courant : return
642 cle_doc = self.JDCDisplay_courant.node_selected.item.get_docu()
643 if cle_doc == None : return
644 cle_doc = string.replace(cle_doc,'.','')
645 cle_doc = string.replace(cle_doc,'-','')
646 commande = self.appli.CONFIGURATION.exec_acrobat
647 nom_fichier = cle_doc+".pdf"
648 fichier = os.path.abspath(os.path.join(self.appli.CONFIGURATION.path_doc,nom_fichier))
650 os.spawnv(os.P_NOWAIT,commande,(commande,fichier,))
651 elif os.name == 'posix':
652 script ="#!/usr/bin/sh \n%s %s&" %(commande,fichier)
653 pid = os.system(script)
654 except AttributeError:
655 traceback.print_exc()
658 def visu_a_plat(self,event=None):
660 Méthode permettant d'afficher dans une fenêtre à part l'écho 'à plat' du jdc courant
662 if not hasattr(self,'JDC') : return
663 titre = 'fichier '+ self.JDCName + ' à plat '
664 self.jdc_fini = self.get_text_JDC('aplat')
665 if self.jdc_fini == None : return
666 self.visu_fichier_cmd = Fenetre(self.appli,titre=titre,texte = self.jdc_fini)
668 def visu_txt_brut_JDC(self,event=None):
670 Méthode permettant d'afficher le jeu de commandes tel qu'il a été passé au JDC
672 if not hasattr(self,'JDC') : return
673 titre = "fichier de commandes utilisateur"
674 #texte = self.JDC.procedure
676 if self.JDCDisplay_courant.fichier == None:
677 self.appli.affiche_infos("Pas de fichier initial")
678 showerror("Impossible de visualiser le fichier initial",
679 "EFICAS ne peut visualiser le fichier initial.\nIl s'agit d'un nouveau JDC")
681 os.chdir(self.appli.dir)
682 f=open(self.JDCDisplay_courant.fichier,'r')
685 self.visu_texte_JDC = Fenetre(self.appli,titre=titre,texte=texte)
687 def affichage_fichier_ini(self):
689 Affichage des valeurs des paramètres relus par Eficas
691 self.appli.CONFIGURATION.affichage_fichier_ini()
693 def saveall(self,liste):
695 Sauvegarde tous les JDC contenus dans liste
698 for JDCDisplay in liste :
699 self.JDCDisplay_courant=JDCDisplay
700 self.JDC = JDCDisplay.jdc
701 test = test * self.saveJDC(echo = 'non')
704 def save_homard(self,nom,texte):
705 file_homard=nom+'.conf_homard'
707 f=open(file_homard,'w')
713 print "Pb a la sauvegarde sous le format homard"
714 if hasattr( self.appli, 'salome'):
716 self.appli.salome.rangeInStudy(file_homard,"_CONF")
718 # ---------------------------------------------------------------------------
719 # Méthodes liées aux mots-clés inconnus
720 # ---------------------------------------------------------------------------
722 def mc_inconnus(self):
723 l_mc = self.JDCDisplay_courant.jdc.get_liste_mc_inconnus()
724 o = fenetre_mc_inconnus(l_mc)
725 l = o.wait_new_list()
726 #print "mc_inconnus_new_list: ",l
727 #CCAR: Il n' y a pas de retour vers le JDC
729 def aideEFICAS(self,event=None):
730 AIDE.go(master=self.parent)
732 def update_jdc_courant(self):
733 self.JDCDisplay_courant.update()
735 def TraduitFichier(self):
736 directory = self.appli.CONFIGURATION.rep_user
737 FichieraTraduire = askopenfilename(title="Nom du Fichier à Traduire",
738 defaultextension=".comm",
739 initialdir = directory
741 if (FichieraTraduire == "" or FichieraTraduire == () ) : return
742 i=FichieraTraduire.rfind(".")
743 Feuille=FichieraTraduire[0:i]
744 FichierTraduit=Feuille+"v8.comm"
745 log=self.initialdir+"/convert.log"
746 os.system("rm -rf "+log)
747 os.system("rm -rf "+FichierTraduit)
749 traduitV7V8.traduc(FichieraTraduire,FichierTraduit,log)
751 Entete="Fichier Traduit : "+FichierTraduit +"\n\n"
752 titre = "conversion de "+ FichieraTraduire
754 if os.stat(log)[6] != 0L :
760 commande="diff "+FichieraTraduire+" "+FichierTraduit+" >/dev/null"
762 if os.system(commande) == 0 :
763 texte_cr = texte_cr + "Pas de difference entre le fichier V7 et le fichier traduit"
767 cptrendu = FenetreSurLigneWarning(self.appli,titre=titre,texte=texte_cr)