Skip to content
Open
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
13 changes: 8 additions & 5 deletions PyInquirer/prompts/checkbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ def select_item(mouse_event):
else:
tokens.append(('', ' ', select_item))
# 'o ' - FISHEYE
if choice[2]: # disabled
tokens.append(('', '- %s (%s)' % (choice[0], choice[2])))
if line[2]: # disabled
tokens.append(('', '- %s (%s)' % (line[0], line[2])))
else:
if selected:
tokens.append(('class:selected', '{} '.format(self.selected_sign), select_item))
Expand All @@ -93,8 +93,8 @@ def select_item(mouse_event):
if pointed_at:
tokens.append(('[SetCursorPosition]', ''))

if choice[3]: # description
tokens.append(('', "%s - %s" % (line_name, choice[3])))
if line[3]: # description
tokens.append(('', "%s - %s" % (line_name, line[3])))
else:
tokens.append(('', line_name, select_item))
tokens.append(('', '\n'))
Expand Down Expand Up @@ -160,7 +160,10 @@ def get_prompt_tokens():
' (<up>, <down> to move, <space> to select, <a> '
'to toggle, <i> to invert)'))
if not ic.answered_correctly:
tokens.append((Token.Error, ' Error: %s' % ic.error_message))
# Use 'class:error' style consistent with prompt_toolkit style tuples.
# Previously referenced Token.Error from pygments which was never
# imported in this module, causing a NameError on validation failure.
tokens.append(('class:error', ' Error: %s' % ic.error_message))
return tokens

# assemble layout
Expand Down