diff options
author | echinelli <emilianochinelli@gmail.com> | 2010-12-11 16:11:12 (GMT) |
---|---|---|
committer | echinelli <emilianochinelli@gmail.com> | 2010-12-11 16:11:12 (GMT) |
commit | 389519ca3dc2fc2f8734701bea88fcf117431fc4 (patch) | |
tree | 8ab2653af07d879f045588121b87f8525004f81e | |
parent | 435b2794da0c41a56da67c9342e89d59ef8ac31d (diff) |
max quantity of items per selection implementation.
-rwxr-xr-x | Saludame.activity/menu.py | 5 | ||||
-rwxr-xr-x | Saludame.activity/menu_creator.py | 3 |
2 files changed, 6 insertions, 2 deletions
diff --git a/Saludame.activity/menu.py b/Saludame.activity/menu.py index 3ed67e5..816436d 100755 --- a/Saludame.activity/menu.py +++ b/Saludame.activity/menu.py @@ -13,9 +13,11 @@ from widget import Widget from window import Window import utilities import effects +import random SIZE = 600, 280 EXP_SPEED = 15 #expansion speed, in pixels per frame +MAX_ITEMS = 9 #max items quantity per selection CLOSE_MENU = "close_menu" BACK_MENU = "back_menu" @@ -105,6 +107,9 @@ class Menu(Window): """ if(not self.on_expansion): actual_selection = self.get_allowed_items(items_list) # gets some allowed items, fewer than nine + if len(actual_selection) > MAX_ITEMS: + actual_selection = random.sample(actual_selection, MAX_ITEMS) + self.actual_selection = actual_selection # self.on_expansion = True #if the selection changes, display the animation diff --git a/Saludame.activity/menu_creator.py b/Saludame.activity/menu_creator.py index e202cc5..846701d 100755 --- a/Saludame.activity/menu_creator.py +++ b/Saludame.activity/menu_creator.py @@ -42,8 +42,7 @@ example = [ (_("Leche chocolatada"), "assets/icons/icon.png", "leche_chocolatada", None), (_("Café con leche"), "assets/icons/icon.png", "leche_cafe", None), (_("Leche"), "assets/icons/icon.png", "leche", None), - (_("Leche con cereales"), "assets/icons/icon.png", "leche_cereales", None), - + (_("Leche con cereales"), "assets/icons/icon.png", "leche_cereales", None) ]), (_("Líquidos..."), "assets/icons/icon_parent.png", None, [ |