Ejemplo n.º 1
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.º 2
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.º 3
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.º 4
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.º 5
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.º 6
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.__ccMessages = {}
        self.__bgColor = GlobalData().skin['flakesMarginPaper']
        self.__noTooltip = True

        self.currentDebugLine = None
        self.excptionLine = None

        if not MARKS:
            MARKS[self.CURRENT_MARK] = getPixmap('dbgcurrentmarker.png')
            MARKS[self.EXC_MARK] = getPixmap('dbgexcptmarker.png')
            MARKS[self.FLAKES_MARK] = getPixmap('pyflakesmsgmarker.png')
            MARKS[self.COMPLEXITY_A_MARK] = getPixmap('complexity-a.png')
            MARKS[self.COMPLEXITY_B_MARK] = getPixmap('complexity-b.png')
            MARKS[self.COMPLEXITY_C_MARK] = getPixmap('complexity-c.png')
            MARKS[self.COMPLEXITY_D_MARK] = getPixmap('complexity-d.png')
            MARKS[self.COMPLEXITY_E_MARK] = getPixmap('complexity-e.png')
            MARKS[self.COMPLEXITY_F_MARK] = getPixmap('complexity-f.png')

            for item in MARKS:
                if MARKS[item].height() != MARKS[item].width():
                    logging.error('analysis 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)