MCPcopy Create free account
hub / github.com/ehForwarderBot/ehForwarderBot / KeyValueBullet

Class KeyValueBullet

ehforwarderbot/wizard.py:254–272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

252
253# @keyhandler.init
254class 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
275class ReorderBullet(Bullet):

Callers 4

choose_master_channelFunction · 0.85
choose_slave_channelsFunction · 0.85
choose_middlewaresFunction · 0.85
confirmationFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected