X-Git-Url: http://iramuteq.org/git?a=blobdiff_plain;f=tabfrequence.py;h=9d5876983a0bd9479d13f2c9fa1b74e42b6fc0a0;hb=916692a81898bdf694bfcf73f6c5e6a7d3bba8d0;hp=376c8bf557946b59534f6aaa1be59f3d50333765;hpb=ae0a736d9598a3483ccf2b35e3b61d365cf77db4;p=iramuteq diff --git a/tabfrequence.py b/tabfrequence.py index 376c8bf..9d58769 100644 --- a/tabfrequence.py +++ b/tabfrequence.py @@ -1,27 +1,39 @@ -#!/bin/env python # -*- coding: utf-8 -*- #Author: Pierre Ratinaud -#Copyright (c) 2008 Pierre Ratinaud +#Copyright (c) 2008-2020 Pierre Ratinaud +#modification pour python 3 : Laurent Mérat, 6x7 - mai 2020 #License: GNU/GPL -#from __future__ import division +#------------------------------------ +# import des modules python +#------------------------------------ import os -import wx -from chemins import ffr, FFF import tempfile from time import sleep +from operator import itemgetter + +#------------------------------------ +# import des modules wx +#------------------------------------ +import wx + +#------------------------------------ +# import des fichiers du projet +#------------------------------------ +from chemins import ffr, FFF from analysematrix import AnalyseMatrix from functions import exec_rcode, check_Rresult from dialog import FreqDialog from PrintRScript import PrintRScript, FreqMultiScript -from operator import itemgetter + class Frequences(AnalyseMatrix) : + def doparametres(self, dlg=None) : if dlg is None : return else : - dial = FreqDialog(self.parent, self.tableau.get_colnames(), u"Fréquences") + dial = FreqDialog(self.parent, self.tableau.get_colnames(), "Fréquences") dial.CenterOnParent() val = dial.ShowModal() if val == wx.ID_OK : @@ -31,7 +43,7 @@ class Frequences(AnalyseMatrix) : else : self.parametres = None dial.Destroy() - + def doanalyse(self): self.pathout.createdir(self.parametres['pathout']) header = self.tableau.get_colnames() @@ -56,7 +68,6 @@ class Frequences(AnalyseMatrix) : titles <- %s compteur <- 1 """ % (sel, listfiles, titles) - if self.parametres['NA'] : txt += """ countNA <- TRUE @@ -65,7 +76,6 @@ class Frequences(AnalyseMatrix) : txt += """ countNA <- FALSE """ - txt += """ for (i in select) { if (countNA) { @@ -110,7 +120,7 @@ class Frequences(AnalyseMatrix) : self.Rscript.write() self.doR(self.Rscript.scriptout) self.dolayout() - + def dolayout(self): listtab = [] tab = [] @@ -120,20 +130,20 @@ class Frequences(AnalyseMatrix) : content.pop(0) content = ['\t'.join(line.split('\t')[1:]).replace('"','') for line in content] content = '\n'.join(content) - content = content.split(u'***\t****\t****') + content = content.split('***\t****\t****') content = [[line.split('\t') for line in tab.splitlines() if line.split('\t') != ['']] for tab in content] listtab = [tab for tab in content if tab != []] texte = '' #for ligne in content: # ligne = ligne.replace('"', '') # ligne = ligne.split('\t') - # if ligne[1] == u'***' : + # if ligne[1] == '***' : # if tab != []: # listtab.append(tab) # tab = [] # else : # tab.append(ligne) - pretexte = u''' + pretexte = '''
\n