mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
added alphabetical tree-node sort
This commit is contained in:
parent
6d64fbeb5f
commit
b550c5c0a4
@ -14,6 +14,7 @@ class ObjectPaletteUI(wx.Panel):
|
||||
self.tree = wx.TreeCtrl(self)
|
||||
root = self.tree.AddRoot('Objects')
|
||||
self.addTreeNodes(root, self.palette.dataStruct)
|
||||
self.SortTreeNodes(root)
|
||||
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
sizer.Add(self.tree, 1, wx.EXPAND, 0)
|
||||
@ -69,6 +70,16 @@ class ObjectPaletteUI(wx.Panel):
|
||||
if item is None:
|
||||
newItem = self.addTreeNode(key, parentItem, items)
|
||||
|
||||
def SortTreeNodes(self, parent):
|
||||
self.tree.SortChildren(parent)
|
||||
item, cookie = self.tree.GetFirstChild(parent)
|
||||
while item:
|
||||
if self.tree.ItemHasChildren(item):
|
||||
self.SortTreeNodes(item)
|
||||
|
||||
# continue iteration to the next child
|
||||
item, cookie = self.tree.GetNextChild(parent, cookie)
|
||||
|
||||
def onSelected(self, event):
|
||||
pass
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user