X-Git-Url: http://www.iramuteq.org/git?a=blobdiff_plain;f=tabverges.py;h=24bcce793105f3e23421e07d26d79fd5f3c131dc;hb=refs%2Fheads%2F3.0;hp=8ba6619c6c353af5f75ae92baf47091ab1e1778f;hpb=6919f2ef8d85c176c7be824b606c4b71142e10fd;p=iramuteq diff --git a/tabverges.py b/tabverges.py index 8ba6619..24bcce7 100644 --- a/tabverges.py +++ b/tabverges.py @@ -1,50 +1,56 @@ -#!/bin/env python # -*- coding: utf-8 -*- #Author: Pierre Ratinaud -#Copyright (c) 2012 Pierre Ratinaud -#License: GNU GPL +#Copyright (c) 2008-2020 Pierre Ratinaud +#modification pour python 3 : Laurent Mérat, 6x7 - mai 2020 +#License: GNU/GPL +#------------------------------------ +# import des modules python +#------------------------------------ import os import string -import wx -import os import sys import tempfile -from chemins import ffr,FFF, ConstructPathOut -import wx.lib.sized_controls as sc from time import sleep + +#------------------------------------ +# import des modules wx +#------------------------------------ +import wx +import wx.lib.sized_controls as sc + +#------------------------------------ +# import des fichiers du projet +#------------------------------------ +from chemins import ffr,FFF, ConstructPathOut from functions import exec_rcode, check_Rresult, progressbar from PrintRScript import ProtoScript from analysematrix import AnalyseMatrix from dialog import ProtoDial + class Prototypical(AnalyseMatrix) : - def __init__(self, parent, parametres): - self.parent = parent - self.tableau = self.parent.tableau - self.parametres = parametres - self.parametres['filename'] = parent.tableau.parametre['filename'] - self.parametres['pathout'] = ConstructPathOut(parent.tableau.parametre['filename'], 'proto') - self.parametres['type'] = 'proto' - dlg = progressbar(self.parent, 2) - self.colnames = self.tableau.get_colnames() - AnalyseMatrix.__init__(self, parent, parent.tableau, self.parametres, dlg = dlg) - - def doanalyse(self) : - res = self.check_val() - return res - def check_val(self) : - self.dial = ProtoDial(self.ira, self.colnames) - self.dial.CenterOnParent() +# def __init__(self, parent, parametres): +# self.parent = parent +# self.tableau = self.parent.tableau +# self.parametres = parametres +# self.parametres['filename'] = parent.tableau.parametre['filename'] +# self.parametres['pathout'] = ConstructPathOut(parent.tableau.parametre['filename'], 'proto') +# self.parametres['type'] = 'proto' +# dlg = progressbar(self.parent, 2) +# self.colnames = self.tableau.get_colnames() +# AnalyseMatrix.__init__(self, parent, parent.tableau, self.parametres, dlg = dlg) + def doparametres(self, dlg = None): + self.dial = ProtoDial(self.ira, self.tableau.colnames) + self.dial.CenterOnParent() self.val = self.dial.ShowModal() if self.val==wx.ID_OK : self.ColSel1 = self.dial.variables.GetSelections() self.ColSel2 = self.dial.rangs.GetSelections() - if len(self.ColSel1) != len(self.ColSel2) : - print 'pas meme taille' + print('pas meme taille') self.check_val() else : if self.dial.choix_freq.GetSelection() == 0 : @@ -56,11 +62,23 @@ class Prototypical(AnalyseMatrix) : else : self.parametres['limrang'] = self.dial.ranglim.GetValue() self.parametres['freqmin'] = int(self.dial.m_textCtrl4.GetValue()) - table_assoc, table_rank = self.dotable() - self.makedatas(table_assoc, table_rank) - self.DoR() + if self.dial.typegraph.GetSelection() == 0 : + self.parametres['typegraph'] = 'classical' + self.parametres['cloud'] = False + elif self.dial.typegraph.GetSelection() == 1 : + self.parametres['typegraph'] = 'classical' + self.parametres['cloud'] = True + else : + self.parametres['typegraph'] = 'plan' + self.dial.Destroy() else : - return 'stop' + self.dial.Destroy() + self.parametres = None + + def doanalyse(self) : + table_assoc, table_rank = self.dotable() + self.makedatas(table_assoc, table_rank) + self.DoR() def dotable(self) : table_assoc = self.tableau.select_col(self.ColSel1) @@ -83,13 +101,11 @@ class Prototypical(AnalyseMatrix) : words[word] = [1, []] res = [[word, words[word][0], float(sum(words[word][1])) / len(words[word][1])] for word in words if len(words[word][1]) != 0 and words[word][0] >= self.parametres['freqmin']] with open(self.pathout['table.csv'], 'w') as f : - f.write('\n'.join(['\t'.join(['"' + val[0] +'"', `val[1]`, `val[2]`]) for val in res])) - self.parent.tableau.parametres = self.parent.tableau.parametre - self.parent.tableau.save_tableau(self.pathout['analyse.db']) + f.write('\n'.join(['\t'.join(['"' + val[0] +'"', repr(val[1]), repr(val[2])]) for val in res])) + #self.parent.tableau.parametres = self.parent.tableau.parametre + #self.parent.tableau.save_tableau(self.pathout['analyse.db']) def DoR(self) : script = ProtoScript(self) script.make_script() self.doR(script.scriptout) - -