Modernizing the results from PR #3683
This commit is contained in:
parent
07b77dd682
commit
205afc28fd
|
|
@ -367,16 +367,16 @@ class BaseKeyParser(QObject):
|
|||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def _set_partial_timeout(self):
|
||||
def _set_partial_timeout(self) -> None:
|
||||
"""Set a timeout to clear a partial keystring."""
|
||||
timeout = config.val.input.partial_timeout
|
||||
if timeout != 0:
|
||||
self._partial_timer.setInterval(timeout)
|
||||
self._partial_timer.timeout.connect(self.clear_partial_match)
|
||||
self._partial_timer.timeout.connect(self._clear_partial_match)
|
||||
self._partial_timer.start()
|
||||
|
||||
@pyqtSlot()
|
||||
def clear_partial_match(self):
|
||||
def _clear_partial_match(self) -> None:
|
||||
"""Clear a partial keystring after a timeout."""
|
||||
self._debug_log("Clearing partial keystring {}".format(
|
||||
self._sequence))
|
||||
|
|
@ -395,7 +395,7 @@ class BaseKeyParser(QObject):
|
|||
self.keystring_updated.emit('')
|
||||
self._partial_timer.stop()
|
||||
try:
|
||||
self._partial_timer.timeout.disconnect(self.clear_partial_match)
|
||||
self._partial_timer.timeout.disconnect(self._clear_partial_match)
|
||||
except TypeError:
|
||||
# no connections
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -66,7 +66,11 @@ class CommandKeyParser(basekeyparser.BaseKeyParser):
|
|||
|
||||
class NormalKeyParser(CommandKeyParser):
|
||||
|
||||
"""KeyParser for normal mode with added STARTCHARS detection and more."""
|
||||
"""KeyParser for normal mode with added STARTCHARS detection and more.
|
||||
|
||||
Attributes:
|
||||
_partial_timer: Timer to clear partial keypresses.
|
||||
"""
|
||||
|
||||
_sequence: keyutils.KeySequence
|
||||
|
||||
|
|
@ -212,19 +216,7 @@ class PassthroughKeyParser(CommandKeyParser):
|
|||
self._orig_sequence = keyutils.KeySequence()
|
||||
|
||||
|
||||
class PromptKeyParser(CommandKeyParser):
|
||||
|
||||
"""KeyParser for yes/no prompts."""
|
||||
|
||||
def __init__(self, win_id, parent=None):
|
||||
super().__init__(win_id, parent, supports_count=False)
|
||||
self._read_config('yesno')
|
||||
|
||||
def __repr__(self):
|
||||
return utils.get_repr(self)
|
||||
|
||||
|
||||
class HintKeyParser(CommandKeyParser):
|
||||
class HintKeyParser(basekeyparser.BaseKeyParser):
|
||||
|
||||
"""KeyChainParser for hints.
|
||||
|
||||
|
|
@ -333,19 +325,6 @@ class HintKeyParser(CommandKeyParser):
|
|||
assert count is None
|
||||
self._hintmanager.handle_partial_key(cmdstr)
|
||||
|
||||
@pyqtSlot()
|
||||
def clear_partial_match(self):
|
||||
"""Override to avoid clearing filter text after a timeout."""
|
||||
if self._last_press != LastPress.filtertext:
|
||||
super().clear_partial_match()
|
||||
|
||||
@pyqtSlot(str)
|
||||
def on_keystring_updated(self, keystr):
|
||||
"""Update hintmanager when the keystring was updated."""
|
||||
hintmanager = objreg.get('hintmanager', scope='tab',
|
||||
window=self._win_id, tab='current')
|
||||
hintmanager.handle_partial_key(keystr)
|
||||
|
||||
|
||||
class RegisterKeyParser(CommandKeyParser):
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue