SimplePanoramaViewer/main.py
Rémi BERTHO 7c604fab52
First version
Signed-off-by: Rémi BERTHO <remi.bertho@dalan.fr>
2018-05-01 11:05:04 +02:00

29 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_())