mirror of https://gitlab.com/pamhyr/pamhyr2
RunSolver: Fix #15 and minor change.
parent
45afdc25f9
commit
3ff0883eca
|
|
@ -182,21 +182,30 @@ class SolverLogWindow(PamhyrWindow):
|
||||||
self._alarm.timeout.connect(self.update)
|
self._alarm.timeout.connect(self.update)
|
||||||
|
|
||||||
def _log(self, msg, color=None):
|
def _log(self, msg, color=None):
|
||||||
if msg is str:
|
if type(msg) is str:
|
||||||
|
logger.info(f"solver: {msg}")
|
||||||
|
|
||||||
msg = msg.rsplit('\n')[0]
|
msg = msg.rsplit('\n')[0]
|
||||||
|
|
||||||
if color is not None:
|
if color is not None:
|
||||||
msg = f"<font color=\"{color}\">" + msg + "</font>"
|
msg = f"<font color=\"{color}\">" + msg + "</font>"
|
||||||
|
|
||||||
self.find(QTextEdit, "textEdit").append(msg)
|
self.find(QTextEdit, "textEdit").append(msg)
|
||||||
|
elif type(msg) is int:
|
||||||
|
logger.info(f"solver: Returns {msg}")
|
||||||
|
|
||||||
elif msg is int:
|
|
||||||
color = "blue" if msg == 0 else "red"
|
color = "blue" if msg == 0 else "red"
|
||||||
self.find(QTextEdit, "textEdit")\
|
self.find(QTextEdit, "textEdit")\
|
||||||
.append(f"<font color=\"{color}\">" +
|
.append(f"<font color=\"{color}\">" +
|
||||||
f" *** Finished with code {msg}" +
|
f" *** Finished with code {msg}" +
|
||||||
"</font>")
|
"</font>")
|
||||||
|
|
||||||
|
self.statusbar.showMessage(
|
||||||
|
"Done" if msg == 0 else "Failed",
|
||||||
|
3000
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
if self._solver.is_stoped():
|
if self._solver.is_stoped():
|
||||||
self.find(QAction, "action_start").setEnabled(True)
|
self.find(QAction, "action_start").setEnabled(True)
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,9 @@
|
||||||
<family>Monospace</family>
|
<family>Monospace</family>
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="locale">
|
||||||
|
<locale language="English" country="Europe"/>
|
||||||
|
</property>
|
||||||
<property name="documentTitle">
|
<property name="documentTitle">
|
||||||
<string notr="true"/>
|
<string notr="true"/>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue