Source code for pySimBlocks.gui.dialogs.help_dialog
# ******************************************************************************
# pySimBlocks
# Copyright (c) 2026 Université de Lille & INRIA
# ******************************************************************************
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
# for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# ******************************************************************************
# Authors: see Authors.txt
# ******************************************************************************
from pathlib import Path
from PySide6.QtWidgets import QTextBrowser, QDialog, QVBoxLayout
[docs]
class HelpDialog(QDialog):
"""Display Markdown help content for a block or feature."""
def __init__(self, md_path: Path, parent=None):
"""Initialize a help dialog.
Args:
md_path: Markdown file to display.
parent: Optional parent widget.
Raises:
None.
"""
super().__init__(parent)
self.setWindowTitle(md_path.name)
self.resize(600, 500)
layout = QVBoxLayout(self)
browser = QTextBrowser()
browser.setOpenExternalLinks(True)
with md_path.open("r") as f:
browser.setMarkdown(f.read())
layout.addWidget(browser)