##// END OF EJS Templates
Fix QtConsole tooltip formatting remove string mangling, and turn on QT wordWrap
Kalibri -
Show More
@@ -1,6 +1,5 b''
1 1 # Standard library imports
2 2 import re
3 import textwrap
4 3 from unicodedata import category
5 4
6 5 # System library imports
@@ -37,6 +36,7 b' class CallTipWidget(QtGui.QLabel):'
37 36 QtGui.QStyle.PM_ToolTipLabelFrameWidth, None, self))
38 37 self.setWindowOpacity(self.style().styleHint(
39 38 QtGui.QStyle.SH_ToolTipLabel_Opacity, None, self, None) / 255.0)
39 self.setWordWrap(True)
40 40
41 41 def eventFilter(self, obj, event):
42 42 """ Reimplemented to hide on certain key presses and on text edit focus
@@ -244,16 +244,6 b' class CallTipWidget(QtGui.QLabel):'
244 244
245 245 def _format_tooltip(self, doc):
246 246 doc = re.sub(r'\033\[(\d|;)+?m', '', doc)
247
248 # make sure a long argument list does not make
249 # the first row overflow the width of the actual tip body
250 rows = doc.split("\n")
251 # An object which is not a callable has '<no docstring>' as doc
252 if len(rows) == 1:
253 return doc
254 max_text_width = max(80, max([len(x) for x in rows[1:]]))
255 rows= textwrap.wrap(rows[0],max_text_width) + rows[1:]
256 doc = "\n".join(rows)
257 247 return doc
258 248
259 249 #------ Signal handlers ----------------------------------------------------
General Comments 0
You need to be logged in to leave comments. Login now