LCOV - code coverage report
Current view: top level - src/pairinteraction_gui/qobjects - events.py (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 14 0.0 %
Date: 2025-04-29 15:59:54 Functions: 0 4 0.0 %

          Line data    Source code
       1             : # SPDX-FileCopyrightText: 2025 Pairinteraction Developers
       2             : # SPDX-License-Identifier: LGPL-3.0-or-later
       3             : 
       4           0 : import logging
       5           0 : from functools import partial
       6           0 : from typing import Optional
       7             : 
       8           0 : from PySide6.QtCore import QObject, QTimer
       9           0 : from PySide6.QtGui import QStatusTipEvent
      10           0 : from PySide6.QtWidgets import QApplication
      11             : 
      12             : 
      13           0 : def show_status_tip(parent: QObject, message: str, timeout: int = 0, logger: Optional[logging.Logger] = None) -> None:
      14             :     """Show a status tip message using QStatusTipEvent."""
      15           0 :     QApplication.sendEvent(parent, QStatusTipEvent(message))
      16           0 :     if logger:
      17           0 :         logger.info(message)
      18           0 :     if timeout > 0:
      19           0 :         QTimer.singleShot(timeout, partial(reset_status_tip, parent))
      20             : 
      21             : 
      22           0 : def reset_status_tip(parent: QObject) -> None:
      23             :     """Hide the status tip by sending an empty message."""
      24           0 :     QApplication.sendEvent(parent, QStatusTipEvent("Ready"))

Generated by: LCOV version 1.16