""" Status Indicator Widget A simple colored dot widget to show online/offline/updating status. """ from PyQt5.QtWidgets import QLabel from resources.styles import get_status_indicator_style from utils.config import STATUS_INDICATOR_SIZE class StatusIndicator(QLabel): """ A colored status indicator dot. Shows different colors based on status: - online: Green - offline: Red - updating: Orange Attributes: status: Current status ('online', 'offline', or 'updating') """ def __init__(self, status: str = "online"): """ Initialize the status indicator. Args: status: Initial status ('online', 'offline', or 'updating') """ super().__init__() self.status = status self.setFixedSize(STATUS_INDICATOR_SIZE, STATUS_INDICATOR_SIZE) self.update_status() def update_status(self): """Update the visual appearance based on current status.""" style = get_status_indicator_style(self.status) self.setStyleSheet(style) def set_status(self, status: str): """ Set a new status and update appearance. Args: status: New status ('online', 'offline', or 'updating') """ self.status = status self.update_status() def get_status(self) -> str: """ Get the current status. Returns: str: Current status """ return self.status