Browse Source

AnimPanel Had no way of telling objects that it had been closed

Abhishek Nath 16 years ago
parent
commit
518176f53f
1 changed files with 11 additions and 4 deletions
  1. 11 4
      direct/src/tkpanels/AnimPanel.py

+ 11 - 4
direct/src/tkpanels/AnimPanel.py

@@ -56,7 +56,9 @@ class AnimPanel(AppShell):
 
 
 
 
         # Execute option callbacks
         # Execute option callbacks
-        self.initialiseoptions(AnimPanel)
+        self.initialiseoptions(AnimPanel)                
+        # We need to know when AnimPanel is closed
+        self.destroyCallBack = None
 
 
     def createInterface(self):
     def createInterface(self):
         # Handle to the toplevels interior
         # Handle to the toplevels interior
@@ -176,7 +178,7 @@ class AnimPanel(AppShell):
 
 
         controlFrame.pack(fill = X)
         controlFrame.pack(fill = X)
 
 
-    def createActorControls(self):
+    def createActorControls(self): 
         # Create a frame to hold all the actor controls
         # Create a frame to hold all the actor controls
         self.actorFrame = Frame(self.interior())
         self.actorFrame = Frame(self.interior())
         # Create a control for each actor
         # Create a control for each actor
@@ -332,11 +334,16 @@ class AnimPanel(AppShell):
 
 
     def resetAllToEnd(self):
     def resetAllToEnd(self):
         for actorControl in self.actorControlList:
         for actorControl in self.actorControlList:
-            actorControl.resetToEnd()            
+            actorControl.resetToEnd()                        
+                        
+    def setDestroyCallBack(self, callBack):    
+        self.destroyCallBack = callBack
                         
                         
     def destroy(self):    
     def destroy(self):    
         # First clean up 
         # First clean up 
-        taskMgr.remove(self.id + '_UpdateTask')
+        taskMgr.remove(self.id + '_UpdateTask')        
+        self.destroyCallBack()        
+        self.destroyCallBack = None
         AppShell.destroy(self)    
         AppShell.destroy(self)    
 
 
 class ActorControl(Pmw.MegaWidget):
 class ActorControl(Pmw.MegaWidget):