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,58 @@
|
||||
#!/usr/bin/env python3
|
||||
"""FarmHUD - a compact FS25 companion HUD with Discord Rich Presence.
|
||||
|
||||
Run:
|
||||
pip install -r requirements.txt
|
||||
python main.py
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import sys
|
||||
import tkinter
|
||||
|
||||
from PySide6.QtWidgets import QApplication
|
||||
|
||||
from main_window import MainWindow
|
||||
from theme import STYLESHEET
|
||||
from version import APP_NAME, APP_ORG, APP_VERSION
|
||||
|
||||
|
||||
def resource_path(relative: str) -> str:
|
||||
"""Works both run from source and from a PyInstaller onefile bundle."""
|
||||
base = getattr(sys, "_MEIPASS", os.path.dirname(os.path.abspath(__file__)))
|
||||
return os.path.join(base, relative)
|
||||
|
||||
|
||||
def _fix_windows_taskbar_icon() -> None:
|
||||
"""Without this, Windows groups the app under its own generic Python
|
||||
icon in the taskbar (and when pinned) instead of the one set via
|
||||
setWindowIcon() - the title bar icon is unaffected either way, this is
|
||||
purely a taskbar/grouping quirk. Setting an explicit AppUserModelID
|
||||
tells Windows this process is its own distinct app. No-op everywhere
|
||||
else, and safe to skip if anything about this call ever misbehaves."""
|
||||
if sys.platform != "win32":
|
||||
return
|
||||
try:
|
||||
import ctypes
|
||||
|
||||
app_id = f"{APP_ORG}.{APP_NAME}.{APP_VERSION}"
|
||||
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(app_id)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
def main() -> int:
|
||||
_fix_windows_taskbar_icon()
|
||||
app = QApplication(sys.argv)
|
||||
app.setApplicationName(APP_NAME)
|
||||
app.setStyleSheet(STYLESHEET)
|
||||
|
||||
icon_path = resource_path(os.path.join("assets", "icon.ico"))
|
||||
window = MainWindow(icon_path=icon_path if os.path.exists(icon_path) else None)
|
||||
window.show()
|
||||
return app.exec()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
Reference in New Issue
Block a user