fixes before release

This commit is contained in:
2026-08-10 16:47:32 -07:00
parent 074a0681b9
commit 1e7fca49f2
6 changed files with 35 additions and 21 deletions
+17 -12
View File
@@ -19,7 +19,7 @@ from queue import Empty
from copy import deepcopy
from pathlib import Path
from datetime import datetime
from multiprocessing import Process, current_process, freeze_support, Queue
from multiprocessing import Process, current_process, freeze_support, Queue, set_start_method
# External library imports
import psutil
@@ -2038,7 +2038,7 @@ class MainApplication(QMainWindow):
msgbox.setWindowTitle(f"Warning - {APP_NAME.upper()}")
message = (
f"{APP_NAME.upper} has encountered an error processing the file {title}.<br><br>"
f"{APP_NAME.upper()} has encountered an error processing the file {title}.<br><br>"
"This error was likely due to incorrect parameters on the right side of the screen and not an error with your data. "
"Processing of the remaining files continues in the background and this participant will be ignored in the analysis. "
f"If you think the parameters on the right side are correct for your data, raise an issue <a href='https://git.research.dezeeuw.ca/tyler/{APP_NAME}/issues'>here</a>.<br><br>"
@@ -2449,8 +2449,9 @@ def exception_hook(exc_type, exc_value, exc_traceback):
show_critical_error(error_msg)
# Exit the app after user acknowledges
sys.exit(1)
if getattr(sys, 'frozen', False):
sys.exit(1)
def show_critical_error(error_msg):
msg_box = QMessageBox()
@@ -2459,22 +2460,25 @@ def show_critical_error(error_msg):
if PLATFORM_NAME == "darwin":
log_path = os.path.join(os.path.dirname(sys.executable), "../../../flares.log")
log_path2 = os.path.join(os.path.dirname(sys.executable), "../../../flares_error.log")
error_path = os.path.join(os.path.dirname(sys.executable), "../../../flares_error.log")
save_path = os.path.join(os.path.dirname(sys.executable), "../../../flares_autosave.flare")
else:
log_path = os.path.join(os.getcwd(), "flares.log")
log_path2 = os.path.join(os.getcwd(), "flares_error.log")
error_path = os.path.join(os.getcwd(), "flares_error.log")
save_path = os.path.join(os.getcwd(), "flares_autosave.flare")
shutil.copy(log_path, log_path2)
log_path2 = Path(log_path2).absolute().as_posix()
shutil.copy(log_path, error_path)
error_path = Path(error_path).absolute().as_posix()
autosave_path = Path(save_path).absolute().as_posix()
log_link = f"file:///{log_path2}"
error_link = f"file:///{error_path}"
autosave_link = f"file:///{autosave_path}"
window.save_project(True) #TODO: If the window is the one to crash, the file can't get saved. Could be fine as the window is what was storing the data to begin with?
try:
window.project_manager.save_project(True)
except:
pass
message = (
f"{APP_NAME.upper()} has encountered an unrecoverable error and needs to close.<br><br>"
@@ -2482,7 +2486,7 @@ def show_critical_error(error_msg):
"If the file was saved, it still may not be intact, openable, or contain the correct data. Use the autosave at your own discretion.<br><br>"
f"This unrecoverable error was due to an error with {APP_NAME.upper()} and not your data.<br>"
f"If this crash occured inside a [BETA] branch, it is likely to eventually be fixed.<br>"
f"Please raise an issue <a href='https://git.research.dezeeuw.ca/tyler/{APP_NAME}/issues'>here</a> and attach the error file located at <a href='{log_link}'>{log_path2}</a><br><br>"
f"Please raise an issue <a href='https://git.research.dezeeuw.ca/tyler/{APP_NAME}/issues'>here</a> and attach the error file located at <a href='{error_link}'>{error_path}</a><br><br>"
f"<pre>{error_msg}</pre>"
)
@@ -2583,6 +2587,7 @@ if __name__ == "__main__":
config_init()
freeze_support() # Required for PyInstaller + multiprocessing
set_start_method('spawn', force=True)
# Only run GUI in the main process
if current_process().name == 'MainProcess':