Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions addons/source-python/packages/source-python/menus/radio.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@
BUTTON_BACK = 7
BUTTON_NEXT = 8
BUTTON_CLOSE = 9
BUTTON_CLOSE_SLOT = BUTTON_CLOSE
MAX_ITEM_COUNT = 6
VALID_CHOICES = range(1, 10)
else:
BUTTON_BACK = 8
BUTTON_NEXT = 9
BUTTON_CLOSE = 10
BUTTON_CLOSE_SLOT = 0
MAX_ITEM_COUNT = 7
VALID_CHOICES = range(1, 11)

Expand All @@ -61,8 +63,8 @@ def _get_menu_data(self, player_index):
@param <player_index>:
A player index.
"""
# Always enable BUTTON_CLOSE
slots = {BUTTON_CLOSE}
# Always enable BUTTON_CLOSE_SLOT
slots = {BUTTON_CLOSE_SLOT}
buffer = ''
page = self._player_pages[player_index]
page.options = {}
Expand Down Expand Up @@ -93,6 +95,8 @@ def _slots_to_bin(slots):
for slot in slots:
if 0 <= slot <= 9:
buffer[~(slot - 1)] = '1'
else:
raise ValueError('Slot out of range: {}'.format(slot))

return int(''.join(buffer), 2)

Expand Down Expand Up @@ -314,8 +318,8 @@ def _get_menu_data(self, player_index):
# Get the player's current page
page = self._player_pages[player_index]

# Always enable slot BUTTON_CLOSE
slots = {BUTTON_CLOSE}
# Always enable BUTTON_CLOSE_SLOT
slots = {BUTTON_CLOSE_SLOT}

# Format the menu
buffer = self._format_header(player_index, page, slots)
Expand Down