Ejemplo n.º 1
0
 def keyPressEvent(self, event):
     """Del key processing"""
     if event.key() == Qt.Key_Delete:
         event.accept()
         self.__removeItem()
     else:
         QWidget.keyPressEvent(self, event)
Ejemplo n.º 2
0
    def __init__(self, parent):
        QWidget.__init__(self, parent)

        # Margin data is:
        # {lineNo: [(text, tooltip, msgType),...], }
        # line number is 1 based, tooltip and fgColor could be None
        self.__data = {}

        extendInstance(self, MarginBase)
        MarginBase.__init__(self, parent, 'cdm_redirected_io_margin', 0)
        self.setMouseTracking(True)

        skin = GlobalData().skin
        self.__bgColor = skin['marginPaper']
        self.__fgColor = skin['marginColor']  # default

        CDMRedirectedIOMargin.MSG_TYPE_PROPS[IOConsoleMsg.IDE_MESSAGE][1] = \
            skin['ioconsoleMarginIDEMsgColor']
        CDMRedirectedIOMargin.MSG_TYPE_PROPS[IOConsoleMsg.STDOUT_MESSAGE][1] = \
            skin['ioconsoleMarginStdoutColor']
        CDMRedirectedIOMargin.MSG_TYPE_PROPS[IOConsoleMsg.STDERR_MESSAGE][1] = \
            skin['ioconsoleMarginStderrColor']
        CDMRedirectedIOMargin.MSG_TYPE_PROPS[IOConsoleMsg.STDIN_MESSAGE][1] = \
            skin['ioconsoleMarginStdinColor']

        self.__width = self.__calculateWidth()
        self.onTextZoomChanged()

        # The width needs to be re-calculated when the margin is drawn the
        # first time. The problem is that if the widget is not on the screen
        # then the font metrics are not calculated properly and thus the width
        # is not shown right. What I observed is an offset up to 2 pixels.
        self.__firstTime = True
Ejemplo n.º 3
0
    def __init__(self,
                 scriptName,
                 params,
                 reportTime,
                 dataFile,
                 stats,
                 parent=None):
        QWidget.__init__(self, parent)

        self.__dataFile = dataFile
        self.__script = scriptName
        self.__reportTime = reportTime
        self.__params = params
        self.__stats = stats

        project = GlobalData().project
        if project.isLoaded():
            self.__projectPrefix = os.path.dirname(project.fileName)
        else:
            self.__projectPrefix = os.path.dirname(scriptName)
        if not self.__projectPrefix.endswith(os.path.sep):
            self.__projectPrefix += os.path.sep

        self.__createLayout()
        self.__getDiagramLayout()

        self.__viewer.setScene(self.__scene)
Ejemplo n.º 4
0
    def __init__(self, parent):
        QWidget.__init__(self, parent)

        extendInstance(self, MarginBase)
        MarginBase.__init__(self, parent, "cdm_flakes_margin", 1)
        self.setMouseTracking(True)

        self.__messages = {}
        self.__bgColor = GlobalData().skin['flakesMarginPaper']
        self.__noTooltip = True

        self.currentDebugLine = None
        self.excptionLine = None

        self.__marks = {
            self.CURRENT_MARK: [getPixmap('dbgcurrentmarker.png'), 0],
            self.EXC_MARK: [getPixmap('dbgexcptmarker.png'), 0],
            self.FLAKES_MARK: [getPixmap('pyflakesmsgmarker.png'), 0]}

        for item in self.__marks:
            self.__marks[item][1] = self.__marks[item][0].height()
            if self.__marks[item][0].height() != self.__marks[item][0].width():
                logging.error('flakes margin pixmap needs to be square')

        self.myUUID = None
        if hasattr(self._qpart._parent, 'getUUID'):
            self.myUUID = self._qpart._parent.getUUID()

        mainWindow = GlobalData().mainWindow
        editorsManager = mainWindow.editorsManagerWidget.editorsManager
        editorsManager.sigFileTypeChanged.connect(self.__onFileTypeChanged)
        self._qpart.blockCountChanged.connect(self.update)
Ejemplo n.º 5
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)

        self.__results = QStackedWidget(self)

        self.__bufferChangeConnected = False

        # Prepare members for reuse
        self.__noneLabel = QLabel("\nNo results available")

        self.__noneLabel.setFrameShape(QFrame.StyledPanel)
        self.__noneLabel.setAlignment(Qt.AlignHCenter)
        self.__headerFont = self.__noneLabel.font()
        self.__headerFont.setPointSize(self.__headerFont.pointSize() + 4)
        self.__noneLabel.setFont(self.__headerFont)
        self.__noneLabel.setAutoFillBackground(True)
        noneLabelPalette = self.__noneLabel.palette()
        noneLabelPalette.setColor(QPalette.Background,
                                  GlobalData().skin['nolexerPaper'])
        self.__noneLabel.setPalette(noneLabelPalette)

        self.__createLayout(parent)
        self.__updateButtonsStatus()

        GlobalData().project.sigProjectChanged.connect(self.__onProjectChanged)
Ejemplo n.º 6
0
    def __init__(self, parent, debugger):
        QWidget.__init__(self, parent)

        extendInstance(self, MainWindowTabWidgetBase)
        MainWindowTabWidgetBase.__init__(self)

        self.__navigationBar = None
        self.__editor = TextEditor(self, debugger)
        self.__fileName = ""
        self.__shortName = ""

        self.__createLayout()

        self.__editor.redoAvailable.connect(self.__redoAvailable)
        self.__editor.undoAvailable.connect(self.__undoAvailable)
        self.__editor.modificationChanged.connect(self.modificationChanged)
        self.__editor.sigCFlowSyncRequested.connect(self.cflowSyncRequested)
        self.__editor.languageChanged.connect(self.__languageChanged)

        self.__diskModTime = None
        self.__diskSize = None
        self.__reloadDlgShown = False

        self.__debugMode = False

        self.__vcsStatus = None
Ejemplo n.º 7
0
    def __init__(self, editor, parent):
        QWidget.__init__(self, parent)

        # It is always not visible at the beginning because there is no
        # editor content at the start
        self.setVisible(False)

        self.__editor = editor
        self.__parentWidget = parent
        self.__connected = False
        self.__needPathUpdate = False

        self.cflowSettings = getCflowSettings(self)
        self.__displayProps = (self.cflowSettings.hidedocstrings,
                               self.cflowSettings.hidecomments,
                               self.cflowSettings.hideexcepts,
                               Settings()['smartZoom'])

        hLayout = QHBoxLayout()
        hLayout.setContentsMargins(0, 0, 0, 0)
        hLayout.setSpacing(0)

        vLayout = QVBoxLayout()
        vLayout.setContentsMargins(0, 0, 0, 0)
        vLayout.setSpacing(0)

        # Make pylint happy
        self.__toolbar = None
        self.__navBar = None
        self.__cf = None
        self.__canvas = None
        self.__validGroups = []
        self.__allGroupId = set()

        # Create the update timer
        self.__updateTimer = QTimer(self)
        self.__updateTimer.setSingleShot(True)
        self.__updateTimer.timeout.connect(self.process)

        vLayout.addWidget(self.__createNavigationBar())
        vLayout.addWidget(self.__createStackedViews())

        hLayout.addLayout(vLayout)
        hLayout.addWidget(self.__createToolbar())
        self.setLayout(hLayout)

        self.updateSettings()

        # Connect to the change file type signal
        self.__mainWindow = GlobalData().mainWindow
        editorsManager = self.__mainWindow.editorsManagerWidget.editorsManager
        editorsManager.sigFileTypeChanged.connect(self.__onFileTypeChanged)

        Settings().sigHideDocstringsChanged.connect(
            self.__onHideDocstringsChanged)
        Settings().sigHideCommentsChanged.connect(self.__onHideCommentsChanged)
        Settings().sigHideExceptsChanged.connect(self.__onHideExceptsChanged)
        Settings().sigSmartZoomChanged.connect(self.__onSmartZoomChanged)

        self.setSmartZoomLevel(Settings()['smartZoom'])
Ejemplo n.º 8
0
    def __init__(self, debugger, parent=None):
        QWidget.__init__(self, parent)

        self.__debugger = debugger
        self.__createLayout()

        if not Settings()['showThreadViewer']:
            self.__onShowHide(True)
    def __init__(self, parent=None):
        MainWindowTabWidgetBase.__init__(self)
        QWidget.__init__(self, parent)

        self.__viewer = DiagramWidget(self)
        self.__viewer.sigEscapePressed.connect(self.__onEsc)

        self.__createLayout()
Ejemplo n.º 10
0
    def __init__(self, debugger, parent=None):
        QWidget.__init__(self, parent)

        self.__debugger = debugger
        self.__createLayout()

        self.__debugger.sigClientCallTrace.connect(self.__onCallTrace)
        GlobalData().project.sigProjectChanged.connect(self.__onProjectChanged)
Ejemplo n.º 11
0
    def __init__(self, debugger, parent=None):
        QWidget.__init__(self, parent)

        self.__debugger = debugger
        self.currentStack = None
        self.currentFrame = 0
        self.__contextItem = None
        self.__createPopupMenu()
        self.__createLayout()
Ejemplo n.º 12
0
    def __init__(self, procuuid, kind, parent=None):
        QWidget.__init__(self, parent)
        self.procuuid = procuuid
        self.kind = kind    # RUN/DEBUG/PROFILE

        self.__viewer = RedirectedIOConsole(self)
        self.__viewer.sigUserInput.connect(self.__onUserInput)

        self.__createLayout()
Ejemplo n.º 13
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)

        self.__createPopupMenu()
        self.__createLayout()
        self.__ignored = []
        self.__currentItem = None

        GlobalData().project.sigProjectChanged.connect(self.__onProjectChanged)
Ejemplo n.º 14
0
    def __init__(self, ide):
        QWidget.__init__(self)

        self.__ide = ide
        self.__process = None
        self.__args = None

        self.__stdout = ''
        self.__stderr = ''
Ejemplo n.º 15
0
    def __init__(self, parent, ignoredExceptionsViewer):
        QWidget.__init__(self, parent)

        self.__ignoredExceptionsViewer = ignoredExceptionsViewer
        self.__currentItem = None

        self.__createPopupMenu()
        self.__createLayout()

        GlobalData().project.sigProjectChanged.connect(self.__onProjectChanged)
Ejemplo n.º 16
0
    def __init__(self, parent, bpointsModel):
        QWidget.__init__(self, parent)

        self.__currentItem = None
        self.__createLayout(bpointsModel)

        GlobalData().project.sigProjectChanged.connect(self.__onProjectChanged)
        GlobalData().project.sigProjectAboutToUnload.connect(
            self.__onProjectAboutToUnload)
        self.bpointsList.sigSelectionChanged.connect(self.__onSelectionChanged)
        bpointsModel.sigBreakpoinsChanged.connect(self.__onModelChanged)
Ejemplo n.º 17
0
    def __init__(self, debugger, parent=None):
        QWidget.__init__(self, parent)

        self.__debugger = debugger
        self.__browser = VariablesBrowser(debugger, self)
        self.__createLayout()

        self.setTabOrder(self.__browser, self.__execStatement)
        self.setTabOrder(self.__execStatement, self.__execButton)

        self.__updateFilter()
Ejemplo n.º 18
0
    def __init__(self, parent):

        MainWindowTabWidgetBase.__init__(self)
        QWidget.__init__(self, parent)

        self.__viewer = VCSAnnotateViewer(self)
        self.__viewer.sigEscapePressed.connect(self.__onEsc)
        self.__fileName = ""
        self.__shortName = ""

        self.__createLayout()
        self.__viewer.zoomTo(Settings()['zoom'])
Ejemplo n.º 19
0
    def __init__(self, debugger, parent=None):
        QWidget.__init__(self, parent)
        self.__debugger = debugger
        self.__debugger.sigClientLine.connect(self.__onClientLine)
        self.__debugger.sigClientStack.connect(self.onClientStack)
        self.__debugger.sigClientThreadList.connect(self.__onClientThreadList)
        self.__debugger.sigClientVariables.connect(self.__onClientVariables)
        self.__debugger.sigClientVariable.connect(self.__onClientVariable)
        self.__debugger.sigClientThreadSet.connect(self.__onClientThreadSet)

        self.currentStack = None
        self.__createLayout()
Ejemplo n.º 20
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)

        self.__createPopupMenu()
        self.__createLayout()
        self.__ignored = []
        self.__currentItem = None

        GlobalData().project.sigProjectChanged.connect(self.__onProjectChanged)

        if not Settings()['showIgnoredExcViewer']:
            self.__onShowHide(True)
Ejemplo n.º 21
0
    def __init__(self, debugger, parent=None):
        QWidget.__init__(self, parent)

        self.__debugger = debugger
        self.currentStack = None
        self.currentFrame = 0
        self.__contextItem = None
        self.__createPopupMenu()
        self.__createLayout()

        if not Settings()['showStackViewer']:
            self.__onShowHide(True)
Ejemplo n.º 22
0
    def __init__(self, parent, wpointModel):
        QWidget.__init__(self, parent)

        self.__currentItem = None

        self.__createPopupMenu()
        self.__createLayout(wpointModel)

        GlobalData().project.sigProjectChanged.connect(self.__onProjectChanged)

        if Settings()['showWatchPointViewer'] == False:
            self.__onShowHide(True)
Ejemplo n.º 23
0
    def __createLayout(self):
        """Creates the toolbar and layout"""
        # Buttons
        printButton = QAction(getIcon('printer.png'), 'Print', self)
        # printButton.setShortcut('Ctrl+')
        printButton.triggered.connect(self.__onPrint)

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

        fixedSpacer = QWidget()
        fixedSpacer.setFixedHeight(16)

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

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

        zoomResetButton = QAction(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)
Ejemplo n.º 24
0
    def mouseMoveEvent(self, event):
        """Tooltips for the marks"""
        if not self.__noTooltip:
            blockNumber = self._qpart.cursorForPosition(
                event.pos()).blockNumber()
            lineno = blockNumber + 1
            msg = None

            if lineno == self.excptionLine:
                msg = 'Exception line'
            elif lineno == self.currentDebugLine:
                msg = 'Current debugger line'
            elif lineno in self.__messages:
                msg = ''
                for part in self.__messages[lineno]:
                    if msg:
                        msg += '<br/>'
                    msg += escape(part)
                msg = "<p style='white-space:pre'>" + msg + "</p>"

            if msg:
                QToolTip.showText(event.globalPos(), msg)
            else:
                QToolTip.hideText()
        return QWidget.mouseMoveEvent(self, event)
Ejemplo n.º 25
0
    def __createLayout(self):
        """Creates the layout"""
        self.setFixedHeight(24)
        self.__layout = QHBoxLayout(self)
        self.__layout.setContentsMargins(0, 0, 0, 0)

        # Create info icon
        self.__infoIcon = QLabel(self)
        self.__infoIcon.setPixmap(getPixmap('cfunknown.png'))
        self.__layout.addWidget(self.__infoIcon)

        self.__warningsIcon = QLabel(self)
        self.__warningsIcon.setPixmap(getPixmap('cfwarning.png'))
        self.__layout.addWidget(self.__warningsIcon)

        self.clearWarnings()

        labelStylesheet = 'QLabel {' + getLabelStyle(self.__infoIcon) + '}'

        # Create the path label
        self.__pathLabel = QLabel(self)
        self.__pathLabel.setStyleSheet(labelStylesheet)
        self.__pathLabel.setTextFormat(Qt.PlainText)
        self.__pathLabel.setAlignment(Qt.AlignLeft)
        self.__pathLabel.setWordWrap(False)
        self.__pathLabel.setTextInteractionFlags(Qt.NoTextInteraction)
        self.__pathLabel.setSizePolicy(QSizePolicy.Expanding,
                                       QSizePolicy.Fixed)
        self.__layout.addWidget(self.__pathLabel)

        self.__spacer = QWidget()
        self.__spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        self.__spacer.setMinimumWidth(0)
        self.__layout.addWidget(self.__spacer)

        # Create the selection label
        self.__selectionLabel = QLabel(self)
        self.__selectionLabel.setStyleSheet(labelStylesheet)
        self.__selectionLabel.setTextFormat(Qt.PlainText)
        self.__selectionLabel.setAlignment(Qt.AlignCenter)
        self.__selectionLabel.setWordWrap(False)
        self.__selectionLabel.setTextInteractionFlags(Qt.NoTextInteraction)
        self.__selectionLabel.setSizePolicy(QSizePolicy.Fixed,
                                            QSizePolicy.Fixed)
        self.__selectionLabel.setMinimumWidth(40)
        self.__layout.addWidget(self.__selectionLabel)
        self.setSelectionLabel(0, None)
Ejemplo n.º 26
0
    def __init__(self, providerId, results, parameters, searchId, parent):
        QWidget.__init__(self, parent)

        self.__providerId = providerId
        self.__parameters = parameters
        self.searchId = searchId
        self.selectedItem = None
        self.__removeItemButton = parent.removeItemButton

        self.resultsTree = SearchResultsTreeWidget()
        self.resultsTree.itemSelectionChanged.connect(
            self.__selectionChanged)

        self.indicator = HeaderLabel()
        self.providerLabel = HeaderLabel(
            GlobalData().searchProviders[providerId].getName())
        self.providerLabel.setToolTip('Results provider')
        self.timestampLabel = HeaderLabel()
        self.timestampLabel.setToolTip('Search timestamp')

        self.__labelLayout = QHBoxLayout()
        self.__labelLayout.setContentsMargins(0, 0, 0, 0)
        self.__labelLayout.setSpacing(4)
        self.__labelLayout.addWidget(self.indicator)
        self.__labelLayout.addWidget(self.providerLabel)

        # There could be many labels with the search parameters
        for item in GlobalData().searchProviders[providerId].serialize(parameters):
            paramLabel = HeaderFitLabel()
            paramLabel.setText('%s: %s' % item)
            paramLabel.setAlignment(Qt.AlignLeft)
            paramLabel.setSizePolicy(QSizePolicy.Expanding,
                                     QSizePolicy.Fixed)
            self.__labelLayout.addWidget(paramLabel)

        self.__labelLayout.addWidget(self.timestampLabel)

        self.__vLayout = QVBoxLayout()
        self.__vLayout.setContentsMargins(0, 0, 0, 0)
        self.__vLayout.setSpacing(4)
        self.__vLayout.addLayout(self.__labelLayout)
        self.__vLayout.addWidget(self.resultsTree)

        self.setLayout(self.__vLayout)
        self.populate(results)
Ejemplo n.º 27
0
    def __init__(self, parent):
        QWidget.__init__(self, parent)

        extendInstance(self, MarginBase)
        MarginBase.__init__(self, parent, 'cdm_line_number_margin', 0)

        self.__bgColor = GlobalData().skin['marginPaper']
        self.__fgColor = GlobalData().skin['marginColor']

        self.__width = self.__calculateWidth()
        self.onTextZoomChanged()

        # The width needs to be re-calculated when the margin is drawn the
        # first time. The problem is that if the widget is not on the screen
        # then the font metrics are not calculated properly and thus the width
        # is not shown right. What I observed is an offset up to 2 pixels.
        self.__firstTime = True

        self._qpart.blockCountChanged.connect(self.__updateWidth)
Ejemplo n.º 28
0
    def __init__(self, parent, debugger):
        QWidget.__init__(self, parent)

        extendInstance(self, MarginBase)
        MarginBase.__init__(self, parent, "cdm_bpoint_margin", getMarginBits())
        self.setMouseTracking(True)

        self.__debugger = debugger
        self.__breakpoints = {}  # block handle -> Breakpoint instance
        self.__breakableLines = None
        self.__maxBreakpoints = Settings()['maxBreakpoints']
        self.__bgColor = GlobalData().skin['bpointsMarginPaper']

        self.__marks = {
            self.BPOINT_MARK: [getPixmap('dbgbpointmarker.png'), 0],
            self.TMP_BPOINT_MARK: [getPixmap('dbgtmpbpointmarker.png'), 0],
            self.DISABLED_BPOINT_MARK:
            [getPixmap('dbgdisbpointmarker.png'), 0]
        }

        for item in self.__marks:
            self.__marks[item][1] = self.__marks[item][0].height()
            if self.__marks[item][0].height() != self.__marks[item][0].width():
                logging.error('breakpoint margin pixmap needs to be square')

        self.myUUID = None
        if hasattr(self._qpart._parent, 'getUUID'):
            self.myUUID = self._qpart._parent.getUUID()

        mainWindow = GlobalData().mainWindow
        editorsManager = mainWindow.editorsManagerWidget.editorsManager
        editorsManager.sigFileTypeChanged.connect(self.__onFileTypeChanged)

        self.blockClicked.connect(self.__onBlockClicked)

        self._qpart.blockCountChanged.connect(self.__onBlockCountChanged)

        bpointModel = self.__debugger.getBreakPointModel()
        bpointModel.rowsAboutToBeRemoved.connect(self.__deleteBreakPoints)
        bpointModel.sigDataAboutToBeChanged.connect(
            self.__breakPointDataAboutToBeChanged)
        bpointModel.dataChanged.connect(self.__changeBreakPoints)
        bpointModel.rowsInserted.connect(self.__addBreakPoints)
Ejemplo n.º 29
0
    def __init__(self, scriptName, params, reportTime, dataFile, parent=None):
        MainWindowTabWidgetBase.__init__(self)
        QWidget.__init__(self, parent)

        # The same stats object is needed for both - a table and a graph
        # So, parse profile output once and then pass the object further
        stats = pstats.Stats(dataFile)
        stats.calc_callees()

        self.__profTable = ProfileTableViewer(scriptName, params, reportTime,
                                              dataFile, stats, self)
        self.__profGraph = ProfileGraphViewer(scriptName, params, reportTime,
                                              dataFile, stats, self)
        self.__profTable.hide()

        self.__profTable.sigEscapePressed.connect(self.__onEsc)
        self.__profGraph.sigEscapePressed.connect(self.__onEsc)

        self.__createLayout()
Ejemplo n.º 30
0
    def __init__(self, navBar, parent):
        QWidget.__init__(self, parent)
        self.__navBar = navBar

        self.__textEdit = BinViewTextEditor(self)

        self.__summary = HeaderLabel(parent=self)
        self.__summary.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Maximum)
        self.__summary.setMinimumWidth(10)
        self.__summary.setVisible(False)

        vLayout = QVBoxLayout()
        vLayout.setContentsMargins(0, 0, 0, 0)
        vLayout.setSpacing(0)
        vLayout.addWidget(self.__summary)
        vLayout.addWidget(self.__textEdit)

        self.setLayout(vLayout)

        Settings().sigTextZoomChanged.connect(self.onTextZoomChanged)