60 lines
1.5 KiB
Python
60 lines
1.5 KiB
Python
"""Application entry point for Development Hub."""
|
|
|
|
import signal
|
|
import sys
|
|
|
|
from PySide6.QtCore import QTimer
|
|
from PySide6.QtWidgets import QApplication
|
|
|
|
from development_hub.main_window import MainWindow
|
|
from development_hub.settings import Settings
|
|
from development_hub.dialogs import SetupWizardDialog
|
|
from development_hub.styles import DARK_THEME
|
|
|
|
|
|
class DevelopmentHubApp(QApplication):
|
|
"""Main application class for Development Hub."""
|
|
|
|
def __init__(self, argv: list[str]):
|
|
super().__init__(argv)
|
|
self.setApplicationName("Development Hub")
|
|
self.setApplicationVersion("0.1.0")
|
|
self.setStyle("Fusion") # Consistent cross-platform style
|
|
self.setStyleSheet(DARK_THEME)
|
|
|
|
|
|
def main() -> int:
|
|
"""Run the Development Hub application.
|
|
|
|
Returns:
|
|
Exit code (0 for success).
|
|
"""
|
|
app = DevelopmentHubApp(sys.argv)
|
|
|
|
# Check for first-run setup
|
|
settings = Settings()
|
|
if not settings.get("setup_completed", False):
|
|
wizard = SetupWizardDialog()
|
|
wizard.exec()
|
|
|
|
window = MainWindow()
|
|
|
|
# Handle Ctrl+C gracefully
|
|
def handle_sigint(*args):
|
|
"""Handle SIGINT by closing the main window gracefully."""
|
|
window.close()
|
|
|
|
signal.signal(signal.SIGINT, handle_sigint)
|
|
|
|
# Timer to allow Python to process signals (Qt blocks them otherwise)
|
|
timer = QTimer()
|
|
timer.timeout.connect(lambda: None)
|
|
timer.start(100)
|
|
|
|
window.show()
|
|
return app.exec()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|