X-Git-Url: http://iramuteq.org/git?a=blobdiff_plain;f=layout.py;h=c671a541d51d04a111264352e166e3d627937746;hb=d0bb4e6888ca98ba7177457d65ddce796fd2b298;hp=7c7edd987208589f26ca2521e1540dd45ad9215d;hpb=e6f6318b1ab077a97c10559b3323ccf158ae6203;p=iramuteq diff --git a/layout.py b/layout.py index 7c7edd9..c671a54 100644 --- a/layout.py +++ b/layout.py @@ -46,6 +46,7 @@ from webexport import WebExport from corpus import Corpus from sheet import MySheet from graph_to_json import GraphToJson +from listlex2 import LexPanel import langue @@ -251,7 +252,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) @@ -751,15 +752,22 @@ class dolexlayout : #sash = SashList(ira.nb) self.TabStat = aui.AuiNotebook(ira.nb, -1, wx.DefaultPosition) self.TabStat.parametres = parametres + #self.ListPan = LexPanel(self, ira, self.DictSpec, self.etoiles) self.ListPan = ListForSpec(ira, self, self.DictSpec, self.etoiles) + self.ListPan.pathout = self.pathout if os.path.exists(self.pathout['banalites.csv']) : self.listban = ListForSpec(ira, self, self.dictban, ['eff'] + self.etoiles, usefirst = True) #self.ListPan2 = ListForSpec(sash.rightwin1, self, self.DictSpec, first) self.ListPant = ListForSpec(ira, self, self.DictType, self.etoiles) + self.ListPant.pathout = self.pathout self.ListPanEff = ListForSpec(ira, self, self.DictEff, self.etoiles) + self.ListPanEff.pathout = self.pathout self.ListPanEffType = ListForSpec(ira, self, self.DictEffType, self.etoiles) + self.ListPanEffType.pathout = self.pathout self.ListPanEffRelForme = ListForSpec(ira, self, self.DictEffRelForme, self.etoiles) + self.ListPanEffRelForme.pathout = self.pathout self.ListPanEffRelType = ListForSpec(ira, self, self.DictEffRelType, self.etoiles) + self.ListPanEffRelType.pathout = self.pathout self.TabStat.AddPage(self.ListPan, _('Forms')) if os.path.exists(self.pathout['banalites.csv']) : self.TabStat.AddPage(self.listban, _('Banal forms')) @@ -781,6 +789,7 @@ class dolexlayout : self.ira = ira self.TabStat.corpus = self.corpus self.TabStat.etoiles = self.etoiles + self.TabStat.pathout = self.pathout if os.path.exists(os.path.join(self.parametres['pathout'], 'tgenspec.csv')) : self.parametres['tgenspec'] = os.path.join(self.parametres['pathout'], 'tgenspec.csv') TgenLayout(self.TabStat) @@ -991,7 +1000,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) @@ -1054,7 +1063,6 @@ class OpenCorpus : ira.nb.SetSelection(ira.nb.GetPageCount() - 1) ira.ShowAPane("Tab_content") - class MatLayout : def __init__(self, ira, matrix): @@ -1206,7 +1214,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) @@ -1362,7 +1370,8 @@ class FreqLayout(DefaultMatLayout) : self.tab = wx.html.HtmlWindow(self.ira.nb, -1) #self.tab = wx.html2.WebView.New(self) res = normpath_win32(self.pathout['resultats.html']).replace('\\','/') - self.tab.LoadPage(res) + #self.tab.LoadPage(res) + self.tab.LoadFile(res) #self.tab.LoadURL(res) self.tab.parametres = self.parametres self.ira.nb.AddPage(self.tab, ' - '.join([_("Frequency"), self.parametres['name']])) @@ -1375,7 +1384,7 @@ class Chi2Layout(DefaultMatLayout) : if "gtk2" in wx.PlatformInfo: self.tab.SetStandardFonts() res = normpath_win32(self.pathout['resultats-chi2.html']).replace('\\','/') - self.tab.LoadPage(res) + self.tab.LoadFile(res) self.tab.parametres = self.parametres self.ira.nb.AddPage(self.tab, ' - '.join(["Chi2", self.parametres['name']])) #self.ira.nb.SetSelection(self.ira.nb.GetPageCount() - 1) @@ -1402,6 +1411,7 @@ class ProtoLayout(DefaultMatLayout) : 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']])) @@ -1429,7 +1439,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 : @@ -1442,6 +1452,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() @@ -1456,7 +1467,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() @@ -1584,7 +1595,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)