Files
pyGUI/main.py
T
Jack.Le fbb04eb2f7 Refactor main application entry and enhance UI with file browser integration
- Changed application entry point to use QApplication for better compatibility with widgets.
- Set up QML UI style to support custom button backgrounds.
- Introduced LocalSettingsModel and FileBrowser for managing application settings and file selection.
- Updated QML components to reflect new data models and improve layout consistency.
- Enhanced Theme.qml with detailed comments and improved color management for better readability.
2026-04-27 14:28:08 -07:00

38 lines
1.2 KiB
Python

import sys
from pathlib import Path
from PySide6.QtQml import QQmlApplicationEngine
from PySide6.QtQuickControls2 import QQuickStyle
from PySide6.QtWidgets import QApplication
from backend.local_settings_model import LocalSettingsModel
from backend.file_browser import FileBrowser
# ===== Application Entry Point =====
if __name__ == "__main__":
# ===== UI Style Setup =====
# Use a non-native controls style so our custom QML button backgrounds are supported.
QQuickStyle.setStyle("Basic")
# ===== Qt Bootstrap =====
# Minimal Qt bootstrap: load the ISC QML module and exit if it fails.
app = QApplication(sys.argv)
engine = QQmlApplicationEngine()
# ===== Shared Models =====
settings_model = LocalSettingsModel()
select_file_dialog_model = FileBrowser()
settings_model.loadSettings()
engine.rootContext().setContextProperty("settingsModel", settings_model)
engine.rootContext().setContextProperty("file_browser", select_file_dialog_model)
# ===== QML Startup =====
engine.addImportPath(Path(__file__).parent)
engine.loadFromModule("ISC", "Main")
# ===== Exit Handling =====
if not engine.rootObjects():
sys.exit(-1)
sys.exit(app.exec())