Merge branch 'wxWidgets:master' into master

This commit is contained in:
arjones6
2023-06-02 17:04:59 -04:00
committed by GitHub
19 changed files with 117 additions and 96 deletions

View File

@@ -4610,8 +4610,8 @@ class AuiNotebook(wx.Panel):
# because there are two panes, always split them
# equally
split_size = self.GetClientSize()
split_size.x /= 2
split_size.y /= 2
split_size.x //= 2
split_size.y //= 2
# create a new tab frame
new_tabs = TabFrame(self)
@@ -4638,22 +4638,22 @@ class AuiNotebook(wx.Panel):
if direction == wx.LEFT:
pane_info.Left()
mouse_pt = wx.Point(0, cli_size.y/2)
mouse_pt = wx.Point(0, cli_size.y//2)
elif direction == wx.RIGHT:
pane_info.Right()
mouse_pt = wx.Point(cli_size.x, cli_size.y/2)
mouse_pt = wx.Point(cli_size.x, cli_size.y//2)
elif direction == wx.TOP:
pane_info.Top()
mouse_pt = wx.Point(cli_size.x/2, 0)
mouse_pt = wx.Point(cli_size.x//2, 0)
elif direction == wx.BOTTOM:
pane_info.Bottom()
mouse_pt = wx.Point(cli_size.x/2, cli_size.y)
mouse_pt = wx.Point(cli_size.x//2, cli_size.y)
self._mgr.AddPane(new_tabs, pane_info, mouse_pt)
self._mgr.Update()

View File

@@ -2232,7 +2232,7 @@ class FNBRenderer(object):
return
# Get the text height
tabHeight = self.CalcTabHeight(pageContainer)
tabHeight = int(self.CalcTabHeight(pageContainer))
agwStyle = pc.GetParent().GetAGWWindowStyleFlag()
# Calculate the number of rows required for drawing the tabs
@@ -2366,8 +2366,8 @@ class FNBRenderer(object):
# Update the tab position & size
posy = (pc.HasAGWFlag(FNB_BOTTOM) and [0] or [VERTICAL_BORDER_PADDING])[0]
pc._pagesInfoVec[i].SetPosition(wx.Point(posx, posy))
pc._pagesInfoVec[i].SetSize(wx.Size(tabWidth, tabHeight))
pc._pagesInfoVec[i].SetPosition(wx.Point(int(posx), int(posy)))
pc._pagesInfoVec[i].SetSize(wx.Size(int(tabWidth), int(tabHeight)))
self.DrawFocusRectangle(dc, pc, pc._pagesInfoVec[i])
posx += tabWidth
@@ -2461,7 +2461,7 @@ class FNBRenderer(object):
break;
# Add a result to the returned vector
tabRect = wx.Rect(posx, VERTICAL_BORDER_PADDING, tabWidth , tabHeight)
tabRect = wx.Rect(int(posx), VERTICAL_BORDER_PADDING, int(tabWidth) , int(tabHeight))
vTabInfo.append(tabRect)
# Advance posx
@@ -2567,7 +2567,7 @@ class FNBRendererDefault(FNBRenderer):
pc = pageContainer
tabPoints = [wx.Point() for ii in range(7)]
tabPoints[0].x = posx
tabPoints[0].x = int(posx)
tabPoints[0].y = (pc.HasAGWFlag(FNB_BOTTOM) and [2] or [tabHeight - 2])[0]
tabPoints[1].x = int(posx+(tabHeight-2)*math.tan(float(pc._pagesInfoVec[tabIdx].GetTabAngle())/180.0*math.pi))
@@ -2646,14 +2646,14 @@ class FNBRendererDefault(FNBRenderer):
imageXOffset = textOffset - 16 - padding
pc._ImageList.Draw(pc._pagesInfoVec[tabIdx].GetImageIndex(), dc,
posx + imageXOffset, imageYCoord,
int(posx + imageXOffset), int(imageYCoord),
wx.IMAGELIST_DRAW_TRANSPARENT, True)
pageTextColour = pc._pParent.GetPageTextColour(tabIdx)
if pageTextColour is not None:
dc.SetTextForeground(pageTextColour)
dc.DrawText(pc.GetPageText(tabIdx), posx + textOffset, imageYCoord)
dc.DrawText(pc.GetPageText(tabIdx), int(posx + textOffset), int(imageYCoord))
# draw 'x' on tab (if enabled)
if pc.HasAGWFlag(FNB_X_ON_TAB) and tabIdx == pc.GetSelection():
@@ -2777,7 +2777,7 @@ class FNBRendererFirefox2(FNBRenderer):
# take a bitmap from the position of the 'x' button (the x on tab button)
# this bitmap will be used later to delete old buttons
tabCloseButtonYCoord = imageYCoord
x_rect = wx.Rect(tabCloseButtonXCoord, tabCloseButtonYCoord, 16, 16)
x_rect = wx.Rect(int(tabCloseButtonXCoord), int(tabCloseButtonYCoord), 16, 16)
# Draw the tab
self.DrawTabX(pc, dc, x_rect, tabIdx, btnStatus)

View File

@@ -367,12 +367,12 @@ class PyGauge(wx.Window):
drawString = self._drawIndicatorText_formatString.format(drawValue)
rect = self.GetClientRect()
(textWidth, textHeight, descent, extraLeading) = dc.GetFullTextExtent(drawString)
textYPos = (rect.height-textHeight)/2
textYPos = (rect.height-textHeight)//2
if textHeight > rect.height:
textYPos = 0-descent+extraLeading
textXPos = (rect.width-textWidth)/2
textXPos = (rect.width-textWidth)//2
if textWidth>rect.width:
textXPos = 0

View File

@@ -1377,11 +1377,11 @@ class Shape(ShapeEvtHandler):
def OnDrawOutline(self, dc, x, y, w, h):
"""The draw outline handler."""
points = [[x - w / 2.0, y - h / 2.0],
[x + w / 2.0, y - h / 2.0],
[x + w / 2.0, y + h / 2.0],
[x - w / 2.0, y + h / 2.0],
[x - w / 2.0, y - h / 2.0],
points = [[int(x - w / 2.0), int(y - h / 2.0)],
[int(x + w / 2.0), int(y - h / 2.0)],
[int(x + w / 2.0), int(y + h / 2.0)],
[int(x - w / 2.0), int(y + h / 2.0)],
[int(x - w / 2.0), int(y - h / 2.0)],
]
dc.DrawLines(points)
@@ -3174,7 +3174,7 @@ class PolygonShape(Shape):
dc.SetPen(self._pen)
if self._brush:
dc.SetBrush(self._brush)
dc.DrawPolygon(self._points, self._xpos, self._ypos)
dc.DrawPolygon(self._points, int(self._xpos), int(self._ypos))
def OnDrawOutline(self, dc, x, y, w, h):
"""The draw outline handler."""
@@ -3185,8 +3185,8 @@ class PolygonShape(Shape):
intPoints = []
for point in self._originalPoints:
intPoints.append(wx.Point(x_proportion * point[0], y_proportion * point[1]))
dc.DrawPolygon(intPoints, x, y)
intPoints.append(wx.Point(int(x_proportion * point[0]), int(y_proportion * point[1])))
dc.DrawPolygon(intPoints, int(x), int(y))
# Make as many control points as there are vertices
def MakeControlPoints(self):

View File

@@ -116,7 +116,7 @@ class Diagram(object):
dc.SetPen(wx.Pen(wx.BLACK, 1, wx.PENSTYLE_DOT))
dc.SetBrush(wx.TRANSPARENT_BRUSH)
dc.DrawLines([[x1, y1], [x2, y1], [x2, y2], [x1, y2], [x1, y1]])
dc.DrawLines([[int(x1), int(y1)], [int(x2), int(y1)], [int(x2), int(y2)], [int(x1), int(y2)], [int(x1), int(y1)]])
def RecentreAll(self, dc):
"""Recentre all the text that should be centred.

View File

@@ -165,21 +165,21 @@ class OpDraw(DrawOp):
def Do(self, dc, xoffset, yoffset):
if self._op == DRAWOP_DRAW_LINE:
dc.DrawLine(self._x1 + xoffset, self._y1 + yoffset, self._x2 + xoffset, self._y2 + yoffset)
dc.DrawLine(int(self._x1 + xoffset), int(self._y1 + yoffset), int(self._x2 + xoffset), int(self._y2 + yoffset))
elif self._op == DRAWOP_DRAW_RECT:
dc.DrawRectangle(self._x1 + xoffset, self._y1 + yoffset, self._x2, self._y2)
dc.DrawRectangle(int(self._x1 + xoffset), int(self._y1 + yoffset), int(self._x2), int(self._y2))
elif self._op == DRAWOP_DRAW_ROUNDED_RECT:
dc.DrawRoundedRectangle(self._x1 + xoffset, self._y1 + yoffset, self._x2, self._y2, self._radius)
dc.DrawRoundedRectangle(int(self._x1 + xoffset), int(self._y1 + yoffset), int(self._x2), int(self._y2), self._radius)
elif self._op == DRAWOP_DRAW_ELLIPSE:
dc.DrawEllipse(self._x1 + xoffset, self._y1 + yoffset, self._x2, self._y2)
dc.DrawEllipse(int(self._x1 + xoffset), int(self._y1 + yoffset), int(self._x2), int(self._y2))
elif self._op == DRAWOP_DRAW_ARC:
dc.DrawArc(self._x2 + xoffset, self._y2 + yoffset, self._x3 + xoffset, self._y3 + yoffset, self._x1 + xoffset, self._y1 + yoffset)
dc.DrawArc(int(self._x2 + xoffset), int(self._y2 + yoffset), int(self._x3 + xoffset), int(self._y3 + yoffset), int(self._x1 + xoffset), int(self._y1 + yoffset))
elif self._op == DRAWOP_DRAW_ELLIPTIC_ARC:
dc.DrawEllipticArc(self._x1 + xoffset, self._y1 + yoffset, self._x2, self._y2, self._x3 * 360 / (2 * math.pi), self._y3 * 360 / (2 * math.pi))
dc.DrawEllipticArc(int(self._x1 + xoffset), int(self._y1 + yoffset), int(self._x2), int(self._y2), self._x3 * 360 / (2 * math.pi), self._y3 * 360 / (2 * math.pi))
elif self._op == DRAWOP_DRAW_POINT:
dc.DrawPoint(self._x1 + xoffset, self._y1 + yoffset)
elif self._op == DRAWOP_DRAW_TEXT:
dc.DrawText(self._textString, self._x1 + xoffset, self._y1 + yoffset)
dc.DrawText(self._textString, int(self._x1 + xoffset), int(self._y1 + yoffset))
def Scale(self, scaleX, scaleY):
self._x1 *= scaleX
self._y1 *= scaleY
@@ -267,9 +267,9 @@ class OpPolyDraw(DrawOp):
def Do(self, dc, xoffset, yoffset):
if self._op == DRAWOP_DRAW_POLYLINE:
dc.DrawLines(self._points, xoffset, yoffset)
dc.DrawLines(self._points, int(xoffset), int(yoffset))
elif self._op == DRAWOP_DRAW_POLYGON:
dc.DrawPolygon(self._points, xoffset, yoffset)
dc.DrawPolygon(self._points, int(xoffset), int(yoffset))
elif self._op == DRAWOP_DRAW_SPLINE:
dc.DrawSpline(self._points) # no offsets in DrawSpline

View File

@@ -528,7 +528,7 @@ def GetArrowPoints(x1, y1, x2, y2, length, width):
x3 = -length * i_bar + x2
y3 = -length * j_bar + y2
return x2, y2, width * -j_bar + x3, width * i_bar + y3, -width * -j_bar + x3, -width * i_bar + y3
return int(x2), int(y2), int(width * -j_bar + x3), int(width * i_bar + y3), int(-width * -j_bar + x3), int(-width * i_bar + y3)
def DrawArcToEllipse(x1, y1, width1, height1, x2, y2, x3, y3):