caret: Use strings instead of ints for enums
This commit is contained in:
parent
7a0cbf54fc
commit
d57fe79f5f
|
|
@ -427,9 +427,12 @@ class AbstractZoom(QObject):
|
|||
self._set_factor_internal(self._zoom_factor)
|
||||
|
||||
|
||||
class SelectionState(enum.IntEnum):
|
||||
class SelectionState(enum.Enum):
|
||||
|
||||
"""Possible states of selection in Caret mode."""
|
||||
"""Possible states of selection in caret mode.
|
||||
|
||||
NOTE: Names need to line up with SelectionState in caret.js!
|
||||
"""
|
||||
|
||||
none = 1
|
||||
normal = 2
|
||||
|
|
|
|||
|
|
@ -504,8 +504,8 @@ class WebEngineCaret(browsertab.AbstractCaret):
|
|||
code = javascript.assemble('caret', command, *args)
|
||||
self._tab.run_js_async(code, callback)
|
||||
|
||||
def _toggle_sel_translate(self, state_int):
|
||||
state = browsertab.SelectionState(state_int)
|
||||
def _toggle_sel_translate(self, state_str):
|
||||
state = browsertab.SelectionState[state_str]
|
||||
self.selection_toggled.emit(state)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -706,13 +706,15 @@ window._qutebrowser.caret = (function() {
|
|||
CaretBrowsing.isCaretVisible = false;
|
||||
|
||||
/**
|
||||
* selection modes
|
||||
* Selection modes.
|
||||
* NOTE: Values need to line up with SelectionState in browsertab.py!
|
||||
*
|
||||
* @type {enum}
|
||||
*/
|
||||
CaretBrowsing.SelectionState = {
|
||||
"NONE": 1,
|
||||
"NORMAL": 2,
|
||||
"LINE": 3,
|
||||
"NONE": "none",
|
||||
"NORMAL": "normal",
|
||||
"LINE": "line",
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue