diff options
Diffstat (limited to 'Saludame.activity/main_window.py')
-rwxr-xr-x | Saludame.activity/main_window.py | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/Saludame.activity/main_window.py b/Saludame.activity/main_window.py index ef67e89..264f187 100755 --- a/Saludame.activity/main_window.py +++ b/Saludame.activity/main_window.py @@ -3,17 +3,17 @@ import pygame from gettext import gettext as _ -from window import * +import gui from panel_window import PanelWindow from kid_window import KidWindow import status_bars import animation import utilities -class MainWindow(Window): +class MainWindow(gui.Window): def __init__(self, container, rect, frame_rate, clock, windows_controller, cha_loader, bars_loader, game_man): - Window.__init__(self, container, rect, frame_rate, windows_controller, "main_window") + gui.Window.__init__(self, container, rect, frame_rate, windows_controller, "main_window") self.clock = clock self.cha_loader = cha_loader @@ -27,41 +27,37 @@ class MainWindow(Window): self.kidW = KidWindow(container, pygame.Rect((227, 0), (973, 609)), 1, windows_controller, game_man) self.windows.append(self.kidW) - #self.windows.append(animation.Apple(pygame.Rect((700, 90), (150, 172)), 10)) self.windows.append(animation.FPS(container, pygame.Rect((1150, 0), (50, 20)), 15, self.clock)) self.windows.append(status_bars.BarsWindow(container, pygame.Rect(0, 0, 227, 590), 5, windows_controller, bars_loader)) self.add_child(Clock(container, pygame.Rect(0, 528, 1, 1), 1, game_man)) - # Challenges - - challenges_button = ImageButton(self.rect, pygame.Rect((1120, 400), (60, 60)), 1, "challenges/trophy.png", self._cb_button_click_mc_challenges) + # Challenges + challenges_button = gui.ImageButton(self.rect, pygame.Rect((1120, 400), (60, 60)), 1, "challenges/trophy.png", self._cb_button_click_mc_challenges) challenges_button.set_tooltip(_("Multiple choice")) self.add_button(challenges_button) - challenges_button2 = ImageButton(self.rect, pygame.Rect((1120, 500), (60, 60)), 1, "challenges/trophy.png", self._cb_button_click_tf_challenges) + challenges_button2 = gui.ImageButton(self.rect, pygame.Rect((1120, 500), (60, 60)), 1, "challenges/trophy.png", self._cb_button_click_tf_challenges) challenges_button2.set_tooltip(_("True or false")) self.add_button(challenges_button2) - challenges_button3 = ImageButton(self.rect, pygame.Rect((1120, 300), (60, 60)), 1, "challenges/trophy.png", self._cb_button_click_master_challenge) + challenges_button3 = gui.ImageButton(self.rect, pygame.Rect((1120, 300), (60, 60)), 1, "challenges/trophy.png", self._cb_button_click_master_challenge) challenges_button3.set_tooltip(_("Master challenge")) self.add_button(challenges_button3) - challenges_button4 = ImageButton(self.rect, pygame.Rect((1120, 200), (60, 60)), 1, "challenges/trophy.png", self._cb_button_click_cooking_challenge) + challenges_button4 = gui.ImageButton(self.rect, pygame.Rect((1120, 200), (60, 60)), 1, "challenges/trophy.png", self._cb_button_click_cooking_challenge) challenges_button4.set_tooltip(_("Cooking")) self.add_button(challenges_button4) button_back = pygame.image.load("customization/customization_button.png").convert() - btn_reset = utilities.TextButton2(self.rect, pygame.Rect((1000, 20), (70, 30)), 1, _("Reset"), 30, (255, 255, 255), button_back, self._cb_reset_game) + btn_reset = gui.TextButton2(self.rect, pygame.Rect((1000, 20), (70, 30)), 1, _("Reset"), 30, (255, 255, 255), button_back, self._cb_reset_game) self.add_button(btn_reset) - #stop_animation_button = TextButton(self.rect, pygame.Rect((800, 550), (30, 30)), 1, "Stop animation", 38, (255, 0, 0), self._cb_button_click_stop_animation) - #self.add_button(stop_animation_button) - #btn_change_mood = ImageButton(self.rect, pygame.Rect((1120, 500), (60, 60)), 1, "assets/icons/change.png", self._cb_button_click_change_mood) + #btn_change_mood = gui.ImageButton(self.rect, pygame.Rect((1120, 500), (60, 60)), 1, "assets/icons/change.png", self._cb_button_click_change_mood) #self.add_button(btn_change_mood) - #### Callbacks #### + # Callbacks def _cb_button_click_mc_challenges(self, button): self.cha_loader.get_challenge("mc") self.windows_controller.set_active_window("mc_challenge_window") @@ -92,12 +88,12 @@ class MainWindow(Window): def _cb_reset_game(self, button): self.game_manager.reset_game() -class Clock(Widget): +class Clock(gui.Widget): def __init__(self, container, rect_in_container, frame_rate, game_manager): background = pygame.image.load("assets/layout/clock_background.png").convert() rect_in_container.size = background.get_size() - Widget.__init__(self, container, rect_in_container, frame_rate) + gui.Widget.__init__(self, container, rect_in_container, frame_rate) self.game_manager = game_manager self.background = background @@ -115,7 +111,7 @@ class Clock(Widget): self.frame = pygame.image.load(self.frame_paths[self.frame_index]).convert() def draw(self, screen): - change = Widget.draw(self, screen) + change = gui.Widget.draw(self, screen) if self.game_manager.hour <> self.frame_index: self.frame_index = self.game_manager.hour @@ -126,5 +122,3 @@ class Clock(Widget): screen.blit(self.frame, rect) return change - - |