def keyPressEvent(self, e): if e.key() == Qt.Key_Escape: if self.finder.hasFocus(): self.view1.setFocus() else: self.finder.setFocus()