Salome HOME
linux/windows
[tools/eficas.git] / InterfaceQT4 / editor.py
index 2080558497e2791346de93d845b1eaba6f1490d1..136b860440c0369fd92658eb1cc169ab74a7cf78 100755 (executable)
@@ -37,6 +37,7 @@ from Editeur        import comploader
 from Editeur        import Objecttreeitem
 from desBaseWidget  import Ui_baseWidget
 from monViewTexte   import ViewText 
+from monViewTexte   import ViewText2
 from monWidgetCreeParam import MonWidgetCreeParam 
 import browser
 import readercata
@@ -79,6 +80,7 @@ class JDCEditor(Ui_baseWidget,QtGui.QWidget):
         self.code = self.appliEficas.CONFIGURATION.code
         self.mode_nouv_commande=self.appliEficas.CONFIGURATION.mode_nouv_commande
         self.affiche=self.appliEficas.CONFIGURATION.affiche
+        #if self.code in ['MAP','CARMELCND','PSEN'] : self.afficheCommandesPliees=False
         if self.code in ['MAP','CARMELCND'] : self.afficheCommandesPliees=False
         if self.code in ['MAP',] : 
            self.widgetTree.close()
@@ -194,14 +196,31 @@ class JDCEditor(Ui_baseWidget,QtGui.QWidget):
                 if (not self.jdc.isvalid()) and (not self.nouveau) and (self.appliEficas.ssIhm == False):
                     self.viewJdcRapport()
  
-       # if self.code=="TELEMAC" : print "kkkkkkkk"
 
 
         if jdc_item:
             self.tree = browser.JDCTree( jdc_item,  self )
         self.appliEficas.construitMenu()
 
+    #-------------------#   Pour execution avec output sans une fenetre EFICAS. (erreurs encore dans la fenetre bash)
+    def runPSEN_2(self):   
     #-------------------#
+      if self.modified or self.fichier==None  :
+         QMessageBox.critical( self, tr( "Execution impossible "),tr("Sauvegarder SVP avant l'execution "))
+         return
+        
+      #monPython="/home/A96028/salome75/prerequisites/install/Python-273-tcl8513-tk8513/bin/python"
+      #monWrapper="/local00/home/A96028/GitEficasTravail/eficas/PSEN_Eficas/PSSEWrapper.py"
+      path1 = os.path.abspath(os.path.join(os.path.abspath(__file__), '../','../','PSEN_Eficas','PSEN'))
+      monWrapper = os.path.join(path1, 'PSSEWrapper.py')
+      cmd=['python',monWrapper]
+
+      w = ViewText2( self.QWParent, cmd )
+      w.setWindowTitle( "execution" )
+      w.exec_()
+
+
+    #-------------------#  Pour execution avec output et error dans le bash
     def runPSEN(self):
     #-------------------#
       if self.modified or self.fichier==None  :
@@ -209,19 +228,13 @@ class JDCEditor(Ui_baseWidget,QtGui.QWidget):
          return
         
       #lancement avec le .bat
-      textePython="PSEN_Path='EficasV2\PSEN_Eficas\PSEN\PSSEWrapper.py'\
-      \nimport subprocess\
-      \np=subprocess.Popen(['python',PSEN_Path])\
-      \n(out,err)=p.communicate()"
-      
- #lancement avec qteficas_psen.py      
-
-      #textePython='C:\Users\plscist\Desktop\Vico\sauveEficasPSEN~\EficasV1\PSEN_Eficas\PSEN\PSSEWrapper.py'
-      try :
-          self._viewTextExecute( textePython,"psen_run",".py")
-      except Exception, e:
-          print traceback.print_exc()
-
+      path1 = os.path.abspath(os.path.join(os.path.abspath(__file__), '../','../','PSEN_Eficas','PSEN'))
+      WrapperFilePath = os.path.join(path1, 'PSSEWrapper.py') 
+      import subprocess
+      p = subprocess.Popen(['python',WrapperFilePath])
+      (out,err)=p.communicate()        
+      print out
+      print err
 
     #--------------------------------#
     def _newJDC( self ,units = None):
@@ -236,6 +249,7 @@ class JDCEditor(Ui_baseWidget,QtGui.QWidget):
         if self.code == "CARMELCND" : texte=self._newJDCCND()
         if self.code == "ZCRACKS" : texte=self._newZCRACKS()
         if self.code == "TELEMAC" : texte=self._newTELEMAC()
+        if self.code == "PSEN" : texte = self._newPSEN()
         #   texte=self.newTexteCND
        
         jdc=self.readercata.cata[0].JdC( procedure =texte,
@@ -395,7 +409,7 @@ class JDCEditor(Ui_baseWidget,QtGui.QWidget):
         f.close()
         self.connect(self.monExe, SIGNAL("readyReadStandardOutput()"), self.readFromStdOut )
         self.connect(self.monExe, SIGNAL("readyReadStandardError()"), self.readFromStdErr )
-        exe='sh /tmp/test.sh'
+        exe='sh ' + nomFichier
         self.monExe.start(exe)
         self.monExe.closeWriteChannel()
         self.w.exec_()
@@ -440,6 +454,8 @@ class JDCEditor(Ui_baseWidget,QtGui.QWidget):
     def viewJdcRapport(self):
     #-----------------------#
         strRapport = unicode( self.jdc.report() )
+        # on ajoute les regles
+        
         self._viewText(strRapport, "JDC_RAPPORT")
 
     #----------------#
@@ -767,7 +783,6 @@ class JDCEditor(Ui_baseWidget,QtGui.QWidget):
     #-----------------------------------------------------------#
       if self.code == "MAP" and not(generator.plugins.has_key(format)): format = "MAP"
       if generator.plugins.has_key(format):
-         print "get_text_JDC"
          
          # Le generateur existe on l'utilise
          self.generator=generator.plugins[format]()
@@ -832,11 +847,11 @@ class JDCEditor(Ui_baseWidget,QtGui.QWidget):
 
           #textePython="ls -l"
           self._viewTextExecute( textePython,"map_run",".sh")
-          try:
-             commande="rm  "+self.fichierMapInput
-             os.system(commande)
-          except :
-             pass
+          #try:
+          #  commande="rm  "+self.fichierMapInput
+          #   os.system(commande)
+          #except :
+          #   pass
       except Exception, e:
           print traceback.print_exc()
 
@@ -1266,6 +1281,13 @@ class JDCEditor(Ui_baseWidget,QtGui.QWidget):
         #texte=""
         return texte
 
+    #---------------------------#
+    def _newPSEN(self):
+    #---------------------------#
+        texte="DIRECTORY() ; PSSE_PARAMETERS() ; SIMULATION() ; sansnom=DISTRIBUTION() ; sansnom=DISTRIBUTION() ; CORRELATION() ;"
+        #texte=""
+        return texte
+
     #---------------------------#
 
     #---------------------------#