Ejemplo n.º 1
0
class MiTraceView(QWidget):
    def __init__(self, do, parent):
        QWidget.__init__(self, parent)

        self.ui = Ui_MiTraceView()
        self.ui.setupUi(self)

        self.__do = do

        self.ui.commandEdit.lineEdit().returnPressed.connect(self.executeMiCommand)

        self.__do.gdb_connector.commandExecuted.connect(self.appendCommand)
        self.__do.gdb_connector.reader.asyncRecordReceived.connect(self.appendAsync)

        self.__timeAction = QAction(Icons.time, "Show Elapsed Time", self)
        self.__timeAction.setCheckable(True)
        self.__timeAction.setChecked(True)
        parent.titleBarWidget().addAction(self.__timeAction)

        parent.addClearAction()
        parent.clearRequested.connect(self.ui.traceView.clear)

    def appendCommand(self, cmd, rec, time):
        timestr = "[<i>%.3f</i>] " % time if self.__timeAction.isChecked() else ""
        self.ui.traceView.append("%s<b>%s</b>" % (timestr, cmd))
        color = 'color="#ff3333"' if rec.class_ == GdbOutput.ERROR else ""
        self.ui.traceView.append("<font %s>%s</font>" % (color, rec.raw))

    def appendAsync(self, rec):
        self.ui.traceView.append('<font color="#777777">%s</font>' % rec.raw)

    def executeMiCommand(self):
        cmd = str(self.ui.commandEdit.lineEdit().text())
        self.ui.commandEdit.lineEdit().setText("")
        self.__do.gdb_connector.execute(cmd)
Ejemplo n.º 2
0
    def __init__(self, do, parent):
        QWidget.__init__(self, parent)

        self.ui = Ui_MiTraceView()
        self.ui.setupUi(self)

        self.__do = do

        self.ui.commandEdit.lineEdit().returnPressed.connect(self.executeMiCommand)

        self.__do.gdb_connector.commandExecuted.connect(self.appendCommand)
        self.__do.gdb_connector.reader.asyncRecordReceived.connect(self.appendAsync)

        self.__timeAction = QAction(Icons.time, "Show Elapsed Time", self)
        self.__timeAction.setCheckable(True)
        self.__timeAction.setChecked(True)
        parent.titleBarWidget().addAction(self.__timeAction)

        parent.addClearAction()
        parent.clearRequested.connect(self.ui.traceView.clear)