Salome HOME
Update copyrights
[modules/smesh.git] / src / Tools / blocFissure / ihm / fissureCoude_plugin.py
index 622f82ee6326eb74dff4f2105d63297e16a9412a..19aa8406458a9ae52efd812ae5a99cc34621e9e9 100644 (file)
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 
-# Copyright (C) 2006-2016  EDF R&D
+# Copyright (C) 2006-2019  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
 # if you already have plugins defined in a salome_plugins.py file, add this file at the end.
 # if not, copy this file as ${HOME}/Plugins/smesh_plugins.py or ${APPLI}/Plugins/smesh_plugins.py
 
-import sys, traceback
 import math
+import sys
+import traceback
+
 from blocFissure import gmu
 
+
 def fissureCoudeDlg(context):
-  # get context study, studyId, salomeGui
+  # get context study, salomeGui
   study = context.study
-  studyId = context.studyId
   sg = context.sg
   
   import os
   #import subprocess
   #import tempfile
   from qtsalome import QFileDialog, QMessageBox, QPalette, QColor, QDialog
-  from fissureCoude_ui import Ui_Dialog
+  from blocFissure.ihm.fissureCoude_ui import Ui_Dialog
   
   class fissureCoudeDialog(QDialog):
     
@@ -259,15 +261,14 @@ def fissureCoudeDlg(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 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)
@@ -286,9 +287,8 @@ def fissureCoudeDlg(context):
         fileNames = fileDiag.selectedFiles()
         filedef = fileNames[0]
         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")
@@ -301,8 +301,8 @@ def fissureCoudeDlg(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)