Make pylint-gui cope with '--include-ids'. Closes #110838

When pylint's '--include-ids' option is used, the message type is not a single character string but includes the ID as well - change to deal with this when processing messages.

Originally reported at http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=689172

authorOmega Weapon <OmegaPhil+hg@gmail.com>
changeset24a0879de622
branchstable
phasepublic
hiddenno
parent revision#1e005265968f Fix some typos and grammatical errors in the help text
child revision#2096899a1443 pylint-gui: Bind F5 to the run button. Closes #110839
files modified by this revision
ChangeLog
gui.py
# HG changeset patch
# User Omega Weapon <OmegaPhil+hg@gmail.com>
# Date 1352724571 -3600
# Mon Nov 12 13:49:31 2012 +0100
# Branch stable
# Node ID 24a0879de62214c641a64fbdc135426e6dcd3231
# Parent 1e005265968f5cc0d04aad59cea4eddc9c362e6d
Make pylint-gui cope with '--include-ids'. Closes #110838

When pylint's '--include-ids' option is used, the message type is not a
single character string but includes the ID as well - change to deal with
this when processing messages.

Originally reported at http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=689172

diff --git a/ChangeLog b/ChangeLog
@@ -1,9 +1,14 @@
1  ChangeLog for PyLint
2  ====================
3 
4  --
5 +    * #110838: fix pylint-gui crash when include-ids is activated (patch by
6 +      Omega Weapon)
7 +
8 +
9 +--
10      * #106534: add --ignore-imports option to code similarity checking
11        and 'symilar' command line tool (patch by Ry4an Brase)
12 
13      * #104571: check for anomalous backslash escape, introducing new
14        W1401 and W1402 messages (patch by Martin Pool)
diff --git a/gui.py b/gui.py
@@ -316,11 +316,16 @@
15      def refresh_msg_window(self):
16          """refresh the message window with current output"""
17          #clear the window
18          self.lbMessages.delete(0, END)
19          for msg in self.msgs:
20 -            if (self.msg_type_dict.get(msg[0])()):
21 +
22 +            # Obtaining message type (pylint's '--include-ids' appends the
23 +            # ID to this letter, so 1 character long is not guaranteed)
24 +            msg_type = msg[0][0]
25 +
26 +            if (self.msg_type_dict.get(msg_type)()):
27                  msg_str = convert_to_string(msg)
28                  self.lbMessages.insert(END, msg_str)
29                  fg_color = COLORS.get(msg_str[:3], 'black')
30                  self.lbMessages.itemconfigure(END, fg=fg_color)
31 
@@ -344,12 +349,16 @@
32                      return False
33 
34                  #adding message to list of msgs
35                  self.msgs.append(msg)
36 
37 +                # Obtaining message type (pylint's '--include-ids' appends the
38 +                # ID to this letter, so 1 character long is not guaranteed)
39 +                msg_type = msg[0][0]
40 +
41                  #displaying msg if message type is selected in check box
42 -                if (self.msg_type_dict.get(msg[0])()):
43 +                if (self.msg_type_dict.get(msg_type)()):
44                      msg_str = convert_to_string(msg)
45                      self.lbMessages.insert(END, msg_str)
46                      fg_color = COLORS.get(msg_str[:3], 'black')
47                      self.lbMessages.itemconfigure(END, fg=fg_color)
48