(self)
| 168 | print() |
| 169 | |
| 170 | def select(self): |
| 171 | print(ansiescapes.cursorSavePosition, end="") |
| 172 | print(ansiescapes.eraseDown, end="") |
| 173 | selected = input(self.prompt) |
| 174 | |
| 175 | keys = [option[0].upper() for option in self.options] |
| 176 | if self.add_quit: |
| 177 | keys += [self.return_option[0]] |
| 178 | |
| 179 | while not selected or selected.upper() not in keys: |
| 180 | nl_count = self.prompt.count("\n") + selected.count("\n") + 1 |
| 181 | selected = input(f"{nl_count * ansiescapes.cursorPrevLine}{ansiescapes.eraseDown}{self.prompt}") |
| 182 | |
| 183 | if self.add_quit and selected.upper() == self.return_option[0]: |
| 184 | return self.EXIT_MENU |
| 185 | elif self.return_number: |
| 186 | return self.options[keys.index(selected.upper())][0] |
| 187 | else: |
| 188 | return self.options[keys.index(selected.upper())][3]() if self.options[keys.index(selected.upper())][3] else None |
| 189 | |
| 190 | def start(self): |
| 191 | while True: |
no outgoing calls
no test coverage detected