コード例 #1
0
    def __onShowHide(self, startup=False):
        " Triggered when show/hide button is clicked "
        if startup or self.exceptionsList.isVisible():
            self.exceptionsList.setVisible(False)
            self.__excTypeEdit.setVisible(False)
            self.__addButton.setVisible(False)
            self.__removeButton.setVisible(False)
            self.__removeAllButton.setVisible(False)
            self.__showHideButton.setIcon(PixmapCache().getIcon('more.png'))
            self.__showHideButton.setToolTip("Show ignored exceptions list")

            self.__minH = self.minimumHeight()
            self.__maxH = self.maximumHeight()

            self.setMinimumHeight(self.headerFrame.height())
            self.setMaximumHeight(self.headerFrame.height())

            Settings().showIgnoredExcViewer = False
        else:
            self.exceptionsList.setVisible(True)
            self.__excTypeEdit.setVisible(True)
            self.__addButton.setVisible(True)
            self.__removeButton.setVisible(True)
            self.__removeAllButton.setVisible(True)
            self.__showHideButton.setIcon(PixmapCache().getIcon('less.png'))
            self.__showHideButton.setToolTip("Hide ignored exceptions list")

            self.setMinimumHeight(self.__minH)
            self.setMaximumHeight(self.__maxH)

            Settings().showIgnoredExcViewer = True
        return
コード例 #2
0
    def __init__(self, pluginManager, cdmPlugin, active, category):
        self.plugin = cdmPlugin
        self.active = active
        self.category = category

        name = self.plugin.getName()
        ver = self.plugin.getVersion()
        QTreeWidgetItem.__init__(self, ["", "", "", name, ver])

        if not self.plugin.conflictType in [
                pluginManager.NO_CONFLICT, pluginManager.USER_DISABLED
        ]:
            self.setIcon(CONFLICT_COL,
                         PixmapCache().getIcon('pluginconflict.png'))
            self.setToolTip(CONFLICT_COL, self.plugin.conflictMessage)

        self.setToolTip(STATE_COL, "Enable / disable")
        self.setToolTip(CONFLICT_COL, "Conflict")

        if self.plugin.isUser():
            self.setIcon(TYPE_COL, PixmapCache().getIcon('pluginuser.png'))
            self.setToolTip(TYPE_COL, "User plugin")
        else:
            self.setIcon(TYPE_COL, PixmapCache().getIcon('pluginsystem.png'))
            self.setToolTip(TYPE_COL, "System wide plugin")

        self.setFlags(self.flags() | Qt.ItemIsUserCheckable)
        if active:
            self.setCheckState(STATE_COL, Qt.Checked)
        else:
            self.setCheckState(STATE_COL, Qt.Unchecked)
        return
コード例 #3
0
    def setFlakesResults(label, results, editor):
        """ Displays the appropriate icon:
            - pyflakes has no complains
            - pyflakes found errors """

        if editor is not None:
            editor.clearPyflakesMessages()

        if results:
            # There are complains
            complains = "File checked: there are pyflakes complains<br>"
            for item in results:
                if complains:
                    complains += "<br>"
                msg = item[0]
                lineno = item[1]
                if lineno == -1:
                    # Special case: compilation error
                    complains += PyflakesViewer.__htmlEncode(msg)
                else:
                    complains += "Line " + str( lineno ) + ": " + \
                                 PyflakesViewer.__htmlEncode( msg )
                if editor is not None and lineno != -1:
                    # item[ 1 ] -> lineno, -1 is a special case for the
                    # buffer compilation problems
                    editor.addPyflakesMessage(lineno, msg)
            label.setToolTip(complains.replace(" ", "&nbsp;"))
            label.setPixmap(PixmapCache().getPixmap('flakeserrors.png'))
        else:
            # There are no complains
            label.setToolTip("File checked: no pyflakes complains")
            label.setPixmap(PixmapCache().getPixmap('flakesok.png'))
        return
コード例 #4
0
    def paint(self, painter, option, widget):
        """ Draws a filled rectangle and then adds a title """

        # Hide the dotted outline
        itemOption = QStyleOptionGraphicsItem(option)
        if itemOption.state & QStyle.State_Selected != 0:
            itemOption.state = itemOption.state & ~QStyle.State_Selected

        # Draw the rectangle
        pen = painter.pen()
        pen.setJoinStyle(Qt.RoundJoin)
        painter.setPen(pen)
        QGraphicsRectItem.paint(self, painter, itemOption, widget)

        # Draw text over the rectangle
        font = QFont("Arial", 10)
        painter.setFont(font)
        painter.setPen(QPen(QColor(255, 255, 255)))
        painter.drawText(self.__node.posX - self.__node.width / 2.0,
                         self.__node.posY - self.__node.height / 2.0,
                         self.__node.width, self.__node.height, Qt.AlignCenter,
                         self.__node.label.replace('\\n', '\n'))

        if self.__outside:
            pixmap = PixmapCache().getPixmap("nonprojectentrydgm.png")
            pixmapPosX = self.__node.posX - self.__node.width / 2.0 + 2
            pixmapPosY = self.__node.posY + self.__node.height / 2.0 - \
                         pixmap.height() - 2
            painter.setRenderHint(QPainter.SmoothPixmapTransform)
            painter.drawPixmap(pixmapPosX, pixmapPosY, pixmap)
        return
コード例 #5
0
    def __createLayout(self, parent):
        " Creates the toolbar and layout "

        # Buttons
        self.printButton = QAction(PixmapCache().getIcon('printer.png'),
                                   'Print', self)
        #printButton.setShortcut( 'Ctrl+' )
        self.printButton.triggered.connect(self.__onPrint)
        self.printButton.setVisible(False)

        self.printPreviewButton = QAction(
            PixmapCache().getIcon('printpreview.png'), 'Print preview', self)
        #printPreviewButton.setShortcut( 'Ctrl+' )
        self.printPreviewButton.triggered.connect(self.__onPrintPreview)
        self.printPreviewButton.setVisible(False)

        spacer = QWidget()
        spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)

        self.clearButton = QAction(PixmapCache().getIcon('trash.png'), 'Clear',
                                   self)
        self.clearButton.triggered.connect(self.__clear)

        # The toolbar
        self.toolbar = QToolBar(self)
        self.toolbar.setOrientation(Qt.Vertical)
        self.toolbar.setMovable(False)
        self.toolbar.setAllowedAreas(Qt.RightToolBarArea)
        self.toolbar.setIconSize(QSize(16, 16))
        self.toolbar.setFixedWidth(28)
        self.toolbar.setContentsMargins(0, 0, 0, 0)

        self.toolbar.addAction(self.printPreviewButton)
        self.toolbar.addAction(self.printButton)
        self.toolbar.addWidget(spacer)
        self.toolbar.addAction(self.clearButton)

        self.__resultsTree = FindResultsTreeWidget()
        self.__resultsTree.setAlternatingRowColors(True)
        self.__resultsTree.setRootIsDecorated(True)
        self.__resultsTree.setItemsExpandable(True)
        self.__resultsTree.setUniformRowHeights(True)
        self.__resultsTree.setItemDelegate(NoOutlineHeightDelegate(4))
        headerLabels = ["File name / line", "Text"]
        self.__resultsTree.setHeaderLabels(headerLabels)
        self.__resultsTree.itemActivated.connect(self.__resultActivated)
        self.__resultsTree.itemClicked.connect(self.__resultClicked)
        self.__resultsTree.setMouseTracking(True)
        self.__resultsTree.itemEntered.connect(self.__itemEntered)
        self.__resultsTree.hide()

        self.__hLayout = QHBoxLayout()
        self.__hLayout.setContentsMargins(0, 0, 0, 0)
        self.__hLayout.setSpacing(0)
        self.__hLayout.addWidget(self.toolbar)
        self.__hLayout.addWidget(self.__noneLabel)
        self.__hLayout.addWidget(self.__resultsTree)

        self.setLayout(self.__hLayout)
        return
コード例 #6
0
ファイル: profgraph.py プロジェクト: eaglexmw/codimension
    def paint( self, painter, option, widget ):
        """ Draws a filled rectangle and then adds a title """

        # Hide the dotted outline
        itemOption = QStyleOptionGraphicsItem( option )
        if itemOption.state & QStyle.State_Selected != 0:
            itemOption.state = itemOption.state & ~QStyle.State_Selected

        # Draw the rectangle
        pen = painter.pen()
        pen.setJoinStyle( Qt.RoundJoin )
        painter.setPen( pen )
        QGraphicsRectItem.paint( self, painter, itemOption, widget )

        # Draw text over the rectangle
        font = QFont( "Arial", 10 )
        painter.setFont( font )
        painter.setPen( QPen( QColor( 255, 255, 255 ) ) )
        painter.drawText( self.__node.posX - self.__node.width / 2.0,
                          self.__node.posY - self.__node.height / 2.0,
                          self.__node.width, self.__node.height,
                          Qt.AlignCenter,
                          self.__node.label.replace( '\\n', '\n' ) )

        if self.__outside:
            pixmap = PixmapCache().getPixmap( "nonprojectentrydgm.png" )
            pixmapPosX = self.__node.posX - self.__node.width / 2.0 + 2
            pixmapPosY = self.__node.posY + self.__node.height / 2.0 - \
                         pixmap.height() - 2
            painter.setRenderHint( QPainter.SmoothPixmapTransform )
            painter.drawPixmap( pixmapPosX, pixmapPosY, pixmap )
        return
コード例 #7
0
    def onFileUpdated(self, fileName, uuid):
        " Triggered when the file is updated "
        fileType = detectFileType(fileName)
        if fileType in [PythonFileType, Python3FileType]:
            path = os.path.realpath(fileName)
            info = GlobalData().briefModinfoCache.get(path)
            if info.isOK:
                icon = PixmapCache().getIcon('filepython.png')
            else:
                icon = PixmapCache().getIcon('filepythonbroken.png')

            # For all root items
            for treeItem in self.model().sourceModel().rootItem.childItems:
                self.__walkTreeAndUpdate(treeItem, path, fileType, icon, info)
        elif fileType == CodimensionProjectFileType:
            path = os.path.realpath(fileName)

            # For all root items
            for treeItem in self.model().sourceModel().rootItem.childItems:
                self.__walkTreeAndUpdate(treeItem, path, fileType, None, None)
        elif fileName.endswith(".cgi"):
            path = os.path.realpath(fileName)

            icon = getFileIcon(fileType)
            # For all root items
            for treeItem in self.model().sourceModel().rootItem.childItems:
                self.__walkTreeAndUpdate(treeItem, path, fileType, icon, None)

        return
コード例 #8
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)

        self.__isEmpty = True
        self.__copyAvailable = False
        self.clearButton = None
        self.messages = None
        self.copyButton = None
        self.selectAllButton = None
        self.__createLayout(parent)

        # create the context menu
        self.__menu = QMenu(self)
        self.__selectAllMenuItem = self.__menu.addAction(
            PixmapCache().getIcon('selectall.png'), 'Select All',
            self.messages.selectAll)
        self.__copyMenuItem = self.__menu.addAction(
            PixmapCache().getIcon('copytoclipboard.png'), 'Copy',
            self.messages.copy)
        self.__menu.addSeparator()
        self.__clearMenuItem = self.__menu.addAction(
            PixmapCache().getIcon('trash.png'), 'Clear', self.__clear)

        self.messages.setContextMenuPolicy(Qt.CustomContextMenu)
        self.messages.customContextMenuRequested.connect(
            self.__handleShowContextMenu)
        self.messages.copyAvailable.connect(self.__onCopyAvailable)

        self.cNormalFormat = self.messages.currentCharFormat()
        self.cErrorFormat = self.messages.currentCharFormat()
        self.cErrorFormat.setForeground(QBrush(QColor(Qt.red)))
        self.__updateToolbarButtons()
        return
コード例 #9
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)

        self.__isEmpty = True
        self.__copyAvailable = False
        self.__clearButton = None
        self.__textEdit = None
        self.__header = None
        self.__copyButton = None
        self.__selectAllButton = None
        self.__createLayout(parent)

        # create the context menu
        self.__menu = QMenu(self)
        self.__selectAllMenuItem = self.__menu.addAction(
            PixmapCache().getIcon('selectall.png'), 'Select All',
            self.__textEdit.selectAll)
        self.__copyMenuItem = self.__menu.addAction(
            PixmapCache().getIcon('copytoclipboard.png'), 'Copy',
            self.__textEdit.copy)
        self.__menu.addSeparator()
        self.__clearMenuItem = self.__menu.addAction(
            PixmapCache().getIcon('trash.png'), 'Clear', self.__clear)

        self.__textEdit.setContextMenuPolicy(Qt.CustomContextMenu)
        self.__textEdit.customContextMenuRequested.connect(
            self.__handleShowContextMenu)
        self.__textEdit.copyAvailable.connect(self.__onCopyAvailable)

        self.__updateToolbarButtons()
        return
コード例 #10
0
    def __onShowHide(self, startup=False):
        " Triggered when show/hide button is clicked "
        if startup or self.__wpointsList.isVisible():
            self.__wpointsList.setVisible(False)
            self.__enableButton.setVisible(False)
            self.__jumpToCodeButton.setVisible(False)
            self.__showHideButton.setIcon(PixmapCache().getIcon('more.png'))
            self.__showHideButton.setToolTip("Show watchpoints list")

            self.__minH = self.minimumHeight()
            self.__maxH = self.maximumHeight()

            self.setMinimumHeight(self.headerFrame.height())
            self.setMaximumHeight(self.headerFrame.height())

            Settings().showWatchPointViewer = False
        else:
            self.__wpointsList.setVisible(True)
            self.__enableButton.setVisible(True)
            self.__jumpToCodeButton.setVisible(True)
            self.__showHideButton.setIcon(PixmapCache().getIcon('less.png'))
            self.__showHideButton.setToolTip("Hide watchpoints list")

            self.setMinimumHeight(self.__minH)
            self.setMaximumHeight(self.__maxH)

            Settings().showWatchPointViewer = True
        return
コード例 #11
0
    def __init__(self, parent, classObj):

        TreeViewItem.__init__(self, parent, classObj.getDisplayName())

        self.sourceObj = classObj
        self.itemType = ClassItemType

        self.__updateTooltip()

        if classObj.isPrivate():
            self.icon = PixmapCache().getIcon('class_private.png')
        elif classObj.isProtected():
            self.icon = PixmapCache().getIcon('class_protected.png')
        else:
            self.icon = PixmapCache().getIcon('class.png')

        # Decide if it should be expandable
        if classObj.decorators or \
           classObj.functions or \
           classObj.classes or \
           classObj.classAttributes or \
           classObj.instanceAttributes:
            self.populated = False
            self.lazyPopulation = True
        return
コード例 #12
0
    def paint(self, painter, option, widget):
        """ Draws a filled rectangle and then adds a title """

        # Hide the dotted outline
        itemOption = QStyleOptionGraphicsItem(option)
        if itemOption.state & QStyle.State_Selected != 0:
            itemOption.state = itemOption.state & ~QStyle.State_Selected

        # Draw the rectangle
        QGraphicsRectItem.paint(self, painter, itemOption, widget)

        # Draw text over the rectangle
        font = QFont("Arial", 10)
        painter.setFont(font)
        painter.drawText(self.__node.posX - self.__node.width / 2.0,
                         self.__node.posY - self.__node.height / 2.0,
                         self.__node.width, self.__node.height, Qt.AlignCenter,
                         self.__srcobj.text)

        pixmap = PixmapCache().getPixmap("docstring.png")
        pixmapPosX = self.__node.posX + self.__node.width / 2.0 - \
                     pixmap.width() / 2.0
        pixmapPosY = self.__node.posY - self.__node.height / 2.0 - \
                     pixmap.height() / 2.0
        painter.setRenderHint(QPainter.SmoothPixmapTransform)
        painter.drawPixmap(pixmapPosX, pixmapPosY, pixmap)
        return
コード例 #13
0
    def paint( self, painter, option, widget ):
        """ Draws a filled rectangle and then adds a title """

        # Hide the dotted outline
        itemOption = QStyleOptionGraphicsItem( option )
        if itemOption.state & QStyle.State_Selected != 0:
            itemOption.state = itemOption.state & ~QStyle.State_Selected

        # Draw the rectangle
        QGraphicsRectItem.paint( self, painter, itemOption, widget )

        # Draw text over the rectangle
        font = QFont( "Arial", 10 )
        painter.setFont( font )
        painter.drawText( self.__node.posX - self.__node.width / 2.0,
                          self.__node.posY - self.__node.height / 2.0,
                          self.__node.width, self.__node.height,
                          Qt.AlignCenter, self.__srcobj.text )

        pixmap = PixmapCache().getPixmap( "docstring.png" )
        pixmapPosX = self.__node.posX + self.__node.width / 2.0 - \
                     pixmap.width() / 2.0
        pixmapPosY = self.__node.posY - self.__node.height / 2.0 - \
                     pixmap.height() / 2.0
        painter.setRenderHint( QPainter.SmoothPixmapTransform )
        painter.drawPixmap( pixmapPosX, pixmapPosY, pixmap )
        return
コード例 #14
0
 def __switchView(self, state):
     " Triggered when view is to be switched "
     if state:
         self.__profGraph.hide()
         self.__profTable.show()
         self.__toggleViewButton.setIcon(
             PixmapCache().getIcon('profdgmview.png'))
         self.__toggleViewButton.setToolTip('Switch to diagram view')
         self.__zoomInButton.setEnabled(False)
         self.__zoomOutButton.setEnabled(False)
         self.__zoomResetButton.setEnabled(False)
         self.__togglePathButton.setEnabled(True)
         self.__profTable.setFocus()
     else:
         self.__profTable.hide()
         self.__profGraph.show()
         self.__toggleViewButton.setIcon(
             PixmapCache().getIcon('tableview.png'))
         self.__toggleViewButton.setToolTip('Switch to table view')
         self.__zoomInButton.setEnabled(True)
         self.__zoomOutButton.setEnabled(True)
         self.__zoomResetButton.setEnabled(True)
         self.__togglePathButton.setEnabled(False)
         self.__profGraph.setFocus()
     return
コード例 #15
0
 def setCurrent(self, value):
     """ Mark the current stack frame with an icon if so """
     self.__isCurrent = value
     if value:
         self.setIcon(0, PixmapCache().getIcon('currentframe.png'))
     else:
         self.setIcon(0, PixmapCache().getIcon('empty.png'))
     return
コード例 #16
0
    def setCompleted(self, completed):
        """ Updates the completed flag """

        self.__completed = completed
        if self.__completed:
            self.setIcon(0, PixmapCache().getIcon("taskcompleted.png"))
        else:
            self.setIcon(0, PixmapCache().getIcon("empty.png"))
        return
コード例 #17
0
 def __setIcon(self):
     " Sets the icon depending on access type "
     if self.sourceObj.isPrivate():
         self.icon = PixmapCache().getIcon('attribute_private.png')
     elif self.sourceObj.isProtected():
         self.icon = PixmapCache().getIcon('attribute_protected.png')
     else:
         self.icon = PixmapCache().getIcon('attribute.png')
     return
コード例 #18
0
    def __createLayout(self):
        " Creates the toolbar and layout "

        # Buttons
        printButton = QAction(PixmapCache().getIcon('printer.png'), 'Print',
                              self)
        #printButton.setShortcut( 'Ctrl+' )
        printButton.triggered.connect(self.__onPrint)

        printPreviewButton = QAction( \
                PixmapCache().getIcon( 'printpreview.png' ),
                'Print preview', self )
        #printPreviewButton.setShortcut( 'Ctrl+' )
        printPreviewButton.triggered.connect(self.__onPrintPreview)

        fixedSpacer = QWidget()
        fixedSpacer.setFixedHeight(16)

        zoomInButton = QAction(PixmapCache().getIcon('zoomin.png'),
                               'Zoom in (Ctrl+=)', self)
        zoomInButton.setShortcut('Ctrl+=')
        zoomInButton.triggered.connect(self.onZoomIn)

        zoomOutButton = QAction(PixmapCache().getIcon('zoomout.png'),
                                'Zoom out (Ctrl+-)', self)
        zoomOutButton.setShortcut('Ctrl+-')
        zoomOutButton.triggered.connect(self.onZoomOut)

        zoomResetButton = QAction(PixmapCache().getIcon('zoomreset.png'),
                                  'Zoom reset (Ctrl+0)', self)
        zoomResetButton.setShortcut('Ctrl+0')
        zoomResetButton.triggered.connect(self.onZoomReset)

        # Toolbar
        toolbar = QToolBar(self)
        toolbar.setOrientation(Qt.Vertical)
        toolbar.setMovable(False)
        toolbar.setAllowedAreas(Qt.RightToolBarArea)
        toolbar.setIconSize(QSize(16, 16))
        toolbar.setFixedWidth(28)
        toolbar.setContentsMargins(0, 0, 0, 0)
        #toolbar.addAction( printPreviewButton )
        #toolbar.addAction( printButton )
        #toolbar.addWidget( fixedSpacer )
        toolbar.addAction(zoomInButton)
        toolbar.addAction(zoomOutButton)
        toolbar.addAction(zoomResetButton)

        hLayout = QHBoxLayout()
        hLayout.setContentsMargins(0, 0, 0, 0)
        hLayout.setSpacing(0)
        hLayout.addWidget(self.__viewer)
        hLayout.addWidget(toolbar)

        self.setLayout(hLayout)
        return
コード例 #19
0
    def __createLayout(self):
        " Helper to create the viewer layout "

        self.globalsViewer = GlobalsBrowser()

        # 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.globalsViewer.copyToClipboard)

        self.findNotUsedButton = QAction(PixmapCache().getIcon('notused.png'),
                                         'Unused global variable 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.globalsViewer)

        self.setLayout(layout)
        return
コード例 #20
0
 def __onShowHideIgnored(self):
     if self.__pathToIgnoreView.isVisible():
         self.__pathToIgnoreView.setVisible(False)
         self.__showHideIgnoredButton.setIcon(
             PixmapCache().getIcon('less.png'))
         self.__showHideIgnoredButton.setToolTip("Show ignored path list")
     else:
         self.__pathToIgnoreView.setVisible(True)
         self.__showHideIgnoredButton.setIcon(
             PixmapCache().getIcon('more.png'))
         self.__showHideIgnoredButton.setToolTip("Hide ignored path list")
     return
コード例 #21
0
 def __onShowHideDiff(self):
     if self.__diffViewer.isVisible():
         self.__diffViewer.setVisible(False)
         self.__showHideDiffButton.setIcon(
             PixmapCache().getIcon('less.png'))
         self.__showHideDiffButton.setToolTip("Show diff")
     else:
         self.__diffViewer.setVisible(True)
         self.__showHideDiffButton.setIcon(
             PixmapCache().getIcon('more.png'))
         self.__showHideDiffButton.setToolTip("Hide diff")
     return
コード例 #22
0
    def setCurrent(self, value):
        """ Mark the current thread with an icon if so """
        if self.__isCurrent == value:
            return

        self.__isCurrent = value
        if value:
            self.setIcon(0, PixmapCache().getIcon('currentthread.png'))
        else:
            self.setIcon(0, PixmapCache().getIcon('empty.png'))
        self.__setTooltip()
        return
コード例 #23
0
    def __init__( self, editorsManager, parent = None ):

        QWidget.__init__( self, parent )
        self.editorsManager = editorsManager

        self.__gotoHistory = []

        # Common graphics items
        closeButton = QToolButton( self )
        closeButton.setToolTip( "Click to close the dialog (ESC)" )
        closeButton.setIcon( PixmapCache().getIcon( "close.png" ) )
        closeButton.clicked.connect( self.hide )

        lineLabel = QLabel( self )
        lineLabel.setText( "Goto line:" )

        self.linenumberEdit = QComboBox( self )
        self.linenumberEdit.setEditable( True )
        self.linenumberEdit.setInsertPolicy( QComboBox.InsertAtTop )
        self.linenumberEdit.setAutoCompletion( False )
        self.linenumberEdit.setDuplicatesEnabled( False )
        sizePolicy = QSizePolicy( QSizePolicy.Expanding, QSizePolicy.Fixed )
        sizePolicy.setHorizontalStretch( 0 )
        sizePolicy.setVerticalStretch( 0 )
        sizePolicy.setHeightForWidth(
                self.linenumberEdit.sizePolicy().hasHeightForWidth() )
        self.linenumberEdit.setSizePolicy( sizePolicy )
        self.validator = QIntValidator( 1, 100000, self )
        self.linenumberEdit.setValidator( self.validator )
        self.linenumberEdit.editTextChanged.connect( self.__onEditTextChanged )
        self.linenumberEdit.lineEdit().returnPressed.connect( self.__onEnter )

        self.goButton = QToolButton( self )
        self.goButton.setToolTip( "Click to jump to the line (ENTER)" )
        self.goButton.setIcon( PixmapCache().getIcon( "gotoline.png" ) )
        self.goButton.setFocusPolicy( Qt.NoFocus )
        self.goButton.setEnabled( False )
        self.goButton.clicked.connect( self.__onGo )

        spacer = QWidget()
        spacer.setFixedWidth( 1 )

        horizontalLayout = QHBoxLayout( self )
        horizontalLayout.setMargin( 0 )

        horizontalLayout.addWidget( closeButton )
        horizontalLayout.addWidget( lineLabel )
        horizontalLayout.addWidget( self.linenumberEdit )
        horizontalLayout.addWidget( self.goButton )
        horizontalLayout.addWidget( spacer )
        return
コード例 #24
0
 def __createPopupMenus(self):
     " Generate the popup menu "
     self.menu = QMenu()
     self.__editAct = self.menu.addAction(
         PixmapCache().getIcon('bpprops.png'), "Edit...", self.__editBreak)
     self.__jumpToCodeAct = self.menu.addAction(
         PixmapCache().getIcon('gotoline.png'), "Jump to code",
         self.__showSource)
     self.menu.addSeparator()
     self.__enableAct = self.menu.addAction(
         PixmapCache().getIcon('bpenable.png'), "Enable", self.enableBreak)
     self.__enableAllAct = self.menu.addAction(
         PixmapCache().getIcon('bpenableall.png'), "Enable all",
         self.enableAllBreaks)
     self.menu.addSeparator()
     self.__disableAct = self.menu.addAction(
         PixmapCache().getIcon('bpdisable.png'), "Disable",
         self.disableBreak)
     self.__disableAllAct = self.menu.addAction(
         PixmapCache().getIcon('bpdisableall.png'), "Disable all",
         self.disableAllBreaks)
     self.menu.addSeparator()
     self.__delAct = self.menu.addAction(PixmapCache().getIcon('bpdel.png'),
                                         "Delete", self.deleteBreak)
     self.__delAllAct = self.menu.addAction(
         PixmapCache().getIcon('bpdelall.png'), "Delete all",
         self.deleteAllBreaks)
     return
コード例 #25
0
    def __init__(self, varName, varType, varValue, isGlobal, parent=None):
        QDialog.__init__(self, parent)

        if varName.endswith("."):
            varName = varName[:-1]

        if isGlobal:
            self.setWindowTitle("Global variable '" + varName + "'")
            self.setWindowIcon(PixmapCache().getIcon("globvar.png"))
        else:
            self.setWindowTitle("Local variable '" + varName + "'")
            self.setWindowIcon(PixmapCache().getIcon("locvar.png"))
        self.__createLayout(varName, varType, varValue, isGlobal)
        return
コード例 #26
0
 def __togglePath(self, state):
     " Triggered when full path/file name is switched "
     self.__profTable.togglePath(state)
     if state:
         self.__togglePathButton.setIcon(
             PixmapCache().getIcon('shortpath.png'))
         self.__togglePathButton.setToolTip(
             'Show file names only for item location')
     else:
         self.__togglePathButton.setIcon(
             PixmapCache().getIcon('longpath.png'))
         self.__togglePathButton.setToolTip(
             'Show full paths for item location')
     return
コード例 #27
0
    def __createLayout(self, parent):
        " Helper to create the viewer layout "

        # Messages list area
        self.messages = QPlainTextEdit(parent)
        self.messages.setLineWrapMode(QPlainTextEdit.NoWrap)
        self.messages.setFont(QFont(GlobalData().skin.baseMonoFontFace))
        self.messages.setReadOnly(True)
        self.messages.setMaximumBlockCount(MAX_LINES)

        # Default font size is good enough for most of the systems.
        # 12.0 might be good only in case of the XServer on PC (Xming).
        # self.messages.setFontPointSize( 12.0 )

        # Buttons
        self.selectAllButton = QAction(PixmapCache().getIcon('selectall.png'),
                                       'Select all', self)
        self.selectAllButton.triggered.connect(self.messages.selectAll)
        self.copyButton = QAction(PixmapCache().getIcon('copytoclipboard.png'),
                                  'Copy to clipboard', self)
        self.copyButton.triggered.connect(self.messages.copy)
        spacer = QWidget()
        spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        self.clearButton = QAction(PixmapCache().getIcon('trash.png'),
                                   'Clear all', self)
        self.clearButton.triggered.connect(self.__clear)

        # Toolbar
        self.toolbar = QToolBar()
        self.toolbar.setOrientation(Qt.Vertical)
        self.toolbar.setMovable(False)
        self.toolbar.setAllowedAreas(Qt.LeftToolBarArea)
        self.toolbar.setIconSize(QSize(16, 16))
        self.toolbar.setFixedWidth(28)
        self.toolbar.setContentsMargins(0, 0, 0, 0)
        self.toolbar.addAction(self.selectAllButton)
        self.toolbar.addAction(self.copyButton)
        self.toolbar.addWidget(spacer)
        self.toolbar.addAction(self.clearButton)

        # layout
        layout = QHBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(0)
        layout.addWidget(self.toolbar)
        layout.addWidget(self.messages)

        self.setLayout(layout)
        return
コード例 #28
0
    def __createLayout(self):
        " Creates the toolbar and layout "

        # Buttons
        printButton = QAction(PixmapCache().getIcon('printer.png'), 'Print',
                              self)
        printButton.triggered.connect(self.__onPrint)
        printButton.setEnabled(False)
        printButton.setVisible(False)

        printPreviewButton = QAction(PixmapCache().getIcon('printpreview.png'),
                                     'Print preview', self)
        printPreviewButton.triggered.connect(self.__onPrintPreview)
        printPreviewButton.setEnabled(False)
        printPreviewButton.setVisible(False)

        spacer = QWidget()
        spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)

        self.lineCounterButton = QAction(
            PixmapCache().getIcon('linecounter.png'), 'Line counter', self)
        self.lineCounterButton.triggered.connect(self.onLineCounter)

        # The toolbar
        toolbar = QToolBar(self)
        toolbar.setOrientation(Qt.Vertical)
        toolbar.setMovable(False)
        toolbar.setAllowedAreas(Qt.RightToolBarArea)
        toolbar.setIconSize(QSize(16, 16))
        toolbar.setFixedWidth(28)
        toolbar.setContentsMargins(0, 0, 0, 0)

        toolbar.addAction(printPreviewButton)
        toolbar.addAction(printButton)
        toolbar.addWidget(spacer)
        toolbar.addAction(self.lineCounterButton)

        self.__importsBar = ImportListWidget(self.__viewer)
        self.__importsBar.hide()

        hLayout = QHBoxLayout()
        hLayout.setContentsMargins(0, 0, 0, 0)
        hLayout.setSpacing(0)
        hLayout.addWidget(self.__viewer)
        hLayout.addWidget(toolbar)

        self.setLayout(hLayout)
        return
コード例 #29
0
    def __init__( self, parent = None ):

        ObjectsBrowser.__init__( self, FunctionsBrowserModel(), parent )

        self.setWindowTitle( 'Functions browser' )
        self.setWindowIcon( PixmapCache().getIcon( 'icon.png' ) )
        return
コード例 #30
0
    def __createContextMenu( self ):
        " Creates context menu for the table raws "
        self.__contextMenu = QMenu( self )
        self.__callersMenu = QMenu( "Callers", self )
        self.__outsideCallersMenu = QMenu( "Outside callers", self )
        self.__calleesMenu = QMenu( "Callees", self )
        self.__outsideCalleesMenu = QMenu( "Outside callees", self )
        self.__contextMenu.addMenu( self.__callersMenu )
        self.__contextMenu.addMenu( self.__outsideCallersMenu )
        self.__contextMenu.addSeparator()
        self.__contextMenu.addMenu( self.__calleesMenu )
        self.__contextMenu.addMenu( self.__outsideCalleesMenu )
        self.__contextMenu.addSeparator()
        self.__disasmAct = self.__contextMenu.addAction(
                                    PixmapCache().getIcon( 'disasmmenu.png' ),
                                    "Disassemble", self.__onDisassemble )

        self.__callersMenu.triggered.connect( self.__onCallContextMenu )
        self.__outsideCallersMenu.triggered.connect( self.__onCallContextMenu )
        self.__calleesMenu.triggered.connect( self.__onCallContextMenu )
        self.__outsideCalleesMenu.triggered.connect( self.__onCallContextMenu )

        self.__table.setContextMenuPolicy( Qt.CustomContextMenu )
        self.__table.customContextMenuRequested.connect( self.__showContextMenu )
        return
コード例 #31
0
 def __createPopupMenu(self):
     " Creates the popup menu "
     self.__excptMenu = QMenu()
     self.__removeMenuItem = self.__excptMenu.addAction(
         PixmapCache().getIcon('ignexcptdel.png'),
         "Remove from ignore list", self.__onRemoveFromIgnore)
     return
コード例 #32
0
    def __createLayout(self):
        " Creates the widget layout "

        verticalLayout = QVBoxLayout(self)
        verticalLayout.setContentsMargins(0, 0, 0, 0)
        verticalLayout.setSpacing(0)

        self.headerFrame = QFrame()
        self.headerFrame.setFrameStyle(QFrame.StyledPanel)
        self.headerFrame.setAutoFillBackground(True)
        headerPalette = self.headerFrame.palette()
        headerBackground = headerPalette.color(QPalette.Background)
        headerBackground.setRgb(min(headerBackground.red() + 30, 255),
                                min(headerBackground.green() + 30, 255),
                                min(headerBackground.blue() + 30, 255))
        headerPalette.setColor(QPalette.Background, headerBackground)
        self.headerFrame.setPalette(headerPalette)
        self.headerFrame.setFixedHeight(24)

        self.__threadsLabel = QLabel("Threads")

        expandingSpacer = QSpacerItem(10, 10, QSizePolicy.Expanding)
        fixedSpacer = QSpacerItem(3, 3)

        self.__showHideButton = QToolButton()
        self.__showHideButton.setAutoRaise(True)
        self.__showHideButton.setIcon(PixmapCache().getIcon('less.png'))
        self.__showHideButton.setFixedSize(20, 20)
        self.__showHideButton.setToolTip("Hide threads list")
        self.__showHideButton.setFocusPolicy(Qt.NoFocus)
        self.__showHideButton.clicked.connect(self.__onShowHide)

        headerLayout = QHBoxLayout()
        headerLayout.setContentsMargins(0, 0, 0, 0)
        headerLayout.addSpacerItem(fixedSpacer)
        headerLayout.addWidget(self.__threadsLabel)
        headerLayout.addSpacerItem(expandingSpacer)
        headerLayout.addWidget(self.__showHideButton)
        self.headerFrame.setLayout(headerLayout)

        self.__threadsList = QTreeWidget()
        self.__threadsList.setSortingEnabled(False)
        # I might not need that because of two reasons:
        # - the window has no focus
        # - the window has custom current indicator
        # self.__threadsList.setAlternatingRowColors( True )
        self.__threadsList.setRootIsDecorated(False)
        self.__threadsList.setItemsExpandable(False)
        self.__threadsList.setUniformRowHeights(True)
        self.__threadsList.setSelectionMode(QAbstractItemView.NoSelection)
        self.__threadsList.setSelectionBehavior(QAbstractItemView.SelectRows)
        self.__threadsList.setItemDelegate(NoOutlineHeightDelegate(4))
        self.__threadsList.setFocusPolicy(Qt.NoFocus)

        self.__threadsList.itemClicked.connect(self.__onThreadClicked)
        self.__threadsList.setHeaderLabels(["", "Name", "State", "TID"])

        verticalLayout.addWidget(self.headerFrame)
        verticalLayout.addWidget(self.__threadsList)
        return
コード例 #33
0
    def paint( self, painter, option, widget ):
        """ Draws a filled rectangle and then adds a title """

        # Draw the rectangle
        QGraphicsRectItem.paint( self, painter, option, widget )

        # Draw text over the rectangle
        font = QFont( "Arial", 10 )
        font.setBold( True )
        painter.setFont( font )
        painter.setPen( QPen( QColor( 90, 90, 88 ) ) )
        painter.drawText( self.__node.posX - self.__node.width / 2.0,
                          self.__node.posY - self.__node.height / 2.0,
                          self.__node.width, self.__node.height,
                          Qt.AlignCenter, self.__node.label )

        pixmap = PixmapCache().getPixmap( "binarymod.png" )
        pixmapPosX = self.__node.posX + self.__node.width / 2.0 - \
                     pixmap.width() / 2.0
        pixmapPosY = self.__node.posY - self.__node.height / 2.0 - \
                     pixmap.height() / 2.0
        painter.setRenderHint( QPainter.SmoothPixmapTransform )
        painter.drawPixmap( pixmapPosX, pixmapPosY, pixmap )
        return