From: Jeremy Thurgood Date: Wed, 14 May 2014 21:07:27 +0000 (+0200) Subject: Parameterised action text. X-Git-Tag: 0.1~296 X-Git-Url: https://git.ctpug.org.za/?a=commitdiff_plain;h=00bdc8cec84b91a3a76bf946bc4764e8cb96fded;p=naja.git Parameterised action text. --- diff --git a/naja/actions.py b/naja/actions.py index 9c4e8f3..7d5be63 100644 --- a/naja/actions.py +++ b/naja/actions.py @@ -17,6 +17,9 @@ class LocationAction(object): self.required_bits = frozenset(bits) self.data = data + def get_text(self): + return self.TEXT % self.data + def check_available(self, player): return player.bits.check_bits(self.required_bits) @@ -99,8 +102,7 @@ class GainHealthAndClearBitsOrMSB(LocationAction): class ShiftLocations(LocationAction): - # TODO: Direction parameter in TEXT. - TEXT = "Shift board locations." + TEXT = "Shift board locations %(direction)s." def perform_action(self, board, location): board.shift_locations(self.data['direction']) diff --git a/naja/widgets/info_area.py b/naja/widgets/info_area.py index 8399882..d7ad07d 100644 --- a/naja/widgets/info_area.py +++ b/naja/widgets/info_area.py @@ -76,7 +76,7 @@ class InfoAreaWidget(Widget): self.surface.blit(img, (0, y_offset)) y_offset += 8 text = TextBoxWidget( - (12, y_offset), action.TEXT, + (12, y_offset), action.get_text(), box_width=(INFO_SIZE[0] - 12) // EIGHT_BIT_SCALE, fontsize=28) text.render(self.surface)