X-Git-Url: http://www.iramuteq.org/git?a=blobdiff_plain;f=search_tools.py;h=5dd03a0b6173d7b24e84464fc877fdcc6e291631;hb=eaa044d1147e26b82942ce56d5965c83fdddf069;hp=5a0984d47099fcd48d58923880d2f1423b1e3b9f;hpb=10d67a5cd48583c060b6a0e77e87c41f80671027;p=iramuteq diff --git a/search_tools.py b/search_tools.py index 5a0984d..5dd03a0 100644 --- a/search_tools.py +++ b/search_tools.py @@ -1,15 +1,28 @@ # -*- coding: utf-8 -*- #Author: Pierre Ratinaud -#Copyright (c) 2011 Pierre Ratinaud +#Copyright (c) 2008-2020 Pierre Ratinaud +#modification pour python 3 : Laurent Mérat, 6x7 - mai 2020 #License: GNU/GPL +#------------------------------------ +# import des modules python +#------------------------------------ +import codecs + +#------------------------------------ +# import des modules wx +#------------------------------------ import wx + +#------------------------------------ +# import des fichiers du projet +#------------------------------------ from search_list import SearchList from dialog import SearchDial -import codecs class SearchFrame(wx.Frame): + def __init__(self, parent, id, title, corpus, size=(800, 900)): # begin wxGlade: MyFrame.__init__ #kwds["style"] = wx.DEFAULT_FRAME_STYLE @@ -21,9 +34,8 @@ class SearchFrame(wx.Frame): self.Bind(wx.EVT_MENU, self.onsearch, id = search_id) self.accel_tbl = wx.AcceleratorTable([(wx.ACCEL_CTRL, ord('F'), search_id)]) self.SetAcceleratorTable(self.accel_tbl) - self.corpus = corpus - dlg = wx.ProgressDialog(u"Traitements", u"lecture du tableau...", maximum = 4, parent=self, style = wx.PD_APP_MODAL|wx.PD_AUTO_HIDE|wx.PD_ELAPSED_TIME) + dlg = wx.ProgressDialog("Traitements", "lecture du tableau...", maximum = 4, parent=self, style = wx.PD_APP_MODAL|wx.PD_AUTO_HIDE|wx.PD_ELAPSED_TIME) dlg.Center() dlg.Update(1) with codecs.open(corpus.dictpathout['chisqtable'], 'r', parent.SysEncoding) as f : @@ -34,25 +46,24 @@ class SearchFrame(wx.Frame): dlg.Update(2) self.dchisqtable = dict([[i, [i, line[0]] + [float(val) for val in line[1:]]] for i, line in enumerate(chisqtable)]) self.dindex = dict([[line[0], i] for i,line in enumerate(chisqtable)]) - #self.text_ctrl_1 = wx.TextCtrl(self, -1, "", style=wx.TE_MULTILINE) - #nbactives = len(self.corpus.actives) + #self.text_ctrl_1 = wx.TextCtrl(self, -1, "", style=wx.TE_MULTILINE) + #nbactives = len(self.corpus.actives) dlg.Update(3) with open(corpus.dictpathout['ContEtOut'], 'r') as f : nbetoiles = len(f.readlines()) with open(corpus.dictpathout['Contout'], 'r') as f : nbactives = len(f.readlines()) - dlg.Update(4, u"Ouverture...") + dlg.Update(4, "Ouverture...") self.liste = SearchList(self, parent, self.dchisqtable, first, nbactives, nbetoiles) dlg.Destroy() #self.HtmlPage = wx.html.HtmlWindow(self, -1) #if "gtk2" in wx.PlatformInfo: # self.HtmlPage.SetStandardFonts() #self.HtmlPage.SetFonts('Courier', 'Courier') - self.button_1 = wx.Button(self, -1, "Fermer") self.Bind(wx.EVT_BUTTON, self.OnCloseMe, self.button_1) self.Bind(wx.EVT_CLOSE, self.OnCloseWindow) - self.SetTitle(u'Navigation') + self.SetTitle('Navigation') self.SetSize(wx.Size(900,700)) self.__do_layout() # end wxGlade @@ -69,7 +80,7 @@ class SearchFrame(wx.Frame): self.SetSizer(sizer_1) self.Layout() # end wxGlade - + def OnCloseMe(self, event): self.Show(False)