# -*- 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):
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)
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")
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)