Lines Matching refs:self
43 def __init__(self, choices, **kwargs): argument
44 self.pointer_index = 0
45 self.selected_options = [] # list of names
46 self.answered = False
47 self._init_choices(choices)
48 self.deps = kwargs.pop('deps')
49 self.nodes_from = defaultdict(list)
50 super(InquirerControl, self).__init__(self._get_choice_tokens,
53 def _init_choices(self, choices): argument
55 self.choices = [] # list (name, value)
59 self.choices.append(choice)
65 self.selected_options.append(choice['name'])
66 self.choices.append((name, value, disabled))
68 self.pointer_index = index
72 def choice_count(self): argument
73 return len(self.choices)
75 def _get_choice_tokens(self, cli): argument
85 selected = (line_value in self.selected_options)
86 pointed_at = (index == self.pointer_index)
91 if line_value in self.selected_options:
92 deselect_node(line_value, self.selected_options,
93 self.nodes_from, self.deps)
95 select_node(line_value, self.selected_options,
96 self.nodes_from, self.deps)
119 for i, choice in enumerate(self.choices):
124 def get_selected_values(self): argument
126 return [c[1] for c in self.choices if not isinstance(c, Separator) and
127 c[1] in self.selected_options]
130 def line_count(self): argument
131 return len(self.choices)