from PyQt6.QtWebEngineWidgets import QWebEngineView
from PyQt6.QtGui import QAction
from PyQt6.QtCore import QUrl
-import webbrowser
+import os, webbrowser
class RenderBox(QMainWindow):
def update(self, file):
try:
self.file=file
- self.webview.load(QUrl("file://"+self.file))
+ self.webview.load(QUrl("file:///"+self.file.replace(os.sep, "/")))
except Exception as e:
QMessageBox.warning(self,"Display failed", "Failed to display file.")
self.hide()
self.setCentralWidget(self.webview)
def open(self, file):
- self.webview.load(QUrl("file://"+os.path.abspath(file)))
+ self.webview.load(QUrl("file:///"+os.path.abspath(file).replace(os.sep, "/")))