feat: add FS25_FarmHUD mod and FarmHUD desktop companion app
Initial commit: the FS25 Lua mod (live.json data export), the FS25-WebDashboard project (Node/web dashboard + PySide6 desktop variant), and FarmHUD (standalone PySide6 companion app with Discord Rich Presence, settings, and installer).
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
"""Top bar: brand, connection status, map id, theme + fullscreen toggles."""
|
||||
from __future__ import annotations
|
||||
|
||||
from PySide6.QtCore import Signal
|
||||
from PySide6.QtWidgets import QFrame, QHBoxLayout, QLabel, QPushButton
|
||||
|
||||
from widgets.common import style_role
|
||||
|
||||
|
||||
class TopBar(QFrame):
|
||||
theme_toggle_requested = Signal()
|
||||
fullscreen_toggle_requested = Signal()
|
||||
|
||||
def __init__(self, parent=None) -> None:
|
||||
super().__init__(parent)
|
||||
style_role(self, "panel-header")
|
||||
layout = QHBoxLayout(self)
|
||||
layout.setContentsMargins(14, 8, 14, 8)
|
||||
layout.setSpacing(10)
|
||||
|
||||
brand = QLabel("FS25")
|
||||
brand.setStyleSheet("font-weight: 800; font-size: 15px;")
|
||||
layout.addWidget(brand)
|
||||
|
||||
title = QLabel("Live Dashboard")
|
||||
style_role(title, "panel-title")
|
||||
layout.addWidget(title)
|
||||
|
||||
self.map_id_label = QLabel("")
|
||||
style_role(self.map_id_label, "panel-sub")
|
||||
layout.addWidget(self.map_id_label)
|
||||
|
||||
layout.addStretch(1)
|
||||
|
||||
self.status_dot = QLabel("●")
|
||||
self.status_dot.setStyleSheet("color: #ff5d5d; font-size: 14px;")
|
||||
layout.addWidget(self.status_dot)
|
||||
|
||||
self.status_label = QLabel("Verbinde…")
|
||||
style_role(self.status_label, "panel-sub")
|
||||
layout.addWidget(self.status_label)
|
||||
|
||||
self.theme_btn = QPushButton("🌓")
|
||||
self.theme_btn.setToolTip("Hell/Dunkel umschalten")
|
||||
self.theme_btn.clicked.connect(self.theme_toggle_requested.emit)
|
||||
layout.addWidget(self.theme_btn)
|
||||
|
||||
self.fullscreen_btn = QPushButton("⛶")
|
||||
self.fullscreen_btn.setToolTip("Vollbild")
|
||||
self.fullscreen_btn.clicked.connect(self.fullscreen_toggle_requested.emit)
|
||||
layout.addWidget(self.fullscreen_btn)
|
||||
|
||||
def set_status(self, live: bool, waiting: bool) -> None:
|
||||
if live:
|
||||
self.status_dot.setStyleSheet("color: #3ecf7a; font-size: 14px;")
|
||||
self.status_label.setText("Live")
|
||||
elif waiting:
|
||||
self.status_dot.setStyleSheet("color: #e8b93f; font-size: 14px;")
|
||||
self.status_label.setText("Warte auf Spiel…")
|
||||
else:
|
||||
self.status_dot.setStyleSheet("color: #ff5d5d; font-size: 14px;")
|
||||
self.status_label.setText("Keine Verbindung")
|
||||
|
||||
def set_map_id(self, map_id: str) -> None:
|
||||
self.map_id_label.setText(f"· {map_id}" if map_id else "")
|
||||
Reference in New Issue
Block a user