+#!/usr/bin/env python
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2013 EDF R&D
+# Copyright (C) 2007-2017 EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# 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 PyQt5.QtWidgets import QApplication, QMainWindow, QGridLayout, QBoxLayout, QMenu, QAction, QMessageBox
+from PyQt5.QtGui import QIcon
+from PyQt5.QtCore import Qt, QSize
+
-from PyQt4.QtGui import *
-from PyQt4.QtCore import *
+from Editeur import session
from myMain import Ui_Eficas
-from viewManager import MyTabview
-from getVersion import getEficasVersion
+from InterfaceQT4.viewManager import MyViewManager
+from InterfaceQT4.qtEficasSsIhm import AppliSsIhm
from Extensions.i18n import tr
from Extensions.eficas_exception import EficasException
-
-from Editeur import session
+from Extensions import param2
-class Appli(Ui_Eficas,QMainWindow):
+class Appli(AppliSsIhm,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=1,parent=None,ssCode=None,multi=False,langue='fr',ssIhm=False,versionCode=None):
"""
Constructor
"""
+ if ssIhm == True :
+ print ('mauvaise utilisation de la classe Appli. Utiliser AppliSsIm SVP')
+ exit()
+
+ AppliSsIhm.__init__(self,code,salome,parent,ssCode,multi,langue,ssIhm=True,versionCode=None)
QMainWindow.__init__(self,parent)
Ui_Eficas.__init__(self)
-
- version=getEficasVersion()
- self.VERSION_EFICAS="Eficas QT4 "+version
- self.salome=salome
- 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.dict_reels={}
- self.recent = QStringList()
- self.ficRecents={}
- 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')
-
- if self.salome:
- import Accas
- import eficasSalome
- Accas.SalomeEntry = eficasSalome.SalomeEntry
-
+ self.ssIhm=False
self.multi=multi
+ self.demande=multi # voir PSEN
+
if self.multi == False :
self.definitCode(code,ssCode)
if code==None: return
+ else :
+ print ('a programmer')
+
+ self.suiteTelemac=False
+ if hasattr (self, 'maConfiguration') :
+ if self.maConfiguration.force_langue :
+ from InterfaceQT4.monChoixLangue import MonChoixLangue
+ widgetLangue = MonChoixLangue(self)
+ ret=widgetLangue.exec_()
+ self.suiteTelemac=self.maConfiguration.suiteTelemac
- if not self.salome and hasattr(self.CONFIGURATION,'lang') : langue=self.CONFIGURATION.lang
- if langue=='fr': self.langue=langue
- else : self.langue="ang"
+ if not self.salome and hasattr (self, 'maConfiguration') and hasattr(self.maConfiguration,'lang') : self.langue=self.maConfiguration.lang
from Extensions import localisation
app=QApplication
- localisation.localise(app,langue)
-
+ if hasattr (self, 'maConfiguration') : localisation.localise(None,self.langue,translatorFichier=self.maConfiguration.translatorFichier)
self.setupUi(self)
+ #if parent != None : self.parentCentralWidget = parent.centralWidget()
+ #else : self.parentCentralWidget = None
+
+ if not self.salome :
+ if hasattr (self, 'maConfiguration') and hasattr(self.maConfiguration,'taille') : self.taille=self.maConfiguration.taille
+ else : self.taille=1700
+
+ #if self.code in ['MAP',] : self.resize(1440,self.height())
+ #else : self.resize(self.taille,self.height())
+ self.resize(self.taille,self.height())
+
+
+ icon = QIcon(self.repIcon+"/parametres.png")
+ self.actionParametres.setIcon(icon)
+ if hasattr (self, 'maConfiguration') and self.maConfiguration.boutonDsMenuBar :
+ self.frameEntete.setMaximumSize(QSize(16777215,100))
+ self.frameEntete.setMinimumSize(QSize(0,100))
+ if hasattr (self, 'maConfiguration') and self.maConfiguration.enleverActionStructures :
+ self.enleverActionsStructures()
+ if hasattr (self, 'maConfiguration') and self.maConfiguration.enleverParametres :
+ self.enleverParametres()
+ if hasattr (self, 'maConfiguration') and self.maConfiguration.enleverSupprimer :
+ self.enleverSupprimer()
+
+
self.myQtab.removeTab(0)
- self.blEntete= QBoxLayout(0,self.frameEntete)
+ self.blEnteteGlob = QBoxLayout(2,self.frameEntete)
+ self.blEnteteGlob.setSpacing(0)
+ self.blEnteteGlob.setContentsMargins(0,0,0,0)
+
+ self.blEntete = QBoxLayout(0)
self.blEntete.insertWidget(0,self.toolBar)
self.blEntete.insertWidget(0,self.menubar)
+ self.blEnteteGlob.insertLayout(0,self.blEntete)
+
+ if hasattr (self, 'maConfiguration') and self.maConfiguration.boutonDsMenuBar :
+ self.blEnteteCommmande = QBoxLayout(0)
+ self.blEnteteCommmande.insertWidget(0,self.toolBarCommande)
+ self.toolBarCommande.setIconSize(QSize(96,96))
+ self.blEnteteGlob.insertLayout(-1,self.blEnteteCommmande)
+ else :
+ self.toolBarCommande.close()
+
+
+ if hasattr (self, 'maConfiguration') and self.maConfiguration.closeEntete==True and self.salome: self.closeEntete()
+
eficas_root_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
- self.viewmanager = MyTabview(self)
- #self.recentMenu=self.menuFichier.addMenu(tr('&Recents'))
+ self.viewmanager = MyViewManager(self)
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 :
+ # print ('attention try devient if 1')
+ self.ouvreFichiers()
+ except EficasException as 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 InterfaceQT4.monChoixCode import MonChoixCode
widgetChoix = MonChoixCode(self)
ret=widgetChoix.exec_()
- import sys
+ #widgetChoix.show()
if self.code == None:return # pour le cancel de la fenetre choix code
- name='prefs_'+self.code
- prefsCode=__import__(name)
+ AppliSsIhm.definitCode(self,self.code,ssCode)
- self.repIni=prefsCode.repIni
- if ssCode != None :
- self.format_fichier= ssCode #par defaut
- prefsCode.NAME_SCHEME=ssCode
- else :
- self.format_fichier="python" #par defaut
-
- nameConf='configuration_'+self.code
- configuration=__import__(nameConf)
- self.CONFIGURATION = configuration.make_config(self,prefsCode.repIni)
- 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)
+ #PN --> pb d exception qui font planter salome
+ # plus supporte en python 3
+ #app=QApplication
+ #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.upper() in Appli.__dict__.keys():
- listeTexte=apply(Appli.__dict__[self.code.upper()],(self,))
+ if self.code.upper() in Appli.__dict__:
+ Appli.__dict__[self.code.upper()](self,)
+ if self.suiteTelemac : self.lookSuiteTelemac()
+ self.metMenuAJourUtilisateurs()
+ if hasattr (self, 'maConfiguration') and self.maConfiguration.ajoutExecution :
+ self.ajoutExecution()
def initAides(self):
#print "je passe la"
repAide=os.path.dirname(os.path.abspath(__file__))
fileName='index.html'
self.docPath=repAide+"/../Aide"
- if hasattr(self,'CONFIGURATION') and hasattr(self.CONFIGURATION,'docPath') : self.docPath=self.CONFIGURATION.docPath
- if hasattr(self,'CONFIGURATION') and hasattr(self.CONFIGURATION,'fileName'):fileName=self.CONFIGURATION.fileName
+ if hasattr(self,'maConfiguration') and hasattr(self.maConfiguration,'docPath') : self.docPath=self.maConfiguration.docPath
+ if hasattr(self,'maConfiguration') and hasattr(self.maConfiguration,'fileName'):fileName=self.maConfiguration.fileName
self.fileDoc=os.path.join(self.docPath,fileName)
self.actionCode.setText(tr("Aide specifique ")+str(self.code))
if not os.path.isfile(self.fileDoc) :
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):
+ return
+ 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)
if sys.platform[0:5]=="linux":
icon6 = QIcon(self.repIcon+"/roue.png")
self.actionExecution.setIcon(icon6)
else :
- self.actionExecution.setText(QApplication.translate("Eficas", "Run", None))
+ 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("triggered()"),self.run)
+ self.actionExecution.setText(tr("Run"))
+ self.actionExecution.triggered.connect(self.run)
def ajoutSauveExecution(self):
self.actionSaveRun = QAction(self)
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("triggered()"),self.saveRun)
+ self.actionSaveRun.setText(tr("Save Run"))
+ self.actionSaveRun.triggered.connect(self.saveRun)
def griserActionsStructures(self):
self.actionCouper.setEnabled(False)
self.toolBar.removeAction(self.actionParametres)
self.menuJdC.removeAction(self.actionParametres)
+ def enleverSupprimer(self):
+ self.toolBar.removeAction(self.actionSupprimer)
- def enleverNewInclude(self):
+ 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 ajoutSortieComplete(self):
+ if hasattr(self,'actionSortieComplete') : return
+ self.actionSortieComplete = QAction(self)
+ self.actionSortieComplete.setText(tr("Sortie Complete"))
+ self.menuFichier.insertAction(self.actionEnregistrer_sous,self.actionSortieComplete)
+ self.actionSortieComplete.triggered.connect(self.handleSortieComplete)
+
+
+ def MT(self):
+ self.enlevernewInclude()
+ self.toolBar.addSeparator()
+
+
def ZCRACKS(self):
- self.enleverNewInclude()
+ self.enlevernewInclude()
self.toolBar.addSeparator()
self.ajoutExecution()
def ADAO(self):
self.enleverActionsStructures()
- self.enleverNewInclude()
- self.enleverRechercherDsCatalogue()
+ self.enlevernewInclude()
def ASTER(self) :
self.menuTraduction = self.menubar.addMenu("menuTraduction")
def CARMEL3D(self):
#if self.salome == 0 : return
- self.enleverNewInclude()
+ self.enlevernewInclude()
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()
+ self.enlevernewInclude()
self.enleverRechercherDsCatalogue()
self.ajoutExecution()
self.ajoutSauveExecution()
self.griserActionsStructures()
-
+
def MAP(self):
- self.enleverNewInclude()
+ self.enlevernewInclude()
self.toolBar.addSeparator()
self.ajoutExecution()
self.ajoutSauveExecution()
self.menuOptions.addAction(self.actionParametres_Eficas)
self.menuOptions.setTitle(tr("Options"))
+ def MAPIDENTIFICATION(self):
+ self.enlevernewInclude()
+ self.enleverSupprimer()
+ #self.ajoutExecution()
+ self.enleverRechercherDsCatalogue()
+ self.enleverActionsStructures()
+ self.enleverParametres()
+
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.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.enlevernewInclude()
+ self.connectRechercherDsCatalogue()
+ self.ajoutSortieComplete()
+
+ 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):
# Normalement la variable self.salome permet de savoir si on est ou non dans Salome
try:
- Msg,listeGroup=self.ChercheGrpMailleInSalome() # recherche dans Salomé
- #Msg = None; listeGroup = None # recherche manuelle, i.e., sans Salomé si ligne précédente commentée
+ 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):
#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")
+ icon1 = QIcon(self.repIcon+"/ouvrir.png")
self.actionOuvrir.setIcon(icon1)
- icon2 = QIcon(self.repIcon+"/Save24.png")
+ 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("triggered()"),self.fileNew)
- self.connect(self.actionNouvel_Include,SIGNAL("triggered()"),self.NewInclude)
+ 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.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.actionDeplier_replier,SIGNAL("triggered()"),self.handleDeplier)
self.connect(self.actionRapport_de_Validation,SIGNAL("triggered()"),self.jdcRapport)
self.connect(self.actionRegles_du_JdC,SIGNAL("triggered()"),self.jdcRegles)
self.connect(self.actionFichier_Resultat,SIGNAL("triggered()"),self.visuJdcPy)
- #self.connect(self.helpIndexAction,SIGNAL("triggered()"),self.helpIndex)
- #self.connect(self.helpContentsAction,SIGNAL("triggered()"),self.helpContents)
+
# Pour Aster
self.actionTraduitV9V10 = QAction(self)
self.actionSauveLigne = QAction(self)
self.actionSauveLigne.setText(tr("Sauve Format Ligne"))
- self.connect(self.actionParametres_Eficas,SIGNAL("triggered()"),self.optionEditeur)
+ #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.actionCode.setText(tr("Specificites Maille"))
self.connect(self.actionCode,SIGNAL("triggered()"),self.aideCode)
- def Deplier(self):
+ 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.handleDeplier)
+
+ 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"))
+
+ # Pour CarmelCND
+ self.actionChercheGrp = QAction(self)
+ self.actionChercheGrp.setText(tr("Accquisition Groupe Maille"))
+ self.actionChercheGrp.triggered.connect(self.ChercheGrp)
+
+ # Pour Aide
+ self.actionCode = QAction(self)
+ self.actionCode.setText(tr("Specificites Maille"))
+ self.actionCode.triggered.connect(self.aideCode)
+
+
+ def handleDeplier(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()
self.dir=cwd
for study in session.d_env.studies:
os.chdir(cwd)
- d=session.get_unit(study,self)
+ d=session.getUnit(study,self)
self.viewmanager.handleOpen(fichier=study["comm"],units=d)
- def get_source(self,file):
+ def getSource(self,file):
# appele par Editeur/session.py
import convert
p=convert.plugins['python']()
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()
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 :
if sys.platform[0:5]=="linux" :
rep=os.path.join(os.environ['HOME'],'.config/Eficas',self.code)
else :
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.
def sauveRecents(self) :
try :
- rep=self.CONFIGURATION.rep_user
+ rep=self.maConfiguration.rep_user
monFichier=rep+"/listefichiers_"+self.code
except :
return
def traductionV11V12(self):
- from gereTraduction import traduction
- traduction(self.CONFIGURATION.repIni,self.viewmanager,"V11V12")
+ from .gereTraduction import traduction
+ traduction(self.maConfiguration.repIni,self.viewmanager,"V11V12")
def traductionV10V11(self):
- from gereTraduction import traduction
- traduction(self.CONFIGURATION.repIni,self.viewmanager,"V10V11")
+ from .gereTraduction import traduction
+ traduction(self.maConfiguration.repIni,self.viewmanager,"V10V11")
def traductionV9V10(self):
- from gereTraduction import traduction
- traduction(self.CONFIGURATION.repIni,self.viewmanager,"V9V10")
+ from .gereTraduction import traduction
+ traduction(self.maConfiguration.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)
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')
try :
- indexAide=maD+"/fichiers_EFICAS/index.html"
+ 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')
+ 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
#else :
QMessageBox.critical( self, tr("Parametrage"), tr("Pas de possibilite de personnalisation de la configuration "))
return
- monOption=optionCode.Options(parent=self,modal = 0 ,configuration=self.CONFIGURATION)
+ monOption=optionCode.Options(parent=self,modal = 0 ,configuration=self.maConfiguration)
monOption.show()
def optionPdf(self) :
from monOptionsPdf import OptionPdf
- monOption=OptionPdf(parent=self,modal = 0 ,configuration=self.CONFIGURATION)
+ monOption=OptionPdf(parent=self,modal = 0 ,configuration=self.maConfiguration)
monOption.show()
+ def handleSortieComplete(self):
+ return self.viewmanager.saveCompleteCurrentEditor()
+
def handleShowRecentMenu(self):
"""
Private method to set up recent files menu.
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)
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)
self.viewmanager.handleViewJdcRegles()
def gestionParam(self):
- self.viewmanager.handlegestionParam()
+ self.viewmanager.handleGestionParam()
def visuJdcPy(self):
self.viewmanager.handleViewJdcPy()
+ def ouvreArbre(self):
+ self.viewmanager.ouvreArbre()
- def NewInclude(self):
+ 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)
res=self.fileExit()
if res==2 : event.ignore()
+
+ def remplitIconesCommandes(self):
+ if self.maConfiguration.boutonDsMenuBar == False : return
+ if not hasattr(self, 'readercata') : return
+ from monLayoutBouton import MonLayoutBouton
+ if hasattr(self,'monLayoutBoutonRempli') : return
+ self.monLayoutBoutonRempli=MonLayoutBouton(self)
+
+ def handleAjoutEtape(self,nomEtape):
+ self.viewmanager.handleAjoutEtape(nomEtape)
+
+ def metMenuAJourUtilisateurs(self):
+ self.lesFonctionsUtilisateurs={}
+ if self.code not in self.mesScripts : return
+ if not hasattr(self.mesScripts[self.code],'dict_menu') : return
+ for monMenu in iter(self.mesScripts[self.code].dict_menu.items()) :
+ titre,lesFonctions= monMenu
+ self.menuOptions = self.menubar.addMenu("menuOptions")
+ self.menuOptions.setTitle(tr(titre))
+ for elt in lesFonctions :
+ laFonctionUtilisateur, label, lesArguments = elt
+ action = QAction(self)
+ action.setText(label)
+ #action.triggered.connect(self.appelleFonctionUtilisateur)
+ self.menuOptions.addAction(action)
+ self.lesFonctionsUtilisateurs[action]=(laFonctionUtilisateur, lesArguments)
+ self.menuOptions.triggered.connect(self.handleFonctionUtilisateur)
+
+ def handleFonctionUtilisateur(self,action) :
+ (laFonctionUtilisateur, lesArguments)=self.lesFonctionsUtilisateurs[action]
+ self.viewmanager.handleFonctionUtilisateur(laFonctionUtilisateur, lesArguments)
+
if __name__=='__main__':
# Modules Eficas
- rep=os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__),'..','ASTER')))
+ rep=os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__),'..','Adao')))
sys.path.append(rep)
- from Aster import prefsCode
- if hasattr(prefsCode,'encoding'):
+ from Adao import prefs
+ from Adao import prefs_Adao
+ #if hasattr(prefsCode,'encoding'):
# Hack pour changer le codage par defaut des strings
- import sys
- reload(sys)
- sys.setdefaultencoding(prefsCode.encoding)
- del sys.setdefaultencoding
+ #import sys
+ #reload(sys)
+ #sys.setdefaultencoding(prefsCode.encoding)
+ #del sys.setdefaultencoding
# Fin hack
from Editeur import import_code
Eficas=Appli()
Eficas.show()
- #app.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()"))
#mw.ouvreFichiers()
#mw.show()