...
authorPierre <ratinaud@univ-tlse2.fr>
Sat, 24 Nov 2012 15:58:56 +0000 (16:58 +0100)
committerPierre <ratinaud@univ-tlse2.fr>
Sat, 24 Nov 2012 15:58:56 +0000 (16:58 +0100)
Liste.py
listlex.py

index 1b283f6..41b5ee8 100644 (file)
--- a/Liste.py
+++ b/Liste.py
@@ -116,13 +116,6 @@ class ListPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.ColumnSorte
         else :
             return self.attr2
 
-#    def do_greyline(self):
-#        for row in xrange(self.GetItemCount()):
-#            if row % 2 :
-#                self.SetItemBackgroundColour(row, (230, 230, 230))
-#            else :
-#                self.SetItemBackgroundColour(row, wx.WHITE)
-                
     def OnColClick(self, event):
         pass
         #self.do_greyline()
index 5d34a66..aab8637 100644 (file)
@@ -59,34 +59,34 @@ class ListForSpec(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.ColumnSor
         
         self.dlist = dlist 
 
-        self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected, self)
-        
-        # for wxMSW
-        self.Bind(wx.EVT_COMMAND_RIGHT_CLICK, self.OnRightClick)
+        i=0
+        for name in first :
+            self.InsertColumn(i,name,wx.LIST_FORMAT_LEFT)
+            i+=1
+            
+        self.SetColumnWidth(0, 180)
 
-        # for wxGTK
-        self.Bind(wx.EVT_RIGHT_UP, self.OnRightClick)
-        
+        for i in range(1,len(first)-1):
+            self.SetColumnWidth(i, len(first[i]) * 10)
         
         self.itemDataMap = dlist
         self.itemIndexMap = dlist.keys()
         self.SetItemCount(len(dlist))
         
-        listmix.ListCtrlAutoWidthMixin.__init__(self)
+        #listmix.ListCtrlAutoWidthMixin.__init__(self)
         listmix.ColumnSorterMixin.__init__(self, len(first))
-        self.SortListItems(1, False)
+        self.SortListItems(1, 2)
         
 #-----------------------------------------------------------------------------------------    
+        self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected, self)
+        
+        # for wxMSW
+        self.Bind(wx.EVT_COMMAND_RIGHT_CLICK, self.OnRightClick)
 
-        i=0
-        for name in first :
-            self.InsertColumn(i,name,wx.LIST_FORMAT_LEFT)
-            i+=1
-            
-        self.SetColumnWidth(0, 180)
+        # for wxGTK
+        self.Bind(wx.EVT_RIGHT_UP, self.OnRightClick)
 
-        for i in range(1,len(first)-1):
-            self.SetColumnWidth(i, len(first[i]) * 10)
+#-----------------------------------------------------------------------------------------    
         
     def OnGetItemText(self, item, col):
         index=self.itemIndexMap[item]
@@ -107,8 +107,7 @@ class ListForSpec(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.ColumnSor
     # Used by the ColumnSorterMixin, see wx/lib/mixins/listctrl.py
     def GetSortImages(self):
         return (self.sm_dn, self.sm_up)
-
-
+    
     def OnRightDown(self, event):
         x = event.GetX()
         y = event.GetY()
@@ -127,7 +126,14 @@ class ListForSpec(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.ColumnSor
         index=self.itemIndexMap[item]
         s = self.itemDataMap[index]
         return s
-
+    
+    def SortItems(self,sorter=cmp):
+        items = list(self.itemDataMap.keys())
+        items.sort(sorter)
+        self.itemIndexMap = items
+        # redraw the list
+        self.Refresh()
+    
     def OnItemSelected(self, event):
         self.currentItem = event.m_itemIndex
         event.Skip()
@@ -259,12 +265,7 @@ class ListForSpec(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.ColumnSor
         win.HtmlPage.SetPage(txt)
         win.Show(True)
 
-    def SortItems(self,sorter=cmp):
-        items = list(self.itemDataMap.keys())
-        items.sort(sorter)
-        self.itemIndexMap = items
-        # redraw the list
-        self.Refresh()
+
 
 class message(wx.Frame):
     def __init__(self, *args, **kwds):