EXPERIMENTAL: switch from PyQt6 to PySide6

This commit is contained in:
WorldTeacher
2024-02-22 21:20:57 +01:00
parent 6d1119783f
commit d6a9868640
37 changed files with 326 additions and 226 deletions

View File

@@ -1,11 +1,13 @@
import sys
#from PyQt6 import Webview
from PySide6.QtWebEngineWidgets import QWebEngineView
import os
from PySide6.QtWidgets import QTabWidget
import sys
# from PySide6 import Webview
from PySide6.QtWebEngineWidgets import QWebEngineView
from PySide6.QtWidgets import QApplication, QMainWindow, QTabWidget
documentation_path = "docs"
class DocumentationViewer(QMainWindow):
def __init__(self):
super().__init__()
@@ -16,22 +18,31 @@ class DocumentationViewer(QMainWindow):
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")]
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>"):
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())