mirror of https://gitlab.com/pamhyr/pamhyr2
SolverLogFileWindow: Add exeption to fix crash for #48.
parent
fb8b5aa77f
commit
c3faf45f75
|
|
@ -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,16 +81,20 @@ class SolverLogFileWindow(PamhyrWindow):
|
||||||
self.open_on_editor)
|
self.open_on_editor)
|
||||||
|
|
||||||
def setup_text(self):
|
def setup_text(self):
|
||||||
|
try:
|
||||||
with open(self._file_name, "r") as f:
|
with open(self._file_name, "r") as f:
|
||||||
for line in f:
|
for line in f:
|
||||||
line = line.rstrip()
|
line = line.rstrip()
|
||||||
self.find(QTextEdit, "textEdit").append(line)
|
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):
|
||||||
|
try:
|
||||||
p = QProcess(self)
|
p = QProcess(self)
|
||||||
|
|
||||||
cmd = self._config.editor
|
cmd = self._config.editor
|
||||||
|
|
@ -103,3 +107,5 @@ class SolverLogFileWindow(PamhyrWindow):
|
||||||
p.start(
|
p.start(
|
||||||
exe, args,
|
exe, args,
|
||||||
)
|
)
|
||||||
|
except Exception as e:
|
||||||
|
logger_exception(e)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue