Possible Bug in Gizmos TreeListCtrl

Hi,

I found a couple issues in the wx.Gizmos.TreeLinstCtr that I thing are
bugs. I am hoping there is a work-around. Any help is much
appreciated.

Bug 1:
1) run code to open gui
2) Use scroll bar to scroll to bottom of the gui
3) Collapse "folder2". You should notice the TreeListCtrl now has bad
entries at the bottom.

Bug 2:
1) run code to open gui
2) Use scroll bar to scroll to bottom of the gui
3) Double click "file2" under "folder2" to delete that item. You
should notice the TreeListCtrl now has bad entries at the bottom.

The version of wx I am running is: 2.8.9.1 (gtk2-unicode)
I am running Linux version 2.6.9-89.ELsmp (Red Hat 3.4.6-11)

···

######################################
#!/usr/local/bin/python

import wx
import wx.gizmos as gizmos

print wx.version()

class Window(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self,None,wx.ID_ANY)
        self.SetSize(wx.Size(200,200))
        FileTree(self)
        self.Show(True)

class FileTree(wx.Panel):
    def __init__(self, parent):
        wx.Panel.__init__(self, parent, -1)
        self.Bind(wx.EVT_SIZE, self.OnSize)

        #Create Gizmo
        self.tree = gizmos.TreeListCtrl(self, -1,
                    style =
                    wx.TR_FULL_ROW_HIGHLIGHT
                    >wx.TR_MULTIPLE
                    >wx.TR_TWIST_BUTTONS
                    )
        self.Bind(wx.EVT_TREE_ITEM_COLLAPSED,
            self.EvtItemCollapsed, self.tree)
        self.tree.GetMainWindow().Bind(
            wx.EVT_LEFT_DCLICK, self.EvtLeftDClick)

        #Add Root
        self.tree.AddColumn("File")
        self.root = self.tree.AddRoot('ROOT')
        self.tree.SetItemHasChildren(self.root, True)

        #Add Children
        for i in range(3):
            item = self.tree.AppendItem(self.root, 'folder%s'%i)
            self.tree.SetItemHasChildren(item, True)
            for j in range(3):
                file = self.tree.AppendItem(item, 'file%s'%j)

        self.tree.ExpandAll(self.root)

    def OnSize(self, evt):
        self.tree.SetSize(self.GetSize())

    def EvtItemCollapsed(self, event):
        self.Refresh()
        self.Update()
        wx.CallAfter(self.MyRefresh)

    def EvtLeftDClick(self, event):
        item = self.tree.GetSelections()[0]
        self.tree.Delete(item)

    def MyRefresh(self):
        self.Refresh()
        self.Update()

app = wx.PySimpleApp()
Window()
app.MainLoop()
######################################

Please try with 2.8.10.1.

···

On 4/2/10 12:26 PM, yl wrote:

Hi,

I found a couple issues in the wx.Gizmos.TreeLinstCtr that I thing are
bugs. I am hoping there is a work-around. Any help is much
appreciated.

Bug 1:
1) run code to open gui
2) Use scroll bar to scroll to bottom of the gui
3) Collapse "folder2". You should notice the TreeListCtrl now has bad
entries at the bottom.

Bug 2:
1) run code to open gui
2) Use scroll bar to scroll to bottom of the gui
3) Double click "file2" under "folder2" to delete that item. You
should notice the TreeListCtrl now has bad entries at the bottom.

The version of wx I am running is: 2.8.9.1 (gtk2-unicode)

--
Robin Dunn
Software Craftsman