mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-06 12:00:13 +01:00
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:
File diff suppressed because it is too large
Load Diff
@@ -59,6 +59,12 @@ class GUIBase(object):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
def __init__(self, Canvas=None):
|
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
|
self.Canvas = Canvas # set the FloatCanvas for the mode
|
||||||
# it gets set when the Mode is set on the Canvas.
|
# it gets set when the Mode is set on the Canvas.
|
||||||
self.Cursors = Cursors()
|
self.Cursors = Cursors()
|
||||||
@@ -286,7 +292,10 @@ class GUIMove(GUIBase):
|
|||||||
self.Canvas.Zoom(1.1)
|
self.Canvas.Zoom(1.1)
|
||||||
|
|
||||||
class GUIZoomIn(GUIBase):
|
class GUIZoomIn(GUIBase):
|
||||||
|
"""
|
||||||
|
Mode to zoom in.
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self, canvas=None):
|
def __init__(self, canvas=None):
|
||||||
GUIBase.__init__(self, canvas)
|
GUIBase.__init__(self, canvas)
|
||||||
self.StartRBBox = None
|
self.StartRBBox = None
|
||||||
@@ -356,6 +365,9 @@ class GUIZoomIn(GUIBase):
|
|||||||
self.Canvas.Zoom(1.1)
|
self.Canvas.Zoom(1.1)
|
||||||
|
|
||||||
class GUIZoomOut(GUIBase):
|
class GUIZoomOut(GUIBase):
|
||||||
|
"""
|
||||||
|
Mode to zoom out.
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self, Canvas=None):
|
def __init__(self, Canvas=None):
|
||||||
GUIBase.__init__(self, Canvas)
|
GUIBase.__init__(self, Canvas)
|
||||||
|
|||||||
@@ -4,7 +4,33 @@ Combines :class:`~lib.floatcanvas.FloatCanvas.FloatCanvas` with Navigation
|
|||||||
controls onto a :class:`Panel`
|
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
|
import wx
|
||||||
@@ -12,7 +38,7 @@ import FloatCanvas, Resources, GUIMode
|
|||||||
|
|
||||||
class NavCanvas(wx.Panel):
|
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
|
:class:`~lib.floatcanvas.FloatCanvas.FloatCanvas` in a :class:`Panel` and
|
||||||
adds a Navigation toolbar.
|
adds a Navigation toolbar.
|
||||||
|
|
||||||
@@ -74,7 +100,9 @@ class NavCanvas(wx.Panel):
|
|||||||
Add the mode buttons to the tool bar.
|
Add the mode buttons to the tool bar.
|
||||||
|
|
||||||
:param ToolBar `tb`: the toolbar instance
|
: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 = {}
|
self.ModesDict = {}
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ Contact me at:
|
|||||||
|
|
||||||
Chris.Barker@noaa.gov
|
Chris.Barker@noaa.gov
|
||||||
|
|
||||||
Tags: phoenix-port, documented
|
Tags: phoenix-port, documented, unittest
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__version__ = "0.9.18"
|
__version__ = "0.9.18"
|
||||||
|
|||||||
Reference in New Issue
Block a user