X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b2f6eb0606be607c176121ad4ae272e3112f44eb..16541a4ef4c409e27a047f898f9d770bdcfa9f30:/wxPython/wx/lib/ogl/_diagram.py diff --git a/wxPython/wx/lib/ogl/_diagram.py b/wxPython/wx/lib/ogl/_diagram.py index 95ef272206..6bdf00185f 100644 --- a/wxPython/wx/lib/ogl/_diagram.py +++ b/wxPython/wx/lib/ogl/_diagram.py @@ -11,8 +11,6 @@ # Licence: wxWindows license #---------------------------------------------------------------------------- -from __future__ import division - import wx DEFAULT_MOUSE_TOLERANCE = 3 @@ -80,13 +78,14 @@ class Diagram(object): for shape in self._shapeList[:]: if not shape.GetParent(): self.RemoveShape(shape) + shape.Delete() def ShowAll(self, show): """Call Show for each shape in the diagram.""" for shape in self._shapeList: - shape.Show() + shape.Show(show) - def DrawOutLine(self, dc, x1, y1, x2, y2): + def DrawOutline(self, dc, x1, y1, x2, y2): """Draw an outline rectangle on the current device context.""" dc.SetPen(wx.Pen(wx.Color(0, 0, 0), 1, wx.DOT)) dc.SetBrush(wx.TRANSPARENT_BRUSH) @@ -120,6 +119,14 @@ class Diagram(object): return self._gridSpacing * int(x / self._gridSpacing + 0.5), self._gridSpacing * int(y / self._gridSpacing + 0.5) return x, y + def SetGridSpacing(self, spacing): + """Sets grid spacing.""" + self._gridSpacing = spacing + + def SetSnapToGrid(self, snap): + """Sets snap-to-grid mode.""" + self._snapToGrid = snap + def GetGridSpacing(self): """Return the grid spacing.""" return self._gridSpacing