From 63c890e229466e70927ba3ed925ba471ea4a9929 Mon Sep 17 00:00:00 2001 From: Matt Singleton Date: Thu, 20 Jan 2022 11:28:36 -0600 Subject: switch back to pyside6 (pyinstaller doesn't work on macos) --- browser/browser.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'browser') diff --git a/browser/browser.py b/browser/browser.py index 36d5fcc..8374131 100755 --- a/browser/browser.py +++ b/browser/browser.py @@ -2,12 +2,12 @@ import sys -from PySide2 import QtCore, QtWidgets, QtGui, QtWebEngineWidgets, QtWebEngineCore +from PySide6 import QtCore, QtWidgets, QtGui, QtWebEngineWidgets, QtWebEngineCore import gemini -class GeminiPage(QtWebEngineWidgets.QWebEnginePage): +class GeminiPage(QtWebEngineCore.QWebEnginePage): def acceptNavigationRequest(self, url, navtype, mainframe): """ Block non-gemini page navigation and @@ -50,7 +50,7 @@ class GBrowser(QtWidgets.QMainWindow): if initial_url is None: initial_url = 'gemini://gemini.circumlunar.space/' if profile is None: - profile = QtWebEngineWidgets.QWebEngineProfile.defaultProfile() + profile = QtWebEngineCore.QWebEngineProfile.defaultProfile() QtWidgets.QMainWindow.__init__(self) # Main Viewport @@ -90,17 +90,17 @@ class GBrowser(QtWidgets.QMainWindow): self.show() # Shortcuts - down_shortcut = QtWidgets.QShortcut(QtGui.QKeySequence(QtCore.Qt.Key_J), self) + down_shortcut = QtGui.QShortcut(QtGui.QKeySequence(QtCore.Qt.Key_J), self) down_event = QtGui.QKeyEvent(QtCore.QEvent.KeyPress, QtCore.Qt.Key_Down, QtCore.Qt.NoModifier) down_shortcut.activated.connect(lambda: QtWidgets.QApplication.sendEvent(self._browser.focusProxy(), down_event)) - up_shortcut = QtWidgets.QShortcut(QtGui.QKeySequence(QtCore.Qt.Key_K), self) + up_shortcut = QtGui.QShortcut(QtGui.QKeySequence(QtCore.Qt.Key_K), self) up_event = QtGui.QKeyEvent(QtCore.QEvent.KeyPress, QtCore.Qt.Key_Up, QtCore.Qt.NoModifier) up_shortcut.activated.connect(lambda: QtWidgets.QApplication.sendEvent(self._browser.focusProxy(), up_event)) - QtWidgets.QShortcut(QtGui.QKeySequence(QtCore.Qt.Key_H), self, self._browser.back) - QtWidgets.QShortcut(QtGui.QKeySequence(QtCore.Qt.Key_L), self, self._browser.forward) - QtWidgets.QShortcut(QtGui.QKeySequence("Shift+R"), self, self._browser.reload) - QtWidgets.QShortcut(QtGui.QKeySequence("Esc"), self._address, lambda: self.setFocus()) - QtWidgets.QShortcut(QtGui.QKeySequence("Shift+L"), self, lambda: self._address.setFocus()) + QtGui.QShortcut(QtGui.QKeySequence(QtCore.Qt.Key_H), self, self._browser.back) + QtGui.QShortcut(QtGui.QKeySequence(QtCore.Qt.Key_L), self, self._browser.forward) + QtGui.QShortcut(QtGui.QKeySequence("Shift+R"), self, self._browser.reload) + QtGui.QShortcut(QtGui.QKeySequence("Esc"), self._address, lambda: self.setFocus()) + QtGui.QShortcut(QtGui.QKeySequence("Shift+L"), self, lambda: self._address.setFocus()) def set_status_url(self, url): if url: @@ -126,8 +126,8 @@ scheme.setFlags(QtWebEngineCore.QWebEngineUrlScheme.SecureScheme) QtWebEngineCore.QWebEngineUrlScheme.registerScheme(scheme) app = QtWidgets.QApplication(['Gemini Browser']) gem_handler = GeminiSchemeHandler() -profile = QtWebEngineWidgets.QWebEngineProfile() +profile = QtWebEngineCore.QWebEngineProfile() profile.removeAllUrlSchemeHandlers() profile.installUrlSchemeHandler(b'gemini', gem_handler) ex = GBrowser(sys.argv[1] if len(sys.argv) > 1 else None, profile) -sys.exit(app.exec_()) +sys.exit(app.exec()) -- cgit v1.2.3