'Qt Override.
Handle key press events.'

def keyPressEvent(self, event):

    if ((event.key() == Qt.Key_Return) or (event.key() == Qt.Key_Enter)):
        if self.add_current_text_if_valid():
            self.selected()
            self.hide_completer()
    elif (event.key() == Qt.Key_Escape):
        self.set_current_text(self.selected_text)
        self.hide_completer()
    else:
        QComboBox.keyPressEvent(self, event)
