<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def key_press_event(self, event):
 """ Directly writes the ascii code of the key to the process' stdin. :retuns: False to prevent the event from being propagated to the parent widget. """

        if event.key() == QtCore.Qt.Key_Return:
            cursor = self.edit.textCursor()
            cursor.movePosition(cursor.EndOfBlock)
            self.edit.setTextCursor(cursor)
        code = _qkey_to_ascii(event)
        if code:
            self.process.writeData(code)
            return False
        return True