-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhowtoTab.py
44 lines (34 loc) · 1.48 KB
/
howtoTab.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import sys
from PyQt5.QtCore import QUrl
from PyQt5 import QtWidgets, QtCore, QtGui
from PyQt5.QtWidgets import QApplication, QMainWindow, QWidget, QSizePolicy, QTextBrowser
from PyQt5.QtWebEngineWidgets import QWebEngineView
from PyQt5.QtGui import QIcon
### Tab that handles acknowledgements
### toubleshooting and links to additional information
class howtoTab(QtWidgets.QMainWindow):
def __init__(self, parent):
super().__init__(parent)
self.initUI()
def initUI(self):
self.setCentralWidget(QtWidgets.QWidget(self))
tab_layout = QtWidgets.QVBoxLayout(self.centralWidget())
file_path = "howto.html"
# Read HTML content from the file
with open(file_path, "r", encoding="utf-8") as file:
text = file.read()
# Create a QLabel to display the text
label = QtWidgets.QLabel(self)
label.setOpenExternalLinks(True)
label.setWordWrap(True)
label.setText(text)
# Create a QScrollArea and set the QLabel as its widget
scroll_area = QtWidgets.QScrollArea(self)
scroll_area.setWidget(label)
scroll_area.setWidgetResizable(True)
scroll_area.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
scroll_area.setFrameShape(QtWidgets.QFrame.NoFrame)
tab_layout.addWidget(scroll_area)
def open_link(self, url):
# Opens the user's default web browser
QtGui.QDesktopServices.openUrl(QtGui.QUrl(url))