]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/wx/lib/ogl/_composit.py
DocView and ActiveGrid IDE updates from Morgan Hua:
[wxWidgets.git] / wxPython / wx / lib / ogl / _composit.py
index fba79f3b7367e1d82c035b43854f2e7385851d25..d07c3993a5c7d6ad0fc85b7eac064ecec34b0718 100644 (file)
@@ -133,7 +133,7 @@ class Constraint(object):
         self._ySpacing = 0.0
 
         self._constraintType = type
-        self._constraintingObject = constraining
+        self._constrainingObject = constraining
 
         self._constraintId = 0
         self._constraintName = "noname"
@@ -158,13 +158,13 @@ class Constraint(object):
 
     def Evaluate(self):
         """Evaluate this constraint and return TRUE if anything changed."""
-        maxWidth, maxHeight = self._constraintingObject.GetBoundingBoxMax()
-        minWidth, minHeight = self._constraintingObject.GetBoundingBoxMin()
-        x = self._constraintingObject.GetX()
-        y = self._constraintingObject.GetY()
+        maxWidth, maxHeight = self._constrainingObject.GetBoundingBoxMax()
+        minWidth, minHeight = self._constrainingObject.GetBoundingBoxMin()
+        x = self._constrainingObject.GetX()
+        y = self._constrainingObject.GetY()
 
-        dc = wx.ClientDC(self._constraintingObject.GetCanvas())
-        self._constraintingObject.GetCanvas().PrepareDC(dc)
+        dc = wx.ClientDC(self._constrainingObject.GetCanvas())
+        self._constrainingObject.GetCanvas().PrepareDC(dc)
 
         if self._constraintType == CONSTRAINT_CENTRED_VERTICALLY:
             n = len(self._constrainedObjects)
@@ -552,11 +552,25 @@ class CompositeShape(RectangleShape):
         """Removes the child from the composite and any constraint
         relationships, but does not delete the child.
         """
-        self._children.remove(child)
-        self._divisions.remove(child)
+        if child in self._children:
+            self._children.remove(child)
+        if child in self._divisions:
+            self._divisions.remove(child)
         self.RemoveChildFromConstraints(child)
         child.SetParent(None)
 
+    def Delete(self):
+        """
+        Fully disconnect this shape from parents, children, the
+        canvas, etc.
+        """
+        for child in self.GetChildren():
+            self.RemoveChild(child)
+            child.Delete()
+        RectangleShape.Delete(self)
+        self._constraints = [] 
+        self._divisions = []
+
     def DeleteConstraintsInvolvingChild(self, child):
         """This function deletes constraints which mention the given child.