1 # Copyright (C) 2016-2020 EDF R&D
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 from subprocess import Popen
21 from os import remove, getpid, path
28 def message(typ, message, goOn=False):
30 log.message(typ,message,goOn)
33 def __init__(self, tmpDir, tmpFile='Messages.txt'):
34 self.tmpFile=path.join(tmpDir,tmpFile)
41 f = open(self.tmpFile,'w')
42 f.write('\n ------------------------------\n')
43 f.write(' | BIENVENUE DANS L\'INTERFACE |\n')
44 f.write(' | ZCRACKS DE SALOME |\n')
45 f.write(' | VERSION BETA |\n')
46 f.write(' ------------------------------\n\n')
50 fenName='Zcracks message log'
51 proc = Popen(['xterm -T "%s" -e "tail -s 0.05 -f %s --pid=%d"' %(fenName,self.tmpFile,pid)], shell=True)
54 def message(self, typ, message='', goOn=False):
56 f = open(fileName,'a')
58 f.write('ERROR: '+message+'\n')
59 #print 'ERROR: '+message
63 elif typ in ['A','W']:
64 #print ARNING: '+message
65 f.write('WARNING: '+message+'\n')
67 elif typ in ['M','I']:
68 #print 'INFO: '+message