mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 18:31:55 -04:00
added new method removeAllItems
This commit is contained in:
parent
ab895aaab6
commit
7a2e78cbb3
@ -349,6 +349,32 @@ class DirectScrolledList(DirectFrame):
|
||||
else:
|
||||
return 0
|
||||
|
||||
def removeAllItems(self, refresh=1):
|
||||
"""
|
||||
Remove this item from the panel
|
||||
Warning 2006_10_19 tested only in the trolley metagame
|
||||
"""
|
||||
assert self.notify.debugStateCall(self)
|
||||
retval = 0
|
||||
#print "remove item called", item
|
||||
#print "items list", self['items']
|
||||
while len (self["items"]):
|
||||
item = self['items'][0]
|
||||
#print "removing item", item
|
||||
if hasattr(self, "currentSelected") and self.currentSelected is item:
|
||||
del self.currentSelected
|
||||
self["items"].remove(item)
|
||||
if type(item) != type(''):
|
||||
#RAU possible leak here, let's try to do the right thing
|
||||
#item.reparentTo(hidden)
|
||||
item.removeNode()
|
||||
retval = 1
|
||||
|
||||
if (refresh):
|
||||
self.refresh()
|
||||
|
||||
return retval
|
||||
|
||||
def refresh(self):
|
||||
"""
|
||||
Update the list - useful when adding or deleting items
|
||||
|
Loading…
x
Reference in New Issue
Block a user