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