""" GUI Application Entry Point for Python Scheduler Launches the PyQt6 desktop application """ import sys import argparse from pathlib import Path # Add current directory to path sys.path.insert(0, str(Path(__file__).parent)) from PyQt6.QtWidgets import QApplication from PyQt6.QtCore import Qt from core.database import Database from core.config import SchedulerConfig from core.logger import setup_logging from gui.main_window import MainWindow def main(): """Main entry point for GUI""" # Parse command line arguments parser = argparse.ArgumentParser(description='Python Scheduler - GUI Control Panel') parser.add_argument('--minimize', '-m', action='store_true', help='Start minimized to system tray') args = parser.parse_args() # Setup logging setup_logging('gui') # Load config and database # GUI connects directly to remote B (reads/writes config); local_path=None → backward compat # local_runtime_path: backup_operations queries read from frank_local.db (daemon writes there) config = SchedulerConfig() db = Database(config.database_path, local_runtime_path=config.local_database_path) # Create QApplication app = QApplication(sys.argv) app.setApplicationName("Frank") app.setOrganizationName("Frank") # Set application style app.setStyle('Fusion') # Enable high DPI scaling QApplication.setHighDpiScaleFactorRoundingPolicy( Qt.HighDpiScaleFactorRoundingPolicy.PassThrough ) # Create main window window = MainWindow(db, config) # Show window or start minimized to tray if args.minimize: # Start minimized - show briefly then hide to tray # This ensures system tray icon is properly initialized window.show() window.hide() else: # Normal startup - show window window.show() # Run application sys.exit(app.exec()) if __name__ == '__main__': main()