comparison gamelib/hand.py @ 44:79062a225703

Correct out-by-one indentation error. :)
author Simon Cross <simon@simonx>
date Mon, 23 Aug 2010 10:35:53 +0200
parents 31a431f795e1
children 8771d545a493
comparison
equal deleted inserted replaced
43:7517a3cc06e7 44:79062a225703
4 from albow.resource import get_image 4 from albow.resource import get_image
5 from albow.utils import frame_rect 5 from albow.utils import frame_rect
6 from pygame.color import Color 6 from pygame.color import Color
7 7
8 class HandButton(ImageButton): 8 class HandButton(ImageButton):
9 """The fancy hand button for the widget""" 9 """The fancy hand button for the widget"""
10 10
11 sel_colour = Color('red') 11 sel_colour = Color('red')
12 sel_width = 2 12 sel_width = 2
13 13
14 def __init__(self, action): 14 def __init__(self, action):
15 # FIXME: Yes, please. 15 # FIXME: Yes, please.
16 this_image = get_image('items', 'square.png') 16 this_image = get_image('items', 'square.png')
17 ImageButton.__init__(self, image=this_image, action=action) 17 ImageButton.__init__(self, image=this_image, action=action)
18 self.selected = False # Flag if we're selected 18 self.selected = False # Flag if we're selected
19 19
20 def draw(self, surface): 20 def draw(self, surface):
21 """Draw the widget""" 21 """Draw the widget"""
22 print 'drawing widget', self.selected 22 print 'drawing widget', self.selected
23 ImageButton.draw(self, surface) 23 ImageButton.draw(self, surface)
24 if self.selected: 24 if self.selected:
25 rect = surface.get_rect().inflate(-self.sel_width, -self.sel_width) 25 rect = surface.get_rect().inflate(-self.sel_width, -self.sel_width)
26 frame_rect(surface, self.sel_colour, rect, self.sel_width) 26 frame_rect(surface, self.sel_colour, rect, self.sel_width)
27 27
28 def toggle_selected(self): 28 def toggle_selected(self):
29 self.selected = not self.selected 29 self.selected = not self.selected
30 30
31 def unselect(self): 31 def unselect(self):
32 self.selected = False 32 self.selected = False
33 33