line[5] = str(float(line[5].replace(',', '.')))[0:7]
return [i, int(line[0]), int(line[1]), float(line[2]), float(line[3]), line[6], line[4], line[5]]
-def ReadProfileAsDico(parent, File, Alceste=False, encoding = sys.getdefaultencoding()):
+def ReadProfileAsDico(File, Alceste=False, encoding = sys.getdefaultencoding()):
#print 'lecture des profils : ReadProfileAsDico'
#if Alceste :
# print 'lecture du dictionnaire de type'
dictlem = {}
print 'lecture des profiles'
#encoding = sys.getdefaultencoding()
- print encoding
FileReader = codecs.open(File, 'r', encoding)
Filecontent = FileReader.readlines()
FileReader.close()
DictProfile[cluster] = [valclusters[i]] + prof[i]
return DictProfile
-def GetTxtProfile(dictprofile) :
+def GetTxtProfile(dictprofile, cluster_size) :
proflist = []
for classe in range(0, len(dictprofile)) :
prof = dictprofile[str(classe + 1)]
- clinfo = prof[0]
+ clinfo = cluster_size[classe]
proflist.append('\n'.join([' '.join(['classe %i' % (classe + 1), '-', '%s uce sur %s - %s%%' % (clinfo[0], clinfo[1], clinfo[2])]), '\n'.join(['%5s|%5s|%6s|%6s|%8s|%8s|%20s\t%10s' % tuple([str(val) for val in line]) for line in prof if len(line)==8])]))
return '\n\n'.join(proflist)
txt += exc
dial = BugDialog(parent)
- #for line in formatExceptionInfo():
- # if type(line) == type([]):
- # for don in line:
- # txt += don.replace(' ', ' ')
- # else:
- # txt += line + '\n'
if 'Rerror' in dir(parent) :
txt += parent.Rerror
parent.Rerror = ''
- #if error is not None :
- # txt += '\n%s\n' %error
- print formatExceptionInfo()
- log.error(txt)
+ log.info(txt)
dial.text_ctrl_1.write(txt)
dial.CenterOnParent()
dial.ShowModal()
- #raise Exception('Bug')
+ dial.Destroy()
def PlaySound(parent):
if parent.pref.getboolean('iramuteq', 'sound') :
i += 1
return dict, first
+def exec_RCMD(rpath, command) :
+ log.info('R CMD INSTALL %s' % command)
+ rpath = rpath.replace('\\','\\\\')
+ error = call(["%s" % rpath, 'CMD', 'INSTALL', "%s" % command])
+ return error
+
def exec_rcode(rpath, rcode, wait = True, graph = False):
log.info("R Script : %s" % rcode)
needX11 = False
if error[1] is None :
error[1] = 'None'
parent.Rerror = '\n'.join([str(pid.returncode), '\n'.join(error)])
- try :
- raise Exception('\n'.join(u'Erreur R', '\n'.join(error[1:])))
- except :
- BugReport(parent)
+ #try :
+ raise Exception('\n'.join([u'Erreur R', '\n'.join(error[1:])]))
+ return False
+ #except :
+ # BugReport(parent)
else :
if pid != 0 :
- try :
- raise Exception(u'Erreur R')
- except :
- BugReport(parent)
+ #try :
+ raise Exception(u'Erreur R')
+ return False
+ #except :
+ # BugReport(parent)
def print_liste(filename,liste):
with open(filename,'w') as f :
ncontent=[line.replace('\n','').split(';') for line in content if line.strip() != '']
return ncontent
-class MessageImage(wx.Dialog):
+class MessageImage(wx.Frame):
def __init__(self, parent,title, size):
- wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = title, pos = wx.DefaultPosition, size = size, style = wx.DEFAULT_DIALOG_STYLE )
+ wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = title, pos = wx.DefaultPosition, size = size, style = wx.DEFAULT_FRAME_STYLE )
self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
self.imageFile = False
self.imagename = u"chi_classe.png"