def consoleClicked(self): message = self.ui.lineEditConsole.text() self.ui.lineEditConsole.clear() if message != '': self.s.command(message) if len(self.consoleLines) is 0: self.consoleLines = self.s.console(60) newConsoleLines = self.consoleLines else: newConsoleLine = 'poop' searchBack = 0 while newConsoleLine[0] not in self.consoleLines[-2:]: searchBack = searchBack + 1 newConsoleLine = self.s.console(searchBack, 1) newConsoleLines = self.s.console(searchBack) newConsoleLines.pop(0) if len(newConsoleLines) > 0: for line in newConsoleLines: fixedLine = line[5:19] + line[26:] width = self.ui.treeWidgetConsole.columnWidth(0) fixedLine = utils.wordWrap(width-5, fixedLine) a = QtGui.QTreeWidgetItem(self.ui.treeWidgetConsole) a.setText(0, fixedLine) self.ui.treeWidgetConsole.scrollToItem(a) self.consoleLines.extend(newConsoleLines)
def sendMessageClicked(self): message = self.ui.lineEditMessage.text() self.ui.lineEditMessage.clear() if message != '': self.s.message(message) if len(self.chatLines) is 0: self.chatLines = self.s.chat(60) newChatLines = self.chatLines else: newChatLine = 'poop' searchBack = 0 while newChatLine not in self.chatLines[-2:]: searchBack = searchBack + 1 newChatLine = self.s.chat(searchBack, oneLine=True) newChatLines = self.s.chat(searchBack) newChatLines.pop(0) if len(newChatLines) > 0: for line in newChatLines: fixedLine = line[5:19] + line[26:] width = self.ui.treeWidgetChat.columnWidth(0) fixedLine = utils.wordWrap(width-5, fixedLine) a = QtGui.QTreeWidgetItem(self.ui.treeWidgetChat) a.setText(0, fixedLine) self.ui.treeWidgetChat.scrollToItem(a) self.chatLines.extend(newChatLines)
def updateConsoleDisplay(self, consoleLines): for line in consoleLines: fixedLine = line[5:19] + line[26:] width = self.ui.treeWidgetConsole.columnWidth(0) fixedLine = utils.wordWrap(width-5, fixedLine) a = QtGui.QTreeWidgetItem(self.ui.treeWidgetConsole) a.setText(0, fixedLine) if len(consoleLines): self.ui.treeWidgetConsole.scrollToItem(a) self.consoleLines.extend(consoleLines)