From 58ee4cc21a4344ec0017b11e533f97956076df6a Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sat, 24 Jun 2023 01:03:10 +0200 Subject: qt6: Add a Qt 5 warning Closes #7742 --- qutebrowser/app.py | 8 ++++++++ qutebrowser/browser/qutescheme.py | 7 +++++++ qutebrowser/html/warning-qt5.html | 28 ++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 qutebrowser/html/warning-qt5.html diff --git a/qutebrowser/app.py b/qutebrowser/app.py index bb2ff56e7..fbfa3df12 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -367,6 +367,14 @@ def _open_special_pages(args): os.environ.get("QTWEBENGINE_DISABLE_SANDBOX") == "1" ), 'qute://warning/sandboxing'), + + ('qt5-warning-shown', + ( + machinery.IS_QT5 and + machinery.INFO.reason == machinery.SelectionReason.auto and + objects.backend != usertypes.Backend.QtWebKit, + ), + 'qute://warning/qt5'), ] if 'quickstart-done' not in general_sect: diff --git a/qutebrowser/browser/qutescheme.py b/qutebrowser/browser/qutescheme.py index 25834670b..0073f9bd2 100644 --- a/qutebrowser/browser/qutescheme.py +++ b/qutebrowser/browser/qutescheme.py @@ -22,6 +22,7 @@ Module attributes: _HANDLERS: The handlers registered via decorators. """ +import sys import html import json import os @@ -583,6 +584,12 @@ def qute_warning(url: QUrl) -> _HandlerRet: elif path == '/sandboxing': src = jinja.render('warning-sandboxing.html', title='Qt 6 macOS sandboxing warning') + elif path == '/qt5': + is_venv = hasattr(sys, 'real_prefix') or sys.base_prefix != sys.prefix + src = jinja.render('warning-qt5.html', + title='Switch to Qt 6', + is_venv=is_venv, + prefix=sys.prefix) else: raise NotFoundError("Invalid warning page {}".format(path)) return 'text/html', src diff --git a/qutebrowser/html/warning-qt5.html b/qutebrowser/html/warning-qt5.html new file mode 100644 index 000000000..17af2f72c --- /dev/null +++ b/qutebrowser/html/warning-qt5.html @@ -0,0 +1,28 @@ +{% extends "styled.html" %} + +{% block content %} +

{{ title }}

+Note this warning will only appear once. Use :open +qute://warning/qt5 to show it again at a later time. + +

+ qutebrowser now supports Qt 6. +

+

+ However, in your environment, Qt 6 is not installed. Thus, qutebrowser is still using Qt 5 instead. + + Qt 5.15 based on a very old Chromium version (83 or 87, from mid/late 2020). +

+{% if is_venv %} +

+ You are using a virtualenv. If you want to use Qt 6, you need to create a new + virtualenv with PyQt6 installed. + + If using mkvenv.py, rerun the script to create a + new virtualenv with Qt 6. +

+{% endif %} +

+ Python installation prefix: {{ prefix }} +

+{% endblock %} -- cgit v1.2.3-54-g00ecf