Esempio n. 1
0
def render_menu(user):
    ''' Function to display menu on screen ''' 
    dirs = read_directories(DEFAULT_IMAGE_DIR)
    background = get_path(IMG_BACKGROUND, dirs)

    menu = MenuActionHandler(bg_filename = background)
    menu.set_user(user)
    ''' define menus '''
    main_menu = { 
                    "menu": GAME_MENU_ITEMS,
                    "font1": menu.font1,
                    "pos": MenuActionHandler.CENTER_POSITION,
                    "color1": (240,230,140), 
                    "light": 5,
                    "speed": 200,
                    "lag": 20,
                    "interline" : 0
                    }
    ''' define store menu '''
    store_menu = { 
                  "menu": PRODUCTS,
                  "font1": menu.font1,
                  "font2": menu.font1,
                  "pos":  MenuActionHandler.CENTER_POSITION,
                  "color1": (240,230,140),
                  "light": 5,
                  "speed": 200,
                  "lag": 20,
                  "interline" : 0
                  }
    ''' define wallet submenu '''
    wallet_menu = { 
                  "menu": ["BUY 100 coins", "BACK"],
                  "font1": menu.font1,
                  "font2": menu.font1,
                  "pos":  MenuActionHandler.CENTER_POSITION,
                  "color1": (240,230,140),
                  "light": 5,
                  "speed": 200,
                  "lag": 20,
                  "interline" : 0
                  }
    ''' set menus '''
    menus = [main_menu, store_menu, wallet_menu]
    menu.add_menu(menus)
    ''' set action for each menu item '''
    menu.set_action(MenuActionHandler.ACTION_PLAY, 
                    package="lunar",
                    clazz="MoonLander")
    ''' render menu on screen '''
    menu.show()
Esempio n. 2
0
 def _get_db(self, name):
     dirs = read_directories(DBBase.DB_DIR)
     self.db_name = get_path(name, dirs)
     return self.db_name