def METHOD_NAME(self, state):
    """Connect/disconnect sig_key_pressed signal."""
    if state:
        self.editor.sig_key_pressed.connect(self._on_key_pressed)
    else:
        self.editor.sig_key_pressed.disconnect(self._on_key_pressed)