# HG changeset patch # User Edouard Tisserant # Date 1697748747 -7200 # Node ID 5d23a47937c46e170d2b963ca1a9cd2b8d1d8cef # Parent be827d87b515e4a09c118f3eb80f36f301aa4075 IDE: py3.10 related float/int fixes in debug plots diff -r be827d87b515 -r 5d23a47937c4 controls/DebugVariablePanel/DebugVariableGraphicViewer.py --- a/controls/DebugVariablePanel/DebugVariableGraphicViewer.py Wed Oct 18 19:36:20 2023 +0200 +++ b/controls/DebugVariablePanel/DebugVariableGraphicViewer.py Thu Oct 19 22:52:27 2023 +0200 @@ -169,7 +169,7 @@ # If mouse is dropped in left part of graph canvas, graph # wall be merged orthogonally merge_rect = wx.Rect(rect.x, rect.y, - rect.width / 2., rect.height) + rect.width // 2, rect.height) if merge_rect.Contains(x, y): merge_type = GRAPH_ORTHOGONAL @@ -613,6 +613,7 @@ [pair for pair in enumerate(self.Labels)]): # Get label bounding box (x0, y0), (x1, y1) = t.get_window_extent().get_points() + x0, y0, x1, y1 = map(int,(x0, y0, x1, y1)) rect = wx.Rect(x0, height - y1, x1 - x0, y1 - y0) # Check if mouse was over label if rect.Contains(x, y): @@ -724,6 +725,7 @@ directions): # Check every label paired with corresponding item (x0, y0), (x1, y1) = t.get_window_extent().get_points() + x0, y0, x1, y1 = map(int,(x0, y0, x1, y1)) rect = wx.Rect(x0, height - y1, x1 - x0, y1 - y0) # Check if mouse was over label if rect.Contains(event.x, height - event.y): @@ -806,7 +808,7 @@ # and mouse position if self.GraphType == GRAPH_ORTHOGONAL: start_tick, end_tick = self.ParentWindow.GetRange() - tick = (start_tick + end_tick) / 2. + tick = (start_tick + end_tick) // 2. else: tick = event.xdata self.ParentWindow.ChangeRange(int(-event.step) // 3, tick) @@ -872,8 +874,8 @@ # The minimum height take in account the height of all items, padding # inside figure and border around figure return wx.Size(200, - CANVAS_BORDER[0] + CANVAS_BORDER[1] + - 2 * CANVAS_PADDING + VALUE_LABEL_HEIGHT * len(self.Items)) + int(CANVAS_BORDER[0] + CANVAS_BORDER[1] + + 2 * CANVAS_PADDING + VALUE_LABEL_HEIGHT * len(self.Items)) ) def SetCanvasHeight(self, height): """ @@ -894,7 +896,7 @@ # Calculate figure bounding box. Y coordinate is inverted in matplotlib # figure comparing to wx panel width, height = self.GetSize() - ax, ay, aw, ah = self.figure.gca().get_position().bounds + ax, ay, aw, ah = map(int, self.figure.gca().get_position().bounds) bbox = wx.Rect(ax * width, height - (ay + ah) * height - 1, aw * width + 2, ah * height + 1) diff -r be827d87b515 -r 5d23a47937c4 controls/DebugVariablePanel/DebugVariableTextViewer.py --- a/controls/DebugVariablePanel/DebugVariableTextViewer.py Wed Oct 18 19:36:20 2023 +0200 +++ b/controls/DebugVariablePanel/DebugVariableTextViewer.py Thu Oct 19 22:52:27 2023 +0200 @@ -243,7 +243,7 @@ # Test if mouse has been pressed in this bounding box. In that case # start a move drag'n drop of item variable x, y = event.GetPosition() - item_path_bbox = wx.Rect(20, (height - h) / 2, w, h) + item_path_bbox = wx.Rect(20, (height - h) // 2, w, h) if item_path_bbox.Contains(x, y): self.ShowButtons(False) data = wx.TextDataObject(str((item.GetVariable(), "debug", "move")))