From 30e18ea544db889931a957e87e3e32c318180060 Mon Sep 17 00:00:00 2001 From: "Paul S. Ferrell" Date: Thu, 8 Oct 2009 09:12:41 -0600 Subject: [PATCH] Fixed type error, made results rows keyed by color. --- tanks/lib/Pflanzarr.py | 11 ++++++++--- tanks/lib/Tank.py | 10 +++++----- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/tanks/lib/Pflanzarr.py b/tanks/lib/Pflanzarr.py index 0922d49..1eaa501 100644 --- a/tanks/lib/Pflanzarr.py +++ b/tanks/lib/Pflanzarr.py @@ -205,12 +205,17 @@ class Pflanzarr: '
TeamKillsCause of Death'] for tank in tanks: if tank is winner: - rowStyle = 'style="color:red;"' + rowStyle = 'style="font-weight:bold; '\ + 'background-color:%s"' % tank._color else: - rowStyle = '' + rowStyle = 'style="background-color:%s"' % tank._color + if name: + name = xml.sax.saxutils.escape(tank.name) + else: + name = '#default' html.append('
%s%d%s' % (rowStyle, - xml.sax.saxutils.escape(tank.name), + name, len(kills[tank]), xml.sax.saxutils.escape(tank.deathReason))) diff --git a/tanks/lib/Tank.py b/tanks/lib/Tank.py index dffa85e..7042a59 100644 --- a/tanks/lib/Tank.py +++ b/tanks/lib/Tank.py @@ -75,7 +75,7 @@ class Tank(object): else: self._tAngle = tAngle - self._color = color + self.color = color # You can't fire until fireReady is 0. self._fireReady = self.FIRE_RATE @@ -466,7 +466,7 @@ class Tank(object): # The base body rectangle. for poly in gm.displacePoly(hood, self.pos, self._limits): - d.polygon( poly, fill=self._color ) + d.polygon( poly, fill=self.color ) # The treads for poly in gm.displacePoly(tread1, self.pos, self._limits) + \ @@ -475,7 +475,7 @@ class Tank(object): # The turret circle for poly in gm.displacePoly(self.body, self.pos, self._limits): - d.ellipse( poly, fill=self._color, outline='black') + d.ellipse( poly, fill=self.color, outline='black') self._drawLaser(d) @@ -491,7 +491,7 @@ class Tank(object): if self._fired: laser = gm.rotatePoly( self.laser, self._angle + self._tAngle ) for poly in gm.displacePoly(laser, self.pos, self._limits): - drawing.polygon(poly, fill=self._color) + drawing.polygon(poly, fill=self.color) self._fired = False @@ -522,7 +522,7 @@ class Tank(object): if self._sensorState[i]: color = '#000000' else: - color = self._color + color = self.color r, angle, width, tAttached = self._sensors[i] r = int(r)