mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +01:00
extracted function for preparation of text with html symbols
This commit is contained in:
parent
7d72481b86
commit
7107e797f0
2 changed files with 40 additions and 33 deletions
|
|
@ -3,20 +3,23 @@ from Qt import QtWidgets, QtCore
|
|||
from .widgets import ClickableFrame, ExpandBtn
|
||||
|
||||
|
||||
def convert_text_for_html(text):
|
||||
return (
|
||||
text
|
||||
.replace("<", "<")
|
||||
.replace(">", ">")
|
||||
.replace("\n", "<br>")
|
||||
.replace(" ", " ")
|
||||
)
|
||||
|
||||
|
||||
class TracebackWidget(QtWidgets.QWidget):
|
||||
def __init__(self, tb_text, parent):
|
||||
super(TracebackWidget, self).__init__(parent)
|
||||
|
||||
# Modify text to match html
|
||||
# - add more replacements when needed
|
||||
tb_text = (
|
||||
tb_text
|
||||
.replace("<", "<")
|
||||
.replace(">", ">")
|
||||
.replace("\n", "<br>")
|
||||
.replace(" ", " ")
|
||||
)
|
||||
|
||||
tb_text = convert_text_for_html(tb_text)
|
||||
expand_btn = ExpandBtn(self)
|
||||
|
||||
clickable_frame = ClickableFrame(self)
|
||||
|
|
@ -103,6 +106,10 @@ class ErrorMessageBox(QtWidgets.QDialog):
|
|||
self._report_data = report_data
|
||||
self._content_widget = content_widget
|
||||
|
||||
@staticmethod
|
||||
def convert_text_for_html(text):
|
||||
return convert_text_for_html(text)
|
||||
|
||||
def _create_top_widget(self, parent_widget):
|
||||
label_widget = QtWidgets.QLabel(parent_widget)
|
||||
label_widget.setText(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue