comparison tools/area_editor.py @ 425:1a85044f81a8

Safer color access
author Neil Muller <drnlmuller@gmail.com>
date Sat, 07 Sep 2013 13:34:01 +0200
parents a64d894aa1bd
children 275e0b4bd571
comparison
equal deleted inserted replaced
424:a64d894aa1bd 425:1a85044f81a8
119 self._draw_background(True) 119 self._draw_background(True)
120 # Draw polygons as needed for the editor 120 # Draw polygons as needed for the editor
121 if filled: 121 if filled:
122 self._draw_exterior(True) 122 self._draw_exterior(True)
123 for index, polygon in self.polygons.items(): 123 for index, polygon in self.polygons.items():
124 color = POLY_COLORS[index] 124 color = POLY_COLORS.get(index, pygame.color.THECOLORS['black'])
125 if move_point_mode and index == self._move_poly: 125 if move_point_mode and index == self._move_poly:
126 pointlist = [p for p in polygon] 126 pointlist = [p for p in polygon]
127 pointlist = [self.point_to_pygame(p) if p != move_point else 127 pointlist = [self.point_to_pygame(p) if p != move_point else
128 mouse_pos for p in pointlist] 128 mouse_pos for p in pointlist]
129 pygame.draw.lines(self._surface, color, False, pointlist, 2) 129 pygame.draw.lines(self._surface, color, False, pointlist, 2)