From 64e6d0971cefa7a950e89ebf2be89187abeb2609 Mon Sep 17 00:00:00 2001 From: dmazzone Date: Mon, 04 Oct 2010 16:40:33 +0000 Subject: Merge branch 'master' of git://git.sugarlabs.org/saludame/mainline into windows_controller Conflicts : Saludame.activity/window.py Si bien tendría que haber hecho el merge del windows_controller al master, eran tantos los cambios en el windows_controller y tan pocos en el master que convenía hacerlo así. Ahora veo como hacer un merge con el master. --- diff --git a/Saludame.activity/actions.py b/Saludame.activity/actions.py new file mode 100644 index 0000000..6fe0efd --- /dev/null +++ b/Saludame.activity/actions.py @@ -0,0 +1,75 @@ +# -*- coding: utf-8 -*- + +import status_bars +import events + +class Action: + + def __init__(self, icon, picture, appereance_probability, time_span, kid_animation, window_animation, sound, effect): + self.appereance_probability = appereance_probability + self.time_span = time_span + + self.effect = effect + """ animations """ + self.icon = icon + self.picture = picture + + self.kid_animation_path = kid_animation.path + self.kid_loop_times = kid_animation.loop_times + self.kid_frame_rate = kid_animation.frame_rate + + self.window_animation_path = window_animation.path + self.window_window_loop_times = window_animation.loop_times + self.window_frame_rate = window_animation.frame_rate + + self.sound_path = sound.path + self.sound_loop_times = sound.loop_times + + def performance(self): + self.effect.activate() + +class Character: + + def __init__(self, name, level, score, hair_color, eyes_color, skin_color, shoes_color, status_bar_dictionary): + self.name = name + self.level = level + self.score = score + """ visuals """ + self.hair_color = hair_color + self.eyes_color = eyes_color + self.skin_color = skin_color + self.shoes_color = shoes_color + """ """ + self.status_bar_dictionary = status_bar_dictionary #status bars {string id: Bar bar} + self.active_events_list = [] + + self.mood_list = [] #Class Mood instance's list + +class Mood: + + def _init__(self, name, kid_animation): + self.kid_animation_path = kid_animation.path + self.kid_frame_rate = kid_animation.frame_rate + +class Effect: + + def __init__(self, effect_status_list): + self.effect_status_list = effect_status_list + + def add_effect(self, effect_status): + self.effect_status_list.append(effect_status) + + def activate(self): + for effect in self.effect_status_list: + effect.activate() + +class EffectStatus: + """ + Abstract class ? + """ + def __init__(self, increase_rate): + self.increase_rate = increase_rate + + def activate(self, status_bar): + status_bar.increase(self.increase_rate) + diff --git a/Saludame.activity/activity.py b/Saludame.activity/activity.py index 3bfc4ac..7013934 100755 --- a/Saludame.activity/activity.py +++ b/Saludame.activity/activity.py @@ -43,8 +43,16 @@ class SaludameActivity(Activity): # Create the canvas to embbed pygame self.pygame_canvas = PygameCanvas(self, False) - self.set_canvas(self.pygame_canvas) - self.show_all() + self.credits = credits.Credits() + + self.items = gtk.HBox() + self.items.add(self.pygame_canvas) + self.items.add(self.credits) + + self.set_canvas(self.items) + self.pygame_canvas.show() + self.items.show() + self.show() # Start pygame self.pygame_canvas.run_pygame(lambda:game.Main().main(True)) # Indico que llame a la función local para iniciar el juego pygame @@ -55,15 +63,15 @@ class SaludameActivity(Activity): def change_mode(self, notebook, index): if index == 0: game.pause = True - self.set_canvas(self.pygame_canvas) + #self.set_canvas(self.pygame_canvas) + self.pygame_canvas.hide() if index == 1: game.pause = False - self.set_canvas(self.pygame_canvas) - + self.pygame_canvas.show() + if index == 2: - game.pause == True - self.credits = credits.Credits() - self.credits.show_all() - self.set_canvas(self.credits) - \ No newline at end of file + game.pause = True + self.pygame_canvas.hide() + self.credits.show() + \ No newline at end of file diff --git a/Saludame.activity/events.py b/Saludame.activity/events.py new file mode 100644 index 0000000..e5314b0 --- /dev/null +++ b/Saludame.activity/events.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- + +import actions + +class Event: + + def __init__(self, picture, appereance_probability, time_span, kind, event_status, effect): + self.appereance_probability = appereance_probability + self.time_span = time_span + + self.event_status = event_status #instance EventStatusProbability + + self.picture = picture + self.kind = kind + + self.effect = effect + +class EventStatusProbability: + + def __init__(self, conditioned_probability, direct_indirect): + self.conditioned_probability = conditioned_probability + self.direct_indirect = direct_indirect diff --git a/Saludame.activity/game.py b/Saludame.activity/game.py index e4c8bce..6c21bbc 100755 --- a/Saludame.activity/game.py +++ b/Saludame.activity/game.py @@ -25,13 +25,13 @@ class Main(): def __init__(self): self.windows_controller = WindowsController() - def main(self, fromSugar): + def main(self, from_sugar): """Main function of the game. This function initializes the game and enters the PyGame main loop. """ - if fromSugar: + if from_sugar: import gtk # Optimizes sound quality and buffer for quick loading @@ -42,7 +42,7 @@ class Main(): target_size = (1200, 780) - if not fromSugar: + if not from_sugar: screen = pygame.display.set_mode(target_size) screen = pygame.display.get_surface() @@ -82,24 +82,23 @@ class Main(): while running: - if fromSugar: + if from_sugar: # Pump GTK messages. while gtk.events_pending(): gtk.main_iteration() - # Waits for events, if none the game pauses: - # http://wiki.laptop.org/go/Game_development_HOWTO#Reducing_CPU_Load - milliseconds = clock.tick(MAX_FPS) # waits if the game is running faster than MAX_FPS - - events = pygame.event.get() - if not pause: + # Waits for events, if none the game pauses: + # http://wiki.laptop.org/go/Game_development_HOWTO#Reducing_CPU_Load + milliseconds = clock.tick(MAX_FPS) # waits if the game is running faster than MAX_FPS + + events = pygame.event.get() if events: for event in events: if event.type == pygame.QUIT: running = False - elif event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE: + elif event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE and not from_sugar: running = False elif event.type == pygame.MOUSEBUTTONDOWN: self.windows_controller.handle_mouse_down(pygame.mouse.get_pos()) diff --git a/Saludame.activity/po/POTFILES.in b/Saludame.activity/po/POTFILES.in new file mode 100755 index 0000000..2107e59 --- /dev/null +++ b/Saludame.activity/po/POTFILES.in @@ -0,0 +1,12 @@ +encoding: UTF-8 + +activity.py +game.py +animation.py +window.py +activity.py +menu.py +customization.py +utilities.py +windowsController.py +challenges.py diff --git a/Saludame.activity/po/es.po b/Saludame.activity/po/es.po new file mode 100755 index 0000000..a07bc0f --- /dev/null +++ b/Saludame.activity/po/es.po @@ -0,0 +1,33 @@ +# Spanish translations for PACKAGE package. +# Copyright (C) 2010 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Pablo Moleri , 2010. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-09-30 18:05-0300\n" +"PO-Revision-Date: 2010-09-30 18:44-0300\n" +"Last-Translator: Pablo Moleri \n" +"Language-Team: Spanish\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: activity/activity.info:2 +msgid "Saludame" +msgstr "Salúdame" + +#: /home/pmoleri/saludame/Saludame.activity/customization.py:20 +msgid "Shoes" +msgstr "Zapatos" + +#: /home/pmoleri/saludame/Saludame.activity/activity.py:29 +msgid "Game" +msgstr "Juego" + +#: /home/pmoleri/saludame/Saludame.activity/activity.py:33 +msgid "Credits" +msgstr "Créditos" diff --git a/Saludame.activity/status_bars.py b/Saludame.activity/status_bars.py index b160b8d..5c2ac98 100755 --- a/Saludame.activity/status_bars.py +++ b/Saludame.activity/status_bars.py @@ -6,46 +6,46 @@ import pygame ****************** VISUALES ****************** """ class BarsWindow(): - + """ + Clase que representa la ventana de las barras de estado del juego. + """ def __init__(self, position, frame_rate, background_color): - self.frame_rate = frame_rate - - #rect and surface: - self.rect = pygame.Rect(position, (400, 501)) + """ visual constant """ + self.max_bar_qty = 7 + self.px_per_bar = 26 + self.px_per_section = 50 + self.px_expanded = self.max_bar_qty * self.px_per_bar + 2 + self.qty_section = 50 + """ rect and surface: """ + self.rect = pygame.Rect(position, (400, 484)) self.surface = pygame.Surface(self.rect.size) self.background_color = background_color self.surface.fill(self.background_color) - #bars + """ game bars """ loader = BarsLoader() - self.bars = loader.create_bars(Bar("main_bar", "overall", None, [], 100, 50)) + self.bars = loader.create_bars(StatusBar("main_bar", "overall", None, [], 100, 50)) - #sections: - self.physica_section = BarSection("physica", self.bars[0], self.bars[0].children_list, (398, 68), (1, 90)) - self.fun_section = BarSection("fun", self.bars[3], self.bars[3].children_list, (398, 73), (1, 159)) - self.hygiene_section = BarSection("hygiene", self.bars[1], self.bars[1].children_list, (398, 94), (1, 233)) - self.nutrition_section = BarSection("nutrition", self.bars[2], self.bars[2].children_list, (398, 172), (1, 328)) - self.overall_section = BarSection("Estado general", self.bars[4], [] , (398, 37), (1, 52)) - self.score_section = ScoreSection(Bar("score_bar", "score", None, self.bars[4], 100, 15), (398, 50), (1, 1), 1) + """ sections """ + self.score_section = ScoreSection(StatusBar("score_bar", "score", None, self.bars[4], 100, 15), (398, 50), (1, 1), 1) + self.overall_section = BarSection("Estado general", self.bars[4], [] , (398, 37), (1, 52), self.px_expanded) - self.sections_list = [self.score_section, self.physica_section, self.fun_section, self.hygiene_section, self.nutrition_section, self.overall_section] + self.physica_section = BarSection("physica", self.bars[0], self.bars[0].children_list, (398, self.px_per_section), (1, 90), self.px_expanded) + self.fun_section = BarSection("fun", self.bars[3], self.bars[3].children_list, (398, self.px_per_section), (1, 142), self.px_expanded) + self.hygiene_section = BarSection("hygiene", self.bars[1], self.bars[1].children_list, (398, self.px_per_section), (1, 194), self.px_expanded) + self.nutrition_section = BarSection("nutrition", self.bars[2], self.bars[2].children_list, (398, self.px_per_section), (1, 246), self.px_expanded) + self.sections_list = [self.score_section, self.physica_section, self.fun_section, self.hygiene_section, self.nutrition_section, self.overall_section] + self.accordeon = Accordeon([self.physica_section, self.fun_section, self.hygiene_section, self.nutrition_section], self.px_per_bar, self.px_per_section, self.px_expanded) + """ """ - def draw(self, screen): self.surface.fill(self.background_color) - screen.blit(self.surface, self.rect) - changes = [] - changes += self.physica_section.draw(self.surface) - changes += self.hygiene_section.draw(self.surface) - changes += self.fun_section.draw(self.surface) - changes += self.nutrition_section.draw(self.surface) - changes += self.overall_section.draw(self.surface) - changes += self.score_section.draw(self.surface) - changes += [self.rect] - + for section in self.sections_list: + changes += section.draw(self.surface) + screen.blit(self.surface, self.rect) return changes @@ -57,109 +57,248 @@ class BarsWindow(): return def on_mouse_click(self, (x, y)): - for section in self.sections_list: + + for section in self.accordeon.sections_list: if(section.rect.collidepoint((x, y))): - section.on_mouse_click((x, y)) + if(not section.expanded): + self.accordeon.expand_section(section) + + def __relative_pos(self, (x, y)): + return (x + self.rect.left, y + self.rect.top) -class ScoreSection: +class Accordeon: + """ + Clase encargada de realizar los calculos para expandir y + contraer las secciones. + """ - def __init__(self, bar, size, position, level): - self.name = "score section" - self.score_bar = bar - self.score_bar_display = BarDisplay(26, (size[0] - 2), (1, (size[1] / 2) - 3), self.score_bar) - self.rect = pygame.Rect(position, size) - self.surface = pygame.Surface(self.rect.size) - self.surface.fill((2, 45, 126)) - #level: - self.level = level - self.font = pygame.font.Font(None, 20) - - - - def draw(self, screen): - #draw bar: - self.score_bar_display.draw(self.surface) - - #write actual level: - level_text = "Nivel: " + str(self.level) - - self.surface.blit(self.font.render(level_text, 1, (255, 0, 0)), (2, 5)) - - screen.blit(self.surface, self.rect) - return [self.rect] - + def __init__(self, sections_list, px_per_bar, px_per_section, px_expanded): + self.sections_list = sections_list #secciones sobre las que se realizarán los cambios + """ + Las secciones deben estar ordenadas de arriba abajo, según se muestren + en la pantalla. + """ + self.px_per_section = px_per_section #cantidad mínima de pixeles por sección + self.px_expanded = px_expanded #cantidad que se suma a la cantidad mínima de pixeles por sección + self.expand_section(self.sections_list[-1]) #inicialmente expande la última sección + + def expand_section(self, section): + """ + Espande la sección 'section' y re calcula la + posición del resto de las secciones. + """ + self.__compress_sections() + for i in range(0, len(self.sections_list)): + if(self.sections_list[i] == section): + if(i + 1 < len(self.sections_list)): + for j in range(i + 1, len(self.sections_list)): + self.sections_list[j].move_down() + self.sections_list[i].expand() + break + + def __compress_sections(self): + """ + Comprime todas las secciones y las localiza + en su posición inicial. + """ + for i in range(0, len(self.sections_list)): + if(self.sections_list[i].expanded): + self.sections_list[i].compress() + if(i + 1 < len(self.sections_list)): + for j in range(i + 1, len(self.sections_list)): #move up the displays under the expanded one + self.sections_list[j].move_up() + break class BarSection: + """ + Clase que contiene un conjunto de BarDisplay, y las + muestra por pantalla + """ - def __init__(self, name, root_bar, children_bar, size, position): + def __init__(self, name, root_bar, children_bar, size, position, max_expand): + """ section attributes """ self.name = name self.root_bar = root_bar - self.root_bar_display = BarDisplay(26, (size[0] - 2), (1, (size[1] / 2) - 13), self.root_bar) self.children_bar = children_bar self.rect = pygame.Rect(position, size) + + """ visuals """ self.surface = pygame.Surface(self.rect.size) - self.surface.fill((2, 45, 126)) - self.displays_list = self.__calculate(children_bar) - self.selected = False #Este flag se activa cuando se están mostrando las sub-barras + self.root_bar_display = BarDisplay(26, (size[0] - 2), (1, (size[1] / 2) - 13), self.root_bar, pygame.Color("blue")) + self.displays_list = self.__get_displays() #obtengo los displays para cada barra. + self.surface.fill((2, 45, 126)) #back ground color + + """ visuals constant """ + self.init_top = position[1] + self.init_height = size[1] + self.max_expand = max_expand + """ """ + self.expanded = False #Este flag se activa cuando se están mostrando las sub-barras + self.__calculate() #calculo la posición de cada barra en la sección + + def expand(self): + """ + Expande la sección, y calcula la posición de las barras + """ + self.expanded = True + self.rect.height = self.init_height + self.max_expand + self.__set_surface(self.rect.size) + self.__calculate() + + def compress(self): + """ + Comprime la sección, y re calcula la posición de las barras + """ + self.expanded = False + self.rect.height = self.init_height #vuelve al tamaño inicial + self.rect.top = self.init_top + self.__set_surface(self.rect.size) + self.__calculate() + + def move_up(self): + """ + Desplaza la sección a su posición original. + """ + self.rect.top = self.init_top + self.__calculate() + + def move_down(self): + """ + Desplaza la sección desde su posición original a + la posición original más el número de expanción + máxima de una sección. + """ + self.rect.top = self.init_top + self.max_expand + self.__calculate() def draw(self, screen): changes = [] - if (self.selected and len(self.children_bar) > 0): + if (self.expanded and len(self.children_bar) > 0): + changes += self.root_bar_display.draw(self.surface) for bar_display in self.displays_list: changes += bar_display.draw(self.surface) else: changes += self.root_bar_display.draw(self.surface) screen.blit(self.surface, self.rect) - return changes + return changes - def __calculate(self, children_bar): - qty = len(children_bar) - if(qty == 0): - qty = 1 - bar_height = int((self.rect.height / qty) - 2) - bar_width = int(self.rect.width - 2) + def __calculate(self): + """ + Calcula la posición de cada barra + dependiendo de si está expandida o no la sección. + """ + qty = len(self.displays_list) + if(self.expanded): + if(qty == 0): + qty = 1 + bar_height = 26 + + y = 50 + for display in self.displays_list: + display.rect.top = y + y += (bar_height + 1) + else: + for display in self.displays_list: + display.rect.top = 1 + + def __get_displays(self): + """ + Crea un BarDisplay para cada barra hija de la sección. + Y retorna una lista con los mismos. + """ display_list = [] - - y = int(self.rect.height / bar_height) # margen vertical - for status_bar in children_bar: - display = BarDisplay(bar_height, bar_width, (1, y), status_bar) + bar_height = 26 + color = pygame.Color(25, 255, 25, 1) #carga las barras hijas con el color verde por defecto. + for status_bar in self.children_bar: + display = BarDisplay(bar_height, 393, (1, 1), status_bar, color) display_list.append(display) - y += (bar_height + 1) - return display_list - def on_mouse_click(self, (x, y)): - self.selected = not self.selected + def __set_surface(self, size): + self.surface = pygame.Surface(size) + self.surface.fill((2, 45, 126)) + + + def __relative_pos(self, (x, y)): + return (x + self.rect.left, y + self.rect.top) class BarDisplay: + """ + Clase que se encarga de representar visualmente a una barra, manteniéndose + actualizada según los incrementos o decrementos de la barra representada. + """ - def __init__(self, height, width, position, status_bar): - self.label = status_bar.label + def __init__(self, height, width, position, status_bar, color): + """ attributes """ self.status_bar = status_bar + self.label = status_bar.label + self.color = color self.rect = pygame.Rect(position, (width, height)) self.position = position - self.color = pygame.Color(0, 255, 0, 1) + """ visuals """ self.surface = pygame.Surface(self.rect.size) self.font = pygame.font.Font(None, 20) + """ """ + self.last_value = self.status_bar.value #valor inicial + self.charge = pygame.Rect((1, 2), (((self.rect.width - 2) * self.last_value / self.status_bar.max, self.rect.height - 4))) def draw(self, screen): - - charge = pygame.Rect((1, 2), (self.rect.width - 2, self.rect.height - 4)) - charge.width = self.status_bar.value * self.rect.width / self.status_bar.max - charge_surface = pygame.Surface(charge.size) - charge_surface.fill(pygame.Color("blue")) + if(self.last_value != self.status_bar.value): + self.charge = pygame.Rect((1, 2), (self.rect.width - 2, self.rect.height - 4)) + self.charge.width = self.status_bar.value * self.rect.width / self.status_bar.max + + charge_surface = pygame.Surface(self.charge.size) + charge_surface.fill(self.color) self.surface.fill(pygame.Color("black")) - self.surface.blit(charge_surface, charge) - - self.surface.blit(self.font.render(self.label, 1, (255, 0, 0)), (2, 5)) + self.surface.blit(charge_surface, self.charge) + self.surface.blit(self.font.render(self.label, 1, (0, 0, 0)), (2, 5)) screen.blit(self.surface, self.rect) return [self.rect] + def __relative_pos(self, (x, y)): + #(x + self.rect.left, y + self.rect.top) + return (x + self.rect.left, y + self.rect.top) + + +class ScoreSection: + """ + Sección que muestra la barra de puntaje principal. + """ + def __init__(self, bar, size, position, level): + """ attributes """ + self.name = "score section" + self.score_bar = bar + self.level = level + self.rect = pygame.Rect(position, size) + """ visuals """ + self.score_bar_display = BarDisplay(26, (size[0] - 2), (1, (size[1] / 2) - 3), self.score_bar, pygame.Color("blue")) + self.surface = pygame.Surface(self.rect.size) + self.surface.fill((2, 45, 126)) + self.font = pygame.font.Font(None, 20) + + + + def draw(self, screen): + #draw bar: + self.score_bar_display.draw(self.surface) + + #write actual level: + level_text = "Nivel: " + str(self.level) + + self.surface.blit(self.font.render(level_text, 1, (255, 255, 255)), (2, 5)) + + screen.blit(self.surface, self.rect) + return [self.rect] + + def __relative_pos(self, (x, y)): + #(x + self.rect.left, y + self.rect.top) + return (x + self.rect.left, y + self.rect.top) + """ ****************** MODELOS ****************** """ @@ -170,7 +309,6 @@ class BarsController: a una barra especifica """ def __init__(self): - #self.main_bar = StatusBar("main_bar", None, [], 100, 50) self.second_level_bar = BarsLoader.create_bars() self.main_bar.children_list = self.second_level_bar third_level_bar = [] @@ -183,12 +321,13 @@ class BarsController: def decrease_bar(self, id, value): return -class Bar: +class StatusBar: """ Entity that represent the bar """ def __init__(self, id, label, parent_bar, children_list, max_value, init_value): + """ attributes """ self.id = id self.label = label self.max = max_value @@ -272,27 +411,27 @@ class BarsLoader: """'hard_level' para plasmar que la idea es que los valores por defecto de las barras se carguen según un nivel de dificultad""" """ physica """ - physica_children_id = ["energy", "resistencia", "fat"] - physica = Bar("physica", "Physica", main_bar, [], hard_level[0], hard_level[1]) - physica_children_bar = [Bar(id, id, physica, [], hard_level[0], hard_level[1]) for id in physica_children_id] + physica_children_id = ["Energy", "Resistencia", "Fat"] + physica = StatusBar("physica", "Physica", main_bar, [], hard_level[0], hard_level[1]) + physica_children_bar = [StatusBar(id, id, physica, [], hard_level[0], hard_level[1]) for id in physica_children_id] physica.children_list = physica_children_bar """ hygiene """ - hygiene_children_id = [("shower", "shower"), ("w_hands", "washing hands"), ("b_teeth", "brushing teeth"), ("toilet", "toilet")] - hygiene = Bar("hygiene", "Hygiene", main_bar, [], hard_level[0], hard_level[1]) - hygiene_children_bar = [Bar(id[0], id[1], hygiene, [], hard_level[0], hard_level[1]) for id in hygiene_children_id] + hygiene_children_id = [("shower", "Shower"), ("w_hands", "Washing hands"), ("b_teeth", "Brushing teeth"), ("toilet", "Toilet")] + hygiene = StatusBar("hygiene", "Hygiene", main_bar, [], hard_level[0], hard_level[1]) + hygiene_children_bar = [StatusBar(id[0], id[1], hygiene, [], hard_level[0], hard_level[1]) for id in hygiene_children_id] hygiene.children_list = hygiene_children_bar """ nutrition """ - nutrition_children_id = [("c_leguminosas", "cereales y leguminosas"), ("v_frutas", "verduras y frutas"), ("C_huevos", "carnes y huevos"), ("dulces", "dulces"), ("g_aceites", "grasas y aceites"), ("l_quesos", "leches y quesos"), ("agua", "agua")] - nutrition = Bar("nutrition", "Nutrition", main_bar, [], hard_level[0], hard_level[1]) - nutrition_children_bar = [Bar(id[0], id[1], nutrition, [], hard_level[0], hard_level[1]) for id in nutrition_children_id] + nutrition_children_id = [("c_leguminosas", "Cereales y leguminosas"), ("v_frutas", "Verduras y frutas"), ("C_huevos", "Carnes y huevos"), ("dulces", "Dulces"), ("g_aceites", "Grasas y aceites"), ("l_quesos", "Leches y quesos"), ("agua", "Agua")] + nutrition = StatusBar("nutrition", "Nutrition", main_bar, [], hard_level[0], hard_level[1]) + nutrition_children_bar = [StatusBar(id[0], id[1], nutrition, [], hard_level[0], hard_level[1]) for id in nutrition_children_id] nutrition.children_list = nutrition_children_bar """ fun """ - fun_children_id = ["sports", "playing", "relaxing"] - fun = Bar("fun", "Fun", main_bar, [], hard_level[0], hard_level[1]) - fun_children_bar = [Bar(id, id, fun, [], hard_level[0], hard_level[1]) for id in fun_children_id] + fun_children_id = ["Sports", "Playing", "Relaxing"] + fun = StatusBar("fun", "Fun", main_bar, [], hard_level[0], hard_level[1]) + fun_children_bar = [StatusBar(id, id, fun, [], hard_level[0], hard_level[1]) for id in fun_children_id] fun.children_list = fun_children_bar bars_list = [physica, hygiene, nutrition, fun, main_bar] @@ -301,3 +440,4 @@ class BarsLoader: return bars_list + diff --git a/Saludame.activity/window.py b/Saludame.activity/window.py index 3350810..299a304 100755 --- a/Saludame.activity/window.py +++ b/Saludame.activity/window.py @@ -146,9 +146,14 @@ class MainWindow(Window): self.windows = [] # Lista de ventanas que 'componen' la ventana principal +<<<<<<< HEAD #temporal para probar ActionWindow (se cargará el diccionario en un módulo aparte). self.animations_dic = {'eat_apple': (animation.Apple(pygame.Rect((210, 20), (150, 172)), 10), "Eating an apple!") } self.action_win = ActionWindow(container, pygame.Rect((0, 505), (600, 20)), 10, pygame.Surface((600, 200)), screen, windows_controller, self.animations_dic) +======= + self.status_bars = status_bars.BarsWindow((0, 0), 1, pygame.Color("gray")) + self.windows.append(self.status_bars) +>>>>>>> 73f0d4ce24750887870a439c77676d1efa9d84a4 self.windows.append(KidWindow(container, pygame.Rect((0, 0), (600, 500)), 1, screen, windows_controller)) #self.windows.append(animation.Apple(pygame.Rect((700, 90), (150, 172)), 10)) -- cgit v0.9.1