e67dd04285be82f7d1a846ca81facd5c8df3e567
[mudpy.git] / mudpy / menu.py
1 """Utility functions for menu operation."""
2
3 # Copyright (c) 2019 mudpy authors. Permission to use, copy,
4 # modify, and distribute this software is granted under terms
5 # provided in the LICENSE file distributed with this software.
6
7
8 def activate_avatar_action(user):
9     """Activate the selected avatar in the activate_avatar state."""
10     return user.activate_avatar_by_index(int(user.choice) - 1)
11
12
13 def activate_avatar_action_a(user):
14     """Abort selection by doing nothing."""
15     return True
16
17
18 def activate_avatar_create(user):
19     """List available avatars as choices for the activate_avatar state."""
20     return dict(
21         [(str(x + 1), y) for x, y in enumerate(user.list_avatar_names())])
22
23
24 def checking_new_account_name_action_d(user):
25     """Destroy the new account because the user asked to disconnect."""
26     return user.account.destroy()
27
28
29 def checking_new_account_name_action_g(user):
30     """Destroy the new account, the user asked to go back to name entry."""
31     return user.account.destroy()