From 53f0fafbd5064470895e46b5b55958fbf5903b15 Mon Sep 17 00:00:00 2001 From: Pierre Date: Sat, 9 Feb 2013 14:33:18 +0100 Subject: [PATCH] segments repetes dans classes --- ProfList.py | 32 +++++++++++++++++++++++++++++--- listlex.py | 47 ++++++++++++++++++++++++----------------------- 2 files changed, 53 insertions(+), 26 deletions(-) diff --git a/ProfList.py b/ProfList.py index 213ae68..6d007a7 100644 --- a/ProfList.py +++ b/ProfList.py @@ -24,7 +24,7 @@ from dialog import PrefExport, PrefUCECarac, SearchDial, message from tableau import Tableau from search_tools import SearchFrame import webbrowser -import cStringIO +#import cStringIO import tempfile import codecs from functions import exec_rcode, MessageImage, progressbar, treat_var_mod @@ -291,7 +291,7 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col self.Bind(wx.EVT_MENU, self.onwordgraph, id = self.idwordgraph) self.Bind(wx.EVT_MENU, self.onproxe, id = self.popup_proxe) self.Bind(wx.EVT_MENU, self.onlexdendro, id = self.idlexdendro) - self.Bind(wx.EVT_MENU, self.onexport, id = self.idexport) + #self.Bind(wx.EVT_MENU, self.onexport, id = self.idexport) # self.Bind(wx.EVT_MENU, self.on_export_classes, id = self.export_classes) # self.Bind(wx.EVT_MENU, self.OnPopupThree, id=self.popupID3) @@ -323,7 +323,7 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col menu.Append(self.popupIDgraph, u"Graphe de la classe") menu.Append(self.idseg, u"Segments répétés") menu.Append(self.iducecarac, u"UCE caractéristiques") - menu.Append(self.idexport, 'Partitionner...') + #menu.Append(self.idexport, 'Partitionner...') #menu.Append(self.popupID2, u"Concordancier") # menu.Append(self.popupID3, "recharger") @@ -786,3 +786,29 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col win.html = '\n' + '
'.join([' : '.join([str(val) for val in forme]) for forme in rep]) + '\n' win.HtmlPage.SetPage(win.html) win.Show(True) + + +class wliste(wx.Frame): + def __init__(self, parent, id, title, d, fline, size=(600, 500)): + wx.Frame.__init__(self, parent, id) + self.liste = ListForSpec(self, parent, d, fline, menu = False) + 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.__do_layout() + + def __do_layout(self): + sizer_1 = wx.BoxSizer(wx.VERTICAL) + sizer_2 = wx.BoxSizer(wx.VERTICAL) + sizer_2.Add(self.liste, 1, wx.EXPAND | wx.ADJUST_MINSIZE, 0) + sizer_2.Add(self.button_1, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ADJUST_MINSIZE, 0) + sizer_1.Add(sizer_2, 1, wx.EXPAND, 0) + self.SetAutoLayout(True) + self.SetSizer(sizer_1) + self.Layout() + + def OnCloseMe(self, event): + self.Close(True) + + def OnCloseWindow(self, event): + self.Destroy() diff --git a/listlex.py b/listlex.py index 75607f3..b4e1b59 100644 --- a/listlex.py +++ b/listlex.py @@ -31,12 +31,13 @@ from dialog import SearchDial # listmix.ListCtrlAutoWidthMixin.__init__(self) class ListForSpec(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.ColumnSorterMixin): - def __init__(self, parent,gparent, dlist,first): + def __init__(self, parent,gparent, dlist, first, menu = True): wx.ListCtrl.__init__( self, parent, -1, style=wx.LC_REPORT|wx.LC_VIRTUAL|wx.LC_HRULES|wx.LC_VRULES) self.parent=parent self.gparent=gparent self.dlist=dlist self.first = first + self.menu = menu search_id = wx.NewId() self.parent.Bind(wx.EVT_MENU, self.onsearch, id = search_id) @@ -151,28 +152,28 @@ class ListForSpec(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.ColumnSor self.dial.Destroy() def OnRightClick(self, event): - - # only do this part the first time so the events are only bound once - if not hasattr(self, "popupID1"): - self.popupID1 = wx.NewId() - self.popupID2 = wx.NewId() - self.popupID3 = wx.NewId() - self.popup_Tgen_glob = wx.NewId() - - self.Bind(wx.EVT_MENU, self.OnPopupOne, id=self.popupID1) - self.Bind(wx.EVT_MENU, self.OnPopupTwo, id=self.popupID2) - self.Bind(wx.EVT_MENU, self.OnPopupThree, id=self.popupID3) - self.Bind(wx.EVT_MENU, self.OnTgen_glob, id=self.popup_Tgen_glob) - # 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.popupID3, "Graphique") - #menu.Append(self.popup_Tgen_glob, "Tgen global") - - self.PopupMenu(menu) - menu.Destroy() + if self.menu : + # only do this part the first time so the events are only bound once + if not hasattr(self, "popupID1"): + self.popupID1 = wx.NewId() + self.popupID2 = wx.NewId() + self.popupID3 = wx.NewId() + self.popup_Tgen_glob = wx.NewId() + + self.Bind(wx.EVT_MENU, self.OnPopupOne, id=self.popupID1) + self.Bind(wx.EVT_MENU, self.OnPopupTwo, id=self.popupID2) + self.Bind(wx.EVT_MENU, self.OnPopupThree, id=self.popupID3) + self.Bind(wx.EVT_MENU, self.OnTgen_glob, id=self.popup_Tgen_glob) + # 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.popupID3, "Graphique") + #menu.Append(self.popup_Tgen_glob, "Tgen global") + + self.PopupMenu(menu) + menu.Destroy() def getselectedwords(self) : words = [self.getColumnText(self.GetFirstSelected(), 0)] -- 2.7.4