Show More
@@ -1,6 +1,5 b'' | |||||
1 | # Standard library imports |
|
1 | # Standard library imports | |
2 | import re |
|
2 | import re | |
3 | import textwrap |
|
|||
4 | from unicodedata import category |
|
3 | from unicodedata import category | |
5 |
|
4 | |||
6 | # System library imports |
|
5 | # System library imports | |
@@ -37,6 +36,7 b' class CallTipWidget(QtGui.QLabel):' | |||||
37 | QtGui.QStyle.PM_ToolTipLabelFrameWidth, None, self)) |
|
36 | QtGui.QStyle.PM_ToolTipLabelFrameWidth, None, self)) | |
38 | self.setWindowOpacity(self.style().styleHint( |
|
37 | self.setWindowOpacity(self.style().styleHint( | |
39 | QtGui.QStyle.SH_ToolTipLabel_Opacity, None, self, None) / 255.0) |
|
38 | QtGui.QStyle.SH_ToolTipLabel_Opacity, None, self, None) / 255.0) | |
|
39 | self.setWordWrap(True) | |||
40 |
|
40 | |||
41 | def eventFilter(self, obj, event): |
|
41 | def eventFilter(self, obj, event): | |
42 | """ Reimplemented to hide on certain key presses and on text edit focus |
|
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 | def _format_tooltip(self, doc): |
|
245 | def _format_tooltip(self, doc): | |
246 | doc = re.sub(r'\033\[(\d|;)+?m', '', doc) |
|
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 | return doc |
|
247 | return doc | |
258 |
|
248 | |||
259 | #------ Signal handlers ---------------------------------------------------- |
|
249 | #------ Signal handlers ---------------------------------------------------- |
General Comments 0
You need to be logged in to leave comments.
Login now