def METHOD_NAME(self, watched, event):
    """
    Apply the new path/dataset if the user presses 'enter'
    or clicks outside the path/dataset edit box.
    """
    if event.type() == QEvent.FocusOut or (
        event.type() == QEvent.KeyPress and (event.key() == Qt.Key_Enter or event.key() == Qt.Key_Return)
    ):
        if watched == self.datasetEdit:
            self._applyDataset()
        if watched == self.filepathEdit:
            self._applyFilepath()
    return False