fosKeyMan
Loading...
Searching...
No Matches
utils.py
Go to the documentation of this file.
1def format_json_to_html(json_data):
2 r"""
3 Format JSON data as HTML for display in a QTextBrowser.
4 \param json_data: str The JSON data as a formatted string.
5 \return: str The HTML-formatted string for displaying in QTextBrowser.
6 """
7 html_content = f"""
8 <pre style="
9 font-family: monospace;
10 color: #333;
11 background-color: #f9f9f9;
12 padding: 10px;
13 white-space: pre-wrap;
14 word-wrap: break-word;
15 ">{json_data}</pre>
16 """
17 return html_content
18
19
21 button_style = """
22 QPushButton {
23 border: none;
24 background: transparent;
25 padding: 2px;
26 }
27 QPushButton:hover {
28 background-color: lightgray;
29 border-radius: 4px;
30 }
31 QPushButton:pressed {
32 background-color: lightblue;
33 border-radius: 4px;
34 }
35 """
36 button.setStyleSheet(button_style)
format_json_to_html(json_data)
Format JSON data as HTML for display in a QTextBrowser.
Definition utils.py:1
apply_icon_button_style(button)
Definition utils.py:20