SXXXXXXX_FlightMonitor/flightmonitor/data/config.py

110 lines
4.3 KiB
Python

# 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 = (
50 # 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
MOCK_API_ERROR_SIMULATION: Optional[str] = (
None # MODIFIED: Moved error simulation example from comments. Example: "RATE_LIMITED", "HTTP_ERROR", None
)
# 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
# --- 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
# 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
# Directory for map tile caching.
# A service-specific subdirectory will be created inside this.
MAP_TILE_CACHE_DIR: str = "flightmonitor_tile_cache"
# --- Logging Configuration ---
# MODIFIED: Removed all logging-specific constants (LOG_LEVEL, LOG_FORMAT, LOG_DATE_FORMAT, LOG_COLOR_*)
# WHY: These configurations are now centralized in the new logging_config.py module.
# HOW: Deleted these lines.
# 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"
# Format string for log messages.
# LOG_FORMAT: str = "%(asctime)s [%(levelname)-8s] %(name)-20s : %(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.
# 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"
# --- 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"
# Placeholder for future: Maximum number of records or days to retain in the history.
# DATA_RETENTION_DAYS: int = 30