def exit_program(button):
raise urwid.ExitMainLoop()
python类ExitMainLoop()的实例源码
def exit_on_cr(key):
if isinstance(key, basestring) and key in 'Q':
raise urwid.ExitMainLoop()
def kill_buffer(self):
"""Kill current buffer"""
raise urwid.ExitMainLoop()
def end_loop(self, *unused) -> None:
"""End main event loop.
Raises:
urwid.ExitMainLoop: Every time it is called.
"""
raise urwid.ExitMainLoop()
def exit_loop_on_q_esc(key: str):
"""End urwid.MainLoop on keypress of 'q' or 'esc'."""
if key in {'q', 'Q', 'esc'}:
raise urwid.ExitMainLoop()
def on_clicked_cont(button): ##to call when continue pressed
raise urwid.ExitMainLoop()
def menuVAOnly(button): #called when user selects video/audio only in second loop
raise urwid.ExitMainLoop()
def keypress(self, size, key):
key = super(ConversationListBox, self).keypress(size, key)
if key != 'enter':
return key
name = self.focus[0].edit_text
if not name:
raise urwid.ExitMainLoop()
# replace or add response
self.focus.contents[1:] = [(answer(name), self.focus.options())]
pos = self.focus_position
# add a new question
self.body.insert(pos + 1, question())
self.focus_position = pos + 1
def exit_program(button):
raise urwid.ExitMainLoop()
def on_exit_clicked(button):
raise urwid.ExitMainLoop()
def exit_on_q(key):
if key in ('q', 'Q'):
raise urwid.ExitMainLoop()
def exit_program(button):
raise urwid.ExitMainLoop()
def exit_program(key):
raise urwid.ExitMainLoop()
def exit_on_q(key):
if key in ('q', 'Q'):
raise urwid.ExitMainLoop()
def exit_program(button):
raise urwid.ExitMainLoop()
def show_or_exit(key):
if key in ('q', 'Q'):
raise urwid.ExitMainLoop()
txt.set_text(repr(key))
def unhandled_input(self, key):
if key == 'f8':
self.loop.widget = self.exit_view
return True
if self.loop.widget != self.exit_view:
return
if key in ('y', 'Y'):
raise urwid.ExitMainLoop()
if key in ('n', 'N'):
self.loop.widget = self.view
return True
def unhandled_input(self, k):
# update display of focus directory
if k in ('q','Q'):
raise urwid.ExitMainLoop()
def exit_program(self, w):
raise urwid.ExitMainLoop()
def unhandled_keypress(self, k):
"""Last resort for keypresses."""
if k == "f5":
self.save_file()
elif k == "f8":
raise urwid.ExitMainLoop()
elif k == "delete":
# delete at end of line
self.walker.combine_focus_with_next()
elif k == "backspace":
# backspace at beginning of line
self.walker.combine_focus_with_prev()
elif k == "enter":
# start new line
self.walker.split_focus()
# move the cursor to the new line and reset pref_col
self.loop.process_input(["down", "home"])
elif k == "right":
w, pos = self.walker.get_focus()
w, pos = self.walker.get_next(pos)
if w:
self.listbox.set_focus(pos, 'above')
self.loop.process_input(["home"])
elif k == "left":
w, pos = self.walker.get_focus()
w, pos = self.walker.get_prev(pos)
if w:
self.listbox.set_focus(pos, 'below')
self.loop.process_input(["end"])
else:
return
return True