Salome HOME
Merge V9_dev branch into master
[modules/smesh.git] / src / Tools / blocFissure / ihm / fissureGenerale_plugin.py
index 832c06c37f304d730b1790bb693d3f59c29b1dfe..2924f176fb4206201f27553b8e4b348dbcc5232d 100644 (file)
@@ -27,9 +27,8 @@ import math
 from blocFissure import gmu
 
 def fissureGeneraleDlg(context):
-  # get context study, studyId, salomeGui
+  # get context study, salomeGui
   study = context.study
-  studyId = context.studyId
   sg = context.sg
 
   import os
@@ -42,7 +41,7 @@ def fissureGeneraleDlg(context):
   from PyQt5.QtWidgets import QMessageBox
   from PyQt5.QtGui import QPalette
   from PyQt5.QtGui import QColor
-  from fissureGenerale_ui import Ui_Dialog
+  from blocFissure.ihm.fissureGenerale_ui import Ui_Dialog
 
   class fissureGeneraleDialog(QtWidgets.QDialog):
 
@@ -181,9 +180,8 @@ def fissureGeneraleDlg(context):
 
     def writeDefault(self, dico):
       filedef = self.fileDefault()
-      f = open(filedef, 'w')
-      f.write(str(dico))
-      f.close()
+      with open(filedef, 'w') as f:
+          f.write(str(dico))
 
     def genereExemples(self):
       maillageSain      = os.path.join(gmu.pathBloc, 'materielCasTests/CubeAngle.med')
@@ -200,8 +198,8 @@ def fissureGeneraleDlg(context):
     def readValPrec(self):
       filedef = self.fileDefault()
       if os.path.exists(filedef):
-        f = open(filedef, 'r')
-        txt = f.read()
+        with open(filedef, 'r') as f:
+            txt = f.read()
         dico = eval(txt)
         print(dico)
         self.initDialog(dico)
@@ -236,9 +234,8 @@ def fissureGeneraleDlg(context):
         if filedef[-4:] not in ['.dic']:
           filedef += '.dic'
         dico = self.creeDico()
-        f = open(filedef, 'w')
-        f.write(str(dico))
-        f.close()
+        with open(filedef, 'w') as f:
+          f.write(str(dico))
 
     def recharger(self):
       print("recharger")
@@ -251,8 +248,8 @@ def fissureGeneraleDlg(context):
         filedef = fileNames[0]
         print(filedef)
         if os.path.exists(filedef):
-          f = open(filedef, 'r')
-          txt = f.read()
+          with open(filedef, 'r') as f:
+            txt = f.read()
           dico = eval(txt)
           print(dico)
           self.initDialog(dico)