Salome HOME
[fix] Calling Python api for check_boundary instead of Popen
authorYOANN AUDOUIN <B61570@dsp0919998.atlas.edf.fr>
Wed, 2 Dec 2020 14:39:26 +0000 (15:39 +0100)
committerYOANN AUDOUIN <B61570@dsp0919998.atlas.edf.fr>
Wed, 2 Dec 2020 14:39:26 +0000 (15:39 +0100)
src/HYDROGUI/HYDROSOLVERGUI.py
src/salome_hydro/checkBoundariesDialog.py

index 8ab7a44d605584247b3f3da72664ee89e40c60ff..1e030436fe67215c76dc045b87de058fd269245e 100755 (executable)
@@ -134,8 +134,8 @@ class GUIcontext:
 
         act = sgPyQt.createAction(\
                 GUIcontext.CHECK_BOUNDARY_CONDITIONS_ID,
-                "check boundary conditions",
-                "check boundary conditions",
+                "Check boundary conditions",
+                "Check boundary conditions",
                 "display a graph with boundary conditions on the mesh",
                 "check_boundary_conditions.png")
         sgPyQt.createMenu(act, mid)
index e066c7b620679dca2acde437ce381542a0f995ad..b0cb84f935daaecaf2d6373d18cf56fa842d260d 100644 (file)
@@ -50,7 +50,7 @@ class checkBoundariesDialog(QDialog):
         self.rb_liqbcd.setChecked(True)
         self.rb_allbcd.setChecked(False)
         self.liqbcd = True
-        
+
     def on_med_file_browse(self):
         """
         Select MED file
@@ -61,7 +61,7 @@ class checkBoundariesDialog(QDialog):
         if not self.medFile:
             return
         self.le_medFile.setText(self.medFile)
-        
+
     def on_bcd_file_browse(self):
         """
         Select bcd file
@@ -72,7 +72,7 @@ class checkBoundariesDialog(QDialog):
         if not self.bcdFile:
             return
         self.le_bcdFile.setText(self.bcdFile)
-        
+
     def on_liqbcd(self):
         """
         switch type of display
@@ -82,7 +82,7 @@ class checkBoundariesDialog(QDialog):
             self.liqbcd = True
         else:
             self.liqbcd = False
-        
+
     def on_help(self):
         """
         display a help message
@@ -91,19 +91,19 @@ class checkBoundariesDialog(QDialog):
         <h2>Display boundarycondition dialog</h2>
 
         This dialog is used to draw the mesh with colored boundary conditions on nodes.
-        <br><br>        
+        <br><br>
         The boundary condition file (bcd) associates a type of boundary condition to each concerned group in the mesh.
-        <br> 
-        The option "Liquid /solid boundaries" allows to distinguish all the differents boundary condition groups 
-        <br>     
+        <br>
+        The option "Liquid /solid boundaries" allows to distinguish all the differents boundary condition groups
+        <br>
         The option "All boundaries by Telemac type" allows to distinguish all the types of boundary conditions.
-        <br><br>         
+        <br><br>
         The drawing computation Is launch in a separate process, without waiting.
         It may be long, for a big mesh...
         """
         QMessageBox.about(self, self.tr("About change coordinates dialog"), msg);
-       
-   
+
+
     def on_accept(self):
         print("accept")
         #TODO check medfile in and out not empty
@@ -120,21 +120,23 @@ class checkBoundariesDialog(QDialog):
             msgBox.setText( "Boundary condition file does not exist" )
             msgBox.exec_()
             return
-        option = "--bnd"
+        bnd = True
+        liq_bnd = False
         if self.liqbcd:
-            option = "--liq-bnd"
-        cmd = ["plot.py", "mesh2d", medFile, "-b", bcdFile, option]
-        try:
-            proc = subprocess.Popen(cmd)
-        except OSError:
-            print("invalid command")
-            QMessageBox.critical(self, "command error", "%s is not found" % cmd[0])
+            bnd = False
+            liq_bnd = True
+        from postel.plot_actions import plot_mesh2d
+        from data_manip.extraction.telemac_file import TelemacFile
+
+        res = TelemacFile(medFile, bnd_file=bcdFile)
+        plot_mesh2d(res, display_bnd=bnd, display_liq_bnd=liq_bnd)
+        res.close()
         self.accept()
-        
+
     def on_reject(self):
         print("reject")
         self.reject()
-        
+
 
 def execDialog(context):
     print("execDialog")
@@ -142,4 +144,4 @@ def execDialog(context):
     study = context.study
     sg = context.sg
     dlg = checkBoundariesDialog()
-    dlg.exec_()        
+    dlg.exec_()