# HG changeset patch # User Edouard Tisserant # Date 1681333361 -7200 # Node ID 36934591f6eb26c1c5135b8b377e43cf8503ea4a # Parent 9958cf865da0de76430498c68cccdfd3db8d0f08 IDE: python-3.10: wxPython calls don't accept float anymore, continued diff -r 9958cf865da0 -r 36934591f6eb controls/ProjectPropertiesPanel.py --- a/controls/ProjectPropertiesPanel.py Wed Apr 12 21:05:00 2023 +0200 +++ b/controls/ProjectPropertiesPanel.py Wed Apr 12 23:02:41 2023 +0200 @@ -252,13 +252,13 @@ elif item == "contentDescription": self.ContentDescription.SetValue(value) elif item == "pageSize": - self.PageWidth.SetValue(value[0]) - self.PageHeight.SetValue(value[1]) + self.PageWidth.SetValue(int(value[0])) + self.PageHeight.SetValue(int(value[1])) elif item == "scaling": for language, (x, y) in list(value.items()): if language in self.Scalings: - self.Scalings[language][0].SetValue(x) - self.Scalings[language][1].SetValue(y) + self.Scalings[language][0].SetValue(int(x)) + self.Scalings[language][1].SetValue(int(y)) else: tc = getattr(self, item, None) if tc is not None: diff -r 9958cf865da0 -r 36934591f6eb editors/Viewer.py --- a/editors/Viewer.py Wed Apr 12 21:05:00 2023 +0200 +++ b/editors/Viewer.py Wed Apr 12 23:02:41 2023 +0200 @@ -805,8 +805,8 @@ pos = mouse_event.GetLogicalPosition(dc) xmax = self.GetScrollRange(wx.HORIZONTAL) - self.GetScrollThumb(wx.HORIZONTAL) ymax = self.GetScrollRange(wx.VERTICAL) - self.GetScrollThumb(wx.VERTICAL) - scrollx = max(0, round(pos.x * self.ViewScale[0] - mouse_pos.x) / SCROLLBAR_UNIT) - scrolly = max(0, round(pos.y * self.ViewScale[1] - mouse_pos.y) / SCROLLBAR_UNIT) + scrollx = max(0, round(pos.x * self.ViewScale[0] - mouse_pos.x) // SCROLLBAR_UNIT) + scrolly = max(0, round(pos.y * self.ViewScale[1] - mouse_pos.y) // SCROLLBAR_UNIT) if scrollx > xmax or scrolly > ymax: self.RefreshScrollBars(max(0, scrollx - xmax), max(0, scrolly - ymax)) self.Scroll(scrollx, scrolly) diff -r 9958cf865da0 -r 36934591f6eb graphics/GraphicCommons.py --- a/graphics/GraphicCommons.py Wed Apr 12 21:05:00 2023 +0200 +++ b/graphics/GraphicCommons.py Wed Apr 12 23:02:41 2023 +0200 @@ -137,6 +137,10 @@ return vector +def ivector(*a,**k): + return tuple(map(round, vector(*a,**k))) + + def norm(v): """ Calculate the norm of a given vector @@ -1976,8 +1980,8 @@ lx, ly = x, y # Calculate the start and end directions - self.StartPoint = [None, vector(self.Points[0], self.Points[1])] - self.EndPoint = [None, vector(self.Points[-1], self.Points[-2])] + self.StartPoint = [None, ivector(self.Points[0], self.Points[1])] + self.EndPoint = [None, ivector(self.Points[-1], self.Points[-2])] # Calculate the start and end points self.StartPoint[0] = wx.Point(self.Points[0].x + round(CONNECTOR_SIZE * self.StartPoint[1][0]), self.Points[0].y + round(CONNECTOR_SIZE * self.StartPoint[1][1])) @@ -1993,7 +1997,7 @@ if i > lp - 2: break - segment = tuple(map(round,vector(self.Points[i], self.Points[i + 1]))) + segment = ivector(self.Points[i], self.Points[i + 1]) # merge segment if requested if merge_segments and 0 < i and \ @@ -2006,7 +2010,7 @@ # remove corner when two segments are in opposite direction if i < lp - 2: - next = vector(self.Points[i + 1], self.Points[i + 2]) + next = ivector(self.Points[i + 1], self.Points[i + 2]) if is_null_vector(add_vectors(segment, next)): self.Points.pop(i+1) continue @@ -2078,7 +2082,7 @@ # The next point is the last if i + 1 == len(self.Points) - 1: # Calculate the direction from current point to end point - v_end = tuple(map(round,vector(self.Points[i], end))) + v_end = vector(self.Points[i], end) # The current point is the first if i == 0: # If the end point is not in the start direction, a point is added @@ -2200,7 +2204,7 @@ 1, DirectionChoice((self.Segments[0][1], self.Segments[0][0]), - tuple(map(round,vector(start, self.Points[1]))), + vector(start, self.Points[1]), self.Segments[1])) else: self.Points[1].x, self.Points[1].y = start.x, start.y