add wfh files
This commit is contained in:
37
src/utils/documentationview.py
Normal file
37
src/utils/documentationview.py
Normal file
@@ -0,0 +1,37 @@
|
||||
import sys
|
||||
#from PyQt6 import Webview
|
||||
from PySide6.QtWebEngineWidgets import QWebEngineView
|
||||
import os
|
||||
from PySide6.QtWidgets import QTabWidget
|
||||
|
||||
documentation_path = "docs"
|
||||
|
||||
class DocumentationViewer(QMainWindow):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.setWindowTitle("Documentation Viewer")
|
||||
self.setGeometry(100, 100, 800, 600)
|
||||
|
||||
self.tabs = QTabWidget()
|
||||
self.setCentralWidget(self.tabs)
|
||||
|
||||
self.set_documentation_tabs()
|
||||
|
||||
def set_documentation_tabs(self):
|
||||
files = [os.path.join(documentation_path, file) for file in os.listdir(documentation_path) if file.endswith(".html")]
|
||||
for file in files:
|
||||
with open(file, "r") as f:
|
||||
html_content = f.read()
|
||||
tab_name = os.path.basename(file).split(".")[0]
|
||||
self.load_documentation(tab_name, html_content)
|
||||
def load_documentation(self, tab_name="Documentation", html_content="<h1>Documentation</h1><p>Your HTML documentation content goes here.</p>"):
|
||||
documentation_tab = QWebEngineView()
|
||||
documentation_tab.setHtml(html_content)
|
||||
self.tabs.addTab(documentation_tab, tab_name)
|
||||
|
||||
if __name__ == "__main__":
|
||||
app = QApplication(sys.argv)
|
||||
viewer = DocumentationViewer()
|
||||
viewer.show()
|
||||
sys.exit(app.exec())
|
||||
|
||||
Reference in New Issue
Block a user