Пример #1
0
    def __createLayout( self ):
        " Helper to create the viewer layout "

        self.funcViewer = FunctionsBrowser()

        # Toolbar part - buttons
        self.definitionButton = QAction(
                PixmapCache().getIcon( 'definition.png' ),
                'Jump to highlighted item definition', self )
        self.definitionButton.triggered.connect( self.__goToDefinition )
        self.findButton = QAction(
                PixmapCache().getIcon( 'findusage.png' ),
                'Find highlighted item occurences', self )
        self.findButton.triggered.connect( self.__findWhereUsed )
        self.copyPathButton = QAction(
                PixmapCache().getIcon( 'copytoclipboard.png' ),
                'Copy path to clipboard', self )
        self.copyPathButton.triggered.connect( self.funcViewer.copyToClipboard )

        self.findNotUsedButton = QAction(
                PixmapCache().getIcon( 'notused.png' ),
                'Unused function analysis', self )
        self.findNotUsedButton.triggered.connect( self.__findNotUsed )
        self.findNotUsedButton.setEnabled( False )

        self.toolbar = QToolBar( self )
        self.toolbar.setMovable( False )
        self.toolbar.setAllowedAreas( Qt.TopToolBarArea )
        self.toolbar.setIconSize( QSize( 16, 16 ) )
        self.toolbar.setFixedHeight( 28 )
        self.toolbar.setContentsMargins( 0, 0, 0, 0 )
        self.toolbar.addAction( self.definitionButton )
        self.toolbar.addAction( self.findButton )
        self.toolbar.addAction( self.copyPathButton )

        filterLabel = QLabel( "  Filter " )
        self.toolbar.addWidget( filterLabel )
        self.filterEdit = CDMComboBox( True, self.toolbar )
        self.filterEdit.setSizePolicy( QSizePolicy.Expanding,
                                       QSizePolicy.Expanding )
        self.filterEdit.lineEdit().setToolTip( "Space separated regular expressions" )
        self.toolbar.addWidget( self.filterEdit )
        self.toolbar.addAction( self.findNotUsedButton )
        self.filterEdit.editTextChanged.connect( self.__filterChanged )
        self.filterEdit.itemAdded.connect( self.__filterItemAdded )
        self.filterEdit.enterClicked.connect( self.__enterInFilter )

        layout = QVBoxLayout()
        layout.setContentsMargins( 0, 0, 0, 0 )
        layout.setSpacing( 0 )
        layout.addWidget( self.toolbar )
        layout.addWidget( self.funcViewer )

        self.setLayout( layout )
        return