Salome HOME
Pour Traduction Carmel et Parametres
[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.actionTraduitV7V8)
214         self.menuTraduction.addAction(self.actionTraduitV8V9)
215         self.menuTraduction.addAction(self.actionTraduitV9V10)
216         self.menuTraduction.setTitle(tr("Traduction"))
217
218         self.menuOptions = self.menubar.addMenu("menuOptions")
219         self.menuOptions.addAction(self.actionParametres_Eficas)
220         self.menuOptions.addAction(self.actionLecteur_Pdf)
221         self.menuOptions.setTitle(tr("Options"))
222
223     def CARMEL3D(self):
224         #if self.salome == 0 : return
225         self.enleverNewInclude()
226         self.menuMesh = self.menubar.addMenu("menuMesh")
227         self.menuMesh.setObjectName("Mesh")
228         self.menuMesh.addAction(self.actionChercheGrpMaille)
229         self.griserActionsStructures()
230
231     def CARMELCND(self):
232         self.enleverNewInclude()
233         self.enleverRechercherDsCatalogue()
234         self.ajoutExecution()
235         self.ajoutSauveExecution()
236         self.griserActionsStructures()
237         
238     def MAP(self):
239         self.enleverNewInclude()
240         self.toolBar.addSeparator()
241         self.ajoutExecution()
242         self.ajoutSauveExecution()
243         self.menuOptions = self.menubar.addMenu("menuOptions")
244         self.menuOptions.addAction(self.actionParametres_Eficas)
245         self.menuOptions.setTitle(tr("Options"))
246
247
248     def ChercheGrpMesh(self):
249         Msg,listeGroup=self.ChercheGrpMeshInSalome()
250         if Msg == None :
251            self.viewmanager.handleAjoutGroup(listeGroup)
252         else :
253            print "il faut gerer les erreurs"
254
255     def ChercheGrpMaille(self):
256         Msg,listeGroup=self.ChercheGrpMailleInSalome()
257         if Msg == None :
258            self.viewmanager.handleAjoutGroup(listeGroup)
259         else :
260            print "il faut gerer les erreurs"
261
262     def ChercheGrp(self):
263         #Msg,listeGroup=self.ChercheGrpMailleInSalome()
264         #if Msg == None :
265         #   self.viewmanager.handleAjoutGroup(listeGroup)
266         #else :
267         print "il faut gerer "
268
269
270     def ajoutIcones(self) :
271         # Pour pallier les soucis de repertoire d icone
272         icon = QIcon(self.repIcon+"/New24.png")
273         self.action_Nouveau.setIcon(icon)
274         icon1 = QIcon(self.repIcon+"/Open24.png")
275         self.action_Ouvrir.setIcon(icon1)
276         icon2 = QIcon(self.repIcon+"/Save24.png")
277         self.actionEnregistrer.setIcon(icon2)
278         icon3 = QIcon(self.repIcon+"/Cut24.png")
279         self.actionCouper.setIcon(icon3)
280         icon4 = QIcon(self.repIcon+"/Copy24.png")
281         self.actionCopier.setIcon(icon4)
282         icon5 = QIcon(self.repIcon+"/Paste24.png")
283         self.actionColler.setIcon(icon5)
284         icon6 = QIcon(self.repIcon+"/Delete24.png")
285         self.actionSupprimer.setIcon(icon6)
286
287
288
289     def connecterSignaux(self) :
290         self.connect(self.recentMenu,SIGNAL('aboutToShow()'),self.handleShowRecentMenu)
291
292         self.connect(self.action_Nouveau,SIGNAL("activated()"),self.fileNew)
293         self.connect(self.actionNouvel_Include,SIGNAL("activated()"),self.NewInclude)
294         self.connect(self.action_Ouvrir,SIGNAL("activated()"),self.fileOpen)
295         self.connect(self.actionEnregistrer,SIGNAL("activated()"),self.fileSave)
296         self.connect(self.actionEnregistrer_sous,SIGNAL("activated()"),self.fileSaveAs)
297         self.connect(self.actionFermer,SIGNAL("activated()"),self.fileClose)
298         self.connect(self.actionFermer_tout,SIGNAL("activated()"),self.fileCloseAll)
299         self.connect(self.actionQuitter,SIGNAL("activated()"),self.fileExit)
300
301         self.connect(self.actionEficas,SIGNAL("activated()"),self.aidePPal)
302         self.connect(self.actionVersion,SIGNAL("activated()"),self.version)
303         self.connect(self.actionParametres,SIGNAL("activated()"),self.gestionParam)
304
305         self.connect(self.actionCouper,SIGNAL("activated()"),self.editCut)
306         self.connect(self.actionCopier,SIGNAL("activated()"),self.editCopy)
307         self.connect(self.actionColler,SIGNAL("activated()"),self.editPaste)
308         self.connect(self.actionSupprimer,SIGNAL("activated()"),self.supprimer)
309         self.connect(self.actionRechercher,SIGNAL("activated()"),self.rechercher)
310         self.connect(self.actionDeplier_replier,SIGNAL("activated()"),self.Deplier)
311
312         self.connect(self.actionRapport_de_Validation,SIGNAL("activated()"),self.jdcRapport)
313         self.connect(self.actionFichier_Source,SIGNAL("activated()"),self.jdcFichierSource)
314         self.connect(self.actionFichier_Resultat,SIGNAL("activated()"),self.visuJdcPy)
315
316
317         #self.connect(self.helpIndexAction,SIGNAL("activated()"),self.helpIndex)
318         #self.connect(self.helpContentsAction,SIGNAL("activated()"),self.helpContents)
319
320         # Pour Aster
321         self.actionTraduitV7V8 = QAction(self)
322         self.actionTraduitV7V8.setObjectName("actionTraduitV7V8")
323         self.actionTraduitV8V9 = QAction(self)
324         self.actionTraduitV8V9.setObjectName("actionTraduitV8V9")
325         self.actionTraduitV9V10 = QAction(self)
326         self.actionTraduitV9V10.setObjectName("actionTraduitV9V10")
327         self.actionTraduitV7V8.setText(tr("TraduitV7V8"))
328         self.actionTraduitV8V9.setText(tr("TraduitV8V9"))
329         self.actionTraduitV9V10.setText(tr("TraduitV9V10"))
330         self.connect(self.actionParametres_Eficas,SIGNAL("activated()"),self.optionEditeur)
331         self.connect(self.actionLecteur_Pdf,SIGNAL("activated()"),self.optionPdf)
332         self.connect(self.actionTraduitV7V8,SIGNAL("activated()"),self.traductionV7V8)
333         self.connect(self.actionTraduitV8V9,SIGNAL("activated()"),self.traductionV8V9)
334         self.connect(self.actionTraduitV9V10,SIGNAL("activated()"),self.traductionV9V10)
335
336         # Pour Carmel
337         self.actionChercheGrpMaille = QAction(self)
338         self.actionChercheGrpMaille.setText(tr("Acquiert Groupe Maille"))
339         self.connect(self.actionChercheGrpMaille,SIGNAL("activated()"),self.ChercheGrpMaille)
340
341         # Pour CarmelCND
342         self.actionChercheGrp = QAction(self)
343         self.actionChercheGrp.setText(tr("Accquisition Groupe Maille"))
344         self.connect(self.actionChercheGrp,SIGNAL("activated()"),self.ChercheGrp)
345
346         # Pour Aide
347         self.actionCode = QAction(self)
348         self.actionCode.setText(tr("Specificites Maille"))
349         self.connect(self.actionCode,SIGNAL("activated()"),self.aideCode)
350
351     def Deplier(self):
352         self.viewmanager.handleDeplier()
353
354     def ouvreFichiers(self) :
355     # Ouverture des fichiers de commandes donnes sur la ligne de commande
356         cwd=os.getcwd()
357         self.dir=cwd
358         for study in session.d_env.studies:
359             os.chdir(cwd)
360             d=session.get_unit(study,self)
361             self.viewmanager.handleOpen(fichier=study["comm"],units=d)
362
363
364     def  get_source(self,file):
365     # appele par Editeur/session.py
366         import convert
367         p=convert.plugins['python']()
368         p.readfile(file)
369         texte=p.convert('execnoparseur')
370         return texte
371
372     def initPatrons(self) :
373     # Mise a jour du menu des fichiers recemment ouverts
374         from Editeur import listePatrons
375         if not(self.code in listePatrons.sous_menus.keys()) :
376            if hasattr(self,"menuPatrons"):
377               self.menuPatrons.setAttribute(Qt.WA_DeleteOnClose)
378               self.menuPatrons.close()
379               delattr(self,"menuPatrons")
380            return
381         if (not hasattr(self,"menuPatrons")):
382            self.menuPatrons = QMenu(self.menubar)
383            self.menuPatrons.setObjectName("menuPatrons")
384            self.menubar.addAction(self.menuPatrons.menuAction())
385            self.menuPatrons.setTitle(QApplication.translate("Eficas", "Patrons", None, QApplication.UnicodeUTF8))
386         else :
387            self.menuPatrons.clear()
388         self.listePatrons = listePatrons.listePatrons(self.code)
389         idx = 0
390         for nomSsMenu in self.listePatrons.liste.keys():
391             ssmenu=self.menuPatrons.addMenu(nomSsMenu)
392             for fichier in self.listePatrons.liste[nomSsMenu]:
393                id = ssmenu.addAction(fichier)
394                self.ficPatrons[id]=fichier
395                self.connect(id, SIGNAL('triggered()'),self.handleOpenPatrons)
396             #   self.Patrons.setItemParameter(id,idx)
397                idx=idx+1
398
399     def initRecents(self):
400        self.recent =  QStringList()
401        try :
402        #if 1 :
403            rep=os.path.join(os.environ['HOME'],'.config/Eficas',self.code)
404            monFichier=rep+"/listefichiers_"+self.code
405            index=0
406            f=open(monFichier)
407            while ( index < 9) :
408               ligne=f.readline()
409               if ligne != "" :
410                  l=(ligne.split("\n"))[0]
411                  self.recent.append(l)
412               index=index+1
413        except :
414        #else :
415            pass
416
417        try    : f.close()
418        except : pass
419
420     def addToRecentList(self, fn):
421         """
422         Public slot to add a filename to the list of recently opened files.
423
424         @param fn name of the file to be added
425         """
426         self.recent.removeAll(fn)
427         self.recent.prepend(fn)
428         if len(self.recent) > 9:
429             self.recent = self.recent[:9]
430
431     def sauveRecents(self) :
432        try :
433          rep=self.CONFIGURATION.rep_user
434          monFichier=rep+"/listefichiers_"+self.code
435        except :
436          return
437        try :
438             f=open(monFichier,'w')
439             if len(self.recent) == 0 : return
440             index=0
441             while ( index <  len(self.recent)):
442               ligne=str(self.recent[index])+"\n"
443               f.write(ligne)
444               index=index+1
445        except :
446             pass
447        try :
448             f.close()
449        except :
450             pass
451
452
453
454     def traductionV7V8(self):
455         from gereTraduction import traduction
456         traduction(self.CONFIGURATION.repIni,self.viewmanager,"V7V8")
457
458     def traductionV8V9(self):
459         from gereTraduction import traduction
460         traduction(self.CONFIGURATION.repIni,self.viewmanager,"V8V9")
461
462     def traductionV9V10(self):
463         from gereTraduction import traduction
464         traduction(self.CONFIGURATION.repIni,self.viewmanager,"V9V10")
465
466     def version(self) :
467         from monVisu import DVisu
468         titre = tr("version ")
469         monVisuDialg=DVisu(parent=self,fl=0)
470         monVisuDialg.setWindowTitle(titre)
471         monVisuDialg.TB.setText(self.VERSION_EFICAS +tr(" pour ") + self.code)
472         monVisuDialg.adjustSize()
473         monVisuDialg.show()
474
475     def aidePPal(self) :
476         if self.code==None : return
477         repAide=os.path.dirname(os.path.abspath(__file__))
478         maD=repAide+"/../Aide"
479         try :
480           indexAide=maD+"/fichiers_EFICAS/index.html"
481           cmd="xdg-open "+indexAide
482           os.system(cmd)
483         except:
484           QMessageBox.warning( self,tr( "Aide Indisponible"),tr( "l'aide n est pas installee "))
485
486
487     def aideCode(self) :
488         if self.code==None : return
489         try :
490         #if 1 :
491           cmd="xdg-open "+self.fileDoc
492           os.system(cmd)
493         except:
494         #else:
495           QMessageBox.warning( self,tr( "Aide Indisponible"),tr( "l'aide n est pas installee "))
496
497
498     def optionEditeur(self) :
499         try :
500            name='monOptions_'+self.code
501         except :
502            QMessageBox.critical( self,tr( "Parametrage"),tr( "Veuillez d abord choisir un code"))
503            return
504         try :
505         #if 1:
506            optionCode=__import__(name)
507         except :
508         #else :
509            QMessageBox.critical( self, tr("Parametrage"), tr("Pas de possibilite de personnalisation de la configuration "))
510            return
511         monOption=optionCode.Options(parent=self,modal = 0 ,configuration=self.CONFIGURATION)
512         monOption.show()
513
514     def optionPdf(self) :
515         from monOptionsPdf import OptionPdf
516         monOption=OptionPdf(parent=self,modal = 0 ,configuration=self.CONFIGURATION)
517         monOption.show()
518
519     def handleShowRecentMenu(self):
520         """
521         Private method to set up recent files menu.
522         """
523         self.recentMenu.clear()
524
525         for rp in self.recent:
526             id = self.recentMenu.addAction(rp)
527             self.ficRecents[id]=rp
528             self.connect(id, SIGNAL('triggered()'),self.handleOpenRecent)
529         self.recentMenu.addSeparator()
530         self.recentMenu.addAction(tr('&Effacer'), self.handleClearRecent)
531
532     def handleOpenPatrons(self):
533         idx=self.sender()
534         fichier=self.repIni+"/../Editeur/Patrons/"+self.code+"/"+self.ficPatrons[idx]
535         self.viewmanager.handleOpen(fichier=fichier, patron = 1)
536
537     def handleOpenRecent(self):
538         idx=self.sender()
539         fichier=self.ficRecents[idx]
540         self.viewmanager.handleOpen(fichier=fichier, patron =0 )
541
542     def handleClearRecent(self):
543         self.recent = QStringList()
544         self.sauveRecents()
545
546     def fileNew(self):
547         try:
548             self.viewmanager.newEditor()
549         except EficasException, exc:
550             msg = unicode(exc)
551             if msg != "":
552                 QMessageBox.warning(self, tr(u"Erreur"), msg)
553
554     def fileOpen(self):
555         try:
556             self.viewmanager.handleOpen()
557         except EficasException, exc:
558             msg = unicode(exc)
559             if msg != "":
560                 QMessageBox.warning(self, tr(u"Erreur"), msg)
561
562     def fileSave(self):
563         return self.viewmanager.saveCurrentEditor()
564
565     def fileSaveAs(self):
566         return self.viewmanager.saveAsCurrentEditor()
567
568     def fileClose(self):
569         self.viewmanager.handleClose(texte='&Fermer')
570
571     def fileCloseAll(self):
572         self.viewmanager.handleCloseAll(texte='&Fermer')
573
574     def fileExit(self):
575         # On peut sortir sur Abort
576         res=self.viewmanager.handleCloseAll()
577         if (res != 2) :
578             self.close()
579         return res
580
581     def editCopy(self):
582         self.viewmanager.handleEditCopy()
583
584     def editCut(self):
585         self.viewmanager.handleEditCut()
586
587     def editPaste(self):
588         self.viewmanager.handleEditPaste()
589
590     def rechercher(self):
591         self.viewmanager.handleRechercher()
592
593     def run(self):
594         self.viewmanager.run()
595
596     def saveRun(self):
597         self.viewmanager.saveRun()
598
599
600     def supprimer(self):
601         self.viewmanager.handleSupprimer()
602
603     def jdcFichierSource(self):
604         self.viewmanager.handleViewJdcFichierSource()
605
606     def jdcRapport(self):
607         self.viewmanager.handleViewJdcRapport()
608
609     def gestionParam(self):
610         self.viewmanager.handlegestionParam()
611
612     def visuJdcPy(self):
613         self.viewmanager.handleViewJdcPy()
614
615
616     def NewInclude(self):
617         self.viewmanager.newIncludeEditor()
618
619     def cleanPath(self):
620         for pathCode in self.ListeCode:
621             try:
622               aEnlever=os.path.abspath(os.path.join(os.path.dirname(__file__),'..',pathCode))
623               sys.path.remove(aEnlever)
624             except :
625               pass
626         for pathCode in self.listeAEnlever:
627             try:
628               sys.path.remove(aEnlever)
629             except :
630               pass
631
632
633     def closeEvent(self,event):
634       res=self.fileExit()
635       if res==2 : event.ignore()
636
637 if __name__=='__main__':
638
639     # Modules Eficas
640     rep=os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__),'..','ASTER')))
641     sys.path.append(rep)
642     from Aster import prefsCode
643     if hasattr(prefsCode,'encoding'):
644        # Hack pour changer le codage par defaut des strings
645        import sys
646        reload(sys)
647        sys.setdefaultencoding(prefsCode.encoding)
648        del sys.setdefaultencoding
649        # Fin hack
650
651     from Editeur import import_code
652     from Editeur import session
653
654     # Analyse des arguments de la ligne de commande
655     options=session.parse(sys.argv)
656     code=options.code
657
658
659     app = QApplication(sys.argv)
660     #app.setMainWidget(mw) (qt3)
661     Eficas=Appli()
662     Eficas.show()
663
664     #app.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()"))
665     #mw.ouvreFichiers()
666     #mw.show()
667
668     res=app.exec_()
669     sys.exit(res)