X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/02b800ce7c2bb1c1f08075f22be2e7412124b47f..97ad053bffe0fe5d8862578bae4e7492592b5702:/wxPython/wx/lib/ogl/_basic.py diff --git a/wxPython/wx/lib/ogl/_basic.py b/wxPython/wx/lib/ogl/_basic.py index 5ebf3287ca..757c5c2115 100644 --- a/wxPython/wx/lib/ogl/_basic.py +++ b/wxPython/wx/lib/ogl/_basic.py @@ -288,9 +288,16 @@ class Shape(ShapeEvtHandler): return str(self.__class__).split(".")[-1][:-2] def Delete(self): + """ + Fully disconnect this shape from parents, children, the + canvas, etc. + """ if self._parent: self._parent.GetChildren().remove(self) + for child in self.GetChildren(): + child.Delete() + self.ClearText() self.ClearRegions() self.ClearAttachments() @@ -749,18 +756,18 @@ class Shape(ShapeEvtHandler): if self._pen: dc.SetPen(self._pen) - region = self._regions[0] - if region.GetFont(): - dc.SetFont(region.GetFont()) + for region in self._regions: + if region.GetFont(): + dc.SetFont(region.GetFont()) - dc.SetTextForeground(region.GetActualColourObject()) - dc.SetBackgroundMode(wx.TRANSPARENT) - if not self._formatted: - CentreText(dc, region.GetFormattedText(), self._xpos, self._ypos, bound_x - 2 * self._textMarginX, bound_y - 2 * self._textMarginY, region.GetFormatMode()) - self._formatted = True + dc.SetTextForeground(region.GetActualColourObject()) + dc.SetBackgroundMode(wx.TRANSPARENT) + if not self._formatted: + CentreText(dc, region.GetFormattedText(), self._xpos, self._ypos, bound_x - 2 * self._textMarginX, bound_y - 2 * self._textMarginY, region.GetFormatMode()) + self._formatted = True - if not self.GetDisableLabel(): - DrawFormattedText(dc, region.GetFormattedText(), self._xpos, self._ypos, bound_x - 2 * self._textMarginX, bound_y - 2 * self._textMarginY, region.GetFormatMode()) + if not self.GetDisableLabel(): + DrawFormattedText(dc, region.GetFormattedText(), self._xpos, self._ypos, bound_x - 2 * self._textMarginX, bound_y - 2 * self._textMarginY, region.GetFormatMode()) def DrawContents(self, dc): @@ -3040,7 +3047,7 @@ class ShapeRegion(object): return None if self._penColour=="Invisible": return None - self._actualPenObject = wx.ThePenList.FindOrCreatePen(self._penColour, 1, self._penStyle) + self._actualPenObject = wx.Pen(self._penColour, 1, self._penStyle) return self._actualPenObject def SetText(self, s):