class TextGui(QtGui.QMainWindow): def __init__(self, universe): QtGui.QMainWindow.__init__(self) self.Universe = universe self.textWidget = SpeakingTextWidget(self.Universe, "Hauptansicht") self.setCentralWidget(self.textWidget) self.outputHandler = OutputHandler(self.Universe) self.interpreter = Interpreter(self.Universe) self.Universe.Body = self.textWidget def executeCommand(self): command = unicode( self.textWidget.textCursor().block().text().toUtf8() ) print "CALL: ", command self.callTheInterpreter(command) def callTheInterpreter(self, input_value): try: returnvalue, line = self.interpreter.interpreter(input_value) except NoReturnValue: self.Universe.InputLine.clear() else: self.outputHandler.handleReturnValue(input_value, returnvalue, line) def keyPressEvent(self, e): if (e.modifiers() & QtCore.Qt.ControlModifier): if e.key() == QtCore.Qt.Key_J: print "CTRL + ENTER" self.executeCommand() return True
def __init__(self, universe): QtGui.QMainWindow.__init__(self) self.Universe = universe self.textWidget = SpeakingTextWidget(self.Universe, "Hauptansicht") self.setCentralWidget(self.textWidget) self.outputHandler = OutputHandler(self.Universe) self.interpreter = Interpreter(self.Universe) self.Universe.Body = self.textWidget
def outputList(self, returnvalue): return_list = returnvalue.Payload.List metaData_list = returnvalue.Description.List textEdit = SpeakingTextWidget(self.Universe, None)#QtGui.QTextEdit() textEdit.activateSpeak(False) i = -1 for line in return_list: i += 1 textEdit.append(line) try: textEdit.appendDescription(metaData_list[i]) except TypeError: pass textEdit.moveCursor(QtGui.QTextCursor.Start) textEdit.activateSpeak(True) return textEdit
def outputLine(self, returnvalue): lineWidget = SpeakingTextWidget(self.Universe, None) lineWidget.setText(returnvalue.Payload.String) lineWidget.activateSpeak(True) return lineWidget