def clear(self):
        """Clear current state."""
        # Adapted from http://stackoverflow.com/a/13103617/1198772
        for i in reversed(list(range(self.extra_keywords_layout.count()))):
            self.extra_keywords_layout.itemAt(i).widget().setParent(None)
        self.widgets_dict = OrderedDict()
Clear current state.