Salome HOME
pb d accent. on les enleve en français
[tools/eficas.git] / InterfaceQT4 / qtEficas.py
1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2007-2013   EDF R&D
3 #
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License.
8 #
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 # Lesser General Public License for more details.
13 #
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 #
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #
20
21 import os, sys
22
23 from PyQt4.QtGui  import *
24 from PyQt4.QtCore import *
25 from myMain import Ui_Eficas
26 from viewManager import MyTabview
27 from getVersion import getEficasVersion
28
29 from Extensions.i18n import tr
30 from Extensions.eficas_exception import EficasException
31
32 from Editeur import session
33
34
35 class Appli(Ui_Eficas,QMainWindow):
36     """
37     Class implementing the main user interface.
38     """
39     def __init__(self,code=None,salome=0,parent=None,ssCode=None,multi=False,langue='fr',ssIhm=False):
40         """
41         Constructor
42         """
43         QMainWindow.__init__(self,parent)
44         Ui_Eficas.__init__(self)
45         self.setupUi(self)
46         self.myQtab.removeTab(0)
47         self.blEntete= QBoxLayout(0,self.frameEntete)
48         self.blEntete.insertWidget(0,self.toolBar)
49         self.blEntete.insertWidget(0,self.menubar)
50
51
52         version=getEficasVersion()
53         self.VERSION_EFICAS="Eficas QT4 "+version
54         self.salome=salome
55         self.ihm="QT"
56         self.ssIhm=ssIhm
57         self.top = self    #(pour CONFIGURATION)
58         self.QWParent=None #(Pour lancement sans IHM)
59         self.code=code
60         self.indice=0
61         self.dict_reels={}
62         self.recent =  QStringList()
63         self.ficRecents={}
64         self.listeAEnlever=[]
65         self.ListeCode=['Aster','Carmel3D','Cuve2dg','Openturns_Study','Openturns_Wrapper','MAP','ZCracks', 'CarmelCND','MT']
66         self.repIcon=os.path.join( os.path.dirname(os.path.abspath(__file__)),'../Editeur/icons')
67
68         if self.salome:
69           import Accas
70           import eficasSalome
71           Accas.SalomeEntry = eficasSalome.SalomeEntry
72
73         #self.ajoutIcones()
74         self.multi=multi
75         if langue=='fr': self.langue=langue
76         else           : self.langue="ang"
77         if self.multi == False :
78              self.definitCode(code,ssCode)
79              if code==None: return
80
81         eficas_root_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
82
83         self.viewmanager = MyTabview(self)
84         self.recentMenu=self.menuFichier.addMenu(tr('&Recents'))
85         self.connecterSignaux()
86         self.toolBar.addSeparator()
87         if self.code != None : self.construitMenu()
88
89
90         self.setWindowTitle(self.VERSION_EFICAS)
91         self.ouvreFichiers()
92
93
94
95     def definitCode(self,code,ssCode) :
96         self.code=code
97         self.ssCode=ssCode
98         if self.code==None :
99            self.cleanPath()
100            from monChoixCode import MonChoixCode
101            widgetChoix = MonChoixCode(self)
102            ret=widgetChoix.exec_()
103         import sys
104         if self.code == None:return # pour le cancel de la fenetre choix code
105         name='prefs_'+self.code
106         prefsCode=__import__(name)
107
108         self.repIni=prefsCode.repIni
109         if ssCode != None :
110            self.format_fichier= ssCode  #par defaut
111            prefsCode.NAME_SCHEME=ssCode
112         else :
113            self.format_fichier="python" #par defaut
114
115         nameConf='configuration_'+self.code
116         configuration=__import__(nameConf)
117         self.CONFIGURATION = configuration.make_config(self,prefsCode.repIni)
118         self.CONFIGStyle = None
119         if hasattr(configuration,'make_config_style'):
120            self.CONFIGStyle = configuration.make_config_style(self,prefsCode.repIni)
121         if hasattr(prefsCode,'encoding'):
122            import sys
123            reload(sys)
124            sys.setdefaultencoding(prefsCode.encoding)
125
126     def construitMenu(self):
127         self.initPatrons()
128         self.initRecents()
129         self.initAides()
130         for intituleMenu in ("menuTraduction","menuOptions","menuMesh","menuExecution"):
131               if hasattr(self,intituleMenu):
132                  menu=getattr(self,intituleMenu)
133                  menu.setAttribute(Qt.WA_DeleteOnClose)
134                  menu.close()
135                  delattr(self,intituleMenu)
136         for intituleAction in ("actionExecution","actionSaveRun",):
137             if hasattr(self,intituleAction):
138               action=getattr(self,intituleAction)
139               self.toolBar.removeAction(action)
140         if self.code in Appli.__dict__.keys():
141           listeTexte=apply(Appli.__dict__[self.code],(self,))
142
143     def initAides(self):
144         #print "je passe la"
145         repAide=os.path.dirname(os.path.abspath(__file__))
146         fileName='index.html'
147         self.docPath=repAide+"/../Aide"
148         if hasattr(self,'CONFIGURATION') and hasattr(self.CONFIGURATION,'docPath') : self.docPath=self.CONFIGURATION.docPath
149         if hasattr(self,'CONFIGURATION') and hasattr(self.CONFIGURATION,'fileName'):fileName=self.CONFIGURATION.fileName
150         self.fileDoc=os.path.join(self.docPath,fileName)
151         self.actionCode.setText(tr("Aide specifique ")+str(self.code))
152         if not os.path.isfile(self.fileDoc) :
153                self.fileDoc=""
154                self.docPath=""
155                self.actionCode.setEnabled(False)
156                return
157
158         self.actionCode.setEnabled(True)
159         self.menuAide.addAction(self.actionCode)
160
161
162     def ajoutExecution(self):
163         self.menuExecution = self.menubar.addMenu(QApplication.translate("Eficas", "Execution", None, QApplication.UnicodeUTF8))
164         self.actionExecution = QAction(self)
165         icon6 = QIcon(self.repIcon+"/roue.png")
166         self.actionExecution.setIcon(icon6)
167         self.actionExecution.setObjectName("actionExecution")
168         self.menuExecution.addAction(self.actionExecution)
169         if not(self.actionExecution in self.toolBar.actions()):
170            self.toolBar.addAction(self.actionExecution)
171         self.actionExecution.setText(QApplication.translate("Eficas", "Execution ", None, QApplication.UnicodeUTF8))
172         self.connect(self.actionExecution,SIGNAL("activated()"),self.run)
173
174     def ajoutSauveExecution(self):
175         self.actionSaveRun = QAction(self)
176         icon7 = QIcon(self.repIcon+"/export_MAP.png")
177         self.actionSaveRun.setIcon(icon7)
178         self.actionSaveRun.setObjectName("actionSaveRun")
179         self.menuExecution.addAction(self.actionSaveRun)
180         if not(self.actionSaveRun in self.toolBar.actions()):
181            self.toolBar.addAction(self.actionSaveRun)
182         self.actionSaveRun.setText(QApplication.translate("Eficas", "Save Run", None, QApplication.UnicodeUTF8))
183         self.connect(self.actionSaveRun,SIGNAL("activated()"),self.saveRun)
184
185     def griserActionsStructures(self):
186         self.actionCouper.setEnabled(False)
187         self.actionColler.setEnabled(False)
188         self.actionCopier.setEnabled(False)
189         self.actionSupprimer.setEnabled(False)
190
191     def enleverNewInclude(self):
192         self.actionNouvel_Include.setVisible(False)
193
194     def enleverRechercherDsCatalogue(self):
195         self.actionRechercherDsCatalogue.setVisible(False)
196
197     def ZCRACKS(self):
198         self.enleverNewInclude()
199         self.toolBar.addSeparator()
200         self.ajoutExecution()
201
202         self.menuOptions = self.menubar.addMenu("menuOptions")
203         self.menuOptions.addAction(self.actionParametres_Eficas)
204         self.menuOptions.setTitle(tr("Options"))
205
206     def ADAO(self):
207         self.griserActionsStructures()
208         self.enleverNewInclude()
209         self.enleverRechercherDsCatalogue()
210
211     def ASTER(self) :
212         self.menuTraduction = self.menubar.addMenu("menuTraduction")
213         self.menuTraduction.addAction(self.actionTraduitV11V12)
214         self.menuTraduction.addAction(self.actionTraduitV10V11)
215         self.menuTraduction.addAction(self.actionTraduitV9V10)
216         self.menuTraduction.setTitle(tr("Traduction"))
217
218         self.menuFichier.addAction(self.actionSauveLigne)
219
220         self.menuOptions = self.menubar.addMenu("menuOptions")
221         self.menuOptions.addAction(self.actionParametres_Eficas)
222         self.menuOptions.addAction(self.actionLecteur_Pdf)
223         self.menuOptions.setTitle(tr("Options"))
224
225     def CARMEL3D(self):
226         #if self.salome == 0 : return
227         self.enleverNewInclude()
228         self.menuMesh = self.menubar.addMenu("menuMesh")
229         self.menuMesh.setObjectName("Mesh")
230         self.menuMesh.addAction(self.actionChercheGrpMaille)
231         self.griserActionsStructures()
232
233     def CARMELCND(self):
234         self.enleverNewInclude()
235         self.enleverRechercherDsCatalogue()
236         self.ajoutExecution()
237         self.ajoutSauveExecution()
238         self.griserActionsStructures()
239         
240     def MAP(self):
241         self.enleverNewInclude()
242         self.toolBar.addSeparator()
243         self.ajoutExecution()
244         self.ajoutSauveExecution()
245         self.menuOptions = self.menubar.addMenu("menuOptions")
246         self.menuOptions.addAction(self.actionParametres_Eficas)
247         self.menuOptions.setTitle(tr("Options"))
248
249
250     def ChercheGrpMesh(self):
251         Msg,listeGroup=self.ChercheGrpMeshInSalome()
252         if Msg == None :
253            self.viewmanager.handleAjoutGroup(listeGroup)
254         else :
255            print "il faut gerer les erreurs"
256
257     def ChercheGrpMaille(self):
258         Msg,listeGroup=self.ChercheGrpMailleInSalome()
259         if Msg == None :
260            self.viewmanager.handleAjoutGroup(listeGroup)
261         else :
262            print "il faut gerer les erreurs"
263
264     def ChercheGrp(self):
265         #Msg,listeGroup=self.ChercheGrpMailleInSalome()
266         #if Msg == None :
267         #   self.viewmanager.handleAjoutGroup(listeGroup)
268         #else :
269         print "il faut gerer "
270
271
272     def ajoutIcones(self) :
273         # Pour pallier les soucis de repertoire d icone
274         icon = QIcon(self.repIcon+"/New24.png")
275         self.action_Nouveau.setIcon(icon)
276         icon1 = QIcon(self.repIcon+"/Open24.png")
277         self.action_Ouvrir.setIcon(icon1)
278         icon2 = QIcon(self.repIcon+"/Save24.png")
279         self.actionEnregistrer.setIcon(icon2)
280         icon3 = QIcon(self.repIcon+"/Cut24.png")
281         self.actionCouper.setIcon(icon3)
282         icon4 = QIcon(self.repIcon+"/Copy24.png")
283         self.actionCopier.setIcon(icon4)
284         icon5 = QIcon(self.repIcon+"/Paste24.png")
285         self.actionColler.setIcon(icon5)
286         icon6 = QIcon(self.repIcon+"/Delete24.png")
287         self.actionSupprimer.setIcon(icon6)
288
289
290
291     def connecterSignaux(self) :
292         self.connect(self.recentMenu,SIGNAL('aboutToShow()'),self.handleShowRecentMenu)
293
294         self.connect(self.action_Nouveau,SIGNAL("activated()"),self.fileNew)
295         self.connect(self.actionNouvel_Include,SIGNAL("activated()"),self.NewInclude)
296         self.connect(self.action_Ouvrir,SIGNAL("activated()"),self.fileOpen)
297         self.connect(self.actionEnregistrer,SIGNAL("activated()"),self.fileSave)
298         self.connect(self.actionEnregistrer_sous,SIGNAL("activated()"),self.fileSaveAs)
299         self.connect(self.actionFermer,SIGNAL("activated()"),self.fileClose)
300         self.connect(self.actionFermer_tout,SIGNAL("activated()"),self.fileCloseAll)
301         self.connect(self.actionQuitter,SIGNAL("activated()"),self.fileExit)
302
303         self.connect(self.actionEficas,SIGNAL("activated()"),self.aidePPal)
304         self.connect(self.actionVersion,SIGNAL("activated()"),self.version)
305         self.connect(self.actionParametres,SIGNAL("activated()"),self.gestionParam)
306
307         self.connect(self.actionCouper,SIGNAL("activated()"),self.editCut)
308         self.connect(self.actionCopier,SIGNAL("activated()"),self.editCopy)
309         self.connect(self.actionColler,SIGNAL("activated()"),self.editPaste)
310         self.connect(self.actionSupprimer,SIGNAL("activated()"),self.supprimer)
311         self.connect(self.actionRechercher,SIGNAL("activated()"),self.rechercher)
312         self.connect(self.actionDeplier_replier,SIGNAL("activated()"),self.Deplier)
313
314         self.connect(self.actionRapport_de_Validation,SIGNAL("activated()"),self.jdcRapport)
315         self.connect(self.actionFichier_Source,SIGNAL("activated()"),self.jdcFichierSource)
316         self.connect(self.actionFichier_Resultat,SIGNAL("activated()"),self.visuJdcPy)
317
318
319         #self.connect(self.helpIndexAction,SIGNAL("activated()"),self.helpIndex)
320         #self.connect(self.helpContentsAction,SIGNAL("activated()"),self.helpContents)
321
322         # Pour Aster
323         self.actionTraduitV9V10 = QAction(self)
324         self.actionTraduitV9V10.setObjectName("actionTraduitV9V10")
325         self.actionTraduitV9V10.setText(tr("TraduitV9V10"))
326         self.actionTraduitV10V11 = QAction(self)
327         self.actionTraduitV10V11.setObjectName("actionTraduitV10V11")
328         self.actionTraduitV10V11.setText(tr("TraduitV10V11"))
329         self.actionTraduitV11V12 = QAction(self)
330         self.actionTraduitV11V12.setObjectName("actionTraduitV11V12")
331         self.actionTraduitV11V12.setText(tr("TraduitV11V12"))
332         self.actionSauveLigne = QAction(self)
333         self.actionSauveLigne.setText(tr("Sauve Format Ligne"))
334
335         self.connect(self.actionParametres_Eficas,SIGNAL("activated()"),self.optionEditeur)
336         self.connect(self.actionLecteur_Pdf,SIGNAL("activated()"),self.optionPdf)
337         self.connect(self.actionTraduitV9V10,SIGNAL("activated()"),self.traductionV9V10)
338         self.connect(self.actionTraduitV10V11,SIGNAL("activated()"),self.traductionV10V11)
339         self.connect(self.actionTraduitV11V12,SIGNAL("activated()"),self.traductionV11V12)
340         self.connect(self.actionSauveLigne,SIGNAL("activated()"),self.sauveLigne)
341
342
343         # Pour Carmel
344         self.actionChercheGrpMaille = QAction(self)
345         self.actionChercheGrpMaille.setText(tr("Acquiert Groupe Maille"))
346         self.connect(self.actionChercheGrpMaille,SIGNAL("activated()"),self.ChercheGrpMaille)
347
348         # Pour CarmelCND
349         self.actionChercheGrp = QAction(self)
350         self.actionChercheGrp.setText(tr("Accquisition Groupe Maille"))
351         self.connect(self.actionChercheGrp,SIGNAL("activated()"),self.ChercheGrp)
352
353         # Pour Aide
354         self.actionCode = QAction(self)
355         self.actionCode.setText(tr("Specificites Maille"))
356         self.connect(self.actionCode,SIGNAL("activated()"),self.aideCode)
357
358     def Deplier(self):
359         self.viewmanager.handleDeplier()
360
361     def ouvreFichiers(self) :
362     # Ouverture des fichiers de commandes donnes sur la ligne de commande
363         cwd=os.getcwd()
364         self.dir=cwd
365         for study in session.d_env.studies:
366             os.chdir(cwd)
367             d=session.get_unit(study,self)
368             self.viewmanager.handleOpen(fichier=study["comm"],units=d)
369
370
371     def  get_source(self,file):
372     # appele par Editeur/session.py
373         import convert
374         p=convert.plugins['python']()
375         p.readfile(file)
376         texte=p.convert('execnoparseur')
377         return texte
378
379     def initPatrons(self) :
380     # Mise a jour du menu des fichiers recemment ouverts
381         from Editeur import listePatrons
382         if not(self.code in listePatrons.sous_menus.keys()) :
383            if hasattr(self,"menuPatrons"):
384               self.menuPatrons.setAttribute(Qt.WA_DeleteOnClose)
385               self.menuPatrons.close()
386               delattr(self,"menuPatrons")
387            return
388         if (not hasattr(self,"menuPatrons")):
389            self.menuPatrons = QMenu(self.menubar)
390            self.menuPatrons.setObjectName("menuPatrons")
391            self.menubar.addAction(self.menuPatrons.menuAction())
392            self.menuPatrons.setTitle(QApplication.translate("Eficas", "Patrons", None, QApplication.UnicodeUTF8))
393         else :
394            self.menuPatrons.clear()
395         self.listePatrons = listePatrons.listePatrons(self.code)
396         idx = 0
397         for nomSsMenu in self.listePatrons.liste.keys():
398             ssmenu=self.menuPatrons.addMenu(nomSsMenu)
399             for fichier in self.listePatrons.liste[nomSsMenu]:
400                id = ssmenu.addAction(fichier)
401                self.ficPatrons[id]=fichier
402                self.connect(id, SIGNAL('triggered()'),self.handleOpenPatrons)
403             #   self.Patrons.setItemParameter(id,idx)
404                idx=idx+1
405
406     def initRecents(self):
407        self.recent =  QStringList()
408        try :
409        #if 1 :
410            rep=os.path.join(os.environ['HOME'],'.config/Eficas',self.code)
411            monFichier=rep+"/listefichiers_"+self.code
412            index=0
413            f=open(monFichier)
414            while ( index < 9) :
415               ligne=f.readline()
416               if ligne != "" :
417                  l=(ligne.split("\n"))[0]
418                  self.recent.append(l)
419               index=index+1
420        except :
421        #else :
422            pass
423
424        try    : f.close()
425        except : pass
426
427     def addToRecentList(self, fn):
428         """
429         Public slot to add a filename to the list of recently opened files.
430
431         @param fn name of the file to be added
432         """
433         self.recent.removeAll(fn)
434         self.recent.prepend(fn)
435         if len(self.recent) > 9:
436             self.recent = self.recent[:9]
437
438     def sauveRecents(self) :
439        try :
440          rep=self.CONFIGURATION.rep_user
441          monFichier=rep+"/listefichiers_"+self.code
442        except :
443          return
444        try :
445             f=open(monFichier,'w')
446             if len(self.recent) == 0 : return
447             index=0
448             while ( index <  len(self.recent)):
449               ligne=str(self.recent[index])+"\n"
450               f.write(ligne)
451               index=index+1
452        except :
453             pass
454        try :
455             f.close()
456        except :
457             pass
458
459
460
461     def traductionV11V12(self):
462         from gereTraduction import traduction
463         traduction(self.CONFIGURATION.repIni,self.viewmanager,"V11V12")
464
465     def traductionV10V11(self):
466         from gereTraduction import traduction
467         traduction(self.CONFIGURATION.repIni,self.viewmanager,"V10V11")
468
469     def traductionV9V10(self):
470         from gereTraduction import traduction
471         traduction(self.CONFIGURATION.repIni,self.viewmanager,"V9V10")
472
473     def version(self) :
474         from monVisu import DVisu
475         titre = tr("version ")
476         monVisuDialg=DVisu(parent=self,fl=0)
477         monVisuDialg.setWindowTitle(titre)
478         monVisuDialg.TB.setText(self.VERSION_EFICAS +tr(" pour ") + self.code)
479         monVisuDialg.adjustSize()
480         monVisuDialg.show()
481
482     def aidePPal(self) :
483         if self.code==None : return
484         repAide=os.path.dirname(os.path.abspath(__file__))
485         maD=repAide+"/../Aide"
486         try :
487           indexAide=maD+"/fichiers_EFICAS/index.html"
488           cmd="xdg-open "+indexAide
489           os.system(cmd)
490         except:
491           QMessageBox.warning( self,tr( "Aide Indisponible"),tr( "l'aide n est pas installee "))
492
493
494     def aideCode(self) :
495         if self.code==None : return
496         try :
497         #if 1 :
498           cmd="xdg-open "+self.fileDoc
499           os.system(cmd)
500         except:
501         #else:
502           QMessageBox.warning( self,tr( "Aide Indisponible"),tr( "l'aide n est pas installee "))
503
504
505     def optionEditeur(self) :
506         try :
507            name='monOptions_'+self.code
508         except :
509            QMessageBox.critical( self,tr( "Parametrage"),tr( "Veuillez d abord choisir un code"))
510            return
511         try :
512         #if 1:
513            optionCode=__import__(name)
514         except :
515         #else :
516            QMessageBox.critical( self, tr("Parametrage"), tr("Pas de possibilite de personnalisation de la configuration "))
517            return
518         monOption=optionCode.Options(parent=self,modal = 0 ,configuration=self.CONFIGURATION)
519         monOption.show()
520
521     def optionPdf(self) :
522         from monOptionsPdf import OptionPdf
523         monOption=OptionPdf(parent=self,modal = 0 ,configuration=self.CONFIGURATION)
524         monOption.show()
525
526     def handleShowRecentMenu(self):
527         """
528         Private method to set up recent files menu.
529         """
530         self.recentMenu.clear()
531
532         for rp in self.recent:
533             id = self.recentMenu.addAction(rp)
534             self.ficRecents[id]=rp
535             self.connect(id, SIGNAL('triggered()'),self.handleOpenRecent)
536         self.recentMenu.addSeparator()
537         self.recentMenu.addAction(tr('&Effacer'), self.handleClearRecent)
538
539     def handleOpenPatrons(self):
540         idx=self.sender()
541         fichier=self.repIni+"/../Editeur/Patrons/"+self.code+"/"+self.ficPatrons[idx]
542         self.viewmanager.handleOpen(fichier=fichier, patron = 1)
543
544     def handleOpenRecent(self):
545         idx=self.sender()
546         fichier=self.ficRecents[idx]
547         self.viewmanager.handleOpen(fichier=fichier, patron =0 )
548
549     def handleClearRecent(self):
550         self.recent = QStringList()
551         self.sauveRecents()
552
553     def fileNew(self):
554         try:
555             self.viewmanager.newEditor()
556         except EficasException, exc:
557             msg = unicode(exc)
558             if msg != "":
559                 QMessageBox.warning(self, tr(u"Erreur"), msg)
560
561     def fileOpen(self):
562         try:
563             self.viewmanager.handleOpen()
564         except EficasException, exc:
565             msg = unicode(exc)
566             if msg != "":
567                 QMessageBox.warning(self, tr(u"Erreur"), msg)
568
569     def sauveLigne(self):
570         return self.viewmanager.sauveLigneCurrentEditor()
571
572     def fileSave(self):
573         return self.viewmanager.saveCurrentEditor()
574
575     def fileSaveAs(self):
576         return self.viewmanager.saveAsCurrentEditor()
577
578     def fileClose(self):
579         self.viewmanager.handleClose(texte='&Fermer')
580
581     def fileCloseAll(self):
582         self.viewmanager.handleCloseAll(texte='&Fermer')
583
584     def fileExit(self):
585         # On peut sortir sur Abort
586         res=self.viewmanager.handleCloseAll()
587         if (res != 2) :
588             self.close()
589         return res
590
591     def editCopy(self):
592         self.viewmanager.handleEditCopy()
593
594     def editCut(self):
595         self.viewmanager.handleEditCut()
596
597     def editPaste(self):
598         self.viewmanager.handleEditPaste()
599
600     def rechercher(self):
601         self.viewmanager.handleRechercher()
602
603     def run(self):
604         self.viewmanager.run()
605
606     def saveRun(self):
607         self.viewmanager.saveRun()
608
609
610     def supprimer(self):
611         self.viewmanager.handleSupprimer()
612
613     def jdcFichierSource(self):
614         self.viewmanager.handleViewJdcFichierSource()
615
616     def jdcRapport(self):
617         self.viewmanager.handleViewJdcRapport()
618
619     def gestionParam(self):
620         self.viewmanager.handlegestionParam()
621
622     def visuJdcPy(self):
623         self.viewmanager.handleViewJdcPy()
624
625
626     def NewInclude(self):
627         self.viewmanager.newIncludeEditor()
628
629     def cleanPath(self):
630         for pathCode in self.ListeCode:
631             try:
632               aEnlever=os.path.abspath(os.path.join(os.path.dirname(__file__),'..',pathCode))
633               sys.path.remove(aEnlever)
634             except :
635               pass
636         for pathCode in self.listeAEnlever:
637             try:
638               sys.path.remove(aEnlever)
639             except :
640               pass
641
642
643     def closeEvent(self,event):
644       res=self.fileExit()
645       if res==2 : event.ignore()
646
647 if __name__=='__main__':
648
649     # Modules Eficas
650     rep=os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__),'..','ASTER')))
651     sys.path.append(rep)
652     from Aster import prefsCode
653     if hasattr(prefsCode,'encoding'):
654        # Hack pour changer le codage par defaut des strings
655        import sys
656        reload(sys)
657        sys.setdefaultencoding(prefsCode.encoding)
658        del sys.setdefaultencoding
659        # Fin hack
660
661     from Editeur import import_code
662     from Editeur import session
663
664     # Analyse des arguments de la ligne de commande
665     options=session.parse(sys.argv)
666     code=options.code
667
668
669     app = QApplication(sys.argv)
670     #app.setMainWidget(mw) (qt3)
671     Eficas=Appli()
672     Eficas.show()
673
674     #app.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()"))
675     #mw.ouvreFichiers()
676     #mw.show()
677
678     res=app.exec_()
679     sys.exit(res)