From 1447c3d50a15fbca79f5d36a4ac6259b57b6df91 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Sat, 4 May 2013 02:00:24 +0000 Subject: [PATCH] More FloatCanvas updates from Werner git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@73909 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wx/lib/floatcanvas/FloatCanvas.py | 24 +++++++++---------- wx/lib/floatcanvas/SpecialObjects/PieChart.py | 8 +++---- wx/lib/floatcanvas/Utilities/GUI.py | 4 ++-- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/wx/lib/floatcanvas/FloatCanvas.py b/wx/lib/floatcanvas/FloatCanvas.py index 6a479ec8..f88a5c9c 100644 --- a/wx/lib/floatcanvas/FloatCanvas.py +++ b/wx/lib/floatcanvas/FloatCanvas.py @@ -1834,10 +1834,10 @@ class Bitmap(TextObjectMixin, DrawObject, ): DrawObject.__init__(self,InForeground) - if type(Bitmap) == wx._gdi.Bitmap: + if type(Bitmap) == wx.Bitmap: self.Bitmap = Bitmap - elif type(Bitmap) == wx._core.Image: - self.Bitmap = wx.BitmapFromImage(Bitmap) + elif type(Bitmap) == wx.Image: + self.Bitmap = wx.Bitmap(Bitmap) # Note the BB is just the point, as the size in World coordinates is not fixed self.BoundingBox = BBox.asBBox( (XY,XY) ) @@ -1850,7 +1850,7 @@ class Bitmap(TextObjectMixin, DrawObject, ): def _Draw(self, dc , WorldToPixel, ScaleWorldToPixel, HTdc=None): XY = WorldToPixel(self.XY) XY = self.ShiftFun(XY[0], XY[1], self.Width, self.Height) - dc.DrawBitmapPoint(self.Bitmap, XY, True) + dc.DrawBitmap(self.Bitmap, XY, True) if HTdc and self.HitAble: HTdc.SetPen(self.HitPen) HTdc.SetBrush(self.HitBrush) @@ -1884,9 +1884,9 @@ class ScaledBitmap(TextObjectMixin, DrawObject, ): DrawObject.__init__(self,InForeground) - if type(Bitmap) == wx._gdi.Bitmap: + if type(Bitmap) == wx.Bitmap: self.Image = Bitmap.ConvertToImage() - elif type(Bitmap) == wx._core.Image: + elif type(Bitmap) == wx.Image: self.Image = Bitmap self.XY = XY @@ -1912,10 +1912,10 @@ class ScaledBitmap(TextObjectMixin, DrawObject, ): if (self.ScaledBitmap is None) or (H <> self.ScaledHeight) : self.ScaledHeight = H Img = self.Image.Scale(W, H) - self.ScaledBitmap = wx.BitmapFromImage(Img) + self.ScaledBitmap = wx.Bitmap(Img) XY = self.ShiftFun(XY[0], XY[1], W, H) - dc.DrawBitmapPoint(self.ScaledBitmap, XY, True) + dc.DrawBitmap(self.ScaledBitmap, XY, True) if HTdc and self.HitAble: HTdc.SetPen(self.HitPen) HTdc.SetBrush(self.HitBrush) @@ -1995,7 +1995,7 @@ class ScaledBitmap2(TextObjectMixin, DrawObject, ): self.ScaledHeight = H #print "Scaling to:", W, H Img = self.Image.Scale(W, H) - bmp = wx.BitmapFromImage(Img) + bmp = wx.Bitmap(Img) self.ScaledBitmap = ((0, 0, self.bmpWidth, self.bmpHeight , W, H), bmp)# this defines the cached bitmap else: #print "Using Cached bitmap" @@ -2062,7 +2062,7 @@ class ScaledBitmap2(TextObjectMixin, DrawObject, ): Img = self.Image.GetSubImage(wx.Rect(Xb, Yb, Wb, Hb)) print "rescaling with High quality" Img.Rescale(Ws, Hs, quality=wx.IMAGE_QUALITY_HIGH) - bmp = wx.BitmapFromImage(Img) + bmp = wx.Bitmap(Img) self.ScaledBitmap = ((Xb, Yb, Wb, Hb, Ws, Ws), bmp)# this defines the cached bitmap #XY = self.ShiftFun(XY[0], XY[1], W, H) #fixme: get the shiftfun working! @@ -2261,9 +2261,9 @@ class Arc(XYObjectMixin, LineAndFillMixin, DrawObject): EndXY = WorldToPixel(self.EndXY) CenterXY = WorldToPixel(self.CenterXY) - dc.DrawArcPoint(StartXY, EndXY, CenterXY) + dc.DrawArc(StartXY, EndXY, CenterXY) if HTdc and self.HitAble: - HTdc.DrawArcPoint(StartXY, EndXY, CenterXY) + HTdc.DrawArc(StartXY, EndXY, CenterXY) def CalcBoundingBox(self): self.BoundingBox = BBox.asBBox( N.array((self.XY, (self.XY + self.WH) ), N.float) ) diff --git a/wx/lib/floatcanvas/SpecialObjects/PieChart.py b/wx/lib/floatcanvas/SpecialObjects/PieChart.py index 3bccd9d9..2325b0c4 100644 --- a/wx/lib/floatcanvas/SpecialObjects/PieChart.py +++ b/wx/lib/floatcanvas/SpecialObjects/PieChart.py @@ -3,9 +3,9 @@ import wx ## import a local version of FloatCanvas -from floatcanvas import FloatCanvas -from floatcanvas.Utilities import BBox -from floatcanvas.Utilities import Colors +from wx.lib.floatcanvas import FloatCanvas +from wx.lib.floatcanvas.Utilities import BBox +from wx.lib.floatcanvas.Utilities import Colors import numpy as N @@ -133,6 +133,6 @@ class PieChart(XYObjectMixin, LineOnlyMixin, DrawObject): radius = self.Diameter/2 HTdc.SetPen(self.HitPen) HTdc.SetBrush(self.HitBrush) - HTdc.DrawCirclePoint(CenterXY, radius) + HTdc.DrawCircle(CenterXY, radius) diff --git a/wx/lib/floatcanvas/Utilities/GUI.py b/wx/lib/floatcanvas/Utilities/GUI.py index 28ca6c7d..075c4492 100644 --- a/wx/lib/floatcanvas/Utilities/GUI.py +++ b/wx/lib/floatcanvas/Utilities/GUI.py @@ -66,9 +66,9 @@ class RubberBandBox(GUIMode.GUIBase): dc.SetBrush(wx.TRANSPARENT_BRUSH) dc.SetLogicalFunction(wx.XOR) if self.RBRect: - dc.DrawRectanglePointSize(*self.RBRect) + dc.DrawRectangle(*self.RBRect) self.RBRect = ((x, y), (w, h) ) - dc.DrawRectanglePointSize(*self.RBRect) + dc.DrawRectangle(*self.RBRect) self.Canvas._RaiseMouseEvent(event,FloatCanvas.EVT_FC_MOTION) def OnLeftDown(self, event):