]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/wx/lib/ogl/_lines.py
fix WXDLLIMPEXP_STC definition when building all wx libraries as DLLs (patch 1704527)
[wxWidgets.git] / wxPython / wx / lib / ogl / _lines.py
index 1e1d3ab68ab68ab24f7388758599a1b78664c42b..77ce392cacdbe1498ef8eea7f331d7760d65fe18 100644 (file)
@@ -14,7 +14,7 @@
 import sys
 import math
 
-from _basic import Shape, ShapeRegion, ControlPoint, RectangleShape
+from _basic import Shape, ShapeRegion, ShapeTextLine, ControlPoint, RectangleShape
 from _oglmisc import *
 
 # Line alignment flags
@@ -131,7 +131,7 @@ class LabelShape(RectangleShape):
         RectangleShape.__init__(self, w, h)
         self._lineShape = parent
         self._shapeRegion = region
-        self.SetPen(wx.ThePenList.FindOrCreatePen(wx.Colour(0, 0, 0), 1, wx.DOT))
+        self.SetPen(wx.Pen(wx.Colour(0, 0, 0), 1, wx.DOT))
 
     def OnDraw(self, dc):
         if self._lineShape and not self._lineShape.GetDrawHandles():
@@ -218,16 +218,6 @@ class LineShape(Shape):
         self._lineControlPoints = []
         self._arcArrows = []
 
-    def __del__(self):
-        if self._lineControlPoints:
-            self._lineControlPoints = []
-        for i in range(3):
-            if self._labelObjects[i]:
-                self._labelObjects[i].Select(False)
-                self._labelObjects[i].RemoveFromCanvas(self._canvas)
-        self._labelObjects = []
-        self.ClearArrowsAtPosition(-1)
-
     def GetFrom(self):
         """Return the 'from' object."""
         return self._from
@@ -350,7 +340,7 @@ class LineShape(Shape):
                         y2 = first_point[1]
                         y1 = last_point[1]
                     self._lineControlPoints[i] = wx.RealPoint((x2 - x1) / 2.0 + x1, (y2 - y1) / 2.0 + y1)
-                    self._initialised = True
+            self._initialised = True
                     
     def FormatText(self, dc, s, i):
         """Format a text string according to the region size, adding
@@ -492,6 +482,11 @@ class LineShape(Shape):
             self._from.GetLines().remove(self)
         self._to = None
         self._from = None
+        for i in range(3):
+            if self._labelObjects[i]:
+                self._labelObjects[i].Select(False)
+                self._labelObjects[i].RemoveFromCanvas(self._canvas)
+        self.ClearArrowsAtPosition(-1)
 
     def SetEnds(self, x1, y1, x2, y2):
         """Set the end positions of the line."""
@@ -1027,7 +1022,7 @@ class LineShape(Shape):
         # Problem with pen - if not a solid pen, does strange things
         # to the arrowhead. So make (get) a new pen that's solid.
         if self._pen and self._pen.GetStyle() != wx.SOLID:
-            solid_pen = wx.ThePenList.FindOrCreatePen(self._pen.GetColour(), 1, wx.SOLID)
+            solid_pen = wx.Pen(self._pen.GetColour(), 1, wx.SOLID)
             if solid_pen:
                 dc.SetPen(solid_pen)