Salome HOME
synchronisation avec Yoann
[tools/eficas.git] / InterfaceQT4 / qtEficas.py
index 601089c2ff100cfbcec7446d33b74561df3eff4f..ced79316317932dcd097893a1a85079cd659349b 100755 (executable)
@@ -48,7 +48,7 @@ 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
         """
@@ -76,6 +76,8 @@ class Appli(Ui_Eficas,QMainWindow):
         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
@@ -94,8 +96,6 @@ class Appli(Ui_Eficas,QMainWindow):
       
         if not self.salome and hasattr (self, 'CONFIGURATION') and hasattr(self.CONFIGURATION,'lang') : langue=self.CONFIGURATION.lang
 
-        if langue=='fr': self.langue=langue
-        else           : self.langue="ang"
 
         self.suiteTelemac=False 
         if hasattr (self, 'CONFIGURATION') :
@@ -108,7 +108,7 @@ class Appli(Ui_Eficas,QMainWindow):
 
         from Extensions import localisation
         app=QApplication
-        localisation.localise(None,self.langue,translatorFichier=self.CONFIGURATION.translatorFichier)
+        if hasattr (self, 'CONFIGURATION') : localisation.localise(None,self.langue,translatorFichier=self.CONFIGURATION.translatorFichier)
 
 
 
@@ -190,6 +190,9 @@ class Appli(Ui_Eficas,QMainWindow):
         self.CONFIGStyle = None
         if hasattr(configuration,'make_config_style'):
            self.CONFIGStyle = configuration.make_config_style(self,prefsCode.repIni)
+        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'):
@@ -207,12 +210,12 @@ class Appli(Ui_Eficas,QMainWindow):
                  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__:
-          listeTexte=Appli.__dict__[self.code.upper()],(self,)
+          Appli.__dict__[self.code.upper()](self,)
         if self.suiteTelemac : self.lookSuiteTelemac()
 
     def initAides(self):
@@ -328,6 +331,8 @@ class Appli(Ui_Eficas,QMainWindow):
         self.actionRechercherDsCatalogue.setVisible(False)
 
     def connectRechercherDsCatalogue(self):
+        if hasattr(self,'rechercherDejaLa') : return
+        self.rechercherDejaLa=True
         self.actionRechercherDsCatalogue.triggered.connect(self.handleRechercherDsCatalogue)
 
     def ajoutSortieLegere(self):
@@ -390,8 +395,12 @@ class Appli(Ui_Eficas,QMainWindow):
         self.menuOptions.setTitle(tr("Options"))
 
     def PSEN(self):
-        if self.first: self.first=0
-        self.action_Nouveau.triggered.disconnect(self.fileNew)
+        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()
@@ -557,6 +566,7 @@ class Appli(Ui_Eficas,QMainWindow):
         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)
@@ -610,6 +620,9 @@ class Appli(Ui_Eficas,QMainWindow):
     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()