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