Clear screen implemented

This commit is contained in:
Dirk Alders 2025-07-22 06:08:47 +02:00
parent a23e25a94c
commit 845eb99de6

View File

@ -44,7 +44,10 @@ class MqttSniffer(App):
"""a textual application for viewing mqtt messages.""" """a textual application for viewing mqtt messages."""
CSS_PATH = "style.tcss" CSS_PATH = "style.tcss"
BINDINGS = [("q", "quit", "Quit")] BINDINGS = [
("q", "quit", "Quit"),
("c", "clear_screen", "Clear")
]
MAX_LOGS = 50 MAX_LOGS = 50
def __init__(self, args, password): def __init__(self, args, password):
@ -102,6 +105,11 @@ class MqttSniffer(App):
self.log_display.write(message) self.log_display.write(message)
def action_clear_screen(self):
self.all_logs = []
self._update_display()
def _update_display(self): def _update_display(self):
"""Clean the display and render all mqtt messages based on the current filters.""" """Clean the display and render all mqtt messages based on the current filters."""
self.log_display.clear() self.log_display.clear()