OLD | NEW |
(Empty) | |
| 1 """ reporter used by gui.py """ |
| 2 |
| 3 import sys |
| 4 |
| 5 from pylint.interfaces import IReporter |
| 6 from pylint.reporters import BaseReporter |
| 7 from logilab.common.ureports import TextWriter |
| 8 |
| 9 |
| 10 class GUIReporter(BaseReporter): |
| 11 """saves messages""" |
| 12 |
| 13 __implements__ = IReporter |
| 14 extension = '' |
| 15 |
| 16 def __init__(self, gui, output=sys.stdout): |
| 17 """init""" |
| 18 BaseReporter.__init__(self, output) |
| 19 self.msgs = [] |
| 20 self.gui = gui |
| 21 |
| 22 def add_message(self, msg_id, location, msg): |
| 23 """manage message of different type and in the context of path""" |
| 24 module, obj, line = location[1:] |
| 25 if self.include_ids: |
| 26 sigle = msg_id |
| 27 else: |
| 28 sigle = msg_id[0] |
| 29 |
| 30 full_msg = [sigle, module, obj, str(line), msg] |
| 31 self.msgs += [[sigle, module, obj, str(line)]] |
| 32 self.gui.msg_queue.put(full_msg) |
| 33 |
| 34 def _display(self, layout): |
| 35 """launch layouts display""" |
| 36 TextWriter().format(layout, self.out) |
OLD | NEW |