improve wipe_screen

master
magical 2022-08-07 01:37:35 +00:00
parent 77d38011b5
commit 92bdd7b660
1 changed files with 9 additions and 13 deletions

View File

@ -1695,6 +1695,12 @@ class App(object):
self.window_split=True self.window_split=True
self.switch_editor() self.switch_editor()
def repaint_screen(self):
"""
Force urwid to repaint the whole screen.
"""
self.loop.screen.clear()
class MessageBody(urwid.Text): class MessageBody(urwid.Text):
""" """
@ -2052,7 +2058,7 @@ class ExternalEditor(urwid.Terminal):
if keyl == "ctrl l": if keyl == "ctrl l":
# always do this, and also pass it to the terminal # always do this, and also pass it to the terminal
wipe_screen() app.repaint_screen()
elif key == app.prefs["edit_escapes"]["abort"]: elif key == app.prefs["edit_escapes"]["abort"]:
self.terminate() self.terminate()
@ -2130,7 +2136,7 @@ class OptionsMenu(urwid.LineBox):
return self.keypress(size, "enter") return self.keypress(size, "enter")
elif keyl == "ctrl l": elif keyl == "ctrl l":
wipe_screen() app.repaint_screen()
def mouse_event(self, size, event, button, x, y, focus): def mouse_event(self, size, event, button, x, y, focus):
@ -2186,7 +2192,7 @@ class ActionBox(urwid.ListBox):
self.change_focus(size, 0) self.change_focus(size, 0)
elif key == "ctrl l": elif key == "ctrl l":
wipe_screen() app.repaint_screen()
elif keyl == "o": elif keyl == "o":
app.options_menu() app.options_menu()
@ -2550,16 +2556,6 @@ def ignore(*_, **__):
pass pass
def wipe_screen(*_):
"""
A crude hack to repaint the whole screen. I didnt immediately
see anything to acheive this in the MainLoop methods so this
will do, I suppose.
"""
app.loop.stop()
call("clear")
app.loop.start()
# XxX_N0_4rgP4rs3_XxX ###yoloswag # XxX_N0_4rgP4rs3_XxX ###yoloswag
def get_arg(key, default=None, get_value=True): def get_arg(key, default=None, get_value=True):
try: try: