X-Git-Url: http://iramuteq.org/git?a=blobdiff_plain;f=layout.py;h=302cbed0b7762343702ab5002fa68b86ed9f8060;hb=1af35be77e3c958e29e8e5d679cd945f48899768;hp=bdaa0384049da0427a05d33069f5633ebc235495;hpb=916692a81898bdf694bfcf73f6c5e6a7d3bba8d0;p=iramuteq diff --git a/layout.py b/layout.py index bdaa038..302cbed 100644 --- a/layout.py +++ b/layout.py @@ -38,6 +38,7 @@ from PrintRScript import write_afc_graph, print_simi3d, PrintSimiScript from profile_segment import ProfileSegment from listlex import * from Liste import * +from elcategorizator import ElCategorizator from search_tools import SearchFrame from dialog import PrefGraph, PrefExport, PrefSimpleFile, PrefDendro, SimpleDialog, ImageViewer from guifunct import SelectColumn, PrepSimi, PrefSimi, redosimi @@ -250,7 +251,7 @@ class GraphPanelAfc(wx.Panel): """ txt += write_afc_graph(self) filetmp = tempfile.mktemp() - with open(filetmp, 'w') as f : + with open(filetmp, 'w', encoding='utf8') as f : f.write(txt) pid = exec_rcode(self.ira.RPath, filetmp) check_Rresult(self.ira, pid) @@ -990,7 +991,7 @@ class GraphPanelDendro(wx.Panel): """ % (ffr(self.dictpathout['RData.RData']), ffr(self.ira.RscriptsPath['Rgraph']), ffr(fileout), width, height, svg, type_dendro, bw) tmpfile = tempfile.mktemp() # ecriture du fichier de script à éxécuter - with open(tmpfile, 'w') as f : + with open(tmpfile, 'w', encoding='utf8') as f : f.write(txt) # dialogue d'attente busy = wx.BusyInfo(_("Please wait..."), self.parent) @@ -1053,7 +1054,6 @@ class OpenCorpus : ira.nb.SetSelection(ira.nb.GetPageCount() - 1) ira.ShowAPane("Tab_content") - class MatLayout : def __init__(self, ira, matrix): @@ -1205,7 +1205,7 @@ def blender(self): """ # ecriture du fichier de script à éxécuter filetmp = tempfile.mktemp() - with open(filetmp, 'w') as f : + with open(filetmp, 'w', encoding='utf8') as f : f.write(txt) exec_rcode(self.ira.RPath, filetmp) GraphToJson(nodesfile, edgesfile, jsonout) @@ -1398,6 +1398,12 @@ class ProtoLayout(DefaultMatLayout) : #self.ira.nb.SetSelection(self.ira.nb.GetPageCount() - 1) #self.ira.ShowAPane("Tab_content") +class CateLayout(DefaultMatLayout) : + + def dolayout(self) : + self.tableau.read_tableau(self.pathout['analyse.db']) + TabCate = ElCategorizator(self.ira.nb, self.pathout, self.tableau) + self.ira.nb.AddPage(TabCate, ' - '.join([_('ElCaTeGoRiZaToR'), self.parametres['name']])) class SimiMatLayout(DefaultMatLayout) : @@ -1423,7 +1429,7 @@ class SimiMatLayout(DefaultMatLayout) : #self.parent.nb.SetSelection(self.parent.nb.GetPageCount() - 1) def redosimi(self,evt) : - with open(self.pathout['selected.csv'],'r') as f : + with open(self.pathout['selected.csv'],'r', encoding='utf8') as f : selected = f.read() selected = [int(val) for val in selected.splitlines()] #if self.actives is None : @@ -1436,6 +1442,7 @@ class SimiMatLayout(DefaultMatLayout) : actives = [[val, self.tableau.actives[val]] for val in self.tableau.actives] #self.tableau.make_listactives() actives = dict([[i, val] for i, val in enumerate(actives)]) + print(actives) #dictcol = dict([[i, [act, self.corpus.getlemeff(act)]] for i, act in enumerate(self.actives)]) self.dial = PrefSimi(self.parent, -1, self.parametres, self.indices, wordlist = actives, selected = selected, actives = self.tableau.listactives) self.dial.CenterOnParent() @@ -1450,7 +1457,7 @@ class SimiMatLayout(DefaultMatLayout) : indexes.append(self.dial.listcol.getColumnText(last,0)) self.column = [self.tableau.listactives.index(val) for val in indexes] self.column.sort() - with open(self.pathout['selected.csv'], 'w') as f : + with open(self.pathout['selected.csv'], 'w', encoding='utf8') as f : f.write('\n'.join([repr(val) for val in self.column])) self.make_param() self.dial.Destroy() @@ -1578,7 +1585,7 @@ class SimiMatLayout(DefaultMatLayout) : #saveAsGEXF(graph, filepath = fileout) """ % (ffr(self.pathout['RData.RData']), ffr(self.parent.RscriptsPath['simi']), fileout) filetmp = tempfile.mktemp() - with open(filetmp, 'w') as f : + with open(filetmp, 'w', encoding='utf8') as f : f.write(txt) exec_rcode(self.ira.RPath, filetmp) mss = wx.MessageDialog(self.ira, fileout, _('File exported'), wx.OK)