diff --git a/direct/src/tkpanels/DirectSessionPanel.py b/direct/src/tkpanels/DirectSessionPanel.py index f19cdcad7e..97e5d9648e 100644 --- a/direct/src/tkpanels/DirectSessionPanel.py +++ b/direct/src/tkpanels/DirectSessionPanel.py @@ -570,9 +570,6 @@ class DirectSessionPanel(AppShell): # Create some buttons in the bottom tray self.createButtons() - # Clean up things when you destroy the panel - interior.bind('', self.onDestroy) - def createButtons(self): # Grid: enable/disable, xyz/hpr snap, snap to plane # Render mode: wireframe, lights, texture diff --git a/direct/src/tkpanels/FSMInspector.py b/direct/src/tkpanels/FSMInspector.py index 1daa966735..546fda22e2 100644 --- a/direct/src/tkpanels/FSMInspector.py +++ b/direct/src/tkpanels/FSMInspector.py @@ -279,6 +279,12 @@ class FSMInspector(AppShell): else: self.balloon.configure(state = 'none') + def onDestroy(self, event): + """ Called on FSM Panel shutdown """ + for si in self.stateInspectorDict.values(): + self.ignore(self.name + '_' + si.getName() + '_entered') + self.ignore(self.name + '_' + si.getName() + '_exited') + class StateInspector(Pmw.MegaArchetype): def __init__(self, inspector, state, **kw): @@ -433,6 +439,7 @@ class StateInspector(Pmw.MegaArchetype): def exitedState(self): self._canvas.itemconfigure(self.marker, fill = 'CornflowerBlue') + """ # USING FINITE STATE INSPECTOR diff --git a/direct/src/tkpanels/MopathRecorder.py b/direct/src/tkpanels/MopathRecorder.py index 37a477efbf..cbacf1175f 100644 --- a/direct/src/tkpanels/MopathRecorder.py +++ b/direct/src/tkpanels/MopathRecorder.py @@ -162,11 +162,6 @@ class MopathRecorder(AppShell, PandaObject): self.accept(event, method) def createInterface(self): - # The interior of the toplevel panel - interior = self.interior() - # Clean up things when you destroy the panel - interior.bind('', self.onDestroy) - # FILE MENU # Get a handle on the file menu so commands can be inserted # before quit item diff --git a/direct/src/tkpanels/Placer.py b/direct/src/tkpanels/Placer.py index 4eed5c8baa..232ee5e2cc 100644 --- a/direct/src/tkpanels/Placer.py +++ b/direct/src/tkpanels/Placer.py @@ -365,9 +365,6 @@ class Placer(AppShell): # Set up placer for inital node path self.selectNodePathNamed('init') - # Clean up things when you destroy the panel - interior.bind('', self.onDestroy) - self.createButtons() def createButtons(self): diff --git a/direct/src/tkwidgets/AppShell.py b/direct/src/tkwidgets/AppShell.py index 615e6c0d75..f78de072a4 100644 --- a/direct/src/tkwidgets/AppShell.py +++ b/direct/src/tkwidgets/AppShell.py @@ -105,6 +105,8 @@ class AppShell(Pmw.MegaWidget, PandaObject): self.__createCommandArea() self.__createMessageBar() self.__createAboutBox() + # Add binding for panel cleanup code + self.interior().bind('', self.onDestroy) # # Create the parts of the interface # which can be modified by subclasses @@ -232,6 +234,10 @@ class AppShell(Pmw.MegaWidget, PandaObject): # Override this method to create the interface for the app. pass + def onDestroy(self, event): + # Override this method with actions to be performed on panel shutdown + pass + def createMenuBar(self): # Creates default menus. Can be overridden or simply augmented # Using button Add below