def __init__(self, console_widget):
        """ Create a completion widget that is attached to the specified Qt
            text edit widget.
        """
        text_edit = console_widget._control
        assert isinstance(text_edit, (QtGui.QTextEdit, QtGui.QPlainTextEdit))
        super(CompletionWidget, self).__init__()

        self._text_edit = text_edit

        self.setAttribute(QtCore.Qt.WA_StaticContents)
        self.setWindowFlags(QtCore.Qt.ToolTip | QtCore.Qt.WindowStaysOnTopHint)

        # Ensure that the text edit keeps focus when widget is displayed.
        self.setFocusProxy(self._text_edit)

        self.setFrameShadow(QtGui.QFrame.Plain)
        self.setFrameShape(QtGui.QFrame.StyledPanel)

        self.itemActivated.connect(self._complete_current)
def __init__ ( self , console_widget ) : text_edit = console_widget . _control assert isinstance ( text_edit , ( QtGui . QTextEdit , QtGui . QPlainTextEdit ) ) super ( CompletionWidget , self ) . __init__ ( ) self . _text_edit = text_edit self . setAttribute ( QtCore . Qt . WA_StaticContents ) self . setWindowFlags ( QtCore . Qt . ToolTip | QtCore . Qt . WindowStaysOnTopHint ) self . setFocusProxy ( self . _text_edit ) self . setFrameShadow ( QtGui . QFrame . Plain ) self . setFrameShape ( QtGui . QFrame . StyledPanel ) self . itemActivated . connect ( self . _complete_current )
Create a completion widget that is attached to the specified Qt
            text edit widget.