From: Pierre Ratinaud Date: Fri, 18 Jul 2014 23:25:59 +0000 (+0200) Subject: ... X-Git-Url: http://iramuteq.org/git?a=commitdiff_plain;h=54fef96ad151ba25920f3e589b39a83c3f62ae2c;p=iramuteq ... --- diff --git a/KeyFrame.py b/KeyFrame.py index 5ad7f92..4ec826c 100755 --- a/KeyFrame.py +++ b/KeyFrame.py @@ -43,7 +43,7 @@ class AlcOptFrame(wx.Dialog): 'nr' : [wx.NewId(),wx.NewId(),u"Formes non reconnues"], } self.parent=parent - self.keys=self.parent.parent.keys + self.keys=self.parent.keys self.listlabel=[] self.listspin=[] self.listbutton=[] @@ -73,7 +73,7 @@ class AlcOptFrame(wx.Dialog): #self.Bind(wx.EVT_BUTTON, self.OnApply, self.button_val) - self.dico=self.parent.parent.parent.lexique#'dictionnaires/lexique.txt') + self.dico=self.parent.parent.lexique#'dictionnaires/lexique.txt') self.__set_properties() self.__do_layout() diff --git a/Liste.py b/Liste.py index 85abc69..737120e 100644 --- a/Liste.py +++ b/Liste.py @@ -174,7 +174,7 @@ class ListPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.ColumnSorte lems = corpus.getlems() rep = [] for forme in lems[word].formes : - rep.append([corpus.getforme(forme).forme, corpus.getforme(forme).freq]) + rep.append([corpus.getforme(forme).forme, corpus.getforme(forme).freq]) rep.sort(key = itemgetter(1), reverse = True) win = message(self, u"Formes associées", (300, 200)) win.html = '\n' + '
'.join([' : '.join([str(val) for val in forme]) for forme in rep]) + '\n' @@ -186,7 +186,9 @@ class ListPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.ColumnSorte item = self.getColumnText(self.GetFirstSelected(), 0) uce_ok = corpus.getlemuces(item) ucis_txt, ucestxt = doconcorde(corpus, uce_ok, [item]) - win = message(self, u"Concordancier", (750, 600)) - win.html = ('\n

%s

' % item) + '
'.join(['
'.join([ucis_txt[i], ucestxt[i]]) for i in range(0,len(ucestxt))]) + '\n' - win.HtmlPage.SetPage(win.html) + items = dict([[i, '

'.join([ucis_txt[i], ucestxt[i]])] for i in range(0,len(ucestxt))]) + win = message(self, items, u"Concordancier - %s" % item, (800, 500)) + #win = message(self, u"Concordancier", (750, 600)) + #win.html = ('\n

%s

' % item) + '
'.join(['
'.join([ucis_txt[i], ucestxt[i]]) for i in range(0,len(ucestxt))]) + '\n' + #win.HtmlPage.SetPage(win.html) win.Show(True) diff --git a/PrintRScript.py b/PrintRScript.py index c84efa9..c30276f 100644 --- a/PrintRScript.py +++ b/PrintRScript.py @@ -293,7 +293,7 @@ def RchdQuest(DicoPath, RscriptPath, nbcl = 10, mincl = 10): chd.result<-Rchdquest("%s","%s","%s", nbt = nbt, mincl = mincl) n1 <- chd.result$n1 classeuce1 <- chd.result$cuce1 - """ % (DicoPath['mat01'], DicoPath['listeuce1'], DicoPath['uce']) + """ % (DicoPath['mat01.csv'], DicoPath['listeuce1'], DicoPath['uce']) txt += """ tree_tot1 <- make_tree_tot(chd.result$chd) @@ -848,7 +848,7 @@ class PrintSimiScript(PrintRScript) : if self.parametres['type_graph'] == 1 : graphnb = 1 type = 'nplot' - dirout = os.path.dirname(self.pathout['mat01']) + dirout = os.path.dirname(self.pathout['mat01.csv']) while os.path.exists(os.path.join(dirout,'graph_simi_'+str(graphnb)+'.png')): graphnb +=1 self.filename = ffr(os.path.join(dirout,'graph_simi_'+str(graphnb)+'.png')) @@ -856,7 +856,7 @@ class PrintSimiScript(PrintRScript) : if self.parametres['type_graph'] == 3 : graphnb = 1 type = 'web' - dirout = os.path.dirname(self.pathout['mat01']) + dirout = os.path.dirname(self.pathout['mat01.csv']) while os.path.exists(os.path.join(dirout,'web_'+str(graphnb))): graphnb +=1 self.filename = ffr(os.path.join(dirout,'web_'+str(graphnb))) @@ -865,7 +865,7 @@ class PrintSimiScript(PrintRScript) : if self.parametres['type_graph'] == 4 : graphnb = 1 type = 'rglweb' - dirout = os.path.dirname(self.pathout['mat01']) + dirout = os.path.dirname(self.pathout['mat01.csv']) while os.path.exists(os.path.join(dirout,'webrgl_'+str(graphnb))): graphnb +=1 self.filename = ffr(os.path.join(dirout,'webrgl_'+str(graphnb))) @@ -1149,6 +1149,12 @@ class ProtoScript(PrintRScript) : self.sources([self.analyse.parent.RscriptsPath['Rgraph'], self.analyse.parent.RscriptsPath['prototypical.R']]) self.packages(['wordcloud']) txt = """ + errorn <- function(x) { + qnorm(0.975)*sd(x)/sqrt(lenght(n)) + } + errort <- function(x) { + qt(0.975,df=lenght(x)-1)*sd(x)/sqrt(lenght(x)) + } mat <- read.csv2("%s", header = FALSE, row.names=1, sep='\t', quote='"', dec='.') open_file_graph("%s",height=800, width=1000) prototypical(mat, mfreq = %s, mrank = %s, cloud = FALSE, cexrange=c(1,2.4), cexalpha= c(0.4, 1)) @@ -1164,4 +1170,25 @@ class ExportAfc(PrintRScript) : self.packages(['rgexf']) txt = """ """ - + +class TgenSpecScript(PrintRScript): + def make_script(self): + self.packages(['textometry']) + txt = """ + tgen <- read.csv2("%s", row.names = 1, sep = '\\t') + """ % self.parametres['tgeneff'] + txt += """ + tot <- tgen[nrow(tgen), ] + result <- NULL + tgen <- tgen[-nrow(tgen),] + for (i in 1:nrow(tgen)) { + mat <- rbind(tgen[i,], tot - tgen[i,]) + specmat <- specificities(mat) + result <- rbind(result, specmat[1,]) + } + colnames(result) <- colnames(tgen) + row.names(result) <- rownames(tgen) + write.table(result, file = "%s", sep='\\t', col.names = NA) + """ % self.pathout['tgenspec.csv'] + self.add(txt) + diff --git a/ProfList.py b/ProfList.py index 1bc2c60..e882f7e 100644 --- a/ProfList.py +++ b/ProfList.py @@ -511,7 +511,7 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col act = {} tableau.chi = {} tableau.lchi = self.lchi - tableau.parametre['fromprof'] = True + tableau.parametres['fromprof'] = True for i, val in enumerate(self.la) : act[val] = [self.lfreq[i]] tableau.chi[val] = [self.lchi[i]] @@ -600,10 +600,11 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col nuces = [val[1] for val in ntab2] dlg.Update(3, u'concordancier...') ucis_txt, ucestxt = doconcorde(corpus, nuces, self.la, uci = uci) + items = dict([[i, '
'.join([ucis_txt[i], '
score : %.2f

' % ntab2[i][0], ucestxt[i]])] for i in range(0,len(ucestxt))]) dlg.Update(4, u'texte...') - win = message(self, u"Segments de texte caractéristiques - Classe %i" % self.cl, (750, 600)) - win.html = '\n' + '
'.join(['
'.join([ucis_txt[i], '
score : %.2f
' % ntab2[i][0], ucestxt[i]]) for i in range(0,len(ucestxt))]) + '\n' - win.HtmlPage.SetPage(win.html) + win = message(self, items, u"Segments de texte caractéristiques - Classe %i" % self.cl, (750, 600)) + #win.html = '\n' + '
'.join(['
'.join([ucis_txt[i], '
score : %.2f
' % ntab2[i][0], ucestxt[i]]) for i in range(0,len(ucestxt))]) + '\n' + #win.HtmlPage.SetPage(win.html) dlg.Destroy() win.Show(True) @@ -708,16 +709,19 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col ucef += list(set(corpus.getlemucis(word)).intersection(uces)) uci = True ucis_txt, ucestxt = doconcorde(corpus, ucef, ListWord, uci = uci) - win = message(self, title, size=(750, 600)) - win.html = ('\n

%s

' % ' '.join(ListWord)) + '
'.join(['
'.join([ucis_txt[i], ucestxt[i]]) for i in range(0,len(ucestxt))]) + '\n' - win.HtmlPage.SetPage(win.html) + items = dict([[i, '

'.join([ucis_txt[i], ucestxt[i]])] for i in range(0,len(ucestxt))]) + win = message(self, items, title, (800, 500)) + #win = message(self, title, size=(750, 600)) + #win.html = ('\n

%s

' % ' '.join(ListWord)) + '
'.join(['
'.join([ucis_txt[i], ucestxt[i]]) for i in range(0,len(ucestxt))]) + '\n' + #win.HtmlPage.SetPage(win.html) return win def OnPopupTwo(self, event): - corpus = self.Source.corpus - uces = corpus.lc[self.cl-1] - win = self.make_concord(uces, "Concordancier - Classe %i" % self.cl) - win.Show(True) + if 'corpus' in dir(self.Source) : + corpus = self.Source.corpus + uces = corpus.lc[self.cl-1] + win = self.make_concord(uces, "Concordancier - Classe %i" % self.cl) + win.Show(True) def OnPopupThree(self, event): corpus = self.Source.corpus @@ -780,9 +784,11 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col nb = len(ucef) rep.append([corpus.getforme(forme).forme, nb]) rep.sort(key = itemgetter(1), reverse = True) - win = message(self, u"Formes associées", wx.Size(300, 200)) - win.html = '\n' + '
'.join([' : '.join([str(val) for val in forme]) for forme in rep]) + '\n' - win.HtmlPage.SetPage(win.html) + #win = message(self, u"Formes associées", wx.Size(300, 200)) + items = dict([[i, '\t:\t'.join([str(val) for val in forme])] for i, forme in enumerate(rep)]) + win = message(self, items, u"Formes associées", (300, 200)) + #win.html = '\n' + '
'.join([' : '.join([str(val) for val in forme]) for forme in rep]) + '\n' + #win.HtmlPage.SetPage(win.html) win.Show(True) diff --git a/Rscripts/Rgraph.R b/Rscripts/Rgraph.R index da03d5b..39fe618 100644 --- a/Rscripts/Rgraph.R +++ b/Rscripts/Rgraph.R @@ -242,6 +242,107 @@ stopoverlap <- function(x, cex.par = NULL, xlim = NULL, ylim = NULL) { } ############################################################################### +getwordcloudcoord <- function(words,freq,scale=c(4,.5),min.freq=3,max.words=Inf,random.order=TRUE,random.color=FALSE, + rot.per=.1,colors="black",ordered.colors=FALSE,use.r.layout=FALSE,fixed.asp=TRUE,...) { + tails <- "g|j|p|q|y" + last <- 1 + + overlap <- function(x1, y1, sw1, sh1) { + if(!use.r.layout) + return(.overlap(x1,y1,sw1,sh1,boxes)) + s <- 0 + if (length(boxes) == 0) + return(FALSE) + for (i in c(last,1:length(boxes))) { + bnds <- boxes[[i]] + x2 <- bnds[1] + y2 <- bnds[2] + sw2 <- bnds[3] + sh2 <- bnds[4] + if (x1 < x2) + overlap <- x1 + sw1 > x2-s + else + overlap <- x2 + sw2 > x1-s + + if (y1 < y2) + overlap <- overlap && (y1 + sh1 > y2-s) + else + overlap <- overlap && (y2 + sh2 > y1-s) + if(overlap){ + last <<- i + return(TRUE) + } + } + FALSE + } + + ord <- rank(-freq, ties.method = "random") + words <- words[ord<=max.words] + freq <- freq[ord<=max.words] + + + ord <- order(freq,decreasing=TRUE) + words <- words[ord] + freq <- freq[ord] + words <- words[freq>=min.freq] + freq <- freq[freq>=min.freq] + if (ordered.colors) { + colors <- colors[ord][freq>=min.freq] + } + + thetaStep <- .1 + rStep <- .05 + plot.new() + + normedFreq <- freq/max(freq) + size <- (scale[1]-scale[2])*normedFreq + scale[2] + boxes <- list() + toplot <- NULL + + + for(i in 1:length(words)){ + rotWord <- runif(1)0 && y1-.5*ht>0 && + x1+.5*wid<1 && y1+.5*ht<1){ + toplot <- rbind(toplot, c(x1,y1,size[i], i)) + boxes[[length(boxes)+1]] <- c(x1-.5*wid,y1-.5*ht,wid,ht) + isOverlaped <- FALSE + }else{ + if(r>sqrt(.5)){ + warning(paste(words[i], + "could not be fit on page. It will not be plotted.")) + isOverlaped <- FALSE + } + theta <- theta+thetaStep + r <- r + rStep*thetaStep/(2*pi) + x1 <- .5+r*cos(theta) + y1 <- .5+r*sin(theta) + } + } + } + toplot <- cbind(toplot,norm.vec(freq[toplot[,4]], 1, 50)) + row.names(toplot) <- words[toplot[,4]] + toplot <- toplot[,-4] + return(toplot) +} + make_tree_tot <- function (chd) { library(ape) lf<-chd$list_fille @@ -458,7 +559,7 @@ del.yellow <- function(colors) { tochange <- apply(rgbs, 2, is.yellow) tochange <- which(tochange) if (length(tochange)) { - gr.col <- grey.colors(length(tochange)) + gr.col <- grey.colors(length(tochange), start = 0.5) } compt <- 1 for (val in tochange) { @@ -497,6 +598,8 @@ make_afc_graph <- function(toplot, classes, clnb, xlab, ylab, cex.txt = NULL, le if (is.null(cex.txt)) text(toplot[,1],toplot[,2],rownames(toplot),col=cl.color, offset=0) else + #require(wordcloud) + #textplot(toplot[,1],toplot[,2],rownames(toplot),col=cl.color, cex = cex.txt, xlim=xminmax, ylim = yminmax) text(toplot[,1],toplot[,2],rownames(toplot),col=cl.color, cex = cex.txt, offset=0) if (!cmd) { @@ -532,7 +635,7 @@ plot.dendro.prof <- function(tree, classes, chisqtable, nbbycl = 60, type.dendro vec.mat <- matrix(1, nrow = 3, ncol = length(sum.cl)) vec.mat[2,] <- 2 vec.mat[3,] <- 3:(length(sum.cl)+2) - layout(matrix(vec.mat, nrow=3, ncol=length(sum.cl)),heights=c(1,1,6)) + layout(matrix(vec.mat, nrow=3, ncol=length(sum.cl)),heights=c(2,1,6)) if (! bw) { col <- rainbow(length(sum.cl))[as.numeric(tree$tip.label)] col <- del.yellow(col) @@ -545,7 +648,7 @@ plot.dendro.prof <- function(tree, classes, chisqtable, nbbycl = 60, type.dendro } else { tree[[2]]<-paste('classe ',tree[[2]]) } - par(mar=c(1,1,0,1)) + par(mar=c(2,1,0,1)) plot.phylo(tree,label.offset=0, tip.col=col, type=type.dendro, direction = 'downwards', srt=90, adj = 0.5, cex = 1.4, y.lim=c(-0.3,tree$Nnode)) par(mar=c(0,0,0,0)) d <- barplot(-sum.cl[tree.order], col=col, names.arg='', axes=FALSE, axisname=FALSE) @@ -981,3 +1084,43 @@ simi.to.gexf <- function(fileout, graph.simi, nodes.attr = NULL) { col <- t(sapply(col, col2rgb, alpha=TRUE)) write.gexf(nodes, edges, output=fileout, nodesAtt=nodesatt, nodesVizAtt=list(color=col,position=lo)) } + + +graph.to.file <- function(grah.simi, nodesfile = NULL, edgesfile = NULL, community = FALSE, color = NULL, sweight = NULL) { + require(igraph) + g <- graph.simi$graph + V(g)$weight <- graph.simi$eff + V(g)$x <- graph.simi$layout[,1] + V(g)$y <- graph.simi$layout[,2] + if (ncol(graph.simi$layout) == 3) { + V(g)$z <- graph.simi$layout[,3] + } + if (community) { + member <- graph.simi$communities$membership + col <- rainbow(max(member)) + v.colors <- col[member] + v.colors <- col2rgb(v.colors) + V(g)$r <- v.colors[1,] + V(g)$g <- v.colors[2,] + V(g)$b <- v.colors[3,] + } + if (!is.null(color)) { + v.colors <- col2rgb(color) + V(g)$r <- v.colors[1,] + V(g)$g <- v.colors[2,] + V(g)$b <- v.colors[3,] + } + if (!is.null(sweight)) { + V(g)$sweight <- sweight + } + df <- get.data.frame(g, what='both') + if (!is.null(nodesfile)) { + write.table(df$vertices, nodesfile, sep='\t') + } + if (!is.null(edgesfile)) { + write.table(df$edges, edgesfile, sep='\t') + } + if (is.null(edgesfile) & is.null(nodesfile)) { + df + } +} diff --git a/Rscripts/afc_lex.R b/Rscripts/afc_lex.R index b84b4b1..a890db1 100644 --- a/Rscripts/afc_lex.R +++ b/Rscripts/afc_lex.R @@ -1,6 +1,6 @@ #Author: Pierre Ratinaud #Copyright (c) 20011 Pierre Ratinaud -#Lisense: GNU/GPL +#License: GNU/GPL #fichier genere par IRaMuTeq diff --git a/Rscripts/chdquest.R b/Rscripts/chdquest.R index e8ad294..6a271aa 100644 --- a/Rscripts/chdquest.R +++ b/Rscripts/chdquest.R @@ -1,6 +1,6 @@ #Author: Pierre Ratinaud #Copyright (c) 2008-2009 Pierre Ratinaud -#Lisense: GNU/GPL +#License: GNU/GPL fille<-function(classe,classeuce) { listfm<-unique(unlist(classeuce[classeuce[,classe%/%2]==classe,])) diff --git a/Rscripts/prototypical.R b/Rscripts/prototypical.R index 8d3c634..dddd7cb 100644 --- a/Rscripts/prototypical.R +++ b/Rscripts/prototypical.R @@ -63,3 +63,8 @@ prototypical <- function(x, mfreq = NULL, mrank = NULL, cexrange=c(0.8, 3), cexa mtext(paste('<', mfreq, ' Fréquences ', '>=', mfreq, sep = ' '), side=2, line=1, cex=1, col="red", outer=TRUE) mtext(paste('<=', mrank, ' Rangs ', '>', mrank, sep = ' '), side=3, line=1, cex=1, col="red", outer=TRUE) } + +intervalle.freq <- function(x, SX=NULL) { + errorn <- (x/SX) + (1.96 * sqrt(((x/SX) * (1-(x/SX))/SX))) + print(errorn) +} diff --git a/Rscripts/simi.R b/Rscripts/simi.R index 2564e2e..9f4b52b 100644 --- a/Rscripts/simi.R +++ b/Rscripts/simi.R @@ -143,7 +143,7 @@ do.simi <- function(x, method = 'cooc',seuil = NULL, p.type = 'tkplot',layout.ty w<-E(g.toplot)$weight tovire <- which(w<=seuil) g.toplot <- delete.edges(g.toplot,(tovire)) - for (i in 0:(length(V(g.toplot)))) { + for (i in 1:(length(V(g.toplot)))) { if (length(neighbors(g.toplot,i))==0) { vec<-append(vec,i) } @@ -151,7 +151,9 @@ do.simi <- function(x, method = 'cooc',seuil = NULL, p.type = 'tkplot',layout.ty g.toplot <- delete.vertices(g.toplot,vec) v.label <- V(g.toplot)$name if (!is.logical(vec)) mat.eff <- mat.eff[-(vec)] - } + } else { + vec <- NULL + } if (!is.null(minmaxeff[1])) { eff<-norm.vec(mat.eff,minmaxeff[1],minmaxeff[2]) @@ -217,7 +219,7 @@ do.simi <- function(x, method = 'cooc',seuil = NULL, p.type = 'tkplot',layout.ty com <- NULL } - out <- list(graph = g.toplot, mat.eff = mat.eff, eff = eff, mat = mat.simi, v.label = v.label, we.width = we.width, we.label=we.label, label.cex = label.cex, layout = lo, communities = com, halo = halo) + out <- list(graph = g.toplot, mat.eff = mat.eff, eff = eff, mat = mat.simi, v.label = v.label, we.width = we.width, we.label=we.label, label.cex = label.cex, layout = lo, communities = com, halo = halo, elim=vec) } plot.simi <- function(graph.simi, p.type = 'tkplot',filename=NULL, communities = NULL, vertex.col = 'red', edge.col = 'black', edge.label = TRUE, vertex.label=TRUE, vertex.label.color = 'black', vertex.label.cex= NULL, vertex.size=NULL, leg=NULL, width = 800, height = 800, alpha = 0.1, cexalpha = FALSE, movie = NULL, svg = FALSE) { @@ -270,14 +272,14 @@ plot.simi <- function(graph.simi, p.type = 'tkplot',filename=NULL, communities = } par(pch=' ') if (is.null(graph.simi$com)) { - plot(g.toplot,vertex.label='', edge.width=we.width, vertex.size=vertex.size, vertex.color=vertex.col, vertex.label.color='white', edge.label=we.label, edge.label.cex=cex, edge.color=edge.col, vertex.label.cex = 0, layout=lo)#, rescale = FALSE) + plot(g.toplot,vertex.label='', edge.width=we.width, vertex.size=vertex.size, vertex.color=vertex.col, vertex.label.color='white', edge.label=we.label, edge.label.cex=cex, edge.color=edge.col, vertex.label.cex = 0, layout=lo, edge.curved=FALSE)#, rescale = FALSE) } else { if (graph.simi$halo) { mark.groups <- communities(graph.simi$com) } else { mark.groups <- NULL } - plot(com, g.toplot,vertex.label='', edge.width=we.width, vertex.size=vertex.size, vertex.color=vertex.col, vertex.label.color='white', edge.label=we.label, edge.label.cex=cex, edge.color=edge.col, vertex.label.cex = 0, layout=lo, mark.groups = mark.groups) + plot(com, g.toplot,vertex.label='', edge.width=we.width, vertex.size=vertex.size, vertex.color=vertex.col, vertex.label.color='white', edge.label=we.label, edge.label.cex=cex, edge.color=edge.col, vertex.label.cex = 0, layout=lo, mark.groups = mark.groups, edge.curved=FALSE) } #txt.layout <- lo txt.layout <- layout.norm(lo, -1, 1, -1, 1, -1, 1) diff --git a/analysematrix.py b/analysematrix.py index 7b861a6..7fe67b5 100644 --- a/analysematrix.py +++ b/analysematrix.py @@ -2,13 +2,12 @@ # -*- coding: utf-8 -*- #Author: Pierre Ratinaud #Copyright (c) 2013 Pierre Ratinaud -#Lisense: GNU GPL +#License: GNU GPL import logging import os -from time import time from uuid import uuid4 @@ -17,26 +16,37 @@ from functions import exec_rcode, check_Rresult, DoConf from time import time, sleep from openanalyse import OpenAnalyse + class AnalyseMatrix : def __init__(self, ira, tableau, parametres = None, dlg = False) : self.tableau = tableau + if self.tableau.csvtable is None : + self.tableau.open() self.ira = ira self.parent = ira self.dlg = dlg self.parametres = parametres self.val = False + self.parametres['pathout'] = PathOut(tableau.parametres['originalpath'], analyse_type = self.parametres['type'], dirout = tableau.parametres['pathout']).mkdirout() if not 'pathout' in self.parametres : - self.pathout = PathOut(tableau.parametres['filename'], analyse_type = parametres['type'], dirout = parametres['pathout']) + self.pathout = PathOut(tableau.parametres['originalpath'], analyse_type = self.parametres['type'], dirout = tableau.parametres['pathout']) else : - self.pathout = PathOut(filename = tableau.parametres['filename'], dirout = self.parametres['pathout'], analyse_type = self.parametres['type']) + self.pathout = PathOut(filename = tableau.parametres['originalpath'], dirout = self.parametres['pathout'], analyse_type = self.parametres['type']) - self.parametres['pathout'] = self.pathout.dirout + #self.parametres['pathout'] = self.pathout.dirout self.parametres['uuid'] = str(uuid4()) self.parametres['name'] = os.path.split(self.parametres['pathout'])[1] self.parametres['encoding'] = self.ira.syscoding - - self.t1 = time() - result_analyse = self.doanalyse() + self.parametres['matrix'] = self.tableau.parametres['uuid'] + self.tableau.pathout.dirout = self.parametres['pathout'] + self.doparametres(dlg = dlg) + if self.parametres is not None : + self.t1 = time() + if not os.path.exists(self.parametres['pathout']) : + self.pathout.createdir(self.parametres['pathout']) + result_analyse = self.doanalyse() + else : + result_analyse = False if result_analyse is None : self.time = time() - self.t1 minutes, seconds = divmod(self.time, 60) @@ -44,11 +54,11 @@ class AnalyseMatrix : self.parametres['time'] = '%.0fh %.0fm %.0fs' % (hours, minutes, seconds) self.parametres['ira'] = self.pathout['Analyse.ira'] DoConf().makeoptions([self.parametres['type']], [self.parametres], self.pathout['Analyse.ira']) - self.ira.history.addMatrix(self.parametres) + self.ira.history.addMatrixAnalyse(self.parametres) if dlg : dlg.Destroy() OpenAnalyse(self.parent, self.parametres['ira']) - #self.ira.tree.AddAnalyse(self.parametres) + self.ira.tree.AddMatAnalyse(self.parametres) self.val = 5100 else : self.val = False @@ -58,6 +68,9 @@ class AnalyseMatrix : def doanalyse(self) : pass + def doparametres(self, dlg = None): + pass + def doR(self, Rscript, wait = False, dlg = None, message = '') : #log.info('R code...') pid = exec_rcode(self.ira.RPath, Rscript, wait = wait) diff --git a/analysetxt.py b/analysetxt.py index ab19b3c..95fcfa2 100644 --- a/analysetxt.py +++ b/analysetxt.py @@ -4,14 +4,12 @@ # copyright : 2012-2013 (c) Pierre Ratinaud import logging -from chemins import PathOut, ChdTxtPathOut -from functions import exec_rcode, check_Rresult, DoConf, print_liste +from chemins import PathOut +from functions import exec_rcode, check_Rresult, DoConf, ReadDicoAsDico +from shutil import copy from time import time, sleep from uuid import uuid4 import os -from PrintRScript import RchdTxt, AlcesteTxtProf -from OptionAlceste import OptionAlc -from layout import PrintRapport from openanalyse import OpenAnalyse from dialog import StatDialog @@ -49,7 +47,15 @@ class AnalyseText : self.parametres['type'] = parametres['type'] self.parametres['encoding'] = self.ira.syscoding self.t1 = time() - self.corpus.make_lems(lem=self.parametres['lem']) + if not self.parametres.get('dictionary', False) : + self.corpus.make_lems(lem=self.parametres['lem']) + else : + dico = ReadDicoAsDico(self.parametres['dictionary']) + self.corpus.make_lems_from_dict(dico, dolem=self.parametres['lem']) + dictname = os.path.basename(self.parametres['dictionary']) + dictpath = os.path.join(self.pathout.dirout, dictname) + copy(self.parametres['dictionary'], dictpath) + self.parametres['dictionary'] = dictpath self.corpus.parse_active(gramact, gramsup) result_analyse = self.doanalyse() if result_analyse is None : @@ -79,7 +85,7 @@ class AnalyseText : def lemparam(self) : if self.dlg and self.lemdial: - dial = StatDialog(self, self.parent) + dial = StatDialog(self.parent, self.keys) dial.CenterOnParent() val = dial.ShowModal() if val == 5100 : @@ -88,6 +94,8 @@ class AnalyseText : else : lem = 0 self.parametres['lem'] = lem + if dial.radio_dictchoice.GetSelection() == 1 : + self.parametres['dictionary'] = dial.dictpath.GetValue() dial.Destroy() return self.parametres else : @@ -127,91 +135,7 @@ class AnalyseText : -class Alceste(AnalyseText) : - def doanalyse(self) : - self.parametres['type'] = 'alceste' - self.pathout.basefiles(ChdTxtPathOut) - self.actives, lim = self.corpus.make_actives_nb(self.parametres['max_actives'], 1) - self.parametres['eff_min_forme'] = lim - self.parametres['nbactives'] = len(self.actives) - uci = False - if self.parametres['classif_mode'] == 0 : - lenuc1, lenuc2 = self.corpus.make_and_write_sparse_matrix_from_uc(self.actives, self.parametres['tailleuc1'], self.parametres['tailleuc2'], self.pathout['TableUc1'], self.pathout['TableUc2'], self.pathout['listeuce1'], self.pathout['listeuce2']) - self.parametres['lenuc1'] = lenuc1 - self.parametres['lenuc2'] = lenuc2 - elif self.parametres['classif_mode'] == 1 : - self.corpus.make_and_write_sparse_matrix_from_uces(self.actives, self.pathout['TableUc1'], self.pathout['listeuce1']) - elif self.parametres['classif_mode'] == 2 : - self.corpus.make_and_write_sparse_matrix_from_uci(self.actives, self.pathout['TableUc1'], self.pathout['listeuce1']) - uci = True - Rscript = self.printRscript() - self.doR(Rscript, dlg=self.dlg, message='CHD...') - - self.corpus.make_ucecl_from_R(self.pathout['uce']) - self.corpus.make_and_write_profile(self.actives, self.corpus.lc, self.pathout['Contout'], uci = uci) - self.sup, lim = self.corpus.make_actives_nb(self.parametres['max_actives'], 2) - self.corpus.make_and_write_profile(self.sup, self.corpus.lc, self.pathout['ContSupOut'], uci = uci) - self.corpus.make_and_write_profile_et(self.corpus.lc, self.pathout['ContEtOut'], uci = uci) - self.clnb = len(self.corpus.lc) - self.parametres['clnb'] = self.clnb - Rscript = self.printRscript2() - self.doR(Rscript, dlg=self.dlg, message='profils et A.F.C. ...') - self.time = time() - self.t1 - minutes, seconds = divmod(self.time, 60) - hours, minutes = divmod(minutes, 60) - self.parametres['time'] = '%.0fh %.0fm %.0fs' % (hours, minutes, seconds) - self.print_graph_files() - def preferences(self) : - parametres = DoConf(self.parent.ConfigPath['alceste']).getoptions('ALCESTE') - parametres['corpus'] = self.corpus - parametres['pathout'] = self.pathout - self.dial = OptionAlc(self.parent, parametres) - self.dial.CenterOnParent() - self.dialok = self.dial.ShowModal() - if self.dialok == 5100 : - parametres['classif_mode'] = self.dial.radio_box_2.GetSelection() - parametres['tailleuc1'] = self.dial.spin_ctrl_1.GetValue() - parametres['tailleuc2'] = self.dial.spin_ctrl_2.GetValue() - parametres['mincl'] = self.dial.spin_ctrl_4.GetValue() - parametres['minforme'] = self.dial.spin_ctrl_5.GetValue() - parametres['nbcl_p1'] = self.dial.spin_nbcl.GetValue() - parametres['max_actives'] = self.dial.spin_max_actives.GetValue() - parametres['corpus'] = '' - parametres['svdmethod'] = self.dial.svdmethod[self.dial.choicesvd.GetSelection()] - parametres['pathout'] = self.pathout.dirout - parametres['mode.patate'] = self.dial.check_patate.GetValue() - DoConf(self.parent.ConfigPath['alceste']).makeoptions(['ALCESTE'], [parametres]) - self.dial.Destroy() - print parametres - return parametres - else : - self.dial.Destroy() - return None - - def printRscript(self) : - RchdTxt(self.pathout, self.parent.RscriptsPath, self.parametres['mincl'], self.parametres['classif_mode'], nbt=self.parametres['nbcl_p1'] - 1, svdmethod=self.parametres['svdmethod'], libsvdc=self.parent.pref.getboolean('iramuteq', 'libsvdc'), libsvdc_path=self.parent.pref.get('iramuteq', 'libsvdc_path'), R_max_mem=False, mode_patate=self.parametres['mode.patate']) - return self.pathout['Rchdtxt'] - - def printRscript2(self) : - AlcesteTxtProf(self.pathout, self.parent.RscriptsPath, self.clnb, 0.9) - return self.pathout['RTxtProfGraph'] - - def print_graph_files(self) : - mess_afc = u"La position des points n'est peut être pas exacte" - afc_graph_list = [[os.path.basename(self.pathout['AFC2DL_OUT']), u'Variables actives - coordonnées - 30 points par classes - facteurs 1 / 2 - %s' % mess_afc], - [os.path.basename(self.pathout['AFC2DSL_OUT']), u'variables supplémentaires - coordonnées - 30 points par classes - facteurs 1 / 2 - %s' % mess_afc], - [os.path.basename(self.pathout['AFC2DEL_OUT']), u'Variables illustratives - Coordonnées - 30 points par classes - facteur 1 / 2 - %s' % mess_afc], - [os.path.basename(self.pathout['AFC2DCL_OUT']), u'Classes - Coordonnées - facteur 1 / 2']] - chd_graph_list = [[os.path.basename(self.pathout['dendro1']), u'dendrogramme à partir de chd1']] - if self.parametres['classif_mode'] == 0 : - chd_graph_list.append([os.path.basename(self.pathout['dendro2']), u'dendrogramme à partir de chd2']) - chd_graph_list.append([os.path.basename(self.pathout['arbre1']), u'chd1']) - if self.parametres['classif_mode'] == 0 : - chd_graph_list.append([os.path.basename(self.pathout['arbre2']), u'chd2']) - print_liste(self.pathout['liste_graph_afc'], afc_graph_list) - print_liste(self.pathout['liste_graph_chd'], chd_graph_list) - PrintRapport(self, self.corpus, self.parametres) # keys = {'art_def' : 2, diff --git a/chemins.py b/chemins.py index 014d009..2374874 100644 --- a/chemins.py +++ b/chemins.py @@ -129,7 +129,7 @@ def ConstructConfigPath(AppliPath, user=True): else : ConfigPath = AppliPath DictConfigPath = { - 'alceste': os.path.join(ConfigPath, 'alceste.cfg'), + 'reinert': os.path.join(ConfigPath, 'reinert.cfg'), 'key': os.path.join(ConfigPath, 'key.cfg'), 'path': os.path.join(ConfigPath, 'path.cfg'), 'preferences' : os.path.join(ConfigPath, 'iramuteq.cfg'), @@ -137,6 +137,7 @@ def ConstructConfigPath(AppliPath, user=True): 'corpus' : os.path.join(ConfigPath, 'corpus.cfg'), 'stat' : os.path.join(ConfigPath, 'stat.cfg'), 'simitxt' : os.path.join(ConfigPath, 'simitxt.cfg'), + 'matrix' : os.path.join(ConfigPath, 'matrix.cfg'), } return DictConfigPath diff --git a/corpus.py b/corpus.py index d26a8a3..4a2140d 100644 --- a/corpus.py +++ b/corpus.py @@ -16,7 +16,7 @@ import logging from operator import itemgetter from uuid import uuid4 from chemins import PathOut -from dialog import CorpusPref +from dialog import CorpusPref, SubTextFromMetaDial from colors import colors import datetime @@ -82,6 +82,22 @@ class Corpus : lem = word self.formes[word] = Word(word, gramtype, len(self.formes), lem) self.idformesuces[self.formes[word].ident] = {self.ucis[-1].uces[-1].ident : 1} + + def add_word_from_forme(self, word, stident): + if word.forme in self.formes : + self.formes[word.forme].freq += 1 + if self.formes[word.forme].ident in self.idformesuces : + if stident in self.idformesuces[self.formes[word.forme].ident] : + self.idformesuces[self.formes[word.forme].ident][stident] += 1 + else : + self.idformesuces[self.formes[word.forme].ident][stident] = 1 + else : + self.idformesuces[self.formes[word.forme].ident] = {stident: 1} + else : + self.formes[word.forme] = word + self.formes[word.forme].ident = len(self.formes) + self.formes[word.forme].freq = 1 + self.idformesuces[self.formes[word.forme].ident] = {stident : 1} def conn_all(self): """connect corpus to db""" @@ -289,6 +305,30 @@ class Corpus : self.lems[self.formes[forme].lem] = Lem(self, self.formes[forme]) else : self.lems = dict([[forme, Lem(self, self.formes[forme])] for forme in self.formes]) + + def make_lems_from_dict(self, dictionnaire, dolem = True) : + log.info('make lems from dict') + self.lems = {} + for forme in self.formes : + if self.formes[forme].forme in dictionnaire : + lem = dictionnaire[forme][0] + gram = dictionnaire[forme][1] + elif forme.isdigit() : + gram = u'num' + lem = forme + else : + gram = u'nr' + lem = forme + self.formes[forme].lem = lem + self.formes[forme].gram = gram + if dolem : + if self.formes[forme].lem in self.lems : + if self.formes[forme].ident not in self.lems[self.formes[forme].lem].formes : + self.lems[self.formes[forme].lem].add_forme(self.formes[forme]) + else : + self.lems[self.formes[forme].lem] = Lem(self, self.formes[forme]) + else : + self.lems[forme] = Lem(self, self.formes[forme]) def make_idformes(self) : self.idformes = dict([[self.formes[forme].ident, self.formes[forme]] for forme in self.formes]) @@ -319,6 +359,29 @@ class Corpus : tab.insert(0, [''] + etoiles) return tab + def make_tgen_table(self, tgen, etoiles, tot = None): + lclasses = [self.getucesfrometoile(etoile) for etoile in etoiles] + sets = [set(cl) for cl in lclasses] + totoccurrences = dict([[val, 0] for val in etoiles]) + if tot is None : + for forme in self.formes : + formeuceeff = self.getformeuceseff(forme) + for i, classe in enumerate(lclasses) : + concern = sets[i].intersection(formeuceeff.keys()) + if len(concern) : + totoccurrences[etoiles[i]] += sum([formeuceeff[uce] for uce in concern]) + #tgenoccurrences = dict([[val, 0] for val in etoiles]) + tgenoccurrences = {} + for t in tgen.tgen : + tgenoccurrences[t] = dict([[val, 0] for val in etoiles]) + for lem in tgen[t] : + lemuceeff = self.getlemuceseff(lem) + for i, classe in enumerate(lclasses) : + concern = sets[i].intersection(lemuceeff.keys()) + if len(concern) : + tgenoccurrences[t][etoiles[i]] += sum([lemuceeff[uce] for uce in concern]) + return tgenoccurrences, totoccurrences + def make_efftype_from_etoiles(self, etoiles) : dtype = {} etuces = [[] for et in etoiles] @@ -656,6 +719,12 @@ class Corpus : for uci in self.ucis : etoiles.update(uci.etoiles[1:]) return list(etoiles) + + def make_themes(self): + themes = set([]) + for uci in self.ucis : + themes.update(uci.paras) + return list(themes) def make_etoiles_dict(self) : etoiles = [et for uci in self.ucis for et in uci.etoiles[1:]] @@ -929,8 +998,7 @@ class Corpus : listlem.sort() with open(fileout, 'w') as f : f.write('\n'.join(['\t'.join(lem) for lem in listlem]).encode(syscoding)) - - + class MakeUciStat : @@ -1230,6 +1298,77 @@ class BuildCorpus : pourhapaxocc = (float(hapaxnb) / self.corpus.parametres['occurrences']) * 100 self.corpus.parametres['hapax'] = '%i - %.2f %% des formes - %.2f %% des occurrences' % (hapaxnb, pourhapaxf, pourhapaxocc) +class BuildSubCorpus(BuildCorpus): + def __init__(self, corpus, parametres, dlg = None) : + log.info('begin subcorpus...') + self.dlg = dlg + self.ori = corpus + self.infile = None + self.corpus = Corpus(self, corpus.parametres) + self.last = 0 + self.encoding = corpus.parametres['encoding'] + self.corpus.parametres['corpus_name'] = parametres['corpus_name'] + self.corpus.pathout = PathOut(filename = corpus.parametres['originalpath'], dirout = parametres['pathout']) + self.corpus.pathout.createdir(parametres['pathout']) + self.corpus.parametres['pathout'] = parametres['pathout'] + self.corpus.parametres['meta'] = parametres.get('meta', False) + self.corpus.parametres['uuid'] = str(uuid4()) + if parametres.get('frommeta', False) : + print 'make subtexts' + self.corpus.ucis = [uci for uci in self.ori.ucis if set(parametres['meta']).intersection(uci.etoiles) != set()] + elif parametres.get('fromtheme', False) : + print 'make subtexts from theme' + idpara = 0 + for uci in self.ori.ucis : + if uci.paras != [] : + newuce = [] + newpara = [] + for et in uci.paras : + if et in parametres['meta'] : + newuce += [uce for uce in uci.uces if uce.para == idpara] + newpara.append(et) + idpara += 1 + if newuce != [] : + uci.uces = newuce + uci.paras = newpara + self.corpus.ucis.append(uci) + else : + idpara += 1 + elif parametres.get('fromcluster', False) : + pass + #create database + self.connect() + self.dobuild() + + def read_corpus(self, infile = None): + self.olduceid = [uce.ident for uci in self.corpus.ucis for uce in uci.uces] + ident_uci = 0 + ident_uce = 0 + ident_para = -1 + lastpara = -1 + newuceident = {} + print 'redo text, para and st ident' + for uci in self.corpus.ucis : + uci.ident = ident_uci + ident_uci += 1 + for uce in uci.uces : + uce.uci = uci.ident + if uce.para != lastpara : + ident_para += 1 + lastpara = uce.para + uce.para = ident_para + else : + uce.para = ident_para + newuceident[uce.ident] = ident_uce + uce.ident = ident_uce + ident_uce += 1 + print 'backup st text and forms' + for row in self.ori.getconcorde(self.olduceid) : + self.c.execute('INSERT INTO uces VALUES(?,?);', (`newuceident[row[0]]`, row[1])) + for word in row[1].split() : + self.corpus.add_word_from_forme(self.ori.formes[word], newuceident[row[0]]) + self.backup_uce() + print 'done' class BuildFromAlceste(BuildCorpus) : def read_corpus(self, infile) : @@ -1374,6 +1513,41 @@ class Builder : def doanalyse(self) : return BuildFromAlceste(self.parent.filename, self.parametres, self.parent.lexique, self.parent.expressions, dlg = self.dlg).corpus +class SubBuilder : + def __init__(self, parent, corpus, parametres = None, dlg = None): + self.parent = parent + self.ori = corpus + self.dlg = dlg + corpus_name = 'Sub' + corpus.parametres['corpus_name'] + parametres['corpus_name'] = corpus_name + if parametres.get('frommeta', False) : + parametres['meta'] = corpus.make_etoiles() + elif parametres.get('fromtheme', False) : + parametres['meta'] = corpus.make_themes() + parametres['meta'].sort() + dial = SubTextFromMetaDial(parent, parametres) + self.res = dial.ShowModal() + if self.res == 5100 : + if dial.subcorpusname.GetValue() != '' : + corpus_name = ''.join([l for l in dial.subcorpusname.GetValue() if l.isalnum() or l in ['_']]) + if corpus_name != '' : + parametres['corpus_name'] = corpus_name + else : + parametres['corpus_name'] = 'Sub' + corpus.parametres['corpus_name'] + pathout = os.path.join(corpus.parametres['pathout'], parametres['corpus_name']) + i = 1 + while os.path.exists(pathout + '_%i' % i) : + i += 1 + parametres['pathout'] = pathout + '_%i' % i + meta = dial.m_listBox1.GetSelections() + parametres['meta'] = [parametres['meta'][val] for val in meta] + self.parametres = parametres + dial.Destroy() + else : + dial.Destroy() + + def doanalyse(self): + return BuildSubCorpus(self.ori, parametres = self.parametres, dlg = self.dlg).corpus if __name__ == '__main__' : t1 = time() diff --git a/dialog.py b/dialog.py index 89da90f..3805c46 100755 --- a/dialog.py +++ b/dialog.py @@ -1032,75 +1032,179 @@ class PrefSimpleFile(wx.Dialog): else : self.EndModal(wx.ID_CANCEL) - -class StatDialog(wx.Dialog): - def __init__(self, parent, *args, **kwds): - kwds['style'] = wx.DEFAULT_DIALOG_STYLE - wx.Dialog.__init__(self, *args, **kwds) +class StatDialog ( wx.Dialog ): + + def __init__( self, parent, keys ): + wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"Settings", pos = wx.DefaultPosition, size = wx.Size( -1,-1 ), style = wx.DEFAULT_DIALOG_STYLE ) + self.fileout = "" self.parent = parent - self.label_lem = wx.StaticText(self, -1, _(u"Lemmatization").decode('utf8')) - self.radio_lem = wx.RadioBox(self, -1, u"", choices=['oui', 'non'], majorDimension=0, style=wx.RA_SPECIFY_ROWS) - #txt = u"""Fréquence minimum d'une forme -#analysée (0 = non utilisé)""" - #self.label_8 = wx.StaticText(self, -1, txt) - #self.spin_ctrl_5 = wx.SpinCtrl(self, -1, "",size = (100,30), min=0, max=1000, initial=0) - #self.label_max_actives = wx.StaticText(self, -1, u"Nombre maximum de formes analysées") - #self.spin_max_actives = wx.SpinCtrl(self, -1, "",size = (100,30), min=20, max=10000, initial=1500) - self.label_4 = wx.StaticText(self, -1, _(u"Keys settings").decode('utf8')) - self.button_5 = wx.Button(self, wx.ID_PREFERENCES, "") - - #self.Bind(wx.EVT_CHECKBOX, self.OnCheckUce, self.check_uce) - #self.Bind(wx.EVT_SPINCTRL, self.OnSpin, self.spin_ctrl_5) - self.Bind(wx.EVT_BUTTON, self.OnKeys, self.button_5) - self.__do_layout() - self.__set_properties() - - def __do_layout(self) : - first = wx.BoxSizer(wx.VERTICAL) - sizer = wx.FlexGridSizer(0,2,0,0) - sizer.Add(self.label_lem, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5) - sizer.Add(self.radio_lem, 0, wx.ALIGN_LEFT, 5) - sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5) - sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5) - #sizer.Add(self.txt_exp, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5) - #sizer.Add(self.exp, 0, wx.ALIGN_RIGHT, 5) - #sizer.Add(self.label_uce, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5) - #sizer.Add(self.check_uce, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5) - #sizer.Add(self.label_occuce, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5) - #sizer.Add(self.spin_ctrl_4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5) - #sizer.Add(self.label_8, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5) - #sizer.Add(self.spin_ctrl_5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5) - #sizer.Add(self.label_max_actives, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5) - #sizer.Add(self.spin_max_actives, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5) - sizer.Add(self.label_4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5) - sizer.Add(self.button_5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5) - sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5) - sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5) - #sizer.Add(box2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5) - first.Add(sizer, 0, wx.ALL, 5) - btnsizer = wx.StdDialogButtonSizer() - btn = wx.Button(self, wx.ID_CANCEL) - btnsizer.AddButton(btn) - btn_ok = wx.Button(self, wx.ID_OK) - btn_ok.SetDefault() - btnsizer.AddButton(btn_ok) - btnsizer.Realize() - first.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5) - self.SetSizer(first) - first.Fit(self) - - def __set_properties(self) : - self.SetTitle(_(u"Settings").decode('utf8')) + self.keys = keys + self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize ) + + bSizer1 = wx.BoxSizer( wx.VERTICAL ) + + gSizer1 = wx.GridSizer( 0, 2, 0, 0 ) + + self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, u"Lemmatization", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_staticText1.Wrap( -1 ) + gSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) + + radio_lemChoices = [ u"yes", u"no" ] + self.radio_lem = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, radio_lemChoices, 1, wx.RA_SPECIFY_COLS ) + self.radio_lem.SetSelection( 0 ) + gSizer1.Add( self.radio_lem, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 ) + + self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, u"Keys properties", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_staticText2.Wrap( -1 ) + gSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) + + self.button_5 = wx.Button( self, wx.ID_PREFERENCES, u"properties", wx.DefaultPosition, wx.DefaultSize, 0 ) + gSizer1.Add( self.button_5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 ) + + self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, u"Dictionary", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_staticText3.Wrap( -1 ) + gSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) + + radio_dictchoiceChoices = [ u"indexation", u"other" ] + self.radio_dictchoice = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, radio_dictchoiceChoices, 1, wx.RA_SPECIFY_COLS ) + self.radio_dictchoice.SetSelection( 0 ) + gSizer1.Add( self.radio_dictchoice, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 ) + + + bSizer1.Add( gSizer1, 1, wx.EXPAND, 5 ) + + self.dictpath = filebrowse.FileBrowseButton(self, -1, size=(350, -1), labelText = _(u"Path").decode('utf8'), fileMode = 2, fileMask = '*') + bSizer1.Add( self.dictpath, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) + self.dictpath.Enable(False) - def OnKeys(self, evt): - dial = AlcOptFrame(self, self.parent.parent) + m_sdbSizer1 = wx.StdDialogButtonSizer() + self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK ) + m_sdbSizer1.AddButton( self.m_sdbSizer1OK ) + self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL ) + m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel ) + m_sdbSizer1.Realize(); + + bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 ) + + + self.SetSizer( bSizer1 ) + self.Layout() + bSizer1.Fit( self ) + + self.Centre( wx.BOTH ) + + # Connect Events + self.button_5.Bind( wx.EVT_BUTTON, self.OnKeys ) + self.radio_dictchoice.Bind( wx.EVT_RADIOBOX, self.OnOther ) + + def __del__( self ): + pass + + + # Virtual event handlers, overide them in your derived class + def OnKeys( self, event ): + dial = AlcOptFrame(self, self.parent) dial.CenterOnParent() dial.ShowModal() for i in range(0,len(dial.listlabel)): dial.keys[dial.listcle[i]] = dial.listspin[i].GetValue() - DoConf().makeoptions(['KEY'], [dial.keys], outfile = self.parent.parent.ConfigPath['key']) + DoConf().makeoptions(['KEY'], [dial.keys], outfile = self.parent.ConfigPath['key']) dial.Destroy() + + def OnOther( self, event ): + if self.radio_dictchoice.GetSelection() : + self.dictpath.Enable(True) + else : + self.dictpath.Enable(False) + +# class StatDialog(wx.Dialog): +# def __init__(self, parent, *args, **kwds): +# kwds['style'] = wx.DEFAULT_DIALOG_STYLE +# wx.Dialog.__init__(self, *args, **kwds) +# self.fileout = "" +# self.parent = parent +# self.label_lem = wx.StaticText(self, -1, _(u"Lemmatization").decode('utf8')) +# self.radio_lem = wx.RadioBox(self, -1, u"", choices=[_(u'oui').decode('utf8'), _(u'non').decode('utf8')], majorDimension=0, style=wx.RA_SPECIFY_ROWS) +# #txt = u"""Fréquence minimum d'une forme +# #analysée (0 = non utilisé)""" +# #self.label_8 = wx.StaticText(self, -1, txt) +# #self.spin_ctrl_5 = wx.SpinCtrl(self, -1, "",size = (100,30), min=0, max=1000, initial=0) +# #self.label_max_actives = wx.StaticText(self, -1, u"Nombre maximum de formes analysées") +# #self.spin_max_actives = wx.SpinCtrl(self, -1, "",size = (100,30), min=20, max=10000, initial=1500) +# self.label_4 = wx.StaticText(self, -1, _(u"Keys settings").decode('utf8')) +# self.button_5 = wx.Button(self, wx.ID_PREFERENCES, "") +# self.labeldictchoice = wx.StaticText(self, -1, _(u"Dictionary").decode('utf8')) +# self.radio_dictchoice = wx.RadioBox(self, -1, u"", choices=[_(u'indexation').decode('utf8'), _(u'other').decode('utf8')], majorDimension=0, style=wx.RA_SPECIFY_ROWS) +# #self.labeldictpath = wx.StaticText(self, -1, _(u"Path").decode('utf8')) +# self.dictpath = filebrowse.FileBrowseButton(self, -1, size=(350, -1), labelText = _(u"Path").decode('utf8'), fileMode = 2, fileMask = '*') +# self.dictpath.Enable(False) +# #self.Bind(wx.EVT_CHECKBOX, self.OnCheckUce, self.check_uce) +# #self.Bind(wx.EVT_SPINCTRL, self.OnSpin, self.spin_ctrl_5) +# self.Bind(wx.EVT_BUTTON, self.OnKeys, self.button_5) +# self.Bind(wx.EVT_RADIOBOX, self.OnOther, self.radio_dictchoice) +# self.__do_layout() +# self.__set_properties() +# +# def __do_layout(self) : +# first = wx.BoxSizer(wx.VERTICAL) +# sizer = wx.FlexGridSizer(0,2,0,0) +# sizer.Add(self.label_lem, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5) +# sizer.Add(self.radio_lem, 0, wx.ALIGN_LEFT, 5) +# sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5) +# sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5) +# #sizer.Add(self.txt_exp, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5) +# #sizer.Add(self.exp, 0, wx.ALIGN_RIGHT, 5) +# #sizer.Add(self.label_uce, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5) +# #sizer.Add(self.check_uce, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5) +# #sizer.Add(self.label_occuce, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5) +# #sizer.Add(self.spin_ctrl_4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5) +# #sizer.Add(self.label_8, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5) +# #sizer.Add(self.spin_ctrl_5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5) +# #sizer.Add(self.label_max_actives, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5) +# #sizer.Add(self.spin_max_actives, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5) +# sizer.Add(self.label_4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5) +# sizer.Add(self.button_5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5) +# sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5) +# sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5) +# sizer.Add(self.labeldictchoice, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5) +# sizer.Add(self.radio_dictchoice, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5) +# sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5) +# sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5) +# #sizer.Add(self.labeldictpath, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5) +# sizer.Add(self.dictpath, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5) +# sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5) +# sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5) +# #sizer.Add(box2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5) +# first.Add(sizer, 0, wx.ALL, 5) +# btnsizer = wx.StdDialogButtonSizer() +# btn = wx.Button(self, wx.ID_CANCEL) +# btnsizer.AddButton(btn) +# btn_ok = wx.Button(self, wx.ID_OK) +# btn_ok.SetDefault() +# btnsizer.AddButton(btn_ok) +# btnsizer.Realize() +# first.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5) +# self.SetSizer(first) +# first.Fit(self) +# +# def __set_properties(self) : +# self.SetTitle(_(u"Settings").decode('utf8')) +# +# def OnKeys(self, evt): +# dial = AlcOptFrame(self, self.parent.parent) +# dial.CenterOnParent() +# dial.ShowModal() +# for i in range(0,len(dial.listlabel)): +# dial.keys[dial.listcle[i]] = dial.listspin[i].GetValue() +# DoConf().makeoptions(['KEY'], [dial.keys], outfile = self.parent.parent.ConfigPath['key']) +# dial.Destroy() +# +# def OnOther(self, evt): +# if self.radio_dictchoice.GetSelection() : +# self.dictpath.Enable(True) +# else : +# self.dictpath.Enable(False) class PrefUCECarac(wx.Dialog): def __init__(self, parent, *args, **kwds): @@ -1197,14 +1301,14 @@ class PrefSegProf(wx.Dialog) : class PrefQuestAlc ( wx.Dialog ): - def __init__( self, parent, sim = False): + def __init__( self, parent, tableau, sim = False): wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = _(u"Clustering").decode('utf8'), pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE ) self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize ) #--------------------------------------------------------------- #self.content = parent.content[:] - self.header = parent.tableau.get_colnames() + self.header = tableau.get_colnames() labels = [val for val in self.header] self.labels_tot = labels self.varsup = [] @@ -2066,7 +2170,7 @@ class PrefChi(sc.SizedDialog): class ChiDialog(wx.Dialog): def __init__( - self, parent, ID, title, optionchi, size=wx.DefaultSize, pos=wx.DefaultPosition, + self, parent, ID, title, optionchi, tableau, size=wx.DefaultSize, pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE ): @@ -2078,9 +2182,10 @@ class ChiDialog(wx.Dialog): self.parent = parent self.optionchi = optionchi self.chiopt = False + self.tableau = tableau #self.Filename=parent.filename #self.content=parent.content[:] - self.headers=parent.tableau.get_colnames() + self.headers=self.tableau.get_colnames() LABELLIST=[] for i in self.headers: @@ -2165,7 +2270,14 @@ class CorpusPref ( wx.Dialog ): self.txtpath = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Path").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 ) self.txtpath.Wrap( -1 ) fgSizer1.Add( self.txtpath, 0, wx.ALL, 5 ) + + self.m_staticText18 = wx.StaticText( self.m_panel1, wx.ID_ANY, u"Corpus' name", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_staticText18.Wrap( -1 ) + fgSizer1.Add( self.m_staticText18, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 ) + self.corpusname = wx.TextCtrl( self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 200,-1 ), 0 ) + fgSizer1.Add( self.corpusname, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 ) + self.m_staticText1 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Characters set").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText1.Wrap( -1 ) fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 ) @@ -2184,6 +2296,36 @@ class CorpusPref ( wx.Dialog ): self.lang_choices.SetSelection( 0 ) fgSizer1.Add( self.lang_choices, 0, wx.ALL, 5 ) + self.m_staticText19 = wx.StaticText( self.m_panel1, wx.ID_ANY, u"Dictionary", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_staticText19.Wrap( -1 ) + fgSizer1.Add( self.m_staticText19, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 ) + + bSizer2 = wx.BoxSizer( wx.HORIZONTAL ) + + fgSizer5 = wx.FlexGridSizer( 2, 2, 0, 0 ) + fgSizer5.SetFlexibleDirection( wx.BOTH ) + fgSizer5.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) + + self.radio_default_dict = wx.RadioButton( self.m_panel1, wx.ID_ANY, u"Default", wx.DefaultPosition, wx.DefaultSize, 0 ) + fgSizer5.Add( self.radio_default_dict, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) + + self.defaultdictpath = wx.TextCtrl( self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 300,-1 ), wx.TE_READONLY ) + self.defaultdictpath.Enable( False ) + + fgSizer5.Add( self.defaultdictpath, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) + + self.radio_other_dict = wx.RadioButton( self.m_panel1, wx.ID_ANY, u"Other", wx.DefaultPosition, wx.DefaultSize, 0 ) + fgSizer5.Add( self.radio_other_dict, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) + + self.otherdictpath = wx.FilePickerCtrl( self.m_panel1, wx.ID_ANY, wx.EmptyString, u"Select a file", u"*.*", wx.DefaultPosition, wx.Size( 300,-1 ), wx.FLP_DEFAULT_STYLE ) + fgSizer5.Add( self.otherdictpath, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) + + + bSizer2.Add( fgSizer5, 1, wx.EXPAND, 5 ) + + + fgSizer1.Add( bSizer2, 1, wx.EXPAND, 5 ) + self.m_staticText3 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Output folder").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText3.Wrap( -1 ) fgSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 ) @@ -2329,7 +2471,11 @@ class CorpusPref ( wx.Dialog ): bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 ) + # Connect Events self.Bind(wx.EVT_BUTTON, self.OnChangeDir, self.m_button1) + self.lang_choices.Bind( wx.EVT_CHOICE, self.OnChangeLangage ) + self.radio_other_dict.Bind( wx.EVT_RADIOBUTTON, self.changedictchoice ) + self.setparametres(parametres) self.SetSizer( bSizer1 ) self.Layout() @@ -2393,19 +2539,39 @@ class CorpusPref ( wx.Dialog ): else : parametres[val] = 0 return parametres + + def OnChangeLangage(self, evt): + pass + + def changedictchoice(self, evt): + pass + + +class ConcordList(wx.HtmlListBox): + def __init__(self, parent, concord): + self.concord = concord + #self.script_status = dict() + wx.HtmlListBox.__init__(self, parent, -1, size = (900, 600)) + self.SetItemCount(len(concord)) + #self.Bind(wx.EVT_LISTBOX, self.RefreshMe) + #self.Bind(wx.EVT_LISTBOX_DCLICK, self.Download) + + def OnGetItem(self, index): + return self.concord[index] + '
' class message(wx.Dialog): - def __init__(self, parent, title, size, save = True): - wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = title, pos = wx.DefaultPosition, size = size, style = wx.DEFAULT_DIALOG_STYLE ) + def __init__(self, parent, items, title, size, save = True): + wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = title, pos = wx.DefaultPosition, size = size, style = wx.DEFAULT_DIALOG_STYLE|wx.STAY_ON_TOP ) self.save = save self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize ) self.html = "" - self.HtmlPage=wx.html.HtmlWindow(self, -1) - self.HtmlPage.SetMinSize( size ) - if "gtk2" in wx.PlatformInfo: - self.HtmlPage.SetStandardFonts() - self.HtmlPage.SetFonts('Courier','Courier') + #self.HtmlPage=wx.html.HtmlWindow(self, -1) + self.HtmlPage = ConcordList(self, items) + #self.HtmlPage.SetMinSize( size ) + #if "gtk2" in wx.PlatformInfo: + # self.HtmlPage.SetStandardFonts() + #self.HtmlPage.SetFonts('Courier','Courier') self.button_1 = wx.Button(self, wx.ID_CANCEL) @@ -2447,6 +2613,8 @@ class message(wx.Dialog): def OnCloseWindow(self, event): self.Destroy() + + class ExtractDialog ( wx.Dialog ): def __init__( self, parent, option ): @@ -2508,6 +2676,25 @@ class ExtractDialog ( wx.Dialog ): self.extractformat = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, extractformatChoices, 1, wx.RA_SPECIFY_COLS ) self.extractformat.SetSelection( 0 ) fgSizer1.Add( self.extractformat, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) + + if option == 'them' : + self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, _(u"thematics (one by line, with the -*)").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_staticText4.Wrap( -1 ) + fgSizer1.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) + + self.txtmods = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE ) + self.txtmods.SetMinSize( wx.Size( 200,150 ) ) + + fgSizer1.Add( self.txtmods, 0, wx.ALL|wx.EXPAND, 5 ) + + #self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, _(u"Extraction type").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 ) + #self.m_staticText5.Wrap( -1 ) + #fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) + + #extractformatChoices = [ _(u"Only one file").decode('utf8'), _(u"One file by thematic").decode('utf8') ] + #self.extractformat = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, extractformatChoices, 1, wx.RA_SPECIFY_COLS ) + #self.extractformat.SetSelection( 0 ) + #fgSizer1.Add( self.extractformat, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) fgSizer1.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 ) @@ -2542,7 +2729,13 @@ class ExtractDialog ( wx.Dialog ): parametres['onefile'] = True else : parametres['onefile'] = False - parametres['encodeout'] = locale.getpreferredencoding() + if self.option == 'them' : + parametres['them'] = self.txtmods.GetValue().splitlines() + # if self.extractformat.GetSelection() == 0 : + # parametres['onefile'] = True + # else : + # parametres['onefile'] = False + parametres['encodeout'] = le[self.encodage.GetSelection()] return parametres def __del__( self ): @@ -2743,3 +2936,62 @@ class SimpleDialog ( wx.Dialog ): def __del__( self ): pass + + +class SubTextFromMetaDial ( wx.Dialog ): + + def __init__( self, parent, parametres ): + wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"Subcorpus from metadata", pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE ) + + self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize ) + + bSizer1 = wx.BoxSizer( wx.VERTICAL ) + + fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 ) + fgSizer1.SetFlexibleDirection( wx.BOTH ) + fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) + + self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, u"SubCorpus Name", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_staticText1.Wrap( -1 ) + fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) + + self.subcorpusname = wx.TextCtrl( self, wx.ID_ANY, parametres['corpus_name'], wx.DefaultPosition, wx.Size( 300,-1 ), 0 ) + fgSizer1.Add( self.subcorpusname, 0, wx.ALL, 5 ) + + self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, u"Select one or more metadata", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_staticText2.Wrap( -1 ) + fgSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) + + m_listBox1Choices = parametres['meta'] + self.m_listBox1 = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.Size( -1,-1 ), m_listBox1Choices, wx.LB_HSCROLL|wx.LB_MULTIPLE ) + self.m_listBox1.SetMinSize( wx.Size( -1,200 ) ) + self.m_listBox1.SetMaxSize( wx.Size( -1,500 ) ) + + fgSizer1.Add( self.m_listBox1, 0, wx.ALL|wx.EXPAND, 5 ) + + + bSizer1.Add( fgSizer1, 1, wx.EXPAND, 5 ) + + m_sdbSizer1 = wx.StdDialogButtonSizer() + self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK ) + m_sdbSizer1.AddButton( self.m_sdbSizer1OK ) + self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL ) + m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel ) + m_sdbSizer1.Realize(); + + bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 ) + + + self.SetSizer( bSizer1 ) + self.Layout() + bSizer1.Fit( self ) + + self.Centre( wx.BOTH ) + + def __del__( self ): + pass + + + + + diff --git a/extract.py b/extract.py index 1a17475..2f55dca 100644 --- a/extract.py +++ b/extract.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- #Author: Pierre Ratinaud #Copyright (c) 2011, Pierre Ratinaud -#Lisense: GNU/GPL +#License: GNU/GPL import codecs diff --git a/functions.py b/functions.py index aa260b3..cef90ca 100644 --- a/functions.py +++ b/functions.py @@ -30,12 +30,52 @@ log = logging.getLogger('iramuteq') indices_simi = [u'cooccurrence' ,'pourcentage de cooccurrence',u'Russel',u'Jaccard', 'Kulczynski1', 'Kulczynski2', 'Mountford', 'Fager', 'simple matching', 'Hamman', 'Faith', 'Tanimoto', 'Dice', 'Phi', 'Stiles', 'Michael', 'Mozley', 'Yule', 'Yule2', 'Ochiai', 'Simpson', 'Braun-Blanquet','Chi-squared', 'Phi-squared', 'Tschuprow', 'Cramer', 'Pearson', 'binomial'] +class TGen : + def __init__(self, path = None, encoding = 'utf8'): + self.path = path + self.tgen = {} + self.encoding = encoding + + def __getitem__(self, key): + return self.tgen[key] + + def read(self, path): + with codecs.open(path, 'r', self.encoding) as f : + tgen = f.read() + tgen = [line.split('\t') for line in tgen.splitlines()] + tgen = dict([[line[0], line[1:]] for line in tgen]) + self.tgen = tgen + self.path = path + + def write(self, path = None): + if path is None : + path = self.path + with open(path, 'w') as f : + f.write('\n'.join(['\t'.join([val] + self.tgen[val]) for val in self.tgen])) + + def writetable(self, pathout, tgens, totocc): + etoiles = totocc.keys() + with open(pathout, 'w') as f : + line = '\t'.join([u'tgens'] + etoiles) + '\n' + f.write(line.encode(self.encoding)) + for t in tgens : + line = '\t'.join([t] + [`tgens[t][et]` for et in etoiles]) + '\n' + f.write(line.encode(self.encoding)) + i = 0 + totname = 'total' + while totname + `i` in tgens : + i += 1 + totname = totname + `i` + line = '\t'.join([totname] + [`totocc[et]` for et in etoiles]) + f.write(line.encode(self.encoding)) + class History : def __init__(self, filein, syscoding = 'utf8') : self.filein = filein self.syscoding = syscoding self.corpora = {} self.openedcorpus = {} + self.openedmatrix = {} self.orph = [] self.analyses = {} self.history = [] @@ -50,6 +90,7 @@ class History : self.corpus = dict([[corpus['uuid'], corpus] for corpus in self.history]) self.analyses = dict([[analyse['uuid'], analyse] for corpus in self.history for analyse in corpus.get('analyses', [])]) self.matrixanalyse = dict([[mat['uuid'], mat] for mat in self.matrix]) + self.ordermatrix = dict([[matrix['uuid'], i] for i, matrix in enumerate(self.matrix)]) d.close() def write(self) : @@ -81,12 +122,21 @@ class History : self.read() def addMatrix(self, analyse) : - tosave = {'uuid' : analyse['uuid'], 'ira': analyse['ira'], 'type' : analyse['type']} - tosave['name'] = analyse['name'] + tosave = analyse + #tosave['matrix_name'] = analyse['matrix_name'] + tosave['analyses'] = [] self.matrix.append(tosave) self.write() self.read() + def addMatrixAnalyse(self, analyse) : + tosave = {'uuid' : analyse['uuid'], 'ira': analyse['ira'], 'type' : analyse['type'], 'matrix' : analyse['matrix']} + tosave['name'] = analyse['name'] + if tosave['matrix'] in self.ordermatrix : + self.matrix[self.ordermatrix[tosave['matrix']]]['analyses'].append(tosave) + self.write() + self.read() + def addmultiple(self, analyses) : log.info('add multiple') for analyse in analyses : @@ -128,6 +178,10 @@ class History : for corpus in corpustodel : print 'cleaning :', corpus['corpus_name'] self.delete(corpus, corpus = True) + anatodel = [analyse for corpus in self.history for analyse in corpus.get('analyses', []) if not os.path.exists(analyse.get('ira', '/'))] + for analyse in anatodel : + print 'cleaning :', analyse['name'] + self.delete(analyse) def __str__(self) : return str(self.history) @@ -473,12 +527,8 @@ def PlaySound(parent): def ReadDicoAsDico(dicopath): with codecs.open(dicopath, 'r', 'UTF8') as f: content = f.readlines() - dico = {} - for line in content : - if line[0] != u'': - line = line.rstrip('\n\r').replace(u'\n', '').replace('"', '').split('\t') - dico[line[0]] = line[1:] - return dico + lines = [line.rstrip('\n\r').replace(u'\n', '').replace('"', '').split('\t') for line in content if line != u''] + return dict([[line[0], line[1:]] for line in lines]) def ReadLexique(parent, lang = 'french', filein = None): if lang != 'other' : @@ -489,18 +539,21 @@ def ReadLexique(parent, lang = 'french', filein = None): else : parent.lexique = {} -def ReadList(filein, encoding = sys.getdefaultencoding()): +def ReadList(filein, encoding = sys.getdefaultencoding(), sep = ';'): #file = open(filein) - file = codecs.open(filein, 'r', encoding) - content = file.readlines() - file.close() + with codecs.open(filein, 'r', encoding) as f : + content = f.read() + content = [line.replace('\n', '').replace('\r','').replace('\"', '').replace(',', '.').split(sep) for line in content.splitlines()] + #file = codecs.open(filein, 'r', encoding) + #content = file.readlines() + #file.close() first = content.pop(0) - first = first.replace('\n', '').replace('\r','').replace('\"', '').split(';') + #first = first.replace('\n', '').replace('\r','').replace('\"', '').split(sep) dict = {} i = 0 for line in content: - line = line.replace('\n', '').replace('\r','').replace('\"', '').replace(',', '.') - line = line.split(';') + #line = line.replace('\n', '').replace('\r','').replace('\"', '').replace(',', '.') + #line = line.split(';') nline = [line[0]] for val in line[1:]: if val == u'NA' : @@ -701,7 +754,7 @@ def doconcorde(corpus, uces, mots, uci = False) : ucis_txt = [] listmot = [corpus.getlems()[lem].formes for lem in mots] listmot = [corpus.getforme(fid).forme for lem in listmot for fid in lem] - mothtml = [''+mot+'' for mot in listmot] + mothtml = ['%s' % mot for mot in listmot] dmots = dict(zip(listmot, mothtml)) for uce in uces : ucetxt = ucestxt1[uce].split() @@ -710,7 +763,7 @@ def doconcorde(corpus, uces, mots, uci = False) : ucis_txt.append('

' + ' '.join(corpus.ucis[corpus.getucefromid(uce).uci].etoiles) + '

') else : ucis_txt.append('

' + ' '.join(corpus.ucis[uce].etoiles) + '

') - ucestxt.append(ucetxt) + ucestxt.append(ucetxt) return ucis_txt, ucestxt diff --git a/guifunct.py b/guifunct.py index 9253789..ef718c0 100644 --- a/guifunct.py +++ b/guifunct.py @@ -9,6 +9,7 @@ import sys from copy import copy import dialog from listlex import * +from vitemspicker import VItemsPicker, EVT_IP_SELECTION_CHANGED, IP_SORT_CHOICES, IP_SORT_SELECTED, IP_REMOVE_FROM_CHOICES from functions import treat_var_mod @@ -52,37 +53,31 @@ def get_table_param(self, filename) : dlg.CenterOnParent() val = dlg.ShowModal() if val == wx.ID_OK: - self.tableau.parametre['colsep'] = dlg.colsep[dlg.choice3.GetSelection()] - self.tableau.parametre['txtsep'] = dlg.txtsep[dlg.choice4.GetSelection()] - if self.tableau.parametre['colsep'] == 'tabulation' : - self.tableau.parametre['colsep'] = '\t' - self.tableau.parametre['filetype'] = 'csv' - else : - dlg.Destroy() + self.tableau.parametres['colsep'] = dlg.colsep[dlg.choice3.GetSelection()] + self.tableau.parametres['txtsep'] = dlg.txtsep[dlg.choice4.GetSelection()] + if self.tableau.parametres['colsep'] == 'tabulation' : + self.tableau.parametres['colsep'] = '\t' + self.tableau.parametres['filetype'] = 'csv' elif getfileextension(filename) == '.xls' : dlg = dialog.FileOptionDialog(self, -1, _(u"File format").decode('utf8'), sep=False, sheet = True, size=(350, 200), style=wx.DEFAULT_DIALOG_STYLE) dlg.CenterOnParent() val = dlg.ShowModal() if val == wx.ID_OK: - self.tableau.parametre['colsep'] = ';' - self.tableau.parametre['txtsep'] = '\"' - self.tableau.parametre['encodage'] = sys.getdefaultencoding() - self.tableau.parametre['sheetnb'] = dlg.spin1.GetValue() - self.tableau.parametre['filetype'] = 'xls' - else : - dlg.Destroy() + self.tableau.parametres['colsep'] = ';' + self.tableau.parametres['txtsep'] = '\"' + self.tableau.parametres['encodage'] = sys.getdefaultencoding() + self.tableau.parametres['sheetnb'] = dlg.spin1.GetValue() + self.tableau.parametres['filetype'] = 'xls' elif getfileextension(filename) == '.ods': dlg = dialog.FileOptionDialog(self, -1, _(u"File format").decode('utf8'), sep=False, size=(350, 200), style=wx.DEFAULT_DIALOG_STYLE) dlg.CenterOnParent() val = dlg.ShowModal() if val == wx.ID_OK: - self.tableau.parametre['colsep'] = ';' - self.tableau.parametre['txtsep'] = '\"' - self.tableau.parametre['filetype'] = 'ods' - else : - dlg.Destroy() + self.tableau.parametres['colsep'] = ';' + self.tableau.parametres['txtsep'] = '\"' + self.tableau.parametres['filetype'] = 'ods' else : val = False if val == wx.ID_OK: @@ -94,7 +89,8 @@ def get_table_param(self, filename) : self.tableau.firstcolisrownames = True else: self.tableau.firstcolisrownames = False - dlg.Destroy() + dlg.Destroy() + return val def getPage(ira) : if '_mgr' in dir(ira) : @@ -962,3 +958,232 @@ class PrepSimi : param['stars'] = self.parametres['stars'] self.parametres.update(param) +class CreateTgenDialog ( wx.Frame ): + + def __init__( self, parent, lemlist, tgen = None, tgens = None ): + wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u'Tgen Creator', pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL|wx.FRAME_FLOAT_ON_PARENT|wx.STAY_ON_TOP ) + + self.tgens = tgens + self.edit = False + self.parent = parent + self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize ) + + bSizer2 = wx.BoxSizer( wx.VERTICAL ) + + fgSizer3 = wx.FlexGridSizer( 0, 2, 0, 0 ) + fgSizer3.SetFlexibleDirection( wx.BOTH ) + fgSizer3.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) + + self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, u"Name", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_staticText3.Wrap( -1 ) + fgSizer3.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 ) + + self.m_textCtrl1 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_textCtrl1.SetMinSize( wx.Size( 250,-1 ) ) + + + fgSizer3.Add( self.m_textCtrl1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) + + + bSizer2.Add( fgSizer3, 1, wx.ALIGN_CENTER_HORIZONTAL, 5 ) + + self.ip = VItemsPicker(self,-1, lemlist,'Forms', 'Selected') + self.ip._source.SetMinSize( wx.Size( 250, 400 ) ) + + bSizer2.Add( self.ip, 0, wx.ALL, 5 ) + + m_sdbSizer3 = wx.StdDialogButtonSizer() + self.m_sdbSizer3OK = wx.Button( self, wx.ID_OK ) + m_sdbSizer3.AddButton( self.m_sdbSizer3OK ) + self.m_sdbSizer3Cancel = wx.Button( self, wx.ID_CANCEL ) + m_sdbSizer3.AddButton( self.m_sdbSizer3Cancel ) + m_sdbSizer3.Realize(); + + bSizer2.Add( m_sdbSizer3, 1, wx.EXPAND, 5 ) + + + self.SetSizer( bSizer2 ) + self.Layout() + bSizer2.Fit( self ) + + self.Centre( wx.BOTH ) + + self.m_textCtrl1.Bind( wx.EVT_TEXT, self.OnTextEnter ) + self.ip.Bind(EVT_IP_SELECTION_CHANGED, self.OnSelectionChange) + self.m_sdbSizer3OK.Bind(wx.EVT_BUTTON, self.OnClose) + self.m_sdbSizer3Cancel.Bind(wx.EVT_BUTTON, self.OnCancel) + + #self.ip.SetItems(lemlist) + self.m_sdbSizer3OK.Enable(False) + + if tgen is not None : + self.m_textCtrl1.SetValue(tgen) + self.ip._destData = dict([[i,[word,'']] for i, word in enumerate(tgens[tgen])]) + self.ip._SetDestItems() + #self.ip.SetSelections(tgens[tgen]) + self.m_sdbSizer3OK.Enable(True) + self.edit = True + else : + self.edit = False + + def __del__( self ): + pass + + def OnTextEnter(self, evt): + if self.m_textCtrl1.GetValue() != '' and self.m_textCtrl1.GetValue() not in self.tgens and self.ip.GetSelections() != []: + self.m_sdbSizer3OK.Enable(True) + else : + self.m_sdbSizer3OK.Enable(False) + if self.m_textCtrl1.GetValue() != '' and self.ip.GetSelections() and self.edit: + self.m_sdbSizer3OK.Enable(True) + + def OnSelectionChange(self, evt): + if self.ip.GetSelections() != [] and self.m_textCtrl1.GetValue() != '' and self.m_textCtrl1.GetValue() not in self.tgens : + self.m_sdbSizer3OK.Enable(True) + else : + self.m_sdbSizer3OK.Enable(False) + if self.m_textCtrl1.GetValue() != '' and self.ip.GetSelections() and self.edit: + self.m_sdbSizer3OK.Enable(True) + + def OnClose(self, evt): + self.Close() + + def OnCancel(self, evt): + self.Destroy() + +class TGenFrame ( wx.Frame ): + + def __init__( self, parent, corpus, Tgen ): + wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u"Tgen", pos = wx.DefaultPosition, size = wx.Size( 473,434 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL|wx.FRAME_FLOAT_ON_PARENT|wx.STAY_ON_TOP ) + + self.Tgen = Tgen + self.parent = parent + self.corpus = corpus + self.activetgen = None + + self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize ) + + bSizer1 = wx.BoxSizer( wx.VERTICAL ) + + fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 ) + fgSizer1.SetFlexibleDirection( wx.BOTH ) + fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) + + self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, u"Tgen", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_staticText1.Wrap( -1 ) + fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) + + self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, u"Content", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_staticText2.Wrap( -1 ) + fgSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) + + tgensChoices = Tgen.tgen.keys() + self.tgens = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, tgensChoices, 0 ) + self.tgens.SetMinSize( wx.Size( 200,250 ) ) + + fgSizer1.Add( self.tgens, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) + + tgencontentChoices = [] + self.tgencontent = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, tgencontentChoices, 0|wx.VSCROLL ) + self.tgencontent.SetMinSize( wx.Size( 200,250 ) ) + + fgSizer1.Add( self.tgencontent, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) + + fgSizer2 = wx.FlexGridSizer( 0, 2, 0, 0 ) + fgSizer2.SetFlexibleDirection( wx.BOTH ) + fgSizer2.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) + + self.but_new = wx.Button( self, wx.ID_ANY, u"New...", wx.DefaultPosition, wx.DefaultSize, 0 ) + fgSizer2.Add( self.but_new, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) + + self.but_del = wx.Button( self, wx.ID_ANY, u"Delete", wx.DefaultPosition, wx.DefaultSize, 0 ) + fgSizer2.Add( self.but_del, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) + + + fgSizer1.Add( fgSizer2, 1, wx.EXPAND, 5 ) + + self.but_edit = wx.Button( self, wx.ID_ANY, u"Edit", wx.DefaultPosition, wx.DefaultSize, 0 ) + fgSizer1.Add( self.but_edit, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) + + + bSizer1.Add( fgSizer1, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) + + m_sdbSizer2 = wx.StdDialogButtonSizer() + self.m_sdbSizer2OK = wx.Button( self, wx.ID_OK ) + m_sdbSizer2.AddButton( self.m_sdbSizer2OK ) + #self.m_sdbSizer2Cancel = wx.Button( self, wx.ID_CANCEL ) + #m_sdbSizer2.AddButton( self.m_sdbSizer2Cancel ) + m_sdbSizer2.Realize(); + + bSizer1.Add( m_sdbSizer2, 0, wx.EXPAND, 5 ) + + + self.SetSizer( bSizer1 ) + self.Layout() + + self.Centre( wx.BOTH ) + + # Connect Events + self.tgens.Bind( wx.EVT_LISTBOX, self.GetContent ) + self.but_new.Bind( wx.EVT_BUTTON, self.OnNewTgen ) + self.but_del.Bind( wx.EVT_BUTTON, self.OnDeleteTgen ) + self.but_edit.Bind( wx.EVT_BUTTON, self.OnEditTgen ) + self.m_sdbSizer2OK.Bind( wx.EVT_BUTTON, self.OnOK ) + + def __del__( self ): + pass + + def GetContent( self, event ): + tgen = event.GetString() + if tgen != '' : + self.tgencontent.Clear() + for word in self.Tgen[tgen] : + self.tgencontent.Append(word) + + def OnNewTgen( self, event, tgen = None ): + if tgen is None : + self.dial = CreateTgenDialog(self, dict([[i, [lem, self.corpus.lems[lem].freq]] for i, lem in enumerate(self.corpus.lems.keys())]), tgens = self.Tgen.tgen) + else : + self.dial = CreateTgenDialog(self, dict([[i, [lem, self.corpus.lems[lem].freq]] for i, lem in enumerate(self.corpus.lems.keys())]), tgen = tgen, tgens = self.Tgen.tgen) + self.activetgen = tgen + self.dial.Show() + self.dial.Bind(wx.EVT_CLOSE, self.OnDialClose) + + def OnDeleteTgen( self, event ): + if self.tgens.GetSelection() != -1 : + tgens = self.tgens.GetItems() + del self.Tgen.tgen[tgens[self.tgens.GetSelection()]] + self.Tgen.write() + self.tgens.Clear() + self.tgencontent.Clear() + for val in self.Tgen.tgen : + self.tgens.Append(val) + event.Skip() + + def OnEditTgen( self, event ): + if self.tgens.GetSelection() != -1 : + tgens = self.tgens.GetItems() + tgen = tgens[self.tgens.GetSelection()] + self.activetgen = tgen + self.dial = CreateTgenDialog(self, dict([[i, [lem, self.corpus.lems[lem].freq]] for i, lem in enumerate(self.corpus.lems.keys())]), tgen = tgen, tgens = self.Tgen.tgen) + self.dial.Bind(wx.EVT_CLOSE, self.OnDialClose) + self.dial.m_textCtrl1.Enable(False) + self.dial.ip._source.selected = dict(zip(self.Tgen.tgen[tgen], self.Tgen.tgen[tgen])) + self.dial.Show() + event.Skip() + + def OnOK(self, evt): + self.Destroy() + + def OnDialClose(self, evt): + if self.dial.edit : + del self.Tgen.tgen[self.activetgen] + self.tgens.Clear() + self.tgencontent.Clear() + for val in self.Tgen.tgen : + self.tgens.Append(val) + self.Tgen.tgen[self.dial.m_textCtrl1.GetValue()] = self.dial.ip.GetSelections() + self.Tgen.write() + self.tgens.Append(self.dial.m_textCtrl1.GetValue()) + self.dial.Destroy() + evt.Skip() diff --git a/images/splash.svg b/images/splash.svg index f7759e2..0819907 100644 --- a/images/splash.svg +++ b/images/splash.svg @@ -15,7 +15,7 @@ height="400" id="svg2" version="1.1" - inkscape:version="0.48.3.1 r9886" + inkscape:version="0.48.4 r9939" sodipodi:docname="splash.svg" inkscape:export-filename="/home/pierre/workspace/iramuteq/images/splash.png" inkscape:export-xdpi="100" @@ -23,6 +23,29 @@ + + + + + + + + @@ -90,13 +113,14 @@ width="260" /> + id="linearGradient3854" + osb:paint="gradient"> + style="stop-color:#ecde0c;stop-opacity:1;" /> @@ -113,21 +137,20 @@ + gradientUnits="userSpaceOnUse" /> @@ -139,16 +162,22 @@ inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="1.4" - inkscape:cx="213.60775" - inkscape:cy="156.61747" + inkscape:cx="240.01838" + inkscape:cy="170.0922" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="false" - inkscape:window-width="1018" - inkscape:window-height="1030" - inkscape:window-x="0" - inkscape:window-y="18" - inkscape:window-maximized="0" /> + inkscape:window-width="1631" + inkscape:window-height="1026" + inkscape:window-x="49" + inkscape:window-y="24" + inkscape:window-maximized="1" + showguides="true" + inkscape:guide-bbox="true"> + + @@ -157,7 +186,7 @@ image/svg+xml - + @@ -167,31 +196,31 @@ id="layer1" transform="translate(0,-652.36218)"> IRaMuTeQ IRaMuTeQ Laboratoire LERASS REPERE REPERE Licence GNU GPL (c) 2008-2013 Pierre Ratinaud www.iramuteq.org Version 0.6 alpha 4