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
37 from jdcdisplay import JDCDISPLAY
38 from utils import extension_fichier,stripPath,save_in_file
39 from widgets import Fenetre,Ask_Format_Fichier
40 from fenetre_mc_inconnus import fenetre_mc_inconnus
41 from Ihm import CONNECTOR
48 ('Nouveau','newJDC','<Control-n>'),
49 ('Ouvrir','openJDC','<Control-o>'),
50 ('Enregistrer','saveJDC','<Control-e>'),
51 ('Enregistrer sous','saveasJDC','<Control-s>'),
53 ('Fermer','closeJDC','<Control-f>'),
54 ('Quitter','exitEFICAS','<Control-q>'),
58 ('Copier','copy','<Control-c>'),
59 ('Couper','cut','<Control-x>'),
60 ('Coller','paste','<Control-v>'),
64 ('Rapport de validation','visuCRJDC','<Control-r>'),
65 ('Fichier à plat','visu_a_plat','<Control-p>'),
66 ('Fichier .py','visuJDC_py'),
67 ('Fichier source','visu_txt_brut_JDC','<Control-b>'),
68 ('Paramètres Eficas','affichage_fichier_ini'),
69 ('Mots-clés inconnus','mc_inconnus'),
73 ('Aide EFICAS','aideEFICAS'),
78 button_defs = (('New24',"newJDC","Création d'un nouveau fichier",'always'),
79 ('Open24',"openJDC","Ouverture d'un fichier existant",'always'),
80 ('Save24',"saveJDC","Sauvegarde du fichier courant",'always'),
81 ('Fermer24',"closeJDC","Fermeture du fichier courant",'always'),
82 ('Zoom24',"visuJDC","Visualisation du fichier de commandes",'always'),
84 ('Copy24',"copy","Copie l'objet courant",'jdc'),
85 ('Cut24',"cut","Coupe l'objet courant",'jdc'),
86 ('Paste24',"paste","Colle l'objet copié après l'objet courant",'jdc'),
88 ('Delete24',"delete","Supprime l'objet courant",'jdc'),
89 ('Help24',"view_doc","Documentation de l'objet courant",'jdc')
92 menu_defs=prefs.menu_defs['bureau']
96 button_defs=prefs.button_defs['bureau']
100 def __init__(self,appli,parent):
103 if self.appli.test == 0 :
104 splash._splash.configure(text = "Création du bureau")
105 self.nb = Pmw.NoteBook(self.parent,raisecommand=self.selectJDC)
106 self.nb.pack(fill='both',expand=1)
107 self.JDCDisplay_courant=None
109 self.liste_JDCDisplay=[]
110 comploader.charger_composants()
113 self.initialdir = self.appli.CONFIGURATION.initialdir
115 def cree_cataitem(self):
117 On récupère dans l'appli_composant readercata les variables
118 qui servent par la suite pour la création des JDC
120 self.cataitem=self.appli.readercata.cataitem
121 self.cata=self.appli.readercata.cata
122 self.cata_ordonne_dico=self.appli.readercata.cata_ordonne_dico
123 self.code=self.appli.readercata.code
124 self.version_code=self.appli.readercata.version_code
125 self.fic_cata=self.appli.readercata.fic_cata
127 def selectJDC(self,event=None):
129 Cette méthode est appelée chaque fois que l'on sélectionne
130 l'onglet d'un JDC dans le NoteBook des JDC.
131 Elle permet de stocker dans les variable self.JDC et
132 self.JDCDisplay_courant les valeurs concernant le JDC courant
134 if len(self.liste_JDCDisplay) == 0 : return
135 #if self.JDCDisplay_courant : self.JDCDisplay_courant.jdc.unset_context()
136 numero_jdc = self.nb.index(self.nb.getcurselection())
137 self.JDCDisplay_courant.unselect()
138 self.JDCDisplay_courant = self.liste_JDCDisplay[numero_jdc]
139 self.JDC = self.JDCDisplay_courant.jdc
140 self.JDCName = self.JDC.nom
141 self.JDCDisplay_courant.select()
142 #print "selectJDC",numero_jdc,self.JDCDisplay_courant,self.JDCName
145 def newJDC_include(self,event=None):
147 Initialise un nouveau JDC vierge
149 import Extensions.jdc_include
150 JdC_aux=Extensions.jdc_include.JdC_include
152 self.appli.statusbar.reset_affichage_infos()
154 CONTEXT.unset_current_step()
155 jaux=self.cata[0].JdC(procedure="",appli=self.appli,
156 cata=self.cata,cata_ord_dico=self.cata_ordonne_dico,
157 rep_mat=self.appli.CONFIGURATION.rep_mat,
161 J=JdC_aux(procedure="",appli=self.appli,
162 cata=self.cata,cata_ord_dico=self.cata_ordonne_dico,
164 rep_mat=self.appli.CONFIGURATION.rep_mat,
169 self.ShowJDC(J,self.JDCName)
170 self.appli.toolbar.active_boutons()
172 def newJDC(self,event=None):
174 Initialise un nouveau JDC include vierge
176 self.appli.statusbar.reset_affichage_infos()
178 CONTEXT.unset_current_step()
179 J=self.cata[0].JdC(procedure="",appli=self.appli,
180 cata=self.cata,cata_ord_dico=self.cata_ordonne_dico,
181 rep_mat=self.appli.CONFIGURATION.rep_mat,
186 self.ShowJDC(J,self.JDCName)
187 self.appli.toolbar.active_boutons()
189 def ShowJDC(self,JDC,nom,label_onglet=None,JDCDISPLAY=JDCDISPLAY,enregistre="non"):
191 Lance l'affichage du JDC cad création du JDCDisplay
192 Rajoute le JDCDisplay à la liste des JDCDisplay si label_onglet == None cad si on crée
193 bien un nouveau JDCDisplay et non si on remplace (renommage de l'onglet)
196 self.JDCName = self.JDC.nom = nom
197 if label_onglet == None :
198 # On veut un nouvel onglet
199 label_onglet = self.GetLabelJDC()
200 self.nb.add(label_onglet,tab_text = nom,tab_width=20)
204 self.JDCDisplay_courant=JDCDISPLAY(self.JDC,nom,appli=self.appli,parent=self.nb.page(label_onglet))
206 self.liste_JDCDisplay.append(self.JDCDisplay_courant)
207 self.JDCDisplay_courant.modified='n'
208 if enregistre != "non" :
209 self.JDCDisplay_courant.fichier=self.fileName
211 self.initialdir = self.appli.CONFIGURATION.rep_user
212 self.nb.selectpage(label_onglet)
213 self.nb.setnaturalsize()
214 texte = "Jeu de commandes :" + self.JDCName+" ouvert"
215 CONNECTOR.Connect(JDC,"close",self.onClose,(self.JDCDisplay_courant,))
216 self.appli.affiche_infos(texte)
218 def onClose(self,jdcdisplay):
219 #print "onClose",jdcdisplay
220 self.closeJDCDISPLAY(jdcdisplay)
222 def closeJDCDISPLAY(self,jdc):
224 Ferme le jdcdisplay spécifié par l'argument jdc
226 if jdc is self.JDCDisplay_courant:
227 # on ferme le jdcdisplay courant
228 self.closeSelectedJDC()
230 # on ferme un autre jdcdisplay que le courant
231 old_JDCDisplay=self.JDCDisplay_courant
232 old_page=self.nb.getcurselection()
234 self.JDCDisplay_courant=jdc
236 numero_jdc=self.liste_JDCDisplay.index(jdc)
237 self.nb.selectpage(numero_jdc)
240 self.closeSelectedJDC()
241 self.JDCDisplay_courant=old_JDCDisplay
242 self.JDC=old_JDCDisplay.jdc
243 self.nb.selectpage(old_page)
245 def closeJDC (self,event=None) :
247 Ferme le JDC associé au JDCDISPLAY selectionné
249 if self.JDCDisplay_courant :
250 self.JDCDisplay_courant.jdc.close()
252 def closeSelectedJDC (self) :
254 Ferme le JDC courant et détruit l'onglet associé dans le notebook self.nb
256 if self.JDCDisplay_courant.modified == 'o' :
257 message = "Voulez-vous sauvegarder le jeu de commandes "+self.JDC.nom+" courant ?"
258 reponse = askyesno(title="Sauvegarde du jdc courant",
261 test = self.saveJDC()
263 self.appli.affiche_infos("Sauvegarde impossible")
266 CONNECTOR.Disconnect(self.JDCDisplay_courant.jdc,"close",self.onClose,(self.JDCDisplay_courant,))
267 self.JDCDisplay_courant.supprime()
268 self.JDCDisplay_courant.jdc.supprime()
269 self.liste_JDCDisplay.remove(self.JDCDisplay_courant)
270 # Active le mecanisme de selection du notebook (selectJDC)
271 self.nb.delete(self.nb.getcurselection())
274 index = self.nb.index(self.nb.getcurselection())
275 self.JDCDisplay_courant = self.liste_JDCDisplay[index]
276 self.JDC = self.JDCDisplay_courant.jdc
279 self.JDCDisplay_courant = None
280 self.appli.toolbar.inactive_boutons()
282 def visuCRJDC(self,event=None):
283 return self.visuCR(mode='JDC')
285 def visuCR(self,mode):
287 Méthode permettant l'affichage du rapport de validation
290 if not hasattr(self,'JDC') : return
291 titre="rapport de validation du jeu de commandes courant"
292 cr = self.JDC.report()
293 #self.update_jdc_courant()
295 from Noyau.N_CR import CR
297 cr.debut = "Début rapport de validation du catalogue"
298 cr.fin = "Fin rapport de validation du catalogue"
299 titre="rapport de validation du catalogue"
300 if hasattr(self,'cata_ordonne_cr') :
301 cr.add(self.cata_ordonne_cr)
302 if hasattr(self,'cata_dev_ordonne_cr') :
303 cr.add(self.cata_dev_ordonne_cr)
304 for cata in self.cata:
305 if hasattr(cata,'JdC'):
306 cr.add(cata.JdC.report())
308 self.visu_texte_cr = Fenetre(self.appli,titre=titre,texte=texte_cr)
310 def openJDC(self,event=None,file=None,units=None,enregistre="oui"):
312 Demande à l'utilisateur quel JDC existant il veut ouvrir
314 if self.code == 'ASTER':
315 filetypes = ( ("format "+self.appli.format_fichier.get(), ".com*"),("Tous",'*'))
316 elif self.code == 'HOMARD' :
317 filetypes = ( ("format "+self.appli.format_fichier.get(), ".py"),("Tous",'*'))
319 filetypes = ( ("format "+self.appli.format_fichier.get(), ".py"),)
320 if not hasattr(self,'initialdir'):
321 self.initialdir = self.appli.CONFIGURATION.initialdir
324 file = askopenfilename(title="Ouverture d'un fichier de commandes Aster",
325 defaultextension=".comm",
326 filetypes = filetypes,
327 initialdir = self.initialdir)
330 e=extension_fichier(file)
331 self.JDCName=stripPath(file)
332 self.initialdir = os.path.dirname(os.path.abspath(file))
336 format=self.appli.format_fichier.get()
337 # Il faut convertir le contenu du fichier en fonction du format
338 if convert.plugins.has_key(format):
339 # Le convertisseur existe on l'utilise
340 p=convert.plugins[format]()
342 text=p.convert('exec',self.appli)
343 if not p.cr.estvide():
344 self.appli.affiche_infos("Erreur à la conversion")
346 titre="compte-rendu d'erreurs, EFICAS ne sait pas convertir ce fichier",
347 texte = str(p.cr)).wait()
349 if enregistre == "oui" :
350 self.appli.listeFichiers.aOuvert(file)
352 # Il n'existe pas c'est une erreur
353 self.appli.affiche_infos("Type de fichier non reconnu")
354 showerror("Type de fichier non reconnu","EFICAS ne sait pas ouvrir ce type de fichier")
357 # On se met dans le repertoire ou se trouve le fichier de commandes
358 # pour trouver les eventuels fichiers include ou autres
359 # localises a cote du fichier de commandes
360 os.chdir(self.initialdir)
361 CONTEXT.unset_current_step()
362 J=self.cata[0].JdC(procedure=text,appli=self.appli,
363 cata=self.cata,cata_ord_dico=self.cata_ordonne_dico,
365 rep_mat=self.appli.CONFIGURATION.rep_mat,
367 if units is not None:
368 J.recorded_units=units
369 J.old_recorded_units=units
372 txt_exception = J.cr.get_mess_exception()
374 # des exceptions ont été levées à la création du JDC
375 # --> on affiche les erreurs mais pas le JDC
377 self.appli.affiche_infos("Erreur fatale au chargement de %s" %file)
378 if self.appli.test == 0 :
379 showerror("Erreur fatale au chargement d'un fichier",txt_exception)
381 self.ShowJDC(J,self.JDCName,enregistre=enregistre)
382 self.appli.toolbar.active_boutons()
383 # si le JDC ne contient rien (vide), on retourne ici
384 if len(self.JDC.etapes) == 0 : return
385 # dans le cas où le JDC est invalide, on affiche son CR
386 if not self.JDC.isvalid():
387 self.appli.top.update()
388 self.visuCR(mode='JDC')
389 # On a ouvert un Patron
390 self.nb.bind_all("<F1>",lambda e,s=self:s.selectArbreDown())
391 self.nb.bind_all("<F2>",lambda e,s=self:s.selectArbreUp())
393 def selectArbreDown(self):
394 self.JDCDisplay_courant.tree.tree.canvas.focus_set()
395 self.JDCDisplay_courant.tree.tree.mot_down_force()
397 def selectArbreUp(self):
398 self.JDCDisplay_courant.tree.tree.canvas.focus_set()
399 self.JDCDisplay_courant.tree.tree.mot_up_force()
401 def GetLabelJDC(self,nb_jdc = 'absent'):
403 Retourne le label de l'onglet du NoteBook associé au JDC à afficher
405 if nb_jdc == 'absent':
406 nb_jdc = len(self.nb.pagenames())
408 label_onglet = 'JDC'+`nb_jdc`
409 if label_onglet not in self.nb.pagenames() :
412 return self.GetLabelJDC(nb_jdc)
414 def saveasJDC(self,event=None):
416 Sauvegarde le JDC courant en demandant impérativement à l'utilisateur de
417 donner le nom du fichier de sauvegarde
419 self.saveJDC(echo='oui')
421 def saveJDC(self,echo='non'):
423 Sauvegarde le JDC courant.
424 Retourne 1 si la sauvegarde s'est bien faite, 0 sinon.
425 Si echo = 'oui' : interactif (l'utilisateur donne le nom sous lequel il
427 Si echo = 'non' : muet (sauvegarde le JDC dans JDC.procedure)
429 if not hasattr(self,'JDC') : return 0
430 format=self.appli.format_fichier.get()
431 if generator.plugins.has_key(format):
432 # Le generateur existe on l'utilise
433 g=generator.plugins[format]()
434 jdc_formate=g.gener(self.JDC,format='beautifie')
435 if format == 'homard':
436 self.jdc_homard=g.get_homard()
437 if not g.cr.estvide():
438 self.appli.affiche_infos("Erreur à la generation")
439 showerror("Erreur à la generation","EFICAS ne sait pas convertir ce JDC")
442 # Il n'existe pas c'est une erreur
443 self.appli.affiche_infos("Format %s non reconnu" % format)
444 showerror("Format %s non reconnu" % format,"EFICAS ne sait pas convertir le JDC")
446 self.jdc_fini = string.replace(jdc_formate,'\r\n','\n')
448 if echo =='oui' or self.JDCDisplay_courant.fichier == None:
449 return self.asknomsauvegardeJDC()
450 elif self.JDCDisplay_courant.fichier != None :
452 # Pour sauvegarde dans l etude si lancement depuis salome
453 if self.appli.salome != 0:
455 self.appli.salome.rangeInStudy(self.JDCDisplay_courant.fichier)
456 from panelsSalome import SALOME_UNIQUE_BASE_Panel
457 if len(SALOME_UNIQUE_BASE_Panel.dict_fichier_unite) > 0 :
458 self.appli.salome.creeConfigTxt(self.appli.CONFIGURATION.initialdir,SALOME_UNIQUE_BASE_Panel.dict_fichier_unite)
462 MyCLinit=eficasCL.CLinit()
468 #PN Fin Ajout --> Salome
469 # le JDC a déjà un nom : on sauvegarde directement sans demander
470 # un autre nom au développeur
471 if not save_in_file(self.JDCDisplay_courant.fichier,self.jdc_fini,self.appli.dir) :
472 showinfo("Erreur","Problème à la sauvegarde du fichier :" + `self.JDCDisplay_courant.fichier`)
475 if self.appli.format_fichier.get() == 'homard':
476 self.save_homard(self.JDCDisplay_courant.fichier,self.jdc_homard)
477 self.JDCDisplay_courant.stop_modif()
478 self.appli.affiche_infos("sauvegarde de "+`self.JDCDisplay_courant.fichier`+" effectuée")
481 def asknomsauvegardeJDC(self):
482 """ Demande à l'utilsateur le nom sous lequel il veut sauvegarder le JDC courant """
483 titre = "Sauvegarde d'un fichier de commandes "+self.code
484 if self.code == 'ASTER':
486 filtyp = ( ("ASTER", ".comm"),)
489 filtyp = ( (self.code, ".py"),)
490 sauvegarde = asksaveasfilename(title=titre,
491 defaultextension=defext,
493 initialdir = self.initialdir)
494 #initialdir = self.appli.CONFIGURATION.initialdir)
495 #initialdir = self.appli.CONFIGURATION.rep_user)
497 # PN ajout --> Salome
498 # Pour sauvegarde dans l etude si lancement depuis salome
499 if self.appli.salome != 0:
501 self.appli.salome.rangeInStudy(sauvegarde)
502 from panelsSalome import SALOME_UNIQUE_BASE_Panel
503 if len(SALOME_UNIQUE_BASE_Panel.dict_fichier_unite) > 0 :
504 self.appli.salome.creeConfigTxt(self.appli.CONFIGURATION.initialdir,SALOME_UNIQUE_BASE_Panel.dict_fichier_unite)
508 MyCLinit=eficasCL.CLinit()
514 # PN fin ajout --> Salome
515 if not save_in_file(sauvegarde,self.jdc_fini,None) :
516 showinfo("Erreur","Problème à la sauvegarde du fichier "+`sauvegarde`)
519 if self.appli.format_fichier.get() == 'homard':
520 self.save_homard(sauvegarde,self.jdc_homard)
521 self.JDCDisplay_courant.stop_modif()
522 self.appli.affiche_infos("Sauvegarde effectuée")
523 if sauvegarde != self.JDCDisplay_courant.fichier :
524 # l'utilisateur a sauvegardé le JDC sous un autre nom
525 self.JDCDisplay_courant.fichier = sauvegarde
526 self.JDCName = self.JDC.nom = stripPath(sauvegarde)
527 self.JDC.changefichier(sauvegarde)
533 def changeNomPage(self):
534 """ Change le nom de l'onglet contenant le JDC courant : en fait détruit l'actuel
535 et recrée un autre onglet à la même place avec le bon nom
538 self.JDCDisplay_courant.jdc.nom = nom
539 nom_page = self.nb.getcurselection()
540 num_page = self.nb.index(nom_page)
541 tab = self.nb.tab(num_page)
542 tab.configure(text = nom)
544 def exitEFICAS(self,event=None):
546 Permet de sortir d'EFICAS en demandant à l'utilisateur
547 s'il veut sauvegarder les modifications en cours
549 liste = self.GetListeJDCaSauvegarder()
551 # Certains fichiers n'ont pas été sauvegardés ...
552 if askyesno("Enregistrer modifications","Enregistrer les modifications ?") :
553 test = self.saveall(liste)
556 if askyesno ("Quitter","Voulez-vous vraiment quitter l'application ?") :
557 for JDCDisplay in self.liste_JDCDisplay:
558 JDCDisplay.jdc.supprime()
562 def GetListeJDCaSauvegarder(self) :
563 """ Retourne parmi la liste de tous les JDC ouverts la liste de ceux qui ont été modifiés """
564 if not self.JDCDisplay_courant : return []
565 if len(self.liste_JDCDisplay) == 0 : return l
567 for JDCDisplay in self.liste_JDCDisplay:
568 if JDCDisplay.modified == 'o' :
572 def copy(self,event=None):
574 Lance la copie sur le JDC courant
576 if self.JDCDisplay_courant : self.JDCDisplay_courant.doCopy()
578 def paste(self,event=None):
580 Lance le collage sur le JDC courant
582 if self.JDCDisplay_courant : self.JDCDisplay_courant.doPaste()
584 def cut(self,event=None):
586 Lance le cut sur le JDC courant
588 if self.JDCDisplay_courant: self.JDCDisplay_courant.doCut()
592 Lance la suppression du noeud courant
594 if not self.JDCDisplay_courant : return
595 self.JDCDisplay_courant.init_modif()
596 self.JDCDisplay_courant.node_selected.delete()
598 def visuJDC_py(self,event=None):
600 Méthode permettant d'afficher dans une fenêtre à part l'écho au
601 format python du jdc courant
603 if not hasattr(self,'JDC') : return
604 jdc_fini = self.get_text_JDC('python')
605 if jdc_fini == None : return
607 titre = 'fichier '+ self.JDCName + ' à la syntaxe Python',
612 Méthode permettant d'afficher dans une fenêtre à part l'écho au
613 format .comm ou .py du jdc courant
615 if not hasattr(self,'JDC') : return
616 titre = 'fichier '+ self.JDCName + ' à la syntaxe '+ self.code
617 format=self.appli.format_fichier.get()
618 self.jdc_fini = self.get_text_JDC(format)
619 if self.jdc_fini == None : return
620 self.visu_fichier_cmd = Fenetre(self.appli,titre=titre,texte = self.jdc_fini)
622 def get_text_JDC(self,format):
623 if generator.plugins.has_key(format):
624 # Le generateur existe on l'utilise
625 g=generator.plugins[format]()
626 jdc_formate=g.gener(self.JDC,format='beautifie')
627 if not g.cr.estvide():
628 self.appli.affiche_infos("Erreur à la generation")
629 showerror("Erreur à la generation","EFICAS ne sait pas convertir ce JDC")
634 # Il n'existe pas c'est une erreur
635 self.appli.affiche_infos("Format %s non reconnu" % format)
636 showerror("Format %s non reconnu" % format,"EFICAS ne sait pas convertir le JDC en format %s "% format)
641 Permet d'ouvrir le fichier doc U de la commande au format pdf avec Acrobat Reader
642 - Ne fonctionne pas sous UNIX (chemin d'accès Acrobat Reader)
643 - indication du chemin d'accès aux fichiers pdf à revoir : trop statique
645 if not self.JDCDisplay_courant : return
647 cle_doc = self.JDCDisplay_courant.node_selected.item.get_docu()
648 if cle_doc == None : return
649 cle_doc = string.replace(cle_doc,'.','')
650 cle_doc = string.replace(cle_doc,'-','')
651 commande = self.appli.CONFIGURATION.exec_acrobat
652 nom_fichier = cle_doc+".pdf"
653 fichier = os.path.abspath(os.path.join(self.appli.CONFIGURATION.path_doc,nom_fichier))
655 os.spawnv(os.P_NOWAIT,commande,(commande,fichier,))
656 elif os.name == 'posix':
657 script ="#!/usr/bin/sh \n%s %s&" %(commande,fichier)
658 pid = os.system(script)
659 except AttributeError:
660 traceback.print_exc()
663 def visu_a_plat(self,event=None):
665 Méthode permettant d'afficher dans une fenêtre à part l'écho 'à plat' du jdc courant
667 if not hasattr(self,'JDC') : return
668 titre = 'fichier '+ self.JDCName + ' à plat '
669 self.jdc_fini = self.get_text_JDC('aplat')
670 if self.jdc_fini == None : return
671 self.visu_fichier_cmd = Fenetre(self.appli,titre=titre,texte = self.jdc_fini)
673 def visu_txt_brut_JDC(self,event=None):
675 Méthode permettant d'afficher le jeu de commandes tel qu'il a été passé au JDC
677 if not hasattr(self,'JDC') : return
678 titre = "fichier de commandes utilisateur"
679 #texte = self.JDC.procedure
681 if self.JDCDisplay_courant.fichier == None:
682 self.appli.affiche_infos("Pas de fichier initial")
683 showerror("Impossible de visualiser le fichier initial",
684 "EFICAS ne peut visualiser le fichier initial.\nIl s'agit d'un nouveau JDC")
686 f=open(self.JDCDisplay_courant.fichier,'r')
689 self.visu_texte_JDC = Fenetre(self.appli,titre=titre,texte=texte)
691 def affichage_fichier_ini(self):
693 Affichage des valeurs des paramètres relus par Eficas
695 self.appli.CONFIGURATION.affichage_fichier_ini()
697 def saveall(self,liste):
699 Sauvegarde tous les JDC contenus dans liste
702 for JDCDisplay in liste :
703 self.JDCDisplay_courant=JDCDisplay
704 self.JDC = JDCDisplay.jdc
705 test = test * self.saveJDC(echo = 'non')
708 def save_homard(self,nom,texte):
709 file_homard=nom+'.conf_homard'
711 f=open(file_homard,'w')
717 print "Pb a la sauvegarde sous le format homard"
718 if self.appli.salome != 0:
720 self.appli.salome.rangeInStudy(file_homard,"_CONF")
722 # ---------------------------------------------------------------------------
723 # Méthodes liées aux mots-clés inconnus
724 # ---------------------------------------------------------------------------
726 def mc_inconnus(self):
727 l_mc = self.JDCDisplay_courant.jdc.get_liste_mc_inconnus()
728 o = fenetre_mc_inconnus(l_mc)
729 l = o.wait_new_list()
730 #print "mc_inconnus_new_list: ",l
731 #CCAR: Il n' y a pas de retour vers le JDC
733 def aideEFICAS(self,event=None):
734 AIDE.go(master=self.parent)
736 def update_jdc_courant(self):
737 self.JDCDisplay_courant.update()