mirror of
https://github.com/allankoechke/pywebview.git
synced 2026-12-02 09:37:30 +00:00
Merge pull request #215 from hucste/master
Add support PyQt5 for OpenBSD 6.x!
This commit is contained in:
5
setup.py
5
setup.py
@@ -20,7 +20,10 @@ elif platform.system() == "Linux":
|
||||
'gtk3': ['PyGObject'],
|
||||
'qt5': ['PyQt5'],
|
||||
}
|
||||
|
||||
elif platform.system() == 'OpenBSD':
|
||||
extras_require = {
|
||||
'qt5': ['PyQt5'],
|
||||
}
|
||||
|
||||
setup(
|
||||
name="pywebview",
|
||||
|
||||
@@ -75,7 +75,7 @@ def _initialize_imports():
|
||||
logger.exception('QT cannot be loaded')
|
||||
raise Exception('You must have either PyObjC (for Cocoa support) or Qt with Python bindings installed in order to use this library.')
|
||||
|
||||
elif platform.system() == 'Linux':
|
||||
elif platform.system() == 'Linux' or platform.system() == 'OpenBSD':
|
||||
if not config.use_qt:
|
||||
try:
|
||||
import webview.gtk as gui
|
||||
@@ -115,7 +115,7 @@ def _initialize_imports():
|
||||
logger.exception('PyWin32 cannot be loaded')
|
||||
raise Exception('You must have either pythonnet or pywin32 installed in order to use this library.')
|
||||
else:
|
||||
raise Exception('Unsupported platform. Only Windows, Linux and OS X are supported.')
|
||||
raise Exception('Unsupported platform. Only Windows, Linux, OS X, OpenBSD are supported.')
|
||||
|
||||
_initialized = True
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ http://github.com/r0x0r/pywebview/
|
||||
'''
|
||||
|
||||
import os
|
||||
import platform
|
||||
import json
|
||||
import logging
|
||||
import webbrowser
|
||||
@@ -31,7 +32,7 @@ try:
|
||||
from PyQt5.QtCore import QT_VERSION_STR
|
||||
_qt_version = [int(n) for n in QT_VERSION_STR.split('.')]
|
||||
|
||||
if _qt_version >= [5, 5]:
|
||||
if _qt_version >= [5, 5] and platform.system() != 'OpenBSD':
|
||||
from PyQt5.QtWebEngineWidgets import QWebEngineView as QWebView, QWebEnginePage as QWebPage
|
||||
from PyQt5.QtWebChannel import QWebChannel
|
||||
else:
|
||||
@@ -63,7 +64,7 @@ if _import_error:
|
||||
_import_error = False
|
||||
|
||||
if _import_error:
|
||||
raise Exception('This module requires PyQt4 or PyQt5 to work under Linux.')
|
||||
raise Exception('This module requires PyQt4 or PyQt5 to work under Linux or *BSD.')
|
||||
|
||||
|
||||
class BrowserView(QMainWindow):
|
||||
@@ -181,7 +182,7 @@ class BrowserView(QMainWindow):
|
||||
self.evaluate_js_trigger.connect(self.on_evaluate_js)
|
||||
self.set_title_trigger.connect(self.on_set_title)
|
||||
|
||||
if _qt_version >= [5, 5]:
|
||||
if _qt_version >= [5, 5] and platform.system() != 'OpenBSD':
|
||||
self.channel = QWebChannel(self.view.page())
|
||||
self.view.page().setWebChannel(self.channel)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user