def METHOD_NAME(self, key, before, after):
    """Internal append_undo function. Emit 'undo-changed' if the undo stack
    now contains a history."""
    self._undo.append((key, before, after))
    if len(self._undo) == 1:
        self.emit('undo-changed', True)