diff -r b1144bb36605 -r c70aefcadf66 graphics/GraphicCommons.py --- a/graphics/GraphicCommons.py Tue Apr 22 10:25:24 2008 +0200 +++ b/graphics/GraphicCommons.py Tue Apr 22 16:16:00 2008 +0200 @@ -1183,6 +1183,7 @@ self.Value = None self.OverStart = False self.OverEnd = False + self.ComputingType = False # Destructor of a wire def __del__(self): @@ -1212,8 +1213,11 @@ # Returns connector to which start point is connected def GetStartConnectedType(self): - if self.StartConnected: - return self.StartConnected.GetType() + if self.StartConnected and not self.ComputingType: + self.ComputingType = True + computed_type = self.StartConnected.GetType() + self.ComputingType = False + return computed_type return None # Returns connector to which end point is connected @@ -1222,8 +1226,11 @@ # Returns connector to which end point is connected def GetEndConnectedType(self): - if self.EndConnected: - return self.EndConnected.GetType() + if self.EndConnected and not self.ComputingType: + self.ComputingType = True + computed_type = self.EndConnected.GetType() + self.ComputingType = False + return computed_type return None def GetOtherConnected(self, connector): @@ -1324,7 +1331,7 @@ miny, minbbxy = min(miny, self.Points[-1].y), min(minbbxy, self.Points[-1].y - end_radius) maxy, maxbbxy = max(maxy, self.Points[-1].y), max(maxbbxy, self.Points[-1].y + end_radius) self.Pos.x, self.Pos.y = minx, miny - self.Size = wx.Size(maxx - minx + 1, maxy - miny + 1) + self.Size = wx.Size(maxx - minx, maxy - miny) self.BoundingBox = wx.Rect(minbbxx, minbbxy, maxbbxx - minbbxx + 1, maxbbxy - minbbxy + 1) # Refresh the realpoints that permits to keep the proportionality in wire during resizing @@ -1652,10 +1659,10 @@ dir = self.EndPoint[1] else: dir = (0, 0) - pointx = max(-dir[0] * MIN_SEGMENT_SIZE, min(int(round(point[0] * (width - 1) / float(lastwidth - 1))), - width - dir[0] * MIN_SEGMENT_SIZE - 1)) - pointy = max(-dir[1] * MIN_SEGMENT_SIZE, min(int(round(point[1] * (height - 1) / float(lastheight - 1))), - height - dir[1] * MIN_SEGMENT_SIZE - 1)) + pointx = max(-dir[0] * MIN_SEGMENT_SIZE, min(int(round(point[0] * width / float(max(lastwidth, 1)))), + width - dir[0] * MIN_SEGMENT_SIZE)) + pointy = max(-dir[1] * MIN_SEGMENT_SIZE, min(int(round(point[1] * height / float(max(lastheight, 1)))), + height - dir[1] * MIN_SEGMENT_SIZE)) self.Points[i] = wx.Point(minx + x + pointx, miny + y + pointy) self.StartPoint[0] = self.Points[0] self.EndPoint[0] = self.Points[-1] @@ -1676,8 +1683,8 @@ # duringa resize dragging for i, point in enumerate(self.RealPoints): if not (i == 0 and self.StartConnected) and not (i == len(self.Points) - 1 and self.EndConnected): - point[0] = point[0] * (width - 1) / float(lastwidth - 1) - point[1] = point[1] * (height - 1) / float(lastheight - 1) + point[0] = point[0] * width / float(max(lastwidth, 1)) + point[1] = point[1] * height / float(max(lastheight, 1)) # Calculate the correct position of the points from real points for i, point in enumerate(self.RealPoints): if not (i == 0 and self.StartConnected) and not (i == len(self.Points) - 1 and self.EndConnected): @@ -1688,9 +1695,9 @@ else: dir = (0, 0) realpointx = max(-dir[0] * MIN_SEGMENT_SIZE, min(int(round(point[0])), - width - dir[0] * MIN_SEGMENT_SIZE - 1)) + width - dir[0] * MIN_SEGMENT_SIZE)) realpointy = max(-dir[1] * MIN_SEGMENT_SIZE, min(int(round(point[1])), - height - dir[1] * MIN_SEGMENT_SIZE - 1)) + height - dir[1] * MIN_SEGMENT_SIZE)) self.Points[i] = wx.Point(minx + x + realpointx, miny + y + realpointy) self.StartPoint[0] = self.Points[0] self.EndPoint[0] = self.Points[-1]