X-Git-Url: http://iramuteq.org/git?p=iramuteq;a=blobdiff_plain;f=Liste.py;h=daf58f5f698148d62137f065916ac00fdb53f37d;hp=791ff67cabce7324da475e880ce68999850ad118;hb=42499e5db4394973bd0761d40ea09e515925ed4b;hpb=342d693d835ba1077fe0f31824664a807cafa3bb diff --git a/Liste.py b/Liste.py index 791ff67..daf58f5 100644 --- a/Liste.py +++ b/Liste.py @@ -19,7 +19,7 @@ import wx from dialog import SearchDial, message import wx.lib.mixins.listctrl as listmix from operator import itemgetter - +from functions import doconcorde #--------------------------------------------------------------------------- class ListPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.ColumnSorterMixin): @@ -53,9 +53,9 @@ class ListPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.ColumnSorte self.attr2.SetBackgroundColour("light blue") - self.InsertColumn(0, 'forme', wx.LIST_FORMAT_RIGHT) - self.InsertColumn(1, 'nb', wx.LIST_FORMAT_RIGHT) - self.InsertColumn(2, 'type', wx.LIST_FORMAT_RIGHT) + self.InsertColumn(0, _(u'Form').decode('utf8'), wx.LIST_FORMAT_RIGHT) + self.InsertColumn(1, _(u'Freq.').decode('utf8'), wx.LIST_FORMAT_RIGHT) + self.InsertColumn(2, _(u'POS').decode('utf8'), wx.LIST_FORMAT_RIGHT) #self.InsertColumn(3, '', wx.LIST_FORMAT_RIGHT) self.SetColumnWidth(0, 150) @@ -71,6 +71,7 @@ class ListPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.ColumnSorte self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected, self) self.Bind(wx.EVT_LIST_COL_CLICK, self.OnColClick, self) + self.Bind(wx.EVT_LIST_ITEM_ACTIVATED , self.OnPopupTwo, self) # for wxMSW self.Bind(wx.EVT_COMMAND_RIGHT_CLICK, self.OnRightClick) @@ -141,8 +142,8 @@ class ListPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.ColumnSorte def onsearch(self, evt) : self.dial = SearchDial(self, self, 0, True) self.dial.CenterOnParent() - self.dial.ShowModal() - self.dial.Destroy() + self.dial.Show() + #self.dial.Destroy() def OnRightClick(self, event): @@ -159,8 +160,8 @@ class ListPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.ColumnSorte # make a menu menu = wx.Menu() # add some items - menu.Append(self.popupID1, u"Formes associées") - menu.Append(self.popupID2, u"Concordancier") + menu.Append(self.popupID1, _(u"Associated forms").decode('utf8')) + menu.Append(self.popupID2, _(u"Concordance").decode('utf8')) # menu.Append(self.popupID3, "recharger") self.PopupMenu(menu) @@ -173,29 +174,22 @@ class ListPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.ColumnSorte lems = corpus.getlems() rep = [] for forme in lems[word].formes : - rep.append([corpus.getforme(forme).forme, corpus.getforme(forme).freq]) + rep.append([corpus.getforme(forme).forme, corpus.getforme(forme).freq]) rep.sort(key = itemgetter(1), reverse = True) - win = message(self, u"Formes associées", (300, 200)) - win.html = '\n' + '
'.join([' : '.join([str(val) for val in forme]) for forme in rep]) + '\n' - win.HtmlPage.SetPage(win.html) + items = dict([[i, '' + '\t:\t'.join([str(val) for val in forme]) + ''] for i, forme in enumerate(rep)]) + win = message(self, items, _(u"Associated forms").decode('utf8'), (300, 200)) + #win.html = '\n' + '
'.join([' : '.join([str(val) for val in forme]) for forme in rep]) + '\n' + #win.HtmlPage.SetPage(win.html) win.Show(True) def OnPopupTwo(self, event): corpus = self.gparent.corpus - win = message(self, u"Concordancier", (750, 600)) - avap = 60 item = self.getColumnText(self.GetFirstSelected(), 0) - listmot = corpus.getlems()[item].formes - #uce_ok = [corpus.formes[corpus.idformes[forme].forme][1] for forme in listmot] - uce_ok = corpus.getlemuces(item)#list(set([tuple(val) for line in uce_ok for val in line])) - txt = '

Concordancier

' - res = corpus.getconcorde(uce_ok) - for uce in res : - ucetxt = ' '+uce[1]+' ' - txt += ' '.join(corpus.ucis[corpus.getucefromid(uce[0]).uci].etoiles) + '
' - for forme in listmot : - forme = corpus.getforme(forme).forme - ucetxt = ucetxt.replace(' '+forme+' ', ' ' + forme + ' ') - txt += ucetxt + '

' - win.HtmlPage.SetPage(txt) + uce_ok = corpus.getlemuces(item) + ucis_txt, ucestxt = doconcorde(corpus, uce_ok, [item]) + items = dict([[i, '

'.join([ucis_txt[i], ucestxt[i]])] for i in range(0,len(ucestxt))]) + win = message(self, items, ' - '.join([_(u"Concordance").decode('utf8'), "%s" % item]), (800, 500), uceids = uce_ok) + #win = message(self, u"Concordancier", (750, 600)) + #win.html = ('\n

%s

' % item) + '
'.join(['
'.join([ucis_txt[i], ucestxt[i]]) for i in range(0,len(ucestxt))]) + '\n' + #win.HtmlPage.SetPage(win.html) win.Show(True)