From 917d9573ea6d906e6302f960d99db637b5bafff6 Mon Sep 17 00:00:00 2001 From: Scott Talbert Date: Mar 08 2022 21:35:11 +0000 Subject: Fix even more Python 3.10 int/float issues (#2060854) --- diff --git a/7dafb83729711a834538de2faebfb42485dbece0.patch b/7dafb83729711a834538de2faebfb42485dbece0.patch new file mode 100644 index 0000000..e04c65a --- /dev/null +++ b/7dafb83729711a834538de2faebfb42485dbece0.patch @@ -0,0 +1,4830 @@ +From 7dafb83729711a834538de2faebfb42485dbece0 Mon Sep 17 00:00:00 2001 +From: Kevin Schlosser +Date: Mon, 11 Jan 2021 14:20:07 -0700 +Subject: [PATCH] Fixes floating point math in wx.lib.agw.aui + +wx.lib.agw.aui was never converted to run on Python 3 and as a result the division operator forces a conversion of the used values to a float. Floats cannot be used in functions like `range`. This caused quite number of things to not function properly and produce tracebacks. + +The other thing is when wx.lib.agw.aui was written pixels could not be rendered using coordinates that were floats so now passing floats could cause rendering alignment problems because the layout of the various bits were done so in a manner that would have the alignment correct using integers. + +(cherry picked from commit 7afcc7fbc68506b55b5bb85970871a5f3df6eac4) +--- + wx/lib/agw/aui/aui_switcherdialog.py | 4 +- + wx/lib/agw/aui/aui_utilities.py | 9 +- + wx/lib/agw/aui/auibar.py | 40 +- + wx/lib/agw/aui/auibook.py | 6 +- + wx/lib/agw/aui/framemanager.py | 1005 +++++++++----------------- + wx/lib/agw/aui/tabart.py | 104 +-- + 6 files changed, 405 insertions(+), 763 deletions(-) + +diff --git a/wx/lib/agw/aui/aui_switcherdialog.py b/wx/lib/agw/aui/aui_switcherdialog.py +index 219db3249..72604273b 100644 +--- a/wx/lib/agw/aui/aui_switcherdialog.py ++++ b/wx/lib/agw/aui/aui_switcherdialog.py +@@ -621,12 +621,12 @@ def PaintItems(self, dc, win): + and item.GetBitmap().GetHeight() <= 16: + x -= textMarginX + dc.DrawBitmap(item.GetBitmap(), x, item.GetRect().y + \ +- (item.GetRect().height - item.GetBitmap().GetHeight())/2, ++ (item.GetRect().height - item.GetBitmap().GetHeight())//2, + True) + x += 16 + textMarginX + #x += textMarginX + +- y = item.GetRect().y + (item.GetRect().height - h)/2 ++ y = item.GetRect().y + (item.GetRect().height - h)//2 + dc.DrawText(item.GetTitle(), x, y) + dc.DestroyClippingRegion() + +diff --git a/wx/lib/agw/aui/aui_utilities.py b/wx/lib/agw/aui/aui_utilities.py +index 10672b898..cbb49d3db 100644 +--- a/wx/lib/agw/aui/aui_utilities.py ++++ b/wx/lib/agw/aui/aui_utilities.py +@@ -322,9 +322,9 @@ def DarkenBitmap(bmp, caption_colour, new_colour): + """ + + image = bmp.ConvertToImage() +- red = caption_colour.Red()/float(new_colour.Red()) +- green = caption_colour.Green()/float(new_colour.Green()) +- blue = caption_colour.Blue()/float(new_colour.Blue()) ++ red = caption_colour.Red()/new_colour.Red() ++ green = caption_colour.Green()/new_colour.Green() ++ blue = caption_colour.Blue()/new_colour.Blue() + image = image.AdjustChannels(red, green, blue) + return image.ConvertToBitmap() + +@@ -656,3 +656,6 @@ def CopyAttributes(newArt, oldArt): + + return newArt + ++ ++ ++ +diff --git a/wx/lib/agw/aui/auibar.py b/wx/lib/agw/aui/auibar.py +index c04eb06a5..06eb96ec8 100644 +--- a/wx/lib/agw/aui/auibar.py ++++ b/wx/lib/agw/aui/auibar.py +@@ -981,16 +981,16 @@ def DrawLabel(self, dc, wnd, item, rect): + + if orient == AUI_TBTOOL_HORIZONTAL: + text_x = rect.x +- text_y = rect.y + (rect.height-text_height)/2 ++ text_y = rect.y + (rect.height-text_height)//2 + dc.DrawText(item.GetLabel(), text_x, text_y) + + elif orient == AUI_TBTOOL_VERT_CLOCKWISE: +- text_x = rect.x + (rect.width+text_width)/2 ++ text_x = rect.x + (rect.width+text_width)//2 + text_y = rect.y + dc.DrawRotatedText(item.GetLabel(), text_x, text_y, 270) + + elif AUI_TBTOOL_VERT_COUNTERCLOCKWISE: +- text_x = rect.x + (rect.width-text_width)/2 ++ text_x = rect.x + (rect.width-text_width)//2 + text_y = rect.y + text_height + dc.DrawRotatedText(item.GetLabel(), text_x, text_y, 90) + +@@ -1088,8 +1088,8 @@ def DrawDropDownButton(self, dc, wnd, item, rect): + dropbmp_width = dropbmp_height + dropbmp_height = tmp + +- dropbmp_x = dropdown_rect.x + (dropdown_rect.width/2) - dropbmp_width/2 +- dropbmp_y = dropdown_rect.y + (dropdown_rect.height/2) - dropbmp_height/2 ++ dropbmp_x = dropdown_rect.x + (dropdown_rect.width//2) - dropbmp_width//2 ++ dropbmp_y = dropdown_rect.y + (dropdown_rect.height//2) - dropbmp_height//2 + + bmp_rect, text_rect = self.GetToolsPosition(dc, item, button_rect) + +@@ -1173,7 +1173,7 @@ def DrawControlLabel(self, dc, wnd, item, rect): + # set the label's text colour + dc.SetTextForeground(wx.BLACK) + +- text_x = rect.x + (rect.width/2) - (text_width/2) + 1 ++ text_x = rect.x + (rect.width//2) - (text_width//2) + 1 + text_y = rect.y + rect.height - text_height - 1 + + if self._agwFlags & AUI_TB_TEXT and item.GetLabel() != "": +@@ -1266,18 +1266,18 @@ def DrawSeparator(self, dc, wnd, _rect): + + if horizontal: + +- rect.x += (rect.width/2) ++ rect.x += (rect.width//2) + rect.width = 1 +- new_height = (rect.height*3)/4 +- rect.y += (rect.height/2) - (new_height/2) ++ new_height = (rect.height*3)//4 ++ rect.y += (rect.height//2) - (new_height//2) + rect.height = new_height + + else: + +- rect.y += (rect.height/2) ++ rect.y += (rect.height//2) + rect.height = 1 +- new_width = (rect.width*3)/4 +- rect.x += (rect.width/2) - (new_width/2) ++ new_width = (rect.width*3)//4 ++ rect.x += (rect.width//2) - (new_width//2) + rect.width = new_width + + start_colour = StepColour(self._base_colour, 80) +@@ -1355,8 +1355,8 @@ def DrawOverflowButton(self, dc, wnd, rect, state): + dc.SetBrush(wx.Brush(light_gray_bg)) + dc.DrawRectangle(rect.x+1, rect.y, rect.width, rect.height) + +- x = rect.x + 1 + (rect.width-self._overflow_bmp.GetWidth())/2 +- y = rect.y + 1 + (rect.height-self._overflow_bmp.GetHeight())/2 ++ x = rect.x + 1 + (rect.width-self._overflow_bmp.GetWidth())//2 ++ y = rect.y + 1 + (rect.height-self._overflow_bmp.GetHeight())//2 + dc.DrawBitmap(self._overflow_bmp, x, y, True) + + +@@ -1488,21 +1488,21 @@ def GetToolsPosition(self, dc, item, rect): + bmp_x = bmp_y = text_x = text_y = 0 + + if horizontal and text_bottom: +- bmp_x = rect.x + (rect.width/2) - (bmp_width/2) ++ bmp_x = rect.x + (rect.width//2) - (bmp_width//2) + bmp_y = rect.y + 3 +- text_x = rect.x + (rect.width/2) - (text_width/2) ++ text_x = rect.x + (rect.width//2) - (text_width//2) + text_y = rect.y + ((bmp_y - rect.y) * 2) + bmp_height + + elif horizontal and text_right: + bmp_x = rect.x + 3 +- bmp_y = rect.y + (rect.height/2) - (bmp_height / 2) ++ bmp_y = rect.y + (rect.height//2) - (bmp_height // 2) + text_x = rect.x + ((bmp_x - rect.x) * 2) + bmp_width +- text_y = rect.y + (rect.height/2) - (text_height/2) ++ text_y = rect.y + (rect.height//2) - (text_height//2) + + elif not horizontal and text_bottom: +- bmp_x = rect.x + (rect.width / 2) - (bmp_width / 2) ++ bmp_x = rect.x + (rect.width // 2) - (bmp_width // 2) + bmp_y = rect.y + 3 +- text_x = rect.x + (rect.width / 2) - (text_width / 2) ++ text_x = rect.x + (rect.width // 2) - (text_width // 2) + text_y = rect.y + ((bmp_y - rect.y) * 2) + bmp_height + + bmp_rect = wx.Rect(bmp_x, bmp_y, bmp_width, bmp_height) +diff --git a/wx/lib/agw/aui/auibook.py b/wx/lib/agw/aui/auibook.py +index c8304f9a5..398be4efd 100644 +--- a/wx/lib/agw/aui/auibook.py ++++ b/wx/lib/agw/aui/auibook.py +@@ -175,7 +175,7 @@ def __init__(self, owner, tab, page_index): + x += image_w + w -= image_w + 4 + +- y = (self._tabEdited.rect.height - h)/2 + 1 ++ y = (self._tabEdited.rect.height - h)//2 + 1 + + expandoStyle = wx.WANTS_CHARS + if wx.Platform in ["__WXGTK__", "__WXMAC__"]: +@@ -864,7 +864,7 @@ def OnPanelPaint(self, event): + # Draw the caption title and place the bitmap + # get the bitmap optimal position, and draw it + bmpPt, txtPt = wx.Point(), wx.Point() +- bmpPt.y = (rect.height - self._props.Icon.GetHeight())/2 ++ bmpPt.y = (rect.height - self._props.Icon.GetHeight())//2 + bmpPt.x = 3 + mem_dc.DrawBitmap(self._props.Icon, bmpPt.x, bmpPt.y, True) + +@@ -875,7 +875,7 @@ def OnPanelPaint(self, event): + fontHeight = mem_dc.GetCharHeight() + + txtPt.x = bmpPt.x + self._props.Icon.GetWidth() + 4 +- txtPt.y = (rect.height - fontHeight)/2 ++ txtPt.y = (rect.height - fontHeight)//2 + mem_dc.SetTextForeground(wx.WHITE) + mem_dc.DrawText("Opened tabs:", txtPt.x, txtPt.y) + mem_dc.SelectObject(wx.NullBitmap) +diff --git a/wx/lib/agw/aui/framemanager.py b/wx/lib/agw/aui/framemanager.py +index a16d2c937..6b5c637f7 100644 +--- a/wx/lib/agw/aui/framemanager.py ++++ b/wx/lib/agw/aui/framemanager.py +@@ -95,7 +95,6 @@ + __author__ = "Andrea Gavana " + __date__ = "31 March 2009" + +- + import wx + # just for isinstance + try: +@@ -124,6 +123,7 @@ + if wx.Platform == "__WXMSW__": + try: + import winxptheme ++ + _winxptheme = True + except ImportError: + pass +@@ -173,6 +173,7 @@ + EVT_AUI_PERSPECTIVE_CHANGED = wx.PyEventBinder(wxEVT_AUI_PERSPECTIVE_CHANGED, 0) + """ The layout in `AuiManager` has been changed. """ + ++ + # ---------------------------------------------------------------------------- # + + class AuiDockInfo(object): +@@ -197,7 +198,6 @@ def __init__(self): + self.rect = wx.Rect() + self.panes = [] + +- + def IsOk(self): + """ + Returns whether a dock is valid or not. +@@ -207,13 +207,11 @@ def IsOk(self): + + return self.dock_direction != 0 + +- + def IsHorizontal(self): + """ Returns whether the dock is horizontal or not. """ + + return self.dock_direction in [AUI_DOCK_TOP, AUI_DOCK_BOTTOM] + +- + def IsVertical(self): + """ Returns whether the dock is vertical or not. """ + +@@ -241,7 +239,6 @@ def __init__(self, other=None): + # dock direction (top, bottom, left, right, center) + self.dock_direction = AUI_DOCK_NONE + +- + def Assign(self, other): + """ + Assigns the properties of the `other` :class:`AuiDockingGuideInfo` to `self`. +@@ -252,7 +249,6 @@ def Assign(self, other): + self.host = other.host + self.dock_direction = other.dock_direction + +- + def Host(self, h): + """ + Hosts a docking guide window. +@@ -263,42 +259,36 @@ def Host(self, h): + self.host = h + return self + +- + def Left(self): + """ Sets the guide window to left docking. """ + + self.dock_direction = AUI_DOCK_LEFT + return self + +- + def Right(self): + """ Sets the guide window to right docking. """ + + self.dock_direction = AUI_DOCK_RIGHT + return self + +- + def Top(self): + """ Sets the guide window to top docking. """ + + self.dock_direction = AUI_DOCK_TOP + return self + +- + def Bottom(self): + """ Sets the guide window to bottom docking. """ + + self.dock_direction = AUI_DOCK_BOTTOM + return self + +- + def Center(self): + """ Sets the guide window to center docking. """ + + self.dock_direction = AUI_DOCK_CENTER + return self + +- + def Centre(self): + """ Sets the guide window to centre docking. """ + +@@ -372,7 +362,6 @@ def __init__(self, eventType, id=1): + self.canveto_flag = True + self.dc = None + +- + def SetManager(self, mgr): + """ + Associates a :class:`AuiManager` to the current event. +@@ -382,7 +371,6 @@ def SetManager(self, mgr): + + self.manager = mgr + +- + def SetDC(self, pdc): + """ + Associates a :class:`wx.DC` device context to this event. +@@ -392,7 +380,6 @@ def SetDC(self, pdc): + + self.dc = pdc + +- + def SetPane(self, p): + """ + Associates a :class:`AuiPaneInfo` instance to this event. +@@ -402,7 +389,6 @@ def SetPane(self, p): + + self.pane = p + +- + def SetButton(self, b): + """ + Associates a :class:`AuiPaneButton` instance to this event. +@@ -412,31 +398,26 @@ def SetButton(self, b): + + self.button = b + +- + def GetManager(self): + """ Returns the associated :class:`AuiManager` (if any). """ + + return self.manager + +- + def GetDC(self): + """ Returns the associated :class:`wx.DC` device context (if any). """ + + return self.dc + +- + def GetPane(self): + """ Returns the associated :class:`AuiPaneInfo` structure (if any). """ + + return self.pane + +- + def GetButton(self): + """ Returns the associated :class:`AuiPaneButton` instance (if any). """ + + return self.button + +- + def Veto(self, veto=True): + """ + Prevents the change announced by this event from happening. +@@ -450,13 +431,11 @@ def Veto(self, veto=True): + + self.veto_flag = veto + +- + def GetVeto(self): + """ Returns whether the event has been vetoed or not. """ + + return self.veto_flag + +- + def SetCanVeto(self, can_veto): + """ + Sets whether the event can be vetoed or not. +@@ -466,11 +445,10 @@ def SetCanVeto(self, can_veto): + + self.canveto_flag = can_veto + +- + def CanVeto(self): + """ Returns whether the event can be vetoed and has been vetoed. """ + +- return self.canveto_flag and self.veto_flag ++ return self.canveto_flag and self.veto_flag + + + # ---------------------------------------------------------------------------- # +@@ -483,47 +461,46 @@ class AuiPaneInfo(object): + size, minimum size, caption text among many other parameters. + """ + +- optionFloating = 2**0 +- optionHidden = 2**1 +- optionLeftDockable = 2**2 +- optionRightDockable = 2**3 +- optionTopDockable = 2**4 +- optionBottomDockable = 2**5 +- optionFloatable = 2**6 +- optionMovable = 2**7 +- optionResizable = 2**8 +- optionPaneBorder = 2**9 +- optionCaption = 2**10 +- optionGripper = 2**11 +- optionDestroyOnClose = 2**12 +- optionToolbar = 2**13 +- optionActive = 2**14 +- optionGripperTop = 2**15 +- optionMaximized = 2**16 +- optionDockFixed = 2**17 +- optionNotebookDockable = 2**18 +- optionMinimized = 2**19 +- optionLeftSnapped = 2**20 +- optionRightSnapped = 2**21 +- optionTopSnapped = 2**22 +- optionBottomSnapped = 2**23 +- optionFlyOut = 2**24 +- optionCaptionLeft = 2**25 +- +- buttonClose = 2**26 +- buttonMaximize = 2**27 +- buttonMinimize = 2**28 +- buttonPin = 2**29 +- +- buttonCustom1 = 2**30 +- buttonCustom2 = 2**31 +- buttonCustom3 = 2**32 +- +- savedHiddenState = 2**33 # used internally +- actionPane = 2**34 # used internally +- wasMaximized = 2**35 # used internally +- needsRestore = 2**36 # used internally +- ++ optionFloating = 2 ** 0 ++ optionHidden = 2 ** 1 ++ optionLeftDockable = 2 ** 2 ++ optionRightDockable = 2 ** 3 ++ optionTopDockable = 2 ** 4 ++ optionBottomDockable = 2 ** 5 ++ optionFloatable = 2 ** 6 ++ optionMovable = 2 ** 7 ++ optionResizable = 2 ** 8 ++ optionPaneBorder = 2 ** 9 ++ optionCaption = 2 ** 10 ++ optionGripper = 2 ** 11 ++ optionDestroyOnClose = 2 ** 12 ++ optionToolbar = 2 ** 13 ++ optionActive = 2 ** 14 ++ optionGripperTop = 2 ** 15 ++ optionMaximized = 2 ** 16 ++ optionDockFixed = 2 ** 17 ++ optionNotebookDockable = 2 ** 18 ++ optionMinimized = 2 ** 19 ++ optionLeftSnapped = 2 ** 20 ++ optionRightSnapped = 2 ** 21 ++ optionTopSnapped = 2 ** 22 ++ optionBottomSnapped = 2 ** 23 ++ optionFlyOut = 2 ** 24 ++ optionCaptionLeft = 2 ** 25 ++ ++ buttonClose = 2 ** 26 ++ buttonMaximize = 2 ** 27 ++ buttonMinimize = 2 ** 28 ++ buttonPin = 2 ** 29 ++ ++ buttonCustom1 = 2 ** 30 ++ buttonCustom2 = 2 ** 31 ++ buttonCustom3 = 2 ** 32 ++ ++ savedHiddenState = 2 ** 33 # used internally ++ actionPane = 2 ** 34 # used internally ++ wasMaximized = 2 ** 35 # used internally ++ needsRestore = 2 ** 36 # used internally + + def __init__(self): + """ Default class constructor. """ +@@ -557,7 +534,6 @@ def __init__(self): + + self.DefaultPane() + +- + def dock_direction_get(self): + """ + Getter for the `dock_direction`. +@@ -570,7 +546,6 @@ def dock_direction_get(self): + else: + return self._dock_direction + +- + def dock_direction_set(self, value): + """ + Setter for the `dock_direction`. +@@ -605,55 +580,46 @@ def IsOk(self): + + return self.window != None + +- + def IsMaximized(self): + """ Returns ``True`` if the pane is maximized. """ + + return self.HasFlag(self.optionMaximized) + +- + def IsMinimized(self): + """ Returns ``True`` if the pane is minimized. """ + + return self.HasFlag(self.optionMinimized) + +- + def IsFixed(self): + """ Returns ``True`` if the pane cannot be resized. """ + + return not self.HasFlag(self.optionResizable) + +- + def IsResizeable(self): + """ Returns ``True`` if the pane can be resized. """ + + return self.HasFlag(self.optionResizable) + +- + def IsShown(self): + """ Returns ``True`` if the pane is currently shown. """ + + return not self.HasFlag(self.optionHidden) + +- + def IsFloating(self): + """ Returns ``True`` if the pane is floating. """ + + return self.HasFlag(self.optionFloating) + +- + def IsDocked(self): + """ Returns ``True`` if the pane is docked. """ + + return not self.HasFlag(self.optionFloating) + +- + def IsToolbar(self): + """ Returns ``True`` if the pane contains a toolbar. """ + + return self.HasFlag(self.optionToolbar) + +- + def IsTopDockable(self): + """ + Returns ``True`` if the pane can be docked at the top +@@ -662,7 +628,6 @@ def IsTopDockable(self): + + return self.HasFlag(self.optionTopDockable) + +- + def IsBottomDockable(self): + """ + Returns ``True`` if the pane can be docked at the bottom +@@ -671,7 +636,6 @@ def IsBottomDockable(self): + + return self.HasFlag(self.optionBottomDockable) + +- + def IsLeftDockable(self): + """ + Returns ``True`` if the pane can be docked at the left +@@ -680,7 +644,6 @@ def IsLeftDockable(self): + + return self.HasFlag(self.optionLeftDockable) + +- + def IsRightDockable(self): + """ + Returns ``True`` if the pane can be docked at the right +@@ -689,14 +652,12 @@ def IsRightDockable(self): + + return self.HasFlag(self.optionRightDockable) + +- + def IsDockable(self): + """ Returns ``True`` if the pane can be docked. """ + + return self.IsTopDockable() or self.IsBottomDockable() or self.IsLeftDockable() or \ + self.IsRightDockable() or self.IsNotebookDockable() + +- + def IsFloatable(self): + """ + Returns ``True`` if the pane can be undocked and displayed as a +@@ -705,7 +666,6 @@ def IsFloatable(self): + + return self.HasFlag(self.optionFloatable) + +- + def IsMovable(self): + """ + Returns ``True`` if the docked frame can be undocked or moved to +@@ -714,7 +674,6 @@ def IsMovable(self): + + return self.HasFlag(self.optionMovable) + +- + def IsDestroyOnClose(self): + """ + Returns ``True`` if the pane should be destroyed when it is closed. +@@ -726,7 +685,6 @@ def IsDestroyOnClose(self): + + return self.HasFlag(self.optionDestroyOnClose) + +- + def IsNotebookDockable(self): + """ + Returns ``True`` if a pane can be docked on top to another to create a +@@ -735,86 +693,72 @@ def IsNotebookDockable(self): + + return self.HasFlag(self.optionNotebookDockable) + +- + def IsTopSnappable(self): + """ Returns ``True`` if the pane can be snapped at the top of the managed frame. """ + + return self.HasFlag(self.optionTopSnapped) + +- + def IsBottomSnappable(self): + """ Returns ``True`` if the pane can be snapped at the bottom of the managed frame. """ + + return self.HasFlag(self.optionBottomSnapped) + +- + def IsLeftSnappable(self): + """ Returns ``True`` if the pane can be snapped on the left of the managed frame. """ + + return self.HasFlag(self.optionLeftSnapped) + +- + def IsRightSnappable(self): + """ Returns ``True`` if the pane can be snapped on the right of the managed frame. """ + + return self.HasFlag(self.optionRightSnapped) + +- + def IsSnappable(self): + """ Returns ``True`` if the pane can be snapped. """ + + return self.IsTopSnappable() or self.IsBottomSnappable() or self.IsLeftSnappable() or \ + self.IsRightSnappable() + +- + def IsFlyOut(self): + """ Returns ``True`` if the floating pane has a "fly-out" effect. """ + + return self.HasFlag(self.optionFlyOut) + +- + def HasCaption(self): + """ Returns ``True`` if the pane displays a caption. """ + + return self.HasFlag(self.optionCaption) + +- + def HasCaptionLeft(self): + """ Returns ``True`` if the pane displays a caption on the left (rotated by 90 degrees). """ + + return self.HasFlag(self.optionCaptionLeft) + +- + def HasGripper(self): + """ Returns ``True`` if the pane displays a gripper. """ + + return self.HasFlag(self.optionGripper) + +- + def HasBorder(self): + """ Returns ``True`` if the pane displays a border. """ + + return self.HasFlag(self.optionPaneBorder) + +- + def HasCloseButton(self): + """ Returns ``True`` if the pane displays a button to close the pane. """ + + return self.HasFlag(self.buttonClose) + +- + def HasMaximizeButton(self): + """ Returns ``True`` if the pane displays a button to maximize the pane. """ + + return self.HasFlag(self.buttonMaximize) + +- + def HasMinimizeButton(self): + """ Returns ``True`` if the pane displays a button to minimize the pane. """ + + return self.HasFlag(self.buttonMinimize) + +- + def GetMinimizeMode(self): + """ + Returns the minimization style for this pane. +@@ -850,19 +794,16 @@ def GetMinimizeMode(self): + + return self.minimize_mode + +- + def HasPinButton(self): + """ Returns ``True`` if the pane displays a button to float the pane. """ + + return self.HasFlag(self.buttonPin) + +- + def HasGripperTop(self): + """ Returns ``True`` if the pane displays a gripper at the top. """ + + return self.HasFlag(self.optionGripperTop) + +- + def Window(self, w): + """ + Associate a :class:`wx.Window` derived window to this pane. +@@ -877,7 +818,6 @@ def Window(self, w): + self.window = w + return self + +- + def Name(self, name): + """ + Sets the name of the pane so it can be referenced in lookup functions. +@@ -897,7 +837,6 @@ def Name(self, name): + self.name = name + return self + +- + def Caption(self, caption): + """ + Sets the caption of the pane. +@@ -908,7 +847,6 @@ def Caption(self, caption): + self.caption = caption + return self + +- + def Left(self): + """ + Sets the pane dock position to the left side of the frame. +@@ -920,7 +858,6 @@ def Left(self): + self.dock_direction = AUI_DOCK_LEFT + return self + +- + def Right(self): + """ + Sets the pane dock position to the right side of the frame. +@@ -932,7 +869,6 @@ def Right(self): + self.dock_direction = AUI_DOCK_RIGHT + return self + +- + def Top(self): + """ + Sets the pane dock position to the top of the frame. +@@ -944,7 +880,6 @@ def Top(self): + self.dock_direction = AUI_DOCK_TOP + return self + +- + def Bottom(self): + """ + Sets the pane dock position to the bottom of the frame. +@@ -956,7 +891,6 @@ def Bottom(self): + self.dock_direction = AUI_DOCK_BOTTOM + return self + +- + def Center(self): + """ + Sets the pane to the center position of the frame. +@@ -971,7 +905,6 @@ def Center(self): + self.dock_direction = AUI_DOCK_CENTER + return self + +- + def Centre(self): + """ + Sets the pane to the center position of the frame. +@@ -986,7 +919,6 @@ def Centre(self): + self.dock_direction = AUI_DOCK_CENTRE + return self + +- + def Direction(self, direction): + """ + Determines the direction of the docked pane. It is functionally the +@@ -1001,7 +933,6 @@ def Direction(self, direction): + self.dock_direction = direction + return self + +- + def Layer(self, layer): + """ + Determines the layer of the docked pane. +@@ -1016,7 +947,6 @@ def Layer(self, layer): + self.dock_layer = layer + return self + +- + def Row(self, row): + """ + Determines the row of the docked pane. +@@ -1027,7 +957,6 @@ def Row(self, row): + self.dock_row = row + return self + +- + def Position(self, pos): + """ + Determines the position of the docked pane. +@@ -1038,7 +967,6 @@ def Position(self, pos): + self.dock_pos = pos + return self + +- + def MinSize(self, arg1=None, arg2=None): + """ + Sets the minimum size of the pane. +@@ -1057,11 +985,10 @@ def MinSize(self, arg1=None, arg2=None): + elif isinstance(arg1, six.integer_types) and arg2 is not None: + ret = self.MinSize2(arg1, arg2) + else: +- raise Exception("Invalid argument passed to `MinSize`: arg1=%s, arg2=%s"%(repr(arg1), repr(arg2))) ++ raise Exception("Invalid argument passed to `MinSize`: arg1=%s, arg2=%s" % (repr(arg1), repr(arg2))) + + return ret + +- + def MinSize1(self, size): + """ + Sets the minimum size of the pane. +@@ -1071,7 +998,6 @@ def MinSize1(self, size): + self.min_size = size + return self + +- + def MinSize2(self, x, y): + """ + Sets the minimum size of the pane. +@@ -1082,7 +1008,6 @@ def MinSize2(self, x, y): + self.min_size = wx.Size(x, y) + return self + +- + def MaxSize(self, arg1=None, arg2=None): + """ + Sets the maximum size of the pane. +@@ -1101,11 +1026,10 @@ def MaxSize(self, arg1=None, arg2=None): + elif isinstance(arg1, six.integer_types) and arg2 is not None: + ret = self.MaxSize2(arg1, arg2) + else: +- raise Exception("Invalid argument passed to `MaxSize`: arg1=%s, arg2=%s"%(repr(arg1), repr(arg2))) ++ raise Exception("Invalid argument passed to `MaxSize`: arg1=%s, arg2=%s" % (repr(arg1), repr(arg2))) + + return ret + +- + def MaxSize1(self, size): + """ + Sets the maximum size of the pane. +@@ -1116,7 +1040,6 @@ def MaxSize1(self, size): + self.max_size = size + return self + +- + def MaxSize2(self, x, y): + """ + Sets the maximum size of the pane. +@@ -1124,10 +1047,9 @@ def MaxSize2(self, x, y): + :see: :meth:`MaxSize` for an explanation of input parameters. + """ + +- self.max_size.Set(x,y) ++ self.max_size.Set(x, y) + return self + +- + def BestSize(self, arg1=None, arg2=None): + """ + Sets the ideal size for the pane. The docking manager will attempt to use +@@ -1147,11 +1069,10 @@ def BestSize(self, arg1=None, arg2=None): + elif isinstance(arg1, six.integer_types) and arg2 is not None: + ret = self.BestSize2(arg1, arg2) + else: +- raise Exception("Invalid argument passed to `BestSize`: arg1=%s, arg2=%s"%(repr(arg1), repr(arg2))) ++ raise Exception("Invalid argument passed to `BestSize`: arg1=%s, arg2=%s" % (repr(arg1), repr(arg2))) + + return ret + +- + def BestSize1(self, size): + """ + Sets the best size of the pane. +@@ -1162,7 +1083,6 @@ def BestSize1(self, size): + self.best_size = size + return self + +- + def BestSize2(self, x, y): + """ + Sets the best size of the pane. +@@ -1170,10 +1090,9 @@ def BestSize2(self, x, y): + :see: :meth:`BestSize` for an explanation of input parameters. + """ + +- self.best_size.Set(x,y) ++ self.best_size.Set(x, y) + return self + +- + def FloatingPosition(self, pos): + """ + Sets the position of the floating pane. +@@ -1184,7 +1103,6 @@ def FloatingPosition(self, pos): + self.floating_pos = wx.Point(*pos) + return self + +- + def FloatingSize(self, size): + """ + Sets the size of the floating pane. +@@ -1195,13 +1113,11 @@ def FloatingSize(self, size): + self.floating_size = wx.Size(*size) + return self + +- + def Maximize(self): + """ Makes the pane take up the full area.""" + + return self.SetFlag(self.optionMaximized, True) + +- + def Minimize(self): + """ + Makes the pane minimized in a :class:`~wx.lib.agw.aui.auibar.AuiToolBar`. +@@ -1217,7 +1133,6 @@ def Minimize(self): + + return self.SetFlag(self.optionMinimized, True) + +- + def MinimizeMode(self, mode): + """ + Sets the expected minimized mode if the minimize button is visible. +@@ -1257,7 +1172,6 @@ def MinimizeMode(self, mode): + self.minimize_mode = mode + return self + +- + def MinimizeTarget(self, toolbarPane): + """ + Minimizes the panes using a :class:`AuiPaneInfo` as a target. As :class:`AuiPaneInfo` properties +@@ -1278,13 +1192,11 @@ def MinimizeTarget(self, toolbarPane): + self.minimize_target = toolbarPane.name + return self + +- + def Restore(self): + """ Is the reverse of :meth:`Maximize` and :meth:`Minimize`.""" + + return self.SetFlag(self.optionMaximized | self.optionMinimized, False) + +- + def Fixed(self): + """ + Forces a pane to be fixed size so that it cannot be resized. +@@ -1293,7 +1205,6 @@ def Fixed(self): + + return self.SetFlag(self.optionResizable, False) + +- + def Resizable(self, resizable=True): + """ + Allows a pane to be resizable if `resizable` is ``True``, and forces +@@ -1306,7 +1217,6 @@ def Resizable(self, resizable=True): + + return self.SetFlag(self.optionResizable, resizable) + +- + def Transparent(self, alpha): + """ + Makes the pane transparent when floating. +@@ -1315,12 +1225,11 @@ def Transparent(self, alpha): + """ + + if alpha < 0 or alpha > 255: +- raise Exception("Invalid transparency value (%s)"%repr(alpha)) ++ raise Exception("Invalid transparency value (%s)" % repr(alpha)) + + self.transparent = alpha + self.needsTransparency = True + +- + def Dock(self): + """ Indicates that a pane should be docked. It is the opposite of :meth:`Float`. """ + +@@ -1330,7 +1239,6 @@ def Dock(self): + + return self.SetFlag(self.optionFloating, False) + +- + def Float(self): + """ Indicates that a pane should be floated. It is the opposite of :meth:`Dock`. """ + +@@ -1340,7 +1248,6 @@ def Float(self): + + return self.SetFlag(self.optionFloating, True) + +- + def Hide(self): + """ + Indicates that a pane should be hidden. +@@ -1350,7 +1257,6 @@ def Hide(self): + + return self.SetFlag(self.optionHidden, True) + +- + def Show(self, show=True): + """ + Indicates that a pane should be shown. +@@ -1360,7 +1266,6 @@ def Show(self, show=True): + + return self.SetFlag(self.optionHidden, not show) + +- + # By defaulting to 1000, the tab will get placed at the end + def NotebookPage(self, id, tab_position=1000): + """ +@@ -1381,7 +1286,6 @@ def NotebookPage(self, id, tab_position=1000): + + return self + +- + def NotebookControl(self, id): + """ + Forces a pane to be a notebook control (:class:`~wx.lib.agw.aui.auibook.AuiNotebook`). +@@ -1398,34 +1302,29 @@ def NotebookControl(self, id): + + return self + +- + def HasNotebook(self): + """ Returns whether a pane has a :class:`~wx.lib.agw.aui.auibook.AuiNotebook` or not. """ + + return self.notebook_id >= 0 + +- + def IsNotebookPage(self): + """ Returns whether the pane is a notebook page in a :class:`~wx.lib.agw.aui.auibook.AuiNotebook`. """ + + return self.notebook_id >= 0 and self.dock_direction == AUI_DOCK_NOTEBOOK_PAGE + +- + def IsNotebookControl(self): + """ Returns whether the pane is a notebook control (:class:`~wx.lib.agw.aui.auibook.AuiNotebook`). """ + + return not self.IsNotebookPage() and self.HasNotebook() + +- + def SetNameFromNotebookId(self): + """ Sets the pane name once docked in a :class:`~wx.lib.agw.aui.auibook.AuiNotebook` using the notebook id. """ + + if self.notebook_id >= 0: +- self.name = "__notebook_%d"%self.notebook_id ++ self.name = "__notebook_%d" % self.notebook_id + + return self + +- + def CaptionVisible(self, visible=True, left=False): + """ + Indicates that a pane caption should be visible. If `visible` is ``False``, no pane +@@ -1442,7 +1341,6 @@ def CaptionVisible(self, visible=True, left=False): + self.SetFlag(self.optionCaptionLeft, False) + return self.SetFlag(self.optionCaption, visible) + +- + def PaneBorder(self, visible=True): + """ + Indicates that a border should be drawn for the pane. +@@ -1452,7 +1350,6 @@ def PaneBorder(self, visible=True): + + return self.SetFlag(self.optionPaneBorder, visible) + +- + def Gripper(self, visible=True): + """ + Indicates that a gripper should be drawn for the pane. +@@ -1462,7 +1359,6 @@ def Gripper(self, visible=True): + + return self.SetFlag(self.optionGripper, visible) + +- + def GripperTop(self, attop=True): + """ + Indicates that a gripper should be drawn at the top of the pane. +@@ -1472,7 +1368,6 @@ def GripperTop(self, attop=True): + + return self.SetFlag(self.optionGripperTop, attop) + +- + def CloseButton(self, visible=True): + """ + Indicates that a close button should be drawn for the pane. +@@ -1482,7 +1377,6 @@ def CloseButton(self, visible=True): + + return self.SetFlag(self.buttonClose, visible) + +- + def MaximizeButton(self, visible=True): + """ + Indicates that a maximize button should be drawn for the pane. +@@ -1492,7 +1386,6 @@ def MaximizeButton(self, visible=True): + + return self.SetFlag(self.buttonMaximize, visible) + +- + def MinimizeButton(self, visible=True): + """ + Indicates that a minimize button should be drawn for the pane. +@@ -1502,7 +1395,6 @@ def MinimizeButton(self, visible=True): + + return self.SetFlag(self.buttonMinimize, visible) + +- + def PinButton(self, visible=True): + """ + Indicates that a pin button should be drawn for the pane. +@@ -1512,7 +1404,6 @@ def PinButton(self, visible=True): + + return self.SetFlag(self.buttonPin, visible) + +- + def DestroyOnClose(self, b=True): + """ + Indicates whether a pane should be destroyed when it is closed. +@@ -1526,7 +1417,6 @@ def DestroyOnClose(self, b=True): + + return self.SetFlag(self.optionDestroyOnClose, b) + +- + def TopDockable(self, b=True): + """ + Indicates whether a pane can be docked at the top of the frame. +@@ -1536,7 +1426,6 @@ def TopDockable(self, b=True): + + return self.SetFlag(self.optionTopDockable, b) + +- + def BottomDockable(self, b=True): + """ + Indicates whether a pane can be docked at the bottom of the frame. +@@ -1546,7 +1435,6 @@ def BottomDockable(self, b=True): + + return self.SetFlag(self.optionBottomDockable, b) + +- + def LeftDockable(self, b=True): + """ + Indicates whether a pane can be docked on the left of the frame. +@@ -1556,7 +1444,6 @@ def LeftDockable(self, b=True): + + return self.SetFlag(self.optionLeftDockable, b) + +- + def RightDockable(self, b=True): + """ + Indicates whether a pane can be docked on the right of the frame. +@@ -1566,7 +1453,6 @@ def RightDockable(self, b=True): + + return self.SetFlag(self.optionRightDockable, b) + +- + def Floatable(self, b=True): + """ + Sets whether the user will be able to undock a pane and turn it +@@ -1577,7 +1463,6 @@ def Floatable(self, b=True): + + return self.SetFlag(self.optionFloatable, b) + +- + def Movable(self, b=True): + """ + Indicates whether a pane can be moved. +@@ -1587,7 +1472,6 @@ def Movable(self, b=True): + + return self.SetFlag(self.optionMovable, b) + +- + def NotebookDockable(self, b=True): + """ + Indicates whether a pane can be docked in an automatic :class:`~wx.lib.agw.aui.auibook.AuiNotebook`. +@@ -1597,7 +1481,6 @@ def NotebookDockable(self, b=True): + + return self.SetFlag(self.optionNotebookDockable, b) + +- + def DockFixed(self, b=True): + """ + Causes the containing dock to have no resize sash. This is useful +@@ -1609,7 +1492,6 @@ def DockFixed(self, b=True): + + return self.SetFlag(self.optionDockFixed, b) + +- + def Dockable(self, b=True): + """ + Specifies whether a frame can be docked or not. It is the same as specifying +@@ -1620,7 +1502,6 @@ def Dockable(self, b=True): + + return self.TopDockable(b).BottomDockable(b).LeftDockable(b).RightDockable(b) + +- + def TopSnappable(self, b=True): + """ + Indicates whether a pane can be snapped at the top of the main frame. +@@ -1630,7 +1511,6 @@ def TopSnappable(self, b=True): + + return self.SetFlag(self.optionTopSnapped, b) + +- + def BottomSnappable(self, b=True): + """ + Indicates whether a pane can be snapped at the bottom of the main frame. +@@ -1640,7 +1520,6 @@ def BottomSnappable(self, b=True): + + return self.SetFlag(self.optionBottomSnapped, b) + +- + def LeftSnappable(self, b=True): + """ + Indicates whether a pane can be snapped on the left of the main frame. +@@ -1650,7 +1529,6 @@ def LeftSnappable(self, b=True): + + return self.SetFlag(self.optionLeftSnapped, b) + +- + def RightSnappable(self, b=True): + """ + Indicates whether a pane can be snapped on the right of the main frame. +@@ -1660,7 +1538,6 @@ def RightSnappable(self, b=True): + + return self.SetFlag(self.optionRightSnapped, b) + +- + def Snappable(self, b=True): + """ + Indicates whether a pane can be snapped on the main frame. This is +@@ -1671,7 +1548,6 @@ def Snappable(self, b=True): + + return self.TopSnappable(b).BottomSnappable(b).LeftSnappable(b).RightSnappable(b) + +- + def FlyOut(self, b=True): + """ + Indicates whether a pane, when floating, has a "fly-out" effect +@@ -1682,7 +1558,6 @@ def FlyOut(self, b=True): + + return self.SetFlag(self.optionFlyOut, b) + +- + # Copy over the members that pertain to docking position + def SetDockPos(self, source): + """ +@@ -1703,7 +1578,6 @@ def SetDockPos(self, source): + + return self + +- + def DefaultPane(self): + """ Specifies that the pane should adopt the default pane settings. """ + +@@ -1717,7 +1591,6 @@ def DefaultPane(self): + self.state = state + return self + +- + def CentrePane(self): + """ + Specifies that the pane should adopt the default center pane settings. +@@ -1728,7 +1601,6 @@ def CentrePane(self): + + return self.CenterPane() + +- + def CenterPane(self): + """ + Specifies that the pane should adopt the default center pane settings. +@@ -1740,7 +1612,6 @@ def CenterPane(self): + self.state = 0 + return self.Center().PaneBorder().Resizable() + +- + def ToolbarPane(self): + """ Specifies that the pane should adopt the default toolbar pane settings. """ + +@@ -1757,7 +1628,6 @@ def ToolbarPane(self): + + return self + +- + def Icon(self, icon): + """ + Specifies whether an icon is drawn on the left of the caption text when +@@ -1774,7 +1644,6 @@ def Icon(self, icon): + self.icon = icon + return self + +- + def SetFlag(self, flag, option_state): + """ + Turns the property given by `flag` on or off with the `option_state` +@@ -1798,7 +1667,6 @@ def SetFlag(self, flag, option_state): + + return self + +- + def HasFlag(self, flag): + """ + Returns ``True`` if the the property specified by flag is active for the pane. +@@ -1808,7 +1676,6 @@ def HasFlag(self, flag): + + return (self.state & flag and [True] or [False])[0] + +- + def ResetButtons(self): + """ + Resets all the buttons and recreates them from scratch depending on the +@@ -1834,7 +1701,6 @@ def ResetButtons(self): + button = AuiPaneButton(AUI_BUTTON_CLOSE) + self.buttons.append(button) + +- + def CountButtons(self): + """ Returns the number of visible buttons in the docked pane. """ + +@@ -1855,7 +1721,6 @@ def CountButtons(self): + + return n + +- + def IsHorizontal(self): + """ Returns ``True`` if the pane `dock_direction` is horizontal. """ + +@@ -1879,7 +1744,7 @@ class AuiDockingGuide(wx.Frame): + + def __init__(self, parent, id=wx.ID_ANY, title="", pos=wx.DefaultPosition, + size=wx.DefaultSize, style=wx.FRAME_TOOL_WINDOW | wx.STAY_ON_TOP | +- wx.FRAME_NO_TASKBAR | wx.NO_BORDER, name="AuiDockingGuide"): ++ wx.FRAME_NO_TASKBAR | wx.NO_BORDER, name="AuiDockingGuide"): + """ + Default class constructor. Used internally, do not call it in your code! + +@@ -1897,7 +1762,6 @@ def __init__(self, parent, id=wx.ID_ANY, title="", pos=wx.DefaultPosition, + + wx.Frame.__init__(self, parent, id, title, pos, size, style, name=name) + +- + def HitTest(self, x, y): + """ + To be overridden by parent classes. +@@ -1908,7 +1772,6 @@ def HitTest(self, x, y): + + return 0 + +- + def ValidateNotebookDocking(self, valid): + """ + To be overridden by parent classes. +@@ -1919,6 +1782,7 @@ def ValidateNotebookDocking(self, valid): + + return 0 + ++ + # ============================================================================ + # implementation + # ============================================================================ +@@ -1958,7 +1822,6 @@ def __init__(self, parent, rect, direction=0, center=False, useAero=False): + self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground) + self.Bind(wx.EVT_PAINT, self.OnPaint) + +- + def SetValid(self, valid): + """ + Sets the docking direction as valid or invalid. +@@ -1968,13 +1831,11 @@ def SetValid(self, valid): + + self._valid = valid + +- + def IsValid(self): + """ Returns whether the docking direction is valid. """ + + return self._valid + +- + def OnEraseBackground(self, event): + """ + Handles the ``wx.EVT_ERASE_BACKGROUND`` event for :class:`AuiDockingGuideWindow`. +@@ -1986,7 +1847,6 @@ def OnEraseBackground(self, event): + + pass + +- + def DrawBackground(self, dc): + """ + Draws the docking guide background. +@@ -2010,13 +1870,13 @@ def DrawBackground(self, dc): + if self._direction != wx.CENTER: + + if not self._center or self._direction != wx.BOTTOM: +- dc.DrawLine(left, top, right+1, top) ++ dc.DrawLine(left, top, right + 1, top) + if not self._center or self._direction != wx.RIGHT: +- dc.DrawLine(left, top, left, bottom+1) ++ dc.DrawLine(left, top, left, bottom + 1) + if not self._center or self._direction != wx.LEFT: +- dc.DrawLine(right, top, right, bottom+1) ++ dc.DrawLine(right, top, right, bottom + 1) + if not self._center or self._direction != wx.TOP: +- dc.DrawLine(left, bottom, right+1, bottom) ++ dc.DrawLine(left, bottom, right + 1, bottom) + + dc.SetPen(wx.Pen(colourTargetShade)) + +@@ -2025,7 +1885,6 @@ def DrawBackground(self, dc): + if self._direction != wx.BOTTOM: + dc.DrawLine(left + 1, top + 1, right, top + 1) + +- + def DrawDottedLine(self, dc, point, length, vertical): + """ + Draws a dotted line (not used if the docking guide images are ok). +@@ -2043,7 +1902,6 @@ def DrawDottedLine(self, dc, point, length, vertical): + else: + point.x += 2 + +- + def DrawIcon(self, dc): + """ + Draws the docking guide icon (not used if the docking guide images are ok). +@@ -2070,24 +1928,24 @@ def DrawIcon(self, dc): + rect.Deflate(1, 1) + + if self._direction == wx.TOP: +- rect.height -= rect.height / 2 ++ rect.height -= rect.height // 2 + point = rect.GetBottomLeft() + length = rect.width + + elif self._direction == wx.LEFT: +- rect.width -= rect.width / 2 ++ rect.width -= rect.width // 2 + point = rect.GetTopRight() + length = rect.height + + elif self._direction == wx.RIGHT: +- rect.x += rect.width / 2 +- rect.width -= rect.width / 2 ++ rect.x += rect.width // 2 ++ rect.width -= rect.width // 2 + point = rect.GetTopLeft() + length = rect.height + + elif self._direction == wx.BOTTOM: +- rect.y += rect.height / 2 +- rect.height -= rect.height / 2 ++ rect.y += rect.height // 2 ++ rect.height -= rect.height // 2 + point = rect.GetTopLeft() + length = rect.width + +@@ -2113,7 +1971,6 @@ def DrawIcon(self, dc): + else: + self.DrawDottedLine(dc, point, length, True) + +- + def DrawArrow(self, dc): + """ + Draws the docking guide arrow icon (not used if the docking guide images are ok). +@@ -2124,8 +1981,8 @@ def DrawArrow(self, dc): + rect = self.GetClientRect() + point = wx.Point() + +- point.x = (rect.GetLeft() + rect.GetRight()) / 2 +- point.y = (rect.GetTop() + rect.GetBottom()) / 2 ++ point.x = (rect.GetLeft() + rect.GetRight()) // 2 ++ point.y = (rect.GetTop() + rect.GetBottom()) // 2 + rx, ry = wx.Size(), wx.Size() + + if self._direction == wx.TOP: +@@ -2144,33 +2001,32 @@ def DrawArrow(self, dc): + rx = wx.Size(-1, 0) + ry = wx.Size(0, -1) + +- point.x += ry.x*3 +- point.y += ry.y*3 ++ point.x += ry.x * 3 ++ point.y += ry.y * 3 + + dc.SetPen(wx.Pen(colourIconArrow)) + + for i in range(4): +- pt1 = wx.Point(point.x - rx.x*i, point.y - rx.y*i) +- pt2 = wx.Point(point.x + rx.x*(i+1), point.y + rx.y*(i+1)) ++ pt1 = wx.Point(point.x - rx.x * i, point.y - rx.y * i) ++ pt2 = wx.Point(point.x + rx.x * (i + 1), point.y + rx.y * (i + 1)) + dc.DrawLine(pt1, pt2) + point.x += ry.x + point.y += ry.y + +- + def OnPaint(self, event): + """ + Handles the ``wx.EVT_PAINT`` event for :class:`AuiDockingGuideWindow`. + + :param `event`: a :class:`PaintEvent` to be processed. + """ +- + dc = wx.AutoBufferedPaintDC(self) ++ + if self._currentImage.IsOk() and self._valid: + dc.DrawBitmap(self._currentImage, 0, 0, True) + else: ++ dc = wx.AutoBufferedPaintDC(self) + self.Draw(dc) + +- + def Draw(self, dc): + """ + Draws the whole docking guide window (not used if the docking guide images are ok). +@@ -2184,7 +2040,6 @@ def Draw(self, dc): + self.DrawIcon(dc) + self.DrawArrow(dc) + +- + def UpdateDockGuide(self, pos): + """ + Updates the docking guide images depending on the mouse position, using focused +@@ -2276,7 +2131,6 @@ def __init__(self, parent, direction=0): + + self.target = AuiDockingGuideWindow(self, self.rect, direction, False, useAero) + +- + def CreateShapesWithStyle(self, useWhidbey): + """ + Creates the docking guide window shape based on which docking bitmaps are used. +@@ -2295,10 +2149,8 @@ def CreateShapesWithStyle(self, useWhidbey): + useAero = (useWhidbey and [2] or [1])[0] + bmp, dummy = GetDockingImage(self._direction, useAero, False) + region = wx.Region(bmp) +- + self.region = region + +- + def AeroMove(self, pos): + """ + Moves the docking window to the new position. Overridden in children classes. +@@ -2308,7 +2160,6 @@ def AeroMove(self, pos): + + pass + +- + def SetGuideShape(self, event=None): + """ + Sets the correct shape for the docking guide window. +@@ -2323,7 +2174,6 @@ def SetGuideShape(self, event=None): + event.Skip() + wx.CallAfter(wx.SafeYield, self, True) + +- + def SetShape(self, region): + """ + If the platform supports it, sets the shape of the window to that depicted by `region`. +@@ -2342,7 +2192,6 @@ def SetShape(self, region): + else: + super(AuiSingleDockingGuide, self).SetShape(region) + +- + def SetValid(self, valid): + """ + Sets the docking direction as valid or invalid. +@@ -2352,13 +2201,11 @@ def SetValid(self, valid): + + self._valid = valid + +- + def IsValid(self): + """ Returns whether the docking direction is valid. """ + + return self._valid + +- + def UpdateDockGuide(self, pos): + """ + Updates the docking guide images depending on the mouse position, using focused +@@ -2370,7 +2217,6 @@ def UpdateDockGuide(self, pos): + + self.target.UpdateDockGuide(pos) + +- + def HitTest(self, x, y): + """ + Checks if the mouse position is inside the target window rect. +@@ -2401,7 +2247,7 @@ def __init__(self, parent): + """ + + AuiDockingGuide.__init__(self, parent, style=wx.FRAME_TOOL_WINDOW | wx.STAY_ON_TOP | +- wx.FRAME_NO_TASKBAR | wx.NO_BORDER | wx.FRAME_SHAPED, ++ wx.FRAME_NO_TASKBAR | wx.NO_BORDER | wx.FRAME_SHAPED, + name="auiCenterDockTarget") + + self.Hide() +@@ -2419,7 +2265,6 @@ def __init__(self, parent): + self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground) + self.Bind(wx.EVT_PAINT, self.OnPaint) + +- + def CreateShapesWithStyle(self): + """ Creates the docking guide window shape based on which docking bitmaps are used. """ + +@@ -2441,7 +2286,7 @@ def CreateShapesWithStyle(self): + + rectLeft = wx.Rect(0, sizeY, sizeY, sizeX) + rectTop = wx.Rect(sizeY, 0, sizeX, sizeY) +- rectRight = wx.Rect(sizeY+sizeX, sizeY, sizeY, sizeX) ++ rectRight = wx.Rect(sizeY + sizeX, sizeY, sizeY, sizeX) + rectBottom = wx.Rect(sizeY, sizeX + sizeY, sizeX, sizeY) + rectCenter = wx.Rect(sizeY, sizeY, sizeX, sizeX) + +@@ -2453,29 +2298,28 @@ def CreateShapesWithStyle(self): + self.targetBottom = AuiDockingGuideWindow(self, rectBottom, wx.BOTTOM, True, useAero) + self.targetCenter = AuiDockingGuideWindow(self, rectCenter, wx.CENTER, True, useAero) + +- + # top-left diamond +- tld = [wx.Point(rectTop.x, rectTop.y+rectTop.height-8), +- wx.Point(rectLeft.x+rectLeft.width-8, rectLeft.y), ++ tld = [wx.Point(rectTop.x, rectTop.y + rectTop.height - 8), ++ wx.Point(rectLeft.x + rectLeft.width - 8, rectLeft.y), + rectTop.GetBottomLeft()] + # bottom-left diamond +- bld = [wx.Point(rectLeft.x+rectLeft.width-8, rectLeft.y+rectLeft.height), +- wx.Point(rectBottom.x, rectBottom.y+8), ++ bld = [wx.Point(rectLeft.x + rectLeft.width - 8, rectLeft.y + rectLeft.height), ++ wx.Point(rectBottom.x, rectBottom.y + 8), + rectBottom.GetTopLeft()] + # top-right diamond +- trd = [wx.Point(rectTop.x+rectTop.width, rectTop.y+rectTop.height-8), +- wx.Point(rectRight.x+8, rectRight.y), ++ trd = [wx.Point(rectTop.x + rectTop.width, rectTop.y + rectTop.height - 8), ++ wx.Point(rectRight.x + 8, rectRight.y), + rectRight.GetTopLeft()] + # bottom-right diamond +- brd = [wx.Point(rectRight.x+8, rectRight.y+rectRight.height), +- wx.Point(rectBottom.x+rectBottom.width, rectBottom.y+8), ++ brd = [wx.Point(rectRight.x + 8, rectRight.y + rectRight.height), ++ wx.Point(rectBottom.x + rectBottom.width, rectBottom.y + 8), + rectBottom.GetTopRight()] + + self._triangles = [tld[0:2], bld[0:2], +- [wx.Point(rectTop.x+rectTop.width-1, rectTop.y+rectTop.height-8), +- wx.Point(rectRight.x+7, rectRight.y)], +- [wx.Point(rectRight.x+7, rectRight.y+rectRight.height), +- wx.Point(rectBottom.x+rectBottom.width-1, rectBottom.y+8)]] ++ [wx.Point(rectTop.x + rectTop.width - 1, rectTop.y + rectTop.height - 8), ++ wx.Point(rectRight.x + 7, rectRight.y)], ++ [wx.Point(rectRight.x + 7, rectRight.y + rectRight.height), ++ wx.Point(rectBottom.x + rectBottom.width - 1, rectBottom.y + 8)]] + + region = wx.Region() + region.Union(rectLeft) +@@ -2512,10 +2356,8 @@ def CreateShapesWithStyle(self): + self._aeroRects = [rectLeft, rectTop, rectRight, rectBottom, rectCenter] + self._valid = True + +- + self.region = region + +- + def SetGuideShape(self, event=None): + """ + Sets the correct shape for the docking guide window. +@@ -2530,7 +2372,6 @@ def SetGuideShape(self, event=None): + event.Skip() + wx.CallAfter(wx.SafeYield, self, True) + +- + def UpdateDockGuide(self, pos): + """ + Updates the docking guides images depending on the mouse position, using focused +@@ -2561,7 +2402,6 @@ def UpdateDockGuide(self, pos): + self._aeroBmp = self._allAeroBmps[-1] + self.Refresh() + +- + def HitTest(self, x, y): + """ + Checks if the mouse position is inside the target windows rect. +@@ -2586,12 +2426,11 @@ def HitTest(self, x, y): + lenRects = len(self._aeroRects) + for indx, rect in enumerate(self._aeroRects): + if rect.Contains((x, y)): +- if indx < lenRects or (indx == lenRects-1 and self._valid): ++ if indx < lenRects or (indx == lenRects - 1 and self._valid): + return constants[indx] + + return -1 + +- + def ValidateNotebookDocking(self, valid): + """ + Sets whether a pane can be docked on top of another to create an automatic +@@ -2610,7 +2449,6 @@ def ValidateNotebookDocking(self, valid): + self._valid = valid + self.Refresh() + +- + def AeroMove(self, pos): + """ + Moves the docking guide window to the new position. +@@ -2631,7 +2469,7 @@ def AeroMove(self, pos): + size = self.GetSize() + + leftRect, topRect, rightRect, bottomRect, centerRect = self._aeroRects +- thePos = pos + wx.Point((size.x-sizeY)/2, (size.y-sizeX)/2) ++ thePos = pos + wx.Point((size.x - sizeY) // 2, (size.y - sizeX) // 2) + + centerRect.SetTopLeft(thePos) + +@@ -2640,7 +2478,6 @@ def AeroMove(self, pos): + rightRect.SetTopLeft(thePos + wx.Point(sizeX, 0)) + bottomRect.SetTopLeft(thePos + wx.Point(0, sizeX)) + +- + def OnEraseBackground(self, event): + """ + Handles the ``wx.EVT_ERASE_BACKGROUND`` event for :class:`AuiCenterDockingGuide`. +@@ -2652,7 +2489,6 @@ def OnEraseBackground(self, event): + + pass + +- + def OnPaint(self, event): + """ + Handles the ``wx.EVT_PAINT`` event for :class:`AuiCenterDockingGuide`. +@@ -2677,8 +2513,8 @@ def OnPaint(self, event): + if not self._valid: + diff = (self._useAero == 2 and [1] or [0])[0] + bmpX, bmpY = self._deniedBitmap.GetWidth(), self._deniedBitmap.GetHeight() +- xPos, yPos = (rect.x + (rect.width)/2 - bmpX/2), (rect.y + (rect.height)/2 - bmpY/2) +- dc.DrawBitmap(self._deniedBitmap, xPos+1, yPos+diff, True) ++ xPos, yPos = (rect.x + (rect.width) // 2 - bmpX // 2), (rect.y + (rect.height) // 2 - bmpY // 2) ++ dc.DrawBitmap(self._deniedBitmap, xPos + 1, yPos + diff, True) + + return + +@@ -2696,7 +2532,7 @@ class AuiDockingHintWindow(wx.Frame): + + def __init__(self, parent, id=wx.ID_ANY, title="", pos=wx.DefaultPosition, + size=wx.Size(1, 1), style=wx.FRAME_TOOL_WINDOW | wx.FRAME_FLOAT_ON_PARENT | +- wx.FRAME_NO_TASKBAR | wx.NO_BORDER | wx.FRAME_SHAPED, ++ wx.FRAME_NO_TASKBAR | wx.NO_BORDER | wx.FRAME_SHAPED, + name="auiHintWindow"): + """ + Default class constructor. Used internally, do not call it in your code! +@@ -2738,7 +2574,6 @@ def __init__(self, parent, id=wx.ID_ANY, title="", pos=wx.DefaultPosition, + + self.Bind(wx.EVT_SIZE, self.OnSize) + +- + def MakeVenetianBlinds(self): + """ + Creates the "venetian blind" effect if :class:`AuiManager` has the ``AUI_MGR_VENETIAN_BLINDS_HINT`` +@@ -2760,7 +2595,6 @@ def MakeVenetianBlinds(self): + + self.SetShape(region) + +- + def SetBlindMode(self, agwFlags): + """ + Sets whether venetian blinds or transparent hints will be shown as docking hint. +@@ -2782,7 +2616,6 @@ def SetBlindMode(self, agwFlags): + else: + self.SetTransparent(0) + +- + def SetShape(self, region): + """ + If the platform supports it, sets the shape of the window to that depicted by `region`. +@@ -2801,7 +2634,6 @@ def SetShape(self, region): + else: + super(AuiDockingHintWindow, self).SetShape(region) + +- + def Show(self, show=True): + """ + Show the hint window. +@@ -2823,7 +2655,6 @@ def Show(self, show=True): + # Need to manually do layout since its a borderless frame. + self.Layout() + +- + def OnSize(self, event): + """ + Handles the ``wx.EVT_SIZE`` event for :class:`AuiDockingHintWindow`. +@@ -2836,7 +2667,6 @@ def OnSize(self, event): + + self.Refresh() + +- + def OnPaint(self, event): + """ + Handles the ``wx.EVT_PAINT`` event for :class:`AuiDockingHintWindow`. +@@ -2864,7 +2694,7 @@ class AuiFloatingFrame(wx.MiniFrame): + + def __init__(self, parent, owner_mgr, pane=None, id=wx.ID_ANY, title="", + style=wx.FRAME_TOOL_WINDOW | wx.FRAME_FLOAT_ON_PARENT | +- wx.FRAME_NO_TASKBAR | wx.CLIP_CHILDREN): ++ wx.FRAME_NO_TASKBAR | wx.CLIP_CHILDREN): + """ + Default class constructor. Used internally, do not call it in your code! + +@@ -2933,7 +2763,6 @@ def __init__(self, parent, owner_mgr, pane=None, id=wx.ID_ANY, title="", + self._mgr.SetArtProvider(owner_mgr.GetArtProvider()) + self._mgr.SetAGWFlags(owner_mgr.GetAGWFlags()) + +- + def CopyAttributes(self, pane): + """ + Copies all the attributes of the input `pane` into another :class:`AuiPaneInfo`. +@@ -2969,7 +2798,6 @@ def CopyAttributes(self, pane): + + return contained_pane + +- + def SetPaneWindow(self, pane): + """ + Sets all the properties of a pane. +@@ -2988,9 +2816,9 @@ def SetPaneWindow(self, pane): + contained_pane = self.CopyAttributes(pane) + + contained_pane.Dock().Center().Show(). \ +- CaptionVisible(False). \ +- PaneBorder(False). \ +- Layer(0).Row(0).Position(0) ++ CaptionVisible(False). \ ++ PaneBorder(False). \ ++ Layer(0).Row(0).Position(0) + + if not contained_pane.HasGripper() and not self._useNativeMiniframes: + contained_pane.CaptionVisible(True) +@@ -3005,30 +2833,31 @@ def SetPaneWindow(self, pane): + pane_best_size = contained_pane.best_size + if pane_best_size.IsFullySpecified() and (pane_best_size.x < pane_min_size.x or \ + pane_best_size.y < pane_min_size.y): +- + pane_min_size = pane_best_size + self._pane_window.SetMinSize(pane_min_size) + + # if the frame window's max size is greater than the min size + # then set the max size to the min size as well + cur_max_size = self.GetMaxSize() +- if cur_max_size.IsFullySpecified() and (cur_max_size.x < pane_min_size.x or \ +- cur_max_size.y < pane_min_size.y): ++ if cur_max_size.IsFullySpecified() and (cur_max_size.x < pane_min_size.x or \ ++ cur_max_size.y < pane_min_size.y): + self.SetMaxSize(pane_min_size) + + art_provider = self._mgr.GetArtProvider() + caption_size = art_provider.GetMetric(AUI_DOCKART_CAPTION_SIZE) + button_size = art_provider.GetMetric(AUI_DOCKART_PANE_BUTTON_SIZE) + \ +- 4*art_provider.GetMetric(AUI_DOCKART_PANE_BORDER_SIZE) ++ 4 * art_provider.GetMetric(AUI_DOCKART_PANE_BORDER_SIZE) + + min_size = pane.window.GetMinSize() + + if min_size.y < caption_size or min_size.x < button_size: + new_x, new_y = min_size.x, min_size.y + if min_size.y < caption_size: +- new_y = (pane.IsResizeable() and [2*wx.SystemSettings.GetMetric(wx.SYS_EDGE_Y)+caption_size] or [1])[0] ++ new_y = \ ++ (pane.IsResizeable() and [2 * wx.SystemSettings.GetMetric(wx.SYS_EDGE_Y) + caption_size] or [1])[0] + if min_size.x < button_size: +- new_x = (pane.IsResizeable() and [2*wx.SystemSettings.GetMetric(wx.SYS_EDGE_X)+button_size] or [1])[0] ++ new_x = (pane.IsResizeable() and [2 * wx.SystemSettings.GetMetric(wx.SYS_EDGE_X) + button_size] or [1])[ ++ 0] + + self.SetMinSize((new_x, new_y)) + else: +@@ -3071,20 +2900,18 @@ def SetPaneWindow(self, pane): + self._owner_mgr._panes[indx] = pane + + self._fly_step = abs(pane.floating_size.y - \ +- (caption_size + 2*wx.SystemSettings.GetMetric(wx.SYS_EDGE_Y)))/10 ++ (caption_size + 2 * wx.SystemSettings.GetMetric(wx.SYS_EDGE_Y))) // 10 + + self._floating_size = wx.Size(*self.GetSize()) + + if pane.IsFlyOut(): + self._check_fly_timer.Start(50) + +- + def GetOwnerManager(self): + """ Returns the :class:`AuiManager` that manages the pane. """ + + return self._owner_mgr + +- + def OnSize(self, event): + """ + Handles the ``wx.EVT_SIZE`` event for :class:`AuiFloatingFrame`. +@@ -3095,7 +2922,6 @@ def OnSize(self, event): + if self._owner_mgr and self._send_size and self.IsShownOnScreen(): + self._owner_mgr.OnFloatingPaneResized(self._pane_window, event.GetSize()) + +- + def OnClose(self, event): + """ + Handles the ``wx.EVT_CLOSE`` event for :class:`AuiFloatingFrame`. +@@ -3118,7 +2944,6 @@ def OnClose(self, event): + self._mgr.UnInit() + self.Destroy() + +- + def OnActivate(self, event): + """ + Handles the ``wx.EVT_ACTIVATE`` event for :class:`AuiFloatingFrame`. +@@ -3129,7 +2954,6 @@ def OnActivate(self, event): + if self._owner_mgr and event.GetActive(): + self._owner_mgr.OnFloatingPaneActivated(self._pane_window) + +- + def OnMove(self, event): + """ + Handles the ``wx.EVT_MOVE`` event for :class:`AuiFloatingFrame`. +@@ -3146,7 +2970,6 @@ def OnMove(self, event): + if self._owner_mgr: + self._owner_mgr.OnFloatingPaneMoved(self._pane_window, event) + +- + def OnMoveEvent(self, event): + """ + Handles the ``wx.EVT_MOVE`` and ``wx.EVT_MOVING`` events for :class:`AuiFloatingFrame`. +@@ -3228,7 +3051,6 @@ def OnMoveEvent(self, event): + else: + self.OnMoving(wx.Rect(event.GetPosition(), self.GetSize()), dir) + +- + def OnIdle(self, event): + """ + Handles the ``wx.EVT_IDLE`` event for :class:`AuiFloatingFrame`. +@@ -3249,7 +3071,6 @@ def OnIdle(self, event): + else: + event.RequestMore() + +- + def OnMoveStart(self, event): + """ + The user has just started moving the floating pane. +@@ -3278,7 +3099,6 @@ def OnMoveStart(self, event): + self._owner_mgr._action_offset = action_offset + self._owner_mgr.OnMotion_DragFloatingPane(point) + +- + def OnMoving(self, rect, direction): + """ + The user is moving the floating pane. +@@ -3297,7 +3117,6 @@ def OnMoving(self, rect, direction): + self.OnMoveStart(None) + self._lastDirection = direction + +- + def OnMoveFinished(self): + """ + The user has just finished moving the floating pane. +@@ -3320,7 +3139,6 @@ def OnMoveFinished(self): + + self._owner_mgr.OnFloatingPaneMoved(self._pane_window, point) + +- + def OnCheckFlyTimer(self, event): + """ + Handles the ``wx.EVT_TIMER`` event for :class:`AuiFloatingFrame`. +@@ -3336,7 +3154,6 @@ def OnCheckFlyTimer(self, event): + if self.IsShownOnScreen(): + self.FlyOut() + +- + def OnFindManager(self, event): + """ + Handles the ``EVT_AUI_FIND_MANAGER`` event for :class:`AuiFloatingFrame`. +@@ -3346,7 +3163,6 @@ def OnFindManager(self, event): + + event.SetManager(self._owner_mgr) + +- + def FlyOut(self): + """ Starts the flying in and out of a floating pane. """ + +@@ -3370,7 +3186,6 @@ def FlyOut(self): + self._send_size = False + self._fly_timer.Start(5) + +- + def OnFlyTimer(self, event): + """ + Handles the ``wx.EVT_TIMER`` event for :class:`AuiFloatingFrame`. +@@ -3388,7 +3203,7 @@ def OnFlyTimer(self, event): + min_size = self._mgr.GetArtProvider().GetMetric(AUI_DOCKART_CAPTION_SIZE) + + if wx.Platform != "__WXMSW__": +- min_size += 2*wx.SystemSettings.GetMetric(wx.SYS_EDGE_Y) ++ min_size += 2 * wx.SystemSettings.GetMetric(wx.SYS_EDGE_Y) + + if current_size.y - self._fly_step <= min_size: + self.SetClientSize((current_size.x, min_size)) +@@ -3396,7 +3211,7 @@ def OnFlyTimer(self, event): + self._fly_timer.Stop() + self._send_size = True + else: +- self.SetClientSize((current_size.x, current_size.y-self._fly_step)) ++ self.SetClientSize((current_size.x, current_size.y - self._fly_step)) + + else: + if current_size.y + self._fly_step >= floating_size.y: +@@ -3405,12 +3220,11 @@ def OnFlyTimer(self, event): + self._fly_timer.Stop() + self._send_size = True + else: +- self.SetClientSize((current_size.x, current_size.y+self._fly_step)) ++ self.SetClientSize((current_size.x, current_size.y + self._fly_step)) + + self.Update() + self.Refresh() + +- + def FadeOut(self): + """ Actually starts the fading out of the floating pane. """ + +@@ -3578,7 +3392,7 @@ def GetMaxRow(panes, dock_direction, dock_layer): + + for pane in panes: + if pane.dock_direction == dock_direction and pane.dock_layer == dock_layer and \ +- pane.dock_row > max_row: ++ pane.dock_row > max_row: + max_row = pane.dock_row + + return max_row +@@ -3617,7 +3431,7 @@ def DoInsertDockRow(panes, dock_direction, dock_layer, dock_row): + + for pane in panes: + if not pane.IsFloating() and pane.dock_direction == dock_direction and \ +- pane.dock_layer == dock_layer and pane.dock_row >= dock_row: ++ pane.dock_layer == dock_layer and pane.dock_row >= dock_row: + pane.dock_row += 1 + + return panes +@@ -3638,8 +3452,8 @@ def DoInsertPane(panes, dock_direction, dock_layer, dock_row, dock_pos): + for ii in range(len(panes)): + pane = panes[ii] + if not pane.IsFloating() and pane.dock_direction == dock_direction and \ +- pane.dock_layer == dock_layer and pane.dock_row == dock_row and \ +- pane.dock_pos >= dock_pos: ++ pane.dock_layer == dock_layer and pane.dock_row == dock_row and \ ++ pane.dock_pos >= dock_pos: + pane.dock_pos = pane.dock_pos + 1 + + panes[ii] = pane +@@ -3662,7 +3476,7 @@ def FindDocks(docks, dock_direction, dock_layer=-1, dock_row=-1, reverse=False): + matchDocks = [(d.dock_layer, d.dock_row, d.dock_direction, d) for d in docks if \ + (dock_direction == -1 or dock_direction == d.dock_direction) and \ + ((dock_layer == -1 or dock_layer == d.dock_layer) and \ +- (dock_row == -1 or dock_row == d.dock_row))] ++ (dock_row == -1 or dock_row == d.dock_row))] + + arr = [x[-1] for x in sorted(matchDocks, reverse=reverse)] + +@@ -3793,7 +3607,7 @@ def CheckEdgeDrop(window, docks, pt): + return wx.LEFT + + if pt.x >= clientSize.x - auiLayerInsertOffset and \ +- pt.x < clientSize.x - auiLayerInsertOffset + auiLayerInsertPixels: ++ pt.x < clientSize.x - auiLayerInsertOffset + auiLayerInsertPixels: + return wx.RIGHT + + if screenPt.x >= frameRect.GetLeft() and screenPt.x < frameRect.GetRight(): +@@ -3801,7 +3615,7 @@ def CheckEdgeDrop(window, docks, pt): + return wx.TOP + + if pt.y >= clientSize.y - auiLayerInsertOffset and \ +- pt.y < clientSize.y - auiLayerInsertOffset + auiLayerInsertPixels: ++ pt.y < clientSize.y - auiLayerInsertOffset + auiLayerInsertPixels: + return wx.BOTTOM + + return -1 +@@ -4121,6 +3935,7 @@ def __init__(self, managed_window=None, agwFlags=None): + ``AUI_MGR_AUTONB_NO_CAPTION`` Panes that merge into an automatic notebook will not have the pane caption visible + ==================================== ================================== + ++ + Default value for `agwFlags` is: + ``AUI_MGR_DEFAULT`` = ``AUI_MGR_ALLOW_FLOATING`` | ``AUI_MGR_TRANSPARENT_HINT`` | ``AUI_MGR_HINT_FADE`` | ``AUI_MGR_NO_VENETIAN_BLINDS_FADE`` + +@@ -4223,7 +4038,6 @@ def __init__(self, managed_window=None, agwFlags=None): + self.Bind(auibook.EVT_AUINOTEBOOK_PAGE_CLOSE, self.OnTabPageClose) + self.Bind(auibook.EVT_AUINOTEBOOK_PAGE_CHANGED, self.OnTabSelected) + +- + def CreateFloatingFrame(self, parent, pane_info): + """ + Creates a floating frame for the windows. +@@ -4234,7 +4048,6 @@ def CreateFloatingFrame(self, parent, pane_info): + + return AuiFloatingFrame(parent, self, pane_info) + +- + def CanDockPanel(self, p): + """ + Returns whether a pane can be docked or not. +@@ -4250,7 +4063,6 @@ def CanDockPanel(self, p): + # don't dock the window + return not (wx.GetKeyState(wx.WXK_CONTROL) or wx.GetKeyState(wx.WXK_ALT)) + +- + def GetPaneByWidget(self, window): + """ + This version of :meth:`GetPane` looks up a pane based on a 'pane window'. +@@ -4266,7 +4078,6 @@ def GetPaneByWidget(self, window): + + return NonePaneInfo + +- + def GetPaneByName(self, name): + """ + This version of :meth:`GetPane` looks up a pane based on a 'pane name'. +@@ -4282,7 +4093,6 @@ def GetPaneByName(self, name): + + return NonePaneInfo + +- + def GetPane(self, item): + """ + Looks up a :class:`AuiPaneInfo` structure based on the supplied window pointer. Upon failure, +@@ -4300,13 +4110,11 @@ def GetPane(self, item): + else: + return self.GetPaneByWidget(item) + +- + def GetAllPanes(self): + """ Returns a reference to all the pane info structures. """ + + return self._panes + +- + def ShowPane(self, window, show): + """ + Shows or hides a pane based on the window passed as input. +@@ -4338,7 +4146,6 @@ def ShowPane(self, window, show): + + self.Update() + +- + def HitTest(self, x, y): + """ + This is an internal function which determines +@@ -4370,7 +4177,6 @@ def HitTest(self, x, y): + + return result + +- + def PaneHitTest(self, panes, pt): + """ + Similar to :meth:`HitTest`, but it checks in which :class:`AuiManager` rectangle the +@@ -4386,7 +4192,6 @@ def PaneHitTest(self, panes, pt): + + return NonePaneInfo + +- + # SetAGWFlags() and GetAGWFlags() allow the owner to set various + # options which are global to AuiManager + +@@ -4435,7 +4240,6 @@ def SetAGWFlags(self, agwFlags): + if self._hint_window and agwFlags & AUI_MGR_RECTANGLE_HINT == 0: + self.CreateHintWindow() + +- + def GetAGWFlags(self): + """ + Returns the current manager's flags. +@@ -4445,7 +4249,6 @@ def GetAGWFlags(self): + + return self._agwFlags + +- + def SetManagedWindow(self, managed_window): + """ + Called to specify the frame or window which is to be managed by :class:`AuiManager`. +@@ -4489,13 +4292,11 @@ def SetManagedWindow(self, managed_window): + self.AddPane(client_window, AuiPaneInfo().Name("mdiclient"). + CenterPane().PaneBorder(False)) + +- + def GetManagedWindow(self): + """ Returns the window being managed by :class:`AuiManager`. """ + + return self._frame + +- + def SetFrame(self, managed_window): + """ + Called to specify the frame or window which is to be managed by :class:`AuiManager`. +@@ -4512,7 +4313,6 @@ def SetFrame(self, managed_window): + DeprecationWarning("This method is deprecated, use SetManagedWindow instead.") + return self.SetManagedWindow(managed_window) + +- + def GetFrame(self): + """ + Returns the window being managed by :class:`AuiManager`. +@@ -4524,7 +4324,6 @@ def GetFrame(self): + DeprecationWarning("This method is deprecated, use GetManagedWindow instead.") + return self._frame + +- + def CreateGuideWindows(self): + """ Creates the VS2005 HUD guide windows. """ + +@@ -4541,7 +4340,6 @@ def CreateGuideWindows(self): + self._guides.append(AuiDockingGuideInfo().Centre(). + Host(AuiCenterDockingGuide(self._frame))) + +- + def DestroyGuideWindows(self): + """ Destroys the VS2005 HUD guide windows. """ + for guide in self._guides: +@@ -4549,7 +4347,6 @@ def DestroyGuideWindows(self): + guide.host.Destroy() + self._guides = [] + +- + def CreateHintWindow(self): + """ Creates the standard wxAUI hint window. """ + +@@ -4558,7 +4355,6 @@ def CreateHintWindow(self): + self._hint_window = AuiDockingHintWindow(self._frame) + self._hint_window.SetBlindMode(self._agwFlags) + +- + def DestroyHintWindow(self): + """ Destroys the standard wxAUI hint window. """ + +@@ -4566,7 +4362,6 @@ def DestroyHintWindow(self): + self._hint_window.Destroy() + self._hint_window = None + +- + def UnInit(self): + """ + Uninitializes the framework and should be called before a managed frame or +@@ -4587,7 +4382,6 @@ def UnInit(self): + if isinstance(handler, AuiManager): + klass.RemoveEventHandler(handler) + +- + def OnClose(self, event): + """Called when the managed window is closed. Makes sure that :meth:`UnInit` + is called. +@@ -4597,8 +4391,7 @@ def OnClose(self, event): + if event.GetEventObject() == self._frame: + wx.CallAfter(self.UnInit) + +- +- def OnDestroy(self, event) : ++ def OnDestroy(self, event): + """Called when the managed window is destroyed. Makes sure that :meth:`UnInit` + is called. + """ +@@ -4606,13 +4399,11 @@ def OnDestroy(self, event) : + if self._frame == event.GetEventObject(): + self.UnInit() + +- + def GetArtProvider(self): + """ Returns the current art provider being used. """ + + return self._art + +- + def ProcessMgrEvent(self, event): + """ + Process the AUI events sent to the manager. +@@ -4627,7 +4418,6 @@ def ProcessMgrEvent(self, event): + + self.ProcessEvent(event) + +- + def FireEvent(self, evtType, pane, canVeto=False): + """ + Fires one of the ``EVT_AUI_PANE_FLOATED`` / ``FLOATING`` / ``DOCKING`` / ``DOCKED`` / ``ACTIVATED`` event. +@@ -4644,7 +4434,6 @@ def FireEvent(self, evtType, pane, canVeto=False): + + return event + +- + def CanUseModernDockArt(self): + """ + Returns whether :class:`dockart` can be used (Windows XP / Vista / 7 only, +@@ -4663,7 +4452,6 @@ def CanUseModernDockArt(self): + + return True + +- + def SetArtProvider(self, art_provider): + """ + Instructs :class:`AuiManager` to use art provider specified by the parameter +@@ -4686,7 +4474,6 @@ def SetArtProvider(self, art_provider): + pane.frame._mgr.SetArtProvider(art_provider) + pane.frame._mgr.Update() + +- + def AddPane(self, window, arg1=None, arg2=None, target=None): + """ + Tells the frame manager to start managing a child window. There +@@ -4723,7 +4510,6 @@ def AddPane(self, window, arg1=None, arg2=None, target=None): + else: + return self.AddPane1(window, arg1) + +- + def AddPane1(self, window, pane_info): + """ See comments on :meth:`AddPane`. """ + +@@ -4739,7 +4525,7 @@ def AddPane1(self, window, pane_info): + # bug in the library user's application + already_exists = False + if pane_info.name != "" and self.GetPane(pane_info.name).IsOk(): +- warnings.warn("A pane with the name '%s' already exists in the manager!"%pane_info.name) ++ warnings.warn("A pane with the name '%s' already exists in the manager!" % pane_info.name) + already_exists = True + + # if the new pane is docked then we should undo maximize +@@ -4819,7 +4605,6 @@ def AddPane1(self, window, pane_info): + + return True + +- + def AddPane2(self, window, direction, caption): + """ See comments on :meth:`AddPane`. """ + +@@ -4839,7 +4624,6 @@ def AddPane2(self, window, direction, caption): + + return self.AddPane(window, pinfo) + +- + def AddPane3(self, window, pane_info, drop_pos): + """ See comments on :meth:`AddPane`. """ + +@@ -4854,7 +4638,6 @@ def AddPane3(self, window, pane_info, drop_pos): + + return True + +- + def AddPane4(self, window, pane_info, target): + """ See comments on :meth:`AddPane`. """ + +@@ -4880,7 +4663,6 @@ def AddPane4(self, window, pane_info, target): + + return True + +- + def InsertPane(self, window, pane_info, insert_level=AUI_INSERT_PANE): + """ + This method is used to insert either a previously unmanaged pane window +@@ -4944,7 +4726,6 @@ def InsertPane(self, window, pane_info, insert_level=AUI_INSERT_PANE): + + return True + +- + def DetachPane(self, window): + """ + Tells the :class:`AuiManager` to stop managing the pane specified +@@ -4999,7 +4780,6 @@ def DetachPane(self, window): + + return False + +- + def ClosePane(self, pane_info): + """ + Destroys or hides the pane depending on its flags. +@@ -5049,7 +4829,6 @@ def ClosePane(self, pane_info): + pane_info.window.Reparent(self._frame) + pane_info.Dock().Hide() + +- + # now we need to either destroy or hide the pane + to_destroy = 0 + if pane_info.IsDestroyOnClose(): +@@ -5064,7 +4843,7 @@ def ClosePane(self, pane_info): + if pane_info.IsNotebookControl(): + + notebook = self._notebooks[pane_info.notebook_id] +- for idx in range(notebook.GetPageCount()-1, -1, -1): ++ for idx in range(notebook.GetPageCount() - 1, -1, -1): + window = notebook.GetPage(idx) + info = self.GetPane(window) + # close page if its IsDestroyOnClose flag is set +@@ -5111,7 +4890,6 @@ def MaximizePane(self, pane_info, savesizes=True): + if pane_info.window and not pane_info.window.IsShown(): + pane_info.window.Show(True) + +- + def SavePreviousDockSizes(self, pane_info): + """ + Stores the previous dock sizes, to be used in a "restore" action later. +@@ -5126,7 +4904,6 @@ def SavePreviousDockSizes(self, pane_info): + if pane_info is not p: + p.SetFlag(p.needsRestore, True) + +- + def RestorePane(self, pane_info): + """ + Restores the input pane from a previous maximized or minimized state. +@@ -5150,7 +4927,6 @@ def RestorePane(self, pane_info): + if pane_info.window and not pane_info.window.IsShown(): + pane_info.window.Show(True) + +- + def RestoreMaximizedPane(self): + """ Restores the current maximized pane (if any). """ + +@@ -5160,7 +4936,6 @@ def RestoreMaximizedPane(self): + self.RestorePane(p) + break + +- + def ActivatePane(self, window): + """ + Activates the pane to which `window` is associated. +@@ -5179,7 +4954,6 @@ def ActivatePane(self, window): + self.RefreshCaptions() + self.FireEvent(wxEVT_AUI_PANE_ACTIVATED, window, canVeto=False) + +- + def CreateNotebook(self): + """ + Creates an automatic :class:`~wx.lib.agw.aui.auibook.AuiNotebook` when a pane is docked on +@@ -5195,7 +4969,6 @@ def CreateNotebook(self): + + return notebook + +- + def SetAutoNotebookTabArt(self, art): + """ + Sets the default tab art provider for automatic notebooks. +@@ -5210,13 +4983,11 @@ def SetAutoNotebookTabArt(self, art): + + self._autoNBTabArt = art + +- + def GetAutoNotebookTabArt(self): + """ Returns the default tab art provider for automatic notebooks. """ + + return self._autoNBTabArt + +- + def SetAutoNotebookStyle(self, agwStyle): + """ + Sets the default AGW-specific window style for automatic notebooks. +@@ -5262,7 +5033,6 @@ def SetAutoNotebookStyle(self, agwStyle): + + self._autoNBStyle = agwStyle + +- + def GetAutoNotebookStyle(self): + """ + Returns the default AGW-specific window style for automatic notebooks. +@@ -5272,7 +5042,6 @@ def GetAutoNotebookStyle(self): + + return self._autoNBStyle + +- + def SavePaneInfo(self, pane): + """ + This method is similar to :meth:`SavePerspective`, with the exception +@@ -5285,28 +5054,27 @@ def SavePaneInfo(self, pane): + result = "name=" + EscapeDelimiters(pane.name) + ";" + result += "caption=" + EscapeDelimiters(pane.caption) + ";" + +- result += "state=%u;"%pane.state +- result += "dir=%d;"%pane.dock_direction +- result += "layer=%d;"%pane.dock_layer +- result += "row=%d;"%pane.dock_row +- result += "pos=%d;"%pane.dock_pos +- result += "prop=%d;"%pane.dock_proportion +- result += "bestw=%d;"%pane.best_size.x +- result += "besth=%d;"%pane.best_size.y +- result += "minw=%d;"%pane.min_size.x +- result += "minh=%d;"%pane.min_size.y +- result += "maxw=%d;"%pane.max_size.x +- result += "maxh=%d;"%pane.max_size.y +- result += "floatx=%d;"%pane.floating_pos.x +- result += "floaty=%d;"%pane.floating_pos.y +- result += "floatw=%d;"%pane.floating_size.x +- result += "floath=%d;"%pane.floating_size.y +- result += "notebookid=%d;"%pane.notebook_id +- result += "transparent=%d"%pane.transparent ++ result += "state=%u;" % pane.state ++ result += "dir=%d;" % pane.dock_direction ++ result += "layer=%d;" % pane.dock_layer ++ result += "row=%d;" % pane.dock_row ++ result += "pos=%d;" % pane.dock_pos ++ result += "prop=%d;" % pane.dock_proportion ++ result += "bestw=%d;" % pane.best_size.x ++ result += "besth=%d;" % pane.best_size.y ++ result += "minw=%d;" % pane.min_size.x ++ result += "minh=%d;" % pane.min_size.y ++ result += "maxw=%d;" % pane.max_size.x ++ result += "maxh=%d;" % pane.max_size.y ++ result += "floatx=%d;" % pane.floating_pos.x ++ result += "floaty=%d;" % pane.floating_pos.y ++ result += "floatw=%d;" % pane.floating_size.x ++ result += "floath=%d;" % pane.floating_size.y ++ result += "notebookid=%d;" % pane.notebook_id ++ result += "transparent=%d" % pane.transparent + + return result + +- + def LoadPaneInfo(self, pane_part, pane): + """ + This method is similar to to :meth:`LoadPerspective`, with the exception that +@@ -5387,7 +5155,6 @@ def LoadPaneInfo(self, pane_part, pane): + + return pane + +- + def SavePerspective(self): + """ + Saves the entire user interface layout into an encoded string, which can then +@@ -5403,13 +5170,12 @@ def SavePerspective(self): + result += self.SavePaneInfo(pane) + "|" + + for dock in self._docks: +- result = result + ("dock_size(%d,%d,%d)=%d|")%(dock.dock_direction, +- dock.dock_layer, +- dock.dock_row, +- dock.size) ++ result = result + ("dock_size(%d,%d,%d)=%d|") % (dock.dock_direction, ++ dock.dock_layer, ++ dock.dock_row, ++ dock.size) + return result + +- + def LoadPerspective(self, layout, update=True, restorecaption=False): + """ + Loads a layout which was saved with :meth:`SavePerspective`. +@@ -5430,13 +5196,13 @@ def LoadPerspective(self, layout, update=True, restorecaption=False): + # 'layout2' = wxAUI 0.9.2 (wxWidgets 2.8) + index = input.find("|") + part = input[0:index].strip() +- input = input[index+1:] ++ input = input[index + 1:] + + if part != "layout2": + return False + + # mark all panes currently managed as docked and hidden +- saveCapt = {} # see restorecaption param ++ saveCapt = {} # see restorecaption param + for pane in self._panes: + + # dock the notebook pages +@@ -5465,7 +5231,7 @@ def LoadPerspective(self, layout, update=True, restorecaption=False): + pane = AuiPaneInfo() + index = input.find("|") + pane_part = input[0:index].strip() +- input = input[index+1:] ++ input = input[index + 1:] + + # if the string is empty, we're done parsing + if pane_part == "": +@@ -5474,10 +5240,10 @@ def LoadPerspective(self, layout, update=True, restorecaption=False): + if pane_part[0:9] == "dock_size": + index = pane_part.find("=") + val_name = pane_part[0:index] +- value = pane_part[index+1:] ++ value = pane_part[index + 1:] + + index = val_name.find("(") +- piece = val_name[index+1:] ++ piece = val_name[index + 1:] + index = piece.find(")") + piece = piece[0:index] + +@@ -5538,7 +5304,6 @@ def LoadPerspective(self, layout, update=True, restorecaption=False): + + return True + +- + def GetPanePositionsAndSizes(self, dock): + """ + Returns all the panes positions and sizes in a dock. +@@ -5572,7 +5337,7 @@ def GetPanePositionsAndSizes(self, dock): + size = 0 + + if pane.HasBorder(): +- size += pane_border_size*2 ++ size += pane_border_size * 2 + + if dock.IsHorizontal(): + if pane.HasGripper() and not pane.HasGripperTop(): +@@ -5623,7 +5388,6 @@ def GetPanePositionsAndSizes(self, dock): + + return positions, sizes + +- + def LayoutAddPane(self, cont, dock, pane, uiparts, spacer_only): + """ + Adds a pane into the existing layout (in an existing dock). +@@ -5635,7 +5399,7 @@ def LayoutAddPane(self, cont, dock, pane, uiparts, spacer_only): + :param bool `spacer_only`: whether to add a simple spacer or a real window. + """ + +- #sizer_item = wx.SizerItem() ++ # sizer_item = wx.SizerItem() + caption_size = self._art.GetMetric(AUI_DOCKART_CAPTION_SIZE) + gripper_size = self._art.GetMetric(AUI_DOCKART_GRIPPER_SIZE) + pane_border_size = self._art.GetMetric(AUI_DOCKART_PANE_BORDER_SIZE) +@@ -5674,7 +5438,7 @@ def LayoutAddPane(self, cont, dock, pane, uiparts, spacer_only): + uiparts.append(part) + + button_count = len(pane.buttons) +- button_width_total = button_count*pane_button_size ++ button_width_total = button_count * pane_button_size + if button_count >= 1: + button_width_total += 3 + +@@ -5686,7 +5450,7 @@ def LayoutAddPane(self, cont, dock, pane, uiparts, spacer_only): + + # add pane buttons to the caption + dummy_parts = [] +- for btn_id in range(len(pane.buttons)-1, -1, -1): ++ for btn_id in range(len(pane.buttons) - 1, -1, -1): + sizer_item = caption_sizer.Add((caption_size, pane_button_size), 0, wx.EXPAND) + part = AuiDockUIPart() + part.type = AuiDockUIPart.typePaneButton +@@ -5790,7 +5554,7 @@ def LayoutAddPane(self, cont, dock, pane, uiparts, spacer_only): + pane_proportion = 0 + + if min_size != wx.Size(-1, -1): +- vert_pane_sizer.SetItemMinSize(len(vert_pane_sizer.GetChildren())-1, (min_size.x, min_size.y)) ++ vert_pane_sizer.SetItemMinSize(len(vert_pane_sizer.GetChildren()) - 1, (min_size.x, min_size.y)) + + # add the vertical/horizontal sizer (caption, pane window) to the + # horizontal sizer (gripper, vertical sizer) +@@ -5815,7 +5579,6 @@ def LayoutAddPane(self, cont, dock, pane, uiparts, spacer_only): + + return uiparts + +- + def LayoutAddDock(self, cont, dock, uiparts, spacer_only): + """ + Adds a dock into the existing layout. +@@ -5826,7 +5589,7 @@ def LayoutAddDock(self, cont, dock, uiparts, spacer_only): + :param bool `spacer_only`: whether to add a simple spacer or a real window. + """ + +-# sizer_item = wx.SizerItem() ++ # sizer_item = wx.SizerItem() + part = AuiDockUIPart() + + sash_size = self._art.GetMetric(AUI_DOCKART_SASH_SIZE) +@@ -5834,8 +5597,7 @@ def LayoutAddDock(self, cont, dock, uiparts, spacer_only): + + # resizable bottom and right docks have a sash before them + if not self._has_maximized and not dock.fixed and \ +- dock.dock_direction in [AUI_DOCK_BOTTOM, AUI_DOCK_RIGHT]: +- ++ dock.dock_direction in [AUI_DOCK_BOTTOM, AUI_DOCK_RIGHT]: + sizer_item = cont.Add((sash_size, sash_size), 0, wx.EXPAND) + + part.type = AuiDockUIPart.typeDockSizer +@@ -5882,7 +5644,7 @@ def LayoutAddDock(self, cont, dock, uiparts, spacer_only): + part.dock = dock + part.pane = None + part.button = None +- part.orientation = (orientation==wx.HORIZONTAL and \ ++ part.orientation = (orientation == wx.HORIZONTAL and \ + [wx.VERTICAL] or [wx.HORIZONTAL])[0] + part.cont_sizer = dock_sizer + part.sizer_item = sizer_item +@@ -5922,9 +5684,9 @@ def LayoutAddDock(self, cont, dock, uiparts, spacer_only): + part = AuiDockUIPart() + part.type = AuiDockUIPart.typePaneSizer + part.dock = dock +- part.pane = dock.panes[pane_i-1] ++ part.pane = dock.panes[pane_i - 1] + part.button = None +- part.orientation = (orientation==wx.HORIZONTAL and \ ++ part.orientation = (orientation == wx.HORIZONTAL and \ + [wx.VERTICAL] or [wx.HORIZONTAL])[0] + part.cont_sizer = dock_sizer + part.sizer_item = sizer_item +@@ -5954,8 +5716,7 @@ def LayoutAddDock(self, cont, dock, uiparts, spacer_only): + + # top and left docks have a sash after them + if not self._has_maximized and not dock.fixed and \ +- dock.dock_direction in [AUI_DOCK_TOP, AUI_DOCK_LEFT]: +- ++ dock.dock_direction in [AUI_DOCK_TOP, AUI_DOCK_LEFT]: + sizer_item = cont.Add((sash_size, sash_size), 0, wx.EXPAND) + + part = AuiDockUIPart() +@@ -5970,7 +5731,6 @@ def LayoutAddDock(self, cont, dock, uiparts, spacer_only): + + return uiparts + +- + def LayoutAll(self, panes, docks, uiparts, spacer_only=False, oncheck=True): + """ + Layouts all the UI structures in the interface. +@@ -6040,8 +5800,8 @@ def LayoutAll(self, panes, docks, uiparts, spacer_only=False, oncheck=True): + frameRect = GetInternalFrameRect(self._frame, self._docks) + + # set max size allowing for sashes and absolute minimum +- maxsize = frameRect[2:][isHor] - sum(sizes) - (len(sizes)*10) - (sashSize*len(sizes)) +- dock.size = min(p.previousDockSize,maxsize) ++ maxsize = frameRect[2:][isHor] - sum(sizes) - (len(sizes) * 10) - (sashSize * len(sizes)) ++ dock.size = min(p.previousDockSize, maxsize) + + else: + dock.size = 0 +@@ -6079,8 +5839,8 @@ def LayoutAll(self, panes, docks, uiparts, spacer_only=False, oncheck=True): + # dock position (dock_pos), in ascending order + dock_pane_count = len(dock.panes) + if dock_pane_count > 1: +- #~ dock.panes.sort(PaneSortFunc) +- dock.panes.sort(key = lambda pane: pane.dock_pos) ++ # ~ dock.panes.sort(PaneSortFunc) ++ dock.panes.sort(key=lambda pane: pane.dock_pos) + + # for newly created docks, set up their initial size + if dock.size == 0: +@@ -6100,7 +5860,7 @@ def LayoutAll(self, panes, docks, uiparts, spacer_only=False, oncheck=True): + # if at least one pane inside the dock has a pane border + for pane in dock.panes: + if pane.HasBorder(): +- size = size + pane_border_size*2 ++ size = size + pane_border_size * 2 + break + + # if pane is on the top or bottom, add the caption height, +@@ -6118,8 +5878,8 @@ def LayoutAll(self, panes, docks, uiparts, spacer_only=False, oncheck=True): + + # new dock's size may not be more than the dock constraint + # parameter specifies. See SetDockSizeConstraint() +- max_dock_x_size = int(self._dock_constraint_x*float(cli_size.x)) +- max_dock_y_size = int(self._dock_constraint_y*float(cli_size.y)) ++ max_dock_x_size = int(self._dock_constraint_x * float(cli_size.x)) ++ max_dock_y_size = int(self._dock_constraint_y * float(cli_size.y)) + if tuple(cli_size) <= tuple(wx.Size(20, 20)): + max_dock_x_size = 10000 + max_dock_y_size = 10000 +@@ -6156,7 +5916,7 @@ def LayoutAll(self, panes, docks, uiparts, spacer_only=False, oncheck=True): + dock_min_size = pane.min_size.x + + if plus_border: +- dock_min_size += pane_border_size*2 ++ dock_min_size += pane_border_size * 2 + if plus_caption and dock.IsHorizontal(): + dock_min_size += caption_size + if plus_caption_left and dock.IsVertical(): +@@ -6220,8 +5980,8 @@ def LayoutAll(self, panes, docks, uiparts, spacer_only=False, oncheck=True): + self._docks[ii] = dock + + # shrink docks if needed +-## docks = self.SmartShrink(docks, AUI_DOCK_TOP) +-## docks = self.SmartShrink(docks, AUI_DOCK_LEFT) ++ ## docks = self.SmartShrink(docks, AUI_DOCK_TOP) ++ ## docks = self.SmartShrink(docks, AUI_DOCK_LEFT) + + if oncheck: + self._docks = docks +@@ -6244,7 +6004,7 @@ def LayoutAll(self, panes, docks, uiparts, spacer_only=False, oncheck=True): + if oncheck: + docks = self._docks + +- for layer in range(max_layer+1): ++ for layer in range(max_layer + 1): + # find any docks in this layer + arr = FindDocks(docks, -1, layer, -1) + # if there aren't any, skip to the next layer +@@ -6279,7 +6039,7 @@ def LayoutAll(self, panes, docks, uiparts, spacer_only=False, oncheck=True): + arr = FindDocks(docks, AUI_DOCK_CENTER, -1, -1) + if arr: + for row in arr: +- uiparts = self.LayoutAddDock(middle, row, uiparts, spacer_only) ++ uiparts = self.LayoutAddDock(middle, row, uiparts, spacer_only) + + elif not self._has_maximized: + # there are no center docks, add a background area +@@ -6306,7 +6066,7 @@ def LayoutAll(self, panes, docks, uiparts, spacer_only=False, oncheck=True): + # find any bottom docks in this layer + arr = FindDocks(docks, AUI_DOCK_BOTTOM, layer, -1, reverse=True) + for row in arr: +- uiparts = self.LayoutAddDock(cont, row, uiparts, spacer_only) ++ uiparts = self.LayoutAddDock(cont, row, uiparts, spacer_only) + + if not cont: + # no sizer available, because there are no docks, +@@ -6333,7 +6093,6 @@ def LayoutAll(self, panes, docks, uiparts, spacer_only=False, oncheck=True): + else: + return container, panes, docks, uiparts + +- + def SetDockSizeConstraint(self, width_pct, height_pct): + """ + When a user creates a new dock by dragging a window into a docked position, +@@ -6355,7 +6114,6 @@ def SetDockSizeConstraint(self, width_pct, height_pct): + self._dock_constraint_x = max(0.0, min(1.0, width_pct)) + self._dock_constraint_y = max(0.0, min(1.0, height_pct)) + +- + def GetDockSizeConstraint(self): + """ + Returns the current dock constraint values. +@@ -6365,7 +6123,6 @@ def GetDockSizeConstraint(self): + + return self._dock_constraint_x, self._dock_constraint_y + +- + def Update(self): + if '__WXGTK__' in wx.PlatformInfo: + wx.CallAfter(self.DoUpdate) +@@ -6477,7 +6234,7 @@ def DoUpdate(self): + # the dragging is happening right now, then the floating + # window should have this style by default + if self._action in [actionDragFloatingPane, actionDragToolbarPane] and \ +- self._agwFlags & AUI_MGR_TRANSPARENT_DRAG: ++ self._agwFlags & AUI_MGR_TRANSPARENT_DRAG: + frame.SetTransparent(150) + + frame.SetPaneWindow(p) +@@ -6569,8 +6326,6 @@ def DoUpdate(self): + if not self._masterManager: + e = self.FireEvent(wxEVT_AUI_PERSPECTIVE_CHANGED, None, canVeto=False) + +- +- + def UpdateNotebook(self): + """ Updates the automatic :class:`~wx.lib.agw.aui.auibook.AuiNotebook` in the layout (if any exists). """ + +@@ -6655,7 +6410,7 @@ def UpdateNotebook(self): + + # Delete empty notebooks, and convert notebooks with 1 page to + # normal panes... +- remap_ids = [-1]*len(self._notebooks) ++ remap_ids = [-1] * len(self._notebooks) + nb_idx = 0 + + for nb, notebook in enumerate(self._notebooks): +@@ -6756,7 +6511,6 @@ def UpdateNotebook(self): + + # todo: remove close + +- + def SmartShrink(self, docks, direction): + """ + Used to intelligently shrink the docks' size (if needed). +@@ -6818,7 +6572,6 @@ def SmartShrink(self, docks, direction): + + return docks + +- + def UpdateDockingGuides(self, paneInfo): + """ + Updates the docking guide windows positions and appearance. +@@ -6843,32 +6596,32 @@ def UpdateDockingGuides(self, paneInfo): + direction = guide.dock_direction + + if direction == AUI_DOCK_LEFT: +- pt.x = frameRect.x + guide_size.x / 2 + 16 +- pt.y = frameRect.y + frameRect.height / 2 ++ pt.x = frameRect.x + guide_size.x // 2 + 16 ++ pt.y = frameRect.y + frameRect.height // 2 + + elif direction == AUI_DOCK_TOP: +- pt.x = frameRect.x + frameRect.width / 2 +- pt.y = frameRect.y + guide_size.y / 2 + 16 ++ pt.x = frameRect.x + frameRect.width // 2 ++ pt.y = frameRect.y + guide_size.y // 2 + 16 + + elif direction == AUI_DOCK_RIGHT: +- pt.x = frameRect.x + frameRect.width - guide_size.x / 2 - 16 +- pt.y = frameRect.y + frameRect.height / 2 ++ pt.x = frameRect.x + frameRect.width - guide_size.x // 2 - 16 ++ pt.y = frameRect.y + frameRect.height // 2 + + elif direction == AUI_DOCK_BOTTOM: +- pt.x = frameRect.x + frameRect.width / 2 +- pt.y = frameRect.y + frameRect.height - guide_size.y / 2 - 16 ++ pt.x = frameRect.x + frameRect.width // 2 ++ pt.y = frameRect.y + frameRect.height - guide_size.y // 2 - 16 + + elif direction == AUI_DOCK_CENTER: + rc = paneInfo.window.GetScreenRect() +- pt.x = rc.x + rc.width / 2 +- pt.y = rc.y + rc.height / 2 ++ pt.x = rc.x + rc.width // 2 ++ pt.y = rc.y + rc.height // 2 + if paneInfo.HasCaption(): +- pt.y -= captionSize / 2 ++ pt.y -= captionSize // 2 + elif paneInfo.HasCaptionLeft(): +- pt.x -= captionSize / 2 ++ pt.x -= captionSize // 2 + + # guide will be centered around point 'pt' +- targetPosition = wx.Point(pt.x - guide_size.x / 2, pt.y - guide_size.y / 2) ++ targetPosition = wx.Point(pt.x - guide_size.x // 2, pt.y - guide_size.y // 2) + + if guide.host.GetPosition() != targetPosition: + guide.host.Move(targetPosition) +@@ -6883,7 +6636,6 @@ def UpdateDockingGuides(self, paneInfo): + + paneInfo.window.Lower() + +- + def DoFrameLayout(self): + """ + This is an internal function which invokes :meth:`wx.Sizer.Layout() ` +@@ -6928,7 +6680,6 @@ def DoFrameLayout(self): + if part.type == AuiDockUIPart.typePane: + part.pane.rect = part.rect + +- + def GetPanePart(self, wnd): + """ + Looks up the pane border UI part of the +@@ -6940,17 +6691,16 @@ def GetPanePart(self, wnd): + + for part in self._uiparts: + if part.type == AuiDockUIPart.typePaneBorder and \ +- part.pane and part.pane.window == wnd: ++ part.pane and part.pane.window == wnd: + return part + + for part in self._uiparts: + if part.type == AuiDockUIPart.typePane and \ +- part.pane and part.pane.window == wnd: ++ part.pane and part.pane.window == wnd: + return part + + return None + +- + def GetDockPixelOffset(self, test): + """ + This is an internal function which returns a dock's offset in pixels from +@@ -6984,8 +6734,8 @@ def GetDockPixelOffset(self, test): + + for dock in docks: + if test.dock_direction == dock.dock_direction and \ +- test.dock_layer == dock.dock_layer and \ +- test.dock_row == dock.dock_row: ++ test.dock_layer == dock.dock_layer and \ ++ test.dock_row == dock.dock_row: + + if dock.IsVertical(): + return dock.rect.y +@@ -6994,7 +6744,6 @@ def GetDockPixelOffset(self, test): + + return 0 + +- + def GetPartnerDock(self, dock): + """ + Returns the partner dock for the input dock. +@@ -7029,7 +6778,6 @@ def GetPartnerDock(self, dock): + + return None + +- + def GetPartnerPane(self, dock, pane): + """ + Returns the partner pane for the input pane. They both need to live +@@ -7049,7 +6797,6 @@ def GetPartnerPane(self, dock, pane): + + return None + +- + def GetTotalPixSizeAndProportion(self, dock): + """ + Returns the dimensions and proportion of the input dock. +@@ -7075,16 +6822,15 @@ def GetTotalPixSizeAndProportion(self, dock): + else: + totalPixsize += tmpPane.rect.height + +-## if tmpPane.min_size.IsFullySpecified(): +-## +-## if dock.IsHorizontal(): +-## totalPixsize -= tmpPane.min_size.x +-## else: +-## totalPixsize -= tmpPane.min_size.y ++ ## if tmpPane.min_size.IsFullySpecified(): ++ ## ++ ## if dock.IsHorizontal(): ++ ## totalPixsize -= tmpPane.min_size.x ++ ## else: ++ ## totalPixsize -= tmpPane.min_size.y + + return totalPixsize, totalProportion + +- + def GetOppositeDockTotalSize(self, docks, direction): + """ + Returns the dimensions of the dock which lives opposite of the input dock. +@@ -7114,7 +6860,7 @@ def GetOppositeDockTotalSize(self, docks, direction): + + for tmpPane in tmpDock.panes: + +- minSize = pane_border_size*2 - sash_size ++ minSize = pane_border_size * 2 - sash_size + + if vertical: + minSize += tmpPane.min_size.y + caption_size +@@ -7138,7 +6884,6 @@ def GetOppositeDockTotalSize(self, docks, direction): + + return result + +- + def CalculateDockSizerLimits(self, dock): + """ + Calculates the minimum and maximum sizes allowed for the input dock. +@@ -7155,9 +6900,8 @@ def CalculateDockSizerLimits(self, dock): + for tmpDock in docks: + + if tmpDock.dock_direction == dock.dock_direction and \ +- tmpDock.dock_layer == dock.dock_layer and \ +- tmpDock.dock_row == dock.dock_row: +- ++ tmpDock.dock_layer == dock.dock_layer and \ ++ tmpDock.dock_row == dock.dock_row: + tmpDock.size = 1 + break + +@@ -7177,9 +6921,8 @@ def CalculateDockSizerLimits(self, dock): + + for tmpDock in docks: + if tmpDock.dock_direction == dock.dock_direction and \ +- tmpDock.dock_layer == dock.dock_layer and \ +- tmpDock.dock_row == dock.dock_row: +- ++ tmpDock.dock_layer == dock.dock_layer and \ ++ tmpDock.dock_row == dock.dock_row: + new_dock = tmpDock + break + +@@ -7234,7 +6977,6 @@ def CalculateDockSizerLimits(self, dock): + + return minPix, maxPix + +- + def CalculatePaneSizerLimits(self, dock, pane): + """ + Calculates the minimum and maximum sizes allowed for the input pane. +@@ -7294,7 +7036,6 @@ def CalculatePaneSizerLimits(self, dock, pane): + + return minPix, maxPix + +- + def CheckMovableSizer(self, part): + """ + Checks if a UI part can be actually resized. +@@ -7305,8 +7046,7 @@ def CheckMovableSizer(self, part): + # a dock may not be resized if it has a single + # pane which is not resizable + if part.type == AuiDockUIPart.typeDockSizer and part.dock and \ +- len(part.dock.panes) == 1 and part.dock.panes[0].IsFixed(): +- ++ len(part.dock.panes) == 1 and part.dock.panes[0].IsFixed(): + return False + + if part.pane: +@@ -7319,7 +7059,6 @@ def CheckMovableSizer(self, part): + + return True + +- + def PaneFromTabEvent(self, event): + """ + Returns a :class:`AuiPaneInfo` from a :class:`~wx.lib.agw.aui.auibook.AuiNotebook` event. +@@ -7350,7 +7089,6 @@ def PaneFromTabEvent(self, event): + + return NonePaneInfo + +- + def OnTabBeginDrag(self, event): + """ + Handles the ``EVT_AUINOTEBOOK_BEGIN_DRAG`` event. +@@ -7458,7 +7196,6 @@ def close(): + else: + event.Skip() + +- + def OnTabSelected(self, event): + """ + Handles the ``EVT_AUINOTEBOOK_PAGE_CHANGED`` event. +@@ -7481,13 +7218,11 @@ def OnTabSelected(self, event): + if paneInfo.IsOk(): + notebookRoot = GetNotebookRoot(self._panes, paneInfo.notebook_id) + if notebookRoot: +- + notebookRoot.Caption(paneInfo.caption) + self.RefreshCaptions() + + event.Skip() + +- + def GetNotebooks(self): + """ Returns all the automatic :class:`~wx.lib.agw.aui.auibook.AuiNotebook` in the :class:`AuiManager`. """ + +@@ -7496,7 +7231,6 @@ def GetNotebooks(self): + + return self._notebooks + +- + def SetMasterManager(self, manager): + """ + Sets the master manager for an automatic :class:`~wx.lib.agw.aui.auibook.AuiNotebook`. +@@ -7506,7 +7240,6 @@ def SetMasterManager(self, manager): + + self._masterManager = manager + +- + def ProcessDockResult(self, target, new_pos): + """ + This is a utility function used by :meth:`DoDrop` - it checks +@@ -7537,7 +7270,6 @@ def ProcessDockResult(self, target, new_pos): + + return allowed, target + +- + def SwitchToolBarOrientation(self, pane): + """ + Switches the toolbar orientation from vertical to horizontal and vice-versa. +@@ -7578,7 +7310,6 @@ def SwitchToolBarOrientation(self, pane): + + return pane + +- + def DoDrop(self, docks, panes, target, pt, offset=wx.Point(0, 0)): + """ + This is an important function. It basically takes a mouse position, +@@ -7600,7 +7331,6 @@ def DoDrop(self, docks, panes, target, pt, offset=wx.Point(0, 0)): + else: + return self.DoDropNonFloatingPane(docks, panes, target, pt) + +- + def CopyTarget(self, target): + """ + Copies all the attributes of the input `target` into another :class:`AuiPaneInfo`. +@@ -7635,7 +7365,6 @@ def CopyTarget(self, target): + + return drop + +- + def DoDropToolbar(self, docks, panes, target, pt, offset): + """ + Handles the situation in which the dropped pane contains a toolbar. +@@ -7688,7 +7417,7 @@ def DoDropToolbar(self, docks, panes, target, pt, offset): + Position(pt.x - self.GetDockPixelOffset(drop) - offset.x) + + if not target.IsFloating() and safeRect.Contains(pt) and \ +- target.dock_direction != drop.dock_direction: ++ target.dock_direction != drop.dock_direction: + return False, target + + return self.ProcessDockResult(target, drop) +@@ -7715,7 +7444,7 @@ def DoDropToolbar(self, docks, panes, target, pt, offset): + if not dock.fixed or dock.dock_direction == AUI_DOCK_CENTER: + + if (self._agwFlags & AUI_MGR_ALLOW_FLOATING and drop.IsFloatable()) or \ +- dock.dock_direction not in [AUI_DOCK_CENTER, AUI_DOCK_NONE]: ++ dock.dock_direction not in [AUI_DOCK_CENTER, AUI_DOCK_NONE]: + if drop.IsFloatable(): + drop.Float() + +@@ -7733,7 +7462,7 @@ def DoDropToolbar(self, docks, panes, target, pt, offset): + Row(dock.dock_row).Position(dockDropOffset) + + if (pt.y <= dock.rect.GetTop() + 2 and dock.IsHorizontal()) or \ +- (pt.x <= dock.rect.GetLeft() + 2 and dock.IsVertical()): ++ (pt.x <= dock.rect.GetLeft() + 2 and dock.IsVertical()): + + if dock.dock_direction in [AUI_DOCK_TOP, AUI_DOCK_LEFT]: + row = drop.dock_row +@@ -7741,15 +7470,15 @@ def DoDropToolbar(self, docks, panes, target, pt, offset): + drop.dock_row = row + + else: +- panes = DoInsertDockRow(panes, dock.dock_direction, dock.dock_layer, dock.dock_row+1) ++ panes = DoInsertDockRow(panes, dock.dock_direction, dock.dock_layer, dock.dock_row + 1) + drop.dock_row = dock.dock_row + 1 + + if (pt.y >= dock.rect.GetBottom() - 2 and dock.IsHorizontal()) or \ +- (pt.x >= dock.rect.GetRight() - 2 and dock.IsVertical()): ++ (pt.x >= dock.rect.GetRight() - 2 and dock.IsVertical()): + + if dock.dock_direction in [AUI_DOCK_TOP, AUI_DOCK_LEFT]: +- panes = DoInsertDockRow(panes, dock.dock_direction, dock.dock_layer, dock.dock_row+1) +- drop.dock_row = dock.dock_row+1 ++ panes = DoInsertDockRow(panes, dock.dock_direction, dock.dock_layer, dock.dock_row + 1) ++ drop.dock_row = dock.dock_row + 1 + + else: + row = drop.dock_row +@@ -7757,12 +7486,11 @@ def DoDropToolbar(self, docks, panes, target, pt, offset): + drop.dock_row = row + + if not target.IsFloating() and safeRect.Contains(pt) and \ +- target.dock_direction != drop.dock_direction: ++ target.dock_direction != drop.dock_direction: + return False, target + + return self.ProcessDockResult(target, drop) + +- + def DoDropFloatingPane(self, docks, panes, target, pt): + """ + Handles the situation in which the dropped pane contains a normal window. +@@ -7785,7 +7513,7 @@ def DoDropFloatingPane(self, docks, panes, target, pt): + + # search the dock guides. + # reverse order to handle the center first. +- for i in range(len(self._guides)-1, -1, -1): ++ for i in range(len(self._guides) - 1, -1, -1): + guide = self._guides[i] + + # do hit testing on the guide +@@ -7794,7 +7522,7 @@ def DoDropFloatingPane(self, docks, panes, target, pt): + if dir == -1: # point was outside of the dock guide + continue + +- if dir == wx.ALL: # target is a single dock guide ++ if dir == wx.ALL: # target is a single dock guide + return self.DoDropLayer(docks, target, guide.dock_direction) + + elif dir == wx.CENTER: +@@ -7805,7 +7533,6 @@ def DoDropFloatingPane(self, docks, panes, target, pt): + continue + + if not paneInfo.HasNotebook(): +- + # Add a new notebook pane with the original as a tab... + self.CreateNotebookBase(panes, paneInfo) + +@@ -7836,8 +7563,8 @@ def DoDropFloatingPane(self, docks, panes, target, pt): + + if insert_dir == AUI_DOCK_LEFT: + +- drop_pane = (dir == wx.UP or dir == wx.DOWN) +- drop_row = (dir == wx.LEFT or dir == wx.RIGHT) ++ drop_pane = (dir == wx.UP or dir == wx.DOWN) ++ drop_row = (dir == wx.LEFT or dir == wx.RIGHT) + if dir == wx.RIGHT: + insert_row += 1 + elif dir == wx.DOWN: +@@ -7845,8 +7572,8 @@ def DoDropFloatingPane(self, docks, panes, target, pt): + + elif insert_dir == AUI_DOCK_RIGHT: + +- drop_pane = (dir == wx.UP or dir == wx.DOWN) +- drop_row = (dir == wx.LEFT or dir == wx.RIGHT) ++ drop_pane = (dir == wx.UP or dir == wx.DOWN) ++ drop_row = (dir == wx.LEFT or dir == wx.RIGHT) + if dir == wx.LEFT: + insert_row += 1 + elif dir == wx.DOWN: +@@ -7855,7 +7582,7 @@ def DoDropFloatingPane(self, docks, panes, target, pt): + elif insert_dir == AUI_DOCK_TOP: + + drop_pane = (dir == wx.LEFT or dir == wx.RIGHT) +- drop_row = (dir == wx.UP or dir == wx.DOWN) ++ drop_row = (dir == wx.UP or dir == wx.DOWN) + if dir == wx.DOWN: + insert_row += 1 + elif dir == wx.RIGHT: +@@ -7864,7 +7591,7 @@ def DoDropFloatingPane(self, docks, panes, target, pt): + elif insert_dir == AUI_DOCK_BOTTOM: + + drop_pane = (dir == wx.LEFT or dir == wx.RIGHT) +- drop_row = (dir == wx.UP or dir == wx.DOWN) ++ drop_row = (dir == wx.UP or dir == wx.DOWN) + if dir == wx.UP: + insert_row += 1 + elif dir == wx.RIGHT: +@@ -7883,7 +7610,6 @@ def DoDropFloatingPane(self, docks, panes, target, pt): + + return False, target + +- + def DoDropNonFloatingPane(self, docks, panes, target, pt): + """ + Handles the situation in which the dropped pane is not floating. +@@ -7932,59 +7658,58 @@ def DoDropNonFloatingPane(self, docks, panes, target, pt): + direction = part.pane.dock_direction + + if direction == AUI_DOCK_TOP: +- if pt.y >= part.rect.y and pt.y < part.rect.y+auiInsertRowPixels: ++ if pt.y >= part.rect.y and pt.y < part.rect.y + auiInsertRowPixels: + insert_dock_row = True + + elif direction == AUI_DOCK_BOTTOM: +- if pt.y > part.rect.y+part.rect.height-auiInsertRowPixels and \ +- pt.y <= part.rect.y + part.rect.height: ++ if pt.y > part.rect.y + part.rect.height - auiInsertRowPixels and \ ++ pt.y <= part.rect.y + part.rect.height: + insert_dock_row = True + + elif direction == AUI_DOCK_LEFT: +- if pt.x >= part.rect.x and pt.x < part.rect.x+auiInsertRowPixels: ++ if pt.x >= part.rect.x and pt.x < part.rect.x + auiInsertRowPixels: + insert_dock_row = True + + elif direction == AUI_DOCK_RIGHT: +- if pt.x > part.rect.x+part.rect.width-auiInsertRowPixels and \ +- pt.x <= part.rect.x+part.rect.width: ++ if pt.x > part.rect.x + part.rect.width - auiInsertRowPixels and \ ++ pt.x <= part.rect.x + part.rect.width: + insert_dock_row = True + + elif direction == AUI_DOCK_CENTER: + +- # "new row pixels" will be set to the default, but +- # must never exceed 20% of the window size +- new_row_pixels_x = auiNewRowPixels +- new_row_pixels_y = auiNewRowPixels +- +- if new_row_pixels_x > (part.rect.width*20)/100: +- new_row_pixels_x = (part.rect.width*20)/100 +- +- if new_row_pixels_y > (part.rect.height*20)/100: +- new_row_pixels_y = (part.rect.height*20)/100 +- +- # determine if the mouse pointer is in a location that +- # will cause a new row to be inserted. The hot spot positions +- # are along the borders of the center pane +- +- insert_layer = 0 +- insert_dock_row = True +- pr = part.rect +- +- if pt.x >= pr.x and pt.x < pr.x + new_row_pixels_x: +- insert_dir = AUI_DOCK_LEFT +- elif pt.y >= pr.y and pt.y < pr.y + new_row_pixels_y: +- insert_dir = AUI_DOCK_TOP +- elif pt.x >= pr.x + pr.width - new_row_pixels_x and pt.x < pr.x + pr.width: +- insert_dir = AUI_DOCK_RIGHT +- elif pt.y >= pr.y+ pr.height - new_row_pixels_y and pt.y < pr.y + pr.height: +- insert_dir = AUI_DOCK_BOTTOM +- else: +- return False, target ++ # "new row pixels" will be set to the default, but ++ # must never exceed 20% of the window size ++ new_row_pixels_x = auiNewRowPixels ++ new_row_pixels_y = auiNewRowPixels ++ ++ if new_row_pixels_x > (part.rect.width * 20) // 100: ++ new_row_pixels_x = (part.rect.width * 20) // 100 ++ ++ if new_row_pixels_y > (part.rect.height * 20) // 100: ++ new_row_pixels_y = (part.rect.height * 20) // 100 ++ ++ # determine if the mouse pointer is in a location that ++ # will cause a new row to be inserted. The hot spot positions ++ # are along the borders of the center pane ++ ++ insert_layer = 0 ++ insert_dock_row = True ++ pr = part.rect ++ ++ if pt.x >= pr.x and pt.x < pr.x + new_row_pixels_x: ++ insert_dir = AUI_DOCK_LEFT ++ elif pt.y >= pr.y and pt.y < pr.y + new_row_pixels_y: ++ insert_dir = AUI_DOCK_TOP ++ elif pt.x >= pr.x + pr.width - new_row_pixels_x and pt.x < pr.x + pr.width: ++ insert_dir = AUI_DOCK_RIGHT ++ elif pt.y >= pr.y + pr.height - new_row_pixels_y and pt.y < pr.y + pr.height: ++ insert_dir = AUI_DOCK_BOTTOM ++ else: ++ return False, target + +- insert_row = GetMaxRow(panes, insert_dir, insert_layer) + 1 ++ insert_row = GetMaxRow(panes, insert_dir, insert_layer) + 1 + + if insert_dock_row: +- + panes = DoInsertDockRow(panes, insert_dir, insert_layer, insert_row) + drop.Dock().Direction(insert_dir).Layer(insert_layer). \ + Row(insert_row).Position(0) +@@ -8008,8 +7733,7 @@ def DoDropNonFloatingPane(self, docks, panes, target, pt): + + # if we are in the top/left part of the pane, + # insert the pane before the pane being hovered over +- if offset <= size/2: +- ++ if offset <= size // 2: + drop_position = part.pane.dock_pos + panes = DoInsertPane(panes, + part.pane.dock_direction, +@@ -8019,24 +7743,21 @@ def DoDropNonFloatingPane(self, docks, panes, target, pt): + + # if we are in the bottom/right part of the pane, + # insert the pane before the pane being hovered over +- if offset > size/2: +- +- drop_position = part.pane.dock_pos+1 ++ if offset > size // 2: ++ drop_position = part.pane.dock_pos + 1 + panes = DoInsertPane(panes, + part.pane.dock_direction, + part.pane.dock_layer, + part.pane.dock_row, +- part.pane.dock_pos+1) +- ++ part.pane.dock_pos + 1) + + drop.Dock(). \ +- Direction(part.dock.dock_direction). \ +- Layer(part.dock.dock_layer).Row(part.dock.dock_row). \ +- Position(drop_position) ++ Direction(part.dock.dock_direction). \ ++ Layer(part.dock.dock_layer).Row(part.dock.dock_row). \ ++ Position(drop_position) + + return self.ProcessDockResult(target, drop) + +- + def DoDropLayer(self, docks, target, dock_direction): + """ + Handles the situation in which `target` is a single dock guide. +@@ -8075,11 +7796,9 @@ def DoDropLayer(self, docks, target, dock_direction): + else: + return False, target + +- + drop.Dock().Layer(drop_new_layer) + return self.ProcessDockResult(target, drop) + +- + def DoDropPane(self, panes, target, dock_direction, dock_layer, dock_row, dock_pos): + """ + Drop a pane in the interface. +@@ -8098,7 +7817,6 @@ def DoDropPane(self, panes, target, dock_direction, dock_layer, dock_row, dock_p + drop.Dock().Direction(dock_direction).Layer(dock_layer).Row(dock_row).Position(dock_pos) + return self.ProcessDockResult(target, drop) + +- + def DoDropRow(self, panes, target, dock_direction, dock_layer, dock_row): + """ + Insert a row in the interface before dropping. +@@ -8116,7 +7834,6 @@ def DoDropRow(self, panes, target, dock_direction, dock_layer, dock_row): + drop.Dock().Direction(dock_direction).Layer(dock_layer).Row(dock_row).Position(0) + return self.ProcessDockResult(target, drop) + +- + def ShowHint(self, rect): + """ + Shows the AUI hint window. +@@ -8162,9 +7879,9 @@ def ShowHint(self, rect): + screendc.SetBrush(brush) + screendc.SetPen(wx.TRANSPARENT_PEN) + screendc.DrawRectangle(rect.x, rect.y, 5, rect.height) +- screendc.DrawRectangle(rect.x+5, rect.y, rect.width-10, 5) +- screendc.DrawRectangle(rect.x+rect.width-5, rect.y, 5, rect.height) +- screendc.DrawRectangle(rect.x+5, rect.y+rect.height-5, rect.width-10, 5) ++ screendc.DrawRectangle(rect.x + 5, rect.y, rect.width - 10, 5) ++ screendc.DrawRectangle(rect.x + rect.width - 5, rect.y, 5, rect.height) ++ screendc.DrawRectangle(rect.x + 5, rect.y + rect.height - 5, rect.width - 10, 5) + RefreshDockingGuides(self._guides) + + return +@@ -8185,13 +7902,12 @@ def ShowHint(self, rect): + if self._action == actionDragFloatingPane and self._action_window: + self._action_window.SetFocus() + +- if self._hint_fadeamt != self._hint_fademax: # Only fade if we need to ++ if self._hint_fadeamt != self._hint_fademax: # Only fade if we need to + # start fade in timer + self._hint_fadetimer.Start(5) + + self._last_hint = wx.Rect(*rect) + +- + def HideHint(self): + """ Hides a transparent window hint if there is one. """ + +@@ -8202,7 +7918,6 @@ def HideHint(self): + self._hint_fadetimer.Stop() + self._last_hint = wx.Rect() + +- + def IsPaneButtonVisible(self, part): + """ + Returns whether a pane button in the pane caption is visible. +@@ -8214,13 +7929,12 @@ def IsPaneButtonVisible(self, part): + + for temp_part in self._uiparts: + if temp_part.pane == part.pane and \ +- temp_part.type == AuiDockUIPart.typeCaption: ++ temp_part.type == AuiDockUIPart.typeCaption: + captionRect = temp_part.rect + break + + return captionRect.Contains(part.rect) + +- + def DrawPaneButton(self, dc, part, pt): + """ + Draws a pane button in the caption (convenience function). +@@ -8245,7 +7959,6 @@ def DrawPaneButton(self, dc, part, pt): + self._art.DrawPaneButton(dc, self._frame, part.button.button_id, + state, part.rect, part.pane) + +- + def RefreshButton(self, part): + """ + Refreshes a pane button in the caption. +@@ -8258,7 +7971,6 @@ def RefreshButton(self, part): + self._frame.Refresh(True, rect) + self._frame.Update() + +- + def RefreshCaptions(self): + """ Refreshes all pane captions. """ + +@@ -8267,7 +7979,6 @@ def RefreshCaptions(self): + self._frame.Refresh(True, part.rect) + self._frame.Update() + +- + def CalculateHintRect(self, pane_window, pt, offset): + """ + Calculates the drop hint rectangle. +@@ -8336,14 +8047,14 @@ def CalculateHintRect(self, pane_window, pt, offset): + if hint.IsNotebookPage(): + id = hint.notebook_id + for pane in panes: +- if pane.IsNotebookControl() and pane.notebook_id==id: ++ if pane.IsNotebookControl() and pane.notebook_id == id: + sought = pane.name + break + + for part in uiparts: + if part.pane and part.pane.name == sought: + rect.Union(wx.Rect(part.sizer_item.GetPosition(), +- part.sizer_item.GetSize())) ++ part.sizer_item.GetSize())) + + sizer.Destroy() + +@@ -8364,7 +8075,6 @@ def CalculateHintRect(self, pane_window, pt, offset): + + return rect + +- + def DrawHintRect(self, pane_window, pt, offset): + """ + Calculates the hint rectangle by calling :meth:`CalculateHintRect`. If there is a +@@ -8386,7 +8096,6 @@ def DrawHintRect(self, pane_window, pt, offset): + self.ShowHint(rect) + self._hint_rect = wx.Rect(*rect) + +- + def GetPartSizerRect(self, uiparts): + """ + Returns the rectangle surrounding the specified UI parts. +@@ -8399,11 +8108,10 @@ def GetPartSizerRect(self, uiparts): + for part in self._uiparts: + if part.pane and part.pane.name == "__HINT__": + rect.Union(wx.Rect(part.sizer_item.GetPosition(), +- part.sizer_item.GetSize())) ++ part.sizer_item.GetSize())) + + return rect + +- + def GetAttributes(self, pane): + """ + Returns all the attributes of a :class:`AuiPaneInfo`. +@@ -8421,7 +8129,6 @@ def GetAttributes(self, pane): + + return attrs + +- + def SetAttributes(self, pane, attrs): + """ + Sets all the attributes contained in `attrs` to a :class:`AuiPaneInfo`. +@@ -8456,7 +8163,6 @@ def SetAttributes(self, pane, attrs): + + return pane + +- + def OnFloatingPaneResized(self, wnd, size): + """ + Handles the resizing of a floating pane. +@@ -8478,7 +8184,6 @@ def OnFloatingPaneResized(self, wnd, size): + if pane.IsSnappable(): + self.SnapPane(pane, pane.floating_pos, pane.floating_size, True) + +- + def OnFloatingPaneClosed(self, wnd, event): + """ + Handles the close event of a floating pane. +@@ -8510,7 +8215,6 @@ def OnFloatingPaneClosed(self, wnd, event): + if check.IsOk(): + self.ClosePane(pane) + +- + def OnFloatingPaneActivated(self, wnd): + """ + Handles the activation event of a floating pane. +@@ -8527,7 +8231,6 @@ def OnFloatingPaneActivated(self, wnd): + self.RefreshCaptions() + self.FireEvent(wxEVT_AUI_PANE_ACTIVATED, wnd, canVeto=False) + +- + def OnFloatingPaneMoved(self, wnd, eventOrPt): + """ + Handles the move event of a floating pane. +@@ -8552,7 +8255,6 @@ def OnFloatingPaneMoved(self, wnd, eventOrPt): + + self.SnapPane(pane, pane_pos, pane_size, False) + +- + def SnapPane(self, pane, pane_pos, pane_size, toSnap=False): + """ + Snaps a floating pane to one of the main frame sides. +@@ -8579,13 +8281,13 @@ def SnapPane(self, pane, pane_pos, pane_size, toSnap=False): + diff = wnd_pos.x - (pane_pos.x + pane_size.x) + if -snapX <= diff <= snapX: + pane.snapped = wx.LEFT +- pane.floating_pos = wx.Point(wnd_pos.x-pane_size.x, pane_pos.y) ++ pane.floating_pos = wx.Point(wnd_pos.x - pane_size.x, pane_pos.y) + elif pane.IsTopSnappable(): + # Check if we can snap to the top + diff = wnd_pos.y - (pane_pos.y + pane_size.y) + if -snapY <= diff <= snapY: + pane.snapped = wx.TOP +- pane.floating_pos = wx.Point(pane_pos.x, wnd_pos.y-pane_size.y) ++ pane.floating_pos = wx.Point(pane_pos.x, wnd_pos.y - pane_size.y) + elif pane.IsRightSnappable(): + # Check if we can snap to the right + diff = pane_pos.x - (wnd_pos.x + wnd_size.x) +@@ -8601,7 +8303,6 @@ def SnapPane(self, pane, pane_pos, pane_size, toSnap=False): + + self.RepositionPane(pane, wnd_pos, wnd_size) + +- + def RepositionPane(self, pane, wnd_pos, wnd_size): + """ + Repositions a pane after the main frame has been moved/resized. +@@ -8631,7 +8332,6 @@ def RepositionPane(self, pane, wnd_pos, wnd_size): + pane.frame.SetPosition(pane.floating_pos) + self._from_move = False + +- + def OnGripperClicked(self, pane_window, start, offset): + """ + Handles the mouse click on the pane gripper. +@@ -8683,7 +8383,6 @@ def OnGripperClicked(self, pane_window, start, offset): + if paneInfo.IsToolbar(): + self._frame.SetCursor(wx.Cursor(wx.CURSOR_SIZING)) + +- + def OnRender(self, event): + """ + Draws all of the pane captions, sashes, backgrounds, captions, grippers, pane borders and buttons. +@@ -8716,7 +8415,6 @@ def OnRender(self, event): + not part.sizer_item.IsSpacer() and \ + not part.sizer_item.IsSizer()) or \ + not part.sizer_item.IsShown()): +- + continue + + ptype = part.type +@@ -8739,7 +8437,6 @@ def OnRender(self, event): + elif ptype == AuiDockUIPart.typePaneButton: + self.DrawPaneButton(dc, part, point) + +- + def Repaint(self, dc=None): + """ + Repaints the entire frame decorations (sashes, borders, buttons and so on). +@@ -8769,7 +8466,6 @@ def Repaint(self, dc=None): + # Render all the items + self.Render(dc) + +- + def Render(self, dc): + """ + Fires a render event, which is normally handled by :meth:`OnRender`. This allows the +@@ -8787,7 +8483,6 @@ def Render(self, dc): + e.SetDC(dc) + self.ProcessMgrEvent(e) + +- + def OnCaptionDoubleClicked(self, pane_window): + """ + Handles the mouse double click on the pane caption. +@@ -8801,7 +8496,7 @@ def OnCaptionDoubleClicked(self, pane_window): + raise Exception("Pane window not found") + + if not paneInfo.IsFloatable() or not paneInfo.IsDockable() or \ +- self._agwFlags & AUI_MGR_ALLOW_FLOATING == 0: ++ self._agwFlags & AUI_MGR_ALLOW_FLOATING == 0: + return + + indx = self._panes.index(paneInfo) +@@ -8855,7 +8550,6 @@ def OnCaptionDoubleClicked(self, pane_window): + pane_rect = paneInfo.window.GetScreenRect() + self.AnimateDocking(win_rect, pane_rect) + +- + def OnPaint(self, event): + """ + Handles the ``wx.EVT_PAINT`` event for :class:`AuiManager`. +@@ -8866,7 +8560,6 @@ def OnPaint(self, event): + dc = wx.PaintDC(self._frame) + self.Repaint(dc) + +- + def OnEraseBackground(self, event): + """ + Handles the ``wx.EVT_ERASE_BACKGROUND`` event for :class:`AuiManager`. +@@ -8880,7 +8573,6 @@ def OnEraseBackground(self, event): + if wx.Platform == "__WXMAC__": + event.Skip() + +- + def OnSize(self, event): + """ + Handles the ``wx.EVT_SIZE`` event for :class:`AuiManager`. +@@ -8902,7 +8594,7 @@ def OnSize(self, event): + self.Repaint() + + if isinstance(self._frame, wx.MDIParentFrame) or isinstance(self._frame, tabmdi.AuiMDIClientWindow) \ +- or isinstance(self._frame, tabmdi.AuiMDIParentFrame): ++ or isinstance(self._frame, tabmdi.AuiMDIParentFrame): + # for MDI parent frames, this event must not + # be "skipped". In other words, the parent frame + # must not be allowed to resize the client window +@@ -8915,7 +8607,6 @@ def OnSize(self, event): + # For the snap to screen... + self.OnMove(None) + +- + def OnFindManager(self, event): + """ + Handles the ``EVT_AUI_FIND_MANAGER`` event for :class:`AuiManager`. +@@ -8934,8 +8625,7 @@ def OnFindManager(self, event): + + # if no, it must be us + if not event.GetManager(): +- event.SetManager(self) +- ++ event.SetManager(self) + + def OnSetCursor(self, event): + """ +@@ -8964,7 +8654,6 @@ def OnSetCursor(self, event): + + event.SetCursor(cursor) + +- + def UpdateButtonOnScreen(self, button_ui_part, event): + """ + Updates/redraws the UI part containing a pane button. +@@ -9000,10 +8689,9 @@ def UpdateButtonOnScreen(self, button_ui_part, event): + + if hit_test.pane: + self._art.DrawPaneButton(cdc, self._frame, +- button_ui_part.button.button_id, +- state, +- button_ui_part.rect, hit_test.pane) +- ++ button_ui_part.button.button_id, ++ state, ++ button_ui_part.rect, hit_test.pane) + + def OnLeftDown(self, event): + """ +@@ -9035,7 +8723,7 @@ def OnLeftDown(self, event): + + # draw the resize hint + rect = wx.Rect(self._frame.ClientToScreen(part.rect.GetPosition()), +- part.rect.GetSize()) ++ part.rect.GetSize()) + + self._action_rect = wx.Rect(*rect) + +@@ -9075,7 +8763,6 @@ def OnLeftDown(self, event): + if wx.Platform != "__WXMAC__": + event.Skip() + +- + def OnLeftDClick(self, event): + """ + Handles the ``wx.EVT_LEFT_DCLICK`` event for :class:`AuiManager`. +@@ -9105,7 +8792,6 @@ def OnLeftDClick(self, event): + + event.Skip() + +- + def DoEndResizeAction(self, event): + """ + Ends a resize action, or for live update, resizes the sash. +@@ -9118,7 +8804,6 @@ def DoEndResizeAction(self, event): + + return self.RestrictResize(clientPt, screenPt, createDC=False) + +- + def RestrictResize(self, clientPt, screenPt, createDC): + """ Common method between :meth:`DoEndResizeAction` and :meth:`OnLeftUp_Resize`. """ + +@@ -9199,13 +8884,12 @@ def RestrictResize(self, clientPt, screenPt, createDC): + + # adjust for the surplus + while (oldPixsize > 0 and totalPixsize > 10 and \ +- oldPixsize*totalProportion/totalPixsize < pane.dock_proportion): +- ++ oldPixsize * totalProportion // totalPixsize < pane.dock_proportion): + totalPixsize -= 1 + + # calculate the new proportion of the pane + +- newProportion = newPixsize*totalProportion/totalPixsize ++ newProportion = newPixsize * totalProportion // totalPixsize + newProportion = Clip(newProportion, 1, totalProportion) + deltaProp = newProportion - pane.dock_proportion + +@@ -9222,7 +8906,6 @@ def RestrictResize(self, clientPt, screenPt, createDC): + + return True + +- + def OnLeftUp(self, event): + """ + Handles the ``wx.EVT_LEFT_UP`` event for :class:`AuiManager`. +@@ -9231,9 +8914,9 @@ def OnLeftUp(self, event): + """ + + if self._action == actionResize: +-## self._frame.Freeze() ++ ## self._frame.Freeze() + self.OnLeftUp_Resize(event) +-## self._frame.Thaw() ++ ## self._frame.Thaw() + + elif self._action == actionClickButton: + self.OnLeftUp_ClickButton(event) +@@ -9258,7 +8941,6 @@ def OnLeftUp(self, event): + + self._action = actionNone + +- + def OnMotion(self, event): + """ + Handles the ``wx.EVT_MOTION`` event for :class:`AuiManager`. +@@ -9284,7 +8966,6 @@ def OnMotion(self, event): + else: + self.OnMotion_Other(event) + +- + def OnLeaveWindow(self, event): + """ + Handles the ``wx.EVT_LEAVE_WINDOW`` event for :class:`AuiManager`. +@@ -9296,7 +8977,6 @@ def OnLeaveWindow(self, event): + self.RefreshButton(self._hover_button) + self._hover_button = None + +- + def OnCaptureLost(self, event): + """ + Handles the ``wx.EVT_MOUSE_CAPTURE_LOST`` event for :class:`AuiManager`. +@@ -9309,7 +8989,6 @@ def OnCaptureLost(self, event): + self._action = actionNone + self.HideHint() + +- + def OnHintFadeTimer(self, event): + """ + Handles the ``wx.EVT_TIMER`` event for :class:`AuiManager`. +@@ -9324,7 +9003,6 @@ def OnHintFadeTimer(self, event): + self._hint_fadeamt += 4 + self._hint_window.SetTransparent(self._hint_fadeamt) + +- + def OnMove(self, event): + """ + Handles the ``wx.EVT_MOVE`` event for :class:`AuiManager`. +@@ -9347,7 +9025,6 @@ def OnMove(self, event): + if pane.IsFloating() and pane.IsShown(): + self.SnapPane(pane, pane.floating_pos, pane.floating_size, True) + +- + def OnSysColourChanged(self, event): + """ + Handles the ``wx.EVT_SYS_COLOUR_CHANGED`` event for :class:`AuiManager`. +@@ -9364,7 +9041,6 @@ def OnSysColourChanged(self, event): + self.Update() + self._frame.Refresh() + +- + def OnChildFocus(self, event): + """ + Handles the ``wx.EVT_CHILD_FOCUS`` event for :class:`AuiManager`. +@@ -9391,7 +9067,6 @@ def OnChildFocus(self, event): + + event.Skip() + +- + def OnMotion_ClickCaption(self, event): + """ + Sub-handler for the :meth:`OnMotion` event. +@@ -9411,7 +9086,6 @@ def OnMotion_ClickCaption(self, event): + # we need to check if the mouse is now being dragged + if not (abs(clientPt.x - self._action_start.x) > drag_x_threshold or \ + abs(clientPt.y - self._action_start.y) > drag_y_threshold): +- + return + + # dragged -- we need to change the mouse action to 'drag' +@@ -9462,10 +9136,10 @@ def OnMotion_ClickCaption(self, event): + # caption is bigger than the width of the floating frame itself, so + # in that case we need to set the action offset to a sensible value + frame_size = self._action_pane.frame.GetSize() +- if self._action_offset.x > frame_size.x * 2 / 3: +- self._action_offset.x = frame_size.x / 2 +- if self._action_offset.y > frame_size.y * 2 / 3: +- self._action_offset.y = frame_size.y / 2 ++ if self._action_offset.x > frame_size.x * 2 // 3: ++ self._action_offset.x = frame_size.x // 2 ++ if self._action_offset.y > frame_size.y * 2 // 3: ++ self._action_offset.y = frame_size.y // 2 + + self.OnMotion_DragFloatingPane(event) + if wx.Platform != "__WXGTK__": +@@ -9477,7 +9151,6 @@ def OnMotion_ClickCaption(self, event): + self._action = actionDragMovablePane + self._action_window = self._action_pane.window + +- + def OnMotion_Resize(self, event): + """ + Sub-handler for the :meth:`OnMotion` event. +@@ -9534,7 +9207,6 @@ def OnMotion_Resize(self, event): + DrawResizeHint(dc, hintrect) + self._action_rect = wx.Rect(*hintrect) + +- + def OnLeftUp_Resize(self, event): + """ + Sub-handler for the :meth:`OnLeftUp` event. +@@ -9560,7 +9232,6 @@ def OnLeftUp_Resize(self, event): + + return self.RestrictResize(clientPt, screenPt, createDC=True) + +- + def OnLeftUp_ClickButton(self, event): + """ + Sub-handler for the :meth:`OnLeftUp` event. +@@ -9575,7 +9246,6 @@ def OnLeftUp_ClickButton(self, event): + + # make sure we're still over the item that was originally clicked + if self._action_part == self.HitTest(*event.GetPosition()): +- + # fire button-click event + e = AuiManagerEvent(wxEVT_AUI_PANE_BUTTON) + e.SetManager(self) +@@ -9583,7 +9253,6 @@ def OnLeftUp_ClickButton(self, event): + e.SetButton(self._action_part.button.button_id) + self.ProcessMgrEvent(e) + +- + def CheckPaneMove(self, pane): + """ + Checks if a pane has moved by a visible amount. +@@ -9605,13 +9274,12 @@ def CheckPaneMove(self, pane): + # skip if moving too fast to avoid massive redraws and + # jumping hint windows + if abs(win_rect.x - self._last_rect.x) > 10 or \ +- abs(win_rect.y - self._last_rect.y) > 10: ++ abs(win_rect.y - self._last_rect.y) > 10: + self._last_rect = wx.Rect(*win_rect) + return False + + return True + +- + def OnMotion_DragFloatingPane(self, eventOrPt): + """ + Sub-handler for the :meth:`OnMotion` event. +@@ -9646,7 +9314,8 @@ def OnMotion_DragFloatingPane(self, eventOrPt): + if pane.frame: + + if diff.x != 0 or diff.y != 0: +- if wx.Platform == "__WXMSW__" and (self._agwFlags & AUI_MGR_TRANSPARENT_DRAG) == 0: # and not self.CheckPaneMove(pane): ++ if wx.Platform == "__WXMSW__" and ( ++ self._agwFlags & AUI_MGR_TRANSPARENT_DRAG) == 0: # and not self.CheckPaneMove(pane): + # return + # HACK: Terrible hack on wxMSW (!) + pane.frame.SetTransparent(254) +@@ -9695,7 +9364,6 @@ def OnMotion_DragFloatingPane(self, eventOrPt): + + wx.CallAfter(self.DrawHintRect, pane.window, clientPt, action_offset) + +- + def OnMotion_DragMovablePane(self, eventOrPt): + """ + Sub-handler for the :meth:`OnMotion` event. +@@ -9719,7 +9387,6 @@ def OnMotion_DragMovablePane(self, eventOrPt): + # Reduces flicker. + self._frame.Update() + +- + def OnLeftUp_DragFloatingPane(self, eventOrPt): + """ + Sub-handler for the :meth:`OnLeftUp` event. +@@ -9794,7 +9461,6 @@ def OnLeftUp_DragFloatingPane(self, eventOrPt): + self.HideHint() + ShowDockingGuides(self._guides, False) + +- + def OnLeftUp_DragMovablePane(self, event): + """ + Sub-handler for the :meth:`OnLeftUp` event. +@@ -9816,7 +9482,7 @@ def OnLeftUp_DragMovablePane(self, event): + pt = event.GetPosition() + # do the drop calculation + indx = self._panes.index(paneInfo) +- ret, paneInfo = self.DoDrop(self._docks, self._panes, paneInfo, pt, wx.Point(0,0)) ++ ret, paneInfo = self.DoDrop(self._docks, self._panes, paneInfo, pt, wx.Point(0, 0)) + + if ret: + e = self.FireEvent(wxEVT_AUI_PANE_DOCKING, paneInfo, canVeto=True) +@@ -9848,7 +9514,6 @@ def OnLeftUp_DragMovablePane(self, event): + self._frame.ReleaseMouse() + self._action_window = None + +- + def OnMotion_DragToolbarPane(self, eventOrPt): + """ + Sub-handler for the :meth:`OnMotion` event. +@@ -9885,7 +9550,8 @@ def OnMotion_DragToolbarPane(self, eventOrPt): + + # move the pane window + if pane.frame: +- if wx.Platform == "__WXMSW__" and (self._agwFlags & AUI_MGR_TRANSPARENT_DRAG) == 0: # and not self.CheckPaneMove(pane): ++ if wx.Platform == "__WXMSW__" and ( ++ self._agwFlags & AUI_MGR_TRANSPARENT_DRAG) == 0: # and not self.CheckPaneMove(pane): + # return + # HACK: Terrible hack on wxMSW (!) + pane.frame.SetTransparent(254) +@@ -9908,7 +9574,6 @@ def OnMotion_DragToolbarPane(self, eventOrPt): + self._action = actionNone + self.OnLeftUp_DragToolbarPane(eventOrPt) + +- + def OnMotion_Other(self, event): + """ + Sub-handler for the :meth:`OnMotion` event. +@@ -9919,7 +9584,7 @@ def OnMotion_Other(self, event): + part = self.HitTest(*event.GetPosition()) + + if part and part.type == AuiDockUIPart.typePaneButton \ +- and self.IsPaneButtonVisible(part): ++ and self.IsPaneButtonVisible(part): + if part != self._hover_button: + + if self._hover_button: +@@ -9937,7 +9602,6 @@ def OnMotion_Other(self, event): + + self._hover_button = None + +- + def OnLeftUp_DragToolbarPane(self, eventOrPt): + """ + Sub-handler for the :meth:`OnLeftUp` event. +@@ -9977,7 +9641,6 @@ def OnLeftUp_DragToolbarPane(self, eventOrPt): + pane.state &= ~AuiPaneInfo.actionPane + self.Update() + +- + def OnPaneButton(self, event): + """ + Handles the ``EVT_AUI_PANE_BUTTON`` event for :class:`AuiManager`. +@@ -10038,7 +9701,6 @@ def OnPaneButton(self, event): + self.ProcessMgrEvent(e) + + if not e.GetVeto(): +- + self.MaximizePane(pane) + self.Update() + +@@ -10051,7 +9713,6 @@ def OnPaneButton(self, event): + self.ProcessMgrEvent(e) + + if not e.GetVeto(): +- + self.RestorePane(pane) + self.Update() + +@@ -10067,7 +9728,6 @@ def OnPaneButton(self, event): + + self.Update() + +- + def MinimizePane(self, paneInfo, mgrUpdate=True): + """ + Minimizes a pane in a newly and automatically created :class:`~wx.lib.agw.aui.auibar.AuiToolBar`. +@@ -10183,7 +9843,7 @@ def MinimizePane(self, paneInfo, mgrUpdate=True): + target = paneInfo.name + + minimize_toolbar.AddSimpleTool(ID_RESTORE_FRAME, paneInfo.caption, restore_bitmap, +- _(six.u("Restore %s"))%paneInfo.caption, target=target) ++ _(six.u("Restore %s")) % paneInfo.caption, target=target) + minimize_toolbar.SetAuiManager(self) + minimize_toolbar.Realize() + toolpanelname = paneInfo.name + "_min" +@@ -10195,27 +9855,27 @@ def MinimizePane(self, paneInfo, mgrUpdate=True): + + if dockDirection == AUI_DOCK_TOP: + self.AddPane(minimize_toolbar, AuiPaneInfo(). \ +- Name(toolpanelname).Caption(paneInfo.caption). \ +- ToolbarPane().Top().BottomDockable(False). \ +- LeftDockable(False).RightDockable(False).DestroyOnClose()) ++ Name(toolpanelname).Caption(paneInfo.caption). \ ++ ToolbarPane().Top().BottomDockable(False). \ ++ LeftDockable(False).RightDockable(False).DestroyOnClose()) + + elif dockDirection == AUI_DOCK_BOTTOM: + self.AddPane(minimize_toolbar, AuiPaneInfo(). \ +- Name(toolpanelname).Caption(paneInfo.caption). \ +- ToolbarPane().Bottom().TopDockable(False). \ +- LeftDockable(False).RightDockable(False).DestroyOnClose()) ++ Name(toolpanelname).Caption(paneInfo.caption). \ ++ ToolbarPane().Bottom().TopDockable(False). \ ++ LeftDockable(False).RightDockable(False).DestroyOnClose()) + + elif dockDirection == AUI_DOCK_LEFT: + self.AddPane(minimize_toolbar, AuiPaneInfo(). \ +- Name(toolpanelname).Caption(paneInfo.caption). \ +- ToolbarPane().Left().TopDockable(False). \ +- BottomDockable(False).RightDockable(False).DestroyOnClose()) ++ Name(toolpanelname).Caption(paneInfo.caption). \ ++ ToolbarPane().Left().TopDockable(False). \ ++ BottomDockable(False).RightDockable(False).DestroyOnClose()) + + elif dockDirection in [AUI_DOCK_RIGHT, AUI_DOCK_CENTER]: + self.AddPane(minimize_toolbar, AuiPaneInfo(). \ +- Name(toolpanelname).Caption(paneInfo.caption). \ +- ToolbarPane().Right().TopDockable(False). \ +- LeftDockable(False).BottomDockable(False).DestroyOnClose()) ++ Name(toolpanelname).Caption(paneInfo.caption). \ ++ ToolbarPane().Right().TopDockable(False). \ ++ LeftDockable(False).BottomDockable(False).DestroyOnClose()) + + arr = FindDocks(self._docks, paneInfo.dock_direction, paneInfo.dock_layer, paneInfo.dock_row) + +@@ -10240,7 +9900,6 @@ def MinimizePane(self, paneInfo, mgrUpdate=True): + if self._agwFlags & AUI_MGR_ANIMATE_FRAMES: + self.AnimateDocking(win_rect, minimize_toolbar.GetScreenRect()) + +- + def OnRestoreMinimizedPane(self, event): + """ + Handles the ``EVT_AUI_PANE_MIN_RESTORE`` event for :class:`AuiManager`. +@@ -10250,7 +9909,6 @@ def OnRestoreMinimizedPane(self, event): + + self.RestoreMinimizedPane(event.pane) + +- + def OnPaneDocked(self, event): + """ + Handles the ``EVT_AUI_PANE_DOCKED`` event for :class:`AuiManager`. +@@ -10261,7 +9919,6 @@ def OnPaneDocked(self, event): + event.Skip() + self.RemoveAutoNBCaption(event.GetPane()) + +- + def CreateNotebookBase(self, panes, paneInfo): + """ + Creates an auto-notebook base from a pane, and then add that pane as a page. +@@ -10284,7 +9941,6 @@ def CreateNotebookBase(self, panes, paneInfo): + # add original pane as tab ... + paneInfo.NotebookPage(nbid) + +- + def RemoveAutoNBCaption(self, pane): + """ + Removes the caption on newly created automatic notebooks. +@@ -10308,7 +9964,6 @@ def RemoveCaption(): + wx.CallAfter(RemoveCaption) + return True + +- + def RestoreMinimizedPane(self, paneInfo): + """ + Restores a previously minimized pane. +@@ -10340,7 +9995,6 @@ def RestoreMinimizedPane(self, paneInfo): + if not pane.IsMinimized(): + return + +- + if pane.HasFlag(pane.wasMaximized): + self.SavePreviousDockSizes(pane) + +@@ -10363,7 +10017,6 @@ def RestoreMinimizedPane(self, paneInfo): + + self.Update() + +- + def AnimateDocking(self, win_rect, pane_rect): + """ + Animates the minimization/docking of a pane a la Eclipse, using a :class:`ScreenDC` +@@ -10388,10 +10041,10 @@ def AnimateDocking(self, win_rect, pane_rect): + + step = self.GetAnimationStep() + +- wstep = int(abs(win_rect.width - pane_rect.width)/step) +- hstep = int(abs(win_rect.height - pane_rect.height)/step) +- xstep = int(win_rect.x - pane_rect.x)/step +- ystep = int(win_rect.y - pane_rect.y)/step ++ wstep = int(abs(win_rect.width - pane_rect.width) // step) ++ hstep = int(abs(win_rect.height - pane_rect.height) // step) ++ xstep = int(win_rect.x - pane_rect.x) // step ++ ystep = int(win_rect.y - pane_rect.y) // step + + dc = wx.ScreenDC() + dc.SetLogicalFunction(wx.INVERT) +@@ -10399,15 +10052,14 @@ def AnimateDocking(self, win_rect, pane_rect): + dc.SetPen(wx.LIGHT_GREY_PEN) + + for i in range(int(step)): +- width, height = win_rect.width - i*wstep, win_rect.height - i*hstep +- x, y = xstart - i*xstep, ystart - i*ystep ++ width, height = win_rect.width - i * wstep, win_rect.height - i * hstep ++ x, y = xstart - i * xstep, ystart - i * ystep + new_rect = wx.Rect(x, y, width, height) + dc.DrawRoundedRectangle(new_rect, 3) + wx.SafeYield() + wx.MilliSleep(10) + dc.DrawRoundedRectangle(new_rect, 3) + +- + def SmoothDock(self, paneInfo): + """ + This method implements a smooth docking effect for floating panes, similar to +@@ -10431,21 +10083,20 @@ def SmoothDock(self, paneInfo): + xstart, ystart = win_rect.x, win_rect.y + xend, yend = hint_rect.x, hint_rect.y + +- step = self.GetAnimationStep()/3 ++ step = self.GetAnimationStep() // 3 + +- wstep = int((win_rect.width - hint_rect.width)/step) +- hstep = int((win_rect.height - hint_rect.height)/step) +- xstep = int((win_rect.x - hint_rect.x))/step +- ystep = int((win_rect.y - hint_rect.y))/step ++ wstep = int((win_rect.width - hint_rect.width) // step) ++ hstep = int((win_rect.height - hint_rect.height) // step) ++ xstep = int((win_rect.x - hint_rect.x)) // step ++ ystep = int((win_rect.y - hint_rect.y)) // step + + for i in range(int(step)): +- width, height = win_rect.width - i*wstep, win_rect.height - i*hstep +- x, y = xstart - i*xstep, ystart - i*ystep ++ width, height = win_rect.width - i * wstep, win_rect.height - i * hstep ++ x, y = xstart - i * xstep, ystart - i * ystep + new_rect = wx.Rect(x, y, width, height) + paneInfo.frame.SetRect(new_rect) + wx.MilliSleep(10) + +- + def SetSnapLimits(self, x, y): + """ + Modifies the snap limits used when snapping the `managed_window` to the screen +@@ -10463,7 +10114,6 @@ def SetSnapLimits(self, x, y): + self._snap_limits = (x, y) + self.Snap() + +- + def Snap(self): + """ + Snaps the main frame to specified position on the screen. +@@ -10483,7 +10133,6 @@ def Snap(self): + if abs(snap_pos.x - wnd_pos.x) < snapX and abs(snap_pos.y - wnd_pos.y) < snapY: + managed_window.SetPosition(snap_pos) + +- + def SnapToScreen(self, snap=True, monitor=0, hAlign=wx.RIGHT, vAlign=wx.TOP): + """ + Snaps the main frame to specified position on the screen. +@@ -10500,12 +10149,11 @@ def SnapToScreen(self, snap=True, monitor=0, hAlign=wx.RIGHT, vAlign=wx.TOP): + + displayCount = wx.Display.GetCount() + if monitor > displayCount: +- raise Exception("Invalid monitor selected: you only have %d monitors"%displayCount) ++ raise Exception("Invalid monitor selected: you only have %d monitors" % displayCount) + + self._is_docked = (True, hAlign, vAlign, monitor) + self.GetManagedWindow().SetPosition(self.GetSnapPosition()) + +- + def GetSnapPosition(self): + """ Returns the main frame snapping position. """ + +@@ -10519,26 +10167,24 @@ def GetSnapPosition(self): + if hAlign == wx.LEFT: + pos.x = area.x + elif hAlign == wx.CENTER: +- pos.x = area.x + (area.width - size.x)/2 ++ pos.x = area.x + (area.width - size.x) // 2 + else: + pos.x = area.x + area.width - size.x + + if vAlign == wx.TOP: + pos.y = area.y + elif vAlign == wx.CENTER: +- pos.y = area.y + (area.height - size.y)/2 ++ pos.y = area.y + (area.height - size.y) // 2 + else: + pos.y = area.y + area.height - size.y + + return pos + +- + def GetAnimationStep(self): + """ Returns the animation step speed (a float) to use in :meth:`AnimateDocking`. """ + + return self._animation_step + +- + def SetAnimationStep(self, step): + """ + Sets the animation step speed (a float) to use in :meth:`AnimateDocking`. +@@ -10548,7 +10194,6 @@ def SetAnimationStep(self, step): + + self._animation_step = float(step) + +- + def RequestUserAttention(self, pane_window): + """ + Requests the user attention by intermittently highlighting the pane caption. +@@ -10576,7 +10221,6 @@ def RequestUserAttention(self, pane_window): + self._frame.RefreshRect(part.rect, True) + break + +- + def StartPreviewTimer(self, toolbar): + """ + Starts a timer for sliding in and out a minimized pane. +@@ -10596,7 +10240,6 @@ def StartPreviewTimer(self, toolbar): + + self._preview_timer.Start(1000, wx.TIMER_ONE_SHOT) + +- + def StopPreviewTimer(self): + """ Stops a timer for sliding in and out a minimized pane. """ + +@@ -10606,7 +10249,6 @@ def StopPreviewTimer(self): + self.SlideOut() + self._sliding_pane = None + +- + def SlideIn(self, event): + """ + Handles the ``wx.EVT_TIMER`` event for :class:`AuiManager`. +@@ -10619,7 +10261,7 @@ def SlideIn(self, event): + window = self._sliding_pane.window + self._sliding_frame = wx.MiniFrame(None, -1, title=_("Pane Preview"), + style=wx.FRAME_TOOL_WINDOW | wx.STAY_ON_TOP | +- wx.FRAME_NO_TASKBAR | wx.CAPTION) ++ wx.FRAME_NO_TASKBAR | wx.CAPTION) + window.Reparent(self._sliding_frame) + self._sliding_frame.SetSize((0, 0)) + window.Show() +@@ -10629,7 +10271,7 @@ def SlideIn(self, event): + + startX, startY, stopX, stopY = GetSlidingPoints(self._sliding_rect, size, self._sliding_direction) + +- step = stopX/10 ++ step = stopX // 10 + window_size = 0 + + for i in range(0, stopX, step): +@@ -10643,7 +10285,6 @@ def SlideIn(self, event): + self._sliding_frame.Refresh() + self._sliding_frame.Update() + +- + def SlideOut(self): + """ + Slides out a preview of a minimized pane. +@@ -10659,7 +10300,7 @@ def SlideOut(self): + + startX, startY, stopX, stopY = GetSlidingPoints(self._sliding_rect, size, self._sliding_direction) + +- step = stopX/10 ++ step = stopX // 10 + window_size = 0 + + for i in range(stopX, 0, -step): +@@ -10667,7 +10308,7 @@ def SlideOut(self): + self._sliding_frame.SetSize(startX, startY, window_size, stopY) + self._sliding_frame.Refresh() + self._sliding_frame.Update() +- self._frame.RefreshRect(wx.Rect(startX+window_size, startY, step, stopY)) ++ self._frame.RefreshRect(wx.Rect(startX + window_size, startY, step, stopY)) + self._frame.Update() + wx.MilliSleep(10) + +@@ -10695,7 +10336,6 @@ def __init__(self, *args, **keys): + AuiManager.__init__(self, *args, **keys) + self.hasDummyPane = False + +- + def _createDummyPane(self): + """ Creates a Dummy Center Pane (**DCP**). """ + +@@ -10707,7 +10347,6 @@ def _createDummyPane(self): + info = AuiPaneInfo().CenterPane().NotebookDockable(True).Name('dummyCenterPane').DestroyOnClose(True) + self.AddPane(dummy, info) + +- + def _destroyDummyPane(self): + """ Destroys the Dummy Center Pane (**DCP**). """ + +@@ -10717,7 +10356,6 @@ def _destroyDummyPane(self): + self.hasDummyPane = False + self.ClosePane(self.GetPane('dummyCenterPane')) + +- + def Update(self): + """ + This method is called after any number of changes are made to any of the +@@ -10742,6 +10380,7 @@ def Update(self): + def do(): + self._destroyDummyPane() + self.Update() ++ + wx.CallAfter(do) + else: + # if we get here, there's no center pane, create our dummy +diff --git a/wx/lib/agw/aui/tabart.py b/wx/lib/agw/aui/tabart.py +index 30dbc7d50..7b0818099 100644 +--- a/wx/lib/agw/aui/tabart.py ++++ b/wx/lib/agw/aui/tabart.py +@@ -299,13 +299,13 @@ def SetSizingInfo(self, tab_ctrl_size, tab_count, minMaxTabWidth): + tot_width -= self._active_windowlist_bmp.GetWidth() + + if tab_count > 0: +- self._fixed_tab_width = tot_width/tab_count ++ self._fixed_tab_width = tot_width//tab_count + + if self._fixed_tab_width < 100: + self._fixed_tab_width = 100 + +- if self._fixed_tab_width > tot_width/2: +- self._fixed_tab_width = tot_width/2 ++ if self._fixed_tab_width > tot_width//2: ++ self._fixed_tab_width = tot_width//2 + + if self._fixed_tab_width > 220: + self._fixed_tab_width = 220 +@@ -472,7 +472,7 @@ def DrawTab(self, dc, wnd, page, in_rect, close_button_state, paint_control=Fals + dc.DrawPoint(r.x+r.width-2, r.y+1) + + # set rectangle down a bit for gradient drawing +- r.SetHeight(r.GetHeight()/2) ++ r.SetHeight(r.GetHeight()//2) + r.x += 2 + r.width -= 2 + r.y += r.height +@@ -495,7 +495,7 @@ def DrawTab(self, dc, wnd, page, in_rect, close_button_state, paint_control=Fals + r.x += 3 + r.y += 1 + r.width -= 4 +- r.height /= 2 ++ r.height //= 2 + r.height -= 1 + + # -- draw top gradient fill for glossy look +@@ -553,7 +553,7 @@ def DrawTab(self, dc, wnd, page, in_rect, close_button_state, paint_control=Fals + # draw bitmap + dc.DrawBitmap(pagebitmap, + bitmap_offset, +- drawn_tab_yoff + (drawn_tab_height/2) - (pagebitmap.GetHeight()/2), ++ drawn_tab_yoff + (drawn_tab_height//2) - (pagebitmap.GetHeight()//2), + True) + + text_offset = bitmap_offset + pagebitmap.GetWidth() +@@ -566,7 +566,7 @@ def DrawTab(self, dc, wnd, page, in_rect, close_button_state, paint_control=Fals + + draw_text = ChopText(dc, caption, tab_width - (text_offset-tab_x) - close_button_width) + +- ypos = drawn_tab_yoff + (drawn_tab_height)/2 - (texty/2) - 1 ++ ypos = drawn_tab_yoff + (drawn_tab_height)//2 - (texty//2) - 1 + + offset_focus = text_offset + if control: +@@ -607,11 +607,11 @@ def DrawTab(self, dc, wnd, page, in_rect, close_button_state, paint_control=Fals + shift = (agwFlags & AUI_NB_BOTTOM and [1] or [0])[0] + + if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT: +- rect = wx.Rect(tab_x + 4, tab_y + (tab_height - bmp.GetHeight())/2 - shift, ++ rect = wx.Rect(tab_x + 4, tab_y + (tab_height - bmp.GetHeight())//2 - shift, + close_button_width, tab_height) + else: + rect = wx.Rect(tab_x + tab_width - close_button_width - 1, +- tab_y + (tab_height - bmp.GetHeight())/2 - shift, ++ tab_y + (tab_height - bmp.GetHeight())//2 - shift, + close_button_width, tab_height) + + rect = IndentPressedBitmap(rect, close_button_state) +@@ -775,14 +775,14 @@ def DrawButton(self, dc, wnd, in_rect, button, orientation): + if orientation == wx.LEFT: + + rect.SetX(in_rect.x) +- rect.SetY(((in_rect.y + in_rect.height)/2) - (bmp.GetHeight()/2)) ++ rect.SetY(((in_rect.y + in_rect.height)//2) - (bmp.GetHeight()//2)) + rect.SetWidth(bmp.GetWidth()) + rect.SetHeight(bmp.GetHeight()) + + else: + + rect = wx.Rect(in_rect.x + in_rect.width - bmp.GetWidth(), +- ((in_rect.y + in_rect.height)/2) - (bmp.GetHeight()/2), ++ ((in_rect.y + in_rect.height)//2) - (bmp.GetHeight()//2), + bmp.GetWidth(), bmp.GetHeight()) + + rect = IndentPressedBitmap(rect, button_state) +@@ -817,11 +817,11 @@ def DrawFocusRectangle(self, dc, page, wnd, draw_text, text_offset, bitmap_offse + + if page.active and wx.Window.FindFocus() == wnd: + +- focusRectText = wx.Rect(text_offset, (drawn_tab_yoff + (drawn_tab_height)/2 - (texty/2)), ++ focusRectText = wx.Rect(text_offset, (drawn_tab_yoff + (drawn_tab_height)//2 - (texty//2)), + textx, texty) + + if page.bitmap.IsOk(): +- focusRectBitmap = wx.Rect(bitmap_offset, drawn_tab_yoff + (drawn_tab_height/2) - (page.bitmap.GetHeight()/2), ++ focusRectBitmap = wx.Rect(bitmap_offset, drawn_tab_yoff + (drawn_tab_height//2) - (page.bitmap.GetHeight()//2), + page.bitmap.GetWidth(), page.bitmap.GetHeight()) + + if page.bitmap.IsOk() and draw_text == "": +@@ -1108,13 +1108,13 @@ def SetSizingInfo(self, tab_ctrl_size, tab_count, minMaxTabWidth): + tot_width -= self._active_windowlist_bmp.GetWidth() + + if tab_count > 0: +- self._fixed_tab_width = tot_width/tab_count ++ self._fixed_tab_width = tot_width//tab_count + + if self._fixed_tab_width < 100: + self._fixed_tab_width = 100 + +- if self._fixed_tab_width > tot_width/2: +- self._fixed_tab_width = tot_width/2 ++ if self._fixed_tab_width > tot_width//2: ++ self._fixed_tab_width = tot_width//2 + + if self._fixed_tab_width > 220: + self._fixed_tab_width = 220 +@@ -1236,23 +1236,23 @@ def DrawTab(self, dc, wnd, page, in_rect, close_button_state, paint_control=Fals + close_button_width = self._active_close_bmp.GetWidth() + if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT: + if control: +- text_offset = tab_x + (tab_height/2) + close_button_width - (textx/2) - 2 ++ text_offset = tab_x + (tab_height//2) + close_button_width - (textx//2) - 2 + else: +- text_offset = tab_x + (tab_height/2) + ((tab_width+close_button_width)/2) - (textx/2) - 2 ++ text_offset = tab_x + (tab_height//2) + ((tab_width+close_button_width)//2) - (textx//2) - 2 + else: + if control: +- text_offset = tab_x + (tab_height/2) + close_button_width - (textx/2) ++ text_offset = tab_x + (tab_height//2) + close_button_width - (textx//2) + else: +- text_offset = tab_x + (tab_height/2) + ((tab_width-close_button_width)/2) - (textx/2) ++ text_offset = tab_x + (tab_height//2) + ((tab_width-close_button_width)//2) - (textx//2) + + else: + +- text_offset = tab_x + (tab_height/3) + (tab_width/2) - (textx/2) ++ text_offset = tab_x + (tab_height//3) + (tab_width//2) - (textx//2) + if control: + if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT: +- text_offset = tab_x + (tab_height/3) - (textx/2) + close_button_width + 2 ++ text_offset = tab_x + (tab_height//3) - (textx//2) + close_button_width + 2 + else: +- text_offset = tab_x + (tab_height/3) - (textx/2) ++ text_offset = tab_x + (tab_height//3) - (textx//2) + + # set minimum text offset + if text_offset < tab_x + tab_height: +@@ -1265,7 +1265,7 @@ def DrawTab(self, dc, wnd, page, in_rect, close_button_state, paint_control=Fals + draw_text = ChopText(dc, caption, + tab_width - (text_offset-tab_x) - close_button_width) + +- ypos = (tab_y + tab_height)/2 - (texty/2) + 1 ++ ypos = (tab_y + tab_height)//2 - (texty//2) + 1 + + if control: + if control.GetPosition() != wx.Point(text_offset+1, ypos): +@@ -1288,7 +1288,7 @@ def DrawTab(self, dc, wnd, page, in_rect, close_button_state, paint_control=Fals + # draw focus rectangle + if page.active and wx.Window.FindFocus() == wnd and (agwFlags & AUI_NB_NO_TAB_FOCUS) == 0: + +- focusRect = wx.Rect(text_offset, ((tab_y + tab_height)/2 - (texty/2) + 1), ++ focusRect = wx.Rect(text_offset, ((tab_y + tab_height)//2 - (texty//2) + 1), + selected_textx, selected_texty) + + focusRect.Inflate(2, 2) +@@ -1308,11 +1308,11 @@ def DrawTab(self, dc, wnd, page, in_rect, close_button_state, paint_control=Fals + + if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT: + rect = wx.Rect(tab_x + tab_height - 2, +- tab_y + (tab_height/2) - (bmp.GetHeight()/2) + 1, ++ tab_y + (tab_height//2) - (bmp.GetHeight()//2) + 1, + close_button_width, tab_height - 1) + else: + rect = wx.Rect(tab_x + tab_width - close_button_width - 1, +- tab_y + (tab_height/2) - (bmp.GetHeight()/2) + 1, ++ tab_y + (tab_height//2) - (bmp.GetHeight()//2) + 1, + close_button_width, tab_height - 1) + + self.DrawButtons(dc, rect, bmp, wx.WHITE, close_button_state) +@@ -1387,7 +1387,7 @@ def GetTabSize(self, dc, wnd, caption, bitmap, active, close_button_state, contr + controlW, controlH = control.GetSize() + tab_width += controlW + 4 + +- x_extent = tab_width - (tab_height/2) - 1 ++ x_extent = tab_width - (tab_height//2) - 1 + + return (tab_width, tab_height), x_extent + +@@ -1443,14 +1443,14 @@ def DrawButton(self, dc, wnd, in_rect, button, orientation): + if orientation == wx.LEFT: + + rect.SetX(in_rect.x) +- rect.SetY(((in_rect.y + in_rect.height)/2) - (bmp.GetHeight()/2)) ++ rect.SetY(((in_rect.y + in_rect.height)//2) - (bmp.GetHeight()//2)) + rect.SetWidth(bmp.GetWidth()) + rect.SetHeight(bmp.GetHeight()) + + else: + + rect = wx.Rect(in_rect.x + in_rect.width - bmp.GetWidth(), +- ((in_rect.y + in_rect.height)/2) - (bmp.GetHeight()/2), ++ ((in_rect.y + in_rect.height)//2) - (bmp.GetHeight()//2), + bmp.GetWidth(), bmp.GetHeight()) + + self.DrawButtons(dc, rect, bmp, wx.WHITE, button_state) +@@ -1751,7 +1751,7 @@ def DrawTab(self, dc, wnd, page, in_rect, close_button_state, paint_control=Fals + + # draw bitmap + dc.DrawBitmap(pagebitmap, bitmap_offset, +- drawn_tab_yoff + (drawn_tab_height/2) - (pagebitmap.GetHeight()/2) + shift, ++ drawn_tab_yoff + (drawn_tab_height//2) - (pagebitmap.GetHeight()//2) + shift, + True) + + text_offset = bitmap_offset + pagebitmap.GetWidth() +@@ -1776,7 +1776,7 @@ def DrawTab(self, dc, wnd, page, in_rect, close_button_state, paint_control=Fals + + draw_text = ChopText(dc, caption, tab_width - (text_offset-tab_x) - close_button_width) + +- ypos = drawn_tab_yoff + (drawn_tab_height)/2 - (texty/2) - 1 + shift ++ ypos = drawn_tab_yoff + (drawn_tab_height)//2 - (texty//2) - 1 + shift + + offset_focus = text_offset + +@@ -1819,11 +1819,11 @@ def DrawTab(self, dc, wnd, page, in_rect, close_button_state, paint_control=Fals + + if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT: + rect = wx.Rect(tab_x + 4, +- drawn_tab_yoff + (drawn_tab_height / 2) - (bmp.GetHeight() / 2) + shift, ++ drawn_tab_yoff + (drawn_tab_height // 2) - (bmp.GetHeight() // 2) + shift, + close_button_width, tab_height) + else: + rect = wx.Rect(tab_x + tab_width - close_button_width - 3, +- drawn_tab_yoff + (drawn_tab_height / 2) - (bmp.GetHeight() / 2) + shift, ++ drawn_tab_yoff + (drawn_tab_height // 2) - (bmp.GetHeight() // 2) + shift, + close_button_width, tab_height) + + # Indent the button if it is pressed down: +@@ -1986,7 +1986,7 @@ def DrawTab(self, dc, wnd, page, in_rect, close_button_state, paint_control=Fals + + # draw bitmap + dc.DrawBitmap(pagebitmap, bitmap_offset, +- drawn_tab_yoff + (drawn_tab_height/2) - (pagebitmap.GetHeight()/2) + shift, ++ drawn_tab_yoff + (drawn_tab_height//2) - (pagebitmap.GetHeight()//2) + shift, + True) + + text_offset = bitmap_offset + pagebitmap.GetWidth() +@@ -2014,7 +2014,7 @@ def DrawTab(self, dc, wnd, page, in_rect, close_button_state, paint_control=Fals + else: + draw_text = ChopText(dc, caption, tab_width - (text_offset-tab_x) - close_button_width) + +- ypos = drawn_tab_yoff + drawn_tab_height/2 - texty/2 - 1 + shift ++ ypos = drawn_tab_yoff + drawn_tab_height//2 - texty//2 - 1 + shift + + offset_focus = text_offset + +@@ -2056,11 +2056,11 @@ def DrawTab(self, dc, wnd, page, in_rect, close_button_state, paint_control=Fals + + if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT: + rect = wx.Rect(tab_x + 5, +- drawn_tab_yoff + (drawn_tab_height / 2) - (bmp.GetHeight() / 2) + shift, ++ drawn_tab_yoff + (drawn_tab_height // 2) - (bmp.GetHeight() // 2) + shift, + close_button_width, tab_height) + else: + rect = wx.Rect(tab_x + tab_width - close_button_width - 3, +- drawn_tab_yoff + (drawn_tab_height / 2) - (bmp.GetHeight() / 2) + shift, ++ drawn_tab_yoff + (drawn_tab_height // 2) - (bmp.GetHeight() // 2) + shift, + close_button_width, tab_height) + + # Indent the button if it is pressed down: +@@ -2091,14 +2091,14 @@ def DrawTabBackground(self, dc, rect, focus, upperTabs): + + if focus: + if upperTabs: +- leftPt = wx.Point(rect.x, rect.y + (rect.height / 10)*8) +- rightPt = wx.Point(rect.x + rect.width - 2, rect.y + (rect.height / 10)*8) ++ leftPt = wx.Point(rect.x, rect.y + (rect.height // 10)*8) ++ rightPt = wx.Point(rect.x + rect.width - 2, rect.y + (rect.height // 10)*8) + else: +- leftPt = wx.Point(rect.x, rect.y + (rect.height / 10)*5) +- rightPt = wx.Point(rect.x + rect.width - 2, rect.y + (rect.height / 10)*5) ++ leftPt = wx.Point(rect.x, rect.y + (rect.height // 10)*5) ++ rightPt = wx.Point(rect.x + rect.width - 2, rect.y + (rect.height // 10)*5) + else: +- leftPt = wx.Point(rect.x, rect.y + (rect.height / 2)) +- rightPt = wx.Point(rect.x + rect.width - 2, rect.y + (rect.height / 2)) ++ leftPt = wx.Point(rect.x, rect.y + (rect.height // 2)) ++ rightPt = wx.Point(rect.x + rect.width - 2, rect.y + (rect.height // 2)) + + # Define the top region + top = wx.Rect(rect.GetTopLeft(), rightPt) +@@ -2322,7 +2322,7 @@ def DrawTab(self, dc, wnd, page, in_rect, close_button_state, paint_control=Fals + + # draw bitmap + dc.DrawBitmap(pagebitmap, bitmap_offset, +- drawn_tab_yoff + (drawn_tab_height/2) - (pagebitmap.GetHeight()/2) + shift, ++ drawn_tab_yoff + (drawn_tab_height//2) - (pagebitmap.GetHeight()//2) + shift, + True) + + text_offset = bitmap_offset + pagebitmap.GetWidth() +@@ -2349,7 +2349,7 @@ def DrawTab(self, dc, wnd, page, in_rect, close_button_state, paint_control=Fals + else: + draw_text = ChopText(dc, caption, tab_width - (text_offset-tab_x) - close_button_width) + +- ypos = drawn_tab_yoff + drawn_tab_height/2 - texty/2 - 1 + shift ++ ypos = drawn_tab_yoff + drawn_tab_height//2 - texty//2 - 1 + shift + + offset_focus = text_offset + +@@ -2396,11 +2396,11 @@ def DrawTab(self, dc, wnd, page, in_rect, close_button_state, paint_control=Fals + + if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT: + rect = wx.Rect(tab_x + 20, +- drawn_tab_yoff + (drawn_tab_height / 2) - (bmp.GetHeight() / 2) + shift, ++ drawn_tab_yoff + (drawn_tab_height // 2) - (bmp.GetHeight() // 2) + shift, + close_button_width, tab_height) + else: + rect = wx.Rect(xpos, +- drawn_tab_yoff + (drawn_tab_height / 2) - (bmp.GetHeight() / 2) + shift, ++ drawn_tab_yoff + (drawn_tab_height // 2) - (bmp.GetHeight() // 2) + shift, + close_button_width, tab_height) + + # Indent the button if it is pressed down: +@@ -2684,7 +2684,7 @@ def DrawTab(self, dc, wnd, page, in_rect, close_button_state, paint_control=Fals + + # draw bitmap + dc.DrawBitmap(pagebitmap, bitmap_offset, +- drawn_tab_yoff + (drawn_tab_height/2) - (pagebitmap.GetHeight()/2), ++ drawn_tab_yoff + (drawn_tab_height//2) - (pagebitmap.GetHeight()//2), + True) + + text_offset = bitmap_offset + pagebitmap.GetWidth() +@@ -2712,7 +2712,7 @@ def DrawTab(self, dc, wnd, page, in_rect, close_button_state, paint_control=Fals + else: + draw_text = ChopText(dc, caption, tab_width - (text_offset-tab_x) - close_button_width - leftw) + +- ypos = drawn_tab_yoff + drawn_tab_height/2 - texty/2 - 1 ++ ypos = drawn_tab_yoff + drawn_tab_height//2 - texty//2 - 1 + + if control: + if control.GetPosition() != wx.Point(text_offset+1, ypos): +@@ -2746,11 +2746,11 @@ def DrawTab(self, dc, wnd, page, in_rect, close_button_state, paint_control=Fals + + if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT: + rect = wx.Rect(tab_x + leftw - 2, +- drawn_tab_yoff + (drawn_tab_height / 2) - (bmp.GetHeight() / 2) + 1, ++ drawn_tab_yoff + (drawn_tab_height // 2) - (bmp.GetHeight() // 2) + 1, + close_button_width, tab_height) + else: + rect = wx.Rect(tab_x + tab_width - close_button_width - rightw + 2, +- drawn_tab_yoff + (drawn_tab_height / 2) - (bmp.GetHeight() / 2) + 1, ++ drawn_tab_yoff + (drawn_tab_height // 2) - (bmp.GetHeight() // 2) + 1, + close_button_width, tab_height) + + if agwFlags & AUI_NB_BOTTOM: diff --git a/python-wxpython4.spec b/python-wxpython4.spec index 6695a1d..4e81482 100644 --- a/python-wxpython4.spec +++ b/python-wxpython4.spec @@ -12,7 +12,7 @@ specific code. Name: python-wxpython4 Version: 4.0.7 -Release: 28%{?dist} +Release: 29%{?dist} Summary: %{sum} # wxPython is licensed under the wxWidgets license. The only exception is # the pubsub code in wx/lib/pubsub which is BSD licensed. Note: wxPython @@ -39,6 +39,7 @@ Patch12: https://github.com/wxWidgets/Phoenix/commit/62e9c7881ea23966fab8 Patch13: https://github.com/wxWidgets/Phoenix/commit/37fd1be72fe333dfe1570ad63eab90408c3c84e4.patch Patch14: https://github.com/wxWidgets/Phoenix/commit/587f3418f2b772cfd24686f4448a29f340791e6b.patch Patch15: https://github.com/wxWidgets/Phoenix/commit/006110366cfece110ca8c68606a76e3801125469.patch +Patch16: https://github.com/wxWidgets/Phoenix/commit/7dafb83729711a834538de2faebfb42485dbece0.patch BuildRequires: gcc-c++ BuildRequires: doxygen @@ -181,6 +182,9 @@ xvfb-run -a %{__python3} build.py test --pytest_timeout=60 --extra_pytest="-k $S %changelog +* Tue Mar 08 2022 Scott Talbert - 4.0.7-29 +- Fix even more Python 3.10 int/float issues (#2060854) + * Wed Feb 16 2022 Scott Talbert - 4.0.7-28 - Fix additional Python 3.10 issues