Add (ugly) countdown timer to tile.
[naja.git] / naja / widgets / tile.py
index 5417dcf3ba3e4e8960c829d76dc8e7c4353a09cf..344a924ae27b0dcb99546b6e38d02a77b82aaa92 100644 (file)
@@ -6,6 +6,7 @@ from naja.constants import (
 from naja.resources import resources
 from naja.resources.mutators import EIGHT_BIT, blender
 from naja.widgets.base import Widget
+from naja.widgets.text import TextBoxWidget
 
 
 BIT_MAP = {
@@ -74,6 +75,15 @@ class TileWidget(Widget):
         for action in card.actions:
             y_offset = self._prepare_action(action, y_offset)
 
+        if card.replacement_time is not None:
+            timestr = str(card.replacement_time)
+            if len(timestr) > 1:
+                timestr = '+'
+            countdown_text = TextBoxWidget(
+                (TILE_SIZE[0] - 24, 4), timestr, padding=2,
+                colour=PALETTE.PINK, bg_colour=PALETTE.DARK_RED)
+            countdown_text.render(self.surface)
+
     def _prepare_lock(self, action, y_offset):
         if not action.required_bits:
             return 4