diff --git a/setup.py b/setup.py index 2c62e28..b90a8e9 100644 --- a/setup.py +++ b/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", diff --git a/webview/__init__.py b/webview/__init__.py index a890314..826a536 100755 --- a/webview/__init__.py +++ b/webview/__init__.py @@ -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 diff --git a/webview/qt.py b/webview/qt.py index a028b04..f4fb3b9 100755 --- a/webview/qt.py +++ b/webview/qt.py @@ -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)