first commit

This commit is contained in:
VALLONGOL 2025-05-12 11:46:21 +02:00
parent ba8ce9a444
commit fae8702e73
3 changed files with 517 additions and 49 deletions

107
README.md
View File

@ -1,16 +1,101 @@
# GUI_g_converter
**Presentazione del Tool (Italiano)**
A brief description of GUI_g_converter.
**Titolo:** g\_reconvert.exe GUI Wrapper
## Features
- Feature 1
- Feature 2
**Introduzione:**
## Getting Started
...
Benvenuti alla presentazione di un nuovo strumento sviluppato per semplificare l'utilizzo dell'eseguibile `g_reconvert.exe`. Questo tool fornisce un'interfaccia grafica intuitiva (GUI) per configurare e lanciare conversioni, eliminando la necessità di gestire manualmente complesse righe di comando.
## Contributing
...
**Il Problema:**
## License
...
L'eseguibile `g_reconvert.exe` è un potente strumento per convertire file `.rec` e gestire vari aspetti del processo di conversione tramite flag da riga di comando. Tuttavia, ricordarsi e digitare correttamente tutti i flag e i percorsi dei file per ogni conversione può essere noioso e incline agli errori.
**La Soluzione:**
Abbiamo sviluppato un wrapper GUI in Python utilizzando Tkinter. Questo tool offre:
* **Interfaccia Intuitiva:** Una finestra singola con schede (tabs) per organizzare in modo logico tutti i parametri di configurazione disponibili per `g_reconvert.exe`.
* **Configurazione Semplificata:** Campi di input per i file di input e output, checkbox per i flag booleani e campi di testo per i parametri con valori.
* **Selezione File/Directory:** Pulsanti "Browse..." dedicati per selezionare facilmente i file di input (`.rec`) e la cartella di destinazione per l'output.
* **Generazione Automatica Nomi File:** Il nome del file di output (`.out`) e del file di log (`.log`) viene generato automaticamente in base al file di input e alla cartella di destinazione selezionata, come in uno script batch tipico.
* **Esecuzione Semplice:** Un singolo pulsante "Run" avvia il processo di conversione.
* **Output in Tempo Reale:** Un'area console integrata visualizza l'output di `g_reconvert.exe` in tempo reale, permettendo di monitorare l'andamento della conversione senza bloccare l'interfaccia. L'output è anche codificato a colori (informazioni, avvisi, errori) per una migliore leggibilità.
* **Gestione Profili:** Possibilità di salvare e caricare configurazioni di parametri come profili JSON, semplificando il riutilizzo delle stesse impostazioni per diverse conversioni.
* **Percorso Eseguibile Persistente:** Il percorso dell'eseguibile di `g_reconvert.exe` viene salvato automaticamente e ricaricato all'avvio dell'applicazione, richiedendo una riconfigurazione manuale solo se necessario.
* **Log GUI Integrato:** Un file di log separato registra le azioni e i messaggi della GUI stessa, utile per il troubleshooting.
**Come Funziona:**
La GUI raccoglie le impostazioni dall'interfaccia utente, costruisce dinamicamente la riga di comando appropriata per `g_reconvert.exe`, e lancia l'eseguibile in un thread di processo separato. L'output standard del subprocess viene catturato e inviato in tempo reale all'area di output nella GUI tramite una coda, evitando il blocco dell'interfaccia principale.
**Benefici:**
* **Facilità d'Uso:** Interfaccia utente intuitiva riduce la curva di apprendimento.
* **Efficienza:** Configurazione rapida e salvataggio/caricamento dei profili.
* **Riduzione Errori:** Elimina errori di digitazione nella riga di comando.
* **Monitoraggio Migliorato:** Visualizzazione del log in tempo reale.
* **Workflow Semplificato:** Gestione centralizzata di tutti i parametri.
**Prossimi Passi (Potenziali):**
* Salvataggio automatico del profilo default all'uscita dell'applicazione.
* Validazione degli input (ad esempio, assicurarsi che i valori numerici siano effettivamente numeri).
* Opzioni per interrompere il processo in corso dalla GUI.
**Conclusioni:**
Questo tool offre un modo semplice ed efficiente per interagire con `g_reconvert.exe`. Fornendo un'interfaccia grafica chiara e funzionalità di gestione dei profili, migliora significativamente l'usabilità e riduce il tempo e gli sforzi richiesti per eseguire conversioni.
Grazie.
---
**Tool Presentation (English)**
**Title:** g\_reconvert.exe GUI Wrapper
**Introduction:**
Welcome to the presentation of a new tool developed to simplify the usage of the `g_reconvert.exe` executable. This tool provides an intuitive Graphical User Interface (GUI) to configure and launch conversions, eliminating the need to manually manage complex command lines.
**The Problem:**
The `g_reconvert.exe` executable is a powerful tool for converting `.rec` files and handling various aspects of the conversion process through command-line flags. However, remembering and correctly typing all the flags and file paths for each conversion can be tedious and error-prone.
**The Solution:**
We have developed a Python GUI wrapper using Tkinter. This tool offers:
* **Intuitive Interface:** A single window with tabs to logically organize all the configuration parameters available for `g_reconvert.exe`.
* **Simplified Configuration:** Input fields for source and output files, checkboxes for boolean flags, and text fields for value-based parameters.
* **Easy File/Directory Selection:** Dedicated "Browse..." buttons to easily select the input `.rec` file and the output destination folder.
* **Automatic File Naming:** The output file (`.out`) and log file (`.log`) names are automatically generated based on the input file and selected destination folder, mirroring a typical batch script approach.
* **Simple Execution:** A single "Run" button initiates the conversion process.
* **Real-time Output:** An integrated console area displays the output of `g_reconvert.exe` in real-time, allowing you to monitor the conversion progress without freezing the interface. The output is also color-coded (info, warnings, errors) for improved readability.
* **Profile Management:** Ability to save and load parameter configurations as JSON profiles, making it easy to reuse the same settings for different conversions.
* **Persistent Executable Path:** The path to the `g_reconvert.exe` executable is automatically saved and reloaded upon application startup, requiring manual reconfiguration only if necessary.
* **Integrated GUI Log:** A separate log file records the GUI's actions and messages, useful for troubleshooting.
**How It Works:**
The GUI collects settings from the user interface, dynamically constructs the appropriate command line for `g_reconvert.exe`, and launches the executable in a separate process thread. The subprocess's standard output is captured and streamed in real-time to the output area in the GUI via a queue, preventing the main interface from freezing.
**Benefits:**
* **Ease of Use:** Intuitive user interface reduces the learning curve.
* **Efficiency:** Quick configuration and profile saving/loading.
* **Reduced Errors:** Eliminates command-line typing mistakes.
* **Improved Monitoring:** Real-time log display.
* **Streamlined Workflow:** Centralized management of all parameters.
**Potential Next Steps:**
* Automatic saving of the default profile upon application exit.
* Input validation (e.g., ensuring numeric values are indeed numbers).
* Options to terminate the running process from the GUI.
**Conclusion:**
This tool provides a user-friendly and efficient way to interact with `g_reconvert.exe`. By offering a clear graphical interface and profile management capabilities, it significantly enhances usability and reduces the time and effort required to perform conversions.
Thank you.

View File

@ -1,24 +1,210 @@
# GUI_g_converter - English Manual
**User Manual (English)**
## Introduction
Welcome to GUI_g_converter. This document provides an overview of how to install, use, and understand the project.
**Title:** User Manual - g\_reconvert.exe GUI Wrapper
## Installation
Describe the installation steps here. For example:
1. Clone the repository: `git clone <repository_url>`
2. Navigate to the project directory: `cd GUI_g_converter`
3. Install dependencies: `pip install -r requirements.txt` (if applicable)
**Version:** 1.0
## Usage
Explain how to run and use the application.
- To run the application: `python -m gui_g_converter`
- Command-line arguments (if any).
- GUI interaction (if any).
**Date:** July 27, 2024
## Development
Information for developers contributing to the project.
- Code structure.
- How to run tests.
**1. Introduction**
## Troubleshooting
Common issues and their solutions.
Welcome to the user manual for the g\_reconvert.exe GUI Wrapper. This tool is designed to provide a simple and intuitive Graphical User Interface (GUI) for the powerful command-line executable `g_reconvert.exe`. The wrapper streamlines the process of configuring and launching conversions, eliminating the need to manually remember and type complex command-line parameters.
This manual will guide you through installation (if applicable), the user interface, parameter configuration, running conversions, profile management, and provide an overview of how the `g_reconvert.exe` executable and the wrapper itself function.
**2. Prerequisites**
To use this tool, you must have the following prerequisites installed on your system:
* **Python:** A compatible version of Python (typically Python 3.x).
* **Python Libraries:** The `tkinter`, `subprocess`, `threading`, `queue`, `json`, `os`, `datetime`, `sys`, and `ttk` libraries. These are generally included in a standard Python installation or can be installed via pip (`pip install tkinter`). Standard libraries like `subprocess`, `threading`, `queue`, `json`, `os`, `datetime`, `sys` are built-in. The `ttk` library is part of `tkinter`.
* **`g_reconvert.exe` Executable:** The `g_reconvert.exe` executable file for your operating system. The GUI tool requires you to specify the path to this executable.
* **Input Files:** The `.rec` files that you wish to convert.
**3. Installation (If Applicable)**
If the tool was provided to you as a Python script (`.py`), no formal installation is required. Simply ensure you have Python and the necessary libraries installed. You can run the application by executing the Python script.
If the tool was provided to you as an executable (e.g., built with PyInstaller), no additional steps are needed beyond obtaining the executable file.
**4. User Interface**
The main window of the g\_reconvert.exe GUI Wrapper is organized as follows:
* **Title Bar:** Displays the application title ("g\_reconvert.exe Interface").
* **Menu Bar:** Contains options for file management and settings (explained in Section 5).
* **g\_reconvert.exe Path:** A label at the top displays the currently configured path to the `g_reconvert.exe` executable. This value is automatically saved and loaded.
* **Tabs (Notebook):** The central area is organized into tabs to logically group the various `g_reconvert.exe` parameters:
* **Input/Output Files:** Configuration of the input file and output destination directory.
* **Main Processing Options:** Primary options for the conversion process.
* **Advanced Config & Numerics:** Advanced settings and numerical parameters.
* **Video Options:** Parameters related to video processing.
* **Execution Control (// flags):** Flags to control execution behavior and verbosity levels.
* **"Run g\_reconvert.exe" Button:** A large button in the center below the tabs to initiate the conversion process. It will turn gray and become disabled while the process is running.
* **Console Output:** A scrollable text area at the bottom of the window that displays the real-time output (stdout and stderr) of the `g_reconvert.exe` executable during execution. Messages of different types (INFO, WARNING, ERROR, CMD, SUCCESS) are color-coded for better readability.
* **Status Bar:** A bar at the very bottom of the window displaying the current application status and informational messages.
**5. Using the Menu Bar**
The menu bar provides the following options:
* **File:**
* **Set g\_reconvert.exe Path:** Opens a dialog to select the `g_reconvert.exe` executable file. This is the only way to change the executable path after the initial loading. The set path is automatically saved to the default profile.
* **Load Profile:** Opens a dialog to select and load a saved parameter configuration from a JSON file.
* **Save Profile:** Opens a dialog to save the current parameter configuration to a JSON file.
* **Save as Default Profile:** Saves the current parameter configuration to the default profile file (`default_launch_profile.json`), which will be automatically loaded upon the next application startup.
* **Open GUI Log File:** Opens the GUI's internal log file (`gui_execution_log.txt`) using the system's default application. This log records events and messages from the GUI itself.
* **Exit:** Closes the application. If a `g_reconvert.exe` process is running, it will ask for confirmation before terminating.
**6. Parameter Configuration**
The tabs organize the `g_reconvert.exe` parameters. The main widgets within each tab are described below:
* **Input/Output Files:**
* **Source Binary File (.rec):\*** Text field and "Browse..." button to select the input `.rec` file. This field is mandatory.
* **Output Directory:** Text field and "Browse..." button to select the folder where the output files will be saved. This field is mandatory unless the "Analyze Only" option is selected.
* Informational note about input and output file requirements.
* **Main Processing Options:** Contains various checkboxes and fields to control the primary conversion process. Widgets are arranged across multiple columns to make the interface more compact.
* **Analyze Only (/a):** Select to only analyze the file without generating output.
* **Don't Save Signal (/nosign):** Select to prevent saving signal data.
* **Use FW Header (/hfw):** Use the firmware header for synchronization.
* **Fix DSP Geopos Bug (/$pbug):** Apply a fix for a potential DSP geopositioning bug.
* **Sync Signal Flows w/ Header (/h):** Synchronize signal flows with the header.
* **Extract Only SW Data (/sw):** Extract only software data.
* **Extract Only DSP Data (/dsp):** Extract only DSP data.
* **Stop on Discontinuity (/ss):** Stop processing if data discontinuity is detected.
* **Dry Run (/dryrun):** Perform a simulation without actually converting the data.
* **Start Save from STBY (/z):** Begin saving data from the standby state.
* **Fix SATA File Date (/d):** Apply a fix to the SATA file date.
* **Examine Some Data (/x):** Perform a preliminary examination of some data.
* **Post Process History (/p) / Level:** Checkbox to enable post-processing. If selected, the "Level:" field becomes active to specify the post-processing level (typically 1).
* **Concatenate REC files (/n):** Text field to specify the number of `.rec` files to concatenate during conversion. The default value is 3.
* **Output Format (/f):** Text field to specify the desired output format.
* **Advanced Config & Numerics:** Contains advanced options and numerical parameters.
* **JSON Config File (/j):** Text field and "..." button to select an external JSON configuration file.
* **g\_reconvert Log File (/l):** Label displaying the path to the log file that will be generated by `g_reconvert.exe`. This path is automatically determined based on the input file and selected output directory.
* **Max Batches (/m):** Text field to specify the maximum number of batches to process.
* **PRI Number (/r):** Text field to specify a PRI number.
* **RBIN Number (/c):** Text field to specify an RBIN number.
* **Video Options:** Contains parameters related to video processing.
* **Output to Rec Results (/vout):** Output video to recording results.
* **Show Video (/vshow):** Display the video during processing (default: Selected).
* **Save Video (/vsave):** Save the processed video (default: Selected).
* **Fix Frame Rate (/vframe):** Apply a fix to the video frame rate.
* **Add AVI Subtitles (/vst):** Add subtitles to AVI files.
* **GPS: Save Track (/gps):** Save the GPS track (default: Selected).
* **HR: Fix Debug Data (/fixhr):** Apply a fix to heart rate debug data.
* **SAR: Save Only SAR (/sar):** Save only SAR data.
* **Execution Control (// flags):** Contains flags that influence execution behavior and verbosity.
* **Verbose Output (//v):** Increase the level of detail in the output.
* **Quiet Mode (//q):** Reduce the output to a minimum. Note: "Verbose Output" and "Quiet Mode" are mutually exclusive.
* **Debug Messages (//d):** Enable debug messages in the output.
* **Silently Overwrite Output (//o):** Overwrite existing output files without prompting for confirmation (default: Selected).
* **Mask Warnings (//w):** Hide warning messages in the output.
* **Mask Errors (//e):** Hide error messages in the output.
**7. Running a Conversion**
Once you have configured the desired parameters:
1. Ensure that the path to `g_reconvert.exe` is correctly set (shown at the top). If not, use "File -> Set g\_reconvert.exe Path".
2. Select the **Source Binary File (.rec)** and the **Output Directory**.
3. Click the **"Run g\_reconvert.exe"** button.
The **Console Output** area will display the command line being executed and the real-time output from the `g_reconvert.exe` process. The **Status Bar** will indicate that the process is running. Once the process completes, the Status Bar will update, and the "Run" button will be re-enabled.
**8. Profile Management**
Profile management allows you to quickly save and reuse parameter configurations:
* **Saving a Profile:** Configure the parameters as desired and select "File -> Save Profile". Choose a name and location for your JSON profile file.
* **Loading a Profile:** Select "File -> Load Profile" and choose a previously saved JSON profile file. The settings stored in that profile will be applied to the interface.
* **Saving as Default Profile:** After setting the options you use most frequently (including the `g_reconvert.exe` path), select "File -> Save as Default Profile". These settings will be loaded automatically each time you start the application.
**9. How the Tool Works Internally**
The GUI wrapper tool functions as follows:
* **Main (GUI) Thread:** Handles the user interface, widgets, and responsiveness. It is responsible for processing events (button clicks, file selections, etc.).
* **Worker (Process Execution) Thread:** When you click "Run," a separate thread is created. This thread is responsible for constructing the command line for `g_reconvert.exe` based on the GUI state and launching the subprocess using `subprocess.Popen`.
* **Queue:** A `queue.Queue` object serves as a safe communication channel between the worker thread and the main thread. The worker thread reads output from the subprocess's stdout (line by line) and puts each line (along with an indication of the message type, if determinable) into the queue. When the subprocess finishes, the worker thread puts a special signal (`None`) into the queue.
* **Polling (Main Thread):** The main thread uses Tkinter's `after` method to periodically check (every 100 milliseconds in the current implementation) if there are new messages in the queue. If it finds messages, it retrieves them from the queue and updates the **Console Output** area in the GUI. When it finds the end-of-process signal (`None`), it stops polling and re-enables the "Run" button.
This multi-threading approach prevents the main thread from freezing while `g_reconvert.exe` is running, keeping the GUI responsive.
**10. About the `g_reconvert.exe` Executable**
This tool is a wrapper for the command-line executable `g_reconvert.exe`. The exact behavior of `g_reconvert.exe` and the precise meaning of each flag depend on its implementation. The GUI tool is based on the command line shown in the provided batch file example.
In general, `g_reconvert.exe` appears to be designed to:
* Convert binary files (with a `.rec` extension in this case) into an output format (`.out`).
* Support the concatenation of multiple consecutive input files (via `/n`).
* Offer various processing options, data extraction (SW, DSP), error handling (`/ss`), execution control (`/dryrun`, `/z`), data correction (`/$pbug`, `/d`, `/x`), and advanced configurations (`/j`, `/m`, `/r`, `/c`).
* Include specific functionalities for processing video and GPS data (`/vshow`, `/vsave`, `/gps`, `/vframe`, `/vst`, `/fixhr`, `/sar`).
* Provide options to control output verbosity (`//v`, `//q`, `//d`) and output file handling (`//o`).
* Write a detailed log file (`/l`).
* May generate additional or support files in a specified base directory (`//b`).
For exact details on the behavior of `g_reconvert.exe` and its flags, you should consult the official documentation or help of the executable itself (if available by running `g_reconvert.exe /?` or similar). The GUI tool provides an interface to *set* these flags in a more user-friendly manner.
**11. In-depth Use Cases**
Here are some examples of how you can use the tool for common conversion scenarios:
* **Use Case 1: Basic Conversion with Concatenation**
* **Objective:** Convert one `.rec` file and the subsequent 2 files, saving the output and log to a specific folder.
* **Steps:**
1. Ensure the `g_reconvert.exe` path is set.
2. In the "Input/Output Files" tab, select the first `.rec` file in the "Source Binary File" field.
3. Select an output destination folder in the "Output Directory" field.
4. In the "Main Processing Options" tab, ensure "Concatenate REC files (/n):" is set to `3` (default value).
5. Keep "Post Process History (/p)" selected (if needed) and set the level (default 1).
6. In the "Video Options" tab, keep "Show Video (/vshow)", "Save Video (/vsave)", and "GPS: Save Track (/gps)" selected as in the batch.
7. In the "Execution Control" tab, keep "Silently Overwrite Output (//o)" selected.
8. Click "Run g\_reconvert.exe".
* **Result:** The tool will construct a command line similar to your batch file, create the output folder (if it doesn't exist), and execute `g_reconvert.exe`. You will see the output in real-time, and upon completion, you will find the `.out` file, the `.log` file, and any other generated files in the selected output folder.
* **Use Case 2: Analysis Without Output**
* **Objective:** Perform a quick analysis of a `.rec` file to check its structure or identify issues, without generating output files.
* **Steps:**
1. Ensure the `g_reconvert.exe` path is set.
2. In the "Input/Output Files" tab, select the `.rec` file in the "Source Binary File" field.
3. Leave the "Output Directory" field empty.
4. In the "Main Processing Options" tab, **select** "Analyze Only (/a)". This will instruct the tool and `g_reconvert.exe` not to require an output directory.
5. Click "Run g\_reconvert.exe".
* **Result:** `g_reconvert.exe` will be executed with the `/a` flag. The output in the console will show the analysis results. No output files will be generated.
* **Use Case 3: Saving and Loading a Specific Configuration**
* **Objective:** Save a non-standard parameter configuration for future reuse.
* **Steps:**
1. Set all desired parameters in the various tabs (e.g., a specific output format, a maximum batch count, disable video saving, enable debug messages).
2. Select "File -> Save Profile". Choose a descriptive name (e.g., "Video Debug Config.json") and a location to save your JSON profile file.
3. To reuse this configuration, start the tool and select "File -> Load Profile", then choose the saved profile file.
* **Result:** The GUI will load all previously saved settings, including the executable path, selected files and directories, and all flags and values.
* **Use Case 4: Setting a Default Configuration for Future Starts**
* **Objective:** Have the tool always start with your preferred settings (including the `g_reconvert.exe` path).
* **Steps:**
1. Set the `g_reconvert.exe` path via "File -> Set g\_reconvert.exe Path".
2. Configure all other desired parameters (e.g., your most frequent output folder, standard processing flags, typical concatenation number).
3. Select "File -> Save as Default Profile".
* **Result:** The current settings will be saved to the `default_launch_profile.json` file (in the same directory as the tool's script/executable). Whenever you start the application, these settings will be loaded automatically.
**12. Troubleshooting**
* **GUI Freezing:** If the GUI freezes and becomes unresponsive, it's likely that `g_reconvert.exe` was not launched correctly in a separate thread or there's an issue with the thread communication. Check the **Console Output** area for any error messages upon startup. Restarting the application might resolve temporary issues.
* **Console Output Errors:** The **Console Output** area will display any errors or warnings generated by `g_reconvert.exe`. Pay attention to messages in red (ERROR) and orange (WARNING). Also, check the `g_reconvert.exe` generated log file (whose path is shown in the "Advanced Config & Numerics" tab) for more detailed information.
* **Files Not Found:** Ensure that the paths to the input `.rec` file and the `g_reconvert.exe` executable are correct. The GUI tool checks for the existence of the input file and the executable before launching the process.
* **Output Folder Issues:** If the conversion fails due to writing issues, verify that the selected output destination folder exists and that the user running the application has write permissions to that folder. The tool attempts to create the folder if it doesn't exist, but permission issues might occur.
* **Profile Issues:** Profile files are in JSON format. If a profile file is corrupted or manually edited incorrectly, it might not load correctly. If you encounter issues with a specific profile, try loading a different one or saving a new profile.
**13. Final Notes**
This tool is a wrapper and relies on the correct functioning of the `g_reconvert.exe` executable. If you encounter conversion issues specific to the data or flags, the problem likely lies within `g_reconvert.exe` itself, and you might need to consult its official documentation or its developer (if available by running `g_reconvert.exe /?` or similar). The GUI tool provides an interface to *set* these flags in a more user-friendly manner.
This manual covers the functionalities of the GUI wrapper based on the current code version and known flags. Future updates to `g_reconvert.exe` or the wrapper might introduce new features or changes.

View File

@ -1,24 +1,221 @@
# GUI_g_converter - Manuale Italiano
**Manuale Utente (Italiano)**
## Introduzione
Benvenuto in GUI_g_converter. Questo documento fornisce una panoramica su come installare, utilizzare e comprendere il progetto.
**Titolo:** Manuale Utente - g\_reconvert.exe GUI Wrapper
## Installazione
Descrivi i passaggi di installazione qui. Ad esempio:
1. Clona il repository: `git clone <repository_url>`
2. Naviga nella directory del progetto: `cd GUI_g_converter`
3. Installa le dipendenze: `pip install -r requirements.txt` (se applicabile)
**Versione:** 1.0
## Utilizzo
Spiega come eseguire e utilizzare l'applicazione.
- Per eseguire l'applicazione: `python -m gui_g_converter`
- Argomenti da riga di comando (se presenti).
- Interazione con la GUI (se presente).
**Data:** 27 Luglio 2024
## Sviluppo
Informazioni per gli sviluppatori che contribuiscono al progetto.
- Struttura del codice.
- Come eseguire i test.
**1. Introduzione**
Benvenuto nel manuale utente per il g\_reconvert.exe GUI Wrapper. Questo strumento è stato progettato per fornire un'interfaccia utente grafica (GUI) semplice e intuitiva per il potente eseguibile a riga di comando `g_reconvert.exe`. Il wrapper semplifica il processo di configurazione e lancio delle conversioni, eliminando la necessità di memorizzare e digitare manualmente complessi parametri da riga di comando.
Questo manuale ti guiderà attraverso l'installazione (se necessaria), l'interfaccia utente, la configurazione dei parametri, l'esecuzione delle conversioni, la gestione dei profili e fornirà una panoramica del funzionamento dell'eseguibile `g_reconvert.exe` e del wrapper stesso.
**2. Prerequisiti**
Per utilizzare questo tool, devi avere i seguenti prerequisiti installati sul tuo sistema:
* **Python:** Una versione compatibile di Python (tipicamente Python 3.x).
* **Librerie Python:** Le librerie `tkinter`, `subprocess`, `threading`, `queue`, `json`, `os`, `datetime`, `sys`, e `ttk`. Queste sono generalmente incluse nell'installazione standard di Python o possono essere installate tramite pip (`pip install tkinter`). Le librerie standard come `subprocess`, `threading`, `queue`, `json`, `os`, `datetime`, `sys` sono integrate. La libreria `ttk` è parte di `tkinter`.
* **Eseguibile `g_reconvert.exe`:** Il file eseguibile `g_reconvert.exe` per il tuo sistema operativo. Il tool GUI richiede che tu specifichi il percorso di questo eseguibile.
* **File di Input:** I file `.rec` che desideri convertire.
**3. Installazione (Se Applicabile)**
Se il tool ti è stato fornito come script Python (`.py`), non è richiesta un'installazione formale. Assicurati semplicemente di avere Python e le librerie necessarie installate. Puoi avviare l'applicazione eseguendo lo script Python.
Se il tool ti è stato fornito come eseguibile (ad esempio, tramite PyInstaller), non sono necessari passaggi aggiuntivi oltre all'ottenimento del file eseguibile.
**4. Interfaccia Utente**
La finestra principale del g\_reconvert.exe GUI Wrapper è organizzata come segue:
* **Barra del Titolo:** Mostra il titolo dell'applicazione ("g\_reconvert.exe Interface").
* **Menu Bar:** Contiene le opzioni per gestire file e impostazioni (spiegate nella Sezione 5).
* **Percorso g\_reconvert.exe:** Un'etichetta in alto mostra il percorso attualmente configurato per l'eseguibile `g_reconvert.exe`. Questo valore viene salvato e caricato automaticamente.
* **Schede (Notebook):** L'area centrale è organizzata in schede per raggruppare logicamente i vari parametri di `g_reconvert.exe`:
* **Input/Output Files:** Configurazione del file di input e della cartella di destinazione.
* **Main Processing Options:** Opzioni principali per il processo di conversione.
* **Advanced Config & Numerics:** Opzioni avanzate e parametri numerici.
* **Video Options:** Parametri relativi all'elaborazione video.
* **Execution Control (// flags):** Flag per controllare il comportamento di esecuzione e il livello di verbosità.
* **Pulsante "Run g\_reconvert.exe":** Un ampio pulsante al centro sotto le schede per avviare il processo di conversione. Diventa grigio e disabilitato mentre il processo è in esecuzione.
* **Console Output:** Un'area di testo scorrevole nella parte inferiore della finestra che visualizza l'output in tempo reale (stdout e stderr) dell'eseguibile `g_reconvert.exe` durante l'esecuzione. Messaggi di diversi tipi (INFO, WARNING, ERROR, CMD, SUCCESS) sono codificati a colori per una migliore leggibilità.
* **Status Bar:** Una barra nella parte inferiore della finestra che mostra lo stato corrente dell'applicazione e messaggi informativi.
**5. Utilizzo del Menu Bar**
Il menu bar fornisce le seguenti opzioni:
* **File:**
* **Set g\_reconvert.exe Path:** Apre un dialogo per selezionare il file eseguibile `g_reconvert.exe`. Questa è l'unica modalità per modificare il percorso dell'eseguibile dopo il caricamento iniziale. Il percorso impostato viene salvato automaticamente nel profilo default.
* **Load Profile:** Apre un dialogo per selezionare e caricare una configurazione di parametri salvata da un file JSON.
* **Save Profile:** Apre un dialogo per salvare la configurazione corrente dei parametri in un file JSON.
* **Save as Default Profile:** Salva la configurazione corrente dei parametri nel file di profilo predefinito (`default_launch_profile.json`), che verrà caricato automaticamente al prossimo avvio dell'applicazione.
* **Open GUI Log File:** Apre il file di log interno della GUI (`gui_execution_log.txt`) con l'applicazione predefinita del sistema. Questo log registra gli eventi e i messaggi della GUI stessa.
* **Exit:** Chiude l'applicazione. Se un processo di `g_reconvert.exe` è in esecuzione, chiederà conferma prima di terminare.
**6. Configurazione dei Parametri**
Le schede organizzano i parametri di `g_reconvert.exe`. Di seguito sono descritti i widget principali:
* **Input/Output Files:**
* **Source Binary File (.rec):\*** Campo di testo e pulsante "Browse..." per selezionare il file di input `.rec`. Questo campo è obbligatorio.
* **Output Directory:** Campo di testo e pulsante "Browse..." per selezionare la cartella dove verranno salvati i file di output. Questo campo è obbligatorio a meno che non sia selezionata l'opzione "Analyze Only".
* Nota informativa sui requisiti dei file di input e output.
* **Main Processing Options:** Contiene vari checkbox e campi per controllare il processo di conversione principale. I widget sono distribuiti su più colonne per compattare l'interfaccia.
* **Analyze Only (/a):** Selezionare per eseguire solo l'analisi del file senza generare output.
* **Don't Save Signal (/nosign):** Selezionare per non salvare i dati di segnale.
* **Use FW Header (/hfw):** Utilizza l'header del firmware per la sincronizzazione.
* **Fix DSP Geopos Bug (/$pbug):** Applica una correzione per un potenziale bug di geoposizionamento DSP.
* **Sync Signal Flows w/ Header (/h):** Sincronizza i flussi di segnale con l'header.
* **Extract Only SW Data (/sw):** Estrae solo i dati software.
* **Extract Only DSP Data (/dsp):** Estrae solo i dati DSP.
* **Stop on Discontinuity (/ss):** Ferma l'elaborazione in caso di discontinuità nei dati.
* **Dry Run (/dryrun):** Esegue una "simulazione" senza effettuare la conversione effettiva.
* **Start Save from STBY (/z):** Inizia il salvataggio dei dati dallo stato di standby.
* **Fix SATA File Date (/d):** Applica una correzione alla data del file SATA.
* **Examine Some Data (/x):** Esegue un esame preliminare di alcuni dati.
* **Post Process History (/p) / Level:** Checkbox per abilitare il post-processing. Se selezionato, il campo "Level:" diventa attivo per specificare il livello di post-processing (generalmente 1).
* **Concatenate REC files (/n):** Campo di testo per specificare il numero di file `.rec` da concatenare durante la conversione. Il valore di default è 3.
* **Output Format (/f):** Campo di testo per specificare il formato di output desiderato.
* **Advanced Config & Numerics:** Contiene opzioni avanzate e parametri numerici.
* **JSON Config File (/j):** Campo di testo e pulsante "..." per selezionare un file di configurazione JSON esterno.
* **g\_reconvert Log File (/l):** Etichetta che mostra il percorso del file di log che verrà generato da `g_reconvert.exe`. Questo percorso viene determinato automaticamente in base al file di input e alla cartella di output selezionata.
* **Max Batches (/m):** Campo di testo per specificare il numero massimo di batch da elaborare.
* **PRI Number (/r):** Campo di testo per specificare un numero PRI.
* **RBIN Number (/c):** Campo di testo per specificare un numero RBIN.
* **Video Options:** Contiene parametri relativi all'elaborazione video.
* **Output to Rec Results (/vout):** Invia l'output video ai risultati di registrazione.
* **Show Video (/vshow):** Visualizza il video durante l'elaborazione (default: Selezionato).
* **Save Video (/vsave):** Salva il video elaborato (default: Selezionato).
* **Fix Frame Rate (/vframe):** Applica una correzione al frame rate del video.
* **Add AVI Subtitles (/vst):** Aggiunge sottotitoli ai file AVI.
* **GPS: Save Track (/gps):** Salva la traccia GPS (default: Selezionato).
* **HR: Fix Debug Data (/fixhr):** Applica una correzione ai dati di debug della frequenza cardiaca.
* **SAR: Save Only SAR (/sar):** Salva solo i dati SAR.
* **Execution Control (// flags):** Contiene flag che influenzano il comportamento di esecuzione e la verbosità.
* **Verbose Output (//v):** Aumenta il livello di dettaglio dell'output.
* **Quiet Mode (//q):** Riduce l'output al minimo. Nota: "Verbose Output" e "Quiet Mode" sono mutuamente esclusivi.
* **Debug Messages (//d):** Abilita i messaggi di debug nell'output.
* **Silently Overwrite Output (//o):** Sovrascrive i file di output esistenti senza chiedere conferma (default: Selezionato).
* **Mask Warnings (//w):** Nasconde i messaggi di avviso nell'output.
* **Mask Errors (//e):** Nasconde i messaggi di errore nell'output.
**7. Esecuzione della Conversione**
Una volta configurati i parametri desiderati:
1. Assicurati che il percorso di `g_reconvert.exe` sia impostato correttamente (mostrato in alto). Se non lo è, utilizza "File -> Set g\_reconvert.exe Path".
2. Seleziona il **Source Binary File (.rec)** e l'**Output Directory**.
3. Fai clic sul pulsante **"Run g\_reconvert.exe"**.
L'area di **Console Output** mostrerà la riga di comando che viene eseguita e l'output in tempo reale del processo `g_reconvert.exe`. La **Status Bar** indicherà che il processo è in esecuzione. Al termine, la Status Bar si aggiornerà e il pulsante "Run" verrà riabilitato.
**8. Gestione Profili**
La gestione dei profili ti permette di salvare e riutilizzare rapidamente le configurazioni dei parametri:
* **Salvare un Profilo:** Configura i parametri come desiderato e seleziona "File -> Save Profile". Scegli un nome e un percorso per il tuo file di profilo JSON.
* **Caricare un Profilo:** Seleziona "File -> Load Profile" e scegli un file di profilo JSON salvato in precedenza. Le impostazioni salvate in quel profilo verranno applicate all'interfaccia.
* **Salvare come Profilo Default:** Dopo aver impostato le opzioni che usi più frequentemente (incluso il percorso di `g_reconvert.exe`), seleziona "File -> Save as Default Profile". Queste impostazioni verranno caricate automaticamente ogni volta che avvierai l'applicazione.
**9. Funzionamento Interno del Tool**
Il tool GUI wrapper funziona in questo modo:
* **Thread Principale (GUI):** Gestisce l'interfaccia utente, i widget e la reattività. È responsabile dell'elaborazione degli eventi (clic sui pulsanti, selezione file, ecc.).
* **Thread di Lavoro (Esecuzione Processo):** Quando fai clic su "Run", viene creato un thread separato. Questo thread è responsabile della costruzione della riga di comando per `g_reconvert.exe` basata sullo stato della GUI e dell'avvio del subprocess tramite `subprocess.Popen`.
* **Coda (Queue):** Un oggetto `queue.Queue` funge da canale di comunicazione sicuro tra il thread di lavoro e il thread principale. Il thread di lavoro legge l'output dallo stdout del subprocess (linea per linea) e mette ogni linea (insieme a un'indicazione del tipo di messaggio, se determinabile) nella coda. Quando il subprocess termina, il thread di lavoro mette un segnale speciale (`None`) nella coda.
* **Polling (Thread Principale):** Il thread principale utilizza il metodo `after` di Tkinter per controllare periodicamente (ogni 100 millisecondi nell'implementazione corrente) se ci sono nuovi messaggi nella coda. Se trova messaggi, li estrae dalla coda e aggiorna l'area di **Console Output** nella GUI. Quando trova il segnale di fine processo (`None`), smette di fare il polling e riabilita il pulsante "Run".
Questo approccio multi-threading impedisce che il thread principale si blocchi mentre `g_reconvert.exe` è in esecuzione, mantenendo la GUI reattiva.
**10. Informazioni sull'Eseguibile `g_reconvert.exe`**
Questo tool è un wrapper per l'eseguibile a riga di comando `g_reconvert.exe`. Il comportamento esatto di `g_reconvert.exe` e il significato preciso di ciascun flag dipendono dalla sua implementazione. Il tool GUI si basa sulla riga di comando mostrata nel file batch fornito come esempio.
In generale, `g_reconvert.exe` sembra essere progettato per:
* Convertire file binari (con estensione `.rec` in questo caso) in un formato di output (`.out`).
* Supportare la concatenazione di più file di input consecutivi (tramite `/n`).
* Offrire varie opzioni di elaborazione, estrazione dati (SW, DSP), gestione errori (`/ss`), controllo esecuzione (`/dryrun`, `/z`), correzione dati (`/$pbug`, `/d`, `/x`), e configurazioni avanzate (`/j`, `/m`, `/r`, `/c`).
* Include funzionalità specifiche per l'elaborazione di dati video e GPS (`/vshow`, `/vsave`, `/gps`, `/vframe`, `/vst`, `/fixhr`, `/sar`).
* Fornire opzioni per controllare la verbosità dell'output (`//v`, `//q`, `//d`) e la gestione dei file di output (`//o`).
* Scrivere un file di log dettagliato (`/l`).
* Potrebbe generare file aggiuntivi o di supporto in una directory base specificata (`//b`).
Per i dettagli esatti sul comportamento di `g_reconvert.exe` e sui suoi flag, si consiglia di consultare la documentazione ufficiale o l'help dell'eseguibile stesso (se disponibile eseguendo `g_reconvert.exe /?` o simili). Il tool GUI fornisce un'interfaccia per *impostare* questi flag in modo più user-friendly.
**11. Casi d'Uso Appronfonditi**
Ecco alcuni esempi di come puoi utilizzare il tool per scenari di conversione comuni:
* **Caso d'Uso 1: Conversione Base con Concatenazione**
* **Obiettivo:** Convertire un file `.rec` e i 2 successivi, salvando l'output e il log in una cartella specifica.
* **Passi:**
1. Assicurati che il percorso di `g_reconvert.exe` sia impostato.
2. Nella scheda "Input/Output Files", seleziona il primo file `.rec` nel campo "Source Binary File".
3. Seleziona una cartella di destinazione per l'output nel campo "Output Directory".
4. Nella scheda "Main Processing Options", assicurati che "Concatenate REC files (/n):" sia impostato su `3` (valore di default).
5. Mantieni selezionati "Post Process History (/p)" (se necessario) e imposta il livello (default 1).
6. Nella scheda "Video Options", mantieni selezionati "Show Video (/vshow)", "Save Video (/vsave)" e "GPS: Save Track (/gps)" come nel batch.
7. Nella scheda "Execution Control", mantieni selezionato "Silently Overwrite Output (//o)".
8. Fai clic su "Run g\_reconvert.exe".
* **Risultato:** Il tool costruirà una riga di comando simile a quella del tuo file batch, creerà la cartella di output (se non esiste) ed eseguirà `g_reconvert.exe`. Vedrai l'output in tempo reale e al termine troverai il file `.out`, il file `.log` e altri file generati nella cartella di output selezionata.
* **Caso d'Uso 2: Analisi Senza Output**
* **Obiettivo:** Eseguire un'analisi rapida di un file `.rec` per verificare la sua struttura o identificare problemi, senza generare file di output.
* **Passi:**
1. Assicurati che il percorso di `g_reconvert.exe` sia impostato.
2. Nella scheda "Input/Output Files", seleziona il file `.rec` nel campo "Source Binary File".
3. Lascia vuoto il campo "Output Directory".
4. Nella scheda "Main Processing Options", **seleziona** "Analyze Only (/a)". Questo indicherà al tool e a `g_reconvert.exe` di non richiedere una cartella di output.
5. Fai clic su "Run g\_reconvert.exe".
* **Risultato:** `g_reconvert.exe` verrà eseguito con il flag `/a`. L'output nella console mostrerà i risultati dell'analisi. Non verranno generati file di output.
* **Caso d'Uso 3: Salvataggio e Caricamento di una Configurazione Specifica**
* **Obiettivo:** Salvare una configurazione di parametri non standard per riutilizzarla in futuro.
* **Passi:**
1. Imposta tutti i parametri desiderati nelle varie schede (ad esempio, un formato di output specifico, un numero di batch massimo, disabilita il salvataggio video, abilita messaggi di debug).
2. Seleziona "File -> Save Profile". Scegli un nome descrittivo (ad esempio, "Configurazion
**Manuale Utente (Italiano - Ripresa)**
...continua dalla sezione 11.
* **Caso d'Uso 3: Salvataggio e Caricamento di una Configurazione Specifica**
* **Obiettivo:** Salvare una configurazione di parametri non standard per riutilizzarla in futuro.
* **Passi:**
1. Imposta tutti i parametri desiderati nelle varie schede (ad esempio, un formato di output specifico, un numero di batch massimo, disabilita il salvataggio video, abilita messaggi di debug).
2. Seleziona "File -> Save Profile". Scegli un nome descrittivo (ad esempio, "Configurazione Debug Video.json") e un percorso dove salvare il file di profilo.
3. Per riutilizzare questa configurazione, avvia il tool e seleziona "File -> Load Profile", quindi scegli il file di profilo salvato.
* **Risultato:** La GUI caricherà tutte le impostazioni precedentemente salvate, inclusi il percorso dell'eseguibile, i file e le directory selezionate, e tutti i flag e valori.
* **Caso d'Uso 4: Impostare una Configurazione Default per Avvii Futuri**
* **Obiettivo:** Fare in modo che il tool si avvii sempre con le tue impostazioni preferite (incluso il percorso di `g_reconvert.exe`).
* **Passi:**
1. Imposta il percorso di `g_reconvert.exe` tramite "File -> Set g\_reconvert.exe Path".
2. Configura tutti gli altri parametri desiderati (ad esempio, la tua cartella di output più frequente, i flag di elaborazione standard, il numero di concatenazione tipico).
3. Seleziona "File -> Save as Default Profile".
* **Risultato:** Le impostazioni correnti verranno salvate nel file `default_launch_profile.json` (nella stessa directory dello script/eseguibile del tool). Ogni volta che avvierai l'applicazione, queste impostazioni verranno caricate automaticamente.
**12. Troubleshooting**
* **GUI Bloccata:** Se la GUI si blocca e smette di rispondere, è probabile che `g_reconvert.exe` non sia stato avviato correttamente in un thread separato o che ci sia un problema nella comunicazione tra i thread. Controlla l'area di **Console Output** per eventuali messaggi di errore all'avvio. Riavviare l'applicazione potrebbe risolvere problemi temporanei.
* **Errori nell'Output della Console:** L'area di **Console Output** mostrerà eventuali errori o avvisi generati da `g_reconvert.exe`. Presta attenzione ai messaggi in rosso (ERROR) e arancione (WARNING). Controlla anche il file di log generato da `g_reconvert.exe` (il cui percorso è mostrato nella scheda "Advanced Config & Numerics") per informazioni più dettagliate.
* **File non Trovati:** Assicurati che i percorsi del file di input (`.rec`) e dell'eseguibile `g_reconvert.exe` siano corretti. Il tool GUI verifica l'esistenza del file di input e dell'eseguibile prima di avviare il processo.
* **Problemi con la Cartella di Output:** Se la conversione fallisce a causa di problemi di scrittura, verifica che la cartella di destinazione selezionata esista e che l'utente che esegue l'applicazione abbia i permessi di scrittura in quella cartella. Il tool tenta di creare la cartella se non esiste, ma potrebbero esserci problemi di permessi.
* **Problemi con i Profili:** I file di profilo sono in formato JSON. Se un file di profilo è corrotto o modificato manualmente in modo errato, potrebbe non essere caricato correttamente. Se riscontri problemi con un profilo specifico, prova a caricarne uno diverso o a salvare un nuovo profilo.
**13. Note Finali**
Questo tool è un wrapper e dipende dal corretto funzionamento dell'eseguibile `g_reconvert.exe`. Se riscontri problemi di conversione specifici dei dati o dei flag, è probabile che il problema risieda in `g_reconvert.exe` stesso e potrebbe essere necessario consultare la sua documentazione o il suo sviluppatore.
Questo manuale copre le funzionalità del GUI wrapper basato sulla versione attuale del codice e sui flag conosciuti. Aggiornamenti futuri di `g_reconvert.exe` o del wrapper potrebbero introdurre nuove funzionalità o modifiche.
## Risoluzione dei problemi
Problemi comuni e relative soluzioni.