Python wx.TreeCtrl() Examples

The following are 21 code examples of wx.TreeCtrl(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module wx , or try the search function .
Example #1
Source File: AddActionDialog.py    From EventGhost with GNU General Public License v2.0 7 votes vote down vote up
def RecurseActionGroup(self, actionGroup, tree, parentTreeItem):
        """
        Recurses an eg.ActionGroup and adds the items to the TreeCtrl.
        """
        for dataItem in actionGroup.items:
            if isinstance(dataItem, eg.ActionGroup):
                # the dataItem is an eg.ActionGroup instance
                isActionGroup = True
                if not len(dataItem.items):
                    # don't add empty ActionGroups
                    continue
                iconIndex = dataItem.icon.folderIndex
            else:
                # the dataItem is an action
                isActionGroup = False
                iconIndex = dataItem.info.icon.index
            newTreeItem = tree.AppendItem(parentTreeItem, dataItem.name)
            tree.SetPyData(newTreeItem, dataItem)
            tree.SetItemImage(newTreeItem, iconIndex)
            if isActionGroup:
                self.RecurseActionGroup(dataItem, tree, newTreeItem)
                if dataItem.expanded:
                    tree.Expand(newTreeItem)
            if dataItem == self.lastSelectedDataItem:
                self.lastSelectedTreeItem = newTreeItem 
Example #2
Source File: main_frame.py    From Rule-based_Expert_System with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, parent, id, title, size):
        wx.Frame.__init__(self, parent, id, title,
                          style=wx.DEFAULT_FRAME_STYLE ^ (wx.RESIZE_BORDER | wx.MINIMIZE_BOX |
                                                          wx.MAXIMIZE_BOX))
        self.SetSize(size)
        self.Center()
        self.sourceLabel = wx.StaticText(self, label='Source Image', pos=(150, 10), size=(40, 25))
        self.detectionLabel = wx.StaticText(self, label='Detection Image', pos=(550, 10), size=(40, 25))
        self.openPicButton = wx.Button(self, label='Open Image', pos=(830, 30), size=(150, 30))
        self.openPicButton.Bind(wx.EVT_BUTTON, self.open_picture)
        self.openEditorButton = wx.Button(self, label='Open Rule Editor', pos=(830, 70), size=(150, 30))
        self.openEditorButton.Bind(wx.EVT_BUTTON, self.open_rule_editor)
        self.showRuleButton = wx.Button(self, label='Show Rules', pos=(830, 110), size=(150, 30))
        self.showRuleButton.Bind(wx.EVT_BUTTON, self.show_rules)
        self.showFactButton = wx.Button(self, label='Show Facts', pos=(830, 150), size=(150, 30))
        self.showFactButton.Bind(wx.EVT_BUTTON, self.show_facts)
        self.treeLabel = wx.StaticText(self, label='What shape do you want', pos=(830, 200), size=(40, 25))
        self.shapeTree = wx.TreeCtrl(self, pos=(830, 220), size=(160, 210))
        root = self.shapeTree.AddRoot('All Shapes')
        self.add_tree_nodes(root, shape_items.tree)
        self.shapeTree.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.shape_chosen)
        self.shapeTree.Expand(root)
        self.show_picture('init_source.png', (10, 30))
        self.show_picture('init_detection.png', (420, 30))
        self.resultLabel = wx.StaticText(self, label='Detection Result', pos=(100, 450), size=(40, 25))
        self.resultText = wx.TextCtrl(self, pos=(10, 480), size=(310, 280), style=wx.TE_MULTILINE | wx.TE_READONLY)
        self.matchedFactLabel = wx.StaticText(self, label='Matched Facts', pos=(430, 450), size=(40, 25))
        self.matchedFactText = wx.TextCtrl(self, pos=(340, 480), size=(310, 280), style=wx.TE_MULTILINE | wx.TE_READONLY)
        self.hitRuleLabel = wx.StaticText(self, label='Hit Rules', pos=(780, 450), size=(40, 25))
        self.hitRuleText = wx.TextCtrl(self, pos=(670, 480), size=(310, 280), style=wx.TE_MULTILINE | wx.TE_READONLY)
        self.title = title
        self.pic_path = None
        self.engine = None
        self.contour_num = None
        self.Show() 
Example #3
Source File: LibraryPanel.py    From OpenPLC_Editor with GNU General Public License v3.0 5 votes vote down vote up
def ResetTree(self):
        """
        Reset LibraryPanel values displayed in controls
        """
        # Clear SearchCtrl, TreeCtrl and TextCtrl
        self.SearchCtrl.SetValue("")
        self.Tree.DeleteAllItems()
        self.Comment.SetValue("") 
Example #4
Source File: LibraryPanel.py    From OpenPLC_Editor with GNU General Public License v3.0 5 votes vote down vote up
def SetBlockList(self, blocklist):
        """
        Set function and function block library to display in TreeCtrl
        @param blocklist: Function and function block library
        """
        # Save functions and function blocks library
        self.BlockList = blocklist
        # Refresh TreeCtrl values
        self.RefreshTree() 
Example #5
Source File: BrowseValuesLibraryDialog.py    From OpenPLC_Editor with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent, name, library, default=None):
        wx.Dialog.__init__(self,
                           name='BrowseValueDialog', parent=parent,
                           style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER,
                           title=_('Browse %s values library') % name)

        self.staticText1 = wx.StaticText(
            label=_('Choose a value for %s:') % name,
            name='staticText1', parent=self,
            pos=wx.Point(0, 0), size=wx.DefaultSize, style=0)

        self.ValuesLibrary = wx.TreeCtrl(
            name='ValuesLibrary', parent=self, pos=wx.Point(0, 0),
            size=wx.Size(400, 200),
            style=wx.TR_HAS_BUTTONS | wx.TR_SINGLE | wx.SUNKEN_BORDER | wx.TR_HIDE_ROOT | wx.TR_LINES_AT_ROOT)

        self.ButtonSizer = self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.CENTRE)

        self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId())

        self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=3, vgap=10)

        self.flexGridSizer1.AddWindow(self.staticText1,   0, border=20, flag=wx.GROW | wx.TOP | wx.LEFT | wx.RIGHT)
        self.flexGridSizer1.AddWindow(self.ValuesLibrary, 0, border=20, flag=wx.GROW | wx.LEFT | wx.RIGHT)
        self.flexGridSizer1.AddSizer(self.ButtonSizer,    0, border=20, flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)

        self.flexGridSizer1.AddGrowableCol(0)
        self.flexGridSizer1.AddGrowableRow(1)

        self.SetSizer(self.flexGridSizer1)
        self.Fit()

        root = self.ValuesLibrary.AddRoot("")
        self.GenerateValuesLibraryBranch(root, library, default) 
Example #6
Source File: WindowTree.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def Destroy(self):
        self.Unselect()
        self.imageList.Destroy()
        return wx.TreeCtrl.Destroy(self) 
Example #7
Source File: WindowTree.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, parent, includeInvisible=False):
        self.includeInvisible = includeInvisible
        self.pids = {}
        wx.TreeCtrl.__init__(
            self,
            parent,
            -1,
            style=(
                wx.TR_DEFAULT_STYLE |
                wx.TR_HIDE_ROOT |
                wx.TR_FULL_ROW_HIGHLIGHT
            ),
            size=(-1, 150)
        )
        self.imageList = imageList = wx.ImageList(16, 16)
        imageList.Add(GetInternalBitmap("cwindow"))
        imageList.Add(GetInternalBitmap("cedit"))
        imageList.Add(GetInternalBitmap("cstatic"))
        imageList.Add(GetInternalBitmap("cbutton"))
        self.SetImageList(imageList)
        self.root = self.AddRoot("")

        # tree context menu
        def OnCmdHighlight(dummyEvent=None):
            hwnd = self.GetPyData(self.GetSelection())
            for _ in range(10):
                HighlightWindow(hwnd)
                sleep(0.1)
        menu = wx.Menu()
        menuId = wx.NewId()
        menu.Append(menuId, "Highlight")
        self.Bind(wx.EVT_MENU, OnCmdHighlight, id=menuId)
        self.contextMenu = menu

        self.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK, self.OnItemRightClick)
        self.Bind(wx.EVT_TREE_ITEM_EXPANDING, self.OnItemExpanding)
        self.Bind(wx.EVT_TREE_ITEM_COLLAPSED, self.OnItemCollapsed)
        self.AppendPrograms() 
Example #8
Source File: TreeCtrl.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, parent, document, size=wx.DefaultSize):
        self.document = document
        self.root = None
        self.editLabelId = None
        self.insertionMark = None
        self.editControl = EditControlProxy(self)
        style = (
            wx.TR_HAS_BUTTONS |
            wx.TR_EDIT_LABELS |
            wx.TR_ROW_LINES |
            wx.CLIP_CHILDREN
        )
        wx.TreeCtrl.__init__(self, parent, size=size, style=style)
        self.SetImageList(eg.Icons.gImageList)
        self.hwnd = self.GetHandle()
        self.normalfont = self.GetFont()
        self.italicfont = self.GetFont()
        self.italicfont.SetStyle(wx.FONTSTYLE_ITALIC)
        self.Bind(wx.EVT_SET_FOCUS, self.OnGetFocusEvent)
        self.Bind(wx.EVT_KILL_FOCUS, self.OnKillFocusEvent)
        self.Bind(wx.EVT_TREE_ITEM_EXPANDING, self.OnItemExpandingEvent)
        self.Bind(wx.EVT_TREE_ITEM_COLLAPSING, self.OnItemCollapsingEvent)
        self.Bind(wx.EVT_TREE_BEGIN_LABEL_EDIT, self.OnBeginLabelEditEvent)
        self.Bind(wx.EVT_TREE_END_LABEL_EDIT, self.OnEndLabelEditEvent)
        self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnItemActivateEvent)
        self.Bind(wx.EVT_LEFT_DCLICK, self.OnLeftDoubleClickEvent)
        self.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK, self.OnRightClickEvent)
        self.Bind(wx.EVT_TREE_ITEM_MENU, self.OnItemMenuEvent)
        self.Bind(wx.EVT_TREE_BEGIN_DRAG, self.OnBeginDragEvent)
        self.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSelectionChangedEvent)
        self.visibleNodes = {}
        self.expandedNodes = document.expandedNodes
        self.dropTarget = DropTarget(self)
        self.SetDropTarget(self.dropTarget)
        eg.Bind("NodeAdded", self.OnNodeAdded)
        eg.Bind("NodeDeleted", self.OnNodeDeleted)
        eg.Bind("NodeChanged", self.OnNodeChanged)
        eg.Bind("NodeSelected", self.OnNodeSelected)
        eg.Bind("DocumentNewRoot", self.OnNewRoot)
        if document.root:
            self.OnNewRoot(document.root) 
Example #9
Source File: TreeCtrl.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def OnCmdPython(self):
        eg.PrintNotice("DEBUG: TreeCtrl: OnCmdPython")
        #self.realControl.Copy() 
Example #10
Source File: CardAndReaderTreePanel.py    From pyscard with GNU Lesser General Public License v2.1 5 votes vote down vote up
def __init__(self,
                  parent,
                  ID=wx.NewId(),
                  pos=wx.DefaultPosition,
                  size=wx.DefaultSize,
                  style=0,
                  clientpanel=None):
        """Constructor. Initializes a smartcard or reader tree control."""
        wx.TreeCtrl.__init__(
            self, parent, ID, pos, size, wx.TR_SINGLE | wx.TR_NO_BUTTONS)

        self.clientpanel = clientpanel
        self.parent = parent

        isz = (16, 16)
        il = wx.ImageList(isz[0], isz[1])
        self.capindex = il.Add(
            wx.ArtProvider_GetBitmap(wx.ART_HELP_BOOK, wx.ART_OTHER, isz))
        self.fldrindex = il.Add(
            wx.ArtProvider_GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, isz))
        self.fldropenindex = il.Add(
            wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN, wx.ART_OTHER, isz))
        if None != ICO_SMARTCARD:
            self.cardimageindex = il.Add(
                wx.Bitmap(ICO_SMARTCARD, wx.BITMAP_TYPE_ICO))
        if None != ICO_READER:
            self.readerimageindex = il.Add(
                wx.Bitmap(ICO_READER, wx.BITMAP_TYPE_ICO))
        self.il = il
        self.SetImageList(self.il) 
Example #11
Source File: tree_ctrl.py    From wxGlade with MIT License 5 votes vote down vote up
def create_widget(self):
        self.widget = wx.TreeCtrl(self.parent_window.widget, self.id, style=self.style) # wx.TR_HAS_BUTTONS|wx.BORDER_SUNKEN)
        # add a couple of items just for a better appearance
        root = self.widget.AddRoot(_(' Tree Control:'))
        self._item_with_name = self.widget.AppendItem(root, ' ' + self.name)
        self.widget.AppendItem(self._item_with_name, _(' on wxGlade version %s') % config.version )
        self.widget.Expand(root)
        self.widget.Expand(self._item_with_name) 
Example #12
Source File: tree.py    From wxGlade with MIT License 5 votes vote down vote up
def __init__(self, parent, application):
        style = wx.TR_DEFAULT_STYLE|wx.TR_HAS_VARIABLE_ROW_HEIGHT
        style |= wx.TR_EDIT_LABELS
        if wx.Platform == '__WXGTK__':    style |= wx.TR_NO_LINES|wx.TR_FULL_ROW_HIGHLIGHT
        elif wx.Platform == '__WXMAC__':  style &= ~wx.TR_ROW_LINES
        wx.TreeCtrl.__init__(self, parent, -1, style=style)
        self.cur_widget = None  # reference to the selected widget
        self.root = application
        image_list = wx.ImageList(21, 21)
        image_list.Add(wx.Bitmap(os.path.join(config.icons_path, 'application.xpm'), wx.BITMAP_TYPE_XPM))
        for w in WidgetTree.images:
            WidgetTree.images[w] = image_list.Add(misc.get_xpm_bitmap(WidgetTree.images[w]))
        self.AssignImageList(image_list)
        application.item = self.AddRoot(_('Application'), 0)
        self._SetItemData(application.item, application)
        self.skip_select = 0  # avoid an infinite loop on win32, as SelectItem fires an EVT_TREE_SEL_CHANGED event

        self.drop_target = clipboard.DropTarget(self, toplevel=True)
        self.SetDropTarget(self.drop_target)
        self._drag_ongoing = False
        self.auto_expand = True  # this control the automatic expansion of  nodes: it is set to False during xml loading
        self.Bind(wx.EVT_TREE_SEL_CHANGED, self.on_change_selection)
        self.Bind(wx.EVT_RIGHT_DOWN, self.popup_menu)
        self.Bind(wx.EVT_LEFT_DCLICK, self.on_left_dclick)
        self.Bind(wx.EVT_LEFT_DOWN, self.on_left_click) # allow direct placement of widgets
        self.Bind(wx.EVT_MENU, self.on_menu)  # for handling the selection of the first item
        self._popup_menu_widget = None  # the widget for the popup menu
        self.Bind(wx.EVT_TREE_BEGIN_DRAG, self.begin_drag)
        self.Bind(wx.EVT_LEAVE_WINDOW, self.on_leave_window)
        self.Bind(wx.EVT_MOUSE_EVENTS, self.on_mouse_events)

        self.Bind(wx.EVT_TREE_BEGIN_LABEL_EDIT, self.begin_edit_label)
        self.Bind(wx.EVT_TREE_END_LABEL_EDIT, self.end_edit_label)
        #self.Bind(wx.EVT_KEY_DOWN, misc.on_key_down_event)
        self.Bind(wx.EVT_KEY_DOWN, self.on_key_down_event)
        #self.Bind(wx.EVT_CHAR_HOOK, self.on_char)  # on wx 2.8 the event will not be delivered to the child
        self.Bind(wx.EVT_TREE_DELETE_ITEM, self.on_delete_item) 
Example #13
Source File: tree.py    From admin4 with Apache License 2.0 5 votes vote down vote up
def __init__(self, parentWin, name, size=wx.DefaultSize, style=wx.TR_HAS_BUTTONS | wx.TR_HIDE_ROOT | wx.TR_LINES_AT_ROOT):
    TreeCtrl.__init__(self, parentWin, name, size=size, style=style)
    self.name=name
    if name:
      adm.trees[name]=self
    self.autoChildren=True
    self.Bind(wx.EVT_RIGHT_DOWN, self.OnTreeRightClick)
    self.Bind(wx.EVT_TREE_ITEM_EXPANDING, self.OnTreeExpand)
    self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnTreeActivate) 
Example #14
Source File: tree.py    From admin4 with Apache License 2.0 5 votes vote down vote up
def __init__(self, parentWin, name, size=wx.DefaultSize, style=wx.TR_HAS_BUTTONS | wx.TR_HIDE_ROOT | wx.TR_LINES_AT_ROOT):
    TreeCtrl.__init__(self, parentWin, name, size, style)
    self.Bind(wx.EVT_TREE_BEGIN_DRAG, self.OnBeginDrag)
    self.Bind(wx.EVT_TREE_END_DRAG, self.OnEndDrag) 
Example #15
Source File: tree.py    From admin4 with Apache License 2.0 5 votes vote down vote up
def __init__(self, parentWin, name, size=wx.DefaultSize, style=wx.TR_HAS_BUTTONS | wx.TR_HIDE_ROOT | wx.TR_LINES_AT_ROOT):
    wx.TreeCtrl.__init__(self, parentWin, size=size, style=style)
    self.SetImageList(adm.images)
    self.AddRoot(name)
    if wx.Platform != "__WXMSW__":
      pt=parentWin.GetFont().GetPointSize() * 0.95  # a little smaller
      font=wx.Font(pt, wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.NORMAL)

      self.SetFont(font) 
Example #16
Source File: adm.py    From admin4 with Apache License 2.0 5 votes vote down vote up
def GetCurrentTree(wnd=None):
  while wnd:
    if isinstance(wnd, wx.TreeCtrl):
      return wnd
    wnd=wnd.GetParent()

  frame=GetCurrentFrame()
  if frame and hasattr(frame, "tree"):
    return frame.tree
  return None 
Example #17
Source File: profile_gui.py    From BitTorrent with GNU General Public License v3.0 5 votes vote down vote up
def OnInit(self):
        f = wx.Frame(None)
        t = wx.TreeCtrl(f, style=0
                           | wx.TR_HAS_BUTTONS
                           | wx.TR_TWIST_BUTTONS
                           | wx.TR_FULL_ROW_HIGHLIGHT
                           #| wx.TR_HIDE_ROOT 
                           #| wx.TR_ROW_LINES
                           | wx.TR_MULTIPLE
                           | wx.TR_EXTENDED
                           #| wx.TR_NO_LINES
                           #| wx.NO_FULL_REPAINT_ON_RESIZE
                           | wx.CLIP_CHILDREN
                          ,)
            
        
        r = t.AddRoot("Profile")

        g = GuiStats(sys.argv[1])
        g.gui_print(t, r)
    
        t.Expand(r)
        f.Show(True)


        
        return True 
Example #18
Source File: app.py    From thotkeeper with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def __init__(self, parent, style):
        wx.TreeCtrl.__init__(self, parent=parent, style=style) 
Example #19
Source File: pcscdiag.py    From pyscard with GNU Lesser General Public License v2.1 5 votes vote down vote up
def __init__(self, parent, title):
        wx.Frame.__init__(self, parent, -1, title, size=(600, 400))
        w, h = self.GetClientSizeTuple()
        self.tree = wx.TreeCtrl(
            self,
            wx.NewId(),
            wx.DefaultPosition,
            (w, h),
            wx.TR_HAS_BUTTONS | wx.TR_EDIT_LABELS)
        self.InitTree()
        self.OnExpandAll() 
Example #20
Source File: Registry.py    From EventGhost with GNU General Public License v2.0 4 votes vote down vote up
def __init__(
        self,
        parent,
        id=-1,
        key = _winreg.HKEY_CURRENT_USER,
        subkey = "Software",
        valueName = None,
        pos = wx.DefaultPosition,
        size = wx.DefaultSize,
        style = wx.TR_HAS_BUTTONS,
        validator = wx.DefaultValidator,
        name="RegistryLazyTree",
        text = None
    ):
        self.text = text
        wx.TreeCtrl.__init__(
            self, parent, id, pos, size, style, validator, name
        )

        self.imageList = imageList = wx.ImageList(16, 16)
        rootIcon = imageList.Add(eg.Icons.GetInternalBitmap("root"))
        self.folderIcon = imageList.Add(eg.Icons.GetInternalBitmap("folder"))
        self.valueIcon = imageList.Add(eg.Icons.GetInternalBitmap("action"))
        self.SetImageList(imageList)
        self.SetMinSize((-1, 200))
        self.treeRoot = self.AddRoot(
            "Registry",
            image = rootIcon,
            data = wx.TreeItemData((True, None, None, None))
        )
        #Adding keys
        for item in regKeys:
            #a tupel of 4 values is assigned to every item
            #1) stores if the key has yet to be queried for subkey, when
            #   selected
            #2) _winreg.hkey constant
            #3) name of the key
            #4) value name, None if just a key, empty string for default value
            tmp = self.AppendItem(
                self.treeRoot,
                item[1],
                image = self.folderIcon,
                data =wx.TreeItemData((False, item[0], "", None))
            )
            self.SetItemHasChildren(tmp, True)
            if item[0] == key:
                self.SelectItem(tmp)

        #select old value in tree
        self.OnTreeChange(wx.CommandEvent(), key, subkey, valueName)
        self.EnsureVisible(self.GetSelection())

        self.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnTreeChange)
        self.Bind(wx.EVT_TREE_ITEM_EXPANDING, self.OnExpandNode) 
Example #21
Source File: FolderTree.py    From OpenPLC_Editor with GNU General Public License v3.0 4 votes vote down vote up
def __init__(self, parent, folder, filter=None, editable=True):
        wx.Panel.__init__(self, parent, style=wx.TAB_TRAVERSAL)

        main_sizer = wx.BoxSizer(wx.VERTICAL)

        self.Tree = wx.TreeCtrl(self,
                                style=(wx.TR_HAS_BUTTONS |
                                       wx.TR_SINGLE |
                                       wx.SUNKEN_BORDER |
                                       wx.TR_HIDE_ROOT |
                                       wx.TR_LINES_AT_ROOT |
                                       wx.TR_EDIT_LABELS))
        if wx.Platform == '__WXMSW__':
            self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnTreeItemExpanded, self.Tree)
            self.Tree.Bind(wx.EVT_LEFT_DOWN, self.OnTreeLeftDown)
        else:
            self.Bind(wx.EVT_TREE_ITEM_EXPANDED, self.OnTreeItemExpanded, self.Tree)
        self.Bind(wx.EVT_TREE_ITEM_COLLAPSED, self.OnTreeItemCollapsed, self.Tree)
        self.Bind(wx.EVT_TREE_BEGIN_LABEL_EDIT, self.OnTreeBeginLabelEdit, self.Tree)
        self.Bind(wx.EVT_TREE_END_LABEL_EDIT, self.OnTreeEndLabelEdit, self.Tree)
        main_sizer.AddWindow(self.Tree, 1, flag=wx.GROW)

        if filter is not None:
            self.Filter = wx.ComboBox(self, style=wx.CB_READONLY)
            self.Bind(wx.EVT_COMBOBOX, self.OnFilterChanged, self.Filter)
            main_sizer.AddWindow(self.Filter, flag=wx.GROW)
        else:
            self.Filter = None

        self.SetSizer(main_sizer)

        self.Folder = folder
        self.Editable = editable

        self.TreeImageList = wx.ImageList(16, 16)
        self.TreeImageDict = {}
        for item_type, bitmap in [(DRIVE, "tree_drive"),
                                  (FOLDER, "tree_folder"),
                                  (FILE, "tree_file")]:
            self.TreeImageDict[item_type] = self.TreeImageList.Add(GetBitmap(bitmap))
        self.Tree.SetImageList(self.TreeImageList)

        self.Filters = {}
        if self.Filter is not None:
            filter_parts = filter.split("|")
            for idx in xrange(0, len(filter_parts), 2):
                if filter_parts[idx + 1] == "*.*":
                    self.Filters[filter_parts[idx]] = ""
                else:
                    self.Filters[filter_parts[idx]] = filter_parts[idx + 1].replace("*", "")
                self.Filter.Append(filter_parts[idx])
                if idx == 0:
                    self.Filter.SetStringSelection(filter_parts[idx])

            self.CurrentFilter = self.Filters[self.Filter.GetStringSelection()]
        else:
            self.CurrentFilter = ""