From 00bdc8cec84b91a3a76bf946bc4764e8cb96fded Mon Sep 17 00:00:00 2001 From: Jeremy Thurgood Date: Wed, 14 May 2014 23:07:27 +0200 Subject: [PATCH] Parameterised action text. --- naja/actions.py | 6 ++++-- naja/widgets/info_area.py | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) 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) -- 2.34.1