2010-05-11 10:23:19 +00:00
|
|
|
""" reporter used by gui.py """
|
|
|
|
|
|
|
|
import sys
|
|
|
|
|
|
|
|
from pylint.interfaces import IReporter
|
|
|
|
from pylint.reporters import BaseReporter
|
|
|
|
from logilab.common.ureports import TextWriter
|
|
|
|
|
|
|
|
|
|
|
|
class GUIReporter(BaseReporter):
|
|
|
|
"""saves messages"""
|
|
|
|
|
|
|
|
__implements__ = IReporter
|
|
|
|
extension = ''
|
2010-05-12 06:59:15 +00:00
|
|
|
|
2010-05-11 10:23:19 +00:00
|
|
|
def __init__(self, gui, output=sys.stdout):
|
|
|
|
"""init"""
|
|
|
|
BaseReporter.__init__(self, output)
|
|
|
|
self.msgs = []
|
|
|
|
self.gui = gui
|
|
|
|
|
|
|
|
def add_message(self, msg_id, location, msg):
|
|
|
|
"""manage message of different type and in the context of path"""
|
2012-05-15 12:57:49 +00:00
|
|
|
module, obj, line, col_offset = location[1:]
|
2012-09-19 15:15:43 +00:00
|
|
|
sigle = self.make_sigle(msg_id)
|
2010-05-11 10:23:19 +00:00
|
|
|
full_msg = [sigle, module, obj, str(line), msg]
|
|
|
|
self.msgs += [[sigle, module, obj, str(line)]]
|
|
|
|
self.gui.msg_queue.put(full_msg)
|
2010-05-12 06:59:15 +00:00
|
|
|
|
2010-05-11 10:23:19 +00:00
|
|
|
def _display(self, layout):
|
|
|
|
"""launch layouts display"""
|
|
|
|
TextWriter().format(layout, self.out)
|