summaryrefslogtreecommitdiff
path: root/host/simu/robots/robospierre/view/clamp.py
diff options
context:
space:
mode:
Diffstat (limited to 'host/simu/robots/robospierre/view/clamp.py')
-rw-r--r--host/simu/robots/robospierre/view/clamp.py41
1 files changed, 29 insertions, 12 deletions
diff --git a/host/simu/robots/robospierre/view/clamp.py b/host/simu/robots/robospierre/view/clamp.py
index bd5f6dab..07a10929 100644
--- a/host/simu/robots/robospierre/view/clamp.py
+++ b/host/simu/robots/robospierre/view/clamp.py
@@ -68,7 +68,7 @@ class ClampTop (Drawable):
self.trans_push ()
self.trans_scale (1 - slot.z / 1000.0)
self.trans_translate ((slot.x, slot.y))
- draw_pawn (self, slot.pawn.radius, slot.pawn.kind)
+ draw_pawn (self, slot.pawn)
self.trans_pop ()
# Draw clamp.
if self.model.rotation is not None:
@@ -82,7 +82,7 @@ class ClampTop (Drawable):
if load is not None:
self.trans_push ()
self.trans_translate ((150, 0))
- draw_pawn (self, load.radius, load.kind)
+ draw_pawn (self, load)
self.trans_pop ()
# Mobile side.
self.trans_rotate (-self.model.clamping / 43)
@@ -107,16 +107,23 @@ class ClampSide (Drawable):
if pawn is not None:
self.trans_push ()
self.trans_translate (pos)
- self.draw_rectangle ((-100, 0), (100, 50), fill = YELLOW)
- if pawn.kind == 'king':
- self.draw_polygon ((-50, 50), (-10, 170), (-50, 170), (-50, 190),
- (-10, 190), (-10, 230), (10, 230), (10, 190), (50, 190),
- (50, 170), (5, 170), (50, 50), fill = YELLOW,
- outline = BLACK)
- elif pawn.kind == 'queen':
- self.draw_polygon ((-50, 50), (-10, 180), (10, 180), (50, 50),
- fill = YELLOW, outline = BLACK)
- self.draw_circle ((0, 180), 50, fill = YELLOW)
+ if pawn.kind == 'tower':
+ pawns = pawn.tower
+ else:
+ pawns = (pawn, )
+ for p in pawns:
+ self.draw_rectangle ((-100, 0), (100, 50), fill = YELLOW)
+ if p.kind == 'king':
+ self.draw_polygon ((-50, 50), (-10, 170), (-50, 170),
+ (-50, 190), (-10, 190), (-10, 230), (10, 230),
+ (10, 190), (50, 190), (50, 170), (5, 170),
+ (50, 50), fill = YELLOW,
+ outline = BLACK)
+ elif p.kind == 'queen':
+ self.draw_polygon ((-50, 50), (-10, 180), (10, 180),
+ (50, 50), fill = YELLOW, outline = BLACK)
+ self.draw_circle ((0, 180), 50, fill = YELLOW)
+ self.trans_translate ((0, 50))
self.trans_pop ()
def draw (self):
@@ -133,6 +140,7 @@ class ClampSide (Drawable):
self.draw_pawn ((-slot.x, slot.z), slot.pawn)
# Draw clamp.
if self.model.rotation is not None:
+ self.trans_push ()
self.trans_translate ((0, self.model.elevation))
m = TransMatrix ()
m.rotate (pi + self.model.rotation)
@@ -169,4 +177,13 @@ class ClampSide (Drawable):
self.draw_pawn ((lcenter, 0), self.model.load)
self.draw_rectangle ((lbase, 10), (lcenter - 103, 40), **attr)
self.draw_rectangle ((rbase, 10), (rtip, 40), **attr)
+ self.trans_pop ()
+ # Draw doors.
+ for slot in self.model.slots:
+ if slot.door_motor is not None:
+ self.trans_push ()
+ self.trans_translate ((-slot.x, slot.z + 50))
+ self.trans_rotate (-0.5 * pi + slot.door_motor.angle)
+ self.draw_line ((0, 0), (40, 0))
+ self.trans_pop ()