'Add current text to combo box history if valid'

def add_current_text_if_valid(self):

    valid = self.is_valid(self.currentText())
    if (valid or (valid is None)):
        self.add_current_text()
        return True
    else:
        self.set_current_text(self.selected_text)
