visualizer: workaround for get_bounds() TypeError
authorTom Henderson <tomh@tomh.org>
Wed, 15 Aug 2018 12:27:15 -0700
changeset 13743 ce5cd3cf2874
parent 13742 ca72220e64e4
child 13744 0c3300b2dae0
visualizer: workaround for get_bounds() TypeError
src/visualizer/visualizer/core.py
--- a/src/visualizer/visualizer/core.py	Wed Aug 15 12:27:09 2018 -0700
+++ b/src/visualizer/visualizer/core.py	Wed Aug 15 12:27:15 2018 -0700
@@ -416,19 +416,23 @@
 
         # If the location of the point is now beyond the bounds of the
         # canvas then those bounds now need to be increased
-        bounds = self.visualizer.canvas.get_bounds()
+        try:
+            bounds = self.visualizer.canvas.get_bounds()
 
-        (min_x, min_y, max_x, max_y) = bounds
+            (min_x, min_y, max_x, max_y) = bounds
 
-        min_x = min(x, min_x)
-        min_y = min(y, min_y)
-        max_x = max(x, max_x)
-        max_y = max(y, max_y)
+            min_x = min(x, min_x)
+            min_y = min(y, min_y)
+            max_x = max(x, max_x)
+            max_y = max(y, max_y)
 
-        new_bounds = (min_x, min_y, max_x, max_y)
+            new_bounds = (min_x, min_y, max_x, max_y)
 
-        if new_bounds != bounds:
-            self.visualizer.canvas.set_bounds(*new_bounds)
+            if new_bounds != bounds:
+                self.visualizer.canvas.set_bounds(*new_bounds)
+        except TypeError:
+            # bug 2969:  GooCanvas.Canvas.get_bounds() inconsistency
+            pass
 
     def get_position(self):
         """!