2025-03-05 15:26:33 +01:00

20 lines
587 B
Python

from PyQt6.QtWidgets import QTextBrowser
from PyQt6.QtGui import QDesktopServices
from ...resources import get_resource_path
class MarkdownView(QTextBrowser):
def __init__(self, path):
super().__init__()
self.setReadOnly(True)
self.filepath = get_resource_path(path)
with open(self.filepath, "r") as file:
content = file.read()
self.setMarkdown(content)
# open links with the OS web browser
self.anchorClicked.connect(QDesktopServices.openUrl)
# dont follow links
self.setOpenLinks(False)