| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | __title__ = "FreeCAD FEM solver report dialog" |
| | __author__ = "Markus Hovorka" |
| | __url__ = "https://www.freecad.org" |
| |
|
| | |
| | |
| |
|
| | |
| | |
| | from PySide import QtGui |
| | from femtools.femutils import getOutputWinColor |
| |
|
| |
|
| | ERROR_COLOR = "Error" |
| | WARNING_COLOR = "Warning" |
| | INFO_COLOR = "Logging" |
| |
|
| |
|
| | class ReportDialog(QtGui.QDialog): |
| |
|
| | def __init__(self, report, title="Report", text=None, parent=None): |
| | super().__init__(parent) |
| | msgDetails = QtGui.QTextEdit() |
| | msgDetails.setReadOnly(True) |
| | msgDetails.setHtml(self._getText(report)) |
| | bttBox = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok) |
| | bttBox.accepted.connect(self.close) |
| | layout = QtGui.QVBoxLayout() |
| | if text is not None: |
| | textLbl = QtGui.QLabel(text) |
| | textLbl.setWordWrap(True) |
| | layout.addWidget(textLbl) |
| | layout.addWidget(msgDetails) |
| | layout.addWidget(bttBox) |
| | self.setWindowTitle(title) |
| | self.setLayout(layout) |
| | self.resize(300, 200) |
| |
|
| | def _getText(self, report): |
| | text = "" |
| | for i in report.infos: |
| | line = "<b>Info:</b> %s" % i |
| | text += "%s<br>" % self._getColoredLine(line, INFO_COLOR) |
| | for w in report.warnings: |
| | line = "<b>Warning:</b> %s" % w |
| | text += "%s<br>" % self._getColoredLine(line, WARNING_COLOR) |
| | for e in report.errors: |
| | line = "<b>Error:</b> %s" % e |
| | text += "%s<br>" % self._getColoredLine(line, ERROR_COLOR) |
| | return text |
| |
|
| | def _getColoredLine(self, text, outputwin_color_type): |
| | return f'<font color="{getOutputWinColor(outputwin_color_type)}">{text}</font>' |
| |
|
| |
|
| | |
| |
|