# FlightMonitor/data/config.py from typing import Optional """ Global configurations for the FlightMonitor application. This file centralizes constants and settings used across different modules, making them easier to manage and modify. Each configuration option should be clearly documented. """ # --- API Configuration --- # Base URL for the OpenSky Network API's 'states/all' endpoint. # This endpoint provides current flight states (position, velocity, etc.). # Documentation: https://opensky-network.org/apidoc/rest.html#all-state-vectors OPENSKY_API_URL: str = "https://opensky-network.org/api/states/all" # Default timeout for API requests in seconds. # This is the maximum time the application will wait for a response from the API # before considering the request as timed out. DEFAULT_API_TIMEOUT_SECONDS: int = 15 # --- Flag per Mock API --- # Set to True to use mock data instead of making real API calls to OpenSky. # This is useful for development to avoid consuming API credits and for offline testing. USE_MOCK_OPENSKY_API: bool = True # Imposta a False per chiamate reali MOCK_API_FLIGHT_COUNT: int = 5 # Numero di aerei finti da generare se USE_MOCK_OPENSKY_API รจ True MOCK_API_ERROR_SIMULATION: Optional[str] = None # Es: "RATE_LIMITED", "HTTP_ERROR", None per successo # --- GUI Configuration --- # Default geographical bounding box coordinates. # These values are used to pre-fill the input fields in the GUI for # selecting the geographical area of interest for live flight tracking. # The example values roughly cover Central Europe. # Latitude values must be between -90 and 90. # Longitude values must be between -180 and 180. DEFAULT_BBOX_LAT_MIN: float = 44.986 #45.0 # Minimum latitude DEFAULT_BBOX_LON_MIN: float = 7.9341 #5.0 # Minimum longitude DEFAULT_BBOX_LAT_MAX: float = 46.9567 #55.0 # Maximum latitude DEFAULT_BBOX_LON_MAX: float = 10.5997 #15.0 # Maximum longitude #lamin=44&lomin=6&lamax=47&lomax=10 # # questa zona si trova nei dintorni del lago di como # https://boundingbox.klokantech.com/ # 7.9341,44.986,10.5997,46.9567 7.9341,44.986,10.5997,46.9567 # Default dimensions (in pixels) for the flight map canvas in the GUI. # These dimensions determine the initial size of the area where flights are displayed. DEFAULT_CANVAS_WIDTH: int = 800 DEFAULT_CANVAS_HEIGHT: int = 600 # --- Live Monitoring Configuration --- # Placeholder for future configuration: # Polling interval in seconds for fetching live flight data. # This will determine how frequently the application requests updates from the API # when live monitoring is active. # LIVE_POLLING_INTERVAL_SECONDS: int = 10 # --- Data Storage Configuration --- # Placeholder for future configuration: # Name of the SQLite database file for storing flight data. # DATABASE_FILENAME: str = "flights.db" # Maximum number of records or days to retain in the history. # DATA_RETENTION_DAYS: int = 30 # Global logging level for the application. # Valid levels: "DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL" # This sets the minimum severity of messages that will be processed. LOG_LEVEL: str = "DEBUG" # Set to "INFO" for less verbose production logging # Format string for log messages. # See Python's logging documentation for format codes. # Example: %(asctime)s - %(name)s - %(levelname)s - %(module)s.%(funcName)s - %(message)s LOG_FORMAT: str = "%(asctime)s [%(levelname)-8s] %(name)-20s : %(message)s" # Alternative more detailed format: # LOG_FORMAT: str = "%(asctime)s - %(levelname)-8s - %(name)-25s [%(module)s.%(funcName)s:%(lineno)d] - %(message)s" # Format string for the date/time in log messages. LOG_DATE_FORMAT: str = "%Y-%m-%d %H:%M:%S" # Colors for different log levels in the GUI log widget. # These should be valid Tkinter color names or hex codes. LOG_COLOR_DEBUG: str = "RoyalBlue1" LOG_COLOR_INFO: str = "black" LOG_COLOR_WARNING: str = "dark orange" LOG_COLOR_ERROR: str = "red2" LOG_COLOR_CRITICAL: str = "red4" # Placeholder for future: File logging configuration # LOG_TO_FILE: bool = False # LOG_FILE_PATH: str = "flight_monitor.log" # LOG_FILE_MAX_BYTES: int = 10 * 1024 * 1024 # 10 MB # LOG_FILE_BACKUP_COUNT: int = 5 # Polling interval in seconds for fetching live flight data. # This determines how frequently the application requests updates from the API # when live monitoring is active. LIVE_POLLING_INTERVAL_SECONDS: int = 15 # Ad esempio, ogni 15 secondi # --- Data Storage Configuration --- # Directory where daily SQLite database files will be stored. # This path is relative to the main application directory or an absolute path. # Ensure this directory is writable by the application. DATABASE_DIRECTORY: str = "flight_data_history" # Format string for the daily database filenames. # Uses strftime format codes (YYYY, MM, DD, HH, etc.). # Example for daily files: "flights_%Y-%m-%d.db" DATABASE_FILENAME_FORMAT: str = "flights_%Y-%m-%d.db"