mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 18:31:55 -04:00
Add ability to flush cached children to support dynamic trees
This commit is contained in:
parent
80862fe41a
commit
03e8cbc717
@ -85,9 +85,9 @@ class SceneGraphExplorer(Pmw.MegaWidget, PandaObject):
|
|||||||
# Check keywords and initialise options based on input values.
|
# Check keywords and initialise options based on input values.
|
||||||
self.initialiseoptions(SceneGraphExplorer)
|
self.initialiseoptions(SceneGraphExplorer)
|
||||||
|
|
||||||
def update(self):
|
def update(self, fUseCachedChildren = 1):
|
||||||
""" Refresh scene graph explorer """
|
""" Refresh scene graph explorer """
|
||||||
self._node.update()
|
self._node.update(fUseCachedChildren)
|
||||||
|
|
||||||
def mouse2Down(self, event):
|
def mouse2Down(self, event):
|
||||||
self._width = 1.0 * self._canvas.winfo_width()
|
self._width = 1.0 * self._canvas.winfo_width()
|
||||||
|
@ -181,20 +181,20 @@ class TreeNode:
|
|||||||
else:
|
else:
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def update(self):
|
def update(self, fUseCachedChildren = 1):
|
||||||
if self.parent:
|
if self.parent:
|
||||||
self.parent.update()
|
self.parent.update(fUseCachedChildren)
|
||||||
else:
|
else:
|
||||||
oldcursor = self.canvas['cursor']
|
oldcursor = self.canvas['cursor']
|
||||||
self.canvas['cursor'] = "watch"
|
self.canvas['cursor'] = "watch"
|
||||||
self.canvas.update()
|
self.canvas.update()
|
||||||
self.canvas.delete(ALL) # XXX could be more subtle
|
self.canvas.delete(ALL) # XXX could be more subtle
|
||||||
self.draw(7, 2)
|
self.draw(7, 2, fUseCachedChildren)
|
||||||
x0, y0, x1, y1 = self.canvas.bbox(ALL)
|
x0, y0, x1, y1 = self.canvas.bbox(ALL)
|
||||||
self.canvas.configure(scrollregion=(0, 0, x1, y1))
|
self.canvas.configure(scrollregion=(0, 0, x1, y1))
|
||||||
self.canvas['cursor'] = oldcursor
|
self.canvas['cursor'] = oldcursor
|
||||||
|
|
||||||
def draw(self, x, y):
|
def draw(self, x, y, fUseCachedChildren = 1):
|
||||||
# XXX This hard-codes too many geometry constants!
|
# XXX This hard-codes too many geometry constants!
|
||||||
self.x, self.y = x, y
|
self.x, self.y = x, y
|
||||||
self.drawicon()
|
self.drawicon()
|
||||||
@ -209,7 +209,7 @@ class TreeNode:
|
|||||||
self.kidKeys = []
|
self.kidKeys = []
|
||||||
for item in sublist:
|
for item in sublist:
|
||||||
key = item.GetKey()
|
key = item.GetKey()
|
||||||
if self.children.has_key(key):
|
if fUseCachedChildren and self.children.has_key(key):
|
||||||
child = self.children[key]
|
child = self.children[key]
|
||||||
else:
|
else:
|
||||||
child = TreeNode(self.canvas, self, item, self.menuList)
|
child = TreeNode(self.canvas, self, item, self.menuList)
|
||||||
@ -226,7 +226,7 @@ class TreeNode:
|
|||||||
child = self.children[key]
|
child = self.children[key]
|
||||||
cylast = cy
|
cylast = cy
|
||||||
self.canvas.create_line(x+9, cy+7, cx, cy+7, fill="gray50")
|
self.canvas.create_line(x+9, cy+7, cx, cy+7, fill="gray50")
|
||||||
cy = child.draw(cx, cy)
|
cy = child.draw(cx, cy, fUseCachedChildren)
|
||||||
if child.item.IsExpandable():
|
if child.item.IsExpandable():
|
||||||
if child.state == 'expanded':
|
if child.state == 'expanded':
|
||||||
iconname = "minusnode"
|
iconname = "minusnode"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user