From: Christian Heller Date: Fri, 30 May 2025 13:12:53 +0000 (+0200) Subject: Refactor event loop, always pass to TUI. X-Git-Url: https://plomlompom.com/repos/%22https:/validator.w3.org/tasks?a=commitdiff_plain;h=994a7eb544664fef9b1628b195d3eb4b81e41f16;p=ircplom Refactor event loop, always pass to TUI. --- diff --git a/ircplom.py b/ircplom.py index ef58fe6..b090868 100755 --- a/ircplom.py +++ b/ircplom.py @@ -376,6 +376,8 @@ class TuiLoop(Loop): # f'DEBUG {line}' for line # in '\n'.join(format_exception(event.payload)).split('\n')] # self._draw_log() + else: + return True self._term.flush() return True @@ -438,24 +440,16 @@ def run() -> None: q_to_main.put(Event('SEND', IrcMessage('NICK', [NICKNAME]))) while True: event = q_to_main.get() + term.tui.put(event) if event.type_ == 'QUIT': break - if event.type_ == 'INPUT_PROMPT': - term.tui.put(event) - elif event.type_ == 'SEND': - term.tui.put(event) + if event.type_ == 'EXCEPTION': + raise event.payload + if event.type_ == 'SEND': event.payload.send(conn) elif event.type_ == 'PING': q_to_main.put( Event('SEND', IrcMessage('PONG', [event.payload]))) - elif event.type_ == 'RECV': - term.tui.put(event) - elif event.type_ == 'EXCEPTION': - raise event.payload - elif event.type_ == 'ALERT': - term.tui.put(event) - # elif event.type_ == 'DEBUG': - # term.tui.put(event) if __name__ == '__main__':