Commit 948da0013c979df910412e6f56e45cea1f1056b1

Authored by Christopher Stone
1 parent 001c428d
Exists in master

More progress on a clean and tidy graph-plotter. Currently throwing an 'incompat…

…ible function signature' error.
Showing 1 changed file with 22 additions and 14 deletions   Show diff stats
telemetry/code/monitor/graph_plotter_rewrite.py
... ... @@ -9,16 +9,21 @@ from colours import *
9 9  
10 10 class Plot:
11 11 def __init__(self, title="Unknown", size=(640, 480)):
12   - self.title = title
13   - self.size = size
14   - self.font = 'Arkhip'
15   - self.window = pyglet.window.Window(self.size[0], self.size[1], resizable=True)
16   - self.window.set_caption(title)
17   -
  12 + self.title = title
  13 + self.size = size
  14 + self.font = 'Arkhip'
  15 + self.window = pyglet.window.Window(self.size[0], self.size[1], resizable=True)
  16 + self.window.set_caption(title)
  17 + self.window.on_resize = self.resize
  18 + self.window.on_draw = self.draw
  19 +
  20 + def resize(width, height):
  21 + self.size = (width, height)
  22 +
18 23 def draw(self):
19   - self.drawBackground()
20   - self.drawHeading()
21   -
  24 + self.drawBackground()
  25 + self.drawHeading()
  26 +
22 27 def drawBackground(self):
23 28 pyglet.image.SolidColorImagePattern(WHITE).create_image(self.size[0], self.size[1]).blit(0, 0)
24 29  
... ... @@ -32,11 +37,14 @@ class Plot:
32 37 plots = []
33 38 plots.append(Plot("This is a test plot"))
34 39  
35   -def update(foo):
36   - for plot in plots:
37   - plot.window.clear()
38   - plot.draw()
  40 +def pollSerial():
  41 + pass
  42 +
  43 +#def update(foo):
  44 +# for plot in plots:
  45 +# plot.window.clear()
  46 +# plot.draw()
39 47  
40   -pyglet.clock.schedule_interval(update, 0.01)
  48 +pyglet.clock.schedule_interval(pollSerial, 0.1)
41 49  
42 50 pyglet.app.run()
43 51 \ No newline at end of file
... ...