MCPcopy Create free account
hub / github.com/bpython/bpython / StatusbarEdit

Class StatusbarEdit

bpython/urwid.py:133–151  ·  view source on GitHub ↗

Wrapper around urwid.Edit used for the prompt in Statusbar. This class only adds a single signal that is emitted if the user presses Enter.

Source from the content-addressed store, hash-verified

131
132
133class StatusbarEdit(urwid.Edit):
134 """Wrapper around urwid.Edit used for the prompt in Statusbar.
135
136 This class only adds a single signal that is emitted if the user presses
137 Enter."""
138
139 signals = urwid.Edit.signals + ["prompt_enter"]
140
141 def __init__(self, *args, **kwargs):
142 self.single = False
143 super().__init__(*args, **kwargs)
144
145 def keypress(self, size, key):
146 if self.single:
147 urwid.emit_signal(self, "prompt_enter", self, key)
148 elif key == "enter":
149 urwid.emit_signal(self, "prompt_enter", self, self.get_edit_text())
150 else:
151 return super().keypress(size, key)
152
153
154urwid.register_signal(StatusbarEdit, "prompt_enter")

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected