From a32cf498ca953e0ebc0558958977ecd37fc741a5 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Mon, 15 Apr 2013 22:24:42 +0200 Subject: host/simu, host/simu/robots/apbirthday: add plate loading simulation --- host/simu/view/table_eurobot2013.py | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) (limited to 'host/simu/view/table_eurobot2013.py') diff --git a/host/simu/view/table_eurobot2013.py b/host/simu/view/table_eurobot2013.py index 889fe369..6acd847d 100644 --- a/host/simu/view/table_eurobot2013.py +++ b/host/simu/view/table_eurobot2013.py @@ -79,26 +79,15 @@ class Plate (Drawable): self.reset () if self.model.pos: self.trans_translate (self.model.pos) + self.trans_rotate (self.model.angle) w, h = self.model.dim w, h = w/2, h/2 self.draw_rectangle ((-w, -h), (w, h), fill = PINK) self.draw_rectangle ((-w + 22, -h + 22), (w - 22, h - 22), fill = PINK) - Drawable.draw (self) - -class Cherry (Drawable): - - def __init__ (self, onto, model): - Drawable.__init__ (self, onto) - self.model = model - self.model.register (self.update) - - def draw (self): - self.reset () - model = self.model - if model.pos: - self.draw_circle (model.pos, model.radius, - fill = colors[model.color]) + for c in self.model.cherries: + if c.pos: + self.draw_circle (c.pos, c.radius, fill = colors[c.color]) Drawable.draw (self) class Gift (Drawable): @@ -133,8 +122,6 @@ class Table (Drawable): Glass (self, e) for e in self.model.plates: Plate (self, e) - for e in self.model.cherries: - Cherry (self, e) for e in self.model.gifts: Gift (self, e) -- cgit v1.2.3