X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=InterfaceQT4%2FqtEficas.py;h=ced79316317932dcd097893a1a85079cd659349b;hb=9bf98fc1cb51814c31679120598dc309e0802e31;hp=3a45ac9a87dba916f04a19dd2e099775d387da58;hpb=1d010ff4e7d10301413f4760ae487291fcb2b2ca;p=tools%2Feficas.git diff --git a/InterfaceQT4/qtEficas.py b/InterfaceQT4/qtEficas.py old mode 100644 new mode 100755 index 3a45ac9a..ced79316 --- a/InterfaceQT4/qtEficas.py +++ b/InterfaceQT4/qtEficas.py @@ -18,86 +18,158 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # +from __future__ import absolute_import +from __future__ import print_function +try : + from builtins import str +except : pass + import os, sys +import six -from PyQt4.QtGui import * -from PyQt4.QtCore import * -from myMain import Ui_Eficas -from viewManager import MyTabview -from getVersion import getEficasVersion + +from PyQt5.QtWidgets import QApplication, QMainWindow, QBoxLayout, QMenu, QAction, QMessageBox +from PyQt5.QtGui import QIcon +from PyQt5.QtCore import Qt from Extensions.i18n import tr from Extensions.eficas_exception import EficasException +from Extensions import param2 + +from myMain import Ui_Eficas +from .viewManager import MyTabview +from .getVersion import getEficasVersion from Editeur import session + class Appli(Ui_Eficas,QMainWindow): """ Class implementing the main user interface. """ - def __init__(self,code=None,salome=0,parent=None,ssCode=None,multi=False,langue='fr',ssIhm=False): + def __init__(self,code=None,salome=0,parent=None,ssCode=None,multi=False,langue='ang',ssIhm=False): """ Constructor """ QMainWindow.__init__(self,parent) Ui_Eficas.__init__(self) - self.setupUi(self) - self.myQtab.removeTab(0) - self.blEntete= QBoxLayout(0,self.frameEntete) - self.blEntete.insertWidget(0,self.toolBar) - self.blEntete.insertWidget(0,self.menubar) version=getEficasVersion() - self.VERSION_EFICAS="Eficas QT4 "+version + self.VERSION_EFICAS="Eficas QT5 Salome " + version self.salome=salome + self.parentMainWindow=parent self.ihm="QT" self.ssIhm=ssIhm self.top = self #(pour CONFIGURATION) self.QWParent=None #(Pour lancement sans IHM) self.code=code self.indice=0 + self.first=1 self.dict_reels={} - self.recent = QStringList() + self.recent = [] self.ficRecents={} + self.mesScripts={} self.listeAEnlever=[] - self.ListeCode=['Aster','Carmel3D','Cuve2dg','Openturns_Study','Openturns_Wrapper','MAP','ZCracks', 'CarmelCND','MT'] - self.repIcon=os.path.join( os.path.dirname(os.path.abspath(__file__)),'../Editeur/icons') + self.ListePathCode=['Adao','ADAO','Carmel3D','Telemac','CF','MAP','ZCracks', 'SEP','SPECA','PSEN_Eficas','PSEN_N1'] + self.listeCode=['Adao','ADAO','Carmel3D','Telemac','CF','MAP','ZCracks', 'SEP','SPECA','PSEN_Eficas','PSEN_N1'] + self.repIcon=os.path.join( os.path.dirname(os.path.abspath(__file__)),'..','Editeur','icons') + + if langue=='fr': self.langue=langue + else : self.langue="ang" if self.salome: import Accas import eficasSalome Accas.SalomeEntry = eficasSalome.SalomeEntry - #self.ajoutIcones() self.multi=multi - if langue=='fr': self.langue=langue - else : self.langue="ang" + self.demande=multi # specifique PSEN + + if self.multi == False : self.definitCode(code,ssCode) if code==None: return + + + if not self.salome and hasattr (self, 'CONFIGURATION') and hasattr(self.CONFIGURATION,'lang') : langue=self.CONFIGURATION.lang + + + self.suiteTelemac=False + if hasattr (self, 'CONFIGURATION') : + if self.CONFIGURATION.force_langue : + from .monChoixLangue import MonChoixLangue + widgetLangue = MonChoixLangue(self) + ret=widgetLangue.exec_() + self.suiteTelemac=self.CONFIGURATION.suiteTelemac + + + from Extensions import localisation + app=QApplication + if hasattr (self, 'CONFIGURATION') : localisation.localise(None,self.langue,translatorFichier=self.CONFIGURATION.translatorFichier) + + + + self.setupUi(self) + #if parent != None : self.parentCentralWidget = parent.centralWidget() + #else : self.parentCentralWidget = None + + if not self.salome : + if hasattr (self, 'CONFIGURATION') and hasattr(self.CONFIGURATION,'taille') : self.taille=self.CONFIGURATION.taille + else : self.taille=1700 + + if self.code in ['MAP',] : self.resize(1440,self.height()) + else : self.resize(self.taille,self.height()) + + + icon = QIcon(self.repIcon+"/parametres.png") + self.actionParametres.setIcon(icon) + + + self.myQtab.removeTab(0) + self.blEntete= QBoxLayout(0,self.frameEntete) + self.blEntete.insertWidget(0,self.toolBar) + self.blEntete.insertWidget(0,self.menubar) + + if hasattr (self, 'CONFIGURATION') and self.CONFIGURATION.closeEntete==True and self.salome: self.closeEntete() + eficas_root_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + #self.resize(20,20) self.viewmanager = MyTabview(self) - self.recentMenu=self.menuFichier.addMenu(tr('&Recents')) + self.recentMenu=QMenu(tr('&Recents')) + #self.menuFichier.insertMenu(self.actionOuvrir,self.recentMenu) + # actionARemplacer ne sert que pour l insert Menu + self.menuFichier.insertMenu(self.actionARemplacer ,self.recentMenu) + self.menuFichier.removeAction(self.actionARemplacer) self.connecterSignaux() self.toolBar.addSeparator() if self.code != None : self.construitMenu() - self.setWindowTitle(self.VERSION_EFICAS) - self.ouvreFichiers() + #try : + if 1 : + self.ouvreFichiers() + #except EficasException, exc: + #except: + # print "je suis dans le except" + #if self.salome == 0 : exit() + #self.adjustSize() + def closeEntete(self): + self.menuBar().close() + self.toolBar.close() + self.frameEntete.close() def definitCode(self,code,ssCode) : self.code=code self.ssCode=ssCode if self.code==None : self.cleanPath() - from monChoixCode import MonChoixCode + from .monChoixCode import MonChoixCode widgetChoix = MonChoixCode(self) ret=widgetChoix.exec_() import sys @@ -118,27 +190,33 @@ class Appli(Ui_Eficas,QMainWindow): self.CONFIGStyle = None if hasattr(configuration,'make_config_style'): self.CONFIGStyle = configuration.make_config_style(self,prefsCode.repIni) - if hasattr(prefsCode,'encoding'): - import sys - reload(sys) - sys.setdefaultencoding(prefsCode.encoding) + from Extensions import localisation + app=QApplication + if hasattr (self, 'CONFIGURATION') : localisation.localise(None,self.langue,translatorFichier=self.CONFIGURATION.translatorFichier) + #PN --> pb d exception qui font planter salome + # plus supporte en python 3 + #if hasattr(prefsCode,'encoding'): + # import sys + # reload(sys) + # sys.setdefaultencoding(prefsCode.encoding) def construitMenu(self): self.initPatrons() self.initRecents() self.initAides() - for intituleMenu in ("menuTraduction","menuOptions","menuMesh","menuExecution"): + for intituleMenu in ("menuTraduction","menuOptions","menuMesh","menuExecution","menuN1"): if hasattr(self,intituleMenu): menu=getattr(self,intituleMenu) menu.setAttribute(Qt.WA_DeleteOnClose) menu.close() delattr(self,intituleMenu) - for intituleAction in ("actionExecution","actionSaveRun",): + for intituleAction in ("actionExecution","actionSaveRun"): if hasattr(self,intituleAction): action=getattr(self,intituleAction) self.toolBar.removeAction(action) - if self.code in Appli.__dict__.keys(): - listeTexte=apply(Appli.__dict__[self.code],(self,)) + if self.code.upper() in Appli.__dict__: + Appli.__dict__[self.code.upper()](self,) + if self.suiteTelemac : self.lookSuiteTelemac() def initAides(self): #print "je passe la" @@ -158,18 +236,60 @@ class Appli(Ui_Eficas,QMainWindow): self.actionCode.setEnabled(True) self.menuAide.addAction(self.actionCode) + def newN1(self): + ssCode=None + code="PSEN_N1" + self.cleanPath() + dirCode=os.path.abspath(os.path.join(os.path.abspath(__file__),'../..',"ProcessOutputs_Eficas")) + sys.path.insert(0,dirCode) + self.code=code + self.definitCode(code,ssCode) + self.initRecents() + self.multi=True + self.demande=False + self.fileNew() + + def newPSEN(self): + ssCode=None + code="PSEN" + self.cleanPath() + dirCode=os.path.abspath(os.path.join(os.path.abspath(__file__),'../..',code)) + sys.path.insert(0,dirCode) + self.code=code + self.definitCode(code,ssCode) + self.multi=True + self.demande=False + self.fileNew() + + def ajoutN1(self): + self.menuN1 = self.menubar.addMenu(tr("Process Output")) + self.actionN1 = QAction(self) + self.actionN1.setText(tr("Process Output")) + self.menuN1.addAction(self.actionN1) + self.actionN1.triggered.connect(self.newN1) + + + if hasattr(self,'actionOpenProcess'):return + + self.actionOpenProcess = QAction(self) + self.actionOpenProcess.setText(tr("Open Process_Output File")) + self.menuN1.addAction(self.actionOpenProcess) + self.actionOpenProcess.triggered.connect(self.openProcess) def ajoutExecution(self): - self.menuExecution = self.menubar.addMenu(QApplication.translate("Eficas", "Execution", None, QApplication.UnicodeUTF8)) + self.menuExecution = self.menubar.addMenu(tr("&Run")) self.actionExecution = QAction(self) - icon6 = QIcon(self.repIcon+"/roue.png") - self.actionExecution.setIcon(icon6) + if sys.platform[0:5]=="linux": + icon6 = QIcon(self.repIcon+"/roue.png") + self.actionExecution.setIcon(icon6) + else : + self.actionExecution.setText(tr("Run")) self.actionExecution.setObjectName("actionExecution") self.menuExecution.addAction(self.actionExecution) if not(self.actionExecution in self.toolBar.actions()): self.toolBar.addAction(self.actionExecution) - self.actionExecution.setText(QApplication.translate("Eficas", "Execution ", None, QApplication.UnicodeUTF8)) - self.connect(self.actionExecution,SIGNAL("activated()"),self.run) + self.actionExecution.setText(tr("Run")) + self.actionExecution.triggered.connect(self.run) def ajoutSauveExecution(self): self.actionSaveRun = QAction(self) @@ -179,8 +299,8 @@ class Appli(Ui_Eficas,QMainWindow): self.menuExecution.addAction(self.actionSaveRun) if not(self.actionSaveRun in self.toolBar.actions()): self.toolBar.addAction(self.actionSaveRun) - self.actionSaveRun.setText(QApplication.translate("Eficas", "Save Run", None, QApplication.UnicodeUTF8)) - self.connect(self.actionSaveRun,SIGNAL("activated()"),self.saveRun) + self.actionSaveRun.setText(tr("Save Run")) + self.actionSaveRun.triggered.connect(self.saveRun) def griserActionsStructures(self): self.actionCouper.setEnabled(False) @@ -188,12 +308,41 @@ class Appli(Ui_Eficas,QMainWindow): self.actionCopier.setEnabled(False) self.actionSupprimer.setEnabled(False) + def enleverActionsStructures(self): + self.toolBar.removeAction(self.actionCopier) + self.toolBar.removeAction(self.actionColler) + self.toolBar.removeAction(self.actionCouper) + self.menuEdition.removeAction(self.actionCouper) + self.menuEdition.removeAction(self.actionCopier) + self.menuEdition.removeAction(self.actionColler) + + + def enleverParametres(self): + self.toolBar.removeAction(self.actionParametres) + self.menuJdC.removeAction(self.actionParametres) + + def enleverSupprimer(self): + self.toolBar.removeAction(self.actionSupprimer) + def enleverNewInclude(self): self.actionNouvel_Include.setVisible(False) def enleverRechercherDsCatalogue(self): self.actionRechercherDsCatalogue.setVisible(False) + def connectRechercherDsCatalogue(self): + if hasattr(self,'rechercherDejaLa') : return + self.rechercherDejaLa=True + self.actionRechercherDsCatalogue.triggered.connect(self.handleRechercherDsCatalogue) + + def ajoutSortieLegere(self): + if hasattr(self,'actionSortieLegere') : return + self.actionSortieLegere = QAction(self) + self.actionSortieLegere.setText(tr("Sortie Legere")) + self.menuFichier.insertAction(self.actionEnregistrer_sous,self.actionSortieLegere) + self.actionSortieLegere.triggered.connect(self.handleSortieLegere) + + def ZCRACKS(self): self.enleverNewInclude() self.toolBar.addSeparator() @@ -204,14 +353,13 @@ class Appli(Ui_Eficas,QMainWindow): self.menuOptions.setTitle(tr("Options")) def ADAO(self): - self.griserActionsStructures() + self.enleverActionsStructures() self.enleverNewInclude() - self.enleverRechercherDsCatalogue() def ASTER(self) : self.menuTraduction = self.menubar.addMenu("menuTraduction") - self.menuTraduction.addAction(self.actionTraduitV7V8) - self.menuTraduction.addAction(self.actionTraduitV8V9) + self.menuTraduction.addAction(self.actionTraduitV11V12) + self.menuTraduction.addAction(self.actionTraduitV10V11) self.menuTraduction.addAction(self.actionTraduitV9V10) self.menuTraduction.setTitle(tr("Traduction")) @@ -225,10 +373,10 @@ class Appli(Ui_Eficas,QMainWindow): def CARMEL3D(self): #if self.salome == 0 : return self.enleverNewInclude() - self.menuMesh = self.menubar.addMenu("menuMesh") + self.menuMesh = self.menubar.addMenu(tr("Gestion Maillage")) self.menuMesh.setObjectName("Mesh") self.menuMesh.addAction(self.actionChercheGrpMaille) - self.griserActionsStructures() + #self.griserActionsStructures() def CARMELCND(self): self.enleverNewInclude() @@ -246,118 +394,235 @@ class Appli(Ui_Eficas,QMainWindow): self.menuOptions.addAction(self.actionParametres_Eficas) self.menuOptions.setTitle(tr("Options")) + def PSEN(self): + if self.first: self.first=0 + try : self.action_Nouveau.triggered.disconnect(self.fileNew) + except : pass + try : self.action_Nouveau.triggered.disconnect(self.newPSEN) + except : pass + + self.action_Nouveau.triggered.connect(self.newPSEN) + self.enleverActionsStructures() + self.enleverParametres() + self.enleverRechercherDsCatalogue() + self.enleverNewInclude() + self.ajoutExecution() + self.ajoutN1() + self.ajoutHelpPSEN() + self.ajoutIcones() + + def PSEN_N1(self): + self.enleverActionsStructures() + self.enleverParametres() + self.enleverRechercherDsCatalogue() + self.enleverNewInclude() + self.ajoutExecution() + self.ajoutIcones() + + def TELEMAC(self): + self.enleverActionsStructures() + self.enleverNewInclude() + self.connectRechercherDsCatalogue() + self.ajoutSortieLegere() + + def lookSuiteTelemac(self): + self.enleverActionsStructures() + self.enleverNewInclude() + self.enleverParametres() + self.enleverSupprimer() + self.enleverRechercherDsCatalogue() + + def ajoutHelpPSEN(self): + self.actionParametres_Eficas.setText('Help PSEN') + self.actionParametres_Eficas.triggered.connect(self.aidePSEN) + + def ChercheGrpMesh(self): Msg,listeGroup=self.ChercheGrpMeshInSalome() if Msg == None : self.viewmanager.handleAjoutGroup(listeGroup) else : - print "il faut gerer les erreurs" + print ("il faut gerer les erreurs") def ChercheGrpMaille(self): - Msg,listeGroup=self.ChercheGrpMailleInSalome() + # Normalement la variable self.salome permet de savoir si on est ou non dans Salome + try: + Msg,listeGroup=self.ChercheGrpMailleInSalome() # recherche dans Salome + #Msg = None; listeGroup = None # recherche manuelle, i.e., sans Salome si ligne precedente commentee + except: + raise ValueError('Salome non ouvert') if Msg == None : self.viewmanager.handleAjoutGroup(listeGroup) else : - print "il faut gerer les erreurs" + print ("il faut gerer les erreurs") + def ChercheGrp(self): #Msg,listeGroup=self.ChercheGrpMailleInSalome() #if Msg == None : # self.viewmanager.handleAjoutGroup(listeGroup) #else : - print "il faut gerer " + #print "il faut gerer " + pass def ajoutIcones(self) : # Pour pallier les soucis de repertoire d icone - icon = QIcon(self.repIcon+"/New24.png") + #print self.repIcon + icon = QIcon(self.repIcon+"/new_file.png") self.action_Nouveau.setIcon(icon) - icon1 = QIcon(self.repIcon+"/Open24.png") - self.action_Ouvrir.setIcon(icon1) - icon2 = QIcon(self.repIcon+"/Save24.png") + icon1 = QIcon(self.repIcon+"/ouvrir.png") + self.actionOuvrir.setIcon(icon1) + icon2 = QIcon(self.repIcon+"/save.png") self.actionEnregistrer.setIcon(icon2) - icon3 = QIcon(self.repIcon+"/Cut24.png") - self.actionCouper.setIcon(icon3) - icon4 = QIcon(self.repIcon+"/Copy24.png") - self.actionCopier.setIcon(icon4) - icon5 = QIcon(self.repIcon+"/Paste24.png") - self.actionColler.setIcon(icon5) - icon6 = QIcon(self.repIcon+"/Delete24.png") + icon6 = QIcon(self.repIcon+"/delete.png") self.actionSupprimer.setIcon(icon6) + icon7 = QIcon(self.repIcon+"/roue.png") + self.actionExecution.setIcon(icon7) - def connecterSignaux(self) : + + def connecterSignauxQT4(self) : self.connect(self.recentMenu,SIGNAL('aboutToShow()'),self.handleShowRecentMenu) - self.connect(self.action_Nouveau,SIGNAL("activated()"),self.fileNew) - self.connect(self.actionNouvel_Include,SIGNAL("activated()"),self.NewInclude) - self.connect(self.action_Ouvrir,SIGNAL("activated()"),self.fileOpen) - self.connect(self.actionEnregistrer,SIGNAL("activated()"),self.fileSave) - self.connect(self.actionEnregistrer_sous,SIGNAL("activated()"),self.fileSaveAs) - self.connect(self.actionFermer,SIGNAL("activated()"),self.fileClose) - self.connect(self.actionFermer_tout,SIGNAL("activated()"),self.fileCloseAll) - self.connect(self.actionQuitter,SIGNAL("activated()"),self.fileExit) + self.connect(self.action_Nouveau,SIGNAL("triggered()"),self.fileNew) + self.connect(self.actionNouvel_Include,SIGNAL("triggered()"),self.NewInclude) + self.connect(self.actionOuvrir,SIGNAL("triggered()"),self.fileOpen) + self.connect(self.actionEnregistrer,SIGNAL("triggered()"),self.fileSave) + self.connect(self.actionEnregistrer_sous,SIGNAL("triggered()"),self.fileSaveAs) + self.connect(self.actionFermer,SIGNAL("triggered()"),self.fileClose) + self.connect(self.actionFermer_tout,SIGNAL("triggered()"),self.fileCloseAll) + self.connect(self.actionQuitter,SIGNAL("triggered()"),self.fileExit) + + self.connect(self.actionEficas,SIGNAL("triggered()"),self.aidePPal) + self.connect(self.actionVersion,SIGNAL("triggered()"),self.version) + self.connect(self.actionParametres,SIGNAL("triggered()"),self.gestionParam) - self.connect(self.actionEficas,SIGNAL("activated()"),self.aidePPal) - self.connect(self.actionVersion,SIGNAL("activated()"),self.version) - self.connect(self.actionParametres,SIGNAL("activated()"),self.gestionParam) + self.connect(self.actionCouper,SIGNAL("triggered()"),self.editCut) + self.connect(self.actionCopier,SIGNAL("triggered()"),self.editCopy) + self.connect(self.actionColler,SIGNAL("triggered()"),self.editPaste) + self.connect(self.actionSupprimer,SIGNAL("triggered()"),self.supprimer) + self.connect(self.actionRechercher,SIGNAL("triggered()"),self.rechercher) + self.connect(self.actionDeplier_replier,SIGNAL("triggered()"),self.Deplier) - self.connect(self.actionCouper,SIGNAL("activated()"),self.editCut) - self.connect(self.actionCopier,SIGNAL("activated()"),self.editCopy) - self.connect(self.actionColler,SIGNAL("activated()"),self.editPaste) - self.connect(self.actionSupprimer,SIGNAL("activated()"),self.supprimer) - self.connect(self.actionRechercher,SIGNAL("activated()"),self.rechercher) - self.connect(self.actionDeplier_replier,SIGNAL("activated()"),self.Deplier) + self.connect(self.actionRapport_de_Validation,SIGNAL("triggered()"),self.jdcRapport) + self.connect(self.actionRegles_du_JdC,SIGNAL("triggered()"),self.jdcRegles) + self.connect(self.actionFichier_Source,SIGNAL("triggered()"),self.jdcFichierSource) + self.connect(self.actionFichier_Resultat,SIGNAL("triggered()"),self.visuJdcPy) - self.connect(self.actionRapport_de_Validation,SIGNAL("activated()"),self.jdcRapport) - self.connect(self.actionFichier_Source,SIGNAL("activated()"),self.jdcFichierSource) - self.connect(self.actionFichier_Resultat,SIGNAL("activated()"),self.visuJdcPy) - #self.connect(self.helpIndexAction,SIGNAL("activated()"),self.helpIndex) - #self.connect(self.helpContentsAction,SIGNAL("activated()"),self.helpContents) # Pour Aster - self.actionTraduitV7V8 = QAction(self) - self.actionTraduitV7V8.setObjectName("actionTraduitV7V8") - self.actionTraduitV8V9 = QAction(self) - self.actionTraduitV8V9.setObjectName("actionTraduitV8V9") self.actionTraduitV9V10 = QAction(self) self.actionTraduitV9V10.setObjectName("actionTraduitV9V10") - self.actionTraduitV7V8.setText(tr("TraduitV7V8")) - self.actionTraduitV8V9.setText(tr("TraduitV8V9")) self.actionTraduitV9V10.setText(tr("TraduitV9V10")) + self.actionTraduitV10V11 = QAction(self) + self.actionTraduitV10V11.setObjectName("actionTraduitV10V11") + self.actionTraduitV10V11.setText(tr("TraduitV10V11")) + self.actionTraduitV11V12 = QAction(self) + self.actionTraduitV11V12.setObjectName("actionTraduitV11V12") + self.actionTraduitV11V12.setText(tr("TraduitV11V12")) self.actionSauveLigne = QAction(self) self.actionSauveLigne.setText(tr("Sauve Format Ligne")) - self.connect(self.actionParametres_Eficas,SIGNAL("activated()"),self.optionEditeur) - self.connect(self.actionLecteur_Pdf,SIGNAL("activated()"),self.optionPdf) - self.connect(self.actionTraduitV7V8,SIGNAL("activated()"),self.traductionV7V8) - self.connect(self.actionTraduitV8V9,SIGNAL("activated()"),self.traductionV8V9) - self.connect(self.actionTraduitV9V10,SIGNAL("activated()"),self.traductionV9V10) - self.connect(self.actionSauveLigne,SIGNAL("activated()"),self.sauveLigne) + #self.connect(self.actionParametres_Eficas,SIGNAL("triggered()"),self.optionEditeur) + self.connect(self.actionLecteur_Pdf,SIGNAL("triggered()"),self.optionPdf) + self.connect(self.actionTraduitV9V10,SIGNAL("triggered()"),self.traductionV9V10) + self.connect(self.actionTraduitV10V11,SIGNAL("triggered()"),self.traductionV10V11) + self.connect(self.actionTraduitV11V12,SIGNAL("triggered()"),self.traductionV11V12) + self.connect(self.actionSauveLigne,SIGNAL("triggered()"),self.sauveLigne) + + + # Pour Carmel + self.actionChercheGrpMaille = QAction(self) + self.actionChercheGrpMaille.setText(tr("Acquiert groupe mailles")) + self.connect(self.actionChercheGrpMaille,SIGNAL("triggered()"),self.ChercheGrpMaille) + + # Pour CarmelCND + self.actionChercheGrp = QAction(self) + self.actionChercheGrp.setText(tr("Acquisition Groupe Maille")) + self.connect(self.actionChercheGrp,SIGNAL("triggered()"),self.ChercheGrp) + + # Pour Aide + self.actionCode = QAction(self) + self.actionCode.setText(tr("Specificites Maille")) + self.connect(self.actionCode,SIGNAL("triggered()"),self.aideCode) + + def connecterSignaux(self) : + + self.recentMenu.aboutToShow.connect(self.handleShowRecentMenu) + self.action_Nouveau.triggered.connect(self.fileNew) + self.actionNouvel_Include.triggered.connect(self.NewInclude) + self.actionOuvrir.triggered.connect(self.fileOpen) + self.actionEnregistrer.triggered.connect(self.fileSave) + self.actionEnregistrer_sous.triggered.connect(self.fileSaveAs) + self.actionFermer.triggered.connect(self.fileClose) + self.actionFermer_tout.triggered.connect(self.fileCloseAll) + self.actionQuitter.triggered.connect(self.fileExit) + + self.actionEficas.triggered.connect(self.aidePPal) + self.actionVersion.triggered.connect(self.version) + self.actionParametres.triggered.connect(self.gestionParam) + self.actionCommentaire.triggered.connect(self.ajoutCommentaire) + + self.actionCouper.triggered.connect(self.editCut) + self.actionCopier.triggered.connect(self.editCopy) + self.actionColler.triggered.connect(self.editPaste) + self.actionSupprimer.triggered.connect(self.supprimer) + self.actionRechercher.triggered.connect(self.rechercher) + self.actionDeplier_replier.triggered.connect(self.Deplier) + + self.actionRapport_de_Validation.triggered.connect(self.jdcRapport) + self.actionRegles_du_JdC.triggered.connect(self.jdcRegles) + self.actionFichier_Source.triggered.connect(self.jdcFichierSource) + self.actionFichier_Resultat.triggered.connect(self.visuJdcPy) + self.actionAfficher_l_Arbre.triggered.connect(self.ouvreArbre) + self.actionCacher_l_Arbre.triggered.connect(self.fermeArbre) + + # Pour Aster + self.actionTraduitV9V10 = QAction(self) + self.actionTraduitV9V10.setObjectName("actionTraduitV9V10") + self.actionTraduitV9V10.setText(tr("TraduitV9V10")) + self.actionTraduitV10V11 = QAction(self) + self.actionTraduitV10V11.setObjectName("actionTraduitV10V11") + self.actionTraduitV10V11.setText(tr("TraduitV10V11")) + self.actionTraduitV11V12 = QAction(self) + self.actionTraduitV11V12.setObjectName("actionTraduitV11V12") + self.actionTraduitV11V12.setText(tr("TraduitV11V12")) + self.actionSauveLigne = QAction(self) + self.actionSauveLigne.setText(tr("Sauve Format Ligne")) + + #self.actionParametres_Eficas.triggered.connect(self.optionEditeur) + self.actionTraduitV9V10.triggered.connect(self.traductionV9V10) + self.actionTraduitV10V11.triggered.connect(self.traductionV10V11) + self.actionTraduitV11V12.triggered.connect(self.traductionV11V12) + self.actionSauveLigne.triggered.connect(self.sauveLigne) # Pour Carmel self.actionChercheGrpMaille = QAction(self) self.actionChercheGrpMaille.setText(tr("Acquiert Groupe Maille")) - self.connect(self.actionChercheGrpMaille,SIGNAL("activated()"),self.ChercheGrpMaille) # Pour CarmelCND self.actionChercheGrp = QAction(self) self.actionChercheGrp.setText(tr("Accquisition Groupe Maille")) - self.connect(self.actionChercheGrp,SIGNAL("activated()"),self.ChercheGrp) + self.actionChercheGrp.triggered.connect(self.ChercheGrp) # Pour Aide self.actionCode = QAction(self) self.actionCode.setText(tr("Specificites Maille")) - self.connect(self.actionCode,SIGNAL("activated()"),self.aideCode) + self.actionCode.triggered.connect(self.aideCode) + def Deplier(self): self.viewmanager.handleDeplier() + def ajoutCommentaire(self): + self.viewmanager.ajoutCommentaire() + def ouvreFichiers(self) : # Ouverture des fichiers de commandes donnes sur la ligne de commande cwd=os.getcwd() @@ -379,7 +644,7 @@ class Appli(Ui_Eficas,QMainWindow): def initPatrons(self) : # Mise a jour du menu des fichiers recemment ouverts from Editeur import listePatrons - if not(self.code in listePatrons.sous_menus.keys()) : + if not(self.code in listePatrons.sous_menus) : if hasattr(self,"menuPatrons"): self.menuPatrons.setAttribute(Qt.WA_DeleteOnClose) self.menuPatrons.close() @@ -389,42 +654,50 @@ class Appli(Ui_Eficas,QMainWindow): self.menuPatrons = QMenu(self.menubar) self.menuPatrons.setObjectName("menuPatrons") self.menubar.addAction(self.menuPatrons.menuAction()) - self.menuPatrons.setTitle(QApplication.translate("Eficas", "Patrons", None, QApplication.UnicodeUTF8)) + self.menuPatrons.setTitle(tr("Patrons")) else : self.menuPatrons.clear() self.listePatrons = listePatrons.listePatrons(self.code) idx = 0 - for nomSsMenu in self.listePatrons.liste.keys(): + for nomSsMenu in self.listePatrons.liste: ssmenu=self.menuPatrons.addMenu(nomSsMenu) for fichier in self.listePatrons.liste[nomSsMenu]: id = ssmenu.addAction(fichier) self.ficPatrons[id]=fichier - self.connect(id, SIGNAL('triggered()'),self.handleOpenPatrons) + self.id.triggered.connect(self.handleOpenPatrons) # self.Patrons.setItemParameter(id,idx) idx=idx+1 def initRecents(self): - self.recent = QStringList() + self.recent = [] try : - #if 1 : - rep=os.path.join(os.environ['HOME'],'.config/Eficas',self.code) + if sys.platform[0:5]=="linux" : + rep=os.path.join(os.environ['HOME'],'.config/Eficas',self.code) + else : + rep=os.path.join('C:/','.config/Eficas',self.code) monFichier=rep+"/listefichiers_"+self.code index=0 f=open(monFichier) while ( index < 9) : ligne=f.readline() - if ligne != "" : + if ligne != "" : l=(ligne.split("\n"))[0] self.recent.append(l) index=index+1 except : - #else : pass try : f.close() except : pass def addToRecentList(self, fn): + while fn in self.recent: self.recent.remove(fn) + self.recent.insert(0,fn) + if len(self.recent) > 9: + self.recent = self.recent[:9] + + + def addToRecentListQT4(self, fn): """ Public slot to add a filename to the list of recently opened files. @@ -434,6 +707,8 @@ class Appli(Ui_Eficas,QMainWindow): self.recent.prepend(fn) if len(self.recent) > 9: self.recent = self.recent[:9] + index=0 + self.sauveRecents() def sauveRecents(self) : try : @@ -458,20 +733,20 @@ class Appli(Ui_Eficas,QMainWindow): - def traductionV7V8(self): - from gereTraduction import traduction - traduction(self.CONFIGURATION.repIni,self.viewmanager,"V7V8") + def traductionV11V12(self): + from .gereTraduction import traduction + traduction(self.CONFIGURATION.repIni,self.viewmanager,"V11V12") - def traductionV8V9(self): - from gereTraduction import traduction - traduction(self.CONFIGURATION.repIni,self.viewmanager,"V8V9") + def traductionV10V11(self): + from .gereTraduction import traduction + traduction(self.CONFIGURATION.repIni,self.viewmanager,"V10V11") def traductionV9V10(self): - from gereTraduction import traduction + from .gereTraduction import traduction traduction(self.CONFIGURATION.repIni,self.viewmanager,"V9V10") def version(self) : - from monVisu import DVisu + from .monVisu import DVisu titre = tr("version ") monVisuDialg=DVisu(parent=self,fl=0) monVisuDialg.setWindowTitle(titre) @@ -480,22 +755,33 @@ class Appli(Ui_Eficas,QMainWindow): monVisuDialg.show() def aidePPal(self) : - if self.code==None : return repAide=os.path.dirname(os.path.abspath(__file__)) - maD=repAide+"/../Aide" + maD=os.path.join( repAide,'..','Doc','html') try : - indexAide=maD+"/fichiers_EFICAS/index.html" - cmd="xdg-open "+indexAide + indexAide=os.path.join(maD,'index.html') + if sys.platform[0:5]=="linux" : cmd="xdg-open "+indexAide + else : cmd="start "+indexAide os.system(cmd) except: QMessageBox.warning( self,tr( "Aide Indisponible"),tr( "l'aide n est pas installee ")) + def aidePSEN(self) : + repAide=os.path.dirname(os.path.abspath(__file__)) + maD=os.path.join( repAide,'..','Doc','html') + try : + indexAide=os.path.join(maD,'index.html') + if sys.platform[0:5]=="linux" : cmd="xdg-open "+indexAide + else : cmd="start "+indexAide + os.system(cmd) + except: + QMessageBox.warning( self,tr( "Aide Indisponible"),tr( "l'aide n est pas installee ")) def aideCode(self) : if self.code==None : return try : #if 1 : - cmd="xdg-open "+self.fileDoc + if sys.platform[0:5]=="linux" : cmd="xdg-open "+self.fileDoc + else : cmd="start "+self.fileDoc os.system(cmd) except: #else: @@ -523,6 +809,9 @@ class Appli(Ui_Eficas,QMainWindow): monOption=OptionPdf(parent=self,modal = 0 ,configuration=self.CONFIGURATION) monOption.show() + def handleSortieLegere(self): + return self.viewmanager.saveLegerCurrentEditor() + def handleShowRecentMenu(self): """ Private method to set up recent files menu. @@ -532,7 +821,7 @@ class Appli(Ui_Eficas,QMainWindow): for rp in self.recent: id = self.recentMenu.addAction(rp) self.ficRecents[id]=rp - self.connect(id, SIGNAL('triggered()'),self.handleOpenRecent) + id.triggered.connect(self.handleOpenRecent) self.recentMenu.addSeparator() self.recentMenu.addAction(tr('&Effacer'), self.handleClearRecent) @@ -550,19 +839,36 @@ class Appli(Ui_Eficas,QMainWindow): self.recent = QStringList() self.sauveRecents() + def handleRechercherDsCatalogue(self): + if not self.viewmanager : return + self.viewmanager.handleRechercherDsCatalogue() + def fileNew(self): try: self.viewmanager.newEditor() - except EficasException, exc: - msg = unicode(exc) - if msg != "": - QMessageBox.warning(self, tr(u"Erreur"), msg) + except EficasException as exc: + msg = six.text_type(exc) + if msg != "": QMessageBox.warning(self, tr(u"Erreur"), msg) + + def openProcess(self): + ssCode=None + code="PSEN_N1" + self.cleanPath() + dirCode=os.path.abspath(os.path.join(os.path.abspath(__file__),'../..',"ProcessOutputs_Eficas")) + sys.path.insert(0,dirCode) + self.code=code + self.definitCode(code,ssCode) + self.multi=True + self.demande=False + self.initRecents() + self.fileOpen() + def fileOpen(self): try: self.viewmanager.handleOpen() - except EficasException, exc: - msg = unicode(exc) + except EficasException as exc: + msg = six.text_type(exc) if msg != "": QMessageBox.warning(self, tr(u"Erreur"), msg) @@ -616,18 +922,26 @@ class Appli(Ui_Eficas,QMainWindow): def jdcRapport(self): self.viewmanager.handleViewJdcRapport() + def jdcRegles(self): + self.viewmanager.handleViewJdcRegles() + def gestionParam(self): self.viewmanager.handlegestionParam() def visuJdcPy(self): self.viewmanager.handleViewJdcPy() + def ouvreArbre(self): + self.viewmanager.ouvreArbre() + + def fermeArbre(self): + self.viewmanager.fermeArbre() def NewInclude(self): self.viewmanager.newIncludeEditor() def cleanPath(self): - for pathCode in self.ListeCode: + for pathCode in self.ListePathCode: try: aEnlever=os.path.abspath(os.path.join(os.path.dirname(__file__),'..',pathCode)) sys.path.remove(aEnlever) @@ -644,6 +958,7 @@ class Appli(Ui_Eficas,QMainWindow): res=self.fileExit() if res==2 : event.ignore() + if __name__=='__main__': # Modules Eficas @@ -671,7 +986,6 @@ if __name__=='__main__': Eficas=Appli() Eficas.show() - #app.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()")) #mw.ouvreFichiers() #mw.show()