24 lines
619 B
Python
24 lines
619 B
Python
from datetime import datetime
|
|
|
|
from PySide6.QtCore import QObject, Signal, Slot
|
|
|
|
|
|
class DataBridge(QObject):
|
|
"""Bridge between the QML app and the Python "host"."""
|
|
|
|
# Indicates whether we're currently loading something or not
|
|
isLoading = Signal(bool, arguments=["loading"])
|
|
|
|
notification = Signal(str, arguments=["text"])
|
|
|
|
def __init__(self):
|
|
super().__init__()
|
|
|
|
def set_loading(self, state: bool):
|
|
"""Set the loading state in the UI."""
|
|
self.isLoading.emit(state)
|
|
|
|
@Slot(result=str)
|
|
def currentTime(self) -> str:
|
|
return datetime.now().strftime("%H:%M")
|