- txt = """
- source("%s")
- library(wordcloud)
- act <- read.csv2("%s", header = FALSE, row.names = 1)
- maxword <- %i
- maxtoprint <- ifelse(nrow(act) > maxword, maxword, nrow(act))
- toprint <- act[1:maxtoprint,]
- open_file_graph("%s", width = %i, height = %i)
- par(bg=rgb%s)
- wordcloud(row.names(toprint), toprint[,1], scale=c(%f,%f), random.order=FALSE, colors=rgb%s)
- dev.off()
- """ % (self.parent.RscriptsPath['Rgraph'], ffr(os.path.join(self.pathout, 'actives.csv')), maxword, ffr(outgraph), width, height, col_bg, maxcex, mincex, col_text)
- tmpscript = tempfile.mktemp(dir=self.parent.TEMPDIR)
- with open(tmpscript, 'w') as f :
- f.write(txt)
- pid = exec_rcode(self.parent.RPath, tmpscript, wait = False)
- while pid.poll() == None :
- self.dlg.Pulse('R...')
- sleep(0.2)
- check_Rresult(self.parent, pid)
- self.corpus.save_corpus(self.dictpathout['db'])
- CreateIraFile(self.dictpathout, 0, corpname = os.path.basename(self.corpus.parametre['filename']), section =
- 'wordcloud')
- #win = MessageImage(self.parent, -1, u"Graphique", size=(700, 500),style = wx.DEFAULT_FRAME_STYLE)
- #win.imagename = "nuage.png"
- #win.addsaveimage(outgraph)
- #txt = "<img src='%s'>" % FFF(outgraph).replace('//','/')
- #win.HtmlPage.SetPage(txt)
- #win.Show(True)
- if not self.cmd :
- #OpenAnalyse(self.parent, self.dictpathout['ira'])
- #self.DoLayout(self.parent)
- OpenAnalyse(self.parent, self.dictpathout['ira'])
- self.dlg.Update(7, 'fini')
- self.dlg.Destroy()