fix multistart main application with pytinstaller

This commit is contained in:
VALLONGOL 2025-07-15 14:37:09 +02:00
parent 7577bafd30
commit 18294f02a2
13 changed files with 158 additions and 17 deletions

View File

@ -0,0 +1,27 @@
@echo off & cls
echo ------------------------------------
echo Package Installer for radar_data_reader
echo ------------------------------------
echo.
echo Checking for pip...
python -m pip --version >nul 2>&1 & if errorlevel 1 ( python3 -m pip --version >nul 2>&1 & if errorlevel 1 ( goto :pip_error ) )
echo pip found. & goto :install
:pip_error
echo ERROR: Python pip module not found.
echo Please install pip for your Python environment. See:
echo https://pip.pypa.io/en/stable/installation/
echo. & pause & exit /b 1
:install
echo Installing packages from local folder using 'requirements.txt'...
echo Source: %~dp0
echo.
python -m pip install --no-index --find-links "%~dp0" -r "%~dp0requirements.txt" --disable-pip-version-check || ( python3 -m pip install --no-index --find-links "%~dp0" -r "%~dp0requirements.txt" --disable-pip-version-check || ( goto :install_error ) )
echo. & echo --------------------------
echo Installation Successful!
echo --------------------------
echo. & pause & exit /b 0
:install_error
echo. & echo --------------------------
echo ERROR: Installation Failed.
echo --------------------------
echo Please check the messages above for details. & pause & exit /b 1

View File

@ -0,0 +1,24 @@
#!/bin/bash
echo "------------------------------------"
echo "Package Installer for radar_data_reader"
echo "------------------------------------"
echo ""
echo "Checking for pip..."
PYTHON_CMD=""
if command -v python3 &>/dev/null && python3 -m pip --version &>/dev/null; then PYTHON_CMD="python3"
elif command -v python &>/dev/null && python -m pip --version &>/dev/null; then PYTHON_CMD="python"
else echo "ERROR: Python pip module not found for python3 or python."; echo "Install pip: https://pip.pypa.io/en/stable/installation/"; exit 1; fi
echo "pip found ($PYTHON_CMD)."
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
REQ_FILE="$SCRIPT_DIR/requirements.txt"
echo "Installing packages from '$SCRIPT_DIR' using '$REQ_FILE'..."
echo ""
"$PYTHON_CMD" -m pip install --no-index --find-links "$SCRIPT_DIR" -r "$REQ_FILE" --disable-pip-version-check
INSTALL_STATUS=$?
echo ""
if [ $INSTALL_STATUS -ne 0 ]; then
echo "--------------------------"; echo "ERROR: Installation Failed."; echo "--------------------------"; echo "Check messages above."; exit 1;
else
echo "--------------------------"; echo "Installation Successful!"; echo "--------------------------"; exit 0;
fi

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,39 @@
# Requirements generated by DependencyAnalyzer for radar_data_reader
# Python Version (analysis env): 3.13.5
# --- Standard Library Modules Used (part of Python 3.13.5) ---
# cProfile (Used in: radar_data_reader\core\file_reader.py)
# collections (Used in: radar_data_reader\core\file_reader.py)
# copy (Used in: radar_data_reader\gui\profile_editor_window.py)
# csv (Used in: radar_data_reader\core\app_controller.py, radar_data_reader\core\flight_analyzer.py, radar_data_reader\core\out_processor.py, ...)
# ctypes (Used in: radar_data_reader\core\app_controller.py, radar_data_reader\core\struct_parser.py, radar_data_reader\core\structures\base_structures.py, ...)
# dataclasses (Used in: radar_data_reader\core\export_profiles.py, radar_data_reader\core\structures\base_structures.py, radar_data_reader\core\structures\cdpsts_structures.py, ...)
# datetime (Used in: radar_data_reader\core\app_controller.py, radar_data_reader\core\flight_analyzer.py)
# enum (Used in: radar_data_reader\core\data_enums.py)
# inspect (Used in: radar_data_reader\gui\profile_editor_window.py)
# json (Used in: radar_data_reader\core\app_controller.py, radar_data_reader\core\out_processor.py, radar_data_reader\core\segment_processor.py, ...)
# logging (Used in: radar_data_reader\__main__.py, radar_data_reader\core\file_reader.py, radar_data_reader\gui\main_window.py, ...)
# math (Used in: radar_data_reader\core\structures\d1553_structures.py)
# multiprocessing (Used in: radar_data_reader\core\app_controller.py, radar_data_reader\core\cpp_runner.py, radar_data_reader\core\file_reader.py, ...)
# os (Used in: radar_data_reader\core\app_controller.py, radar_data_reader\core\cpp_runner.py, radar_data_reader\core\export_manager.py, ...)
# pathlib (Used in: radar_data_reader\__main__.py, radar_data_reader\core\app_controller.py, radar_data_reader\core\export_manager.py, ...)
# pstats (Used in: radar_data_reader\core\file_reader.py)
# queue (Used in: radar_data_reader\core\app_controller.py, radar_data_reader\core\export_manager.py, radar_data_reader\core\file_reader.py, ...)
# re (Used in: radar_data_reader\_version.py, radar_data_reader\core\app_controller.py, radar_data_reader\core\cpp_runner.py, ...)
# shutil (Used in: radar_data_reader\core\app_controller.py, radar_data_reader\core\export_manager.py)
# subprocess (Used in: radar_data_reader\core\app_controller.py, radar_data_reader\core\cpp_runner.py, radar_data_reader\core\export_manager.py, ...)
# sys (Used in: radar_data_reader\core\app_controller.py)
# threading (Used in: radar_data_reader\core\app_controller.py, radar_data_reader\core\export_manager.py, radar_data_reader\core\flight_analyzer.py, ...)
# time (Used in: radar_data_reader\core\app_controller.py)
# tkinter (Used in: radar_data_reader\__main__.py, radar_data_reader\core\app_controller.py, radar_data_reader\gui\config_frames.py, ...)
# typing (Used in: radar_data_reader\core\app_controller.py, radar_data_reader\core\export_manager.py, radar_data_reader\core\export_profiles.py, ...)
# --- External Dependencies (for pip install) ---
# Found in: radar_data_reader\core\file_reader.py, radar_data_reader\core\struct_parser.py, radar_data_reader\core\structures\generic_structures.py
# Version not detected in analysis env
numpy
# Found in: radar_data_reader\core\app_controller.py, radar_data_reader\core\flight_analyzer.py, radar_data_reader\core\segment_processor.py
# Version not detected in analysis env
pandas

Binary file not shown.

Binary file not shown.

View File

@ -4,7 +4,7 @@
"last_out_output_dir": "C:/src/____GitProjects/radar_data_reader/flight_workspace/250515_122252_Flight", "last_out_output_dir": "C:/src/____GitProjects/radar_data_reader/flight_workspace/250515_122252_Flight",
"last_rec_output_dir": "C:\\src\\____GitProjects\\radar_data_reader\\_rec", "last_rec_output_dir": "C:\\src\\____GitProjects\\radar_data_reader\\_rec",
"last_flight_folder": "C:/__Voli/Volo_12_25maggio2025/rec", "last_flight_folder": "C:/__Voli/Volo_12_25maggio2025/rec",
"last_flight_workspace_parent_dir": "C:\\src\\____GitProjects\\radar_data_reader\\flight_workspace", "last_flight_workspace_parent_dir": "C:/src/____GitProjects/radar_data_reader/flight_workspace/250515_122252_Flight",
"active_out_export_profile_name": "gsp_data", "active_out_export_profile_name": "gsp_data",
"export_profiles": [ "export_profiles": [
{ {
@ -410,7 +410,7 @@
"folder_name_template": "{StartBatch}-{EndBatch}_{Segment}" "folder_name_template": "{StartBatch}-{EndBatch}_{Segment}"
}, },
"g_reconverter_options": { "g_reconverter_options": {
"cpp_executable_path": "C:/src/GRIFO-E/REP/Projects/Tools/wsLuna/g_reconvert/Debug/g_reconvert.exe", "cpp_executable_path": "C:/src/____GitProjects/radar_data_reader/cpp_tools/g_reconvert.exe",
"analyze_only": false, "analyze_only": false,
"no_sign": false, "no_sign": false,
"use_fw_header": false, "use_fw_header": false,

View File

@ -5,6 +5,8 @@ Main entry point for the Radar Data Reader application.
import tkinter as tk import tkinter as tk
import logging import logging
from pathlib import Path from pathlib import Path
# --- NUOVO IMPORT ---
import multiprocessing
from radar_data_reader.gui.main_window import MainWindow from radar_data_reader.gui.main_window import MainWindow
from radar_data_reader.gui.gui_utils import center_window from radar_data_reader.gui.gui_utils import center_window
@ -28,6 +30,8 @@ LOGGING_CONFIG = {
}, },
} }
# Questo percorso potrebbe essere diverso se l'eseguibile viene spostato.
# Sarebbe meglio gestirlo in modo più robusto, ma per ora lo lasciamo così.
PROJECT_ROOT = Path(__file__).parent.parent PROJECT_ROOT = Path(__file__).parent.parent
CONFIG_DIR = PROJECT_ROOT / "config" CONFIG_DIR = PROJECT_ROOT / "config"
CONFIG_FILE_PATH = CONFIG_DIR / "config.json" CONFIG_FILE_PATH = CONFIG_DIR / "config.json"
@ -36,13 +40,17 @@ CONFIG_FILE_PATH = CONFIG_DIR / "config.json"
def main(): def main():
root = None root = None
try: try:
config_manager = ConfigManager(CONFIG_FILE_PATH) # Per un'applicazione distribuita, il config file dovrebbe essere
# in una posizione standard (es. AppData) invece che relativa.
# Per ora, lasciamo così.
config_path = Path("config/config.json").resolve()
config_manager = ConfigManager(config_path)
config_manager.load_config() config_manager.load_config()
controller = AppController(config_manager) controller = AppController(config_manager)
root = tk.Tk() root = tk.Tk()
# Hide the window initially to prevent flickering while it's being built
root.withdraw() root.withdraw()
logger.setup_basic_logging(root, LOGGING_CONFIG) logger.setup_basic_logging(root, LOGGING_CONFIG)
@ -52,24 +60,28 @@ def main():
) )
controller.bind_view(view) controller.bind_view(view)
# Center the main window on the screen before showing it
center_window(root) center_window(root)
view.mainloop() view.mainloop()
except Exception as e: except Exception as e:
log_or_print = ( # Usa il logger se è già attivo, altrimenti stampa.
logger.get_logger(__name__) if logger._logging_system_active else print log_or_print = logger.get_logger(__name__) if logger._logging_system_active else print
)
if callable(log_or_print): # Gestisce il caso in cui il logger potrebbe non essere un oggetto Logger valido
log_or_print(f"A critical error occurred: {e}") if isinstance(log_or_print, logging.Logger):
else:
log_or_print.critical(f"A critical error occurred: {e}", exc_info=True) log_or_print.critical(f"A critical error occurred: {e}", exc_info=True)
else:
print(f"A critical error occurred: {e}")
if root: if root:
root.destroy() root.destroy()
if __name__ == "__main__": if __name__ == "__main__":
main() # --- MODIFICA CRUCIALE PER PYINSTALLER ---
# Questa chiamata è essenziale per il corretto funzionamento di multiprocessing
# quando l'applicazione è "congelata" in un eseguibile.
# Deve essere la prima istruzione dentro il blocco if __name__ == "__main__".
multiprocessing.freeze_support()
main()

View File

@ -6,10 +6,10 @@
import re import re
# --- Version Data (Generated) --- # --- Version Data (Generated) ---
__version__ = "v.0.0.0.39-0-g4066d4b" __version__ = "v.0.0.0.41-0-g00f0f7e"
GIT_COMMIT_HASH = "4066d4b92bffb9779b5bb530ff48d938a3f3fc95" GIT_COMMIT_HASH = "00f0f7e8086e86e7ae109ea46f8004bc15c5bd5b"
GIT_BRANCH = "master" GIT_BRANCH = "master"
BUILD_TIMESTAMP = "2025-07-14T13:43:12.150911+00:00" BUILD_TIMESTAMP = "2025-07-15T09:22:05.627361+00:00"
IS_GIT_REPO = True IS_GIT_REPO = True
# --- Default Values (for comparison or fallback) --- # --- Default Values (for comparison or fallback) ---

39
requirements.txt Normal file
View File

@ -0,0 +1,39 @@
# Requirements generated by DependencyAnalyzer for radar_data_reader
# Python Version (analysis env): 3.13.5
# --- Standard Library Modules Used (part of Python 3.13.5) ---
# cProfile (Used in: radar_data_reader\core\file_reader.py)
# collections (Used in: radar_data_reader\core\file_reader.py)
# copy (Used in: radar_data_reader\gui\profile_editor_window.py)
# csv (Used in: radar_data_reader\core\app_controller.py, radar_data_reader\core\flight_analyzer.py, radar_data_reader\core\out_processor.py, ...)
# ctypes (Used in: radar_data_reader\core\app_controller.py, radar_data_reader\core\struct_parser.py, radar_data_reader\core\structures\base_structures.py, ...)
# dataclasses (Used in: radar_data_reader\core\export_profiles.py, radar_data_reader\core\structures\base_structures.py, radar_data_reader\core\structures\cdpsts_structures.py, ...)
# datetime (Used in: radar_data_reader\core\app_controller.py, radar_data_reader\core\flight_analyzer.py)
# enum (Used in: radar_data_reader\core\data_enums.py)
# inspect (Used in: radar_data_reader\gui\profile_editor_window.py)
# json (Used in: radar_data_reader\core\app_controller.py, radar_data_reader\core\out_processor.py, radar_data_reader\core\segment_processor.py, ...)
# logging (Used in: radar_data_reader\__main__.py, radar_data_reader\core\file_reader.py, radar_data_reader\gui\main_window.py, ...)
# math (Used in: radar_data_reader\core\structures\d1553_structures.py)
# multiprocessing (Used in: radar_data_reader\core\app_controller.py, radar_data_reader\core\cpp_runner.py, radar_data_reader\core\file_reader.py, ...)
# os (Used in: radar_data_reader\core\app_controller.py, radar_data_reader\core\cpp_runner.py, radar_data_reader\core\export_manager.py, ...)
# pathlib (Used in: radar_data_reader\__main__.py, radar_data_reader\core\app_controller.py, radar_data_reader\core\export_manager.py, ...)
# pstats (Used in: radar_data_reader\core\file_reader.py)
# queue (Used in: radar_data_reader\core\app_controller.py, radar_data_reader\core\export_manager.py, radar_data_reader\core\file_reader.py, ...)
# re (Used in: radar_data_reader\_version.py, radar_data_reader\core\app_controller.py, radar_data_reader\core\cpp_runner.py, ...)
# shutil (Used in: radar_data_reader\core\app_controller.py, radar_data_reader\core\export_manager.py)
# subprocess (Used in: radar_data_reader\core\app_controller.py, radar_data_reader\core\cpp_runner.py, radar_data_reader\core\export_manager.py, ...)
# sys (Used in: radar_data_reader\core\app_controller.py)
# threading (Used in: radar_data_reader\core\app_controller.py, radar_data_reader\core\export_manager.py, radar_data_reader\core\flight_analyzer.py, ...)
# time (Used in: radar_data_reader\core\app_controller.py)
# tkinter (Used in: radar_data_reader\__main__.py, radar_data_reader\core\app_controller.py, radar_data_reader\gui\config_frames.py, ...)
# typing (Used in: radar_data_reader\core\app_controller.py, radar_data_reader\core\export_manager.py, radar_data_reader\core\export_profiles.py, ...)
# --- External Dependencies (for pip install) ---
# Found in: radar_data_reader\core\file_reader.py, radar_data_reader\core\struct_parser.py, radar_data_reader\core\structures\generic_structures.py
# Version not detected in analysis env
numpy
# Found in: radar_data_reader\core\app_controller.py, radar_data_reader\core\flight_analyzer.py, radar_data_reader\core\segment_processor.py
# Version not detected in analysis env
pandas