With sip v4.19.9 (around PyQt 5.11), there's a new way to access enums which makes them all scoped. With PyQt 6, this will be the only way Qt enums can be accessed.
Thus, enum access like QWebEngineSettings.AllowAllUnknownUrlSchemes should be rewritten to say QWebEngineSettings.UnknownUrlSchemePolicy.AllowAllUnknownUrlSchemes instead.
A rough way to search for them:
$ rg 'Q[A-Z][a-z][A-Za-z0-9]+\.[A-Z][a-z][A-Za-z0-9]+'
here's a list of all of them (rg --no-filename 'Q[A-Z][a-z][A-Za-z0-9]+\.[A-Z][a-z][A-Za-z0-9]+' -o | sort | uniq):
Details
QAbstractSocket.AddressInUseError
QAbstractSocket.SocketResourceError
QAbstractTextDocumentLayout.PaintContext
QClipboard.Clipboard
QClipboard.Selection
QColor.Cmyk
QColor.Hsl
QColor.Hsv
QColor.Rgb
QColor.Spec
QDataStream.ReadCorruptData
QDataStream.ReadPastEnd
QDataStream.Status
QDataStream.WriteFailed
QDialog.Accepted
QDialog.Rejected
QDialogButtonBox.AcceptRole
QDialogButtonBox.RejectRole
QDir.AllDirs
QDir.Drives
QDir.NoDot
QEvent.ChildAdded
QEvent.ChildRemoved
QEvent.FileOpen
QEvent.KeyPress
QEvent.KeyRelease
QEvent.MouseButtonPress
QEvent.MouseButtonRelease
QEvent.MouseMove
QEvent.ShortcutOverride
QEvent.Type
QEvent.User
QEvent.Wheel
QEventLoop.AllEvents
QEventLoop.ExcludeSocketNotifiers
QEventLoop.ExcludeUserInputEvents
QEventLoop.ProcessEventsFlags
QFileDevice.FileError
QFileDevice.OpenError
QFont.Bold
QFont.Cursive
QFont.Fantasy
QFont.Monospace
QFont.Normal
QFont.SansSerif
QFont.Serif
QFont.StyleHint
QFont.StyleItalic
QFont.StyleNormal
QFont.StyleOblique
QFont.TypeWriter
QFont.Weight
QFontDatabase.FixedFont
QFrame.Shadow
QFrame.Sunken
QHostAddress.LocalHost
QHostInfo.NoError
QIcon.Disabled
QIcon.Normal
QIcon.Off
QIcon.Selected
QItemSelectionModel.ClearAndSelect
QItemSelectionModel.Rows
QKeyEvent.KeyPress
QKeySequence.ExactMatch
QKeySequence.NoMatch
QKeySequence.PartialMatch
QKeySequence.SequenceMatch
QLibraryInfo.DataPath
QLibraryInfo.LibraryExecutablesPath
QLineEdit.Password
QListView.Adjust
QListView.LeftToRight
QLocalServer.UserAccessOption
QLocalSocket.ConnectionError
QLocalSocket.ConnectionRefusedError
QLocalSocket.PeerClosedError
QLocalSocket.ServerNotFoundError
QLocalSocket.UnconnectedState
QLocalSocket.UnknownSocketError
QMessageBox.Cancel
QMessageBox.Critical
QMessageBox.Information
QMessageBox.Warning
QMetaMethod.Signal
QNetworkAccessManager.GetOperation
QNetworkAccessManager.NotAccessible
QNetworkProxy.HostNameLookupCapability
QNetworkProxy.HttpProxy
QNetworkProxy.NoProxy
QNetworkProxy.Socks5Proxy
QNetworkReply.ContentAccessDenied
QNetworkReply.ContentNotFoundError
QNetworkReply.ContentOperationNotPermittedError
QNetworkReply.HostNotFoundError
QNetworkReply.InternalServerError
QNetworkReply.NoError
QNetworkReply.OperationCanceledError
QNetworkReply.ProtocolUnknownError
QNetworkReply.UnknownNetworkError
QNetworkReply.UnknownProxyError
QNetworkRequest.AlwaysNetwork
QNetworkRequest.CacheLoadControlAttribute
QNetworkRequest.CacheSaveControlAttribute
QNetworkRequest.ContentLengthHeader
QNetworkRequest.ContentTypeHeader
QNetworkRequest.HttpReasonPhraseAttribute
QNetworkRequest.HttpStatusCodeAttribute
QNetworkRequest.NoLessSafeRedirectPolicy
QNetworkRequest.RedirectPolicyAttribute
QNetworkRequest.RedirectionTargetAttribute
QNetworkRequest.UserAgentHeader
QPalette.Base
QPalette.Disabled
QPalette.Highlight
QPalette.HighlightedText
QPalette.Inactive
QPalette.Normal
QPalette.Text
QPalette.Window
QPalette.WindowText
QProcess.CrashExit
QProcess.Crashed
QProcess.ExitStatus
QProcess.NormalExit
QProcess.ProcessError
QProcess.Running
QProcess.SeparateChannels
QProcess.StandardError
QProcess.StandardOutput
QRegularExpression.CaseInsensitiveOption
QSettings.IniFormat
QSettings.NativeFormat
QSettings.UserScope
QSizePolicy.Expanding
QSizePolicy.Fixed
QSizePolicy.Ignored
QSizePolicy.Minimum
QSizePolicy.MinimumExpanding
QSizePolicy.Preferred
QSocketNotifier.Read
QSqlError.UnknownError
QSsl.TlsV1
QStandardPaths.AppDataLocation
QStandardPaths.AppLocalDataLocation
QStandardPaths.CacheLocation
QStandardPaths.ConfigLocation
QStandardPaths.DownloadLocation
QStandardPaths.RuntimeLocation
QStandardPaths.StandardLocation
QStandardPaths.TempLocation
QStyle.PrimitiveElement
QStyle.State
QStyleOptionViewItem.WrapText
QTabBar.SelectLeftTab
QTabBar.SelectPreviousTab
QTabBar.SelectRightTab
QTabWidget.East
QTabWidget.North
QTabWidget.South
QTabWidget.West
QTextCursor.End
QTextEdit.NoWrap
QTextOption.ManualWrap
QTextOption.WordWrap
QUrl.DecodeReserved
QUrl.EncodeFully
QUrl.EncodeUnicode
QUrl.FormattingOptions
QUrl.FullyDecoded
QUrl.FullyEncoded
QUrl.NormalizePathSegments
QUrl.PrettyDecoded
QUrl.RemoveFragment
QUrl.RemovePassword
QUrl.RemovePath
QUrl.RemoveQuery
QUrl.RemoveScheme
QUrl.RemoveUserInfo
QUrl.StrictMode
QUrl.StripTrailingSlash
QUrl.UrlFormattingOption
QValidator.Acceptable
QValidator.Invalid
QWebElement.ComputedStyle
QWebEngineCookieStore.FilterRequest
QWebEngineDownloadItem.DownloadCancelled
QWebEngineDownloadItem.DownloadCompleted
QWebEngineDownloadItem.DownloadInProgress
QWebEngineDownloadItem.DownloadInterrupted
QWebEngineDownloadItem.DownloadRequested
QWebEngineDownloadItem.DownloadState
QWebEngineDownloadItem.UnknownSaveFormat
QWebEnginePage.AbnormalTerminationStatus
QWebEnginePage.CrashedTerminationStatus
QWebEnginePage.DesktopAudioVideoCapture
QWebEnginePage.DesktopVideoCapture
QWebEnginePage.ErrorMessageLevel
QWebEnginePage.ExitFullScreen
QWebEnginePage.FindBackward
QWebEnginePage.FindCaseSensitively
QWebEnginePage.FindFlag
QWebEnginePage.FindFlags
QWebEnginePage.Geolocation
QWebEnginePage.InfoMessageLevel
QWebEnginePage.KilledTerminationStatus
QWebEnginePage.MediaAudioCapture
QWebEnginePage.MediaAudioVideoCapture
QWebEnginePage.MediaVideoCapture
QWebEnginePage.MouseLock
QWebEnginePage.NavigationType
QWebEnginePage.NavigationTypeBackForward
QWebEnginePage.NavigationTypeFormSubmitted
QWebEnginePage.NavigationTypeLinkClicked
QWebEnginePage.NavigationTypeOther
QWebEnginePage.NavigationTypeRedirect
QWebEnginePage.NavigationTypeReload
QWebEnginePage.NavigationTypeTyped
QWebEnginePage.NormalTerminationStatus
QWebEnginePage.Notifications
QWebEnginePage.PermissionDeniedByUser
QWebEnginePage.PermissionGrantedByUser
QWebEnginePage.Reload
QWebEnginePage.ReloadAndBypassCache
QWebEnginePage.RenderProcessTerminationStatus
QWebEnginePage.SavePage
QWebEnginePage.ViewSource
QWebEnginePage.WarningMessageLevel
QWebEnginePage.WebAction
QWebEnginePage.WebBrowserBackgroundTab
QWebEnginePage.WebBrowserTab
QWebEnginePage.WebBrowserWindow
QWebEnginePage.WebDialog
QWebEnginePage.WebWindowType
QWebEngineProfile.AllowPersistentCookies
QWebEngineProfile.NoPersistentCookies
QWebEngineScript.ApplicationWorld
QWebEngineScript.DocumentCreation
QWebEngineScript.DocumentReady
QWebEngineScript.MainWorld
QWebEngineScript.ScriptWorldId
QWebEngineScript.UserWorld
QWebEngineSettings.AllowAllUnknownUrlSchemes
QWebEngineSettings.AllowUnknownUrlSchemesFromUserInteraction
QWebEngineSettings.AutoLoadImages
QWebEngineSettings.CursiveFont
QWebEngineSettings.DefaultFixedFontSize
QWebEngineSettings.DefaultFontSize
QWebEngineSettings.DisallowUnknownUrlSchemes
QWebEngineSettings.DnsPrefetchEnabled
QWebEngineSettings.FantasyFont
QWebEngineSettings.FixedFont
QWebEngineSettings.FocusOnNavigationEnabled
QWebEngineSettings.FullScreenSupportEnabled
QWebEngineSettings.HyperlinkAuditingEnabled
QWebEngineSettings.JavascriptCanAccessClipboard
QWebEngineSettings.JavascriptCanOpenWindows
QWebEngineSettings.JavascriptEnabled
QWebEngineSettings.LinksIncludedInFocusChain
QWebEngineSettings.LocalContentCanAccessFileUrls
QWebEngineSettings.LocalContentCanAccessRemoteUrls
QWebEngineSettings.LocalStorageEnabled
QWebEngineSettings.MinimumFontSize
QWebEngineSettings.MinimumLogicalFontSize
QWebEngineSettings.PdfViewerEnabled
QWebEngineSettings.PlaybackRequiresUserGesture
QWebEngineSettings.PluginsEnabled
QWebEngineSettings.PrintElementBackgrounds
QWebEngineSettings.SansSerifFont
QWebEngineSettings.ScreenCaptureEnabled
QWebEngineSettings.ScrollAnimatorEnabled
QWebEngineSettings.SerifFont
QWebEngineSettings.SpatialNavigationEnabled
QWebEngineSettings.StandardFont
QWebEngineSettings.WebGLEnabled
QWebEngineUrlRequestInfo.ResourceType
QWebEngineUrlRequestInfo.ResourceTypeCspReport
QWebEngineUrlRequestInfo.ResourceTypeFavicon
QWebEngineUrlRequestInfo.ResourceTypeFontResource
QWebEngineUrlRequestInfo.ResourceTypeImage
QWebEngineUrlRequestInfo.ResourceTypeMainFrame
QWebEngineUrlRequestInfo.ResourceTypeMedia
QWebEngineUrlRequestInfo.ResourceTypeObject
QWebEngineUrlRequestInfo.ResourceTypePing
QWebEngineUrlRequestInfo.ResourceTypePluginResource
QWebEngineUrlRequestInfo.ResourceTypePrefetch
QWebEngineUrlRequestInfo.ResourceTypeScript
QWebEngineUrlRequestInfo.ResourceTypeServiceWorker
QWebEngineUrlRequestInfo.ResourceTypeSharedWorker
QWebEngineUrlRequestInfo.ResourceTypeStylesheet
QWebEngineUrlRequestInfo.ResourceTypeSubFrame
QWebEngineUrlRequestInfo.ResourceTypeSubResource
QWebEngineUrlRequestInfo.ResourceTypeUnknown
QWebEngineUrlRequestInfo.ResourceTypeWorker
QWebEngineUrlRequestInfo.ResourceTypeXhr
QWebEngineUrlRequestJob.RequestDenied
QWebEngineUrlRequestJob.RequestFailed
QWebEngineUrlRequestJob.UrlInvalid
QWebEngineUrlRequestJob.UrlNotFound
QWebEngineUrlScheme.LocalAccessAllowed
QWebEngineUrlScheme.LocalScheme
QWebPage.ChooseMultipleFilesExtension
QWebPage.ErrorPageExtension
QWebPage.ErrorPageExtensionOption
QWebPage.ErrorPageExtensionReturn
QWebPage.FindBackward
QWebPage.FindCaseSensitively
QWebPage.FindFlag
QWebPage.FindFlags
QWebPage.FindWrapsAroundDocument
QWebPage.Geolocation
QWebPage.HighlightAllOccurrences
QWebPage.MoveToEndOfBlock
QWebPage.MoveToEndOfDocument
QWebPage.MoveToEndOfLine
QWebPage.MoveToNextChar
QWebPage.MoveToNextLine
QWebPage.MoveToNextWord
QWebPage.MoveToPreviousChar
QWebPage.MoveToPreviousLine
QWebPage.MoveToPreviousWord
QWebPage.MoveToStartOfBlock
QWebPage.MoveToStartOfDocument
QWebPage.MoveToStartOfLine
QWebPage.NavigationType
QWebPage.NavigationTypeBackOrForward
QWebPage.NavigationTypeFormResubmitted
QWebPage.NavigationTypeFormSubmitted
QWebPage.NavigationTypeLinkClicked
QWebPage.NavigationTypeOther
QWebPage.NavigationTypeReload
QWebPage.Notifications
QWebPage.PermissionDeniedByUser
QWebPage.PermissionGrantedByUser
QWebPage.QtNetwork
QWebPage.Reload
QWebPage.ReloadAndBypassCache
QWebPage.SelectEndOfBlock
QWebPage.SelectEndOfDocument
QWebPage.SelectEndOfLine
QWebPage.SelectNextChar
QWebPage.SelectNextLine
QWebPage.SelectNextWord
QWebPage.SelectPreviousChar
QWebPage.SelectPreviousLine
QWebPage.SelectPreviousWord
QWebPage.SelectStartOfBlock
QWebPage.SelectStartOfDocument
QWebPage.SelectStartOfLine
QWebPage.ToggleVideoFullscreen
QWebPage.VisibilityStateHidden
QWebPage.VisibilityStateVisible
QWebPage.WebAction
QWebPage.WebKit
QWebPage.WebModalDialog
QWebSettings.AllowThirdPartyWithExistingCookies
QWebSettings.AlwaysAllowThirdPartyCookies
QWebSettings.AlwaysBlockThirdPartyCookies
QWebSettings.AutoLoadImages
QWebSettings.CaretBrowsingEnabled
QWebSettings.CursiveFont
QWebSettings.DefaultFixedFontSize
QWebSettings.DefaultFontSize
QWebSettings.DeveloperExtrasEnabled
QWebSettings.DnsPrefetchEnabled
QWebSettings.FantasyFont
QWebSettings.FixedFont
QWebSettings.FrameFlatteningEnabled
QWebSettings.HyperlinkAuditingEnabled
QWebSettings.JavascriptCanAccessClipboard
QWebSettings.JavascriptCanCloseWindows
QWebSettings.JavascriptCanOpenWindows
QWebSettings.JavascriptEnabled
QWebSettings.LinksIncludedInFocusChain
QWebSettings.LocalContentCanAccessFileUrls
QWebSettings.LocalContentCanAccessRemoteUrls
QWebSettings.LocalStorageEnabled
QWebSettings.MinimumFontSize
QWebSettings.MinimumLogicalFontSize
QWebSettings.OfflineStorageDatabaseEnabled
QWebSettings.OfflineWebApplicationCacheEnabled
QWebSettings.PluginsEnabled
QWebSettings.PrintElementBackgrounds
QWebSettings.PrivateBrowsingEnabled
QWebSettings.SansSerifFont
QWebSettings.ScrollAnimatorEnabled
QWebSettings.SerifFont
QWebSettings.SiteSpecificQuirksEnabled
QWebSettings.SpatialNavigationEnabled
QWebSettings.StandardFont
QWebSettings.WebGLEnabled
QWebSettings.ZoomTextOnly
(If you want to replicate that locally but don't have ripgrep, you could use something like grep -R --exclude-dir=.git --exclude-dir=.tox --exclude-dir='.venv*' --exclude-dir='.mypy_cache' --exclude='*.pyc' 'Q[A-Z][a-z][A-Za-z0-9]\+\.[A-Z][a-z][A-Za-z0-9]\+' . instead)
The scope to use for every one of those can be found out like this:
>>> from PyQt5.QtWebEngineWidgets import QWebEngineSettings
>>> type(QWebEngineSettings.AllowAllUnknownUrlSchemes).__name__
'UnknownUrlSchemePolicy'
so in theory it should be possible to solve this in a semi-automated way, by starting with the (rip)grep command above, writing a Python script to find the proper types to use (can use from PyQt5.Qt import * and from PyQt5.QtWebEngineWidgets import * to get access to most of those classes) and then generating something to feed to sed (or alternatively, implementing the search/replace in Python).
Marking this as "easy" as it's something that can be worked on without knowing much about qutebrowser internals. It will certainly require some manual work after writing such a script (for formatting adjustments and such), but that shouldn't be too much work. If you decide to work on this, please split it up into a couple of smaller PRs rather than one big one.
With sip v4.19.9 (around PyQt 5.11), there's a new way to access enums which makes them all scoped. With PyQt 6, this will be the only way Qt enums can be accessed.
Thus, enum access like
QWebEngineSettings.AllowAllUnknownUrlSchemesshould be rewritten to sayQWebEngineSettings.UnknownUrlSchemePolicy.AllowAllUnknownUrlSchemesinstead.A rough way to search for them:
here's a list of all of them (
rg --no-filename 'Q[A-Z][a-z][A-Za-z0-9]+\.[A-Z][a-z][A-Za-z0-9]+' -o | sort | uniq):Details
(If you want to replicate that locally but don't have ripgrep, you could use something like
grep -R --exclude-dir=.git --exclude-dir=.tox --exclude-dir='.venv*' --exclude-dir='.mypy_cache' --exclude='*.pyc' 'Q[A-Z][a-z][A-Za-z0-9]\+\.[A-Z][a-z][A-Za-z0-9]\+' .instead)The scope to use for every one of those can be found out like this:
so in theory it should be possible to solve this in a semi-automated way, by starting with the (rip)grep command above, writing a Python script to find the proper types to use (can use
from PyQt5.Qt import *andfrom PyQt5.QtWebEngineWidgets import *to get access to most of those classes) and then generating something to feed tosed(or alternatively, implementing the search/replace in Python).Marking this as "easy" as it's something that can be worked on without knowing much about qutebrowser internals. It will certainly require some manual work after writing such a script (for formatting adjustments and such), but that shouldn't be too much work. If you decide to work on this, please split it up into a couple of smaller PRs rather than one big one.