summaryrefslogtreecommitdiff
path: root/reporters/guireporter.py
blob: e69b39714042085248e6912549a7d89d1e006960 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
""" reporter used by gui.py """

import sys

from pylint.interfaces import IReporter
from pylint.reporters import BaseReporter, Message
from logilab.common.ureports import TextWriter


class GUIReporter(BaseReporter):
    """saves messages"""

    __implements__ = IReporter
    extension = ''

    def __init__(self, gui, output=sys.stdout):
        """init"""
        BaseReporter.__init__(self, output)
        self.gui = gui

    def add_message(self, msg_id, location, msg):
        """manage message of different type and in the context of path"""
        # filename, module, obj, line, col_offset = location
        # message = [msg_id[0], msg_id, filename, module, obj, str(line), msg]
        message = Message(self, msg_id, location, msg)
        self.gui.msg_queue.put(message)

    def _display(self, layout):
        """launch layouts display"""
        TextWriter().format(layout, self.out)