Skip to content

Commit 8eb727f

Browse files
committed
final version of 1.3.7
read change log of 1.3.7 for full version
1 parent cf8a9d6 commit 8eb727f

File tree

4 files changed

+53
-43
lines changed

4 files changed

+53
-43
lines changed

SaveStateTools.pyw

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ class PackagingDialog(QDialog):
419419

420420
self.radio_onefile = QRadioButton("One-File (single .exe, slower startup)")
421421
self.radio_onedir = QRadioButton("One-Folder (folder with .exe, faster startup)")
422-
self.radio_onedir.setChecked(True) # Pre-seleziona One-Folder (spesso preferito)
422+
self.radio_onefile.setChecked(True) # Pre-seleziona One-File invece di One-Folder
423423

424424
layout.addWidget(self.radio_onefile)
425425
layout.addWidget(self.radio_onedir)
@@ -807,8 +807,10 @@ class TranslatorToolWindow(QMainWindow):
807807
self.log_output.appendHtml(html_message)
808808
else:
809809
# Messaggio normale (info e success)
810-
# Non aggiungiamo il prefisso qui per non duplicarlo se già presente nel messaggio
811-
self.log_output.appendPlainText(message)
810+
# Usa sempre appendHtml per resettare il formato precedente.
811+
# Assicura che il messaggio sia escapato per sicurezza.
812+
escaped_message = message.replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;')
813+
self.log_output.appendHtml(escaped_message) # Modificato da appendPlainText
812814

813815
self.log_output.moveCursor(QTextCursor.MoveOperation.End)
814816

SplashScreen/splash.png

-659 KB
Binary file not shown.

main.py

Lines changed: 48 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@
2020
from SaveState_gui import MainWindow # , ENGLISH_TRANSLATOR, CURRENT_TRANSLATOR # Importa da SaveState_gui
2121
from SaveState_gui import SHARED_MEM_KEY, LOCAL_SERVER_NAME # Importa costanti
2222

23+
# --- NUOVO IMPORT ---
24+
try:
25+
import pyi_splash # type: ignore # Questo modulo esiste solo quando l'app è pacchettizzata con PyInstaller
26+
except ImportError:
27+
pyi_splash = None # Imposta a None se non trovato (es. quando non si esegue da bundle)
28+
# --- FINE NUOVO IMPORT ---
29+
2330
# --- Helper Function for Cleanup ---
2431
def cleanup_instance_lock(local_server, shared_memory):
2532
"""Closes the local server and releases the shared memory."""
@@ -172,30 +179,30 @@ def cleanup_instance_lock(local_server, shared_memory):
172179

173180
# === Splash Screen ===
174181
# Only show splash screen if running as a bundled executable
175-
if getattr(sys, 'frozen', False):
176-
logging.debug("Creating and showing splash screen (frozen app)...")
177-
try:
178-
splash_image_path_relative = "SplashScreen/splash.png"
179-
splash_image_path_absolute = resource_path(splash_image_path_relative)
180-
logging.info(f"Attempting to load splash image from: {splash_image_path_absolute}") # Log del percorso calcolato
181-
182-
splash_pixmap = QPixmap(splash_image_path_absolute)
183-
if splash_pixmap.isNull():
184-
logging.warning(f"QSplashScreen: Failed to load pixmap from {splash_image_path_absolute}. Image might be missing, corrupt, or path incorrect in bundle.")
185-
else:
186-
logging.info(f"QSplashScreen: Pixmap loaded successfully from {splash_image_path_absolute}.")
187-
splash = QSplashScreen(splash_pixmap)
188-
splash.setMask(splash_pixmap.mask()) # Per trasparenza, se l'immagine ha un canale alpha
189-
splash.show()
190-
# Show initial message IMMEDIATELY after showing splash
191-
splash.showMessage("Inizializzazione applicazione...", Qt.AlignmentFlag.AlignBottom | Qt.AlignmentFlag.AlignCenter, Qt.GlobalColor.white)
192-
app.processEvents() # Force display of splash screen NOW
193-
logging.debug("QSplashScreen: Splash screen shown.")
194-
except Exception as e_splash_load:
195-
logging.error(f"QSplashScreen: Error during splash screen loading/showing: {e_splash_load}", exc_info=True)
196-
# Non fatale, l'app può continuare senza splash
197-
else:
198-
logging.debug("Skipping splash screen (not a frozen app).")
182+
# if getattr(sys, 'frozen', False):
183+
# logging.debug("Creating and showing splash screen (frozen app)...")
184+
# try:
185+
# splash_image_path_relative = "SplashScreen/splash.png"
186+
# splash_image_path_absolute = resource_path(splash_image_path_relative)
187+
# logging.info(f"Attempting to load splash image from: {splash_image_path_absolute}") # Log del percorso calcolato
188+
189+
# splash_pixmap = QPixmap(splash_image_path_absolute)
190+
# if splash_pixmap.isNull():
191+
# logging.warning(f"QSplashScreen: Failed to load pixmap from {splash_image_path_absolute}. Image might be missing, corrupt, or path incorrect in bundle.")
192+
# else:
193+
# logging.info(f"QSplashScreen: Pixmap loaded successfully from {splash_image_path_absolute}.")
194+
# # splash = QSplashScreen(splash_pixmap)
195+
# # splash.setMask(splash_pixmap.mask()) # Per trasparenza, se l'immagine ha un canale alpha
196+
# # splash.show()
197+
# # # Show initial message IMMEDIATELY after showing splash
198+
# # splash.showMessage("Inizializzazione applicazione...", Qt.AlignmentFlag.AlignBottom | Qt.AlignmentFlag.AlignCenter, Qt.GlobalColor.white)
199+
# # app.processEvents() # Force display of splash screen NOW
200+
# # logging.debug("QSplashScreen: Splash screen shown.")
201+
# except Exception as e_splash_load:
202+
# logging.error(f"QSplashScreen: Error during splash screen loading/showing: {e_splash_load}", exc_info=True)
203+
# # Non fatale, l'app può continuare senza splash
204+
# else:
205+
# logging.debug("Skipping splash screen (not a frozen app).")
199206
# === Fine Splash Screen ===
200207

201208
except Exception as e_app_init:
@@ -215,7 +222,7 @@ def cleanup_instance_lock(local_server, shared_memory):
215222
if not shared_memory.attach():
216223
logging.critical(f"Failed to attach to own shared memory: {shared_memory.errorString()}")
217224
# Non possiamo continuare senza memoria condivisa
218-
if splash: splash.close() # Close splash before exit
225+
# if splash: splash.close() # Close splash before exit
219226
sys.exit(1)
220227

221228
# Crea server locale per ricevere segnali da altre istanze
@@ -229,7 +236,7 @@ def cleanup_instance_lock(local_server, shared_memory):
229236
logging.error(f"Unable to start local server '{LOCAL_SERVER_NAME}': {local_server.errorString()}")
230237
# Pulisci la memoria condivisa prima di uscire
231238
cleanup_instance_lock(local_server, shared_memory)
232-
if splash: splash.close() # Close splash before exit
239+
# if splash: splash.close() # Close splash before exit
233240
sys.exit(1) # Esci se il server non parte
234241
else:
235242
logging.info(f"Local server listening on: {local_server.fullServerName()}")
@@ -243,18 +250,18 @@ def cleanup_instance_lock(local_server, shared_memory):
243250
app.aboutToQuit.connect(lambda: cleanup_instance_lock(local_server, shared_memory))
244251

245252
# --- Caricamento Impostazioni (senza applicazione traduttore qui) ---
246-
if splash: # Aggiorna messaggio se lo splash è attivo
247-
splash.showMessage("Caricamento impostazioni...", Qt.AlignmentFlag.AlignBottom | Qt.AlignmentFlag.AlignCenter, Qt.GlobalColor.white)
248-
app.processEvents()
253+
# if splash: # Aggiorna messaggio se lo splash è attivo
254+
# splash.showMessage("Caricamento impostazioni...", Qt.AlignmentFlag.AlignBottom | Qt.AlignmentFlag.AlignCenter, Qt.GlobalColor.white)
255+
# app.processEvents()
249256
logging.info("Loading settings...")
250257
current_settings, is_first_launch = settings_manager.load_settings()
251258
logging.info("Settings loaded.")
252259
# --- Fine Caricamento Impostazioni ---
253260

254261
# --- Creazione Finestra Principale e gestione primo avvio ---
255-
if splash: # Aggiorna messaggio
256-
splash.showMessage("Creazione interfaccia utente...", Qt.AlignmentFlag.AlignBottom | Qt.AlignmentFlag.AlignCenter, Qt.GlobalColor.white)
257-
app.processEvents()
262+
# if splash: # Aggiorna messaggio
263+
# splash.showMessage("Creazione interfaccia utente...", Qt.AlignmentFlag.AlignBottom | Qt.AlignmentFlag.AlignCenter, Qt.GlobalColor.white)
264+
# app.processEvents()
258265
# Crea la finestra principale, passando gli handler log
259266
# qt_log_handler è già definito sopra
260267
# console_handler è definito sopra
@@ -272,9 +279,9 @@ def cleanup_instance_lock(local_server, shared_memory):
272279

273280

274281
if is_first_launch:
275-
if splash: # Aggiorna messaggio
276-
splash.showMessage("Configurazione iniziale...", Qt.AlignmentFlag.AlignBottom | Qt.AlignmentFlag.AlignCenter, Qt.GlobalColor.white)
277-
app.processEvents()
282+
# if splash: # Aggiorna messaggio
283+
# splash.showMessage("Configurazione iniziale...", Qt.AlignmentFlag.AlignBottom | Qt.AlignmentFlag.AlignCenter, Qt.GlobalColor.white)
284+
# app.processEvents()
278285
logging.info("First launch detected, showing settings dialog.")
279286
# Importa SettingsDialog qui per evitare dipendenze circolari a livello di modulo
280287
from dialogs.settings_dialog import SettingsDialog
@@ -316,22 +323,23 @@ def cleanup_instance_lock(local_server, shared_memory):
316323

317324
window.show()
318325
logging.info("Starting Qt application event loop...")
319-
if splash: # Chiudi lo splash ora che la finestra è mostrata
320-
splash.finish(window)
321-
logging.debug("Splash screen finished.")
326+
if pyi_splash:
327+
logging.debug("Closing PyInstaller splash screen...")
328+
pyi_splash.close()
329+
logging.debug("Splash screen close command sent.")
322330
exit_code = app.exec() # Avvia loop eventi GUI
323331
logging.info(f"Qt application event loop finished with exit code: {exit_code}")
324332

325333
except ImportError as e_imp:
326334
logging.critical(f"Import error during GUI setup: {e_imp}", exc_info=True)
327335
# Prova a chiudere lo splash se esiste
328-
if splash: splash.close()
336+
# if splash: splash.close()
329337
QMessageBox.critical(None, "Errore Import", f"Errore critico: libreria mancante.\\n{e_imp}\\nL'applicazione non può avviarsi.")
330338
exit_code = 1
331339
except Exception as e_gui_init: # Cattura altri errori during l'init della GUI
332340
logging.critical(f"Fatal error during GUI initialization: {e_gui_init}", exc_info=True)
333341
# Prova a chiudere lo splash se esiste
334-
if splash: splash.close()
342+
# if splash: splash.close()
335343
# Prova a mostrare un messaggio di errore base se possibile
336344
try:
337345
QMessageBox.critical(None, "Errore Avvio", f"Errore fatale during l'inizializzazione della GUI:\\n{e_gui_init}")

splash.png

382 KB
Loading

0 commit comments

Comments
 (0)