Floatcanvas patch from Wenrer

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@74112 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2013-06-06 01:58:55 +00:00
parent 32c1e977c6
commit 803aace8ab
4 changed files with 353 additions and 279 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -59,6 +59,12 @@ class GUIBase(object):
"""
def __init__(self, Canvas=None):
"""
Default class constructor.
:param `Canvas`: the canvas the GUI mode is attached too
"""
self.Canvas = Canvas # set the FloatCanvas for the mode
# it gets set when the Mode is set on the Canvas.
self.Cursors = Cursors()
@@ -286,7 +292,10 @@ class GUIMove(GUIBase):
self.Canvas.Zoom(1.1)
class GUIZoomIn(GUIBase):
"""
Mode to zoom in.
"""
def __init__(self, canvas=None):
GUIBase.__init__(self, canvas)
self.StartRBBox = None
@@ -356,6 +365,9 @@ class GUIZoomIn(GUIBase):
self.Canvas.Zoom(1.1)
class GUIZoomOut(GUIBase):
"""
Mode to zoom out.
"""
def __init__(self, Canvas=None):
GUIBase.__init__(self, Canvas)

View File

@@ -4,7 +4,33 @@ Combines :class:`~lib.floatcanvas.FloatCanvas.FloatCanvas` with Navigation
controls onto a :class:`Panel`
Tags: phoenix-port, documented, unittest
In the following very simple sample ``self`` is a frame, but it could be another
container type control::
from wx.lib.floatcanvas import NavCanvas, FloatCanvas
#Add the Canvas
self.Canvas = NavCanvas.NavCanvas(self, -1,
size=(500, 500),
ProjectionFun=None,
Debug=0,
BackgroundColor="White",
).Canvas
# add a circle
cir = FloatCanvas.Circle((10, 10), 100)
self.Canvas.AddObject(cir)
# add a rectangle
rect = FloatCanvas.Rectangle((110, 10), (100, 100), FillColor='Red')
self.Canvas.AddObject(rect)
self.Canvas.Draw()
Many samples are available in the `wxPhoenix/samples/floatcanvas` folder.
"""
import wx
@@ -12,7 +38,7 @@ import FloatCanvas, Resources, GUIMode
class NavCanvas(wx.Panel):
"""
:class:`~lib.floatcanvas.FloatCanvas.NavCanvas` encloses a
:class:`~lib.floatcanvas.NavCanvas.NavCanvas` encloses a
:class:`~lib.floatcanvas.FloatCanvas.FloatCanvas` in a :class:`Panel` and
adds a Navigation toolbar.
@@ -74,7 +100,9 @@ class NavCanvas(wx.Panel):
Add the mode buttons to the tool bar.
:param ToolBar `tb`: the toolbar instance
:param list `Modes`: a list of modes to add ??? what is valid ???
:param list `Modes`: a list of modes to add, out of the box valid modes
are subclassed from :class:`~lib.floatcanvas.GUIMode.GUIBase` or modes
can also be user defined.
"""
self.ModesDict = {}

View File

@@ -105,7 +105,7 @@ Contact me at:
Chris.Barker@noaa.gov
Tags: phoenix-port, documented
Tags: phoenix-port, documented, unittest
"""
__version__ = "0.9.18"