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