Pause added to stop changing log window
This commit is contained in:
parent
dc92c0d4d1
commit
554f19fc6c
15
loggy.py
15
loggy.py
@ -64,14 +64,16 @@ class LogViewerApp(App):
|
|||||||
CSS_PATH = "style.tcss"
|
CSS_PATH = "style.tcss"
|
||||||
BINDINGS = [
|
BINDINGS = [
|
||||||
("q", "quit", "Quit"),
|
("q", "quit", "Quit"),
|
||||||
("c", "clear_screen", "Clear")
|
("c", "clear_screen", "Clear"),
|
||||||
|
("p", "pause", "Pause")
|
||||||
]
|
]
|
||||||
MAX_LOGS = 1000
|
MAX_LOGS = 5000
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
#
|
#
|
||||||
self.all_logs = []
|
self.all_logs = []
|
||||||
|
self.__logging_enabled__ = True
|
||||||
self.__module_selection__ = MultiSelect((), prompt="Module", id="module_filter")
|
self.__module_selection__ = MultiSelect((), prompt="Module", id="module_filter")
|
||||||
self.__level_selection__ = MultiSelect((), prompt="Level", id="level_filter")
|
self.__level_selection__ = MultiSelect((), prompt="Level", id="level_filter")
|
||||||
self.force_critical = True
|
self.force_critical = True
|
||||||
@ -131,13 +133,18 @@ class LogViewerApp(App):
|
|||||||
f"[bold]{record.name}[/bold] - "
|
f"[bold]{record.name}[/bold] - "
|
||||||
f"{record.getMessage()}"
|
f"{record.getMessage()}"
|
||||||
)
|
)
|
||||||
|
if self.__logging_enabled__:
|
||||||
self.log_display.write(message)
|
self.log_display.write(message)
|
||||||
|
|
||||||
def action_clear_screen(self):
|
def action_clear_screen(self):
|
||||||
self.all_logs = []
|
self.all_logs = []
|
||||||
self._update_display()
|
self._update_display()
|
||||||
|
|
||||||
|
def action_pause(self):
|
||||||
|
self.__logging_enabled__ = not self.__logging_enabled__
|
||||||
|
if self.__logging_enabled__:
|
||||||
|
self._update_display()
|
||||||
|
|
||||||
def _update_display(self):
|
def _update_display(self):
|
||||||
"""Löscht die Anzeige und rendert alle Logs basierend auf den aktuellen Filtern neu."""
|
"""Löscht die Anzeige und rendert alle Logs basierend auf den aktuellen Filtern neu."""
|
||||||
self.log_display.clear()
|
self.log_display.clear()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user