summaryrefslogtreecommitdiff
path: root/pylint/reporters/guireporter.py
blob: 5e14586038478ba16dfd828f8b731f0b069f6a9e (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
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/master/COPYING

""" reporter used by gui.py """

import sys

from pylint.interfaces import IReporter
from pylint.reporters import BaseReporter
from pylint.reporters.ureports.text_writer 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 handle_message(self, msg):
        """manage message of different type and in the context of path"""
        self.gui.msg_queue.put(msg)

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