def __init__(self, config, parent=None): '''Constructor''' QtGui.QTextBrowser.__init__(self, parent) gui.base.OutputText.__init__(self, config) self.formatter = MessageFormatter() self._chat_text = QtCore.QString('') self.setOpenLinks(False) self.anchorClicked.connect(self._on_link_clicked) self.clear()
def __init__(self, config, handler): '''constructor''' TextBox.__init__(self, config) gui.base.OutputText.__init__(self, config) self.formatter = MessageFormatter() self.set_shadow_type(gtk.SHADOW_IN) self._textbox.set_editable(False) self._textbox.set_cursor_visible(False) self.clear()
class OutputText(gui.base.OutputText, TextBox): '''a widget that is used to display the messages on the conversation''' NAME = 'Output Text' DESCRIPTION = _('A widget to display the conversation messages') AUTHOR = 'Mariano Guerra' WEBSITE = 'www.emesene.org' def __init__(self, config, handler): '''constructor''' TextBox.__init__(self, config) gui.base.OutputText.__init__(self, config) self.formatter = MessageFormatter() self.set_shadow_type(gtk.SHADOW_IN) self._textbox.set_editable(False) self._textbox.set_cursor_visible(False) self.clear() def clear(self, source="", target="", target_display="", source_img="", target_img=""): '''clear the content''' TextBox.clear(self) gui.base.OutputText.clear(self) def add_message(self, msg, scroll): if msg.type == "status": msg.message = Plus.msnplus_strip(msg.message) text = self.formatter.format_information(msg.message) else: msg.alias = Plus.msnplus_strip(msg.alias) msg.display_name = Plus.msnplus_strip(msg.display_name) text = self.formatter.format(msg) TextBox.append(self, text, scroll) def update_p2p(self, account, _type, *what): ''' new p2p data has been received (custom emoticons) ''' if _type == 'emoticon': for anchor in self._buffer.widgets.keys(): obj = self._buffer.widgets[anchor] if not isinstance(obj, gtk.Widget): path, tip = obj if path == what[2]: self.add_image_at_anchor(anchor, path, tip)
class ChatOutput(gui.base.OutputText, QtGui.QTextBrowser): '''A widget which displays various messages of a conversation''' NAME = 'Output Text' DESCRIPTION = _('A widget to display the conversation messages') AUTHOR = 'Gabriele "Whisky" Visconti' WEBSITE = '' search_request = QtCore.pyqtSignal(basestring) def __init__(self, config, parent=None): '''Constructor''' QtGui.QTextBrowser.__init__(self, parent) gui.base.OutputText.__init__(self, config) self.formatter = MessageFormatter() self._chat_text = QtCore.QString('') self.setOpenLinks(False) self.anchorClicked.connect(self._on_link_clicked) self.clear() def _on_link_clicked(self, url): href = unicode(url.toString()) if href.startswith("search://"): self.search_request.emit(href) return if not href.startswith("file://"): Desktop.open(href) return def clear(self, source="", target="", target_display="", source_img="", target_img=""): '''clear the content''' QtGui.QTextBrowser.clear(self) self._chat_text = QtCore.QString('') gui.base.OutputText.clear(self) def add_message(self, msg, scroll): if msg.type == "status": msg.message = Plus.msnplus_strip(msg.message) text = self.formatter.format_information(msg.message) else: msg.alias = Plus.msnplus_strip(msg.alias) msg.display_name = Plus.msnplus_strip(msg.display_name) text = self.formatter.format(msg) self._append_to_chat(text, scroll) def _append_to_chat(self, html_string, scroll): '''Method that appends an html string to the chat view''' vert_scroll_bar = self.verticalScrollBar() position = vert_scroll_bar.value() self._chat_text.append(html_string) self.setText(self._chat_text) if scroll: vert_scroll_bar.setValue(vert_scroll_bar.maximum()) else: vert_scroll_bar.setValue(position) def update_p2p(self, account, _type, *what): ''' new p2p data has been received (custom emoticons) ''' #FIXME: pass
class ChatOutput (gui.base.OutputText, QtGui.QTextBrowser): '''A widget which displays various messages of a conversation''' NAME = 'Output Text' DESCRIPTION = _('A widget to display the conversation messages') AUTHOR = 'Gabriele "Whisky" Visconti' WEBSITE = '' search_request = QtCore.pyqtSignal(basestring) def __init__(self, config, parent=None): '''Constructor''' QtGui.QTextBrowser.__init__(self, parent) gui.base.OutputText.__init__(self, config) self.formatter = MessageFormatter() self._chat_text = QtCore.QString('') self.setOpenLinks(False) self.anchorClicked.connect(self._on_link_clicked) self.clear() def _on_link_clicked(self, url): href = unicode(url.toString()) if href.startswith("search://"): self.search_request.emit(href) return if not href.startswith("file://"): Desktop.open(href) return def clear(self, source="", target="", target_display="", source_img="", target_img=""): '''clear the content''' QtGui.QTextBrowser.clear(self) self._chat_text = QtCore.QString('') gui.base.OutputText.clear(self) def add_message(self, msg, scroll): if msg.type == "status": msg.message = Plus.msnplus_strip(msg.message) text = self.formatter.format_information(msg.message) else: msg.alias = Plus.msnplus_strip(msg.alias) msg.display_name = Plus.msnplus_strip(msg.display_name) text = self.formatter.format(msg) self._append_to_chat(text, scroll) def _append_to_chat(self, html_string, scroll): '''Method that appends an html string to the chat view''' vert_scroll_bar = self.verticalScrollBar() position = vert_scroll_bar.value() self._chat_text.append(html_string) self.setText(self._chat_text) if scroll: vert_scroll_bar.setValue(vert_scroll_bar.maximum()) else: vert_scroll_bar.setValue(position) def update_p2p(self, account, _type, *what): ''' new p2p data has been received (custom emoticons) ''' #FIXME: pass