Example #1
0
    def flags(self, index):
        if index.column() < BreakpointModel.columnCount(self, None):
            return BreakpointModel.flags(self, index)

        f = Qt.ItemIsSelectable | Qt.ItemIsEnabled

        return f
Example #2
0
    def flags(self, index):
        if index.column() < BreakpointModel.columnCount(self, None):
            return BreakpointModel.flags(self, index)

        f = Qt.ItemIsSelectable | Qt.ItemIsEnabled

        return f
Example #3
0
    def headerData(self, section, orientation, role):
        if section < BreakpointModel.columnCount(self, None):
            return BreakpointModel.headerData(self, section, orientation, role)

        ret = None

        if orientation == Qt.Horizontal:
            if role == Qt.DisplayRole:
                if section == self.columnCount(None) - 1:
                    ret = "Traced Variables"

        return ret
Example #4
0
    def headerData(self, section, orientation, role):
        if section < BreakpointModel.columnCount(self, None):
            return BreakpointModel.headerData(self, section, orientation, role)

        ret = None

        if orientation == Qt.Horizontal:
            if role == Qt.DisplayRole:
                if section == self.columnCount(None) - 1:
                    ret = "Traced Variables"

        return ret
Example #5
0
    def data(self, index, role):
        if index.column() < BreakpointModel.columnCount(self, None):
            return BreakpointModel.data(self, index, role)

        ret = None

        tp = self.breakpoints[index.row()]

        if role == Qt.DisplayRole:
            if index.column() == self.columnCount(None) - 1:
                ret = ", ".join(tp.tracedVariables)

        return ret
Example #6
0
    def data(self, index, role):
        if index.column() < BreakpointModel.columnCount(self, None):
            return BreakpointModel.data(self, index, role)

        ret = None

        tp = self.breakpoints[index.row()]

        if role == Qt.DisplayRole:
            if index.column() == self.columnCount(None) - 1:
                ret = ", ".join(tp.tracedVariables)

        return ret
Example #7
0
    def __init__(self, distributedObjects):
        """ init breakpoint controller and members.
        @param distributedObjects: passing distributed objects
        @note There are following signals: \n
            * insertDockWidgets() : necessary for plugin system\n
            * cleanupModels(): clear Breakpoints\n
        """
        QObject.__init__(self)
        self.distributedObjects = distributedObjects

        self._model = BreakpointModel(self.distributedObjects.gdb_connector)
        self.breakpointView = BreakpointView()

        self.breakpointView.breakpointView.setModel(self._model)

        #register with session manager to save breakpoints
        self.distributedObjects.signalProxy.emitRegisterWithSessionManager(self, "Breakpoints")

        QObject.connect(self.distributedObjects.signalProxy, SIGNAL("insertDockWidgets()"), self.insertDockWidgets)
        QObject.connect(self.distributedObjects.signalProxy, SIGNAL("cleanupModels()"), self._model.clearBreakpoints)
Example #8
0
class BreakpointController(QObject):
    def __init__(self, distributedObjects):
        """ init breakpoint controller and members.
        @param distributedObjects: passing distributed objects
        @note There are following signals: \n
            * insertDockWidgets() : necessary for plugin system\n
            * cleanupModels(): clear Breakpoints\n
        """
        QObject.__init__(self)
        self.distributedObjects = distributedObjects

        self._model = BreakpointModel(self.distributedObjects.gdb_connector)
        self.breakpointView = BreakpointView()

        self.breakpointView.breakpointView.setModel(self._model)

        #register with session manager to save breakpoints
        self.distributedObjects.signalProxy.emitRegisterWithSessionManager(self, "Breakpoints")

        QObject.connect(self.distributedObjects.signalProxy, SIGNAL("insertDockWidgets()"), self.insertDockWidgets)
        QObject.connect(self.distributedObjects.signalProxy, SIGNAL("cleanupModels()"), self._model.clearBreakpoints)

    def insertDockWidgets(self):
        """ needed for plugin system"""
        self.breakpointDock = QDockWidget("Breakpoints")
        self.breakpointDock.setObjectName("BreakpointView")
        self.breakpointDock.setWidget(self.breakpointView)
        self.distributedObjects.signalProxy.addDockWidget(Qt.BottomDockWidgetArea, self.breakpointDock, True)

    def insertBreakpoint(self, file_, line):
        """insert a breakpoint in specified file on specified line
        @param file: (string), full name (incl. path) of file where breakpoint should be inserted
        @param line: (integer), line number where breakpoint should be inserted
        @return: (integer), returns the line as number where the breakpoint finally is inserted
        @note sometimes it is not possible for gdb to insert a breakpoint on specified line because the line is
        empty or has no effect. therefore it is necessary to observe the real line number of inserted breakpoint
        """
        return self._model.insertBreakpoint(file_, line)

    def deleteBreakpoint(self, file_, line):
        """deletes a breakpoint in specified file on specified line
        @param file: (string), full name (incl. path) of file
        @param line: (int), line number where breakpoint should be deleted
        """
        self._model.deleteBreakpoint(file_, line)

    def toggleBreakpoint(self, file_, line):
        """ toggles the breakpoint in file file_ with linenumber line
        @param file_: (string), fullname of file
        @param line: (int), linenumber where the breakpoint should be toggled
        """
        return self._model.toggleBreakpoint(file_, line)

    def getBreakpointsFromModel(self):
        """returns a list of all breakpoints in model
        @return breakpoints: (List<ExtendedBreakpoint>), a list of breakpoints
        """
        return self._model.getBreakpoints()

    def setBreakpointsForModel(self, bpList):
        self._model.setBreakpoints(bpList)

    def saveSession(self, xmlHandler):
        """Insert session info to xml file"""
        bpparent = xmlHandler.createNode("Breakpoints")
        for bp in self._model.getBreakpoints():
            xmlHandler.createNode("Breakpoint", bpparent, {"file": bp.file, "line": bp.line})

    def loadSession(self, xmlHandler):
        """load session info to xml file"""
        bpparent = xmlHandler.getNode("Breakpoints")
        if bpparent != None:
            childnodes = bpparent.childNodes()
            for i in range(childnodes.size()):
                attr = xmlHandler.getAttributes(childnodes.at(i))
                self._model.insertBreakpoint(attr["file"], attr["line"])

    def model(self):
        return self._model
Example #9
0
 def __init__(self, do, parent=None):
     BreakpointModel.__init__(self, do, parent)
     self.do = do
Example #10
0
 def columnCount(self, parent):
     return BreakpointModel.columnCount(self, parent) + 1
Example #11
0
 def __init__(self, do, parent=None):
     BreakpointModel.__init__(self, do, parent)
     self.do = do
Example #12
0
 def columnCount(self, parent):
     return BreakpointModel.columnCount(self, parent) + 1