summaryrefslogtreecommitdiff
path: root/browser
diff options
context:
space:
mode:
authorMatt Singleton <matt@xcolour.net>2022-01-19 19:00:28 -0600
committerMatt Singleton <matt@xcolour.net>2022-01-19 19:00:28 -0600
commit35a197f5e5263bfb0e7d41717b2153c03e50008d (patch)
tree0445db966c669f4302a7c30d37c14ed3036f4f95 /browser
parent069926b1611fe242a8d86a58849ad51e90914da0 (diff)
downgrade to pyside2 (qt5)
Diffstat (limited to 'browser')
-rwxr-xr-xbrowser/browser.py28
1 files changed, 14 insertions, 14 deletions
diff --git a/browser/browser.py b/browser/browser.py
index f5475ab..36d5fcc 100755
--- a/browser/browser.py
+++ b/browser/browser.py
@@ -2,12 +2,12 @@
import sys
-from PySide6 import QtCore, QtWidgets, QtGui, QtWebEngineWidgets, QtWebEngineCore
+from PySide2 import QtCore, QtWidgets, QtGui, QtWebEngineWidgets, QtWebEngineCore
import gemini
-class GeminiPage(QtWebEngineCore.QWebEnginePage):
+class GeminiPage(QtWebEngineWidgets.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 = QtWebEngineCore.QWebEngineProfile.defaultProfile()
+ profile = QtWebEngineWidgets.QWebEngineProfile.defaultProfile()
QtWidgets.QMainWindow.__init__(self)
# Main Viewport
@@ -86,21 +86,21 @@ class GBrowser(QtWidgets.QMainWindow):
settings = QtCore.QSettings("xcolour.net", "GeminiBrowser")
self.restoreGeometry(settings.value("geometry"))
self.restoreState(settings.value("windowState"))
- self.setWindowTitle('Gemini Browser')
+ self.setWindowTitle(QtCore.QCoreApplication.applicationName())
self.show()
# Shortcuts
- down_shortcut = QtGui.QShortcut(QtGui.QKeySequence(QtCore.Qt.Key_J), self)
+ down_shortcut = QtWidgets.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 = QtGui.QShortcut(QtGui.QKeySequence(QtCore.Qt.Key_K), self)
+ up_shortcut = QtWidgets.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))
- 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())
+ 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())
def set_status_url(self, url):
if url:
@@ -124,10 +124,10 @@ scheme = QtWebEngineCore.QWebEngineUrlScheme(b'gemini')
scheme.setDefaultPort(1965)
scheme.setFlags(QtWebEngineCore.QWebEngineUrlScheme.SecureScheme)
QtWebEngineCore.QWebEngineUrlScheme.registerScheme(scheme)
-app = QtWidgets.QApplication(sys.argv)
+app = QtWidgets.QApplication(['Gemini Browser'])
gem_handler = GeminiSchemeHandler()
-profile = QtWebEngineCore.QWebEngineProfile()
+profile = QtWebEngineWidgets.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_())