So, I am not sure how much code you really need to see here.
def buildHead(self):
with open(path['chat_styles']+'chat.css', 'r') as f:
css = f.read()
self.head = '<style type="text/css">\n'
self.head += css+'\n'
self.head += '</style>'
def Post(self, msg):
tabIndex = self.parent.center2.chatView.currentIndex()
tabText = str(self.parent.center2.chatView.tabText(tabIndex))
chatTabs = self.parent.center2.chatTabs
chatTabs['Main Room'].chatBuffer.append(msg)
chatTabs['Main Room'].scrollView(self.head, chatTabs[tabText].chatBuffer)
def buildHead(self):
with open(path['chat_styles']+'chat.css', 'r') as f:
css = f.read()
self.head = '<style type="text/css">\n'
self.head += css+'\n'
self.head += '</style>'
def Post(self, msg):
tabIndex = self.parent.center2.chatView.currentIndex()
tabText = str(self.parent.center2.chatView.tabText(tabIndex))
chatTabs = self.parent.center2.chatTabs
chatTabs['Main Room'].chatBuffer.append(msg)
chatTabs['Main Room'].scrollView(self.head, chatTabs[tabText].chatBuffer)
To copy to clipboard, switch view to plain text mode
I build a head that will be the users defined CSS. In this test model I just send the chat to the 'Main Room' tab. The chat messages are placed inside a list called chatBuffer and then the list is put together.
def scrollView(self, message, chatBuffer):
while len(chatBuffer) > 10: chatBuffer.pop(0) # Currently shows only last 10 messages
message += ''.join(chatBuffer)
self.viewFrame.setHtml(message)
self.viewFrame.scroll(0, 1000)
def scrollView(self, message, chatBuffer):
while len(chatBuffer) > 10: chatBuffer.pop(0) # Currently shows only last 10 messages
message += ''.join(chatBuffer)
self.viewFrame.setHtml(message)
self.viewFrame.scroll(0, 1000)
To copy to clipboard, switch view to plain text mode
This allows me the user to create a chat buffer, so 1,000's of lines of chat are not soaking of their memory. Then I set the HTML in the view frame .. and I get raw text. Do you need to see more code?
edit: Just a quick not. Oddly the setHtml works when the data comes from the client itself, but when the data is transmitted over the network it does not. I may still have an error on my end.
Bookmarks