Ejemplo n.º 1
0
class SearchResultFormatter(object):
    """Formatter of search results."""
    def __init__(self):
        self.style = XHTMLTableStyle(sys.stdout)
        self.nick_colour = NickColourizer()

    def print_prefix(self):
        print self.style.prefix

    def print_html(self, result):
        link = urlescape(result.link)
        if result.event == LogParser.COMMENT:
            nick, text = result.info
            htmlcolour = self.nick_colour[nick]
            self.style.nicktext(result.time, nick, text, htmlcolour, link)
        else:
            if result.event == LogParser.NICKCHANGE:
                text, oldnick, newnick = result.info
                self.nick_colour.change(oldnick, newnick)
            else:
                text = result.info
            self.style.servermsg(result.time, result.event, text, link)

    def print_suffix(self):
        print self.style.suffix
Ejemplo n.º 2
0
class SearchResultFormatter(object):
    """Formatter of search results."""

    def __init__(self):
        self.style = XHTMLTableStyle(sys.stdout)
        self.nick_colour = NickColourizer()

    def print_prefix(self):
        print self.style.prefix

    def print_html(self, result):
        link = urlescape(result.link)
        if result.event == LogParser.COMMENT:
            nick, text = result.info
            htmlcolour = self.nick_colour[nick]
            self.style.nicktext(result.time, nick, text, htmlcolour, link)
        else:
            if result.event == LogParser.NICKCHANGE:
                text, oldnick, newnick = result.info
                self.nick_colour.change(oldnick, newnick)
            else:
                text = result.info
            self.style.servermsg(result.time, result.event, text, link)

    def print_suffix(self):
        print self.style.suffix
Ejemplo n.º 3
0
 def __init__(self):
     self.style = XHTMLTableStyle(sys.stdout)
     self.nick_colour = NickColourizer()
Ejemplo n.º 4
0
 def __init__(self):
     self.style = XHTMLTableStyle(sys.stdout)
     self.nick_colour = NickColourizer()