46 lines
1.3 KiB
Python
46 lines
1.3 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""
|
|
Logger Dock: Real-time system logs display using external TkinterLogger module.
|
|
"""
|
|
import tkinter as tk
|
|
from tkinter import ttk, scrolledtext
|
|
import logging
|
|
from pymsc.gui.docking.title_panel import TitlePanel
|
|
|
|
|
|
class LoggerDock(TitlePanel):
|
|
"""
|
|
Logger dockable panel with scrollable text display.
|
|
Shows real-time logs from the ARTOS system using external TkinterLogger.
|
|
"""
|
|
|
|
def __init__(self, parent: tk.Widget, **kwargs):
|
|
"""
|
|
Args:
|
|
parent: Parent widget
|
|
"""
|
|
super().__init__(parent, title="System Logger", closable=False, **kwargs)
|
|
|
|
def populate_content(self):
|
|
"""Create the scrollable log text widget."""
|
|
# Remove outer padding from the content frame
|
|
try:
|
|
self.content_frame.configure(padding=0)
|
|
except Exception:
|
|
pass
|
|
|
|
# Always create a new widget in this panel
|
|
self.log_text = scrolledtext.ScrolledText(
|
|
self.content_frame,
|
|
wrap=tk.WORD,
|
|
height=10,
|
|
font=('Consolas', 9),
|
|
bg='#ffffff',
|
|
fg='#000000'
|
|
)
|
|
self.log_text.pack(fill=tk.BOTH, expand=True, padx=0, pady=0)
|
|
|
|
def get_log_widget(self):
|
|
"""Return the log widget for external handlers to use."""
|
|
return self.log_text
|