From a1cb222bed44e8b1b610bf6f226d1b452a96f654 Mon Sep 17 00:00:00 2001 From: Dave Schuyler Date: Sat, 29 Apr 2006 00:22:31 +0000 Subject: [PATCH] check for frameStyle before deleting --- direct/src/gui/DirectGuiBase.py | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/direct/src/gui/DirectGuiBase.py b/direct/src/gui/DirectGuiBase.py index 249c3e08c0..fd0997cba7 100644 --- a/direct/src/gui/DirectGuiBase.py +++ b/direct/src/gui/DirectGuiBase.py @@ -996,21 +996,22 @@ class DirectGuiWidget(DirectGuiBase, NodePath): self.updateFrameStyle() def destroy(self): - # Destroy children - for child in self.getChildrenAsList(): - childGui = self.guiDict.get(child.getName()) - if childGui: childGui.destroy() - # messenger.send(DESTROY + child.getName()) - del self.guiDict[self.guiId] - del self.frameStyle - # Get rid of node path - self.removeNode() - for nodePath in self.stateNodePath: - nodePath.removeNode() - del self.stateNodePath - del self.guiItem - # Call superclass destruction method (clears out hooks) - DirectGuiBase.destroy(self) + if hasattr(self, "frameStyle"): + # Destroy children + for child in self.getChildrenAsList(): + childGui = self.guiDict.get(child.getName()) + if childGui: childGui.destroy() + # messenger.send(DESTROY + child.getName()) + del self.guiDict[self.guiId] + del self.frameStyle + # Get rid of node path + self.removeNode() + for nodePath in self.stateNodePath: + nodePath.removeNode() + del self.stateNodePath + del self.guiItem + # Call superclass destruction method (clears out hooks) + DirectGuiBase.destroy(self) def printConfig(self, indent = 0): space = ' ' * indent