Version 1 OneShot

This commit is contained in:
2026-10-09 18:58:50 +00:00
parent 514c13d184
commit bf0d661eed
27 changed files with 3039 additions and 0 deletions

45
ffwrap/app.py Normal file
View File

@@ -0,0 +1,45 @@
"""Application entry point."""
from __future__ import annotations
import os
import sys
from pathlib import Path
def main() -> int:
from PySide6.QtGui import QIcon
from PySide6.QtWidgets import QApplication
from . import APP_NAME
from .gui.main_window import MainWindow
from .tools import app_dir
app = QApplication(sys.argv)
app.setApplicationName(APP_NAME)
app.setOrganizationName("ffwrap")
app.setStyle("Fusion")
# Bundled by PyInstaller into sys._MEIPASS, or next to the sources.
base = Path(getattr(sys, "_MEIPASS", app_dir()))
icon = base / "assets" / "icon.png"
if icon.exists():
app.setWindowIcon(QIcon(str(icon)))
win = MainWindow()
win.show()
# Files passed on the command line (or dropped onto the executable).
args = [Path(a) for a in sys.argv[1:] if not a.startswith("-")]
if args:
win.add_paths(args)
# Build verification: FFWRAP_SMOKE_TEST=shot.png saves a screenshot after start-up and exits.
shot = os.environ.get("FFWRAP_SMOKE_TEST")
if shot:
from PySide6.QtCore import QTimer
def finish():
win.grab().save(shot)
app.exit(0 if win.tools else 3)
QTimer.singleShot(4000, finish)
return app.exec()