| 252 | |
| 253 | # @keyhandler.init |
| 254 | class KeyValueBullet(Bullet): |
| 255 | def __init__(self, prompt: str = "", choices: list = [], choices_id: list = [], bullet: str = "●", |
| 256 | bullet_color: str = colors.foreground["default"], word_color: str = colors.foreground["default"], |
| 257 | word_on_switch: str = colors.REVERSE, background_color: str = colors.background["default"], |
| 258 | background_on_switch: str = colors.REVERSE, pad_right=0, indent: int = 0, align=0, margin: int = 0, |
| 259 | shift: int = 0): |
| 260 | super().__init__(prompt, choices, bullet, bullet_color, word_color, word_on_switch, background_color, |
| 261 | background_on_switch, pad_right, indent, align, margin, shift) |
| 262 | |
| 263 | self.choices_id = choices_id |
| 264 | self._key_handler: Dict[int, Callable] = self._key_handler.copy() |
| 265 | self._key_handler[NEWLINE_KEY] = self.__class__.accept |
| 266 | |
| 267 | # @keyhandler.register(NEWLINE_KEY) |
| 268 | def accept(self, *args): |
| 269 | pos = self.pos |
| 270 | bullet.utils.moveCursorDown(len(self.choices) - pos) |
| 271 | self.pos = 0 |
| 272 | return self.choices[pos], self.choices_id[pos] |
| 273 | |
| 274 | |
| 275 | class ReorderBullet(Bullet): |
no outgoing calls
no test coverage detected