def _handle_single_key(self, e): """Override _handle_single_key to abort if the key is a startchar. Args: e: the KeyPressEvent from Qt. Return: A self.Match member. """ txt = e.text().strip() if self._inhibited: self._debug_log("Ignoring key '{}', because the normal mode is " "currently inhibited.".format(txt)) return self.Match.none if not self._keystring and any(txt == c for c in STARTCHARS): message.set_cmd_text(self._win_id, txt) return self.Match.definitive match = super()._handle_single_key(e) if match == self.Match.partial: timeout = config.get('input', 'partial-timeout') if timeout != 0: self._partial_timer.setInterval(timeout) self._partial_timer.timeout.connect(self._clear_partial_match) self._partial_timer.start() return match
def _preset_cmd_text(self, url): """Preset a commandline text based on a hint URL. Args: url: The URL to open as a QUrl. """ urlstr = url.toDisplayString(QUrl.FullyEncoded) args = self._context.get_args(urlstr) message.set_cmd_text(self._win_id, ' '.join(args))
def preset_cmd_text(self, url, context): """Preset a commandline text based on a hint URL. Args: url: The URL to open as a QUrl. context: The HintContext to use. """ urlstr = url.toDisplayString(QUrl.FullyEncoded) args = context.get_args(urlstr) text = ' '.join(args) if text[0] not in modeparsers.STARTCHARS: raise HintingError("Invalid command text '{}'.".format(text)) message.set_cmd_text(self._win_id, text)
def _handle_single_key(self, e): """Override _handle_single_key to abort if the key is a startchar. Args: e: the KeyPressEvent from Qt. Return: True if event has been handled, False otherwise. """ txt = e.text().strip() if not self._keystring and any(txt == c for c in STARTCHARS): message.set_cmd_text(self._win_id, txt) return True return super()._handle_single_key(e)