SimplePanoramaViewer/main.py

30 lines
721 B
Python
Executable File

#!/usr/bin/env python
import os
import sys
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtWebEngine import *
from PyQt5.QtWebEngineWidgets import *
path = os.path.dirname(os.path.realpath(sys.argv[0]))
os.chdir(path)
try:
with open("html/index.html", "r", encoding="utf8") as file:
html = file.read()
except OSError as exception:
print("Error: HTML file not found: " + str(exception))
html = html.replace("__IMG_PATH__", sys.argv[1])
app = QApplication(sys.argv)
web = QWebEngineView()
web.setHtml(html,QUrl("file://" + path + "/index.html"))
web.setWindowTitle("SimplePanoramaViewer")
web.show()
sys.exit(app.exec_())