LCOV - code coverage report
Current view: top level - src/pairinteraction_gui/qobjects - events.py (source / functions) Hit Total Coverage
Test: coverage.info Lines: 14 14 100.0 %
Date: 2025-06-06 09:09:03 Functions: 2 4 50.0 %

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

Generated by: LCOV version 1.16