environment/lib/python2.7/site-packages/IPython/frontend/qt/console/call_tip_widget.py
def show_tip(self, tip):
        """ Attempts to show the specified tip at the current cursor location.
        """
        # Attempt to find the cursor position at which to show the call tip.
        text_edit = self._text_edit
        document = text_edit.document()
        cursor = text_edit.textCursor()
        search_pos = cursor.position() - 1
        self._start_position, _ = self._find_parenthesis(search_pos,
                                                         forward=False)
        if self._start_position == -1:
            return False

        # Set the text and resize the widget accordingly.
        self.setText(tip)
        self.resize(self.sizeHint())

        # Locate and show the widget. Place the tip below the current line
        # unless it would be off the screen.  In that case, decide the best
        # location based trying to minimize the  area that goes off-screen.
        padding = 3 # Distance in pixels between cursor bounds and tip box.
        cursor_rect = text_edit.cursorRect(cursor)
        screen_rect = QtGui.qApp.desktop().screenGeometry(text_edit)
        point = text_edit.mapToGlobal(cursor_rect.bottomRight())
        point.setY(point.y() + padding)
        tip_height = self.size().height()
        tip_width = self.size().width()

        vertical = 'bottom'
        horizontal = 'Right'
        if point.y() + tip_height > screen_rect.height():
            point_ = text_edit.mapToGlobal(cursor_rect.topRight())
            # If tip is still off screen, check if point is in top or bottom
            # half of screen.
            if point_.y() - tip_height < padding:
                # If point is in upper half of screen, show tip below it.
                # otherwise above it.
                if 2*point.y() < screen_rect.height():
                    vertical = 'bottom'
                else:
                    vertical = 'top'
            else:
                vertical = 'top'
        if point.x() + tip_width > screen_rect.width():
            point_ = text_edit.mapToGlobal(cursor_rect.topRight())
            # If tip is still off-screen, check if point is in the right or
            # left half of the screen.
            if point_.x() - tip_width < padding:
                if 2*point.x() < screen_rect.width():
                    horizontal = 'Right'
                else:
                    horizontal = 'Left'
            else:
                horizontal = 'Left'
        pos = getattr(cursor_rect, '%s%s' %(vertical, horizontal))
        point = text_edit.mapToGlobal(pos())
        if vertical == 'top':
            point.setY(point.y() - tip_height - padding)
        if horizontal == 'Left':
            point.setX(point.x() - tip_width - padding)

        self.move(point)
        self.show()
        return True
def show_tip(self, tip):
        # Attempt to find the cursor position at which to show the call tip.
        text_edit = self._text_edit
        document = text_edit.document()
        cursor = text_edit.textCursor()
        search_pos = cursor.position() - 1
        self._start_position, _ = self._find_parenthesis(search_pos,
                                                         forward=False)
        if self._start_position == -1:
            return False

        # Set the text and resize the widget accordingly.
        self.setText(tip)
        self.resize(self.sizeHint())

        # Locate and show the widget. Place the tip below the current line
        # unless it would be off the screen.  In that case, decide the best
        # location based trying to minimize the  area that goes off-screen.
        padding = 3 # Distance in pixels between cursor bounds and tip box.
        cursor_rect = text_edit.cursorRect(cursor)
        screen_rect = QtGui.qApp.desktop().screenGeometry(text_edit)
        point = text_edit.mapToGlobal(cursor_rect.bottomRight())
        point.setY(point.y() + padding)
        tip_height = self.size().height()
        tip_width = self.size().width()

        vertical = 'bottom'
        horizontal = 'Right'
        if point.y() + tip_height > screen_rect.height():
            point_ = text_edit.mapToGlobal(cursor_rect.topRight())
            # If tip is still off screen, check if point is in top or bottom
            # half of screen.
            if point_.y() - tip_height < padding:
                # If point is in upper half of screen, show tip below it.
                # otherwise above it.
                if 2*point.y() < screen_rect.height():
                    vertical = 'bottom'
                else:
                    vertical = 'top'
            else:
                vertical = 'top'
        if point.x() + tip_width > screen_rect.width():
            point_ = text_edit.mapToGlobal(cursor_rect.topRight())
            # If tip is still off-screen, check if point is in the right or
            # left half of the screen.
            if point_.x() - tip_width < padding:
                if 2*point.x() < screen_rect.width():
                    horizontal = 'Right'
                else:
                    horizontal = 'Left'
            else:
                horizontal = 'Left'
        pos = getattr(cursor_rect, '%s%s' %(vertical, horizontal))
        point = text_edit.mapToGlobal(pos())
        if vertical == 'top':
            point.setY(point.y() - tip_height - padding)
        if horizontal == 'Left':
            point.setX(point.x() - tip_width - padding)

        self.move(point)
        self.show()
        return True
def show_tip ( self , tip ) : # Attempt to find the cursor position at which to show the call tip. text_edit = self . _text_edit document = text_edit . document ( ) cursor = text_edit . textCursor ( ) search_pos = cursor . position ( ) - 1 self . _start_position , _ = self . _find_parenthesis ( search_pos , forward = False ) if self . _start_position == - 1 : return False # Set the text and resize the widget accordingly. self . setText ( tip ) self . resize ( self . sizeHint ( ) ) # Locate and show the widget. Place the tip below the current line # unless it would be off the screen.  In that case, decide the best # location based trying to minimize the  area that goes off-screen. padding = 3 # Distance in pixels between cursor bounds and tip box. cursor_rect = text_edit . cursorRect ( cursor ) screen_rect = QtGui . qApp . desktop ( ) . screenGeometry ( text_edit ) point = text_edit . mapToGlobal ( cursor_rect . bottomRight ( ) ) point . setY ( point . y ( ) + padding ) tip_height = self . size ( ) . height ( ) tip_width = self . size ( ) . width ( ) vertical = 'bottom' horizontal = 'Right' if point . y ( ) + tip_height > screen_rect . height ( ) : point_ = text_edit . mapToGlobal ( cursor_rect . topRight ( ) ) # If tip is still off screen, check if point is in top or bottom # half of screen. if point_ . y ( ) - tip_height < padding : # If point is in upper half of screen, show tip below it. # otherwise above it. if 2 * point . y ( ) < screen_rect . height ( ) : vertical = 'bottom' else : vertical = 'top' else : vertical = 'top' if point . x ( ) + tip_width > screen_rect . width ( ) : point_ = text_edit . mapToGlobal ( cursor_rect . topRight ( ) ) # If tip is still off-screen, check if point is in the right or # left half of the screen. if point_ . x ( ) - tip_width < padding : if 2 * point . x ( ) < screen_rect . width ( ) : horizontal = 'Right' else : horizontal = 'Left' else : horizontal = 'Left' pos = getattr ( cursor_rect , '%s%s' % ( vertical , horizontal ) ) point = text_edit . mapToGlobal ( pos ( ) ) if vertical == 'top' : point . setY ( point . y ( ) - tip_height - padding ) if horizontal == 'Left' : point . setX ( point . x ( ) - tip_width - padding ) self . move ( point ) self . show ( ) return True
Attempts to show the specified tip at the current cursor location.
Attempts to show the specified tip at the current cursor location .