Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PagedMenu select_callback raises AttributeError #71

Closed
thetredev opened this issue Sep 18, 2015 · 1 comment
Closed

PagedMenu select_callback raises AttributeError #71

thetredev opened this issue Sep 18, 2015 · 1 comment
Labels

Comments

@thetredev
Copy link
Contributor

This code:

from players.entity import PlayerEntity

player_models = dict()


def menu_callback(menu, index, option):
    """Called by a player selecting an option from the Models menu."""
    # Get a PlayerEntity instance
    player = PlayerEntity(index)

    # Tell what's happened
    player.say('model changed to {0}'.format(option.value.name))

    # Save what has been chosen
    player_models[player.userid] = option.value

    # Is the player alive and on a team?
    if not player.isdead and not player.dead_flag and player.team > 1:

        # If yes, change their model to the one chosen
        player.model = option.value.path


class _Models(dict):

    """Extends dict to map models to Model instances by their basenames."""

    def __init__(self):
        """Called on instantiation."""
        # Call dict's constructor
        super(_Models, self).__init__()

        # Create a PagedMenu instance
        self._menu = PagedMenu(
            select_callback=menu_callback,
            title='{0}: Models'.format(info.name),
            description='Choose a model below.'
        )

        # .........

raises the error as soon as I choose the first option I get when the menu is sent to me.
attrib error

@Ayuto
Copy link
Member

Ayuto commented Sep 18, 2015

Thanks for reporting! That issue should be solved.

@Ayuto Ayuto closed this as completed Sep 18, 2015
@Ayuto Ayuto added the bug label Sep 18, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants