X-Git-Url: http://iramuteq.org/git?p=iramuteq;a=blobdiff_plain;f=ProfList.py;h=db822cf1f6f2e0bbe59716a65e5a5257b7f59fe9;hp=cca1423bab0fada0ae12887d4d940fc86aa4694e;hb=e413cbe74a3396e4768f952591899272d7e2b7f1;hpb=1a995a6ca4e8dbb09c8b9ab1276dabf17e065f0d diff --git a/ProfList.py b/ProfList.py index cca1423..db822cf 100644 --- a/ProfList.py +++ b/ProfList.py @@ -20,7 +20,7 @@ import wx.lib.mixins.listctrl as listmix from tabsimi import DoSimi from listlex import ListForSpec from chemins import ConstructPathOut, ffr -from dialog import PrefExport, PrefUCECarac, SearchDial +from dialog import PrefExport, PrefUCECarac, SearchDial, message from tableau import Tableau from search_tools import SearchFrame import webbrowser @@ -154,18 +154,9 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col def OnItemSelected(self, event): self.currentItem = event.m_itemIndex - #print 'OnItemSelected: "%s", "%s", "%s", "%s"\n' % (self.currentItem, self.GetItemText(self.currentItem), self.getColumnText(self.currentItem, 1), self.getColumnText(self.currentItem, 2)) - #self.log.WriteText('OnItemSelected: "%s", "%s", "%s", "%s"\n' % - # (self.currentItem, - # self.GetItemText(self.currentItem), - # self.getColumnText(self.currentItem, 1), - # self.getColumnText(self.currentItem, 2))) def OnItemActivated(self, event): self.currentItem = event.m_itemIndex - #print "OnItemActivated: %s\nTopItem: %s\n" % (self.GetItemText(self.currentItem), self.GetTopItem()) - #self.log.WriteText("OnItemActivated: %s\nTopItem: %s\n" % - # (self.GetItemText(self.currentItem), self.GetTopItem())) def getColumnText(self, index, col): item = self.GetItem(index, col) @@ -173,9 +164,6 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col def OnItemDeselected(self, evt): pass - #self.log.WriteText("OnItemDeselected: %s" % evt.m_itemIndex) - - #--------------------------------------------------- # These methods are callbacks for implementing the # "virtualness" of the list... @@ -200,7 +188,6 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col def OnGetItemAttr(self, item): index=self.itemIndexMap[item] - #genre=self.itemDataMap[index][2] if index < self.lenact : if item % 2 : return self.attr1 @@ -219,15 +206,6 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col else : return None -# if genre=="Rock": -# return self.attr2 -# elif genre=="Jazz": -# return self.attr1 -# elif genre=="New Age": -# return self.attr3 -# else: -# return None - #--------------------------------------------------- # Matt C, 2006/02/22 # Here's a better SortItems() method -- @@ -526,59 +504,60 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col DoSimi(self, param = paramsimi, fromprof = ffr(self.filename), pathout = pathout, wordgraph = word) def on_graph(self, evt): - dlg = progressbar(self, 2) - corpus = self.Source.corpus - uces = corpus.lc[self.cl-1] - dlg.Update(1, u'Tableau...') - #tab = corpus.make_table_with_classe(uces, self.la) - pathout = ConstructPathOut(self.Source.pathout.dirout+'/', 'simi_classe_%i' %self.cl) - self.filename = os.path.join(pathout,'mat01.csv') - dlg.Update(2, u'Ecriture...') - #corpus.write_tab(tab, self.filename) - #del tab - corpus.make_and_write_sparse_matrix_from_classe(self.la, uces, self.filename) - dlg.Destroy() - paramsimi = {'coeff' : 0, - 'layout' : 2, - 'type' : 1, - 'arbremax' : 1, - 'coeff_tv' : 1, - 'coeff_tv_nb' : 0, - 'tvprop' : 0, - 'tvmin' : 5, - 'tvmax' : 30, - 'coeff_te' : 1, - 'coeff_temin' : 1, - 'coeff_temax' : 10, - 'label_v': 1, - 'label_e': 0, - 'vcex' : 0, - 'vcexmin' : 10, - 'vcexmax' : 25, - 'cex' : 10, - 'cexfromchi' : True, - 'sfromchi': False, - 'seuil_ok' : 0, - 'seuil' : 1, - 'cols' : (255,0,0), - 'cola' : (200,200,200), - 'width' : 1000, - 'height' : 1000, - 'first' : True, - 'keep_coord' : True, - 'alpha' : 20, - 'film': False, - } - self.tableau = Tableau(self.parent, '') - self.tableau.listactives = self.la - self.tableau.actives = {} - self.tableau.lchi = self.lchi - self.tableau.chi = {} - self.tableau.parametre['fromprof'] = True - for i, val in enumerate(self.la) : - self.tableau.actives[val] = [self.lfreq[i]] - self.tableau.chi[val] = [self.lchi[i]] - DoSimi(self, param = paramsimi, fromprof = ffr(self.filename), pathout = pathout) + self.parent.SimiFromCluster(self.parent, self.Source.corpus, self.la, self.cl - 1, parametres = {'type' : 'clustersimitxt', 'pathout' : self.Source.parametres['pathout']}, dlg = progressbar(self, 4)) + #dlg = progressbar(self, 2) + #corpus = self.Source.corpus + #uces = corpus.lc[self.cl-1] + #dlg.Update(1, u'Tableau...') + ##tab = corpus.make_table_with_classe(uces, self.la) + #pathout = ConstructPathOut(self.Source.pathout.dirout+'/', 'simi_classe_%i' %self.cl) + #self.filename = os.path.join(pathout,'mat01.csv') + #dlg.Update(2, u'Ecriture...') + ##corpus.write_tab(tab, self.filename) + ##del tab + #corpus.make_and_write_sparse_matrix_from_classe(self.la, uces, self.filename) + #dlg.Destroy() + #paramsimi = {'coeff' : 0, + # 'layout' : 2, + # 'type' : 1, + # 'arbremax' : 1, + # 'coeff_tv' : 1, + # 'coeff_tv_nb' : 0, + # 'tvprop' : 0, + # 'tvmin' : 5, + # 'tvmax' : 30, + # 'coeff_te' : 1, + # 'coeff_temin' : 1, + # 'coeff_temax' : 10, + # 'label_v': 1, + # 'label_e': 0, + # 'vcex' : 0, + # 'vcexmin' : 10, + # 'vcexmax' : 25, + # 'cex' : 10, + # 'cexfromchi' : True, + # 'sfromchi': False, + # 'seuil_ok' : 0, + # 'seuil' : 1, + # 'cols' : (255,0,0), + # 'cola' : (200,200,200), + # 'width' : 1000, + # 'height' : 1000, + # 'first' : True, + # 'keep_coord' : True, + # 'alpha' : 20, + # 'film': False, + # } + #self.tableau = Tableau(self.parent, '') + #self.tableau.listactives = self.la + #self.tableau.actives = {} + #self.tableau.lchi = self.lchi + #self.tableau.chi = {} + #self.tableau.parametre['fromprof'] = True + #for i, val in enumerate(self.la) : + # self.tableau.actives[val] = [self.lfreq[i]] + # self.tableau.chi[val] = [self.lchi[i]] + #DoSimi(self, param = paramsimi, fromprof = ffr(self.filename), pathout = pathout) def on_segments(self,evt) : dlg = progressbar(self, 2) @@ -1593,53 +1572,55 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col # def OnCloseWindow(self, event): # self.Destroy() # -class message(wx.Dialog): - def __init__(self, parent, title, size): - wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = title, pos = wx.DefaultPosition, size = size, style = wx.DEFAULT_DIALOG_STYLE ) - - 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.button_1 = wx.Button(self, wx.ID_CANCEL) - self.button_2 = wx.Button(self, wx.ID_SAVE) - - self.Bind(wx.EVT_BUTTON, self.OnSavePage, self.button_2) - self.Bind(wx.EVT_BUTTON, self.OnCloseMe, self.button_1) - self.Bind(wx.EVT_CLOSE, self.OnCloseWindow) - self.__do_layout() - - def __do_layout(self): - sizer_2 = wx.BoxSizer(wx.VERTICAL) - sizer_2.Add(self.HtmlPage, 0, wx.EXPAND|wx.ADJUST_MINSIZE, 0) - m_sdbSizer1 = wx.StdDialogButtonSizer() - m_sdbSizer1.AddButton( self.button_1 ) - m_sdbSizer1.AddButton( self.button_2 ) - m_sdbSizer1.Realize() - sizer_2.Add(m_sdbSizer1, 1, wx.EXPAND, 5) - self.SetSizer(sizer_2) - self.Layout() - sizer_2.Fit( self ) - - def OnSavePage(self, evt) : - dlg = wx.FileDialog( - self, message="Enregistrer sous...", defaultDir=os.getcwd(), - defaultFile="concordancier.html", wildcard="html|*.html", style=wx.SAVE | wx.OVERWRITE_PROMPT - ) - dlg.SetFilterIndex(2) - dlg.CenterOnParent() - if dlg.ShowModal() == wx.ID_OK: - path = dlg.GetPath() - with open(path, 'w') as f : - f.write(self.html) - - def OnCloseMe(self, event): - self.Close(True) - - def OnCloseWindow(self, event): - self.Destroy() +#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 ) +# 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.button_1 = wx.Button(self, wx.ID_CANCEL) +# +# self.Bind(wx.EVT_BUTTON, self.OnCloseMe, self.button_1) +# if self.save : +# self.button_2 = wx.Button(self, wx.ID_SAVE) +# self.Bind(wx.EVT_BUTTON, self.OnSavePage, self.button_2) +# self.Bind(wx.EVT_CLOSE, self.OnCloseWindow) +# self.__do_layout() +# +# def __do_layout(self): +# sizer_2 = wx.BoxSizer(wx.VERTICAL) +# sizer_2.Add(self.HtmlPage, 0, wx.EXPAND|wx.ADJUST_MINSIZE, 0) +# m_sdbSizer1 = wx.StdDialogButtonSizer() +# m_sdbSizer1.AddButton( self.button_1 ) +# if self.save : +# m_sdbSizer1.AddButton( self.button_2 ) +# m_sdbSizer1.Realize() +# sizer_2.Add(m_sdbSizer1, 1, wx.EXPAND, 5) +# self.SetSizer(sizer_2) +# self.Layout() +# sizer_2.Fit( self ) +# +# def OnSavePage(self, evt) : +# dlg = wx.FileDialog( +# self, message="Enregistrer sous...", defaultDir=os.getcwd(), +# defaultFile="concordancier.html", wildcard="html|*.html", style=wx.SAVE | wx.OVERWRITE_PROMPT +# ) +# dlg.SetFilterIndex(2) +# dlg.CenterOnParent() +# if dlg.ShowModal() == wx.ID_OK: +# path = dlg.GetPath() +# with open(path, 'w') as f : +# f.write(self.html) +# +# def OnCloseMe(self, event): +# self.Close(True) +# +# def OnCloseWindow(self, event): +# self.Destroy()