Reverted to old method names/signatures for wx.DC, updated lib and
demo to match. Also fixed some deprecation warnings. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27049 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
019fd9d379
commit
d7403ad2d1
@ -155,7 +155,7 @@ class TestPanel(wx.Panel):
|
||||
text = wx.StaticText(self, -1, "48x48")
|
||||
box.Add(text, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
|
||||
|
||||
fgs.AddSizer(box, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
|
||||
fgs.Add(box, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
|
||||
sizer.Add(fgs, 0, wx.ALL, 5)
|
||||
self.SetSizer(sizer)
|
||||
|
||||
|
@ -19,14 +19,14 @@ class TestPanel(wx.Panel):
|
||||
|
||||
try:
|
||||
bmp = wx.Bitmap("nosuchfile.bmp", wx.BITMAP_TYPE_BMP)
|
||||
mask = wx.MaskColour(bmp, wx.BLUE)
|
||||
mask = wx.Mask(bmp, wx.BLUE)
|
||||
except wx.PyAssertionError:
|
||||
self.log.write("Caught wx.PyAssertionError! I will fix the problem.\n")
|
||||
bmp = images.getTest2Bitmap()
|
||||
mask = wx.MaskColour(bmp, wx.BLUE)
|
||||
else:
|
||||
bmp = images.getTest2Bitmap()
|
||||
mask = wx.MaskColour(bmp, wx.BLUE)
|
||||
mask = wx.Mask(bmp, wx.BLUE)
|
||||
|
||||
bmp.SetMask(mask)
|
||||
b = wx.BitmapButton(self, 30, bmp, (20, 20),
|
||||
|
@ -73,7 +73,7 @@ class TestWindow(wx.ScrolledWindow):
|
||||
while x < sz.width:
|
||||
y = -dy
|
||||
while y < sz.height:
|
||||
dc.DrawBitmap(self.bg_bmp, (x, y))
|
||||
dc.DrawBitmap(self.bg_bmp, x, y)
|
||||
y = y + h
|
||||
|
||||
x = x + w
|
||||
@ -121,13 +121,12 @@ class TestWindow(wx.ScrolledWindow):
|
||||
clr = colours[line]
|
||||
y = (line+1) * self.lineHeight + 2
|
||||
|
||||
# Updated for 2.5 - now takes tuple for pos
|
||||
dc.DrawText(clr, (self.cellWidth, y))
|
||||
dc.DrawText(clr, self.cellWidth, y)
|
||||
|
||||
brush = wx.Brush(clr, wx.SOLID)
|
||||
dc.SetBrush(brush)
|
||||
dc.DrawRectangle((12 * self.cellWidth, y),
|
||||
(6 * self.cellWidth, self.textHeight))
|
||||
dc.DrawRectangle(12 * self.cellWidth, y,
|
||||
6 * self.cellWidth, self.textHeight)
|
||||
|
||||
dc.EndDrawing()
|
||||
|
||||
|
@ -109,7 +109,8 @@ class TestPanel(wx.Panel):
|
||||
dc = wx.ClientDC(self.win)
|
||||
dc.SetPen(wx.Pen("RED"))
|
||||
dc.SetBrush(wx.Brush("RED"))
|
||||
dc.DrawCircle(evt.GetPosition(), 4)
|
||||
pos = evt.GetPosition()
|
||||
dc.DrawCircle(pos.x, pos.y, 4)
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
@ -69,7 +69,7 @@ class DoodlePad(wx.Window):
|
||||
dc = wx.ClientDC(self)
|
||||
dc.BeginDrawing()
|
||||
dc.SetPen(wx.Pen(wx.BLUE, 3))
|
||||
coords = ((self.x, self.y), event.GetPositionTuple())
|
||||
coords = (self.x, self.y) + event.GetPositionTuple()
|
||||
self.curLine.append(coords)
|
||||
dc.DrawLine(*coords)
|
||||
self.x, self.y = event.GetPositionTuple()
|
||||
|
@ -25,9 +25,9 @@ class DragShape:
|
||||
memDC = wx.MemoryDC()
|
||||
memDC.SelectObject(self.bmp)
|
||||
|
||||
dc.Blit((self.pos[0], self.pos[1]),
|
||||
(self.bmp.GetWidth(), self.bmp.GetHeight()),
|
||||
memDC, (0, 0), op, True)
|
||||
dc.Blit(self.pos[0], self.pos[1],
|
||||
self.bmp.GetWidth(), self.bmp.GetHeight(),
|
||||
memDC, 0, 0, op, True)
|
||||
|
||||
return True
|
||||
else:
|
||||
@ -73,9 +73,9 @@ class DragCanvas(wx.ScrolledWindow):
|
||||
dc.Clear()
|
||||
dc.SetTextForeground(wx.RED)
|
||||
dc.SetFont(font)
|
||||
dc.DrawText(text, (0, 0))
|
||||
dc.DrawText(text, 0, 0)
|
||||
dc.SelectObject(wx.NullBitmap)
|
||||
mask = wx.MaskColour(bmp, bg_colour)
|
||||
mask = wx.Mask(bmp, bg_colour)
|
||||
bmp.SetMask(mask)
|
||||
shape = DragShape(bmp)
|
||||
shape.pos = (5, 100)
|
||||
@ -122,7 +122,7 @@ class DragCanvas(wx.ScrolledWindow):
|
||||
y = 0
|
||||
|
||||
while y < sz.height:
|
||||
dc.DrawBitmap(self.bg_bmp, (x, y))
|
||||
dc.DrawBitmap(self.bg_bmp, x, y)
|
||||
y = y + h
|
||||
|
||||
x = x + w
|
||||
|
@ -27,7 +27,7 @@ class TestPanel(wx.Panel):
|
||||
self, -1, (20, 80), (450, -1), changeCallback = self.dbbCallback
|
||||
)
|
||||
|
||||
self.fbbh.SetHistory(['You', 'can', 'put', 'some', 'file', 'names', 'here'])
|
||||
self.fbbh.SetHistory(['You', 'can', 'put', 'some', 'filenames', 'here'])
|
||||
|
||||
|
||||
def fbbCallback(self, evt):
|
||||
@ -39,8 +39,10 @@ class TestPanel(wx.Panel):
|
||||
value = evt.GetString()
|
||||
self.log.write('FileBrowseButtonWithHistory: %s\n' % value)
|
||||
history = self.fbbh.GetHistory()
|
||||
if value not in history:
|
||||
history.append(value)
|
||||
self.fbbh.SetHistory(history)
|
||||
self.fbbh.GetHistoryControl().SetStringSelection(value)
|
||||
|
||||
|
||||
def dbbCallback(self, evt):
|
||||
|
@ -26,8 +26,8 @@ You can get it at:
|
||||
overview = ""
|
||||
|
||||
else:
|
||||
from wxPython.lib import floatcanvas
|
||||
import wxPython.lib.colourdb
|
||||
from wx.lib import floatcanvas
|
||||
import wx.lib.colourdb
|
||||
|
||||
ID_ABOUT_MENU = wx.NewId()
|
||||
ID_EXIT_MENU = wx.NewId()
|
||||
@ -369,8 +369,8 @@ else:
|
||||
|
||||
def OnInit(self):
|
||||
global colors
|
||||
wxPython.lib.colourdb.updateColourDB()
|
||||
colors = wxPython.lib.colourdb.getColourList()
|
||||
wx.lib.colourdb.updateColourDB()
|
||||
colors = wx.lib.colourdb.getColourList()
|
||||
|
||||
frame = DrawFrame(None, -1, "FloatCanvas Demo App",
|
||||
wx.DefaultPosition, (700,700))
|
||||
@ -438,8 +438,8 @@ else:
|
||||
this demo with the rest.
|
||||
"""
|
||||
global colors
|
||||
wxPython.lib.colourdb.updateColourDB()
|
||||
colors = wxPython.lib.colourdb.getColourList()
|
||||
wx.lib.colourdb.updateColourDB()
|
||||
colors = wx.lib.colourdb.getColourList()
|
||||
|
||||
win = DrawFrame(None, -1, "FloatCanvas Drawing Window",
|
||||
wx.DefaultPosition, (500,500))
|
||||
|
@ -67,11 +67,11 @@ class TestPanel(wx.Panel):
|
||||
b = buttons.GenBitmapButton(self, -1, None)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnButton, b)
|
||||
bmp = images.getBulb1Bitmap()
|
||||
mask = wx.MaskColour(bmp, wx.BLUE)
|
||||
mask = wx.Mask(bmp, wx.BLUE)
|
||||
bmp.SetMask(mask)
|
||||
b.SetBitmapLabel(bmp)
|
||||
bmp = images.getBulb2Bitmap()
|
||||
mask = wx.MaskColour(bmp, wx.BLUE)
|
||||
mask = wx.Mask(bmp, wx.BLUE)
|
||||
bmp.SetMask(mask)
|
||||
b.SetBitmapSelected(bmp)
|
||||
b.SetBestSize()
|
||||
@ -86,11 +86,11 @@ class TestPanel(wx.Panel):
|
||||
b = buttons.GenBitmapToggleButton(self, -1, None)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnToggleButton, b)
|
||||
bmp = images.getBulb1Bitmap()
|
||||
mask = wx.MaskColour(bmp, wx.BLUE)
|
||||
mask = wx.Mask(bmp, wx.BLUE)
|
||||
bmp.SetMask(mask)
|
||||
b.SetBitmapLabel(bmp)
|
||||
bmp = images.getBulb2Bitmap()
|
||||
mask = wx.MaskColour(bmp, wx.BLUE)
|
||||
mask = wx.Mask(bmp, wx.BLUE)
|
||||
bmp.SetMask(mask)
|
||||
b.SetBitmapSelected(bmp)
|
||||
b.SetToggle(True)
|
||||
@ -101,11 +101,11 @@ class TestPanel(wx.Panel):
|
||||
b = buttons.GenBitmapTextButton(self, -1, None, "Bitmapped Text", size = (200, 45))
|
||||
self.Bind(wx.EVT_BUTTON, self.OnButton, b)
|
||||
bmp = images.getBulb1Bitmap()
|
||||
mask = wx.MaskColour(bmp, wx.BLUE)
|
||||
mask = wx.Mask(bmp, wx.BLUE)
|
||||
bmp.SetMask(mask)
|
||||
b.SetBitmapLabel(bmp)
|
||||
bmp = images.getBulb2Bitmap()
|
||||
mask = wx.MaskColour(bmp, wx.BLUE)
|
||||
mask = wx.Mask(bmp, wx.BLUE)
|
||||
bmp.SetMask(mask)
|
||||
b.SetBitmapSelected(bmp)
|
||||
b.SetUseFocusIndicator(False)
|
||||
|
@ -26,7 +26,7 @@ class MyCustomRenderer(gridlib.PyGridCellRenderer):
|
||||
|
||||
for ch in text:
|
||||
dc.SetTextForeground(random.choice(colors))
|
||||
dc.DrawText(ch, (x, y))
|
||||
dc.DrawText(ch, x, y)
|
||||
w, h = dc.GetTextExtent(ch)
|
||||
x = x + w
|
||||
if x > rect.right - 5:
|
||||
|
@ -219,7 +219,6 @@ class MegaImageRenderer(Grid.PyGridCellRenderer):
|
||||
dc.SetPen(wx.Pen(wx.WHITE, 1, wx.SOLID))
|
||||
dc.DrawRectangleRect(rect)
|
||||
|
||||
#dc.DrawRectangle((rect.x, rect.y), (rect.width, rect.height))
|
||||
|
||||
# copy the image but only to the size of the grid cell
|
||||
width, height = bmp.GetWidth(), bmp.GetHeight()
|
||||
@ -230,9 +229,9 @@ class MegaImageRenderer(Grid.PyGridCellRenderer):
|
||||
if height > rect.height-2:
|
||||
height = rect.height-2
|
||||
|
||||
dc.Blit((rect.x+1, rect.y+1), (width, height),
|
||||
dc.Blit(rect.x+1, rect.y+1, width, height,
|
||||
image,
|
||||
(0, 0), wx.COPY, True)
|
||||
0, 0, wx.COPY, True)
|
||||
|
||||
|
||||
class MegaFontRenderer(Grid.PyGridCellRenderer):
|
||||
@ -265,8 +264,6 @@ class MegaFontRenderer(Grid.PyGridCellRenderer):
|
||||
dc.SetPen(wx.Pen(wx.WHITE, 1, wx.SOLID))
|
||||
dc.DrawRectangleRect(rect)
|
||||
|
||||
#dc.DrawRectangle((rect.x, rect.y), (rect.width, rect.height))
|
||||
|
||||
text = self.table.GetValue(row, col)
|
||||
dc.SetBackgroundMode(wx.SOLID)
|
||||
|
||||
@ -281,7 +278,7 @@ class MegaFontRenderer(Grid.PyGridCellRenderer):
|
||||
|
||||
dc.SetTextForeground(self.color)
|
||||
dc.SetFont(self.font)
|
||||
dc.DrawText(text, (rect.x+1, rect.y+1))
|
||||
dc.DrawText(text, rect.x+1, rect.y+1)
|
||||
|
||||
# Okay, now for the advanced class :)
|
||||
# Let's add three dots "..."
|
||||
@ -293,8 +290,8 @@ class MegaFontRenderer(Grid.PyGridCellRenderer):
|
||||
if width > rect.width-2:
|
||||
width, height = dc.GetTextExtent("...")
|
||||
x = rect.x+1 + rect.width-2 - width
|
||||
dc.DrawRectangle((x, rect.y+1), (width+1, height))
|
||||
dc.DrawText("...", (x, rect.y+1))
|
||||
dc.DrawRectangle(x, rect.y+1, width+1, height)
|
||||
dc.DrawText("...", x, rect.y+1)
|
||||
|
||||
dc.DestroyClippingRegion()
|
||||
|
||||
|
@ -22,21 +22,21 @@ class TestPanel(wx.Panel):
|
||||
|
||||
dc.SetFont(wx.Font(16, wx.SWISS, wx.NORMAL, wx.BOLD, True))
|
||||
dc.DrawText("Bitmap alpha blending (on wxMSW and wxMac only)",
|
||||
(25,25))
|
||||
25,25)
|
||||
|
||||
bmp = wx.Bitmap(opj('bitmaps/toucan.png'))
|
||||
if "__WXGTK__" in wx.PlatformInfo:
|
||||
# try to make up for it a bit...
|
||||
bmp.SetMaskColour("black")
|
||||
|
||||
dc.DrawBitmap(bmp, (25,100), True)
|
||||
dc.DrawBitmap(bmp, 25,100, True)
|
||||
|
||||
dc.SetFont(self.GetFont())
|
||||
y = 75
|
||||
for line in range(10):
|
||||
y += dc.GetCharHeight() + 5
|
||||
dc.DrawText(msg, (200, y))
|
||||
dc.DrawBitmap(bmp, (250,100), True)
|
||||
dc.DrawText(msg, 200, y)
|
||||
dc.DrawBitmap(bmp, 250,100, True)
|
||||
|
||||
|
||||
|
||||
|
@ -47,7 +47,7 @@ class TestPanel( wx.Panel ):
|
||||
grid.Add( self.target_ctl, 0, wx.ALIGN_LEFT|wx.ALL, 5 )
|
||||
|
||||
outer_box = wx.BoxSizer( wx.VERTICAL )
|
||||
outer_box.AddSizer( grid, 0, wx.ALIGN_CENTRE|wx.ALL, 20 )
|
||||
outer_box.Add( grid, 0, wx.ALIGN_CENTRE|wx.ALL, 20 )
|
||||
|
||||
panel.SetAutoLayout( True )
|
||||
panel.SetSizer( outer_box )
|
||||
|
@ -95,18 +95,18 @@ class JoyGauge(wx.Panel):
|
||||
|
||||
# Restrict our drawing activities to the square defined
|
||||
# above.
|
||||
dc.SetClippingRegion((xorigin, yorigin), (edgeSize, edgeSize))
|
||||
dc.SetClippingRegion(xorigin, yorigin, edgeSize, edgeSize)
|
||||
|
||||
# Optimize drawing a bit (for Win)
|
||||
dc.BeginDrawing()
|
||||
|
||||
dc.SetBrush(wx.Brush(wx.Colour(251, 252, 237)))
|
||||
dc.DrawRectangle((xorigin, yorigin), (edgeSize, edgeSize))
|
||||
dc.DrawRectangle(xorigin, yorigin, edgeSize, edgeSize)
|
||||
|
||||
dc.SetPen(wx.Pen(wx.BLACK, 1, wx.DOT_DASH))
|
||||
|
||||
dc.DrawLine((xorigin, yorigin + center), (xorigin + edgeSize, yorigin + center))
|
||||
dc.DrawLine((xorigin + center, yorigin), (xorigin + center, yorigin + edgeSize))
|
||||
dc.DrawLine(xorigin, yorigin + center, xorigin + edgeSize, yorigin + center)
|
||||
dc.DrawLine(xorigin + center, yorigin, xorigin + center, yorigin + edgeSize)
|
||||
|
||||
if self.stick:
|
||||
# Get the joystick position as a float
|
||||
@ -239,14 +239,14 @@ class POVGauge(wx.Panel):
|
||||
|
||||
# our 'raster'.
|
||||
dc.SetBrush(wx.Brush(wx.WHITE))
|
||||
dc.DrawCircle((xcenter, ycenter), diameter/2)
|
||||
dc.DrawCircle(xcenter, ycenter, diameter/2)
|
||||
dc.SetBrush(wx.Brush(wx.BLACK))
|
||||
dc.DrawCircle((xcenter, ycenter), 10)
|
||||
dc.DrawCircle(xcenter, ycenter, 10)
|
||||
|
||||
# fancy decorations
|
||||
dc.SetPen(wx.Pen(wx.BLACK, 1, wx.DOT_DASH))
|
||||
dc.DrawLine((xorigin, ycenter), (xorigin + diameter, ycenter))
|
||||
dc.DrawLine((xcenter, yorigin), (xcenter, yorigin + diameter))
|
||||
dc.DrawLine(xorigin, ycenter, xorigin + diameter, ycenter)
|
||||
dc.DrawLine(xcenter, yorigin, xcenter, yorigin + diameter)
|
||||
|
||||
if self.stick:
|
||||
if self.avail:
|
||||
@ -284,11 +284,11 @@ class POVGauge(wx.Panel):
|
||||
|
||||
# Draw the line
|
||||
dc.SetPen(wx.Pen(wx.BLUE, 2))
|
||||
dc.DrawLine((xcenter, ycenter), (nx, ny))
|
||||
dc.DrawLine(xcenter, ycenter, nx, ny)
|
||||
|
||||
# And a little thing to show the endpoint
|
||||
dc.SetBrush(wx.Brush(wx.BLUE))
|
||||
dc.DrawCircle((nx, ny), 8)
|
||||
dc.DrawCircle(nx, ny, 8)
|
||||
|
||||
# Turn off drawing optimization
|
||||
dc.EndDrawing()
|
||||
@ -462,7 +462,7 @@ class LED(wx.Panel):
|
||||
else:
|
||||
dc.SetBrush(wx.Brush(wx.BLACK))
|
||||
|
||||
dc.DrawCircle((center, center), bw/2)
|
||||
dc.DrawCircle(center, center, bw/2)
|
||||
|
||||
txt = str(self.number)
|
||||
|
||||
@ -483,7 +483,7 @@ class LED(wx.Panel):
|
||||
# functions. The pseudo-shadow gives the text contrast
|
||||
# regardless of whether the bar is under it or not.
|
||||
dc.SetTextForeground(wx.WHITE)
|
||||
dc.DrawText(txt, (tx, ty))
|
||||
dc.DrawText(txt, tx, ty)
|
||||
|
||||
# Turn off drawing optimization
|
||||
dc.EndDrawing()
|
||||
@ -709,10 +709,10 @@ class AxisBar(wx.Gauge):
|
||||
# functions. The pseudo-shadow gives the text contrast
|
||||
# regardless of whether the bar is under it or not.
|
||||
dc.SetTextForeground(wx.BLACK)
|
||||
dc.DrawText(txt, (tx, ty))
|
||||
dc.DrawText(txt, tx, ty)
|
||||
|
||||
dc.SetTextForeground('white')
|
||||
dc.DrawText(txt, (tx-1, ty-1))
|
||||
dc.DrawText(txt, tx-1, ty-1)
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
@ -66,7 +66,7 @@ class MyParentFrame(wx.MDIParentFrame):
|
||||
y = 0
|
||||
|
||||
while y < sz.height:
|
||||
dc.DrawBitmap(self.bg_bmp, (x, y))
|
||||
dc.DrawBitmap(self.bg_bmp, x, y)
|
||||
y = y + h
|
||||
|
||||
x = x + w
|
||||
|
@ -221,7 +221,7 @@ _treeList = [
|
||||
]),
|
||||
|
||||
# need libs not coming with the demo
|
||||
('Objects using an external library', [
|
||||
('Samples using an external library', [
|
||||
'GLCanvas',
|
||||
]),
|
||||
|
||||
|
@ -49,7 +49,7 @@ class TestMaskWindow(wx.ScrolledWindow):
|
||||
# Now we'll create a mask in a bit of an easier way, by picking a
|
||||
# colour in the image that is to be the transparent colour.
|
||||
self.bmp_withcolourmask = images.getTestStar2Bitmap()
|
||||
mask = wx.MaskColour(self.bmp_withcolourmask, wx.WHITE)
|
||||
mask = wx.Mask(self.bmp_withcolourmask, wx.WHITE)
|
||||
self.bmp_withcolourmask.SetMask(mask)
|
||||
|
||||
self.SetScrollbars(20, 20, 700/20, 460/20)
|
||||
@ -66,17 +66,17 @@ class TestMaskWindow(wx.ScrolledWindow):
|
||||
# make an interesting background...
|
||||
dc.SetPen(wx.MEDIUM_GREY_PEN)
|
||||
for i in range(100):
|
||||
dc.DrawLine((0,i*10), (i*10,0))
|
||||
dc.DrawLine(0,i*10, i*10,0)
|
||||
|
||||
# draw raw image, mask, and masked images
|
||||
dc.DrawText('original image', (0,0))
|
||||
dc.DrawBitmap(self.bmp_nomask, (0,20), 0)
|
||||
dc.DrawText('with colour mask', (0,100))
|
||||
dc.DrawBitmap(self.bmp_withcolourmask, (0,120), 1)
|
||||
dc.DrawText('the mask image', (0,200))
|
||||
dc.DrawBitmap(self.bmp_themask, (0,220), 0)
|
||||
dc.DrawText('masked image', (0,300))
|
||||
dc.DrawBitmap(self.bmp_withmask, (0,320), 1)
|
||||
dc.DrawText('original image', 0,0)
|
||||
dc.DrawBitmap(self.bmp_nomask, 0,20, 0)
|
||||
dc.DrawText('with colour mask', 0,100)
|
||||
dc.DrawBitmap(self.bmp_withcolourmask, 0,120, 1)
|
||||
dc.DrawText('the mask image', 0,200)
|
||||
dc.DrawBitmap(self.bmp_themask, 0,220, 0)
|
||||
dc.DrawText('masked image', 0,300)
|
||||
dc.DrawBitmap(self.bmp_withmask, 0,320, 1)
|
||||
|
||||
cx,cy = self.bmp_themask.GetWidth(), self.bmp_themask.GetHeight()
|
||||
|
||||
@ -86,9 +86,9 @@ class TestMaskWindow(wx.ScrolledWindow):
|
||||
|
||||
for text, code in logicList:
|
||||
x,y = 120+150*(i%4), 20+100*(i/4)
|
||||
dc.DrawText(text, (x, y-20))
|
||||
dc.DrawText(text, x, y-20)
|
||||
mdc.SelectObject(self.bmp_withcolourmask)
|
||||
dc.Blit((x,y), (cx,cy), mdc, (0,0), code, True)
|
||||
dc.Blit(x,y, cx,cy, mdc, 0,0, code, True)
|
||||
i = i + 1
|
||||
|
||||
|
||||
|
@ -5,8 +5,9 @@ import wx
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
dlg = wx.MessageDialog(frame, 'Hello from Python and wxPython!',
|
||||
'A Message Box', wx.OK | wx.ICON_INFORMATION)
|
||||
#wxYES_NO | wxNO_DEFAULT | wxCANCEL | wxICON_INFORMATION)
|
||||
'A Message Box',
|
||||
wx.OK | wx.ICON_INFORMATION)
|
||||
#wx.YES_NO | wx.NO_DEFAULT | wx.CANCEL | wx.ICON_INFORMATION)
|
||||
dlg.ShowModal()
|
||||
dlg.Destroy()
|
||||
|
||||
@ -15,16 +16,14 @@ def runTest(frame, nb, log):
|
||||
|
||||
|
||||
overview = """\
|
||||
This class represents a dialog that shows a single or multi-line message, with a
|
||||
choice of OK, Yes, No and Cancel buttons.
|
||||
<html><body>
|
||||
<h2>wx.MessageDialog</h2>
|
||||
|
||||
Additionally, various style flags can determine whether an icon is displayed,
|
||||
and, if so, what kind.
|
||||
|
||||
The dialog can be modal or not; of modal, the user's response is in the return
|
||||
code of ShowModal(). If not, the response can be taken from GetReturnCode() (inherited
|
||||
from the wx.Dialog). If not modal and the return code is required, it
|
||||
must be retrieved before the dialog is destroyed.
|
||||
This class represents a dialog that shows a single or multi-line
|
||||
message, with a choice of OK, Yes, No and Cancel buttons.
|
||||
Additionally, various style flags can determine whether an icon is
|
||||
displayed, and, if so, what kind. The return value of ShowModal
|
||||
indicates which button was pressed.
|
||||
|
||||
"""
|
||||
|
||||
|
@ -214,7 +214,7 @@ class TestWindow(ogl.ShapeCanvas):
|
||||
)
|
||||
|
||||
bmp = images.getTest2Bitmap()
|
||||
mask = wx.MaskColour(bmp, wx.BLUE)
|
||||
mask = wx.Mask(bmp, wx.BLUE)
|
||||
bmp.SetMask(mask)
|
||||
|
||||
s = ogl.BitmapShape()
|
||||
|
@ -84,7 +84,7 @@ class MyPrintout(wx.Printout):
|
||||
#-------------------------------------------
|
||||
|
||||
self.canvas.DoDrawing(dc, True)
|
||||
dc.DrawText("Page: %d" % page, (marginX/2, maxY-marginY))
|
||||
dc.DrawText("Page: %d" % page, marginX/2, maxY-marginY)
|
||||
|
||||
return True
|
||||
|
||||
|
@ -30,11 +30,11 @@ class TestPanel( wx.Panel ):
|
||||
self.group1_ctrls.append((radio3, text3))
|
||||
|
||||
for radio, text in self.group1_ctrls:
|
||||
grid1.AddWindow( radio, 0, wx.ALIGN_CENTRE|wx.LEFT|wx.RIGHT|wx.TOP, 5 )
|
||||
grid1.AddWindow( text, 0, wx.ALIGN_CENTRE|wx.LEFT|wx.RIGHT|wx.TOP, 5 )
|
||||
grid1.Add( radio, 0, wx.ALIGN_CENTRE|wx.LEFT|wx.RIGHT|wx.TOP, 5 )
|
||||
grid1.Add( text, 0, wx.ALIGN_CENTRE|wx.LEFT|wx.RIGHT|wx.TOP, 5 )
|
||||
|
||||
box1.AddSizer( grid1, 0, wx.ALIGN_CENTRE|wx.ALL, 5 )
|
||||
vs.AddSizer( box1, 0, wx.ALIGN_CENTRE|wx.ALL, 5 )
|
||||
box1.Add( grid1, 0, wx.ALIGN_CENTRE|wx.ALL, 5 )
|
||||
vs.Add( box1, 0, wx.ALIGN_CENTRE|wx.ALL, 5 )
|
||||
|
||||
box2_title = wx.StaticBox( panel, -1, "Group 2" )
|
||||
box2 = wx.StaticBoxSizer( box2_title, wx.VERTICAL )
|
||||
@ -53,11 +53,11 @@ class TestPanel( wx.Panel ):
|
||||
self.group2_ctrls.append((radio6, text6))
|
||||
|
||||
for radio, text in self.group2_ctrls:
|
||||
grid2.AddWindow( radio, 0, wx.ALIGN_CENTRE|wx.LEFT|wx.RIGHT|wx.TOP, 5 )
|
||||
grid2.AddWindow( text, 0, wx.ALIGN_CENTRE|wx.LEFT|wx.RIGHT|wx.TOP, 5 )
|
||||
grid2.Add( radio, 0, wx.ALIGN_CENTRE|wx.LEFT|wx.RIGHT|wx.TOP, 5 )
|
||||
grid2.Add( text, 0, wx.ALIGN_CENTRE|wx.LEFT|wx.RIGHT|wx.TOP, 5 )
|
||||
|
||||
box2.AddSizer( grid2, 0, wx.ALIGN_CENTRE|wx.ALL, 5 )
|
||||
vs.AddSizer( box2, 0, wx.ALIGN_CENTRE|wx.ALL, 5 )
|
||||
box2.Add( grid2, 0, wx.ALIGN_CENTRE|wx.ALL, 5 )
|
||||
vs.Add( box2, 0, wx.ALIGN_CENTRE|wx.ALL, 5 )
|
||||
|
||||
panel.SetSizer( vs )
|
||||
vs.Fit( panel )
|
||||
|
@ -84,7 +84,7 @@ class TestPanel(scrolled.ScrolledPanel):
|
||||
vbox2.Add((20, 10))
|
||||
hbox.Add(vbox2)
|
||||
|
||||
vbox.AddSizer(hbox, 0)
|
||||
vbox.Add(hbox, 0)
|
||||
self.SetSizer(vbox)
|
||||
self.SetAutoLayout(1)
|
||||
self.SetupScrolling()
|
||||
|
@ -20,7 +20,7 @@ class MyCanvas(wx.ScrolledWindow):
|
||||
self.SetBackgroundColour("WHITE")
|
||||
self.SetCursor(wx.StockCursor(wx.CURSOR_PENCIL))
|
||||
bmp = images.getTest2Bitmap()
|
||||
mask = wx.MaskColour(bmp, wx.BLUE)
|
||||
mask = wx.Mask(bmp, wx.BLUE)
|
||||
bmp.SetMask(mask)
|
||||
self.bmp = bmp
|
||||
|
||||
@ -65,19 +65,19 @@ class MyCanvas(wx.ScrolledWindow):
|
||||
def DoDrawing(self, dc, printing=False):
|
||||
dc.BeginDrawing()
|
||||
dc.SetPen(wx.Pen('RED'))
|
||||
dc.DrawRectangle((5, 5), (50, 50))
|
||||
dc.DrawRectangle(5, 5, 50, 50)
|
||||
|
||||
dc.SetBrush(wx.LIGHT_GREY_BRUSH)
|
||||
dc.SetPen(wx.Pen('BLUE', 4))
|
||||
dc.DrawRectangle((15, 15), (50, 50))
|
||||
dc.DrawRectangle(15, 15, 50, 50)
|
||||
|
||||
dc.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.NORMAL))
|
||||
dc.SetTextForeground(wx.Colour(0xFF, 0x20, 0xFF))
|
||||
te = dc.GetTextExtent("Hello World")
|
||||
dc.DrawText("Hello World", (60, 65))
|
||||
dc.DrawText("Hello World", 60, 65)
|
||||
|
||||
dc.SetPen(wx.Pen('VIOLET', 4))
|
||||
dc.DrawLine((5, 65+te[1]), (60+te[0], 65+te[1]))
|
||||
dc.DrawLine(5, 65+te[1], 60+te[0], 65+te[1])
|
||||
|
||||
lst = [(100,110), (150,110), (150,160), (100,160)]
|
||||
dc.DrawLines(lst, -60)
|
||||
@ -86,13 +86,13 @@ class MyCanvas(wx.ScrolledWindow):
|
||||
dc.SetPen(wx.GREEN_PEN)
|
||||
dc.DrawSpline(lst+[(100,100)])
|
||||
|
||||
dc.DrawBitmap(self.bmp, (200, 20), True)
|
||||
dc.DrawBitmap(self.bmp, 200, 20, True)
|
||||
dc.SetTextForeground(wx.Colour(0, 0xFF, 0x80))
|
||||
dc.DrawText("a bitmap", (200, 85))
|
||||
dc.DrawText("a bitmap", 200, 85)
|
||||
|
||||
## dc.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.NORMAL))
|
||||
## dc.SetTextForeground("BLACK")
|
||||
## dc.DrawText("TEST this STRING", (10, 200))
|
||||
## dc.DrawText("TEST this STRING", 10, 200)
|
||||
## print dc.GetFullTextExtent("TEST this STRING")
|
||||
|
||||
font = wx.Font(20, wx.SWISS, wx.NORMAL, wx.NORMAL)
|
||||
@ -100,15 +100,15 @@ class MyCanvas(wx.ScrolledWindow):
|
||||
dc.SetTextForeground(wx.BLACK)
|
||||
|
||||
for a in range(0, 360, 45):
|
||||
dc.DrawRotatedText("Rotated text...", (300, 300), a)
|
||||
dc.DrawRotatedText("Rotated text...", 300, 300, a)
|
||||
|
||||
dc.SetPen(wx.TRANSPARENT_PEN)
|
||||
dc.SetBrush(wx.BLUE_BRUSH)
|
||||
dc.DrawRectangle((50,500),(50,50))
|
||||
dc.DrawRectangle((100,500),(50,50))
|
||||
dc.DrawRectangle(50,500, 50,50)
|
||||
dc.DrawRectangle(100,500, 50,50)
|
||||
|
||||
dc.SetPen(wx.Pen('RED'))
|
||||
dc.DrawEllipticArc((200, 500), (50, 75), 0, 90)
|
||||
dc.DrawEllipticArc(200,500, 50,75, 0, 90)
|
||||
|
||||
if not printing:
|
||||
# This has troubles when used on a print preview in wxGTK,
|
||||
@ -123,18 +123,18 @@ class MyCanvas(wx.ScrolledWindow):
|
||||
pen.SetDashes([1,2])
|
||||
pen.SetColour("RED")
|
||||
dc.SetPen(pen)
|
||||
dc.DrawLine((300, y), (400, y))
|
||||
dc.DrawLine(300,y, 400,y)
|
||||
y = y + 10
|
||||
|
||||
dc.SetBrush(wx.TRANSPARENT_BRUSH)
|
||||
dc.SetPen(wx.Pen(wx.Colour(0xFF, 0x20, 0xFF), 1, wx.SOLID))
|
||||
dc.DrawRectangle((450, 50), (100, 100))
|
||||
dc.DrawRectangle(450,50, 100,100)
|
||||
old_pen = dc.GetPen()
|
||||
new_pen = wx.Pen("BLACK", 5)
|
||||
dc.SetPen(new_pen)
|
||||
dc.DrawRectangle((470, 70), (60, 60))
|
||||
dc.DrawRectangle(470,70, 60,60)
|
||||
dc.SetPen(old_pen)
|
||||
dc.DrawRectangle((490, 90), (20, 20))
|
||||
dc.DrawRectangle(490,90, 20,20)
|
||||
|
||||
self.DrawSavedLines(dc)
|
||||
dc.EndDrawing()
|
||||
@ -178,9 +178,9 @@ class MyCanvas(wx.ScrolledWindow):
|
||||
|
||||
dc.BeginDrawing()
|
||||
dc.SetPen(wx.Pen('MEDIUM FOREST GREEN', 4))
|
||||
coords = [(self.x, self.y) , self.ConvertEventCoords(event)]
|
||||
coords = (self.x, self.y) + self.ConvertEventCoords(event)
|
||||
self.curLine.append(coords)
|
||||
apply(dc.DrawLine, coords)
|
||||
dc.DrawLine(*coords)
|
||||
self.SetXY(event)
|
||||
dc.EndDrawing()
|
||||
|
||||
|
@ -44,7 +44,7 @@ class TestFrame(wx.Frame):
|
||||
self.SetWindowShape()
|
||||
|
||||
dc = wx.ClientDC(self)
|
||||
dc.DrawBitmap(self.bmp, (0,0), True)
|
||||
dc.DrawBitmap(self.bmp, 0,0, True)
|
||||
|
||||
|
||||
def SetWindowShape(self, *evt):
|
||||
@ -63,7 +63,7 @@ class TestFrame(wx.Frame):
|
||||
|
||||
def OnPaint(self, evt):
|
||||
dc = wx.PaintDC(self)
|
||||
dc.DrawBitmap(self.bmp, (0,0), True)
|
||||
dc.DrawBitmap(self.bmp, 0,0, True)
|
||||
|
||||
def OnExit(self, evt):
|
||||
self.Close()
|
||||
|
@ -43,7 +43,7 @@ class SampleWindow(wx.PyWindow):
|
||||
dc = wx.PaintDC(self)
|
||||
w,h = dc.GetTextExtent(self.text)
|
||||
dc.Clear()
|
||||
dc.DrawText(self.text, ((sz.width-w)/2, (sz.height-h)/2))
|
||||
dc.DrawText(self.text, (sz.width-w)/2, (sz.height-h)/2)
|
||||
|
||||
def OnSize(self, evt):
|
||||
self.Refresh()
|
||||
|
@ -73,13 +73,13 @@ class TestValueWindow(gizmos.TreeCompanionWindow):
|
||||
|
||||
dc.SetPen(pen)
|
||||
dc.SetBrush(wx.Brush(self.GetBackgroundColour(), wx.SOLID))
|
||||
dc.DrawRectangle((rect.x, rect.y), (rect.width+1, rect.height+1))
|
||||
dc.DrawRectangle(rect.x, rect.y, rect.width+1, rect.height+1)
|
||||
dc.SetTextForeground("BLACK")
|
||||
dc.SetBackgroundMode(wx.TRANSPARENT)
|
||||
tw, th = dc.GetTextExtent(text)
|
||||
x = 5
|
||||
y = rect.y + max(0, (rect.height - th) / 2)
|
||||
dc.DrawText(text, (x, y))
|
||||
dc.DrawText(text, x, y)
|
||||
|
||||
|
||||
|
||||
|
@ -13,7 +13,7 @@ class TestPanel(wx.Panel):
|
||||
wx.StaticText(self, -1, "This is a wx.StaticBitmap.", (45, 15))
|
||||
|
||||
bmp = images.getTest2Bitmap()
|
||||
mask = wx.MaskColour(bmp, wx.BLUE)
|
||||
mask = wx.Mask(bmp, wx.BLUE)
|
||||
bmp.SetMask(mask)
|
||||
wx.StaticBitmap(self, -1, bmp, (80, 50), (bmp.GetWidth(), bmp.GetHeight()))
|
||||
|
||||
|
@ -1,35 +1,43 @@
|
||||
|
||||
import wx
|
||||
|
||||
|
||||
USE_GENERIC = 0
|
||||
if USE_GENERIC:
|
||||
from wx.lib.stattext import GenStaticText as StaticText
|
||||
else:
|
||||
StaticText = wx.StaticText
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class TestPanel(wx.Panel):
|
||||
def __init__(self, parent):
|
||||
wx.Panel.__init__(self, parent, -1)
|
||||
|
||||
wx.StaticText(self, -1, "This is an example of static text", (20, 10))
|
||||
wx.StaticText(self, -1, "using the wx.StaticText Control.", (20, 30))
|
||||
StaticText(self, -1, "This is an example of static text", (20, 10))
|
||||
StaticText(self, -1, "using the wx.StaticText Control.", (20, 30))
|
||||
|
||||
wx.StaticText(
|
||||
StaticText(
|
||||
self, -1, "Is this yellow?", (20, 70), (90, -1)
|
||||
).SetBackgroundColour('Yellow')
|
||||
|
||||
wx.StaticText(
|
||||
StaticText(
|
||||
self, -1, "align center", (120, 70), (90, -1), wx.ALIGN_CENTER
|
||||
).SetBackgroundColour('Yellow')
|
||||
|
||||
wx.StaticText(
|
||||
StaticText(
|
||||
self, -1, "align right", (220, 70), (90, -1), wx.ALIGN_RIGHT
|
||||
).SetBackgroundColour('Yellow')
|
||||
|
||||
str = "This is a different font."
|
||||
text = wx.StaticText(self, -1, str, (20, 100))
|
||||
text = StaticText(self, -1, str, (20, 100))
|
||||
font = wx.Font(18, wx.SWISS, wx.NORMAL, wx.NORMAL)
|
||||
text.SetFont(font)
|
||||
text.SetSize(text.GetBestSize())
|
||||
|
||||
wx.StaticText(self, -1, "Multi-line wx.StaticText\nline 2\nline 3\n\nafter empty line", (20,150))
|
||||
wx.StaticText(self, -1, "Align right multi-line\nline 2\nline 3\n\nafter empty line", (220,150), style=wx.ALIGN_RIGHT)
|
||||
StaticText(self, -1, "Multi-line wx.StaticText\nline 2\nline 3\n\nafter empty line", (20,150))
|
||||
StaticText(self, -1, "Align right multi-line\nline 2\nline 3\n\nafter empty line", (220,150), style=wx.ALIGN_RIGHT)
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
@ -97,18 +97,18 @@ class GraphWindow(wx.Window):
|
||||
dc.SetBackground(wx.Brush(self.GetBackgroundColour()))
|
||||
dc.Clear()
|
||||
dc.SetPen(wx.Pen(wx.BLACK, 3, wx.SOLID))
|
||||
dc.DrawLine((self.linePos, 0), (self.linePos, size.height-10))
|
||||
dc.DrawLine(self.linePos, 0, self.linePos, size.height-10)
|
||||
|
||||
bh = ypos = self.barHeight
|
||||
for x in range(len(self.values)):
|
||||
label, val = self.values[x]
|
||||
dc.DrawText(label, (5, ypos))
|
||||
dc.DrawText(label, 5, ypos)
|
||||
|
||||
if val:
|
||||
color = self.colors[ x % len(self.colors) ]
|
||||
dc.SetPen(wx.Pen(color))
|
||||
dc.SetBrush(wx.Brush(color))
|
||||
dc.DrawRectangle((self.linePos+3, ypos), (val, bh))
|
||||
dc.DrawRectangle(self.linePos+3, ypos, val, bh)
|
||||
|
||||
ypos = ypos + 2*bh
|
||||
if ypos > size[1]-10:
|
||||
@ -127,7 +127,7 @@ class GraphWindow(wx.Window):
|
||||
|
||||
wdc = wx.PaintDC(self)
|
||||
wdc.BeginDrawing()
|
||||
wdc.Blit((0,0), size, dc, (0,0))
|
||||
wdc.Blit(0,0, size[0], size[1], dc, 0,0)
|
||||
wdc.EndDrawing()
|
||||
|
||||
dc.SelectObject(wx.NullBitmap)
|
||||
|
@ -117,6 +117,7 @@ command_lines = [
|
||||
]
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
for line in command_lines:
|
||||
args = line.split()
|
||||
img2py.main(args)
|
||||
|
@ -13,15 +13,19 @@ the new best size, instead the minsize that the window had when added
|
||||
to the sizer (or the size the window was created with) will always be
|
||||
used. When a window is added to a sizer it's initial size, if any, is
|
||||
set as the window's minimal size using SetSizeHints if there isn't
|
||||
already a minimal size.
|
||||
|
||||
Added some convenience methods to wx.Bitmap: SetSize, GetSize, and
|
||||
wx.EmptyBitmap can be called with a wx.Size (or a 2-element sequence)
|
||||
object too. Similar changes were done for wx.Image as well.
|
||||
already a minimal size. You can set the window's minimal size (via
|
||||
SetSizeHints) to manually control wha tthe sizer will use when
|
||||
calculating layout.
|
||||
|
||||
Added new MaskedEditControl code from Will Sadkin. The modules are
|
||||
now locaed in their own sub-package, wx.lib.masked. Demos updated.
|
||||
|
||||
The changes that implemented the incompatible wx.DC methods in 2.5.1.5
|
||||
have been reverted. The wx.DC methods are now compatible with the 2.4
|
||||
implemetation. In addition a set of renamed methods have been added
|
||||
that take wx.Point and/or wx.Size objects instead of individual
|
||||
parameters.
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -62,26 +62,28 @@ customizations added that I hope to get folded back into the main SWIG
|
||||
distribution.) This has some far reaching ramifications:
|
||||
|
||||
All classes derive from object and so all are now "new-style
|
||||
classes"
|
||||
classes." This also allows you to use mixin classes that are
|
||||
new-style and to use properties, staticmethod, etc.
|
||||
|
||||
Public data members of the C++ classes are wrapped as Python
|
||||
properties using property() instead of using __getattr__/__setattr__
|
||||
like before. Normally you shouldn't notice any difference, but if
|
||||
you were previously doing something with __getattr__/__setattr__
|
||||
in derived classes then you may have to adjust things.
|
||||
properties using property() instead of using
|
||||
__getattr__/__setattr__ hacks like before. Normally you shouldn't
|
||||
notice any difference, but if you were previously doing something
|
||||
with __getattr__/__setattr__ in derived classes then you may have
|
||||
to adjust things.
|
||||
|
||||
Static C++ methods are wrapped using the staticmethod()
|
||||
feature of Python and so are accessible as ClassName.MethodName
|
||||
as expected. They are still available as top level functions
|
||||
Static C++ methods are wrapped using the staticmethod() feature of
|
||||
Python and so are accessible as ClassName.MethodName as expected.
|
||||
They are still also available as top level functions named like
|
||||
ClassName_MethodName as before.
|
||||
|
||||
The relationship between the wxFoo and wxFooPtr classes have
|
||||
changed for the better. Specifically, all instances that you see
|
||||
will be wxFoo even if they are created internally using wxFooPtr,
|
||||
because wxFooPtr.__init__ will change the instance's __class__ as
|
||||
will be wx.Foo even if they are created internally using wx.FooPtr,
|
||||
because wx.FooPtr.__init__ will change the instance's __class__ as
|
||||
part of the initialization. If you have any code that checks
|
||||
class type using something like isinstance(obj, wxFooPtr) you will
|
||||
need to change it to isinstance(obj, wxFoo).
|
||||
class type using something like isinstance(obj, wx.FooPtr) you will
|
||||
need to change it to isinstance(obj, wx.Foo).
|
||||
|
||||
|
||||
|
||||
@ -152,7 +154,7 @@ values::
|
||||
|
||||
If you create your own custom event types and EVT_* functions, and you
|
||||
want to be able to use them with the Bind method above then you should
|
||||
change your EVT_* to be an instance of wxPyEventBinder instead of a
|
||||
change your EVT_* to be an instance of wx.PyEventBinder instead of a
|
||||
function. For example, if you used to have something like this::
|
||||
|
||||
myCustomEventType = wxNewEventType()
|
||||
@ -168,6 +170,15 @@ Change it like so::
|
||||
The second parameter is an integer in [0, 1, 2] that specifies the
|
||||
number of IDs that are needed to be passed to Connect.
|
||||
|
||||
**[Changed in 2.5.1.6]** There is also an Unbind method added to
|
||||
wx.EvtHandler that can be used to disconenct event handlers. It looks
|
||||
like this::
|
||||
|
||||
def Unbind(self, event, source=None, id=wx.ID_ANY, id2=wx.ID_ANY):
|
||||
"""
|
||||
Disconencts the event handler binding for event from self.
|
||||
Returns True if successful.
|
||||
"""
|
||||
|
||||
|
||||
|
||||
@ -184,12 +195,13 @@ Instead of dynamically changing the names at module load time like in
|
||||
2.4, the compatibility modules are generated at build time and contain
|
||||
assignment statements like this::
|
||||
|
||||
wxWindow = wx.core.Window
|
||||
wxWindow = wx._core.Window
|
||||
|
||||
Don't let the "core" in the name bother you. That and some other
|
||||
Don't let the "_core" in the name bother you. That and some other
|
||||
modules are implementation details, and everything that was in the
|
||||
wxPython.wx module before will still be in the wx package namespace
|
||||
after this change. So from your code you would use it as wx.Window.
|
||||
after this change. So from your code you would use it as wx.Window or
|
||||
wxWindow if you import from the wxPython.wx module.
|
||||
|
||||
A few notes about how all of this was accomplished might be
|
||||
interesting... SWIG is now run twice for each module that it is
|
||||
@ -239,125 +251,79 @@ just fine.
|
||||
New wx.DC Methods
|
||||
-----------------
|
||||
|
||||
Many of the Draw methods of wx.DC have alternate forms in C++ that take
|
||||
wxPoint or wxSize parameters (let's call these *Type A*) instead of
|
||||
the individual x, y, width, height, etc. parameters (and we'll call
|
||||
these *Type B*). In the rest of the library I normally made the *Type
|
||||
A* forms of the methods be the default method with the "normal" name,
|
||||
and had renamed the *Type B* forms of the methods to some similar
|
||||
name. For example in wx.Window we have these Python methods::
|
||||
|
||||
SetSize(size) # Type A
|
||||
SetSizeWH(width, height) # Type B
|
||||
**[Changed in 2.5.1.6]** In wxPython 2.5.1.5 there was a new
|
||||
implementation of the wx.DC Draw and other methods that broke
|
||||
backwards compatibility in the name of consistency. That change has
|
||||
been reverted and the wx.DC Draw methods with 2.4 compatible
|
||||
signatures have been restored. In addition a new set of methods have
|
||||
been added that take wx.Point and/or wx.Size parameters instead of
|
||||
separate integer parameters. The Draw and etc. methods now available
|
||||
are::
|
||||
|
||||
|
||||
For various reasons the new *Type A* methods in wx.DC were never added
|
||||
and the existing *Type B* methods were never renamed. Now that lots
|
||||
of other things are also changing in wxPython it has been decided that
|
||||
it is a good time to also do the method renaming in wx.DC too in order
|
||||
to be consistent with the rest of the library. The methods in wx.DC
|
||||
that are affected are listed here::
|
||||
FloodFill(x, y, colour, style = wx.FLOOD_SURFACE)
|
||||
FoodFillPoint(pt, colour, style = wx.FLOOD_SURFACE)
|
||||
|
||||
FloodFillXY(x, y, colour, style = wx.FLOOD_SURFACE)
|
||||
FloodFill(point, colour, style = wx.FLOOD_SURFACE)
|
||||
GetPixel(x,y)
|
||||
GetPixelPoint(pt)
|
||||
|
||||
GetPixelXY(x, y)
|
||||
GetPixel(point)
|
||||
DrawLine(x1, y1, x2, y2)
|
||||
DrawLinePoint(pt1, pt2)
|
||||
|
||||
DrawLineXY(x1, y1, x2, y2)
|
||||
DrawLine(point1, point2)
|
||||
CrossHair(x, y)
|
||||
CrossHairPoint(pt)
|
||||
|
||||
CrossHairXY(x, y)
|
||||
CrossHair(point)
|
||||
DrawArc(x1, y1, x2, y2, xc, yc)
|
||||
DrawArcPoint(pt1, pt2, centre)
|
||||
|
||||
DrawArcXY(x1, y1, x2, y2, xc, yc)
|
||||
DrawArc(point1, point2, center)
|
||||
DrawCheckMark(x, y, width, height)
|
||||
DrawCheckMarkRect(rect)
|
||||
|
||||
DrawCheckMarkXY(x, y, width, height)
|
||||
DrawCheckMark(rect)
|
||||
DrawEllipticArc(x, y, w, h, sa, ea)
|
||||
DrawEllipticArcPointSize(pt, sz, sa, ea)
|
||||
|
||||
DrawEllipticArcXY(x, y, w, h, start_angle, end_angle)
|
||||
DrawEllipticArc(point, size, start_angle, end_angle)
|
||||
DrawPoint(x, y)
|
||||
DrawPointPoint(pt)
|
||||
|
||||
DrawPointXY(x, y)
|
||||
DrawPoint(point)
|
||||
|
||||
DrawRectangleXY(x, y, width, height)
|
||||
DrawRectangle(point, size)
|
||||
DrawRectangle(x, y, width, height)
|
||||
DrawRectangleRect(rect)
|
||||
DrawRectanglePointSize(pt, sz)
|
||||
|
||||
DrawRoundedRectangleXY(x, y, width, height, radius)
|
||||
DrawRoundedRectangle(point, size, radius)
|
||||
DrawRoundedRectangleRect(rect, radius)
|
||||
DrawRoundedRectangle(x, y, width, height, radius)
|
||||
DrawRoundedRectangleRect(r, radius)
|
||||
DrawRoundedRectanglePointSize(pt, sz, radius)
|
||||
|
||||
DrawCircleXY(x, y, radius)
|
||||
DrawCircle(point, radius)
|
||||
DrawCircle(x, y, radius)
|
||||
DrawCirclePoint(pt, radius)
|
||||
|
||||
DrawEllipseXY(x, y, width, height)
|
||||
DrawEllipse(point, size)
|
||||
DrawEllipse(x, y, width, height)
|
||||
DrawEllipseRect(rect)
|
||||
DrawEllipsePointSize(pt, sz)
|
||||
|
||||
DrawIconXY(icon, x, y)
|
||||
DrawIcon(icon, point)
|
||||
DrawIcon(icon, x, y)
|
||||
DrawIconPoint(icon, pt)
|
||||
|
||||
DrawBitmapXY(bmp, x, y, useMask = FALSE)
|
||||
DrawBitmap(bmp, point, useMask = FALSE)
|
||||
DrawBitmap(bmp, x, y, useMask = False)
|
||||
DrawBitmapPoint(bmp, pt, useMask = False)
|
||||
|
||||
DrawTextXY(text, x, y)
|
||||
DrawText(text, point)
|
||||
DrawText(text, x, y)
|
||||
DrawTextPoint(text, pt)
|
||||
|
||||
DrawRotatedTextXY(text, x, y, angle)
|
||||
DrawRotatedText(text, point, angle)
|
||||
DrawRotatedText(text, x, y, angle)
|
||||
DrawRotatedTextPoint(text, pt, angle)
|
||||
|
||||
bool Blit(xdest, ydest, width, height, sourceDC, xsrc, ysrc,
|
||||
rop = wx.COPY, useMask = False, xsrcMask = -1, ysrcMask = -1)
|
||||
BlitPointSize(destPt, sz, sourceDC, srcPt, rop = wx.COPY,
|
||||
useMask = False, srcPtMask = wxDefaultPosition)
|
||||
|
||||
|
||||
BlitXY(xdest, ydest, width, height, sourceDC, xsrc, ysrc,
|
||||
rop = wxCOPY, useMask = FALSE, xsrcMask = -1, ysrcMask = -1)
|
||||
Blit(destPt, size, sourceDC, srcPt,
|
||||
rop = wxCOPY, useMask = FALSE, srcPtMask = wx.DefaultPosition)
|
||||
|
||||
SetClippingRegionXY(x, y, width, height)
|
||||
SetClippingRegion(point, size)
|
||||
SetClippingRegion(x, y, width, height)
|
||||
SetClippingRegionPointSize(pt, sz)
|
||||
SetClippingRegionAsRegion(region)
|
||||
SetClippingRect(rect)
|
||||
SetClippingRegionAsRegion(region);
|
||||
|
||||
|
||||
If you have code that draws on a DC and you are using the new wx
|
||||
namespace then you **will** get errors because of these changes, but
|
||||
it should be easy to fix the code. You can either change the name of
|
||||
the *Type B* method called to the names shown above, or just add
|
||||
parentheses around the parameters as needed to turn them into tuples
|
||||
and let the SWIG typemaps turn them into the wx.Point or wx.Size
|
||||
object that is expected. Then you will be calling the new *Type A*
|
||||
method. For example, if you had this code before::
|
||||
|
||||
dc.DrawRectangle(x, y, width, height)
|
||||
|
||||
You could either continue to use the *Type B* method by changing the
|
||||
name to DrawRectangleXY, or just change it to the new *Type A* by
|
||||
adding some parentheses like this::
|
||||
|
||||
dc.DrawRectangle((x, y), (width, height))
|
||||
|
||||
Or if you were already using a point and size like this::
|
||||
|
||||
dc.DrawRectangle(p.x, p.y, s.width, s.height)
|
||||
|
||||
Then you can just simplify it like this::
|
||||
|
||||
dc.DrawRectangle(p, s)
|
||||
|
||||
Now before you start yelling and screaming at me for breaking all your
|
||||
code, take note that up above I said, "...using the new wx
|
||||
namespace..." That's because if you are still importing from
|
||||
wxPython.wx then there are some classes defined there with Draw and
|
||||
etc. methods that have 2.4 compatible signatures. Unfortunately there
|
||||
is one exception to this behaviour. If a DC is returned from a
|
||||
function or method then an instance of the new class (with the new
|
||||
methods described above) will be returned instead of the compatibility
|
||||
class. If/When the old wxPython.wx namespace is removed then these
|
||||
compatibility classes will be removed too so you should plan on
|
||||
migrating to the new namespace and new DC Draw methods before that
|
||||
time.
|
||||
|
||||
|
||||
|
||||
@ -432,15 +398,18 @@ Sizers
|
||||
|
||||
The hack allowing the old "option" keyword parameter has been removed.
|
||||
If you use keyword args with w.xSizer Add, Insert, or Prepend methods
|
||||
then you will need to use the ``proportion`` name instead of ``option``.
|
||||
then you will need to use the ``proportion`` name instead of
|
||||
``option``. (The ``proportion`` keyword was also allowed in 2.4.2.4.)
|
||||
|
||||
When adding a spacer to a sizer you now need to use a wx.Size or a
|
||||
2-integer sequence instead of separate width and height parameters.
|
||||
This allows for more consistency in how you add the various types of
|
||||
items to a sizer. The first parameter defines the item (instead of
|
||||
the possibily first two, depending on if you are doing a spacer or
|
||||
not,) and that item can either be a window, a sizer or a spacer (which
|
||||
can be a sequence or a wx.Size.)
|
||||
This was optionally allowed in 2.4, but now it is required. This
|
||||
allows for more consistency in how you add the various types of items
|
||||
to a sizer. The first parameter defines the item (instead of the
|
||||
possibily first two, depending on if you are doing a spacer or not,)
|
||||
and that item can either be a window, a sizer or a spacer (which can
|
||||
be a sequence or a wx.Size.) Removing the option for separate width
|
||||
and height parameters greatly simplified the wrapper code.
|
||||
|
||||
The wx.GridBagSizer class (very similar to the RowColSizer in the
|
||||
library) has been added to C++ and wrapped for wxPython. It can also
|
||||
@ -448,7 +417,9 @@ be used from XRC.
|
||||
|
||||
You should not use AddWindow, AddSizer, AddSpacer (and similar for
|
||||
Insert, Prepend, and etc.) methods any longer. Just use Add and the
|
||||
wrappers will figure out what to do.
|
||||
wrappers will figure out what to do. **[Changed in 2.5.1.6]**
|
||||
AddWindow, AddSize, AddSpacer and etc. will now issue a
|
||||
DeprecationWarning.
|
||||
|
||||
**[Changed in 2.5.1.6]** wx.ADJUST_MINSIZE is now the default
|
||||
behaviour for window items in sizers. This means that the item's
|
||||
@ -459,7 +430,11 @@ call window methods to determine the new best size, instead the
|
||||
minsize that the window had when added to the sizer (or the size the
|
||||
window was created with) will always be used. When a window is added
|
||||
to a sizer it's initial size, if any, is set as the window's minimal
|
||||
size using SetSizeHints if there isn't already a minimal size.
|
||||
size using SetSizeHints if there isn't already a minimal size. If you
|
||||
would like the sizer to use something other than the window's initial
|
||||
size as the minimum then you can give it a new minimum by calling its
|
||||
SetSizeHints method.
|
||||
|
||||
|
||||
|
||||
PlatformInfo
|
||||
@ -635,8 +610,8 @@ no longer exist:
|
||||
* windows3
|
||||
|
||||
They have been replaced by the following, but please remember that
|
||||
these are just "implementation details" and you shoudl reall be using
|
||||
the objects in these modules via the wx or wxPython.wx packages:
|
||||
these are just "implementation details" and you should really be using
|
||||
the objects in these modules only via the wx or wxPython.wx packages:
|
||||
|
||||
* _core
|
||||
* _gdi
|
||||
@ -667,8 +642,9 @@ FALSE that used to be provided with wxPython.
|
||||
Use None instead of the ancient and should have been removed a long
|
||||
time ago wx.NULL alias.
|
||||
|
||||
wx.TreeCtrl no longer needs to be passed the cookie variable as the
|
||||
2nd parameter. It still returns it though, for use with GetNextChild.
|
||||
wx.TreeCtrl.GetFirstChild no longer needs to be passed the cookie
|
||||
variable as the 2nd parameter. It still returns it though, for use
|
||||
with GetNextChild.
|
||||
|
||||
The wx.NO_FULL_REPAINT_ON_RESIZE style is now the default style for
|
||||
all windows. The name still exists for compatibility, but it is set
|
||||
@ -687,15 +663,15 @@ there are compatibility aliases for much of the above items.
|
||||
The wxWave class has been renamed to wxSound, and now has a slightly
|
||||
different API.
|
||||
|
||||
wx.TaskbarIcon works on wxGTK-based platforms now, however you have to
|
||||
manage it a little bit more than you did before. Basically, the app
|
||||
will treat it like a top-level frame in that if the wx.TaskBarIcon
|
||||
still exists when all the frames are closed then the app will still
|
||||
not exit. You need to ensure that the wx.TaskBarIcon is destroyed
|
||||
when your last Frame is closed. For wxPython apps it is usually
|
||||
enough if your main frame object holds the only reference to the
|
||||
wx.TaskBarIcon, then when the frame is closed Python reference
|
||||
counting takes care of the rest.
|
||||
wx.TaskbarIcon works on wxGTK-based platforms (for some window
|
||||
managers,) however you have to manage it a little bit more than you
|
||||
did before. Basically, the app will treat it like a top-level frame
|
||||
in that if the wx.TaskBarIcon still exists when all the frames are
|
||||
closed then the app will still not exit. You need to ensure that the
|
||||
wx.TaskBarIcon is destroyed when your last Frame is closed. For
|
||||
wxPython apps it is usually enough if your main frame object holds the
|
||||
only reference to the wx.TaskBarIcon, then when the frame is closed
|
||||
Python reference counting takes care of the rest.
|
||||
|
||||
Before Python 2.3 it was possible to pass a floating point object as a
|
||||
parameter to a function that expected an integer, and the
|
||||
@ -703,7 +679,7 @@ PyArg_ParseTuple family of functions would automatically convert to
|
||||
integer by truncating the fractional portion of the number. With
|
||||
Python 2.3 that behavior was deprecated and a deprecation warning is
|
||||
raised when you pass a floating point value, (for example, calling
|
||||
wx.DC.DrawLineXY with floats for the position and size,) and lots of
|
||||
wx.DC.DrawLine with floats for the position and size,) and lots of
|
||||
developers using wxPython had to scramble to change their code to call
|
||||
int() before calling wxPython methods. Recent changes in SWIG have
|
||||
moved the conversion out of PyArg_ParseTuple to custom code that SWIG
|
||||
@ -722,3 +698,7 @@ parameters that expect floating point values.
|
||||
to their own sub-package, wx.lib.masked. See the docstrings and demo
|
||||
for changes in capabilities, usage, etc.
|
||||
|
||||
**[Changed in 2.5.1.6]** wx.MaskColour constructor has been deprecated
|
||||
and will raise a DeprecationWarning if used. The main wx.Mask
|
||||
constructor has been modified to be compatible with wx.MaskColour so
|
||||
you should use it instead.
|
||||
|
@ -1,19 +1,6 @@
|
||||
# Other names that need to be reverse-renamed for the old namespace
|
||||
|
||||
|
||||
DC_old
|
||||
MemoryDC_old
|
||||
BufferedDC_old
|
||||
BufferedPaintDC_old
|
||||
ScreenDC_old
|
||||
ClientDC_old
|
||||
PaintDC_old
|
||||
WindowDC_old
|
||||
MirrorDC_old
|
||||
PostScriptDC_old
|
||||
MetaFileDC_old
|
||||
PrinterDC_old
|
||||
|
||||
MaskColour
|
||||
|
||||
|
||||
|
@ -78,40 +78,45 @@ class App(wx.PyApp):
|
||||
|
||||
Every application must have a ``wx.App`` instance, and all
|
||||
creation of UI objects should be delayed until after the
|
||||
``wx.App`` object has been created in order to ensure that the
|
||||
gui platform and wxWidgets have been fully initialized.
|
||||
``wx.App`` object has been created in order to ensure that the gui
|
||||
platform and wxWidgets have been fully initialized.
|
||||
|
||||
Normally you would derive from this class and implement an
|
||||
``OnInit`` method that creates a frame and then calls
|
||||
``self.SetTopWindow(frame)``.
|
||||
|
||||
:see: `wx.PySimpleApp` for a simpler app class that can be used directly.
|
||||
:see: `wx.PySimpleApp` for a simpler app class that can be used
|
||||
directly.
|
||||
"""
|
||||
|
||||
outputWindowClass = PyOnDemandOutputWindow
|
||||
|
||||
def __init__(self, redirect=_defRedirect, filename=None, useBestVisual=False):
|
||||
def __init__(self, redirect=_defRedirect, filename=None,
|
||||
useBestVisual=False, clearSigInt=True):
|
||||
"""
|
||||
Construct a ``wx.App`` object.
|
||||
|
||||
:param redirect: Should ``sys.stdout`` and ``sys.stderr``
|
||||
be redirected? Defaults to True on Windows and Mac,
|
||||
False otherwise. If `filename` is None then output
|
||||
will be redirected to a window that pops up as
|
||||
needed. (You can control what kind of window is
|
||||
created for the output by resetting the class
|
||||
variable ``outputWindowClass`` to a class of your
|
||||
choosing.)
|
||||
:param redirect: Should ``sys.stdout`` and ``sys.stderr`` be
|
||||
redirected? Defaults to True on Windows and Mac, False
|
||||
otherwise. If `filename` is None then output will be
|
||||
redirected to a window that pops up as needed. (You can
|
||||
control what kind of window is created for the output by
|
||||
resetting the class variable ``outputWindowClass`` to a
|
||||
class of your choosing.)
|
||||
|
||||
:param filename: The name of a file to redirect output
|
||||
to, if redirect is True.
|
||||
:param filename: The name of a file to redirect output to, if
|
||||
redirect is True.
|
||||
|
||||
:param useBestVisual: Should the app try to use the best
|
||||
available visual provided by the system (only
|
||||
relevant on systems that have more than one visual.)
|
||||
This parameter must be used instead of calling
|
||||
`SetUseBestVisual` later on because it must be set
|
||||
before the underlying GUI toolkit is initialized.
|
||||
available visual provided by the system (only relevant on
|
||||
systems that have more than one visual.) This parameter
|
||||
must be used instead of calling `SetUseBestVisual` later
|
||||
on because it must be set before the underlying GUI
|
||||
toolkit is initialized.
|
||||
|
||||
:param clearSigInt: Should SIGINT be cleared? This allows the
|
||||
app to terminate upon a Ctrl-C in the console like other
|
||||
GUI apps will.
|
||||
|
||||
:note: You should override OnInit to do applicaition
|
||||
initialization to ensure that the system, toolkit and
|
||||
@ -140,6 +145,7 @@ your Mac."""
|
||||
# KeyboardInterrupt???) but will later segfault on exit. By
|
||||
# setting the default handler then the app will exit, as
|
||||
# expected (depending on platform.)
|
||||
if clearSigInt:
|
||||
try:
|
||||
import signal
|
||||
signal.signal(signal.SIGINT, signal.SIG_DFL)
|
||||
@ -220,11 +226,12 @@ class PySimpleApp(wx.App):
|
||||
:see: `wx.App`
|
||||
"""
|
||||
|
||||
def __init__(self, redirect=False, filename=None, useBestVisual=False):
|
||||
def __init__(self, redirect=False, filename=None,
|
||||
useBestVisual=False, clearSigInt=True):
|
||||
"""
|
||||
:see: `wx.App.__init__`
|
||||
"""
|
||||
wx.App.__init__(self, redirect, filename, useBestVisual)
|
||||
wx.App.__init__(self, redirect, filename, useBestVisual, clearSigInt)
|
||||
|
||||
def OnInit(self):
|
||||
wx.InitAllImageHandlers()
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
|
||||
|
||||
|
||||
#if defined(wxUSE_DC_OLD_METHODS)
|
||||
#if 1 // The < 2.4 and > 2.5.1.5 way
|
||||
|
||||
bool FloodFill(wxCoord x, wxCoord y, const wxColour& col, int style = wxFLOOD_SURFACE);
|
||||
%name(FloodFillPoint) bool FloodFill(const wxPoint& pt, const wxColour& col, int style = wxFLOOD_SURFACE);
|
||||
@ -85,25 +85,25 @@ public:
|
||||
%name(DrawCheckMarkRect) void DrawCheckMark(const wxRect& rect);
|
||||
|
||||
void DrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, double sa, double ea);
|
||||
%name(DrawEllipticArcPtSz) void DrawEllipticArc(const wxPoint& pt, const wxSize& sz, double sa, double ea);
|
||||
%name(DrawEllipticArcPointSize) void DrawEllipticArc(const wxPoint& pt, const wxSize& sz, double sa, double ea);
|
||||
|
||||
void DrawPoint(wxCoord x, wxCoord y);
|
||||
%name(DrawPointPoint) void DrawPoint(const wxPoint& pt);
|
||||
|
||||
void DrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
|
||||
%name(DrawRectangleRect)void DrawRectangle(const wxRect& rect);
|
||||
%name(DrawRectanglePtSz) void DrawRectangle(const wxPoint& pt, const wxSize& sz);
|
||||
%name(DrawRectanglePointSize) void DrawRectangle(const wxPoint& pt, const wxSize& sz);
|
||||
|
||||
void DrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius);
|
||||
%name(DrawRoundedRectangleRect) void DrawRoundedRectangle(const wxRect& r, double radius);
|
||||
%name(DrawRoundedRectanglePtSz) void DrawRoundedRectangle(const wxPoint& pt, const wxSize& sz, double radius);
|
||||
%name(DrawRoundedRectanglePointSize) void DrawRoundedRectangle(const wxPoint& pt, const wxSize& sz, double radius);
|
||||
|
||||
void DrawCircle(wxCoord x, wxCoord y, wxCoord radius);
|
||||
%name(DrawCirclePoint) void DrawCircle(const wxPoint& pt, wxCoord radius);
|
||||
|
||||
void DrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
|
||||
%name(DrawEllipseRect) void DrawEllipse(const wxRect& rect);
|
||||
%name(DrawEllipsePtSz) void DrawEllipse(const wxPoint& pt, const wxSize& sz);
|
||||
%name(DrawEllipsePointSize) void DrawEllipse(const wxPoint& pt, const wxSize& sz);
|
||||
|
||||
void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y);
|
||||
%name(DrawIconPoint) void DrawIcon(const wxIcon& icon, const wxPoint& pt);
|
||||
@ -121,14 +121,18 @@ public:
|
||||
wxDC *source, wxCoord xsrc, wxCoord ysrc,
|
||||
int rop = wxCOPY, bool useMask = False,
|
||||
wxCoord xsrcMask = -1, wxCoord ysrcMask = -1);
|
||||
%name(BlitPtSz) bool Blit(const wxPoint& destPt, const wxSize& sz,
|
||||
%name(BlitPointSize) bool Blit(const wxPoint& destPt, const wxSize& sz,
|
||||
wxDC *source, const wxPoint& srcPt,
|
||||
int rop = wxCOPY, bool useMask = False,
|
||||
const wxPoint& srcPtMask = wxDefaultPosition);
|
||||
|
||||
|
||||
void SetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
|
||||
%name(SetClippingRegionPointSize) void SetClippingRegion(const wxPoint& pt, const wxSize& sz);
|
||||
%name(SetClippingRegionAsRegion) void SetClippingRegion(const wxRegion& region);
|
||||
%name(SetClippingRect) void SetClippingRegion(const wxRect& rect);
|
||||
|
||||
#else // The new way
|
||||
#else // The doomed 2.5.1.5
|
||||
|
||||
%name(FloodFillXY) bool FloodFill(wxCoord x, wxCoord y, const wxColour& col, int style = wxFLOOD_SURFACE);
|
||||
bool FloodFill(const wxPoint& pt, const wxColour& col, int style = wxFLOOD_SURFACE);
|
||||
@ -203,6 +207,12 @@ public:
|
||||
int rop = wxCOPY, bool useMask = False,
|
||||
const wxPoint& srcPtMask = wxDefaultPosition);
|
||||
|
||||
|
||||
%name(SetClippingRegionXY)void SetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
|
||||
void SetClippingRegion(const wxPoint& pt, const wxSize& sz);
|
||||
%name(SetClippingRect) void SetClippingRegion(const wxRect& rect);
|
||||
%name(SetClippingRegionAsRegion) void SetClippingRegion(const wxRegion& region);
|
||||
|
||||
#endif
|
||||
|
||||
void DrawLines(int points, wxPoint* points_array, wxCoord xoffset = 0, wxCoord yoffset = 0);
|
||||
@ -266,14 +276,6 @@ public:
|
||||
virtual void SetPalette(const wxPalette& palette);
|
||||
|
||||
|
||||
// clipping region
|
||||
// ---------------
|
||||
|
||||
%name(SetClippingRegionXY)void SetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
|
||||
void SetClippingRegion(const wxPoint& pt, const wxSize& sz);
|
||||
%name(SetClippingRect) void SetClippingRegion(const wxRect& rect);
|
||||
%name(SetClippingRegionAsRegion) void SetClippingRegion(const wxRegion& region);
|
||||
|
||||
virtual void DestroyClippingRegion();
|
||||
|
||||
DocDeclA(
|
||||
@ -417,6 +419,11 @@ public:
|
||||
GetLogicalOriginTuple);
|
||||
|
||||
virtual void SetLogicalOrigin(wxCoord x, wxCoord y);
|
||||
%extend {
|
||||
void SetLogicalOriginPoint(const wxPoint& point) {
|
||||
self->SetLogicalOrigin(point.x, point.y);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
wxPoint GetDeviceOrigin() const;
|
||||
@ -426,6 +433,11 @@ public:
|
||||
GetDeviceOriginTuple);
|
||||
|
||||
virtual void SetDeviceOrigin(wxCoord x, wxCoord y);
|
||||
%extend {
|
||||
void SetDeviceOriginPoint(const wxPoint& point) {
|
||||
self->SetDeviceOrigin(point.x, point.y);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
|
||||
|
||||
@ -440,6 +452,12 @@ public:
|
||||
// ------------
|
||||
|
||||
virtual void CalcBoundingBox(wxCoord x, wxCoord y);
|
||||
%extend {
|
||||
void CalcBoundingBoxPoint(const wxPoint& point) {
|
||||
self->CalcBoundingBox(point.x, point.y);
|
||||
}
|
||||
}
|
||||
|
||||
void ResetBoundingBox();
|
||||
|
||||
// Get the final bounding box of the PostScript or Metafile picture.
|
||||
@ -861,6 +879,8 @@ public:
|
||||
// compatible with the DC Draw methods in 2.4. See also wxPython/_wx.py.
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
%define MAKE_OLD_DC_CLASS(classname)
|
||||
%pythoncode {
|
||||
class classname##_old(classname):
|
||||
@ -898,5 +918,6 @@ MAKE_OLD_DC_CLASS(PostScriptDC);
|
||||
MAKE_OLD_DC_CLASS(MetaFileDC);
|
||||
MAKE_OLD_DC_CLASS(PrinterDC);
|
||||
|
||||
#endif
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -103,6 +103,12 @@ class AnalogClockWindow(wx.PyWindow):
|
||||
|
||||
self.currentTime=None
|
||||
|
||||
size = wx.Size(*size)
|
||||
bestSize = self.GetBestSize()
|
||||
size.x = max(size.x, bestSize.x)
|
||||
size.y = max(size.y, bestSize.y)
|
||||
self.SetSize(size)
|
||||
|
||||
# Make an initial bitmap for the face, it will be updated and
|
||||
# painted at the first EVT_SIZE event.
|
||||
W, H = size
|
||||
@ -117,18 +123,20 @@ class AnalogClockWindow(wx.PyWindow):
|
||||
self.Bind(wx.EVT_RIGHT_DOWN, self.OnRightDown)
|
||||
self.Bind(wx.EVT_RIGHT_UP, self.OnRightClick)
|
||||
|
||||
|
||||
# Initialize the timer that drives the update of the clock
|
||||
# face. Update every half second to ensure that there is at
|
||||
# least one true update during each realtime second.
|
||||
self.timer = wx.Timer(self)
|
||||
self.timer.Start(500)
|
||||
|
||||
|
||||
def DoGetBestSize(self):
|
||||
return wx.Size(25,25)
|
||||
|
||||
|
||||
def OnPaint(self, event):
|
||||
self._doDrawHands(wx.BufferedPaintDC(self), True)
|
||||
dc = wx.BufferedPaintDC(self)
|
||||
self._doDrawHands(dc, True)
|
||||
|
||||
|
||||
def OnTimerExpire(self, event):
|
||||
@ -187,6 +195,9 @@ class AnalogClockWindow(wx.PyWindow):
|
||||
# The faceBitmap init is done here, to make sure the buffer is always
|
||||
# the same size as the Window
|
||||
size = self.GetClientSize()
|
||||
if size.x < 1 or size.y < 1:
|
||||
return
|
||||
|
||||
self.faceBitmap = wx.EmptyBitmap(size.width, size.height)
|
||||
|
||||
# Update drawing coordinates...
|
||||
@ -221,7 +232,7 @@ class AnalogClockWindow(wx.PyWindow):
|
||||
hour, minutes, seconds = currentTime
|
||||
|
||||
# Start by drawing the face bitmap
|
||||
drawDC.DrawBitmap(self.faceBitmap, (0,0))
|
||||
drawDC.DrawBitmap(self.faceBitmap, 0,0)
|
||||
|
||||
|
||||
# NOTE: All this hand drawing code below should be refactored into a helper function.
|
||||
@ -240,10 +251,10 @@ class AnalogClockWindow(wx.PyWindow):
|
||||
drawDC.SetPen(wx.Pen(self.shadowPenColour,
|
||||
int(self.handHoursThickness * self.scale),
|
||||
wx.SOLID))
|
||||
drawDC.DrawLineXY(int(self.centerX + self.shadowDistance),
|
||||
int(self.centerY + self.shadowDistance),
|
||||
int(x + self.shadowDistance),
|
||||
int(y + self.shadowDistance))
|
||||
drawDC.DrawLine(self.centerX + self.shadowDistance,
|
||||
self.centerY + self.shadowDistance,
|
||||
x + self.shadowDistance,
|
||||
y + self.shadowDistance)
|
||||
|
||||
# Draw minutes hand shadow
|
||||
angle = minutes * 6
|
||||
@ -253,10 +264,10 @@ class AnalogClockWindow(wx.PyWindow):
|
||||
drawDC.SetPen(wx.Pen(self.shadowPenColour,
|
||||
int(self.handMinutesThickness * self.scale),
|
||||
wx.SOLID))
|
||||
drawDC.DrawLineXY(int(self.centerX + self.shadowDistance),
|
||||
int(self.centerY + self.shadowDistance),
|
||||
int(x + self.shadowDistance),
|
||||
int(y + self.shadowDistance))
|
||||
drawDC.DrawLine(self.centerX + self.shadowDistance,
|
||||
self.centerY + self.shadowDistance,
|
||||
x + self.shadowDistance,
|
||||
y + self.shadowDistance)
|
||||
|
||||
# Draw seconds hand shadow if required
|
||||
if seconds >= 0:
|
||||
@ -267,10 +278,10 @@ class AnalogClockWindow(wx.PyWindow):
|
||||
drawDC.SetPen(wx.Pen(self.shadowPenColour,
|
||||
int(self.handSecondsThickness * self.scale),
|
||||
wx.SOLID))
|
||||
drawDC.DrawLineXY(int(self.centerX + self.shadowDistance),
|
||||
int(self.centerY + self.shadowDistance),
|
||||
int(x + self.shadowDistance),
|
||||
int(y + self.shadowDistance))
|
||||
drawDC.DrawLine(self.centerX + self.shadowDistance,
|
||||
self.centerY + self.shadowDistance,
|
||||
x + self.shadowDistance,
|
||||
y + self.shadowDistance)
|
||||
|
||||
|
||||
# Draw hours hand
|
||||
@ -285,7 +296,7 @@ class AnalogClockWindow(wx.PyWindow):
|
||||
drawDC.SetPen(wx.Pen(self.handHoursColour,
|
||||
int(self.handHoursThickness * self.scale),
|
||||
wx.SOLID))
|
||||
drawDC.DrawLineXY(int(self.centerX), int(self.centerY), int(x), int(y))
|
||||
drawDC.DrawLine(self.centerX, self.centerY, x, y)
|
||||
|
||||
# Draw minutes hand
|
||||
angle = minutes * 6
|
||||
@ -295,7 +306,7 @@ class AnalogClockWindow(wx.PyWindow):
|
||||
drawDC.SetPen(wx.Pen(self.handMinutesColour,
|
||||
int(self.handMinutesThickness * self.scale),
|
||||
wx.SOLID))
|
||||
drawDC.DrawLineXY(int(self.centerX), int(self.centerY), int(x), int(y))
|
||||
drawDC.DrawLine(self.centerX, self.centerY, x, y)
|
||||
|
||||
# Draw seconds hand if required
|
||||
if seconds >= 0:
|
||||
@ -305,7 +316,7 @@ class AnalogClockWindow(wx.PyWindow):
|
||||
drawDC.SetPen(wx.Pen(self.handSecondsColour,
|
||||
int(self.handSecondsThickness * self.scale),
|
||||
wx.SOLID))
|
||||
drawDC.DrawLineXY(int(self.centerX), int(self.centerY), int(x), int(y))
|
||||
drawDC.DrawLine(self.centerX, self.centerY, x, y)
|
||||
|
||||
|
||||
|
||||
@ -371,11 +382,11 @@ class AnalogClockWindow(wx.PyWindow):
|
||||
|
||||
if style & TICKS_CIRCLE:
|
||||
x, y = self._center2corner(x, y, tipo)
|
||||
drawDC.DrawEllipse((x, y), (int(size), int(size)))
|
||||
drawDC.DrawEllipse(x, y, size, size)
|
||||
|
||||
elif style & TICKS_SQUARE:
|
||||
x, y = self._center2corner(x, y, tipo)
|
||||
drawDC.DrawRectangle((x, y), (int(size), int(size)))
|
||||
drawDC.DrawRectangle(x, y, size, size)
|
||||
|
||||
elif (style & TICKS_DECIMAL) or (style & TICKS_ROMAN):
|
||||
self._draw_rotate_text(drawDC, x, y, tipo, angle)
|
||||
@ -398,12 +409,12 @@ class AnalogClockWindow(wx.PyWindow):
|
||||
y = int(y -
|
||||
((math.cos((angle) * radiansPerDegree)*lY) -
|
||||
(math.sin((angle) * radiansPerDegree)*lX)))
|
||||
drawDC.DrawRotatedText(text, (x,y), angle)
|
||||
drawDC.DrawRotatedText(text, x,y, angle)
|
||||
|
||||
else:
|
||||
x = x - lX
|
||||
y = y - lY
|
||||
drawDC.DrawText(text, (x, y))
|
||||
drawDC.DrawText(text, x, y)
|
||||
|
||||
|
||||
def _draw_rotate_polygon(self, drawDC, x, y, tipo, angle):
|
||||
@ -527,7 +538,7 @@ class AnalogClockWindow(wx.PyWindow):
|
||||
drawDC.SetBrush(self.watchBrush)
|
||||
else:
|
||||
drawDC.SetBrush(wx.Brush(self.GetBackgroundColour(), wx.SOLID))
|
||||
drawDC.DrawCircle((self.centerX, self.centerY), self.radius_watch)
|
||||
drawDC.DrawCircle(self.centerX, self.centerY, self.radius_watch)
|
||||
|
||||
|
||||
def _calcSteps(self):
|
||||
|
@ -217,8 +217,8 @@ class GenButton(wx.PyControl):
|
||||
else:
|
||||
dc.SetPen(self.shadowPen)
|
||||
for i in range(self.bezelWidth):
|
||||
dc.DrawLine((x1+i, y1), (x1+i, y2-i))
|
||||
dc.DrawLine((x1, y1+i), (x2-i, y1+i))
|
||||
dc.DrawLine(x1+i, y1, x1+i, y2-i)
|
||||
dc.DrawLine(x1, y1+i, x2-i, y1+i)
|
||||
|
||||
# draw the lower right sides
|
||||
if self.up:
|
||||
@ -226,8 +226,8 @@ class GenButton(wx.PyControl):
|
||||
else:
|
||||
dc.SetPen(self.highlightPen)
|
||||
for i in range(self.bezelWidth):
|
||||
dc.DrawLine((x1+i, y2-i), (x2+1, y2-i))
|
||||
dc.DrawLine((x2-i, y1+i), (x2-i, y2))
|
||||
dc.DrawLine(x1+i, y2-i, x2+1, y2-i)
|
||||
dc.DrawLine(x2-i, y1+i, x2-i, y2)
|
||||
|
||||
|
||||
def DrawLabel(self, dc, width, height, dw=0, dy=0):
|
||||
@ -240,7 +240,7 @@ class GenButton(wx.PyControl):
|
||||
tw, th = dc.GetTextExtent(label)
|
||||
if not self.up:
|
||||
dw = dy = self.labelDelta
|
||||
dc.DrawText(label, ((width-tw)/2+dw, (height-th)/2+dy))
|
||||
dc.DrawText(label, (width-tw)/2+dw, (height-th)/2+dy)
|
||||
|
||||
|
||||
def DrawFocusIndicator(self, dc, w, h):
|
||||
@ -254,7 +254,7 @@ class GenButton(wx.PyControl):
|
||||
dc.SetLogicalFunction(wx.INVERT)
|
||||
dc.SetPen(self.focusIndPen)
|
||||
dc.SetBrush(wx.TRANSPARENT_BRUSH)
|
||||
dc.DrawRectangle((bw+2,bw+2), (w-bw*2-4, h-bw*2-4))
|
||||
dc.DrawRectangle(bw+2,bw+2, w-bw*2-4, h-bw*2-4)
|
||||
dc.SetLogicalFunction(wx.COPY)
|
||||
|
||||
|
||||
@ -419,7 +419,7 @@ class GenBitmapButton(GenButton):
|
||||
if not self.up:
|
||||
dw = dy = self.labelDelta
|
||||
hasMask = bmp.GetMask() != None
|
||||
dc.DrawBitmap(bmp, ((width-bw)/2+dw, (height-bh)/2+dy), hasMask)
|
||||
dc.DrawBitmap(bmp, (width-bw)/2+dw, (height-bh)/2+dy, hasMask)
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
@ -479,10 +479,10 @@ class GenBitmapTextButton(GenBitmapButton): # generic bitmapped button with
|
||||
|
||||
pos_x = (width-bw-tw)/2+dw # adjust for bitmap and text to centre
|
||||
if bmp !=None:
|
||||
dc.DrawBitmap(bmp, (pos_x, (height-bh)/2+dy), hasMask) # draw bitmap if available
|
||||
dc.DrawBitmap(bmp, pos_x, (height-bh)/2+dy, hasMask) # draw bitmap if available
|
||||
pos_x = pos_x + 2 # extra spacing from bitmap
|
||||
|
||||
dc.DrawText(label, (pos_x + dw+bw, (height-th)/2+dy)) # draw the text
|
||||
dc.DrawText(label, pos_x + dw+bw, (height-th)/2+dy) # draw the text
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
@ -359,7 +359,7 @@ class CalDraw:
|
||||
|
||||
tw,th = DC.GetTextExtent(month)
|
||||
adjust = self.cx_st + (self.sizew-tw)/2
|
||||
DC.DrawText(month, (adjust, self.cy_st + th))
|
||||
DC.DrawText(month, adjust, self.cy_st + th)
|
||||
|
||||
year = str(self.year)
|
||||
tw,th = DC.GetTextExtent(year)
|
||||
@ -369,7 +369,7 @@ class CalDraw:
|
||||
|
||||
f = wx.Font(sizef, self.font, wx.NORMAL, self.bold)
|
||||
DC.SetFont(f)
|
||||
DC.DrawText(year, (self.cx_st + adjust, self.cy_st + th))
|
||||
DC.DrawText(year, self.cx_st + adjust, self.cy_st + th)
|
||||
|
||||
def DrawWeek(self, DC): # draw the week days
|
||||
# increase by 1 to include all gridlines
|
||||
@ -431,7 +431,7 @@ class CalDraw:
|
||||
else:
|
||||
pen = wx.Pen(MakeColor(self.GetColor(COLOR_BACKGROUND)), 1, wx.SOLID)
|
||||
DC.SetPen(pen)
|
||||
DC.DrawRectangle( pointXY, pointWH)
|
||||
DC.DrawRectanglePointSize( pointXY, pointWH)
|
||||
|
||||
old_pen = DC.GetPen()
|
||||
|
||||
@ -440,12 +440,12 @@ class CalDraw:
|
||||
# draw the horizontal hilight
|
||||
startPoint = wx.Point(x + 1 , y + 1)
|
||||
endPoint = wx.Point(x + width - 1, y + 1)
|
||||
DC.DrawLine(startPoint, endPoint )
|
||||
DC.DrawLinePoint(startPoint, endPoint )
|
||||
|
||||
# draw the vertical hilight
|
||||
startPoint = wx.Point(x + 1 , y + 1)
|
||||
endPoint = wx.Point(x + 1, y + height - 2)
|
||||
DC.DrawLine(startPoint, endPoint )
|
||||
DC.DrawLinePoint(startPoint, endPoint )
|
||||
|
||||
pen = wx.Pen(MakeColor(self.colors[COLOR_3D_DARK]), 1, wx.SOLID)
|
||||
DC.SetPen(pen)
|
||||
@ -453,19 +453,19 @@ class CalDraw:
|
||||
# draw the horizontal lowlight
|
||||
startPoint = wx.Point(x + 1, y + height - 2)
|
||||
endPoint = wx.Point(x + width - 1, y + height - 2)
|
||||
DC.DrawLine(startPoint, endPoint )
|
||||
DC.DrawLinePoint(startPoint, endPoint )
|
||||
|
||||
# draw the vertical lowlight
|
||||
startPoint = wx.Point(x + width - 2 , y + 2)
|
||||
endPoint = wx.Point(x + width - 2, y + height - 2)
|
||||
DC.DrawLine(startPoint, endPoint )
|
||||
DC.DrawLinePoint(startPoint, endPoint )
|
||||
|
||||
pen = wx.Pen(MakeColor(self.colors[COLOR_FONT]), 1, wx.SOLID)
|
||||
|
||||
DC.SetPen(pen)
|
||||
|
||||
point = (x+diffx, y+diffy)
|
||||
DC.DrawText(day, point)
|
||||
DC.DrawTextPoint(day, point)
|
||||
cnt_x = cnt_x + 1
|
||||
|
||||
def _CalcFontSize(self, DC, f):
|
||||
@ -536,7 +536,7 @@ class CalDraw:
|
||||
|
||||
adj_v = adj_v + self.num_indent_vert
|
||||
|
||||
DC.DrawText(text, (x+adj_h, y+adj_v))
|
||||
DC.DrawTextPoint(text, (x+adj_h, y+adj_v))
|
||||
|
||||
def DrawDayText(self, DC, key):
|
||||
f = wx.Font(10, self.font, wx.NORMAL, self.bold) # initial font setting
|
||||
@ -589,7 +589,7 @@ class CalDraw:
|
||||
nkey = key + self.st_pos -1
|
||||
rect = self.rg[nkey]
|
||||
|
||||
DC.DrawRectangle((rect.x, rect.y), (rect.width, rect.height))
|
||||
DC.DrawRectangleRect(rect)
|
||||
|
||||
# calculate and draw the grid lines
|
||||
def DrawGrid(self, DC):
|
||||
@ -611,7 +611,7 @@ class CalDraw:
|
||||
x1 = x1 + self.restW
|
||||
|
||||
if self.hide_grid is False:
|
||||
DC.DrawLine((x1, y1), (x1, y2))
|
||||
DC.DrawLinePoint((x1, y1), (x1, y2))
|
||||
|
||||
self.gridx.append(x1)
|
||||
|
||||
@ -626,7 +626,7 @@ class CalDraw:
|
||||
y1 = y1 + self.restH
|
||||
|
||||
if self.hide_grid is False:
|
||||
DC.DrawLine((x1, y1), (x2, y1))
|
||||
DC.DrawLinePoint((x1, y1), (x2, y1))
|
||||
|
||||
self.gridy.append(y1)
|
||||
|
||||
@ -1019,7 +1019,7 @@ class Calendar( wx.PyControl ):
|
||||
DC.SetPen(wx.TRANSPARENT_PEN)
|
||||
|
||||
rect = self.rg[key]
|
||||
DC.DrawRectangle((rect.x+1, rect.y+1), (rect.width-2, rect.height-2))
|
||||
DC.DrawRectangle(rect.x+1, rect.y+1, rect.width-2, rect.height-2)
|
||||
|
||||
self.caldraw.DrawDayText(DC,key)
|
||||
|
||||
@ -1041,7 +1041,7 @@ class Calendar( wx.PyControl ):
|
||||
DC.SetPen(wx.Pen(MakeColor(self.GetColor(COLOR_GRID_LINES)), width))
|
||||
|
||||
rect = self.rg[key]
|
||||
DC.DrawRectangle((rect.x, rect.y), (rect.width, rect.height))
|
||||
DC.DrawRectangleRect(rect)
|
||||
|
||||
DC.EndDrawing()
|
||||
|
||||
|
@ -113,7 +113,7 @@ class Canvas(wx.Window):
|
||||
"""Performs the blit of the buffer contents on-screen."""
|
||||
width, height = self.buffer.GetSize()
|
||||
dc.BeginDrawing()
|
||||
dc.Blit((0, 0), (width, height), self.buffer, (0, 0))
|
||||
dc.Blit(0, 0, width, height, self.buffer, 0, 0)
|
||||
dc.EndDrawing()
|
||||
|
||||
def GetBoundingRect(self):
|
||||
|
@ -68,7 +68,7 @@ class PyColourSlider(canvas.Canvas):
|
||||
"""Returns the colour value for a position on the slider. The position
|
||||
must be within the valid height of the slider, or results can be
|
||||
unpredictable."""
|
||||
return self.buffer.GetPixel((0, pos))
|
||||
return self.buffer.GetPixel(0, pos)
|
||||
|
||||
def DrawBuffer(self):
|
||||
"""Actual implementation of the widget's drawing. We simply draw
|
||||
@ -88,5 +88,5 @@ class PyColourSlider(canvas.Canvas):
|
||||
r,g,b = [c * 255.0 for c in colorsys.hsv_to_rgb(h,s,v)]
|
||||
colour = wx.Colour(int(r), int(g), int(b))
|
||||
self.buffer.SetPen(wx.Pen(colour, 1, wx.SOLID))
|
||||
self.buffer.DrawRectangle((0, y_pos), (15, 1))
|
||||
self.buffer.DrawRectangle(0, y_pos, 15, 1)
|
||||
v = v - vstep
|
||||
|
@ -184,12 +184,12 @@ class PyPalette(canvas.Canvas):
|
||||
"""Returns a colour value at a specific x, y coordinate pair. This
|
||||
is useful for determining the colour found a specific mouse click
|
||||
in an external event handler."""
|
||||
return self.buffer.GetPixel((x, y))
|
||||
return self.buffer.GetPixel(x, y)
|
||||
|
||||
def DrawBuffer(self):
|
||||
"""Draws the palette XPM into the memory buffer."""
|
||||
#self.GeneratePaletteBMP ("foo.bmp")
|
||||
self.buffer.DrawBitmap(self.palette, (0, 0), 0)
|
||||
self.buffer.DrawBitmap(self.palette, 0, 0, 0)
|
||||
|
||||
def HighlightPoint(self, x, y):
|
||||
"""Highlights an area of the palette with a little circle around
|
||||
@ -197,7 +197,7 @@ class PyPalette(canvas.Canvas):
|
||||
colour = wx.Colour(0, 0, 0)
|
||||
self.buffer.SetPen(wx.Pen(colour, 1, wx.SOLID))
|
||||
self.buffer.SetBrush(wx.Brush(colour, wx.TRANSPARENT))
|
||||
self.buffer.DrawCircle((x, y), 3)
|
||||
self.buffer.DrawCircle(x, y, 3)
|
||||
self.Refresh()
|
||||
|
||||
def GeneratePaletteBMP(self, file_name, granularity=1):
|
||||
@ -225,8 +225,8 @@ class PyPalette(canvas.Canvas):
|
||||
colour = wx.Colour(int(r * 255.0), int(g * 255.0), int(b * 255.0))
|
||||
self.buffer.SetPen(wx.Pen(colour, 1, wx.SOLID))
|
||||
self.buffer.SetBrush(wx.Brush(colour, wx.SOLID))
|
||||
self.buffer.DrawRectangle((x, y),
|
||||
(self.HORIZONTAL_STEP, self.vertical_step))
|
||||
self.buffer.DrawRectangle(x, y,
|
||||
self.HORIZONTAL_STEP, self.vertical_step)
|
||||
|
||||
# this code is now simpler (and works)
|
||||
bitmap = self.buffer.GetBitmap()
|
||||
|
@ -1,155 +0,0 @@
|
||||
#----------------------------------------------------------------------
|
||||
# Name: compatdc.py
|
||||
# Purpose: Make wxPython 2.4 DC classes compatible with the 2.5
|
||||
# DC classes
|
||||
#
|
||||
# Author: Robin Dunn
|
||||
#
|
||||
# Created: 21-Apr-2004
|
||||
# RCS-ID: $Id$
|
||||
# Copyright: (c) 2004 by Total Control Software
|
||||
# Licence: wxWindows license
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
import wx
|
||||
|
||||
|
||||
def MakeDCCompatible(klass, full=False):
|
||||
"""
|
||||
Manipulate the DC class passed to this funciton such that it is
|
||||
more compatible with the DC classes used in wxPython 2.5. This
|
||||
should help with writing code that works with both versions. If
|
||||
full is True then in addition to creating the 'XY' versions of the
|
||||
methods, a 'point/size' version (which are the new defaults in
|
||||
2.5) will also be created.
|
||||
"""
|
||||
if wx.VERSION >= (2,5):
|
||||
return # Nothing to do
|
||||
|
||||
# first create XY methods from the current ones.
|
||||
klass.FloodFillXY = klass.FloodFill
|
||||
klass.GetPixelXY = klass.GetPixel
|
||||
klass.DrawLineXY = klass.DrawLine
|
||||
klass.CrossHairXY = klass.CrossHair
|
||||
klass.DrawArcXY = klass.DrawArc
|
||||
klass.DrawEllipticArcXY = klass.DrawEllipticArc
|
||||
klass.DrawPointXY = klass.DrawPoint
|
||||
klass.DrawRectangleXY = klass.DrawRectangle
|
||||
klass.DrawRoundedRectangleXY = klass.DrawRoundedRectangle
|
||||
klass.DrawCircleXY = klass.DrawCircle
|
||||
klass.DrawEllipseXY = klass.DrawEllipse
|
||||
klass.DrawIconXY = klass.DrawIcon
|
||||
klass.DrawBitmapXY = klass.DrawBitmap
|
||||
klass.DrawTextXY = klass.DrawText
|
||||
klass.DrawRotatedTextXY = klass.DrawRotatedText
|
||||
klass.BlitXY = klass.Blit
|
||||
|
||||
# now, make some functions that we can use as new methods
|
||||
if full:
|
||||
def FloodFill(self, pt, col, style=wx.FLOOD_SURFACE):
|
||||
pt = wx.Point(*pt)
|
||||
return self.FloodFillXY(pt.x, pt.y, col, style)
|
||||
klass.FloodFill = FloodFill
|
||||
|
||||
def GetPixel(self, pt):
|
||||
pt = wx.Point(*pt)
|
||||
return self.GetPixelXY(pt.x, pt.y)
|
||||
klass.GetPixel = GetPixel
|
||||
|
||||
def DrawLine(self, pt1, pt2):
|
||||
pt1 = wx.Point(*pt1)
|
||||
pt2 = wx.Point(*pt2)
|
||||
return self.DrawLineXY(pt1.x, pt1.y, pt2.x, pt2.y)
|
||||
klass.DrawLine = DrawLine
|
||||
|
||||
def CrossHair(self, pt):
|
||||
pt = wx.Point(*pt)
|
||||
return self.CrossHairXY(pt.x, pt.y)
|
||||
klass.CrossHair = CrossHair
|
||||
|
||||
def DrawArc(self, pt1, pt2, centre):
|
||||
pt1 = wx.Point(*pt1)
|
||||
pt2 = wx.Point(*pt2)
|
||||
return self.DrawArcXY(pt1.x, pt1.y, pt2.x, pt2.y, centre.x, centre.y)
|
||||
klass.DrawArc = DrawArc
|
||||
|
||||
def DrawEllipticArc(self, pt, sz, sa, ea):
|
||||
pt = wx.Point(*pt)
|
||||
sz = wx.Size(*sz)
|
||||
return self.DrawEllipticArcXY(pt.x, pt.y, sz.width, sz.height, sa, ea)
|
||||
klass.DrawEllipticArc = DrawEllipticArc
|
||||
|
||||
def DrawPoint(self, pt):
|
||||
pt = wx.Point(*pt)
|
||||
return self.DrawPointXY(pt.x, pt.y)
|
||||
klass.DrawPoint = DrawPoint
|
||||
|
||||
def DrawRectangle(self, pt, sz):
|
||||
pt = wx.Point(*pt)
|
||||
sz = wx.Size(*sz)
|
||||
return self.DrawRectangleXY(pt.x, pt.y, sz.width, sz.height)
|
||||
klass.DrawRectangle = DrawRectangle
|
||||
|
||||
def DrawRoundedRectangle(self, pt, sz, radius):
|
||||
pt = wx.Point(*pt)
|
||||
sz = wx.Size(*sz)
|
||||
return self.DrawRoundedRectangleXY(pt.x, pt.y, sz.width, sz.height, radius)
|
||||
klass.DrawRoundedRectangle = DrawRoundedRectangle
|
||||
|
||||
def DrawCircle(self, pt, radius):
|
||||
pt = wx.Point(*pt)
|
||||
return self.DrawCircleXY(pt.x, pt.y, radius)
|
||||
klass.DrawCircle = DrawCircle
|
||||
|
||||
def DrawEllipse(self, pt, sz):
|
||||
pt = wx.Point(*pt)
|
||||
sz = wx.Size(*sz)
|
||||
return self.DrawEllipseXY(pt.x, pt.y, sz.width, sz.height)
|
||||
klass.DrawEllipse = DrawEllipse
|
||||
|
||||
def DrawIcon(self, icon, pt):
|
||||
pt = wx.Point(*pt)
|
||||
return self.DrawIconXY(icon, pt.x, pt.y )
|
||||
klass.DrawIcon = DrawIcon
|
||||
|
||||
def DrawBitmap(self, bmp, pt):
|
||||
pt = wx.Point(*pt)
|
||||
return self.DrawBitmapXY(bmp, pt.x, pt.y)
|
||||
klass.DrawBitmap = DrawBitmap
|
||||
|
||||
def DrawText(self, text, pt):
|
||||
pt = wx.Point(*pt)
|
||||
return self.DrawTextXY(text, pt.x, pt.y)
|
||||
klass.DrawText = DrawText
|
||||
|
||||
def DrawRotatedText(self, text, pt, angle):
|
||||
pt = wx.Point(*pt)
|
||||
return self.DrawRotatedTextXY(text, pt.x, pt.y, angle)
|
||||
klass.DrawRotatedText = DrawRotatedText
|
||||
|
||||
def Blit(self, destPt, sz, source, srcPt,
|
||||
rop=wx.COPY, useMask=False, srcPtMask=wx.DefaultPosition):
|
||||
return self.BlitXY(destPt.x, destPt.y, sz.width, sz.height,
|
||||
source, srcPt.x, srcPt.y, rop, useMask,
|
||||
srcPtMask.x, srcPtMask.y)
|
||||
klass.Blit = Blit
|
||||
|
||||
|
||||
def MakeAllDCsCompatible(full=False):
|
||||
"""
|
||||
Run MakeDCCompatible on all DC classes in wx.
|
||||
"""
|
||||
MakeDCCompatible(wx.BufferedPaintDC, full)
|
||||
MakeDCCompatible(wx.BufferedDC, full)
|
||||
MakeDCCompatible(wx.MemoryDC, full)
|
||||
MakeDCCompatible(wx.ScreenDC, full)
|
||||
MakeDCCompatible(wx.ClientDC, full)
|
||||
MakeDCCompatible(wx.PaintDC, full)
|
||||
MakeDCCompatible(wx.WindowDC, full)
|
||||
MakeDCCompatible(wx.PostScriptDC, full)
|
||||
if hasattr(wx, "MetaFileDC"):
|
||||
MakeDCCompatible(wx.MetaFileDC, full)
|
||||
if hasattr(wx, "PrinterDC"):
|
||||
MakeDCCompatible(wx.PrinterDC, full)
|
||||
MakeDCCompatible(wx.DC, full)
|
||||
|
@ -216,7 +216,7 @@ class Editor(wx.ScrolledWindow):
|
||||
pass
|
||||
|
||||
def DrawEditText(self, t, x, y, dc):
|
||||
dc.DrawText(t, (x * self.fw, y * self.fh))
|
||||
dc.DrawText(t, x * self.fw, y * self.fh)
|
||||
|
||||
def DrawLine(self, line, dc):
|
||||
if self.IsLine(line):
|
||||
@ -264,7 +264,7 @@ class Editor(wx.ScrolledWindow):
|
||||
x = 0
|
||||
y = (len(self.lines) - self.sy) * self.fh
|
||||
hasTransparency = 1
|
||||
dc.DrawBitmap(self.eofMarker, (x, y), hasTransparency)
|
||||
dc.DrawBitmap(self.eofMarker, x, y, hasTransparency)
|
||||
|
||||
##------------------ cursor-related functions
|
||||
|
||||
@ -293,7 +293,7 @@ class Editor(wx.ScrolledWindow):
|
||||
szy = self.fh
|
||||
x = xp * szx
|
||||
y = yp * szy
|
||||
dc.Blit((x,y), (szx,szy), dc, (x,y), wx.SRC_INVERT)
|
||||
dc.Blit(x,y, szx,szy, dc, x,y, wx.SRC_INVERT)
|
||||
self.sco_x = xp
|
||||
self.sco_y = yp
|
||||
|
||||
|
@ -277,15 +277,15 @@ class DCRenderer(Renderer):
|
||||
|
||||
def renderCharacterData(self, data, x, y):
|
||||
self.dc.SetTextForeground(self.getCurrentColor())
|
||||
self.dc.DrawText(data, (x, y))
|
||||
self.dc.DrawText(data, x, y)
|
||||
|
||||
def start_angle(self, attrs):
|
||||
self.dc.SetFont(self.getCurrentFont())
|
||||
self.dc.SetPen(self.getCurrentPen())
|
||||
width, height, descent, leading = self.dc.GetFullTextExtent("M")
|
||||
y = self.y + self.offsets[-1]
|
||||
self.dc.DrawLine((iround(self.x), iround(y)), (iround( self.x+width), iround(y)))
|
||||
self.dc.DrawLine((iround(self.x), iround(y)), (iround(self.x+width), iround(y-width)))
|
||||
self.dc.DrawLine(iround(self.x), iround(y), iround( self.x+width), iround(y))
|
||||
self.dc.DrawLine(iround(self.x), iround(y), iround(self.x+width), iround(y-width))
|
||||
self.updateDims(width, height, descent, leading)
|
||||
|
||||
|
||||
@ -301,8 +301,8 @@ class DCRenderer(Renderer):
|
||||
r = iround( 0.95 * width / 4)
|
||||
xc = (2*self.x + width) / 2
|
||||
yc = iround(y-1.5*r)
|
||||
self.dc.DrawCircle((xc - r, yc), r)
|
||||
self.dc.DrawCircle((xc + r, yc), r)
|
||||
self.dc.DrawCircle(xc - r, yc, r)
|
||||
self.dc.DrawCircle(xc + r, yc, r)
|
||||
self.updateDims(width, height, 0, 0)
|
||||
|
||||
def start_times(self, attrs):
|
||||
@ -313,8 +313,8 @@ class DCRenderer(Renderer):
|
||||
width *= 0.8
|
||||
width = iround(width+.5)
|
||||
self.dc.SetPen(wx.Pen(self.getCurrentColor(), 1))
|
||||
self.dc.DrawLine((iround(self.x), iround(y-width)), (iround(self.x+width-1), iround(y-1)))
|
||||
self.dc.DrawLine((iround(self.x), iround(y-2)), (iround(self.x+width-1), iround(y-width-1)))
|
||||
self.dc.DrawLine(iround(self.x), iround(y-width), iround(self.x+width-1), iround(y-1))
|
||||
self.dc.DrawLine(iround(self.x), iround(y-2), iround(self.x+width-1), iround(y-width-1))
|
||||
self.updateDims(width, height, 0, 0)
|
||||
|
||||
|
||||
|
@ -450,7 +450,7 @@ class PointSet(draw_object):
|
||||
dc.SetBrush(self.Brush)
|
||||
radius = int(round(self.Diameter/2))
|
||||
for (x,y) in Points:
|
||||
dc.DrawEllipse(((x - radius), (y - radius)), (self.Diameter, self.Diameter))
|
||||
dc.DrawEllipse((x - radius), (y - radius), self.Diameter, self.Diameter)
|
||||
|
||||
|
||||
|
||||
@ -486,7 +486,7 @@ class Dot(draw_object):
|
||||
dc.SetBrush(self.Brush)
|
||||
radius = int(round(self.Diameter/2))
|
||||
(X,Y) = WorldToPixel((self.X,self.Y))
|
||||
dc.DrawEllipse(((X - radius), (Y - radius)), (self.Diameter, self.Diameter))
|
||||
dc.DrawEllipse((X - radius), (Y - radius), self.Diameter, self.Diameter)
|
||||
|
||||
|
||||
class Rectangle(draw_object):
|
||||
@ -513,7 +513,7 @@ class Rectangle(draw_object):
|
||||
|
||||
dc.SetPen(self.Pen)
|
||||
dc.SetBrush(self.Brush)
|
||||
dc.DrawRectangle((X,Y), (Width,Height))
|
||||
dc.DrawRectangle(X,Y, Width,Height)
|
||||
|
||||
class Ellipse(draw_object):
|
||||
def __init__(self,x,y,width,height,LineColor,LineStyle,LineWidth,FillColor,FillStyle,Foreground = 0):
|
||||
@ -539,7 +539,7 @@ class Ellipse(draw_object):
|
||||
|
||||
dc.SetPen(self.Pen)
|
||||
dc.SetBrush(self.Brush)
|
||||
dc.DrawEllipse((X,Y), (Width,Height))
|
||||
dc.DrawEllipse(X,Y, Width,Height)
|
||||
|
||||
class Circle(draw_object):
|
||||
def __init__(self,x,y,Diameter,LineColor,LineStyle,LineWidth,FillColor,FillStyle,Foreground = 0):
|
||||
@ -564,7 +564,7 @@ class Circle(draw_object):
|
||||
|
||||
dc.SetPen(self.Pen)
|
||||
dc.SetBrush(self.Brush)
|
||||
dc.DrawEllipse((X-Diameter/2,Y-Diameter/2), (Diameter,Diameter))
|
||||
dc.DrawEllipse(X-Diameter/2,Y-Diameter/2, Diameter,Diameter)
|
||||
|
||||
class Text(draw_object):
|
||||
"""
|
||||
@ -647,7 +647,7 @@ class Text(draw_object):
|
||||
raise "Invalid value for Text Object Position Attribute"
|
||||
self.x_shift = x_shift
|
||||
self.y_shift = y_shift
|
||||
dc.DrawText(self.String, (X-self.x_shift, Y-self.y_shift))
|
||||
dc.DrawText(self.String, X-self.x_shift, Y-self.y_shift)
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
@ -870,8 +870,8 @@ class FloatCanvas(wx.Panel):
|
||||
dc.SetBrush(wx.TRANSPARENT_BRUSH)
|
||||
dc.SetLogicalFunction(wx.XOR)
|
||||
if self.PrevRBBox:
|
||||
dc.DrawRectangleXY(*self.PrevRBBox)
|
||||
dc.DrawRectangleXY(x_c-w/2,y_c-h/2,w,h)
|
||||
dc.DrawRectangle(*self.PrevRBBox)
|
||||
dc.DrawRectangle(x_c-w/2,y_c-h/2,w,h)
|
||||
self.PrevRBBox = (x_c-w/2,y_c-h/2,w,h)
|
||||
dc.EndDrawing()
|
||||
|
||||
@ -909,8 +909,8 @@ class FloatCanvas(wx.Panel):
|
||||
dc.SetBrush(wx.TRANSPARENT_BRUSH)
|
||||
dc.SetLogicalFunction(wx.XOR)
|
||||
if self.PrevMoveBox:
|
||||
dc.DrawRectangleXY(*self.PrevMoveBox)
|
||||
dc.DrawRectangleXY(x_tl,y_tl,w,h)
|
||||
dc.DrawRectangle(*self.PrevMoveBox)
|
||||
dc.DrawRectangle(x_tl,y_tl,w,h)
|
||||
self.PrevMoveBox = (x_tl,y_tl,w,h)
|
||||
dc.EndDrawing()
|
||||
|
||||
@ -955,7 +955,7 @@ class FloatCanvas(wx.Panel):
|
||||
def OnPaint(self, event):
|
||||
#dc = wx.BufferedPaintDC(self.DrawPanel, self._Buffer)
|
||||
dc = wx.PaintDC(self.DrawPanel)
|
||||
dc.DrawBitmap(self._Buffer, (0,0))
|
||||
dc.DrawBitmap(self._Buffer, 0,0)
|
||||
|
||||
def Draw(self):
|
||||
"""
|
||||
@ -991,7 +991,8 @@ class FloatCanvas(wx.Panel):
|
||||
i+=1
|
||||
Object._Draw(dc,self.WorldToPixel,self.ScaleFunction)
|
||||
if i % self.NumBetweenBlits == 0:
|
||||
ScreenDC.Blit((0, 0), self.PanelSize, dc, (0, 0))
|
||||
w,h = self.PanelSize
|
||||
ScreenDC.Blit(0, 0, w,h, dc, 0, 0)
|
||||
dc.EndDrawing()
|
||||
else:
|
||||
dc.Clear()
|
||||
@ -1006,7 +1007,8 @@ class FloatCanvas(wx.Panel):
|
||||
i+=1
|
||||
Object._Draw(dc,self.WorldToPixel,self.ScaleFunction)
|
||||
if i % self.NumBetweenBlits == 0:
|
||||
ScreenDC.Blit((0, 0), self.PanelSize, dc, (0, 0))
|
||||
w, h = self.PanelSize
|
||||
ScreenDC.Blit(0, 0, w,h, dc, 0, 0)
|
||||
dc.EndDrawing()
|
||||
else: # not using a Background DC
|
||||
dc = wx.MemoryDC()
|
||||
@ -1022,25 +1024,27 @@ class FloatCanvas(wx.Panel):
|
||||
i+=1
|
||||
Object._Draw(dc,self.WorldToPixel,self.ScaleFunction)
|
||||
if i % self.NumBetweenBlits == 0:
|
||||
ScreenDC.Blit((0, 0), self.PanelSize, dc, (0, 0))
|
||||
w, h = self.PanelSize
|
||||
ScreenDC.Blit(0, 0, w, h, dc, 0, 0)
|
||||
dc.EndDrawing()
|
||||
else:
|
||||
dc.Clear()
|
||||
# now refresh the screen
|
||||
#ScreenDC.DrawBitmap(self._Buffer,0,0) #NOTE: uisng DrawBitmap didn't work right on MSW
|
||||
ScreenDC.Blit((0, 0), self.PanelSize, dc, (0, 0))
|
||||
w, h = self.PanelSize
|
||||
ScreenDC.Blit(0, 0, w, h, dc, 0, 0)
|
||||
|
||||
# If the canvas is in the middle of a zoom or move, the Rubber Band box needs to be re-drawn
|
||||
if self.PrevRBBox:
|
||||
ScreenDC.SetPen(wx.Pen('WHITE', 2,wx.SHORT_DASH))
|
||||
ScreenDC.SetBrush(wx.TRANSPARENT_BRUSH)
|
||||
ScreenDC.SetLogicalFunction(wx.XOR)
|
||||
ScreenDC.DrawRectangleXY(*self.PrevRBBox)
|
||||
ScreenDC.DrawRectangle(*self.PrevRBBox)
|
||||
elif self.PrevMoveBox:
|
||||
ScreenDC.SetPen(wx.Pen('WHITE', 1,))
|
||||
ScreenDC.SetBrush(wx.TRANSPARENT_BRUSH)
|
||||
ScreenDC.SetLogicalFunction(wx.XOR)
|
||||
ScreenDC.DrawRectangleXY(*self.PrevMoveBox)
|
||||
ScreenDC.DrawRectangle(*self.PrevMoveBox)
|
||||
if self.Debug: print "Drawing took %f seconds of CPU time"%(clock()-start)
|
||||
|
||||
def BBCheck(self, BB1, BB2):
|
||||
|
@ -159,12 +159,12 @@ class ColDragWindow(wx.Window):
|
||||
def OnPaint(self,evt):
|
||||
dc = wx.PaintDC(self)
|
||||
w,h = self.GetSize()
|
||||
dc.DrawBitmap(self.image, (0,0))
|
||||
dc.DrawBitmap(self.image, 0,0)
|
||||
dc.SetPen(wx.Pen(wx.BLACK,1,wx.SOLID))
|
||||
dc.SetBrush(wx.TRANSPARENT_BRUSH)
|
||||
dc.DrawRectangle((0,0), (w,h))
|
||||
dc.DrawRectangle(0,0, w,h)
|
||||
iPos = self.GetInsertionPos()
|
||||
dc.DrawLine((iPos,h - 10), (iPos,h))
|
||||
dc.DrawLine(iPos,h - 10, iPos,h)
|
||||
|
||||
|
||||
|
||||
@ -222,12 +222,12 @@ class RowDragWindow(wx.Window):
|
||||
def OnPaint(self,evt):
|
||||
dc = wx.PaintDC(self)
|
||||
w,h = self.GetSize()
|
||||
dc.DrawBitmap(self.image, (0,0))
|
||||
dc.DrawBitmap(self.image, 0,0)
|
||||
dc.SetPen(wx.Pen(wx.BLACK,1,wx.SOLID))
|
||||
dc.SetBrush(wx.TRANSPARENT_BRUSH)
|
||||
dc.DrawRectangle((0,0), (w,h))
|
||||
dc.DrawRectangle(0,0, w,h)
|
||||
iPos = self.GetInsertionPos()
|
||||
dc.DrawLine((w - 10,iPos), (w,iPos))
|
||||
dc.DrawLine(w - 10,iPos, w,iPos)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
@ -346,7 +346,7 @@ class GridColMover(wx.EvtHandler):
|
||||
memdc = wx.MemoryDC()
|
||||
memdc.SelectObject(bmp)
|
||||
dc = wx.WindowDC(self.lwin)
|
||||
memdc.Blit((0,0), rect.GetSize(), dc, rect.GetPosition())
|
||||
memdc.Blit(0,0, rect.width, rect.height, dc, rect.x, rect.y)
|
||||
memdc.SelectObject(wx.NullBitmap)
|
||||
return bmp
|
||||
|
||||
@ -469,7 +469,7 @@ class GridRowMover(wx.EvtHandler):
|
||||
memdc = wx.MemoryDC()
|
||||
memdc.SelectObject(bmp)
|
||||
dc = wx.WindowDC(self.lwin)
|
||||
memdc.Blit((0,0), rect.GetSize(), dc, rect.GetPosition())
|
||||
memdc.Blit(0,0, rect.width, rect.height, dc, rect.x, rect.y)
|
||||
memdc.SelectObject(wx.NullBitmap)
|
||||
return bmp
|
||||
|
||||
|
@ -82,7 +82,7 @@ class ImageView(wx.Window):
|
||||
brush = wx.Brush(wx.NamedColour(self.back_color), wx.SOLID)
|
||||
dc.SetBrush(brush)
|
||||
dc.SetPen(wx.Pen(wx.NamedColour(self.border_color), 1))
|
||||
dc.DrawRectangle((0, 0), (self.image_sizex, self.image_sizey))
|
||||
dc.DrawRectangle(0, 0, self.image_sizex, self.image_sizey)
|
||||
|
||||
def DrawImage(self, dc):
|
||||
try:
|
||||
@ -113,7 +113,7 @@ class ImageView(wx.Window):
|
||||
image.Rescale(iwidth, iheight) # rescale to fit the window
|
||||
image.ConvertToBitmap()
|
||||
bmp = image.ConvertToBitmap()
|
||||
dc.DrawBitmap(bmp, (diffx, diffy)) # draw the image to window
|
||||
dc.DrawBitmap(bmp, diffx, diffy) # draw the image to window
|
||||
|
||||
|
||||
class ImageDialog(wx.Dialog):
|
||||
|
@ -610,13 +610,13 @@ class MultiCreator(wx.Window):
|
||||
|
||||
# Draw outline
|
||||
dc.SetPen(highlight)
|
||||
dc.DrawLine((0,0), (0,h))
|
||||
dc.DrawLine((0,0), (w,0))
|
||||
dc.DrawLine(0,0, 0,h)
|
||||
dc.DrawLine(0,0, w,0)
|
||||
dc.SetPen(black)
|
||||
dc.DrawLine((0,h), (w+1,h))
|
||||
dc.DrawLine((w,0), (w,h))
|
||||
dc.DrawLine(0,h, w+1,h)
|
||||
dc.DrawLine(w,0, w,h)
|
||||
dc.SetPen(shadow)
|
||||
dc.DrawLine((w-1,2), (w-1,h))
|
||||
dc.DrawLine(w-1,2, w-1,h)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
@ -692,11 +692,11 @@ def DrawSash(win,x,y,direction):
|
||||
bmp = wx.EmptyBitmap(8,8)
|
||||
bdc = wx.MemoryDC()
|
||||
bdc.SelectObject(bmp)
|
||||
bdc.DrawRectangle((-1,-1), (10,10))
|
||||
bdc.DrawRectangle(-1,-1, 10,10)
|
||||
for i in range(8):
|
||||
for j in range(8):
|
||||
if ((i + j) & 1):
|
||||
bdc.DrawPoint((i,j))
|
||||
bdc.DrawPoint(i,j)
|
||||
|
||||
brush = wx.Brush(wx.Colour(0,0,0))
|
||||
brush.SetStipple(bmp)
|
||||
@ -726,8 +726,8 @@ def DrawSash(win,x,y,direction):
|
||||
h = body_h
|
||||
|
||||
if direction == MV_HOR:
|
||||
dc.DrawRectangle((x,y-2), (w,4))
|
||||
dc.DrawRectangle(x,y-2, w,4)
|
||||
else:
|
||||
dc.DrawRectangle((x-2,y), (4,h))
|
||||
dc.DrawRectangle(x-2,y, 4,h)
|
||||
|
||||
dc.EndDrawingOnTop()
|
||||
|
@ -608,14 +608,14 @@ class TreePainter(Painter):
|
||||
mem_dc.SelectObject(self.GetBuffer())
|
||||
mem_dc.SetPen(self.GetBackgroundPen())
|
||||
mem_dc.SetBrush(self.GetBackgroundBrush())
|
||||
mem_dc.DrawRectangle((0, 0), (size[0], size[1]))
|
||||
mem_dc.DrawRectangle(0, 0, size[0], size[1])
|
||||
mem_dc.SetFont(self.tree.GetFont())
|
||||
self.paintWalk(node, mem_dc)
|
||||
else:
|
||||
mem_dc.SelectObject(self.GetBuffer())
|
||||
xstart, ystart = self.tree.CalcUnscrolledPosition(0,0)
|
||||
size = self.tree.GetClientSizeTuple()
|
||||
dc.Blit((xstart, ystart), (size[0], size[1]), mem_dc, (xstart, ystart))
|
||||
dc.Blit(xstart, ystart, size[0], size[1], mem_dc, xstart, ystart)
|
||||
else:
|
||||
if node == self.tree.currentRoot:
|
||||
self.knobs = []
|
||||
@ -624,7 +624,7 @@ class TreePainter(Painter):
|
||||
dc.SetBrush(self.GetBackgroundBrush())
|
||||
dc.SetFont(self.tree.GetFont())
|
||||
if paintBackground:
|
||||
dc.DrawRectangle((0, 0), (size[0], size[1]))
|
||||
dc.DrawRectangle(0, 0, size[0], size[1])
|
||||
if node:
|
||||
#Call with not paintBackground because if we are told not to paint the
|
||||
#whole background, we have to paint in parts to undo selection coloring.
|
||||
@ -652,23 +652,23 @@ class TreePainter(Painter):
|
||||
if (not self.tree.model.IsLeaf(kid.data)) or ((kid.expanded or self.tree._assumeChildren) and len(kid.kids)):
|
||||
dc.SetPen(self.linepen)
|
||||
dc.SetBrush(self.bgbrush)
|
||||
dc.DrawRectangle((px -4, py-4), (9, 9))
|
||||
dc.DrawRectangle(px -4, py-4, 9, 9)
|
||||
self.knobs.append( (kid, Rect(px -4, py -4, 9, 9)) )
|
||||
dc.SetPen(self.textpen)
|
||||
if not kid.expanded:
|
||||
dc.DrawLine((px, py -2), (px, py + 3))
|
||||
dc.DrawLine((px -2, py), (px + 3, py))
|
||||
dc.DrawLine(px, py -2, px, py + 3)
|
||||
dc.DrawLine(px -2, py, px + 3, py)
|
||||
if node == self.tree.currentRoot:
|
||||
px = (node.projx - self.tree.layout.NODE_STEP) + 5
|
||||
py = node.projy + node.height/2
|
||||
dc.SetPen(self.linepen)
|
||||
dc.SetBrush(self.bgbrush)
|
||||
dc.DrawRectangle((px -4, py-4), (9, 9))
|
||||
dc.DrawRectangle(px -4, py-4, 9, 9)
|
||||
self.knobs.append( (node, Rect(px -4, py -4, 9, 9)) )
|
||||
dc.SetPen(self.textpen)
|
||||
if not node.expanded:
|
||||
dc.DrawLine((px, py -2), (px, py + 3))
|
||||
dc.DrawLine((px -2, py), (px + 3, py))
|
||||
dc.DrawLine(px, py -2, px, py + 3)
|
||||
dc.DrawLine(px -2, py, px + 3, py)
|
||||
return True
|
||||
|
||||
def OnMouse(self, evt):
|
||||
@ -684,14 +684,14 @@ class TreeNodePainter(NodePainter):
|
||||
dc.SetPen(self.painter.GetLinePen())
|
||||
dc.SetBrush(self.painter.GetForegroundBrush())
|
||||
dc.SetTextForeground(wx.NamedColour("WHITE"))
|
||||
dc.DrawRectangle((node.projx -1, node.projy -1), (node.width + 3, node.height + 3))
|
||||
dc.DrawRectangle(node.projx -1, node.projy -1, node.width + 3, node.height + 3)
|
||||
else:
|
||||
if drawRects:
|
||||
dc.SetBrush(self.painter.GetBackgroundBrush())
|
||||
dc.SetPen(self.painter.GetBackgroundPen())
|
||||
dc.DrawRectangle((node.projx -1, node.projy -1), (node.width + 3, node.height + 3))
|
||||
dc.DrawRectangle(node.projx -1, node.projy -1, node.width + 3, node.height + 3)
|
||||
dc.SetTextForeground(self.painter.GetTextColour())
|
||||
dc.DrawText(text, (node.projx, node.projy))
|
||||
dc.DrawText(text, node.projx, node.projy)
|
||||
self.painter.rectangles.append((node, Rect(node.projx, node.projy, node.width, node.height)))
|
||||
|
||||
class TreeLinePainter(LinePainter):
|
||||
@ -703,14 +703,14 @@ class TreeLinePainter(LinePainter):
|
||||
py = child.projy + self.painter.tree.layout.NODE_HEIGHT/2 -2
|
||||
cx = child.projx
|
||||
cy = py
|
||||
dc.DrawLine((px, py), (cx, cy))
|
||||
dc.DrawLine(px, py, cx, cy)
|
||||
else:
|
||||
px = parent.projx + 5
|
||||
py = parent.projy + parent.height
|
||||
cx = child.projx -5
|
||||
cy = child.projy + self.painter.tree.layout.NODE_HEIGHT/2 -3
|
||||
dc.DrawLine((px, py), (px, cy))
|
||||
dc.DrawLine((px, cy), (cx, cy))
|
||||
dc.DrawLine(px, py, px, cy)
|
||||
dc.DrawLine(px, cy, cx, cy)
|
||||
|
||||
#>> Event defs
|
||||
wxEVT_MVCTREE_BEGIN_EDIT = wx.NewEventType() #Start editing. Vetoable.
|
||||
|
@ -978,7 +978,7 @@ class PlotCanvas(wx.Window):
|
||||
dc.SetPen(wx.Pen(wx.BLACK))
|
||||
dc.SetBrush(wx.Brush( wx.WHITE, wx.TRANSPARENT ) )
|
||||
dc.SetLogicalFunction(wx.INVERT)
|
||||
dc.DrawRectangle( (ptx,pty), (rectWidth,rectHeight))
|
||||
dc.DrawRectangle( ptx,pty, rectWidth,rectHeight)
|
||||
dc.SetLogicalFunction(wx.COPY)
|
||||
dc.EndDrawing()
|
||||
|
||||
@ -1204,16 +1204,16 @@ class FloatDCWrapper:
|
||||
self.theDC = aDC
|
||||
|
||||
def DrawLine(self, x1,y1,x2,y2):
|
||||
self.theDC.DrawLine((int(x1),int(y1)),(int(x2),int(y2)))
|
||||
self.theDC.DrawLine(int(x1),int(y1), int(x2),int(y2))
|
||||
|
||||
def DrawText(self, txt, x, y):
|
||||
self.theDC.DrawText(txt, (int(x), int(y)))
|
||||
self.theDC.DrawText(txt, int(x), int(y))
|
||||
|
||||
def DrawRotatedText(self, txt, x, y, angle):
|
||||
self.theDC.DrawRotatedText(txt, (int(x), int(y)), angle)
|
||||
self.theDC.DrawRotatedText(txt, int(x), int(y), angle)
|
||||
|
||||
def SetClippingRegion(self, x, y, width, height):
|
||||
self.theDC.SetClippingRegion((int(x), int(y)), (int(width), int(height)))
|
||||
self.theDC.SetClippingRegion(int(x), int(y), int(width), int(height))
|
||||
|
||||
def SetDeviceOrigin(self, x, y):
|
||||
self.theDC.SetDeviceOrigin(int(x), int(y))
|
||||
|
@ -104,8 +104,8 @@ class PopButton(wx.PyControl):
|
||||
else:
|
||||
dc.SetPen(self.shadowPen)
|
||||
for i in range(2):
|
||||
dc.DrawLine((x1+i, y1), (x1+i, y2-i))
|
||||
dc.DrawLine((x1, y1+i), (x2-i, y1+i))
|
||||
dc.DrawLine(x1+i, y1, x1+i, y2-i)
|
||||
dc.DrawLine(x1, y1+i, x2-i, y1+i)
|
||||
|
||||
# draw the lower right sides
|
||||
if self.up:
|
||||
@ -113,20 +113,20 @@ class PopButton(wx.PyControl):
|
||||
else:
|
||||
dc.SetPen(self.highlightPen)
|
||||
for i in range(2):
|
||||
dc.DrawLine((x1+i, y2-i), (x2+1, y2-i))
|
||||
dc.DrawLine((x2-i, y1+i), (x2-i, y2))
|
||||
dc.DrawLine(x1+i, y2-i, x2+1, y2-i)
|
||||
dc.DrawLine(x2-i, y1+i, x2-i, y2)
|
||||
|
||||
def DrawArrow(self,dc):
|
||||
w, h = self.GetSize()
|
||||
mx = w / 2
|
||||
my = h / 2
|
||||
dc.SetPen(self.highlightPen)
|
||||
dc.DrawLine((mx-5,my-5), (mx+5,my-5))
|
||||
dc.DrawLine((mx-5,my-5), (mx,my+5))
|
||||
dc.DrawLine(mx-5,my-5, mx+5,my-5)
|
||||
dc.DrawLine(mx-5,my-5, mx,my+5)
|
||||
dc.SetPen(self.shadowPen)
|
||||
dc.DrawLine((mx+4,my-5), (mx,my+5))
|
||||
dc.DrawLine(mx+4,my-5, mx,my+5)
|
||||
dc.SetPen(self.blackPen)
|
||||
dc.DrawLine((mx+5,my-5), (mx,my+5))
|
||||
dc.DrawLine(mx+5,my-5, mx,my+5)
|
||||
|
||||
def OnPaint(self, event):
|
||||
width, height = self.GetClientSize()
|
||||
|
@ -60,18 +60,18 @@ class PrintBase:
|
||||
if self.draw == True and txtdraw == True:
|
||||
test_out = self.TestFull(vout)
|
||||
if self.align == wx.ALIGN_LEFT:
|
||||
self.DC.DrawText(test_out, (self.indent+self.pcell_left_margin, y))
|
||||
self.DC.DrawText(test_out, self.indent+self.pcell_left_margin, y)
|
||||
|
||||
elif self.align == wx.ALIGN_CENTRE:
|
||||
diff = self.GetCellDiff(test_out, self.region)
|
||||
self.DC.DrawText(test_out, (self.indent+diff/2, y))
|
||||
self.DC.DrawText(test_out, self.indent+diff/2, y)
|
||||
|
||||
elif self.align == wx.ALIGN_RIGHT:
|
||||
diff = self.GetCellDiff(test_out, self.region)
|
||||
self.DC.DrawText(test_out, (self.indent+diff, y))
|
||||
self.DC.DrawText(test_out, self.indent+diff, y)
|
||||
|
||||
else:
|
||||
self.DC.DrawText(test_out, (self.indent+self.pcell_left_margin, y))
|
||||
self.DC.DrawText(test_out, self.indent+self.pcell_left_margin, y)
|
||||
text = remain
|
||||
y = y + self.space
|
||||
return y - self.space + self.pt_space_after
|
||||
@ -148,18 +148,18 @@ class PrintBase:
|
||||
if self.draw == True and txtdraw == True:
|
||||
test_out = vout
|
||||
if align == wx.ALIGN_LEFT:
|
||||
self.DC.DrawText(test_out, (indent, y))
|
||||
self.DC.DrawText(test_out, indent, y)
|
||||
|
||||
elif align == wx.ALIGN_CENTRE:
|
||||
diff = self.GetCellDiff(test_out, pagew)
|
||||
self.DC.DrawText(test_out, (indent+diff/2, y))
|
||||
self.DC.DrawText(test_out, indent+diff/2, y)
|
||||
|
||||
elif align == wx.ALIGN_RIGHT:
|
||||
diff = self.GetCellDiff(test_out, pagew)
|
||||
self.DC.DrawText(test_out, (indent+diff, y))
|
||||
self.DC.DrawText(test_out, indent+diff, y)
|
||||
|
||||
else:
|
||||
self.DC.DrawText(test_out, (indent, y_out))
|
||||
self.DC.DrawText(test_out, indent, y_out)
|
||||
text = remain
|
||||
y = y + y_line
|
||||
return y - y_line
|
||||
@ -496,8 +496,8 @@ class PrintTableDraw(wx.ScrolledWindow, PrintBase):
|
||||
brush = wx.Brush(colour, wx.SOLID)
|
||||
self.DC.SetBrush(brush)
|
||||
height = self.label_space + self.label_pt_space_before + self.label_pt_space_after
|
||||
self.DC.DrawRectangle((self.column[0], self.y),
|
||||
(self.end_x-self.column[0]+1, height))
|
||||
self.DC.DrawRectangle(self.column[0], self.y,
|
||||
self.end_x-self.column[0]+1, height)
|
||||
|
||||
def ColourRowCells(self, height):
|
||||
if self.draw == False:
|
||||
@ -515,7 +515,7 @@ class PrintTableDraw(wx.ScrolledWindow, PrintBase):
|
||||
|
||||
start_x = self.column[col]
|
||||
width = self.column[col+1] - start_x + 2
|
||||
self.DC.DrawRectangle((start_x, self.y), (width, height))
|
||||
self.DC.DrawRectangle(start_x, self.y, width, height)
|
||||
col = col + 1
|
||||
|
||||
def PrintRow(self, row_val, draw = True, align = wx.ALIGN_LEFT):
|
||||
@ -586,7 +586,7 @@ class PrintTableDraw(wx.ScrolledWindow, PrintBase):
|
||||
|
||||
y_out = self.y
|
||||
# y_out = self.y + self.pt_space_before + self.pt_space_after # adjust for extra spacing
|
||||
self.DC.DrawLine((self.column[0], y_out), (self.end_x, y_out))
|
||||
self.DC.DrawLine(self.column[0], y_out, self.end_x, y_out)
|
||||
|
||||
def DrawColumns(self):
|
||||
if self.draw == True:
|
||||
@ -605,7 +605,7 @@ class PrintTableDraw(wx.ScrolledWindow, PrintBase):
|
||||
indent = val
|
||||
|
||||
self.DC.SetPen(wx.Pen(colour, size))
|
||||
self.DC.DrawLine((indent, self.y_start), (indent, self.y))
|
||||
self.DC.DrawLine(indent, self.y_start, indent, self.y)
|
||||
col = col + 1
|
||||
|
||||
def DrawText(self):
|
||||
|
@ -113,7 +113,7 @@ class RowColSizer(wx.PySizer):
|
||||
assert row != -1, "Row must be specified"
|
||||
assert col != -1, "Column must be specified"
|
||||
|
||||
wx.PySizer.AddSpacer(self, (width, height), option, flag, border,
|
||||
wx.PySizer.Add(self, (width, height), option, flag, border,
|
||||
userData=(row, col, row+rowspan, col+colspan))
|
||||
|
||||
#--------------------------------------------------
|
||||
|
@ -89,17 +89,17 @@ class RightTextCtrl(wx.TextCtrl):
|
||||
dc.SetTextForeground(fclr)
|
||||
|
||||
dc.SetClippingRegion((0, 0), (dcwidth, dcheight))
|
||||
dc.DrawText(text, (x, y))
|
||||
dc.DrawText(text, x, y)
|
||||
|
||||
if x < 0:
|
||||
toofat = '...'
|
||||
markwidth = dc.GetTextExtent(toofat)[0]
|
||||
dc.SetPen(wx.Pen(dc.GetBackground().GetColour(), 1, wx.SOLID ))
|
||||
dc.DrawRectangle((0,0), (markwidth, dcheight))
|
||||
dc.DrawRectangle(0,0, markwidth, dcheight)
|
||||
dc.SetPen(wx.Pen(wx.RED, 1, wx.SOLID ))
|
||||
dc.SetBrush(wx.TRANSPARENT_BRUSH)
|
||||
dc.DrawRectangle((1, 1), (dcwidth-2, dcheight-2))
|
||||
dc.DrawText(toofat, (1, y))
|
||||
dc.DrawRectangle(1, 1, dcwidth-2, dcheight-2)
|
||||
dc.DrawText(toofat, 1, y)
|
||||
|
||||
|
||||
def OnKillFocus(self, event):
|
||||
|
@ -93,7 +93,7 @@ class SplashScreen(wx.Frame):
|
||||
|
||||
def OnPaint(self, event):
|
||||
dc = wx.PaintDC(self)
|
||||
dc.DrawBitmap(self.bitmap, (0,0), False)
|
||||
dc.DrawBitmap(self.bitmap, 0,0, False)
|
||||
|
||||
def OnEraseBG(self, event):
|
||||
pass
|
||||
|
@ -131,7 +131,7 @@ class GenStaticText(wx.PyControl):
|
||||
x = width - w
|
||||
if style & wx.ALIGN_CENTER:
|
||||
x = (width - w)/2
|
||||
dc.DrawText(line, (x, y))
|
||||
dc.DrawText(line, x, y)
|
||||
y += h
|
||||
|
||||
|
||||
|
@ -143,13 +143,13 @@ class Throbber(wx.PyPanel):
|
||||
|
||||
|
||||
def Draw(self, dc):
|
||||
dc.DrawBitmap(self.submaps[self.sequence[self.current]], (0, 0), True)
|
||||
dc.DrawBitmap(self.submaps[self.sequence[self.current]], 0, 0, True)
|
||||
if self.overlay and self.showOverlay:
|
||||
dc.DrawBitmap(self.overlay, (self.overlayX, self.overlayY), True)
|
||||
dc.DrawBitmap(self.overlay, self.overlayX, self.overlayY, True)
|
||||
if self.label and self.showLabel:
|
||||
dc.DrawText(self.label, (self.labelX, self.labelY))
|
||||
dc.DrawText(self.label, self.labelX, self.labelY)
|
||||
dc.SetTextForeground(wx.WHITE)
|
||||
dc.DrawText(self.label, (self.labelX-1, self.labelY-1))
|
||||
dc.DrawText(self.label, self.labelX-1, self.labelY-1)
|
||||
|
||||
|
||||
def OnPaint(self, event):
|
||||
|
@ -135,7 +135,7 @@ class PolyMarker(PolyPoints):
|
||||
f(dc, xc, yc, size)
|
||||
|
||||
def _circle(self, dc, xc, yc, size=1):
|
||||
dc.DrawEllipse((xc-2.5*size,yc-2.5*size), (5.*size,5.*size))
|
||||
dc.DrawEllipse(xc-2.5*size,yc-2.5*size, 5.*size,5.*size)
|
||||
|
||||
def _dot(self, dc, xc, yc, size=1):
|
||||
dc.DrawPoint(xc,yc)
|
||||
@ -154,12 +154,12 @@ class PolyMarker(PolyPoints):
|
||||
(0.0,0.577350*size*5)],xc,yc)
|
||||
|
||||
def _cross(self, dc, xc, yc, size=1):
|
||||
dc.DrawLine((xc-2.5*size, yc-2.5*size), (xc+2.5*size,yc+2.5*size))
|
||||
dc.DrawLine((xc-2.5*size,yc+2.5*size), (xc+2.5*size,yc-2.5*size))
|
||||
dc.DrawLine(xc-2.5*size, yc-2.5*size, xc+2.5*size,yc+2.5*size)
|
||||
dc.DrawLine(xc-2.5*size,yc+2.5*size, xc+2.5*size,yc-2.5*size)
|
||||
|
||||
def _plus(self, dc, xc, yc, size=1):
|
||||
dc.DrawLine((xc-2.5*size,yc), (xc+2.5*size,yc))
|
||||
dc.DrawLine((xc,yc-2.5*size,xc), (yc+2.5*size))
|
||||
dc.DrawLine(xc-2.5*size,yc, xc+2.5*size,yc)
|
||||
dc.DrawLine(xc,yc-2.5*size,xc, yc+2.5*size)
|
||||
|
||||
class PlotGraphics:
|
||||
|
||||
@ -318,12 +318,12 @@ class PlotCanvas(wx.Window):
|
||||
for y, d in [(bb1[1], -3), (bb2[1], 3)]:
|
||||
p1 = scale*Numeric.array([lower, y])+shift
|
||||
p2 = scale*Numeric.array([upper, y])+shift
|
||||
dc.DrawLine((p1[0],p1[1]), (p2[0],p2[1]))
|
||||
dc.DrawLine(p1[0],p1[1], p2[0],p2[1])
|
||||
for x, label in xticks:
|
||||
p = scale*Numeric.array([x, y])+shift
|
||||
dc.DrawLine((p[0],p[1]), (p[0],p[1]+d))
|
||||
dc.DrawLine(p[0],p[1], p[0],p[1]+d)
|
||||
if text:
|
||||
dc.DrawText(label, (p[0],p[1]))
|
||||
dc.DrawText(label, p[0],p[1])
|
||||
text = 0
|
||||
|
||||
if yaxis is not None:
|
||||
@ -333,13 +333,13 @@ class PlotCanvas(wx.Window):
|
||||
for x, d in [(bb1[0], -3), (bb2[0], 3)]:
|
||||
p1 = scale*Numeric.array([x, lower])+shift
|
||||
p2 = scale*Numeric.array([x, upper])+shift
|
||||
dc.DrawLine((p1[0],p1[1]), (p2[0],p2[1]))
|
||||
dc.DrawLine(p1[0],p1[1], p2[0],p2[1])
|
||||
for y, label in yticks:
|
||||
p = scale*Numeric.array([x, y])+shift
|
||||
dc.DrawLine((p[0],p[1]), (p[0]-d,p[1]))
|
||||
dc.DrawLine(p[0],p[1], p[0]-d,p[1])
|
||||
if text:
|
||||
dc.DrawText(label,
|
||||
(p[0]-dc.GetTextExtent(label)[0], p[1]-0.5*h))
|
||||
p[0]-dc.GetTextExtent(label)[0], p[1]-0.5*h)
|
||||
text = 0
|
||||
|
||||
def _ticks(self, lower, upper):
|
||||
|
@ -645,7 +645,6 @@ wxImageFromMime = wx._core.ImageFromMime
|
||||
wxImageFromStream = wx._core.ImageFromStream
|
||||
wxImageFromStreamMime = wx._core.ImageFromStreamMime
|
||||
wxEmptyImage = wx._core.EmptyImage
|
||||
wxEmptyImage = wx._core.EmptyImage
|
||||
wxImageFromBitmap = wx._core.ImageFromBitmap
|
||||
wxImageFromData = wx._core.ImageFromData
|
||||
wxImage_CanRead = wx._core.Image_CanRead
|
||||
|
@ -33,12 +33,11 @@ wxBrush = wx._gdi.Brush
|
||||
wxBrushPtr = wx._gdi.BrushPtr
|
||||
wxBitmap = wx._gdi.Bitmap
|
||||
wxBitmapPtr = wx._gdi.BitmapPtr
|
||||
wxEmptyBitmap = wx._gdi.EmptyBitmap
|
||||
wxBitmapFromIcon = wx._gdi.BitmapFromIcon
|
||||
wxBitmapFromImage = wx._gdi.BitmapFromImage
|
||||
wxBitmapFromXPMData = wx._gdi.BitmapFromXPMData
|
||||
wxBitmapFromBits = wx._gdi.BitmapFromBits
|
||||
wxEmptyBitmap = wx._gdi.EmptyBitmap
|
||||
wxEmptyBitmap = wx._gdi.EmptyBitmap
|
||||
wxMask = wx._gdi.Mask
|
||||
wxMaskPtr = wx._gdi.MaskPtr
|
||||
wxIcon = wx._gdi.Icon
|
||||
@ -576,18 +575,6 @@ wxTheBrushList = wx._gdi.TheBrushList
|
||||
wxTheColourDatabase = wx._gdi.TheColourDatabase
|
||||
wxEffects = wx._gdi.Effects
|
||||
wxEffectsPtr = wx._gdi.EffectsPtr
|
||||
wxDC_old = wx._gdi.DC_old
|
||||
wxMemoryDC_old = wx._gdi.MemoryDC_old
|
||||
wxBufferedDC_old = wx._gdi.BufferedDC_old
|
||||
wxBufferedPaintDC_old = wx._gdi.BufferedPaintDC_old
|
||||
wxScreenDC_old = wx._gdi.ScreenDC_old
|
||||
wxClientDC_old = wx._gdi.ClientDC_old
|
||||
wxPaintDC_old = wx._gdi.PaintDC_old
|
||||
wxWindowDC_old = wx._gdi.WindowDC_old
|
||||
wxMirrorDC_old = wx._gdi.MirrorDC_old
|
||||
wxPostScriptDC_old = wx._gdi.PostScriptDC_old
|
||||
wxMetaFileDC_old = wx._gdi.MetaFileDC_old
|
||||
wxPrinterDC_old = wx._gdi.PrinterDC_old
|
||||
wxMaskColour = wx._gdi.MaskColour
|
||||
|
||||
|
||||
|
@ -35,21 +35,3 @@ def wxPyTypeCast(obj, typeStr):
|
||||
wxPy_isinstance = isinstance
|
||||
|
||||
|
||||
|
||||
# The wx*DC_old classes have Draw* method signatures that are mostly
|
||||
# compatible with 2.4, so assign the new classes to wx*DC_new and make
|
||||
# the _old classes be the defaults with the normal names.
|
||||
|
||||
wxDC_new = wxDC; wxDC = wxDC_old
|
||||
wxMemoryDC_new = wxMemoryDC; wxMemoryDC = wxMemoryDC_old
|
||||
wxBufferedDC_new = wxBufferedDC; wxBufferedDC = wxBufferedDC_old
|
||||
wxBufferedPaintDC_new = wxBufferedPaintDC; wxBufferedPaintDC = wxBufferedPaintDC_old
|
||||
wxScreenDC_new = wxScreenDC; wxScreenDC = wxScreenDC_old
|
||||
wxClientDC_new = wxClientDC; wxClientDC = wxClientDC_old
|
||||
wxPaintDC_new = wxPaintDC; wxPaintDC = wxPaintDC_old
|
||||
wxWindowDC_new = wxWindowDC; wxWindowDC = wxWindowDC_old
|
||||
wxMirrorDC_new = wxMirrorDC; wxMirrorDC = wxMirrorDC_old
|
||||
wxPostScriptDC_new = wxPostScriptDC; wxPostScriptDC = wxPostScriptDC_old
|
||||
wxMetaFileDC_new = wxMetaFileDC; wxMetaFileDC = wxMetaFileDC_old
|
||||
wxPrinterDC_new = wxPrinterDC; wxPrinterDC = wxPrinterDC_old
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user