SolverLogFileWindow: Add exeption to fix crash for #48.

dev_dylan
Pierre-Antoine 2026-05-26 16:36:27 +02:00
parent fb8b5aa77f
commit c3faf45f75
1 changed files with 20 additions and 14 deletions

View File

@ -20,7 +20,7 @@ import tempfile
import os import os
from queue import Queue from queue import Queue
from tools import trace, timer from tools import trace, timer, logger_exception
from View.Tools.PamhyrWindow import PamhyrDialog, PamhyrWindow from View.Tools.PamhyrWindow import PamhyrDialog, PamhyrWindow
@ -81,25 +81,31 @@ class SolverLogFileWindow(PamhyrWindow):
self.open_on_editor) self.open_on_editor)
def setup_text(self): def setup_text(self):
with open(self._file_name, "r") as f: try:
for line in f: with open(self._file_name, "r") as f:
line = line.rstrip() for line in f:
self.find(QTextEdit, "textEdit").append(line) line = line.rstrip()
self.find(QTextEdit, "textEdit").append(line)
except Exception as e:
logger_exception(e)
def revert(self): def revert(self):
self.find(QTextEdit, "textEdit").clear() self.find(QTextEdit, "textEdit").clear()
self.setup_text() self.setup_text()
def open_on_editor(self): def open_on_editor(self):
p = QProcess(self) try:
p = QProcess(self)
cmd = self._config.editor cmd = self._config.editor
cmd = cmd.replace("@file", self._file_name) cmd = cmd.replace("@file", self._file_name)
cmd = cmd.split() cmd = cmd.split()
exe = cmd[0] exe = cmd[0]
args = cmd[1:] args = cmd[1:]
p.start( p.start(
exe, args, exe, args,
) )
except Exception as e:
logger_exception(e)