added tooltips for all the other tools
[tabakrolletjie.git] / tabakrolletjie / scenes / night.py
index 9f86745a052aa142acb72654a6519b3a44bf9cc9..5d55231808cb99db92afc3752abbc5d1eefd1f26 100644 (file)
@@ -17,7 +17,7 @@ from ..loader import loader
 from ..sound import sound
 from ..transforms import Overlay
 from ..turnip import Turnip
-from ..widgets import ImageButton
+from ..widgets import ImageButton, Tooltip
 from ..constants import (
     NIGHT_LENGTH, NIGHT_HOURS_PER_TICK, DEBUG, FONTS,
     SCREEN_SIZE, FPS)
@@ -54,18 +54,16 @@ class NightScene(BaseScene):
     def create_tools(self, gamestate):
         tools = []
         y = SCREEN_SIZE[1] - 40
+        tools.append(ImageButton(
+            '32', 'day.png', name='day', pos=(SCREEN_SIZE[0] - 200, y), tooltip=Tooltip(["Skip to day"])))
         tools.append(ImageButton(
             '32', 'pause.png', name='pause play',
-            pos=(SCREEN_SIZE[0] - 150, y)))
+            pos=(SCREEN_SIZE[0] - 150, y), tooltip=Tooltip(["Pause"])))
         tools.append(ImageButton(
-            '32', 'exit.png', name='exit', pos=(SCREEN_SIZE[0] - 50, y)))
+            '32', 'exit.png', name='exit', pos=(SCREEN_SIZE[0] - 50, y), tooltip=Tooltip(["Exit"])))
+        tools[0].disable()
         return tools
 
-    def add_day_button(self):
-        y = SCREEN_SIZE[1] - 40
-        self._tools.append(ImageButton(
-            '32', 'day.png', name='day', pos=(SCREEN_SIZE[0] - 200, y)))
-
     @property
     def turnip_count(self):
         return len(self._turnips)
@@ -144,9 +142,11 @@ class NightScene(BaseScene):
     def toggle_pause(self):
         self._paused = not self._paused
         pause_img = "play.png" if self._paused else "pause.png"
+        pause_text = "Play" if self._paused else "Pause"
         for tool in self._tools:
             if tool.name == 'pause play':
                 tool.update_image("32", pause_img)
+                tool.tooltip = Tooltip([pause_text])
 
     def _to_day(self, gamestate):
         # End the night
@@ -204,7 +204,7 @@ class NightScene(BaseScene):
             if not self._mould.alive():
                 self._end_night()
             if not self.turnip_count:
-                self.add_day_button()
+                self._tools[0].enable()
             if not self.turnip_count and not self._battery.current:
                 self._end_night()