diff --git a/qutebrowser/browser/downloads.py b/qutebrowser/browser/downloads.py index 92d846bd8..9c2a88a87 100644 --- a/qutebrowser/browser/downloads.py +++ b/qutebrowser/browser/downloads.py @@ -40,7 +40,11 @@ from qutebrowser.utils import (usertypes, standarddir, utils, message, log, from qutebrowser.qt import sip -ModelRole = enum.IntEnum('ModelRole', ['item'], start=Qt.UserRole) +class ModelRole(enum.IntEnum): + + """Custom download model roles.""" + + item = Qt.UserRole # Remember the last used directory diff --git a/qutebrowser/mainwindow/tabwidget.py b/qutebrowser/mainwindow/tabwidget.py index f2605e7d3..f9c2ac0e6 100644 --- a/qutebrowser/mainwindow/tabwidget.py +++ b/qutebrowser/mainwindow/tabwidget.py @@ -37,8 +37,11 @@ from qutebrowser.misc import objects from qutebrowser.browser import browsertab -PixelMetrics = enum.IntEnum('PixelMetrics', ['icon_padding'], - start=QStyle.PM_CustomBase) +class PixelMetrics(enum.IntEnum): + + """Custom PixelMetrics attributes.""" + + icon_padding = QStyle.PM_CustomBase class TabWidget(QTabWidget): diff --git a/qutebrowser/misc/backendproblem.py b/qutebrowser/misc/backendproblem.py index d5f7c9680..8e57a0223 100644 --- a/qutebrowser/misc/backendproblem.py +++ b/qutebrowser/misc/backendproblem.py @@ -38,10 +38,14 @@ from qutebrowser.utils import usertypes, objreg, version, qtutils, log, utils from qutebrowser.misc import objects, msgbox -_Result = enum.IntEnum( - '_Result', - ['quit', 'restart', 'restart_webkit', 'restart_webengine'], - start=QDialog.Accepted + 1) +class _Result(enum.IntEnum): + + """The result code returned by the backend problem dialog.""" + + quit = QDialog.Accepted + 1 + restart = QDialog.Accepted + 2 + restart_webkit = QDialog.Accepted + 3 + restart_webengine = QDialog.Accepted + 4 @attr.s diff --git a/qutebrowser/misc/crashdialog.py b/qutebrowser/misc/crashdialog.py index 27dec3345..a846cc59a 100644 --- a/qutebrowser/misc/crashdialog.py +++ b/qutebrowser/misc/crashdialog.py @@ -42,8 +42,12 @@ from qutebrowser.misc import (miscwidgets, autoupdate, msgbox, httpclient, from qutebrowser.config import config, configfiles -Result = enum.IntEnum('Result', ['restore', 'no_restore'], - start=QDialog.Accepted + 1) +class Result(enum.IntEnum): + + """The result code returned by the crash dialog.""" + + restore = QDialog.Accepted + 1 + no_restore = QDialog.Accepted + 2 def parse_fatal_stacktrace(text): diff --git a/qutebrowser/utils/usertypes.py b/qutebrowser/utils/usertypes.py index 039d805f9..82a95c3fd 100644 --- a/qutebrowser/utils/usertypes.py +++ b/qutebrowser/utils/usertypes.py @@ -221,10 +221,17 @@ KeyMode = enum.Enum('KeyMode', ['normal', 'hint', 'command', 'yesno', 'prompt', 'jump_mark', 'record_macro', 'run_macro']) -# Exit statuses for errors. Needs to be an int for sys.exit. -Exit = enum.IntEnum('Exit', ['ok', 'reserved', 'exception', 'err_ipc', - 'err_init', 'err_config', 'err_key_config'], - start=0) +class Exit(enum.IntEnum): + + """Exit statuses for errors. Needs to be an int for sys.exit.""" + + ok = 0 + reserved = 1 + exception = 2 + err_ipc = 3 + err_init = 4 + err_config = 5 + err_key_config = 6 # Load status of a tab