diff --git a/robots/little_john/telemetry/code/monitor/graph_plotter_rewrite.py b/robots/little_john/telemetry/code/monitor/graph_plotter_rewrite.py index 652bb28..d894e35 100755 --- a/robots/little_john/telemetry/code/monitor/graph_plotter_rewrite.py +++ b/robots/little_john/telemetry/code/monitor/graph_plotter_rewrite.py @@ -77,8 +77,14 @@ class Plot(pyglet.window.Window): def on_resize(self, width, height): """Handle a resize event from the pyglet event loop""" - self.bounds = ((int(self.width * self.margins[0]), int(self.width * (1 - self.margins[0]))), + try: + self.bounds = ((int(self.width * self.margins[0]), int(self.width * (1 - self.margins[0]))), (int(self.height * self.margins[1]), int(self.height * (1 - self.margins[1])))) + except Exception as e: + logging.critical(str(e)) + self.close() + logging.critical('Instance closed') + sys.exit() self.tag_size = min(self.height*self.margins[1]*0.3,self.width*self.margins[0]*0.3) # This sometimes seems to throw an error ('AttributeError: 'Plot' object has no attribute 'margins') when started for a second time from the same instance. Interesting. Causes the plot windows to freeze pyglet.window.Window.on_resize(self, width, height) -- libgit2 0.21.2