mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
SolverLogFileWindow: Add exeption to fix crash for #48.
This commit is contained in:
1 parent
fb8b5aa77f
commit
c3faf45f75
1 file changed
+20
-14
@@ -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)
|
||||||
Reference in new issue
Block a user