summaryrefslogtreecommitdiff
path: root/browser
diff options
context:
space:
mode:
authorMatt Singleton <matt@xcolour.net>2022-01-20 11:28:36 -0600
committerMatt Singleton <matt@xcolour.net>2022-01-20 11:28:36 -0600
commit63c890e229466e70927ba3ed925ba471ea4a9929 (patch)
treeeab2e9df9ae311957732992e55c2d53e2b92bda1 /browser
parent616371e01fa96653bd43f4384a6b8ef68b3661b5 (diff)
switch back to pyside6 (pyinstaller doesn't work on macos)pyside6
Diffstat (limited to 'browser')
-rwxr-xr-xbrowser/browser.py24
1 files changed, 12 insertions, 12 deletions
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())